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

Unified Diff: ui/gfx/ozone/impl/drm_wrapper_ozone.cc

Issue 26538005: [Ozone] Adding HardwareDisplayController implementation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Updates Created 7 years, 2 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/gfx/ozone/impl/drm_wrapper_ozone.h ('k') | ui/gfx/ozone/impl/hardware_display_controller_ozone.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/ozone/impl/drm_wrapper_ozone.cc
diff --git a/ui/gfx/ozone/impl/drm_wrapper_ozone.cc b/ui/gfx/ozone/impl/drm_wrapper_ozone.cc
new file mode 100644
index 0000000000000000000000000000000000000000..7b393f78b379025e1ba2229856408e10ba0a5559
--- /dev/null
+++ b/ui/gfx/ozone/impl/drm_wrapper_ozone.cc
@@ -0,0 +1,86 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/gfx/ozone/impl/drm_wrapper_ozone.h"
+
+#include <fcntl.h>
+#include <unistd.h>
+#include <xf86drmMode.h>
+
+#include "base/logging.h"
+
+namespace gfx {
+
+DrmWrapperOzone::DrmWrapperOzone(const char* device_path) {
+ fd_ = open(device_path, O_RDWR | O_CLOEXEC);
+}
+
+DrmWrapperOzone::~DrmWrapperOzone() {
+ if (fd_ >= 0)
+ close(fd_);
+}
+
+drmModeCrtc* DrmWrapperOzone::GetCrtc(uint32_t crtc_id) {
+ CHECK(fd_ >= 0);
+ return drmModeGetCrtc(fd_, crtc_id);
+}
+
+void DrmWrapperOzone::FreeCrtc(drmModeCrtc* crtc) {
+ drmModeFreeCrtc(crtc);
+}
+
+bool DrmWrapperOzone::SetCrtc(uint32_t crtc_id,
+ uint32_t framebuffer,
+ uint32_t* connectors,
+ drmModeModeInfo* mode) {
+ CHECK(fd_ >= 0);
+ return !drmModeSetCrtc(fd_, crtc_id, framebuffer, 0, 0, connectors, 1, mode);
+}
+
+bool DrmWrapperOzone::SetCrtc(drmModeCrtc* crtc, uint32_t* connectors) {
+ CHECK(fd_ >= 0);
+ return !drmModeSetCrtc(fd_,
+ crtc->crtc_id,
+ crtc->buffer_id,
+ crtc->x,
+ crtc->y,
+ connectors,
+ 1,
+ &crtc->mode);
+}
+
+bool DrmWrapperOzone::AddFramebuffer(const drmModeModeInfo& mode,
+ uint8_t depth,
+ uint8_t bpp,
+ uint32_t stride,
+ uint32_t handle,
+ uint32_t* framebuffer) {
+ CHECK(fd_ >= 0);
+ return !drmModeAddFB(fd_,
+ mode.hdisplay,
+ mode.vdisplay,
+ depth,
+ bpp,
+ stride,
+ handle,
+ framebuffer);
+}
+
+bool DrmWrapperOzone::RemoveFramebuffer(uint32_t framebuffer) {
+ CHECK(fd_ >= 0);
+ return !drmModeRmFB(fd_, framebuffer);
+}
+
+bool DrmWrapperOzone::PageFlip(uint32_t crtc_id,
+ uint32_t framebuffer,
+ void* data) {
+ CHECK(fd_ >= 0);
+ return !drmModePageFlip(fd_,
+ crtc_id,
+ framebuffer,
+ DRM_MODE_PAGE_FLIP_EVENT,
+ data);
+}
+
+} // namespace gfx
« no previous file with comments | « ui/gfx/ozone/impl/drm_wrapper_ozone.h ('k') | ui/gfx/ozone/impl/hardware_display_controller_ozone.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698