drm_hwcomposer: Start making HwcDisplay const in Backend
Add some const correctness to HwcDisplay. Narrow the public interface of HwcDisplay to avoid exposing non-const members unnecessarily. Change-Id: I691c9e0025065085ca1e2045bb1d6614535fdbdc
This commit is contained in:
parent
67a09e278f
commit
a9e13211a6
4 changed files with 17 additions and 15 deletions
|
|
@ -131,7 +131,7 @@ Backend::ValidatedComposition Backend::GetFlattenedComposition(
|
|||
}
|
||||
|
||||
std::tuple<size_t, size_t> Backend::GetClientLayers(
|
||||
HwcDisplay* display, const std::vector<const HwcLayer*>& layers,
|
||||
const HwcDisplay* display, const std::vector<const HwcLayer*>& layers,
|
||||
bool use_cursor_plane) {
|
||||
size_t client_start = 0;
|
||||
size_t client_size = 0;
|
||||
|
|
@ -149,11 +149,11 @@ std::tuple<size_t, size_t> Backend::GetClientLayers(
|
|||
use_cursor_plane);
|
||||
}
|
||||
|
||||
bool Backend::IsClientLayer(HwcDisplay* display, const HwcLayer* layer) {
|
||||
bool Backend::IsClientLayer(const HwcDisplay* display, const HwcLayer* layer) {
|
||||
return !HardwareSupportsLayerType(layer->GetSfType()) ||
|
||||
!layer->IsLayerUsableAsDevice() || display->CtmByGpu() ||
|
||||
(layer->GetLayerData().pi.RequireScalingOrPhasing() &&
|
||||
display->GetHwc()->GetResMan().ForcedScalingWithGpu());
|
||||
display->ForcedScalingWithGpu());
|
||||
}
|
||||
|
||||
bool Backend::HardwareSupportsLayerType(CompositionType comp_type) {
|
||||
|
|
@ -201,7 +201,7 @@ auto Backend::GetCompositionTypes(const std::vector<const HwcLayer*>& layers,
|
|||
}
|
||||
|
||||
std::tuple<size_t, size_t> Backend::GetExtraClientRange(
|
||||
HwcDisplay* display, const std::vector<const HwcLayer*>& layers,
|
||||
const HwcDisplay* display, const std::vector<const HwcLayer*>& layers,
|
||||
size_t client_start, size_t client_size, bool use_cursor_plane) {
|
||||
size_t avail_planes = display->GetPipe().GetUsablePlanes().first.size();
|
||||
size_t layers_size = layers.size();
|
||||
|
|
|
|||
|
|
@ -45,9 +45,9 @@ class Backend {
|
|||
virtual ~Backend() = default;
|
||||
virtual ValidatedComposition ValidateDisplay(HwcDisplay* display);
|
||||
virtual std::tuple<size_t, size_t> GetClientLayers(
|
||||
HwcDisplay* display, const std::vector<const HwcLayer*>& layers,
|
||||
const HwcDisplay* display, const std::vector<const HwcLayer*>& layers,
|
||||
bool use_cursor_plane);
|
||||
virtual bool IsClientLayer(HwcDisplay* display, const HwcLayer* layer);
|
||||
virtual bool IsClientLayer(const HwcDisplay* display, const HwcLayer* layer);
|
||||
|
||||
protected:
|
||||
static ValidatedComposition GetFlattenedComposition(
|
||||
|
|
@ -60,7 +60,7 @@ class Backend {
|
|||
const std::vector<const HwcLayer*>& layers, size_t client_first_z,
|
||||
size_t client_size, bool use_cursor_plane);
|
||||
static std::tuple<size_t, size_t> GetExtraClientRange(
|
||||
HwcDisplay* display, const std::vector<const HwcLayer*>& layers,
|
||||
const HwcDisplay* display, const std::vector<const HwcLayer*>& layers,
|
||||
size_t client_start, size_t client_size, bool use_cursor_plane);
|
||||
};
|
||||
} // namespace android
|
||||
|
|
|
|||
|
|
@ -465,7 +465,7 @@ auto HwcDisplay::GetDisplayType() -> DisplayType {
|
|||
return kInternal;
|
||||
}
|
||||
|
||||
auto displays = GetHwc()->GetResMan().GetInternalDisplayNames();
|
||||
auto displays = hwc_->GetResMan().GetInternalDisplayNames();
|
||||
if (!displays.empty()) {
|
||||
std::string name = GetPipe().connector->Get()->GetName();
|
||||
const bool is_internal = (displays.find(name) != displays.end());
|
||||
|
|
@ -970,19 +970,23 @@ void HwcDisplay::ApplyCommitChanges(const AtomicCommitArgs &a_args) {
|
|||
}
|
||||
}
|
||||
|
||||
bool HwcDisplay::CtmByGpu() {
|
||||
bool HwcDisplay::CtmByGpu() const {
|
||||
if (color_transform_is_identity_)
|
||||
return false;
|
||||
|
||||
if (GetPipe().crtc->Get()->GetCtmProperty() && !ctm_has_offset_)
|
||||
return false;
|
||||
|
||||
if (GetHwc()->GetResMan().GetCtmHandling() == CtmHandling::kDrmOrIgnore)
|
||||
if (hwc_->GetResMan().GetCtmHandling() == CtmHandling::kDrmOrIgnore)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool HwcDisplay::ForcedScalingWithGpu() const {
|
||||
return hwc_->GetResMan().ForcedScalingWithGpu();
|
||||
}
|
||||
|
||||
bool HwcDisplay::IsWritebackSupported() {
|
||||
if (IsInHeadlessMode()) {
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -175,10 +175,6 @@ class HwcDisplay {
|
|||
const Backend *backend() const;
|
||||
void set_backend(std::unique_ptr<Backend> backend);
|
||||
|
||||
auto GetHwc() {
|
||||
return hwc_;
|
||||
}
|
||||
|
||||
auto layers() -> std::map<ILayerId, HwcLayer> & {
|
||||
return layers_;
|
||||
}
|
||||
|
|
@ -195,7 +191,9 @@ class HwcDisplay {
|
|||
return *pipeline_;
|
||||
}
|
||||
|
||||
bool CtmByGpu();
|
||||
bool CtmByGpu() const;
|
||||
|
||||
bool ForcedScalingWithGpu() const;
|
||||
|
||||
CompositionStats &total_stats() {
|
||||
return total_stats_;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue