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

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

Issue 1132803004: ozone: drm: Fix graphics buffer handle leak in DrmConsoleBuffer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2357
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
« no previous file with comments | « ui/ozone/platform/drm/gpu/drm_device.h ('k') | ui/ozone/platform/drm/test/mock_drm_device.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 void DrmDevice::DestroyDumbBuffer(const SkImageInfo& info, 469 void DrmDevice::DestroyDumbBuffer(const SkImageInfo& info,
470 uint32_t handle, 470 uint32_t handle,
471 uint32_t stride, 471 uint32_t stride,
472 void* pixels) { 472 void* pixels) {
473 DCHECK(file_.IsValid()); 473 DCHECK(file_.IsValid());
474 TRACE_EVENT1("drm", "DrmDevice::DestroyDumbBuffer", "handle", handle); 474 TRACE_EVENT1("drm", "DrmDevice::DestroyDumbBuffer", "handle", handle);
475 munmap(pixels, info.getSafeSize(stride)); 475 munmap(pixels, info.getSafeSize(stride));
476 DrmDestroyDumbBuffer(file_.GetPlatformFile(), handle); 476 DrmDestroyDumbBuffer(file_.GetPlatformFile(), handle);
477 } 477 }
478 478
479 bool DrmDevice::CloseBufferHandle(uint32_t handle) {
480 struct drm_gem_close close_request;
481 memset(&close_request, 0, sizeof(close_request));
482 close_request.handle = handle;
483 return !drmIoctl(file_.GetPlatformFile(), DRM_IOCTL_GEM_CLOSE,
484 &close_request);
485 }
486
479 bool DrmDevice::CommitProperties(drmModePropertySet* properties, 487 bool DrmDevice::CommitProperties(drmModePropertySet* properties,
480 uint32_t flags, 488 uint32_t flags,
481 const PageFlipCallback& callback) { 489 const PageFlipCallback& callback) {
482 #if defined(USE_DRM_ATOMIC) 490 #if defined(USE_DRM_ATOMIC)
483 scoped_ptr<PageFlipPayload> payload( 491 scoped_ptr<PageFlipPayload> payload(
484 new PageFlipPayload(base::ThreadTaskRunnerHandle::Get(), callback)); 492 new PageFlipPayload(base::ThreadTaskRunnerHandle::Get(), callback));
485 if (!drmModePropertySetCommit(file_.GetPlatformFile(), flags, payload.get(), 493 if (!drmModePropertySetCommit(file_.GetPlatformFile(), flags, payload.get(),
486 properties)) { 494 properties)) {
487 // If successful the payload will be removed by the event 495 // If successful the payload will be removed by the event
488 ignore_result(payload.release()); 496 ignore_result(payload.release());
489 return true; 497 return true;
490 } 498 }
491 return false; 499 return false;
492 #else 500 #else
493 return false; 501 return false;
494 #endif // defined(USE_DRM_ATOMIC) 502 #endif // defined(USE_DRM_ATOMIC)
495 } 503 }
496 504
497 bool DrmDevice::SetMaster() { 505 bool DrmDevice::SetMaster() {
498 DCHECK(file_.IsValid()); 506 DCHECK(file_.IsValid());
499 return (drmSetMaster(file_.GetPlatformFile()) == 0); 507 return (drmSetMaster(file_.GetPlatformFile()) == 0);
500 } 508 }
501 509
502 bool DrmDevice::DropMaster() { 510 bool DrmDevice::DropMaster() {
503 DCHECK(file_.IsValid()); 511 DCHECK(file_.IsValid());
504 return (drmDropMaster(file_.GetPlatformFile()) == 0); 512 return (drmDropMaster(file_.GetPlatformFile()) == 0);
505 } 513 }
506 514
507 } // namespace ui 515 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/drm/gpu/drm_device.h ('k') | ui/ozone/platform/drm/test/mock_drm_device.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698