Commit 9b4cd4f8 authored by Saman Sami's avatar Saman Sami Committed by Commit Bot

Ozone/DRM: Remove unnecessary pointer to CrtcController

During the pageflip operation, we only need the CRTC IDs. The
CrtcController objects themselves aren't needed.

Bug: 1034559
Change-Id: I0259e9440a72a8f4e26346e306d4f648d27387fa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2008324Reviewed-by: default avatarMichael Spang <spang@chromium.org>
Commit-Queue: Saman Sami <samans@chromium.org>
Cr-Commit-Position: refs/heads/master@{#733005}
parent d61d862a
...@@ -90,8 +90,8 @@ bool CrtcController::AssignOverlayPlanes(HardwareDisplayPlaneList* plane_list, ...@@ -90,8 +90,8 @@ bool CrtcController::AssignOverlayPlanes(HardwareDisplayPlaneList* plane_list,
return true; return true;
} }
if (!drm_->plane_manager()->AssignOverlayPlanes(plane_list, overlays, crtc_, if (!drm_->plane_manager()->AssignOverlayPlanes(plane_list, overlays,
this)) { crtc_)) {
PLOG(ERROR) << "Failed to assign overlay planes for crtc " << crtc_; PLOG(ERROR) << "Failed to assign overlay planes for crtc " << crtc_;
return false; return false;
} }
......
...@@ -123,6 +123,7 @@ bool HardwareDisplayPlaneAtomic::SetPlaneData( ...@@ -123,6 +123,7 @@ bool HardwareDisplayPlaneAtomic::SetPlaneData(
return false; return false;
} }
crtc_id_ = crtc_id;
return true; return true;
} }
......
...@@ -18,8 +18,6 @@ class Rect; ...@@ -18,8 +18,6 @@ class Rect;
namespace ui { namespace ui {
class CrtcController;
class HardwareDisplayPlaneAtomic : public HardwareDisplayPlane { class HardwareDisplayPlaneAtomic : public HardwareDisplayPlane {
public: public:
HardwareDisplayPlaneAtomic(uint32_t id); HardwareDisplayPlaneAtomic(uint32_t id);
...@@ -37,11 +35,10 @@ class HardwareDisplayPlaneAtomic : public HardwareDisplayPlane { ...@@ -37,11 +35,10 @@ class HardwareDisplayPlaneAtomic : public HardwareDisplayPlane {
bool SetPlaneCtm(drmModeAtomicReq* property_set, uint32_t ctm_blob_id); bool SetPlaneCtm(drmModeAtomicReq* property_set, uint32_t ctm_blob_id);
void set_crtc(CrtcController* crtc) { crtc_ = crtc; } uint32_t crtc_id() { return crtc_id_; }
CrtcController* crtc() const { return crtc_; }
private: private:
CrtcController* crtc_ = nullptr; uint32_t crtc_id_ = 0;
DISALLOW_COPY_AND_ASSIGN(HardwareDisplayPlaneAtomic); DISALLOW_COPY_AND_ASSIGN(HardwareDisplayPlaneAtomic);
}; };
......
...@@ -32,10 +32,8 @@ HardwareDisplayPlaneList::~HardwareDisplayPlaneList() { ...@@ -32,10 +32,8 @@ HardwareDisplayPlaneList::~HardwareDisplayPlaneList() {
} }
HardwareDisplayPlaneList::PageFlipInfo::PageFlipInfo(uint32_t crtc_id, HardwareDisplayPlaneList::PageFlipInfo::PageFlipInfo(uint32_t crtc_id,
uint32_t framebuffer, uint32_t framebuffer)
CrtcController* crtc) : crtc_id(crtc_id), framebuffer(framebuffer) {}
: crtc_id(crtc_id), framebuffer(framebuffer), crtc(crtc) {
}
HardwareDisplayPlaneList::PageFlipInfo::PageFlipInfo( HardwareDisplayPlaneList::PageFlipInfo::PageFlipInfo(
const PageFlipInfo& other) = default; const PageFlipInfo& other) = default;
...@@ -159,8 +157,7 @@ void HardwareDisplayPlaneManager::BeginFrame( ...@@ -159,8 +157,7 @@ void HardwareDisplayPlaneManager::BeginFrame(
bool HardwareDisplayPlaneManager::AssignOverlayPlanes( bool HardwareDisplayPlaneManager::AssignOverlayPlanes(
HardwareDisplayPlaneList* plane_list, HardwareDisplayPlaneList* plane_list,
const DrmOverlayPlaneList& overlay_list, const DrmOverlayPlaneList& overlay_list,
uint32_t crtc_id, uint32_t crtc_id) {
CrtcController* crtc) {
int crtc_index = LookupCrtcIndex(crtc_id); int crtc_index = LookupCrtcIndex(crtc_id);
if (crtc_index < 0) { if (crtc_index < 0) {
LOG(ERROR) << "Cannot find crtc " << crtc_id; LOG(ERROR) << "Cannot find crtc " << crtc_id;
...@@ -193,8 +190,7 @@ bool HardwareDisplayPlaneManager::AssignOverlayPlanes( ...@@ -193,8 +190,7 @@ bool HardwareDisplayPlaneManager::AssignOverlayPlanes(
to_fixed_point(crop_rect.height())); to_fixed_point(crop_rect.height()));
} }
if (!SetPlaneData(plane_list, hw_plane, plane, crtc_id, fixed_point_rect, if (!SetPlaneData(plane_list, hw_plane, plane, crtc_id, fixed_point_rect)) {
crtc)) {
ResetCurrentPlaneList(plane_list); ResetCurrentPlaneList(plane_list);
return false; return false;
} }
......
...@@ -40,13 +40,12 @@ struct HardwareDisplayPlaneList { ...@@ -40,13 +40,12 @@ struct HardwareDisplayPlaneList {
std::vector<HardwareDisplayPlane*> old_plane_list; std::vector<HardwareDisplayPlane*> old_plane_list;
struct PageFlipInfo { struct PageFlipInfo {
PageFlipInfo(uint32_t crtc_id, uint32_t framebuffer, CrtcController* crtc); PageFlipInfo(uint32_t crtc_id, uint32_t framebuffer);
PageFlipInfo(const PageFlipInfo& other); PageFlipInfo(const PageFlipInfo& other);
~PageFlipInfo(); ~PageFlipInfo();
uint32_t crtc_id; uint32_t crtc_id;
uint32_t framebuffer; uint32_t framebuffer;
CrtcController* crtc;
}; };
// In the case of non-atomic operation, this info will be used for // In the case of non-atomic operation, this info will be used for
// pageflipping. // pageflipping.
...@@ -86,8 +85,7 @@ class HardwareDisplayPlaneManager { ...@@ -86,8 +85,7 @@ class HardwareDisplayPlaneManager {
// |crtc_id| will be used. |overlay_list| must be sorted bottom-to-top. // |crtc_id| will be used. |overlay_list| must be sorted bottom-to-top.
virtual bool AssignOverlayPlanes(HardwareDisplayPlaneList* plane_list, virtual bool AssignOverlayPlanes(HardwareDisplayPlaneList* plane_list,
const DrmOverlayPlaneList& overlay_list, const DrmOverlayPlaneList& overlay_list,
uint32_t crtc_id, uint32_t crtc_id);
CrtcController* crtc);
// Commit the plane states in |plane_list|. // Commit the plane states in |plane_list|.
// //
...@@ -173,8 +171,7 @@ class HardwareDisplayPlaneManager { ...@@ -173,8 +171,7 @@ class HardwareDisplayPlaneManager {
HardwareDisplayPlane* hw_plane, HardwareDisplayPlane* hw_plane,
const DrmOverlayPlane& overlay, const DrmOverlayPlane& overlay,
uint32_t crtc_id, uint32_t crtc_id,
const gfx::Rect& src_rect, const gfx::Rect& src_rect) = 0;
CrtcController* crtc) = 0;
virtual std::unique_ptr<HardwareDisplayPlane> CreatePlane(uint32_t plane_id); virtual std::unique_ptr<HardwareDisplayPlane> CreatePlane(uint32_t plane_id);
......
...@@ -77,31 +77,29 @@ bool HardwareDisplayPlaneManagerAtomic::Commit( ...@@ -77,31 +77,29 @@ bool HardwareDisplayPlaneManagerAtomic::Commit(
} }
} }
std::vector<CrtcController*> crtcs; std::vector<uint32_t> crtcs;
for (HardwareDisplayPlane* plane : plane_list->plane_list) { for (HardwareDisplayPlane* plane : plane_list->plane_list) {
HardwareDisplayPlaneAtomic* atomic_plane = HardwareDisplayPlaneAtomic* atomic_plane =
static_cast<HardwareDisplayPlaneAtomic*>(plane); static_cast<HardwareDisplayPlaneAtomic*>(plane);
if (crtcs.empty() || crtcs.back() != atomic_plane->crtc()) if (crtcs.empty() || crtcs.back() != atomic_plane->crtc_id())
crtcs.push_back(atomic_plane->crtc()); crtcs.push_back(atomic_plane->crtc_id());
} }
drmModeAtomicReqPtr request = plane_list->atomic_property_set.get(); drmModeAtomicReqPtr request = plane_list->atomic_property_set.get();
for (auto* const crtc : crtcs) { for (uint32_t crtc : crtcs) {
int idx = LookupCrtcIndex(crtc->crtc()); int idx = LookupCrtcIndex(crtc);
#if defined(COMMIT_PROPERTIES_ON_PAGE_FLIP) #if defined(COMMIT_PROPERTIES_ON_PAGE_FLIP)
// Apply all CRTC properties in the page-flip so we don't block the // Apply all CRTC properties in the page-flip so we don't block the
// swap chain for a vsync. // swap chain for a vsync.
// TODO(dnicoara): See if we can apply these properties async using // TODO(dnicoara): See if we can apply these properties async using
// DRM_MODE_ATOMIC_ASYNC_UPDATE flag when committing. // DRM_MODE_ATOMIC_ASYNC_UPDATE flag when committing.
AddPropertyIfValid(request, crtc->crtc(), AddPropertyIfValid(request, crtc, crtc_state_[idx].properties.degamma_lut);
crtc_state_[idx].properties.degamma_lut); AddPropertyIfValid(request, crtc, crtc_state_[idx].properties.gamma_lut);
AddPropertyIfValid(request, crtc->crtc(), AddPropertyIfValid(request, crtc, crtc_state_[idx].properties.ctm);
crtc_state_[idx].properties.gamma_lut);
AddPropertyIfValid(request, crtc->crtc(), crtc_state_[idx].properties.ctm);
#endif #endif
AddPropertyIfValid(request, crtc->crtc(), AddPropertyIfValid(request, crtc,
crtc_state_[idx].properties.background_color); crtc_state_[idx].properties.background_color);
} }
...@@ -230,8 +228,7 @@ bool HardwareDisplayPlaneManagerAtomic::SetPlaneData( ...@@ -230,8 +228,7 @@ bool HardwareDisplayPlaneManagerAtomic::SetPlaneData(
HardwareDisplayPlane* hw_plane, HardwareDisplayPlane* hw_plane,
const DrmOverlayPlane& overlay, const DrmOverlayPlane& overlay,
uint32_t crtc_id, uint32_t crtc_id,
const gfx::Rect& src_rect, const gfx::Rect& src_rect) {
CrtcController* crtc) {
HardwareDisplayPlaneAtomic* atomic_plane = HardwareDisplayPlaneAtomic* atomic_plane =
static_cast<HardwareDisplayPlaneAtomic*>(hw_plane); static_cast<HardwareDisplayPlaneAtomic*>(hw_plane);
uint32_t framebuffer_id = overlay.enable_blend uint32_t framebuffer_id = overlay.enable_blend
...@@ -256,7 +253,6 @@ bool HardwareDisplayPlaneManagerAtomic::SetPlaneData( ...@@ -256,7 +253,6 @@ bool HardwareDisplayPlaneManagerAtomic::SetPlaneData(
LOG(ERROR) << "Failed to set plane properties"; LOG(ERROR) << "Failed to set plane properties";
return false; return false;
} }
atomic_plane->set_crtc(crtc);
return true; return true;
} }
...@@ -346,7 +342,7 @@ bool HardwareDisplayPlaneManagerAtomic::CommitGammaCorrection( ...@@ -346,7 +342,7 @@ bool HardwareDisplayPlaneManagerAtomic::CommitGammaCorrection(
bool HardwareDisplayPlaneManagerAtomic::AddOutFencePtrProperties( bool HardwareDisplayPlaneManagerAtomic::AddOutFencePtrProperties(
drmModeAtomicReqPtr property_set, drmModeAtomicReqPtr property_set,
const std::vector<CrtcController*>& crtcs, const std::vector<uint32_t>& crtcs,
std::vector<base::ScopedFD>* out_fence_fds, std::vector<base::ScopedFD>* out_fence_fds,
std::vector<base::ScopedFD::Receiver>* out_fence_fd_receivers) { std::vector<base::ScopedFD::Receiver>* out_fence_fd_receivers) {
// Reserve space in vector to ensure no reallocation will take place // Reserve space in vector to ensure no reallocation will take place
...@@ -356,8 +352,8 @@ bool HardwareDisplayPlaneManagerAtomic::AddOutFencePtrProperties( ...@@ -356,8 +352,8 @@ bool HardwareDisplayPlaneManagerAtomic::AddOutFencePtrProperties(
out_fence_fds->reserve(crtcs.size()); out_fence_fds->reserve(crtcs.size());
out_fence_fd_receivers->reserve(crtcs.size()); out_fence_fd_receivers->reserve(crtcs.size());
for (auto* crtc : crtcs) { for (uint32_t crtc : crtcs) {
const auto crtc_index = LookupCrtcIndex(crtc->crtc()); const auto crtc_index = LookupCrtcIndex(crtc);
DCHECK_GE(crtc_index, 0); DCHECK_GE(crtc_index, 0);
const auto out_fence_ptr_id = const auto out_fence_ptr_id =
crtc_state_[crtc_index].properties.out_fence_ptr.id; crtc_state_[crtc_index].properties.out_fence_ptr.id;
...@@ -371,11 +367,11 @@ bool HardwareDisplayPlaneManagerAtomic::AddOutFencePtrProperties( ...@@ -371,11 +367,11 @@ bool HardwareDisplayPlaneManagerAtomic::AddOutFencePtrProperties(
// commit, so we need to ensure that the pointer remains valid // commit, so we need to ensure that the pointer remains valid
// until then. // until then.
int ret = drmModeAtomicAddProperty( int ret = drmModeAtomicAddProperty(
property_set, crtc->crtc(), out_fence_ptr_id, property_set, crtc, out_fence_ptr_id,
reinterpret_cast<uint64_t>(out_fence_fd_receivers->back().get())); reinterpret_cast<uint64_t>(out_fence_fd_receivers->back().get()));
if (ret < 0) { if (ret < 0) {
LOG(ERROR) << "Failed to set OUT_FENCE_PTR property for crtc=" LOG(ERROR) << "Failed to set OUT_FENCE_PTR property for crtc=" << crtc
<< crtc->crtc() << " error=" << -ret; << " error=" << -ret;
out_fence_fd_receivers->pop_back(); out_fence_fd_receivers->pop_back();
out_fence_fds->pop_back(); out_fence_fds->pop_back();
return false; return false;
......
...@@ -38,8 +38,7 @@ class HardwareDisplayPlaneManagerAtomic : public HardwareDisplayPlaneManager { ...@@ -38,8 +38,7 @@ class HardwareDisplayPlaneManagerAtomic : public HardwareDisplayPlaneManager {
HardwareDisplayPlane* hw_plane, HardwareDisplayPlane* hw_plane,
const DrmOverlayPlane& overlay, const DrmOverlayPlane& overlay,
uint32_t crtc_id, uint32_t crtc_id,
const gfx::Rect& src_rect, const gfx::Rect& src_rect) override;
CrtcController* crtc) override;
private: private:
bool InitializePlanes() override; bool InitializePlanes() override;
...@@ -48,7 +47,7 @@ class HardwareDisplayPlaneManagerAtomic : public HardwareDisplayPlaneManager { ...@@ -48,7 +47,7 @@ class HardwareDisplayPlaneManagerAtomic : public HardwareDisplayPlaneManager {
bool CommitGammaCorrection(const CrtcProperties& crtc_props) override; bool CommitGammaCorrection(const CrtcProperties& crtc_props) override;
bool AddOutFencePtrProperties( bool AddOutFencePtrProperties(
drmModeAtomicReqPtr property_set, drmModeAtomicReqPtr property_set,
const std::vector<CrtcController*>& crtcs, const std::vector<uint32_t>& crtcs,
std::vector<base::ScopedFD>* out_fence_fds, std::vector<base::ScopedFD>* out_fence_fds,
std::vector<base::ScopedFD::Receiver>* out_fence_fd_receivers); std::vector<base::ScopedFD::Receiver>* out_fence_fd_receivers);
......
...@@ -178,8 +178,7 @@ bool HardwareDisplayPlaneManagerLegacy::SetPlaneData( ...@@ -178,8 +178,7 @@ bool HardwareDisplayPlaneManagerLegacy::SetPlaneData(
HardwareDisplayPlane* hw_plane, HardwareDisplayPlane* hw_plane,
const DrmOverlayPlane& overlay, const DrmOverlayPlane& overlay,
uint32_t crtc_id, uint32_t crtc_id,
const gfx::Rect& src_rect, const gfx::Rect& src_rect) {
CrtcController* crtc) {
// Legacy modesetting rejects transforms. // Legacy modesetting rejects transforms.
if (overlay.plane_transform != gfx::OVERLAY_TRANSFORM_NONE) if (overlay.plane_transform != gfx::OVERLAY_TRANSFORM_NONE)
return false; return false;
...@@ -188,7 +187,7 @@ bool HardwareDisplayPlaneManagerLegacy::SetPlaneData( ...@@ -188,7 +187,7 @@ bool HardwareDisplayPlaneManagerLegacy::SetPlaneData(
plane_list->legacy_page_flips.back().crtc_id != crtc_id) { plane_list->legacy_page_flips.back().crtc_id != crtc_id) {
plane_list->legacy_page_flips.push_back( plane_list->legacy_page_flips.push_back(
HardwareDisplayPlaneList::PageFlipInfo( HardwareDisplayPlaneList::PageFlipInfo(
crtc_id, overlay.buffer->opaque_framebuffer_id(), crtc)); crtc_id, overlay.buffer->opaque_framebuffer_id()));
} else { } else {
return false; return false;
} }
......
...@@ -41,8 +41,7 @@ class HardwareDisplayPlaneManagerLegacy : public HardwareDisplayPlaneManager { ...@@ -41,8 +41,7 @@ class HardwareDisplayPlaneManagerLegacy : public HardwareDisplayPlaneManager {
HardwareDisplayPlane* hw_plane, HardwareDisplayPlane* hw_plane,
const DrmOverlayPlane& overlay, const DrmOverlayPlane& overlay,
uint32_t crtc_id, uint32_t crtc_id,
const gfx::Rect& src_rect, const gfx::Rect& src_rect) override;
CrtcController* crtc) override;
bool IsCompatible(HardwareDisplayPlane* plane, bool IsCompatible(HardwareDisplayPlane* plane,
const DrmOverlayPlane& overlay, const DrmOverlayPlane& overlay,
uint32_t crtc_index) const override; uint32_t crtc_index) const override;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment