| 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/drm_device.h" | 5 #include "ui/ozone/platform/drm/gpu/drm_device.h" |
| 6 | 6 |
| 7 #include <fcntl.h> | 7 #include <fcntl.h> |
| 8 #include <sys/mman.h> | 8 #include <sys/mman.h> |
| 9 #include <unistd.h> | 9 #include <unistd.h> |
| 10 #include <xf86drm.h> | 10 #include <xf86drm.h> |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 NULL); | 331 NULL); |
| 332 } | 332 } |
| 333 | 333 |
| 334 ScopedDrmConnectorPtr DrmDevice::GetConnector(uint32_t connector_id) { | 334 ScopedDrmConnectorPtr DrmDevice::GetConnector(uint32_t connector_id) { |
| 335 DCHECK(file_.IsValid()); | 335 DCHECK(file_.IsValid()); |
| 336 TRACE_EVENT1("drm", "DrmDevice::GetConnector", "connector", connector_id); | 336 TRACE_EVENT1("drm", "DrmDevice::GetConnector", "connector", connector_id); |
| 337 return ScopedDrmConnectorPtr( | 337 return ScopedDrmConnectorPtr( |
| 338 drmModeGetConnector(file_.GetPlatformFile(), connector_id)); | 338 drmModeGetConnector(file_.GetPlatformFile(), connector_id)); |
| 339 } | 339 } |
| 340 | 340 |
| 341 bool DrmDevice::AddFramebuffer(uint32_t width, | 341 bool DrmDevice::AddFramebuffer2(uint32_t width, |
| 342 uint32_t height, | 342 uint32_t height, |
| 343 uint8_t depth, | 343 uint32_t format, |
| 344 uint8_t bpp, | 344 uint32_t handles[4], |
| 345 uint32_t stride, | 345 uint32_t strides[4], |
| 346 uint32_t handle, | 346 uint32_t offsets[4], |
| 347 uint32_t* framebuffer) { | 347 uint32_t* framebuffer, |
| 348 uint32_t flags) { |
| 348 DCHECK(file_.IsValid()); | 349 DCHECK(file_.IsValid()); |
| 349 TRACE_EVENT1("drm", "DrmDevice::AddFramebuffer", "handle", handle); | 350 TRACE_EVENT1("drm", "DrmDevice::AddFramebuffer", "handle", handles[0]); |
| 350 return !drmModeAddFB(file_.GetPlatformFile(), width, height, depth, bpp, | 351 return !drmModeAddFB2(file_.GetPlatformFile(), width, height, format, handles, |
| 351 stride, handle, framebuffer); | 352 strides, offsets, framebuffer, 0); |
| 352 } | 353 } |
| 353 | 354 |
| 354 bool DrmDevice::RemoveFramebuffer(uint32_t framebuffer) { | 355 bool DrmDevice::RemoveFramebuffer(uint32_t framebuffer) { |
| 355 DCHECK(file_.IsValid()); | 356 DCHECK(file_.IsValid()); |
| 356 TRACE_EVENT1("drm", "DrmDevice::RemoveFramebuffer", "framebuffer", | 357 TRACE_EVENT1("drm", "DrmDevice::RemoveFramebuffer", "framebuffer", |
| 357 framebuffer); | 358 framebuffer); |
| 358 return !drmModeRmFB(file_.GetPlatformFile(), framebuffer); | 359 return !drmModeRmFB(file_.GetPlatformFile(), framebuffer); |
| 359 } | 360 } |
| 360 | 361 |
| 361 bool DrmDevice::PageFlip(uint32_t crtc_id, | 362 bool DrmDevice::PageFlip(uint32_t crtc_id, |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 b.push_back(lut[i].b); | 575 b.push_back(lut[i].b); |
| 575 } | 576 } |
| 576 | 577 |
| 577 DCHECK(file_.IsValid()); | 578 DCHECK(file_.IsValid()); |
| 578 TRACE_EVENT0("drm", "DrmDevice::SetGamma"); | 579 TRACE_EVENT0("drm", "DrmDevice::SetGamma"); |
| 579 return (drmModeCrtcSetGamma(file_.GetPlatformFile(), crtc_id, r.size(), &r[0], | 580 return (drmModeCrtcSetGamma(file_.GetPlatformFile(), crtc_id, r.size(), &r[0], |
| 580 &g[0], &b[0]) == 0); | 581 &g[0], &b[0]) == 0); |
| 581 } | 582 } |
| 582 | 583 |
| 583 } // namespace ui | 584 } // namespace ui |
| OLD | NEW |