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;
......
...@@ -173,13 +173,12 @@ void HardwareDisplayPlaneManagerTest::PerformPageFlip( ...@@ -173,13 +173,12 @@ void HardwareDisplayPlaneManagerTest::PerformPageFlip(
size_t crtc_idx, size_t crtc_idx,
ui::HardwareDisplayPlaneList* state) { ui::HardwareDisplayPlaneList* state) {
ui::DrmOverlayPlaneList assigns; ui::DrmOverlayPlaneList assigns;
ui::CrtcController crtc(fake_drm_, crtc_properties_[crtc_idx].id, 0);
scoped_refptr<ui::DrmFramebuffer> xrgb_buffer = scoped_refptr<ui::DrmFramebuffer> xrgb_buffer =
CreateBuffer(kDefaultBufferSize); CreateBuffer(kDefaultBufferSize);
assigns.push_back(ui::DrmOverlayPlane(xrgb_buffer, nullptr)); assigns.push_back(ui::DrmOverlayPlane(xrgb_buffer, nullptr));
fake_drm_->plane_manager()->BeginFrame(state); fake_drm_->plane_manager()->BeginFrame(state);
ASSERT_TRUE(fake_drm_->plane_manager()->AssignOverlayPlanes( ASSERT_TRUE(fake_drm_->plane_manager()->AssignOverlayPlanes(
state, assigns, crtc_properties_[crtc_idx].id, &crtc)); state, assigns, crtc_properties_[crtc_idx].id));
scoped_refptr<ui::PageFlipRequest> page_flip_request = scoped_refptr<ui::PageFlipRequest> page_flip_request =
base::MakeRefCounted<ui::PageFlipRequest>(base::TimeDelta()); base::MakeRefCounted<ui::PageFlipRequest>(base::TimeDelta());
ASSERT_TRUE( ASSERT_TRUE(
...@@ -222,7 +221,7 @@ TEST_P(HardwareDisplayPlaneManagerLegacyTest, SinglePlaneAssignment) { ...@@ -222,7 +221,7 @@ TEST_P(HardwareDisplayPlaneManagerLegacyTest, SinglePlaneAssignment) {
property_names_, use_atomic_); property_names_, use_atomic_);
EXPECT_TRUE(fake_drm_->plane_manager()->AssignOverlayPlanes( EXPECT_TRUE(fake_drm_->plane_manager()->AssignOverlayPlanes(
&state_, assigns, crtc_properties_[0].id, nullptr)); &state_, assigns, crtc_properties_[0].id));
EXPECT_EQ(1u, state_.plane_list.size()); EXPECT_EQ(1u, state_.plane_list.size());
} }
...@@ -252,8 +251,8 @@ TEST_P(HardwareDisplayPlaneManagerLegacyTest, BadCrtc) { ...@@ -252,8 +251,8 @@ TEST_P(HardwareDisplayPlaneManagerLegacyTest, BadCrtc) {
fake_drm_->InitializeState(crtc_properties_, plane_properties_, fake_drm_->InitializeState(crtc_properties_, plane_properties_,
property_names_, use_atomic_); property_names_, use_atomic_);
EXPECT_FALSE(fake_drm_->plane_manager()->AssignOverlayPlanes(&state_, assigns, EXPECT_FALSE(
0, nullptr)); fake_drm_->plane_manager()->AssignOverlayPlanes(&state_, assigns, 0));
} }
TEST_P(HardwareDisplayPlaneManagerLegacyTest, NotEnoughPlanes) { TEST_P(HardwareDisplayPlaneManagerLegacyTest, NotEnoughPlanes) {
...@@ -266,7 +265,7 @@ TEST_P(HardwareDisplayPlaneManagerLegacyTest, NotEnoughPlanes) { ...@@ -266,7 +265,7 @@ TEST_P(HardwareDisplayPlaneManagerLegacyTest, NotEnoughPlanes) {
property_names_, use_atomic_); property_names_, use_atomic_);
EXPECT_FALSE(fake_drm_->plane_manager()->AssignOverlayPlanes( EXPECT_FALSE(fake_drm_->plane_manager()->AssignOverlayPlanes(
&state_, assigns, crtc_properties_[0].id, nullptr)); &state_, assigns, crtc_properties_[0].id));
} }
TEST_P(HardwareDisplayPlaneManagerLegacyTest, MultipleCrtcs) { TEST_P(HardwareDisplayPlaneManagerLegacyTest, MultipleCrtcs) {
...@@ -278,9 +277,9 @@ TEST_P(HardwareDisplayPlaneManagerLegacyTest, MultipleCrtcs) { ...@@ -278,9 +277,9 @@ TEST_P(HardwareDisplayPlaneManagerLegacyTest, MultipleCrtcs) {
property_names_, use_atomic_); property_names_, use_atomic_);
EXPECT_TRUE(fake_drm_->plane_manager()->AssignOverlayPlanes( EXPECT_TRUE(fake_drm_->plane_manager()->AssignOverlayPlanes(
&state_, assigns, crtc_properties_[0].id, nullptr)); &state_, assigns, crtc_properties_[0].id));
EXPECT_TRUE(fake_drm_->plane_manager()->AssignOverlayPlanes( EXPECT_TRUE(fake_drm_->plane_manager()->AssignOverlayPlanes(
&state_, assigns, crtc_properties_[1].id, nullptr)); &state_, assigns, crtc_properties_[1].id));
EXPECT_EQ(2u, state_.plane_list.size()); EXPECT_EQ(2u, state_.plane_list.size());
} }
...@@ -294,9 +293,9 @@ TEST_P(HardwareDisplayPlaneManagerLegacyTest, MultiplePlanesAndCrtcs) { ...@@ -294,9 +293,9 @@ TEST_P(HardwareDisplayPlaneManagerLegacyTest, MultiplePlanesAndCrtcs) {
property_names_, use_atomic_); property_names_, use_atomic_);
EXPECT_FALSE(fake_drm_->plane_manager()->AssignOverlayPlanes( EXPECT_FALSE(fake_drm_->plane_manager()->AssignOverlayPlanes(
&state_, assigns, crtc_properties_[0].id, nullptr)); &state_, assigns, crtc_properties_[0].id));
EXPECT_FALSE(fake_drm_->plane_manager()->AssignOverlayPlanes( EXPECT_FALSE(fake_drm_->plane_manager()->AssignOverlayPlanes(
&state_, assigns, crtc_properties_[1].id, nullptr)); &state_, assigns, crtc_properties_[1].id));
EXPECT_EQ(0u, state_.plane_list.size()); EXPECT_EQ(0u, state_.plane_list.size());
} }
...@@ -314,17 +313,17 @@ TEST_P(HardwareDisplayPlaneManagerLegacyTest, CheckFramebufferFormatMatch) { ...@@ -314,17 +313,17 @@ TEST_P(HardwareDisplayPlaneManagerLegacyTest, CheckFramebufferFormatMatch) {
// This should return false as plane manager creates planes which support // This should return false as plane manager creates planes which support
// DRM_FORMAT_XRGB8888 while buffer returns kDummyFormat as its pixelFormat. // DRM_FORMAT_XRGB8888 while buffer returns kDummyFormat as its pixelFormat.
EXPECT_FALSE(fake_drm_->plane_manager()->AssignOverlayPlanes( EXPECT_FALSE(fake_drm_->plane_manager()->AssignOverlayPlanes(
&state_, assigns, crtc_properties_[0].id, nullptr)); &state_, assigns, crtc_properties_[0].id));
assigns.clear(); assigns.clear();
scoped_refptr<ui::DrmFramebuffer> xrgb_buffer = scoped_refptr<ui::DrmFramebuffer> xrgb_buffer =
CreateBuffer(kDefaultBufferSize); CreateBuffer(kDefaultBufferSize);
assigns.push_back(ui::DrmOverlayPlane(xrgb_buffer, nullptr)); assigns.push_back(ui::DrmOverlayPlane(xrgb_buffer, nullptr));
fake_drm_->plane_manager()->BeginFrame(&state_); fake_drm_->plane_manager()->BeginFrame(&state_);
EXPECT_TRUE(fake_drm_->plane_manager()->AssignOverlayPlanes( EXPECT_TRUE(fake_drm_->plane_manager()->AssignOverlayPlanes(
&state_, assigns, crtc_properties_[0].id, nullptr)); &state_, assigns, crtc_properties_[0].id));
fake_drm_->plane_manager()->BeginFrame(&state_); fake_drm_->plane_manager()->BeginFrame(&state_);
EXPECT_FALSE(fake_drm_->plane_manager()->AssignOverlayPlanes( EXPECT_FALSE(fake_drm_->plane_manager()->AssignOverlayPlanes(
&state_, assigns, crtc_properties_[0].id, nullptr)); &state_, assigns, crtc_properties_[0].id));
} }
TEST_P(HardwareDisplayPlaneManagerAtomicTest, MultiplePlaneAssignment) { TEST_P(HardwareDisplayPlaneManagerAtomicTest, MultiplePlaneAssignment) {
...@@ -337,7 +336,7 @@ TEST_P(HardwareDisplayPlaneManagerAtomicTest, MultiplePlaneAssignment) { ...@@ -337,7 +336,7 @@ TEST_P(HardwareDisplayPlaneManagerAtomicTest, MultiplePlaneAssignment) {
property_names_, use_atomic_); property_names_, use_atomic_);
EXPECT_TRUE(fake_drm_->plane_manager()->AssignOverlayPlanes( EXPECT_TRUE(fake_drm_->plane_manager()->AssignOverlayPlanes(
&state_, assigns, crtc_properties_[0].id, nullptr)); &state_, assigns, crtc_properties_[0].id));
EXPECT_EQ(2u, state_.plane_list.size()); EXPECT_EQ(2u, state_.plane_list.size());
} }
...@@ -351,9 +350,9 @@ TEST_P(HardwareDisplayPlaneManagerAtomicTest, MultiplePlanesAndCrtcs) { ...@@ -351,9 +350,9 @@ TEST_P(HardwareDisplayPlaneManagerAtomicTest, MultiplePlanesAndCrtcs) {
property_names_, use_atomic_); property_names_, use_atomic_);
EXPECT_TRUE(fake_drm_->plane_manager()->AssignOverlayPlanes( EXPECT_TRUE(fake_drm_->plane_manager()->AssignOverlayPlanes(
&state_, assigns, crtc_properties_[0].id, nullptr)); &state_, assigns, crtc_properties_[0].id));
EXPECT_TRUE(fake_drm_->plane_manager()->AssignOverlayPlanes( EXPECT_TRUE(fake_drm_->plane_manager()->AssignOverlayPlanes(
&state_, assigns, crtc_properties_[1].id, nullptr)); &state_, assigns, crtc_properties_[1].id));
EXPECT_EQ(4u, state_.plane_list.size()); EXPECT_EQ(4u, state_.plane_list.size());
} }
...@@ -377,11 +376,11 @@ TEST_P(HardwareDisplayPlaneManagerAtomicTest, SharedPlanes) { ...@@ -377,11 +376,11 @@ TEST_P(HardwareDisplayPlaneManagerAtomicTest, SharedPlanes) {
property_names_, use_atomic_); property_names_, use_atomic_);
EXPECT_TRUE(fake_drm_->plane_manager()->AssignOverlayPlanes( EXPECT_TRUE(fake_drm_->plane_manager()->AssignOverlayPlanes(
&state_, assigns, crtc_properties_[1].id, nullptr)); &state_, assigns, crtc_properties_[1].id));
EXPECT_EQ(2u, state_.plane_list.size()); EXPECT_EQ(2u, state_.plane_list.size());
// The shared plane is now unavailable for use by the other CRTC. // The shared plane is now unavailable for use by the other CRTC.
EXPECT_FALSE(fake_drm_->plane_manager()->AssignOverlayPlanes( EXPECT_FALSE(fake_drm_->plane_manager()->AssignOverlayPlanes(
&state_, assigns, crtc_properties_[0].id, nullptr)); &state_, assigns, crtc_properties_[0].id));
} }
TEST_P(HardwareDisplayPlaneManagerAtomicTest, UnusedPlanesAreReleased) { TEST_P(HardwareDisplayPlaneManagerAtomicTest, UnusedPlanesAreReleased) {
...@@ -397,20 +396,19 @@ TEST_P(HardwareDisplayPlaneManagerAtomicTest, UnusedPlanesAreReleased) { ...@@ -397,20 +396,19 @@ TEST_P(HardwareDisplayPlaneManagerAtomicTest, UnusedPlanesAreReleased) {
assigns.push_back(ui::DrmOverlayPlane(primary_buffer, nullptr)); assigns.push_back(ui::DrmOverlayPlane(primary_buffer, nullptr));
assigns.push_back(ui::DrmOverlayPlane(overlay_buffer, nullptr)); assigns.push_back(ui::DrmOverlayPlane(overlay_buffer, nullptr));
ui::HardwareDisplayPlaneList hdpl; ui::HardwareDisplayPlaneList hdpl;
ui::CrtcController crtc(fake_drm_, crtc_properties_[0].id, 0);
scoped_refptr<ui::PageFlipRequest> page_flip_request = scoped_refptr<ui::PageFlipRequest> page_flip_request =
base::MakeRefCounted<ui::PageFlipRequest>(base::TimeDelta()); base::MakeRefCounted<ui::PageFlipRequest>(base::TimeDelta());
fake_drm_->plane_manager()->BeginFrame(&hdpl); fake_drm_->plane_manager()->BeginFrame(&hdpl);
EXPECT_TRUE(fake_drm_->plane_manager()->AssignOverlayPlanes( EXPECT_TRUE(fake_drm_->plane_manager()->AssignOverlayPlanes(
&hdpl, assigns, crtc_properties_[0].id, &crtc)); &hdpl, assigns, crtc_properties_[0].id));
EXPECT_TRUE( EXPECT_TRUE(
fake_drm_->plane_manager()->Commit(&hdpl, page_flip_request, nullptr)); fake_drm_->plane_manager()->Commit(&hdpl, page_flip_request, nullptr));
assigns.clear(); assigns.clear();
assigns.push_back(ui::DrmOverlayPlane(primary_buffer, nullptr)); assigns.push_back(ui::DrmOverlayPlane(primary_buffer, nullptr));
fake_drm_->plane_manager()->BeginFrame(&hdpl); fake_drm_->plane_manager()->BeginFrame(&hdpl);
EXPECT_TRUE(fake_drm_->plane_manager()->AssignOverlayPlanes( EXPECT_TRUE(fake_drm_->plane_manager()->AssignOverlayPlanes(
&hdpl, assigns, crtc_properties_[0].id, &crtc)); &hdpl, assigns, crtc_properties_[0].id));
EXPECT_NE(0u, GetPlanePropertyValue(kPlaneOffset, "FB_ID")); EXPECT_NE(0u, GetPlanePropertyValue(kPlaneOffset, "FB_ID"));
EXPECT_NE(0u, GetPlanePropertyValue(kPlaneOffset + 1, "FB_ID")); EXPECT_NE(0u, GetPlanePropertyValue(kPlaneOffset + 1, "FB_ID"));
...@@ -429,7 +427,7 @@ TEST_P(HardwareDisplayPlaneManagerAtomicTest, MultipleFrames) { ...@@ -429,7 +427,7 @@ TEST_P(HardwareDisplayPlaneManagerAtomicTest, MultipleFrames) {
property_names_, use_atomic_); property_names_, use_atomic_);
EXPECT_TRUE(fake_drm_->plane_manager()->AssignOverlayPlanes( EXPECT_TRUE(fake_drm_->plane_manager()->AssignOverlayPlanes(
&state_, assigns, crtc_properties_[0].id, nullptr)); &state_, assigns, crtc_properties_[0].id));
EXPECT_EQ(1u, state_.plane_list.size()); EXPECT_EQ(1u, state_.plane_list.size());
// Pretend we committed the frame. // Pretend we committed the frame.
state_.plane_list.swap(state_.old_plane_list); state_.plane_list.swap(state_.old_plane_list);
...@@ -437,7 +435,7 @@ TEST_P(HardwareDisplayPlaneManagerAtomicTest, MultipleFrames) { ...@@ -437,7 +435,7 @@ TEST_P(HardwareDisplayPlaneManagerAtomicTest, MultipleFrames) {
ui::HardwareDisplayPlane* old_plane = state_.old_plane_list[0]; ui::HardwareDisplayPlane* old_plane = state_.old_plane_list[0];
// The same plane should be used. // The same plane should be used.
EXPECT_TRUE(fake_drm_->plane_manager()->AssignOverlayPlanes( EXPECT_TRUE(fake_drm_->plane_manager()->AssignOverlayPlanes(
&state_, assigns, crtc_properties_[0].id, nullptr)); &state_, assigns, crtc_properties_[0].id));
EXPECT_EQ(1u, state_.plane_list.size()); EXPECT_EQ(1u, state_.plane_list.size());
EXPECT_EQ(state_.plane_list[0], old_plane); EXPECT_EQ(state_.plane_list[0], old_plane);
} }
...@@ -451,11 +449,11 @@ TEST_P(HardwareDisplayPlaneManagerAtomicTest, MultipleFramesDifferentPlanes) { ...@@ -451,11 +449,11 @@ TEST_P(HardwareDisplayPlaneManagerAtomicTest, MultipleFramesDifferentPlanes) {
property_names_, use_atomic_); property_names_, use_atomic_);
EXPECT_TRUE(fake_drm_->plane_manager()->AssignOverlayPlanes( EXPECT_TRUE(fake_drm_->plane_manager()->AssignOverlayPlanes(
&state_, assigns, crtc_properties_[0].id, nullptr)); &state_, assigns, crtc_properties_[0].id));
EXPECT_EQ(1u, state_.plane_list.size()); EXPECT_EQ(1u, state_.plane_list.size());
// The other plane should be used. // The other plane should be used.
EXPECT_TRUE(fake_drm_->plane_manager()->AssignOverlayPlanes( EXPECT_TRUE(fake_drm_->plane_manager()->AssignOverlayPlanes(
&state_, assigns, crtc_properties_[0].id, nullptr)); &state_, assigns, crtc_properties_[0].id));
EXPECT_EQ(2u, state_.plane_list.size()); EXPECT_EQ(2u, state_.plane_list.size());
EXPECT_NE(state_.plane_list[0], state_.plane_list[1]); EXPECT_NE(state_.plane_list[0], state_.plane_list[1]);
} }
...@@ -731,9 +729,6 @@ TEST_P(HardwareDisplayPlaneManagerAtomicTest, ...@@ -731,9 +729,6 @@ TEST_P(HardwareDisplayPlaneManagerAtomicTest,
fake_drm_->InitializeState(crtc_properties_, plane_properties_, fake_drm_->InitializeState(crtc_properties_, plane_properties_,
property_names_, use_atomic_); property_names_, use_atomic_);
ui::CrtcController crtc1(fake_drm_, crtc_properties_[0].id, 0);
ui::CrtcController crtc2(fake_drm_, crtc_properties_[1].id, 0);
ui::DrmOverlayPlaneList assigns1; ui::DrmOverlayPlaneList assigns1;
assigns1.push_back(ui::DrmOverlayPlane(fake_buffer_, nullptr)); assigns1.push_back(ui::DrmOverlayPlane(fake_buffer_, nullptr));
ui::DrmOverlayPlaneList assigns2; ui::DrmOverlayPlaneList assigns2;
...@@ -741,9 +736,9 @@ TEST_P(HardwareDisplayPlaneManagerAtomicTest, ...@@ -741,9 +736,9 @@ TEST_P(HardwareDisplayPlaneManagerAtomicTest,
fake_drm_->plane_manager()->BeginFrame(&state_); fake_drm_->plane_manager()->BeginFrame(&state_);
EXPECT_TRUE(fake_drm_->plane_manager()->AssignOverlayPlanes( EXPECT_TRUE(fake_drm_->plane_manager()->AssignOverlayPlanes(
&state_, assigns1, crtc_properties_[0].id, &crtc1)); &state_, assigns1, crtc_properties_[0].id));
EXPECT_TRUE(fake_drm_->plane_manager()->AssignOverlayPlanes( EXPECT_TRUE(fake_drm_->plane_manager()->AssignOverlayPlanes(
&state_, assigns2, crtc_properties_[1].id, &crtc2)); &state_, assigns2, crtc_properties_[1].id));
scoped_refptr<ui::PageFlipRequest> page_flip_request = scoped_refptr<ui::PageFlipRequest> page_flip_request =
base::MakeRefCounted<ui::PageFlipRequest>(base::TimeDelta()); base::MakeRefCounted<ui::PageFlipRequest>(base::TimeDelta());
...@@ -988,13 +983,11 @@ TEST(HardwareDisplayPlaneManagerAtomic, EnableBlend) { ...@@ -988,13 +983,11 @@ TEST(HardwareDisplayPlaneManagerAtomic, EnableBlend) {
ui::DrmFramebuffer::AddFramebuffer(drm_device, buffer.get()); ui::DrmFramebuffer::AddFramebuffer(drm_device, buffer.get());
ui::DrmOverlayPlane overlay(framebuffer, nullptr); ui::DrmOverlayPlane overlay(framebuffer, nullptr);
overlay.enable_blend = true; overlay.enable_blend = true;
plane_manager->SetPlaneData(&plane_list, &hw_plane, overlay, 1, gfx::Rect(), plane_manager->SetPlaneData(&plane_list, &hw_plane, overlay, 1, gfx::Rect());
nullptr);
EXPECT_EQ(hw_plane.framebuffer(), framebuffer->framebuffer_id()); EXPECT_EQ(hw_plane.framebuffer(), framebuffer->framebuffer_id());
overlay.enable_blend = false; overlay.enable_blend = false;
plane_manager->SetPlaneData(&plane_list, &hw_plane, overlay, 1, gfx::Rect(), plane_manager->SetPlaneData(&plane_list, &hw_plane, overlay, 1, gfx::Rect());
nullptr);
EXPECT_EQ(hw_plane.framebuffer(), framebuffer->opaque_framebuffer_id()); EXPECT_EQ(hw_plane.framebuffer(), framebuffer->opaque_framebuffer_id());
} }
......
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