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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 uint8_t bpp, | 344 uint8_t bpp, |
345 uint32_t stride, | 345 uint32_t stride, |
346 uint32_t handle, | 346 uint32_t handle, |
347 uint32_t* framebuffer) { | 347 uint32_t* framebuffer) { |
348 DCHECK(file_.IsValid()); | 348 DCHECK(file_.IsValid()); |
349 TRACE_EVENT1("drm", "DrmDevice::AddFramebuffer", "handle", handle); | 349 TRACE_EVENT1("drm", "DrmDevice::AddFramebuffer", "handle", handle); |
350 return !drmModeAddFB(file_.GetPlatformFile(), width, height, depth, bpp, | 350 return !drmModeAddFB(file_.GetPlatformFile(), width, height, depth, bpp, |
351 stride, handle, framebuffer); | 351 stride, handle, framebuffer); |
352 } | 352 } |
353 | 353 |
| 354 bool DrmDevice::AddFramebuffer2(uint32_t width, |
| 355 uint32_t height, |
| 356 uint32_t format, |
| 357 uint32_t handles[4], |
| 358 uint32_t strides[4], |
| 359 uint32_t offsets[4], |
| 360 uint32_t* framebuffer, |
| 361 uint32_t flags) { |
| 362 DCHECK(file_.IsValid()); |
| 363 TRACE_EVENT1("drm", "DrmDevice::AddFramebuffer", "handle", handles[0]); |
| 364 return !drmModeAddFB2(file_.GetPlatformFile(), width, height, format, handles, |
| 365 strides, offsets, framebuffer, 0); |
| 366 } |
| 367 |
354 bool DrmDevice::RemoveFramebuffer(uint32_t framebuffer) { | 368 bool DrmDevice::RemoveFramebuffer(uint32_t framebuffer) { |
355 DCHECK(file_.IsValid()); | 369 DCHECK(file_.IsValid()); |
356 TRACE_EVENT1("drm", "DrmDevice::RemoveFramebuffer", "framebuffer", | 370 TRACE_EVENT1("drm", "DrmDevice::RemoveFramebuffer", "framebuffer", |
357 framebuffer); | 371 framebuffer); |
358 return !drmModeRmFB(file_.GetPlatformFile(), framebuffer); | 372 return !drmModeRmFB(file_.GetPlatformFile(), framebuffer); |
359 } | 373 } |
360 | 374 |
361 bool DrmDevice::PageFlip(uint32_t crtc_id, | 375 bool DrmDevice::PageFlip(uint32_t crtc_id, |
362 uint32_t framebuffer, | 376 uint32_t framebuffer, |
363 const PageFlipCallback& callback) { | 377 const PageFlipCallback& callback) { |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 b.push_back(lut[i].b); | 588 b.push_back(lut[i].b); |
575 } | 589 } |
576 | 590 |
577 DCHECK(file_.IsValid()); | 591 DCHECK(file_.IsValid()); |
578 TRACE_EVENT0("drm", "DrmDevice::SetGamma"); | 592 TRACE_EVENT0("drm", "DrmDevice::SetGamma"); |
579 return (drmModeCrtcSetGamma(file_.GetPlatformFile(), crtc_id, r.size(), &r[0], | 593 return (drmModeCrtcSetGamma(file_.GetPlatformFile(), crtc_id, r.size(), &r[0], |
580 &g[0], &b[0]) == 0); | 594 &g[0], &b[0]) == 0); |
581 } | 595 } |
582 | 596 |
583 } // namespace ui | 597 } // namespace ui |
OLD | NEW |