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

Side by Side Diff: ui/ozone/platform/drm/gpu/hardware_display_plane_manager.cc

Issue 2169733002: ozone: Let BGRA fullscreen overlays replace primary plane. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comment about alpha blending not needed. Created 4 years, 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/ozone/platform/drm/gpu/hardware_display_plane_manager.h" 5 #include "ui/ozone/platform/drm/gpu/hardware_display_plane_manager.h"
6 6
7 #include <drm_fourcc.h> 7 #include <drm_fourcc.h>
8 8
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 CrtcController* crtc) { 227 CrtcController* crtc) {
228 int crtc_index = LookupCrtcIndex(crtc_id); 228 int crtc_index = LookupCrtcIndex(crtc_id);
229 if (crtc_index < 0) { 229 if (crtc_index < 0) {
230 LOG(ERROR) << "Cannot find crtc " << crtc_id; 230 LOG(ERROR) << "Cannot find crtc " << crtc_id;
231 return false; 231 return false;
232 } 232 }
233 233
234 size_t plane_idx = 0; 234 size_t plane_idx = 0;
235 HardwareDisplayPlane* primary_plane = nullptr; 235 HardwareDisplayPlane* primary_plane = nullptr;
236 gfx::Rect primary_display_bounds; 236 gfx::Rect primary_display_bounds;
237 uint32_t primary_format;
238 for (const auto& plane : overlay_list) { 237 for (const auto& plane : overlay_list) {
239 HardwareDisplayPlane* hw_plane = 238 HardwareDisplayPlane* hw_plane =
240 FindNextUnusedPlane(&plane_idx, crtc_index, plane); 239 FindNextUnusedPlane(&plane_idx, crtc_index, plane);
241 if (!hw_plane) { 240 if (!hw_plane) {
242 LOG(ERROR) << "Failed to find a free plane for crtc " << crtc_id; 241 LOG(ERROR) << "Failed to find a free plane for crtc " << crtc_id;
243 ResetCurrentPlaneList(plane_list); 242 ResetCurrentPlaneList(plane_list);
244 return false; 243 return false;
245 } 244 }
246 245
247 gfx::Rect fixed_point_rect; 246 gfx::Rect fixed_point_rect;
(...skipping 10 matching lines...) Expand all
258 fixed_point_rect = gfx::Rect(to_fixed_point(crop_rect.x()), 257 fixed_point_rect = gfx::Rect(to_fixed_point(crop_rect.x()),
259 to_fixed_point(crop_rect.y()), 258 to_fixed_point(crop_rect.y()),
260 to_fixed_point(crop_rect.width()), 259 to_fixed_point(crop_rect.width()),
261 to_fixed_point(crop_rect.height())); 260 to_fixed_point(crop_rect.height()));
262 } 261 }
263 262
264 // If Overlay completely covers primary and isn't transparent, than use 263 // If Overlay completely covers primary and isn't transparent, than use
265 // it as primary. This reduces the no of planes which need to be read in 264 // it as primary. This reduces the no of planes which need to be read in
266 // display controller side. 265 // display controller side.
267 if (primary_plane) { 266 if (primary_plane) {
268 bool needs_blending = true; 267 // TODO(dcastagna): Check if we can move this optimization to
269 if (fourcc_format == DRM_FORMAT_XRGB8888) 268 // GLRenderer::ScheduleOverlays.
270 needs_blending = false; 269 // Note that Chromium compositor promotes buffers to overlays (ARGB
271 // TODO(kalyank): Check if we can move this optimization to 270 // ones too) only if blending is not needed.
272 // DrmOverlayCandidatesHost. 271 if ((fourcc_format == DRM_FORMAT_XRGB8888 ||
273 if (!needs_blending && primary_format == fourcc_format && 272 fourcc_format == DRM_FORMAT_ARGB8888) &&
274 primary_display_bounds == plane.display_bounds) { 273 primary_display_bounds == plane.display_bounds) {
275 ResetCurrentPlaneList(plane_list); 274 ResetCurrentPlaneList(plane_list);
276 hw_plane = primary_plane; 275 hw_plane = primary_plane;
277 } 276 }
278 } else { 277 } else {
279 primary_plane = hw_plane; 278 primary_plane = hw_plane;
280 primary_display_bounds = plane.display_bounds; 279 primary_display_bounds = plane.display_bounds;
281 primary_format = fourcc_format;
282 } 280 }
283 281
284 if (!SetPlaneData(plane_list, hw_plane, plane, crtc_id, fixed_point_rect, 282 if (!SetPlaneData(plane_list, hw_plane, plane, crtc_id, fixed_point_rect,
285 crtc)) { 283 crtc)) {
286 ResetCurrentPlaneList(plane_list); 284 ResetCurrentPlaneList(plane_list);
287 return false; 285 return false;
288 } 286 }
289 287
290 plane_list->plane_list.push_back(hw_plane); 288 plane_list->plane_list.push_back(hw_plane);
291 hw_plane->set_owning_crtc(crtc_id); 289 hw_plane->set_owning_crtc(crtc_id);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 break; 324 break;
327 } else { 325 } else {
328 plane_z_order++; 326 plane_z_order++;
329 } 327 }
330 } 328 }
331 329
332 return format_supported; 330 return format_supported;
333 } 331 }
334 332
335 } // namespace ui 333 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698