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/dri/dri_wrapper.h" | 5 #include "ui/ozone/platform/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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 connectors, | 48 connectors, |
49 1, | 49 1, |
50 &crtc->mode); | 50 &crtc->mode); |
51 } | 51 } |
52 | 52 |
53 bool DriWrapper::DisableCrtc(uint32_t crtc_id) { | 53 bool DriWrapper::DisableCrtc(uint32_t crtc_id) { |
54 CHECK(fd_ >= 0); | 54 CHECK(fd_ >= 0); |
55 return !drmModeSetCrtc(fd_, crtc_id, 0, 0, 0, NULL, 0, NULL); | 55 return !drmModeSetCrtc(fd_, crtc_id, 0, 0, 0, NULL, 0, NULL); |
56 } | 56 } |
57 | 57 |
58 bool DriWrapper::AddFramebuffer(const drmModeModeInfo& mode, | 58 bool DriWrapper::AddFramebuffer(uint32_t width, |
59 uint8_t depth, | 59 uint32_t height, |
60 uint8_t bpp, | 60 uint8_t depth, |
61 uint32_t stride, | 61 uint8_t bpp, |
62 uint32_t handle, | 62 uint32_t stride, |
63 uint32_t* framebuffer) { | 63 uint32_t handle, |
| 64 uint32_t* framebuffer) { |
64 CHECK(fd_ >= 0); | 65 CHECK(fd_ >= 0); |
65 return !drmModeAddFB(fd_, | 66 return !drmModeAddFB(fd_, |
66 mode.hdisplay, | 67 width, |
67 mode.vdisplay, | 68 height, |
68 depth, | 69 depth, |
69 bpp, | 70 bpp, |
70 stride, | 71 stride, |
71 handle, | 72 handle, |
72 framebuffer); | 73 framebuffer); |
73 } | 74 } |
74 | 75 |
75 bool DriWrapper::RemoveFramebuffer(uint32_t framebuffer) { | 76 bool DriWrapper::RemoveFramebuffer(uint32_t framebuffer) { |
76 CHECK(fd_ >= 0); | 77 CHECK(fd_ >= 0); |
77 return !drmModeRmFB(fd_, framebuffer); | 78 return !drmModeRmFB(fd_, framebuffer); |
78 } | 79 } |
79 | 80 |
80 bool DriWrapper::PageFlip(uint32_t crtc_id, | 81 bool DriWrapper::PageFlip(uint32_t crtc_id, |
81 uint32_t framebuffer, | 82 uint32_t framebuffer, |
82 void* data) { | 83 void* data) { |
83 CHECK(fd_ >= 0); | 84 CHECK(fd_ >= 0); |
84 return !drmModePageFlip(fd_, | 85 return !drmModePageFlip(fd_, |
85 crtc_id, | 86 crtc_id, |
86 framebuffer, | 87 framebuffer, |
87 DRM_MODE_PAGE_FLIP_EVENT, | 88 DRM_MODE_PAGE_FLIP_EVENT, |
88 data); | 89 data); |
89 } | 90 } |
90 | 91 |
91 drmModePropertyRes* DriWrapper::GetProperty(drmModeConnector* connector, | 92 drmModePropertyRes* DriWrapper::GetProperty(drmModeConnector* connector, |
92 const char* name) { | 93 const char* name) { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 CHECK(fd_ >= 0); | 149 CHECK(fd_ >= 0); |
149 return !drmModeSetCursor(fd_, crtc_id, handle, width, height); | 150 return !drmModeSetCursor(fd_, crtc_id, handle, width, height); |
150 } | 151 } |
151 | 152 |
152 bool DriWrapper::MoveCursor(uint32_t crtc_id, int x, int y) { | 153 bool DriWrapper::MoveCursor(uint32_t crtc_id, int x, int y) { |
153 CHECK(fd_ >= 0); | 154 CHECK(fd_ >= 0); |
154 return !drmModeMoveCursor(fd_, crtc_id, x, y); | 155 return !drmModeMoveCursor(fd_, crtc_id, x, y); |
155 } | 156 } |
156 | 157 |
157 } // namespace ui | 158 } // namespace ui |
OLD | NEW |