The CalcPixOps is used only for display validation which is implemented
in the generic backend.
Signed-off-by: Matvii Zorin <matvii.zorin@globallogic.com>
return HWC2::Error::None;
}
return HWC2::Error::None;
}
-uint32_t DrmHwcTwo::HwcDisplay::CalcPixOps(
- std::map<uint32_t, DrmHwcTwo::HwcLayer *> &z_map, size_t first_z,
- size_t size) {
- uint32_t pixops = 0;
- for (std::pair<const uint32_t, DrmHwcTwo::HwcLayer *> &l : z_map) {
- if (l.first >= first_z && l.first < first_z + size) {
- hwc_rect_t df = l.second->display_frame();
- pixops += (df.right - df.left) * (df.bottom - df.top);
- }
- }
- return pixops;
-}
-
void DrmHwcTwo::HwcDisplay::MarkValidated(
std::map<uint32_t, DrmHwcTwo::HwcLayer *> &z_map, size_t client_first_z,
size_t client_size) {
void DrmHwcTwo::HwcDisplay::MarkValidated(
std::map<uint32_t, DrmHwcTwo::HwcLayer *> &z_map, size_t client_first_z,
size_t client_size) {
hwc2_function_pointer_t func);
HWC2::Error CreateComposition(bool test);
bool HardwareSupportsLayerType(HWC2::Composition comp_type);
hwc2_function_pointer_t func);
HWC2::Error CreateComposition(bool test);
bool HardwareSupportsLayerType(HWC2::Composition comp_type);
- uint32_t CalcPixOps(std::map<uint32_t, DrmHwcTwo::HwcLayer *> &z_map,
- size_t first_z, size_t size);
void MarkValidated(std::map<uint32_t, DrmHwcTwo::HwcLayer *> &z_map,
size_t client_first_z, size_t client_size);
void MarkValidated(std::map<uint32_t, DrmHwcTwo::HwcLayer *> &z_map,
size_t client_first_z, size_t client_size);
for (std::pair<const uint32_t, DrmHwcTwo::HwcLayer *> &l : z_map_tmp)
z_map.emplace(std::make_pair(z_index++, l.second));
for (std::pair<const uint32_t, DrmHwcTwo::HwcLayer *> &l : z_map_tmp)
z_map.emplace(std::make_pair(z_index++, l.second));
- uint32_t total_pixops = display->CalcPixOps(z_map, 0, z_map.size());
+ uint32_t total_pixops = CalcPixOps(z_map, 0, z_map.size());
uint32_t gpu_pixops = 0;
int client_start = -1;
uint32_t gpu_pixops = 0;
int client_start = -1;
gpu_pixops = INT_MAX;
for (int i = 0; i < steps; i++) {
gpu_pixops = INT_MAX;
for (int i = 0; i < steps; i++) {
- uint32_t po = display->CalcPixOps(z_map, start + i, client_size);
+ uint32_t po = CalcPixOps(z_map, start + i, client_size);
if (po < gpu_pixops) {
gpu_pixops = po;
client_start = start + i;
if (po < gpu_pixops) {
gpu_pixops = po;
client_start = start + i;
display->resource_manager()->ForcedScalingWithGpu());
}
display->resource_manager()->ForcedScalingWithGpu());
}
+uint32_t Backend::CalcPixOps(const std::vector<DrmHwcTwo::HwcLayer *> &layers,
+ size_t first_z, size_t size) {
+ uint32_t pixops = 0;
+ for (auto & [ z_order, layer ] : z_map) {
+ if (z_order >= first_z && z_order < first_z + size) {
+ hwc_rect_t df = layer->display_frame();
+ pixops += (df.right - df.left) * (df.bottom - df.top);
+ }
+ }
+ return pixops;
+}
+
// clang-format off
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables, cert-err58-cpp)
REGISTER_BACKEND("generic", Backend);
// clang-format off
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables, cert-err58-cpp)
REGISTER_BACKEND("generic", Backend);
const std::map<uint32_t, DrmHwcTwo::HwcLayer *> &z_map);
virtual bool IsClientLayer(DrmHwcTwo::HwcDisplay *display,
DrmHwcTwo::HwcLayer *layer);
const std::map<uint32_t, DrmHwcTwo::HwcLayer *> &z_map);
virtual bool IsClientLayer(DrmHwcTwo::HwcDisplay *display,
DrmHwcTwo::HwcLayer *layer);
+
+ protected:
+ uint32_t CalcPixOps(const std::map<uint32_t, DrmHwcTwo::HwcLayer *> &z_map,
+ size_t first_z, size_t size);
};
} // namespace android
};
} // namespace android