Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(148)

Side by Side Diff: ui/ozone/platform/drm/gpu/drm_device.cc

Issue 1099713005: ozone: Add sync flag for atomic commit (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 bool DrmDevice::CloseBufferHandle(uint32_t handle) { 552 bool DrmDevice::CloseBufferHandle(uint32_t handle) {
553 struct drm_gem_close close_request; 553 struct drm_gem_close close_request;
554 memset(&close_request, 0, sizeof(close_request)); 554 memset(&close_request, 0, sizeof(close_request));
555 close_request.handle = handle; 555 close_request.handle = handle;
556 return !drmIoctl(file_.GetPlatformFile(), DRM_IOCTL_GEM_CLOSE, 556 return !drmIoctl(file_.GetPlatformFile(), DRM_IOCTL_GEM_CLOSE,
557 &close_request); 557 &close_request);
558 } 558 }
559 559
560 bool DrmDevice::CommitProperties(drmModePropertySet* properties, 560 bool DrmDevice::CommitProperties(drmModePropertySet* properties,
561 uint32_t flags, 561 uint32_t flags,
562 bool is_sync,
562 const PageFlipCallback& callback) { 563 const PageFlipCallback& callback) {
563 #if defined(USE_DRM_ATOMIC) 564 #if defined(USE_DRM_ATOMIC)
565 flags |= DRM_MODE_PAGE_FLIP_EVENT;
564 scoped_ptr<PageFlipPayload> payload( 566 scoped_ptr<PageFlipPayload> payload(
565 new PageFlipPayload(base::ThreadTaskRunnerHandle::Get(), callback)); 567 new PageFlipPayload(base::ThreadTaskRunnerHandle::Get(), callback));
568 uint64_t id = page_flip_manager_->GetNextId();
566 if (!drmModePropertySetCommit(file_.GetPlatformFile(), flags, payload.get(), 569 if (!drmModePropertySetCommit(file_.GetPlatformFile(), flags, payload.get(),
567 properties)) { 570 properties)) {
568 // If successful the payload will be removed by the event 571 page_flip_manager_->RegisterCallback(id, callback);
569 ignore_result(payload.release()); 572
573 // If the flip was requested synchronous or if no watcher has been installed
574 // yet, then synchronously handle the page flip events.
575 if (is_sync || !watcher_) {
576 TRACE_EVENT1("drm", "OnDrmEvent", "socket", file_.GetPlatformFile());
577
578 ProcessDrmEvent(
579 file_.GetPlatformFile(),
580 base::Bind(&PageFlipManager::OnPageFlip, page_flip_manager_));
581 }
570 return true; 582 return true;
571 } 583 }
584 #endif // defined(USE_DRM_ATOMIC)
572 return false; 585 return false;
573 #else
574 return false;
575 #endif // defined(USE_DRM_ATOMIC)
576 } 586 }
577 587
578 bool DrmDevice::SetMaster() { 588 bool DrmDevice::SetMaster() {
579 DCHECK(file_.IsValid()); 589 DCHECK(file_.IsValid());
580 return (drmSetMaster(file_.GetPlatformFile()) == 0); 590 return (drmSetMaster(file_.GetPlatformFile()) == 0);
581 } 591 }
582 592
583 bool DrmDevice::DropMaster() { 593 bool DrmDevice::DropMaster() {
584 DCHECK(file_.IsValid()); 594 DCHECK(file_.IsValid());
585 return (drmDropMaster(file_.GetPlatformFile()) == 0); 595 return (drmDropMaster(file_.GetPlatformFile()) == 0);
(...skipping 21 matching lines...) Expand all
607 b.push_back(lut[i].b); 617 b.push_back(lut[i].b);
608 } 618 }
609 619
610 DCHECK(file_.IsValid()); 620 DCHECK(file_.IsValid());
611 TRACE_EVENT0("drm", "DrmDevice::SetGamma"); 621 TRACE_EVENT0("drm", "DrmDevice::SetGamma");
612 return (drmModeCrtcSetGamma(file_.GetPlatformFile(), crtc_id, r.size(), &r[0], 622 return (drmModeCrtcSetGamma(file_.GetPlatformFile(), crtc_id, r.size(), &r[0],
613 &g[0], &b[0]) == 0); 623 &g[0], &b[0]) == 0);
614 } 624 }
615 625
616 } // namespace ui 626 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/drm/gpu/drm_device.h ('k') | ui/ozone/platform/drm/gpu/hardware_display_plane_manager_atomic.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698