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

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

Issue 1100763002: Inject CanAddURLToHistory into TopSitesImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@prefs
Patch Set: Fix error introduced during 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 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 bool DrmDevice::CloseBufferHandle(uint32_t handle) { 491 bool DrmDevice::CloseBufferHandle(uint32_t handle) {
492 struct drm_gem_close close_request; 492 struct drm_gem_close close_request;
493 memset(&close_request, 0, sizeof(close_request)); 493 memset(&close_request, 0, sizeof(close_request));
494 close_request.handle = handle; 494 close_request.handle = handle;
495 return !drmIoctl(file_.GetPlatformFile(), DRM_IOCTL_GEM_CLOSE, 495 return !drmIoctl(file_.GetPlatformFile(), DRM_IOCTL_GEM_CLOSE,
496 &close_request); 496 &close_request);
497 } 497 }
498 498
499 bool DrmDevice::CommitProperties(drmModePropertySet* properties, 499 bool DrmDevice::CommitProperties(drmModePropertySet* properties,
500 uint32_t flags, 500 uint32_t flags,
501 bool is_sync,
501 const PageFlipCallback& callback) { 502 const PageFlipCallback& callback) {
502 #if defined(USE_DRM_ATOMIC) 503 #if defined(USE_DRM_ATOMIC)
504 flags |= DRM_MODE_PAGE_FLIP_EVENT;
505 if (!is_sync)
506 flags |= DRM_MODE_PAGE_FLIP_ASYNC;
503 scoped_ptr<PageFlipPayload> payload( 507 scoped_ptr<PageFlipPayload> payload(
504 new PageFlipPayload(base::ThreadTaskRunnerHandle::Get(), callback)); 508 new PageFlipPayload(base::ThreadTaskRunnerHandle::Get(), callback));
505 if (!drmModePropertySetCommit(file_.GetPlatformFile(), flags, payload.get(), 509 if (!drmModePropertySetCommit(file_.GetPlatformFile(), flags, payload.get(),
506 properties)) { 510 properties)) {
507 // If successful the payload will be removed by the event 511 // If successful the payload will be removed by the event
508 ignore_result(payload.release()); 512 ignore_result(payload.release());
513
514 // If the flip was requested synchronous or if no watcher has been installed
515 // yet, then synchronously handle the page flip events.
516 if (is_sync || !watcher_) {
517 TRACE_EVENT1("drm", "OnDrmEvent", "socket", file_.GetPlatformFile());
518
519 drmEventContext event;
520 event.version = DRM_EVENT_CONTEXT_VERSION;
521 event.page_flip_handler = HandlePageFlipEventOnUI;
522 event.vblank_handler = nullptr;
523
524 drmHandleEvent(file_.GetPlatformFile(), &event);
525 }
509 return true; 526 return true;
510 } 527 }
511 return false; 528 return false;
512 #else 529 #else
513 return false; 530 return false;
514 #endif // defined(USE_DRM_ATOMIC) 531 #endif // defined(USE_DRM_ATOMIC)
515 } 532 }
516 533
534 bool DrmDevice::SetCapability(uint64_t capability, uint64_t value) {
535 DCHECK(file_.IsValid());
536 return !drmSetClientCap(file_.GetPlatformFile(), capability, value);
537 }
538
517 bool DrmDevice::SetMaster() { 539 bool DrmDevice::SetMaster() {
518 DCHECK(file_.IsValid()); 540 DCHECK(file_.IsValid());
519 return (drmSetMaster(file_.GetPlatformFile()) == 0); 541 return (drmSetMaster(file_.GetPlatformFile()) == 0);
520 } 542 }
521 543
522 bool DrmDevice::DropMaster() { 544 bool DrmDevice::DropMaster() {
523 DCHECK(file_.IsValid()); 545 DCHECK(file_.IsValid());
524 return (drmDropMaster(file_.GetPlatformFile()) == 0); 546 return (drmDropMaster(file_.GetPlatformFile()) == 0);
525 } 547 }
526 548
527 } // namespace ui 549 } // 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.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698