OLD | NEW |
---|---|
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 Loading... | |
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 Loading... | |
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 if ((fourcc_format == DRM_FORMAT_XRGB8888 || |
271 // TODO(kalyank): Check if we can move this optimization to | 270 fourcc_format == DRM_FORMAT_ARGB8888) && |
reveman
2016/07/21 01:45:36
nit: can you add a comment here explaining that AR
Daniele Castagna
2016/07/21 19:39:00
Done.
| |
272 // DrmOverlayCandidatesHost. | |
273 if (!needs_blending && primary_format == fourcc_format && | |
274 primary_display_bounds == plane.display_bounds) { | 271 primary_display_bounds == plane.display_bounds) { |
275 ResetCurrentPlaneList(plane_list); | 272 ResetCurrentPlaneList(plane_list); |
276 hw_plane = primary_plane; | 273 hw_plane = primary_plane; |
277 } | 274 } |
278 } else { | 275 } else { |
279 primary_plane = hw_plane; | 276 primary_plane = hw_plane; |
280 primary_display_bounds = plane.display_bounds; | 277 primary_display_bounds = plane.display_bounds; |
281 primary_format = fourcc_format; | |
282 } | 278 } |
283 | 279 |
284 if (!SetPlaneData(plane_list, hw_plane, plane, crtc_id, fixed_point_rect, | 280 if (!SetPlaneData(plane_list, hw_plane, plane, crtc_id, fixed_point_rect, |
285 crtc)) { | 281 crtc)) { |
286 ResetCurrentPlaneList(plane_list); | 282 ResetCurrentPlaneList(plane_list); |
287 return false; | 283 return false; |
288 } | 284 } |
289 | 285 |
290 plane_list->plane_list.push_back(hw_plane); | 286 plane_list->plane_list.push_back(hw_plane); |
291 hw_plane->set_owning_crtc(crtc_id); | 287 hw_plane->set_owning_crtc(crtc_id); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
326 break; | 322 break; |
327 } else { | 323 } else { |
328 plane_z_order++; | 324 plane_z_order++; |
329 } | 325 } |
330 } | 326 } |
331 | 327 |
332 return format_supported; | 328 return format_supported; |
333 } | 329 } |
334 | 330 |
335 } // namespace ui | 331 } // namespace ui |
OLD | NEW |