Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(175)

Unified Diff: ui/ozone/platform/drm/gpu/screen_manager.cc

Issue 2951193002: ozone/drm: Only reuse ScanoutBuffers with compatible modifiers (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/ozone/platform/drm/gpu/scanout_buffer.h ('k') | ui/ozone/platform/drm/gpu/screen_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/ozone/platform/drm/gpu/screen_manager.cc
diff --git a/ui/ozone/platform/drm/gpu/screen_manager.cc b/ui/ozone/platform/drm/gpu/screen_manager.cc
index 5dd26663881c04668e11dd0a4af17bb746c38dfb..899f0a59b2b2c4841ecfa149caa7544ff1d9e7c3 100644
--- a/ui/ozone/platform/drm/gpu/screen_manager.cc
+++ b/ui/ozone/platform/drm/gpu/screen_manager.cc
@@ -348,17 +348,30 @@ OverlayPlane ScreenManager::GetModesetBuffer(
HardwareDisplayController* controller,
const gfx::Rect& bounds) {
DrmWindow* window = FindWindowAt(bounds);
+
+ gfx::BufferFormat format = display::DisplaySnapshot::PrimaryFormat();
+ uint32_t fourcc_format = ui::GetFourCCFormatForOpaqueFramebuffer(format);
+
if (window) {
const OverlayPlane* primary = window->GetLastModesetBuffer();
const DrmDevice* drm = controller->GetAllocationDrmDevice().get();
if (primary && primary->buffer->GetSize() == bounds.size() &&
- primary->buffer->GetDrmDevice() == drm)
- return *primary;
+ primary->buffer->GetDrmDevice() == drm) {
+ // If the controller doesn't advertise modifiers, wont have a
+ // modifier either and we can reuse the buffer. Otherwise, check
+ // to see if the controller supports the buffers format
+ // modifier.
+ const auto& modifiers = controller->GetFormatModifiers(fourcc_format);
+ if (modifiers.empty())
+ return *primary;
+ for (const uint64_t modifier : modifiers) {
+ if (modifier == primary->buffer->GetFormatModifier())
+ return *primary;
+ }
+ }
}
- gfx::BufferFormat format = display::DisplaySnapshot::PrimaryFormat();
scoped_refptr<DrmDevice> drm = controller->GetAllocationDrmDevice();
- uint32_t fourcc_format = ui::GetFourCCFormatForOpaqueFramebuffer(format);
scoped_refptr<ScanoutBuffer> buffer =
buffer_generator_->Create(drm, fourcc_format, bounds.size());
if (!buffer) {
« no previous file with comments | « ui/ozone/platform/drm/gpu/scanout_buffer.h ('k') | ui/ozone/platform/drm/gpu/screen_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698