OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/gfx/ozone/dri/dri_wrapper.h" | 5 #include "ui/gfx/ozone/dri/dri_wrapper.h" |
6 | 6 |
7 #include <fcntl.h> | 7 #include <fcntl.h> |
8 #include <unistd.h> | 8 #include <unistd.h> |
9 #include <xf86drmMode.h> | 9 #include <xf86drmMode.h> |
10 | 10 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 handle, | 66 handle, |
67 framebuffer); | 67 framebuffer); |
68 } | 68 } |
69 | 69 |
70 bool DriWrapper::RemoveFramebuffer(uint32_t framebuffer) { | 70 bool DriWrapper::RemoveFramebuffer(uint32_t framebuffer) { |
71 CHECK(fd_ >= 0); | 71 CHECK(fd_ >= 0); |
72 return !drmModeRmFB(fd_, framebuffer); | 72 return !drmModeRmFB(fd_, framebuffer); |
73 } | 73 } |
74 | 74 |
75 bool DriWrapper::PageFlip(uint32_t crtc_id, | 75 bool DriWrapper::PageFlip(uint32_t crtc_id, |
76 uint32_t framebuffer, | 76 uint32_t framebuffer, |
77 void* data) { | 77 gfx::Rect overlay_plane_rect, |
| 78 gfx::Size overlay_plane_size, |
| 79 uint32_t overlay_plane_fb_id, |
| 80 int overlay_plane, |
| 81 void* data) { |
78 CHECK(fd_ >= 0); | 82 CHECK(fd_ >= 0); |
79 return !drmModePageFlip(fd_, | 83 |
80 crtc_id, | 84 drmModePageFlip(fd_, crtc_id, framebuffer, DRM_MODE_PAGE_FLIP_EVENT, data); |
81 framebuffer, | 85 |
82 DRM_MODE_PAGE_FLIP_EVENT, | 86 if (overlay_plane_fb_id) { |
83 data); | 87 int rc = drmModeSetPlane(fd_, |
| 88 overlay_plane, |
| 89 crtc_id, |
| 90 overlay_plane_fb_id, |
| 91 0, |
| 92 overlay_plane_rect.x(), |
| 93 overlay_plane_rect.y(), |
| 94 overlay_plane_rect.width(), |
| 95 overlay_plane_rect.height(), |
| 96 0, |
| 97 0, |
| 98 overlay_plane_size.width() << 16, |
| 99 overlay_plane_size.height() << 16); |
| 100 |
| 101 if (rc) { |
| 102 char buffer[512]; |
| 103 sprintf(buffer, "failed to set overlay: %s\n", strerror(-rc)); |
| 104 LOG(ERROR) << buffer; |
| 105 } |
| 106 } |
| 107 |
| 108 return true; |
84 } | 109 } |
85 | 110 |
86 bool DriWrapper::ConnectorSetProperty(uint32_t connector_id, | 111 bool DriWrapper::ConnectorSetProperty(uint32_t connector_id, |
87 uint32_t property_id, | 112 uint32_t property_id, |
88 uint64_t value) { | 113 uint64_t value) { |
89 CHECK(fd_ >= 0); | 114 CHECK(fd_ >= 0); |
90 return !drmModeConnectorSetProperty(fd_, connector_id, property_id, value); | 115 return !drmModeConnectorSetProperty(fd_, connector_id, property_id, value); |
91 } | 116 } |
92 | 117 |
93 } // namespace gfx | 118 } // namespace gfx |
OLD | NEW |