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