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

Unified Diff: ui/ozone/platform/drm/gpu/drm_device.cc

Issue 1582613004: Ozone support for multiprocess graphics. (Closed) Base URL: https://github.com/domokit/mojo.git@submit-1
Patch Set: rebase Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/ozone/platform/drm/gpu/drm_device.h ('k') | ui/ozone/platform/drm/gpu/drm_dmabuf_pixmap.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/ozone/platform/drm/gpu/drm_device.cc
diff --git a/ui/ozone/platform/drm/gpu/drm_device.cc b/ui/ozone/platform/drm/gpu/drm_device.cc
index 1d80b6810691bea3aa6cff442c64f6a9855965da..7ec92a4697e05700fd6a7e3fdd254056a9585e68 100644
--- a/ui/ozone/platform/drm/gpu/drm_device.cc
+++ b/ui/ozone/platform/drm/gpu/drm_device.cc
@@ -5,6 +5,7 @@
#include "ui/ozone/platform/drm/gpu/drm_device.h"
#include <fcntl.h>
+#include <i915_drm.h>
#include <sys/mman.h>
#include <unistd.h>
#include <xf86drm.h>
@@ -615,4 +616,42 @@ bool DrmDevice::SetGammaRamp(uint32_t crtc_id,
&g[0], &b[0]) == 0);
}
+bool DrmDevice::BufferHandleToFd(uint32_t handle, int* fd) {
+ int ret;
+
+ ret = drmPrimeHandleToFD(file_.GetPlatformFile(), handle, DRM_CLOEXEC, fd);
+ if (ret == -1)
+ return false;
+
+ return true;
+}
+
+bool DrmDevice::BufferFdToHandle(int fd, uint32_t* handle) {
+ int ret;
+
+ ret = drmPrimeFDToHandle(file_.GetPlatformFile(), fd, handle);
+ if (ret == -1)
+ return false;
+
+ return true;
+}
+
+bool DrmDevice::BufferHandleSetTiling(uint32_t handle,
+ uint32_t stride,
+ uint32_t tiling_mode) {
+ struct drm_i915_gem_set_tiling set_tiling;
+ int ret;
+
+ do {
+ set_tiling.handle = handle;
+ set_tiling.tiling_mode = tiling_mode;
+ set_tiling.stride = stride;
+
+ ret = drmIoctl(file_.GetPlatformFile(), DRM_IOCTL_I915_GEM_SET_TILING,
+ &set_tiling);
+ } while (ret == -1 && (errno == EINTR || errno == EAGAIN));
+
+ return ret != -1;
+}
+
} // namespace ui
« no previous file with comments | « ui/ozone/platform/drm/gpu/drm_device.h ('k') | ui/ozone/platform/drm/gpu/drm_dmabuf_pixmap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698