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/gbm_surface_factory.h" | 5 #include "ui/ozone/platform/drm/gbm_surface_factory.h" |
6 | 6 |
7 #include <gbm.h> | 7 #include <gbm.h> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
11 #include "third_party/khronos/EGL/egl.h" | 11 #include "third_party/khronos/EGL/egl.h" |
| 12 #include "ui/gfx/geometry/rect_conversions.h" |
12 #include "ui/ozone/common/egl_util.h" | 13 #include "ui/ozone/common/egl_util.h" |
13 #include "ui/ozone/platform/drm/gpu/drm_device_manager.h" | 14 #include "ui/ozone/platform/drm/gpu/drm_device_manager.h" |
14 #include "ui/ozone/platform/drm/gpu/drm_window.h" | 15 #include "ui/ozone/platform/drm/gpu/drm_window.h" |
15 #include "ui/ozone/platform/drm/gpu/gbm_buffer.h" | 16 #include "ui/ozone/platform/drm/gpu/gbm_buffer.h" |
16 #include "ui/ozone/platform/drm/gpu/gbm_device.h" | 17 #include "ui/ozone/platform/drm/gpu/gbm_device.h" |
17 #include "ui/ozone/platform/drm/gpu/gbm_surface.h" | 18 #include "ui/ozone/platform/drm/gpu/gbm_surface.h" |
18 #include "ui/ozone/platform/drm/gpu/gbm_surfaceless.h" | 19 #include "ui/ozone/platform/drm/gpu/gbm_surfaceless.h" |
19 #include "ui/ozone/platform/drm/gpu/hardware_display_controller.h" | 20 #include "ui/ozone/platform/drm/gpu/hardware_display_controller.h" |
20 #include "ui/ozone/platform/drm/gpu/screen_manager.h" | 21 #include "ui/ozone/platform/drm/gpu/screen_manager.h" |
21 #include "ui/ozone/public/native_pixmap.h" | 22 #include "ui/ozone/public/native_pixmap.h" |
(...skipping 18 matching lines...) Expand all Loading... |
40 &(*candidates)[1]; | 41 &(*candidates)[1]; |
41 OverlayCandidatesOzone::OverlaySurfaceCandidate* overlay; | 42 OverlayCandidatesOzone::OverlaySurfaceCandidate* overlay; |
42 if (first->plane_z_order == 0) { | 43 if (first->plane_z_order == 0) { |
43 overlay = second; | 44 overlay = second; |
44 } else if (second->plane_z_order == 0) { | 45 } else if (second->plane_z_order == 0) { |
45 overlay = first; | 46 overlay = first; |
46 } else { | 47 } else { |
47 NOTREACHED(); | 48 NOTREACHED(); |
48 return; | 49 return; |
49 } | 50 } |
| 51 // 0.01 constant chosen to match DCHECKs in gfx::ToNearestRect and avoid |
| 52 // that code asserting on quads that we accept. |
50 if (overlay->plane_z_order > 0 && | 53 if (overlay->plane_z_order > 0 && |
51 IsTransformSupported(overlay->transform)) { | 54 IsTransformSupported(overlay->transform) && |
| 55 gfx::IsNearestRectWithinDistance(overlay->display_rect, 0.01f)) { |
52 overlay->overlay_handled = true; | 56 overlay->overlay_handled = true; |
53 } | 57 } |
54 } | 58 } |
55 } | 59 } |
56 | 60 |
57 private: | 61 private: |
58 bool IsTransformSupported(gfx::OverlayTransform transform) { | 62 bool IsTransformSupported(gfx::OverlayTransform transform) { |
59 switch (transform) { | 63 switch (transform) { |
60 case gfx::OVERLAY_TRANSFORM_NONE: | 64 case gfx::OVERLAY_TRANSFORM_NONE: |
61 return true; | 65 return true; |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 return false; | 216 return false; |
213 } | 217 } |
214 | 218 |
215 scoped_refptr<GbmDevice> GbmSurfaceFactory::GetGbmDevice( | 219 scoped_refptr<GbmDevice> GbmSurfaceFactory::GetGbmDevice( |
216 gfx::AcceleratedWidget widget) { | 220 gfx::AcceleratedWidget widget) { |
217 return static_cast<GbmDevice*>( | 221 return static_cast<GbmDevice*>( |
218 drm_device_manager_->GetDrmDevice(widget).get()); | 222 drm_device_manager_->GetDrmDevice(widget).get()); |
219 } | 223 } |
220 | 224 |
221 } // namespace ui | 225 } // namespace ui |
OLD | NEW |