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

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

Issue 2712463002: ozone: Reject overlays when a test buffer can't be allocated. (Closed)
Patch Set: Created 3 years, 10 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/drm_overlay_validator.h" 5 #include "ui/ozone/platform/drm/gpu/drm_overlay_validator.h"
6 6
7 #include <drm_fourcc.h> 7 #include <drm_fourcc.h>
8 8
9 #include "ui/gfx/geometry/size_conversions.h" 9 #include "ui/gfx/geometry/size_conversions.h"
10 #include "ui/ozone/platform/drm/common/drm_util.h" 10 #include "ui/ozone/platform/drm/common/drm_util.h"
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 125
126 for (auto& overlay : validated_params) { 126 for (auto& overlay : validated_params) {
127 if (!overlay.is_overlay_candidate) 127 if (!overlay.is_overlay_candidate)
128 continue; 128 continue;
129 129
130 gfx::Size scaled_buffer_size = GetScaledSize( 130 gfx::Size scaled_buffer_size = GetScaledSize(
131 overlay.buffer_size, overlay.display_rect, overlay.crop_rect); 131 overlay.buffer_size, overlay.display_rect, overlay.crop_rect);
132 132
133 uint32_t original_format = GetFourCCFormatForFramebuffer(overlay.format); 133 uint32_t original_format = GetFourCCFormatForFramebuffer(overlay.format);
134 scoped_refptr<ScanoutBuffer> buffer = 134 scoped_refptr<ScanoutBuffer> buffer =
135 GetBufferForPageFlipTest(drm, scaled_buffer_size, original_format, 135 GetBufferForPageFlipTest(drm, overlay.buffer_size, original_format,
136 buffer_generator_, &reusable_buffers); 136 buffer_generator_, &reusable_buffers);
137 DCHECK(buffer);
138 137
139 OverlayPlane plane(buffer, overlay.plane_z_order, overlay.transform, 138 OverlayPlane plane(buffer, overlay.plane_z_order, overlay.transform,
140 overlay.display_rect, overlay.crop_rect); 139 overlay.display_rect, overlay.crop_rect);
141 test_list.push_back(plane); 140 test_list.push_back(plane);
142 141
143 if (controller->TestPageFlip(test_list)) { 142 if (buffer && controller->TestPageFlip(test_list)) {
144 overlay.is_overlay_candidate = true; 143 overlay.is_overlay_candidate = true;
145 144
146 // If size scaling is needed, find an optimal format. 145 // If size scaling is needed, find an optimal format.
147 if (overlay.plane_z_order && scaled_buffer_size != overlay.buffer_size) { 146 if (overlay.plane_z_order && scaled_buffer_size != overlay.buffer_size) {
148 uint32_t optimal_format = FindOptimalBufferFormat( 147 uint32_t optimal_format = FindOptimalBufferFormat(
149 original_format, overlay.plane_z_order, overlay.display_rect, 148 original_format, overlay.plane_z_order, overlay.display_rect,
150 window_->bounds(), controller); 149 window_->bounds(), controller);
151 150
152 if (original_format != optimal_format) { 151 if (original_format != optimal_format) {
153 OverlayPlane original_plain = test_list.back(); 152 OverlayPlane original_plain = test_list.back();
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 261
263 // Make sure we dont hold reference to buffer when caching this plane list. 262 // Make sure we dont hold reference to buffer when caching this plane list.
264 plane.buffer = nullptr; 263 plane.buffer = nullptr;
265 } 264 }
266 265
267 DCHECK(hints_plane_list.size() == overlay_hints.size()); 266 DCHECK(hints_plane_list.size() == overlay_hints.size());
268 overlay_hints_cache_.Put(hints_plane_list, overlay_hints); 267 overlay_hints_cache_.Put(hints_plane_list, overlay_hints);
269 } 268 }
270 269
271 } // namespace ui 270 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698