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

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

Issue 1098093005: Revert of ozone: Add sync flag for atomic commit (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 bool DrmDevice::CloseBufferHandle(uint32_t handle) { 481 bool DrmDevice::CloseBufferHandle(uint32_t handle) {
482 struct drm_gem_close close_request; 482 struct drm_gem_close close_request;
483 memset(&close_request, 0, sizeof(close_request)); 483 memset(&close_request, 0, sizeof(close_request));
484 close_request.handle = handle; 484 close_request.handle = handle;
485 return !drmIoctl(file_.GetPlatformFile(), DRM_IOCTL_GEM_CLOSE, 485 return !drmIoctl(file_.GetPlatformFile(), DRM_IOCTL_GEM_CLOSE,
486 &close_request); 486 &close_request);
487 } 487 }
488 488
489 bool DrmDevice::CommitProperties(drmModePropertySet* properties, 489 bool DrmDevice::CommitProperties(drmModePropertySet* properties,
490 uint32_t flags, 490 uint32_t flags,
491 bool is_sync,
492 const PageFlipCallback& callback) { 491 const PageFlipCallback& callback) {
493 #if defined(USE_DRM_ATOMIC) 492 #if defined(USE_DRM_ATOMIC)
494 flags |= DRM_MODE_PAGE_FLIP_EVENT;
495 if (!is_sync)
496 flags |= DRM_MODE_PAGE_FLIP_ASYNC;
497 scoped_ptr<PageFlipPayload> payload( 493 scoped_ptr<PageFlipPayload> payload(
498 new PageFlipPayload(base::ThreadTaskRunnerHandle::Get(), callback)); 494 new PageFlipPayload(base::ThreadTaskRunnerHandle::Get(), callback));
499 if (!drmModePropertySetCommit(file_.GetPlatformFile(), flags, payload.get(), 495 if (!drmModePropertySetCommit(file_.GetPlatformFile(), flags, payload.get(),
500 properties)) { 496 properties)) {
501 // If successful the payload will be removed by the event 497 // If successful the payload will be removed by the event
502 ignore_result(payload.release()); 498 ignore_result(payload.release());
503
504 // If the flip was requested synchronous or if no watcher has been installed
505 // yet, then synchronously handle the page flip events.
506 if (is_sync || !watcher_) {
507 TRACE_EVENT1("drm", "OnDrmEvent", "socket", file_.GetPlatformFile());
508
509 drmEventContext event;
510 event.version = DRM_EVENT_CONTEXT_VERSION;
511 event.page_flip_handler = HandlePageFlipEventOnUI;
512 event.vblank_handler = nullptr;
513
514 drmHandleEvent(file_.GetPlatformFile(), &event);
515 }
516 return true; 499 return true;
517 } 500 }
518 return false; 501 return false;
519 #else 502 #else
520 return false; 503 return false;
521 #endif // defined(USE_DRM_ATOMIC) 504 #endif // defined(USE_DRM_ATOMIC)
522 } 505 }
523 506
524 bool DrmDevice::SetMaster() { 507 bool DrmDevice::SetMaster() {
525 DCHECK(file_.IsValid()); 508 DCHECK(file_.IsValid());
526 return (drmSetMaster(file_.GetPlatformFile()) == 0); 509 return (drmSetMaster(file_.GetPlatformFile()) == 0);
527 } 510 }
528 511
529 bool DrmDevice::DropMaster() { 512 bool DrmDevice::DropMaster() {
530 DCHECK(file_.IsValid()); 513 DCHECK(file_.IsValid());
531 return (drmDropMaster(file_.GetPlatformFile()) == 0); 514 return (drmDropMaster(file_.GetPlatformFile()) == 0);
532 } 515 }
533 516
534 } // namespace ui 517 } // 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