blob: 1cc948b4304d6af12fc5daa46970013f07ac1745 [file] [log] [blame]
From 7ff43477e7a0193691dade3a3ceb2bc90f9282a7 Mon Sep 17 00:00:00 2001
From: JB Tsai <jb.tsai@mediatek.com>
Date: Wed, 25 Mar 2015 09:04:16 +0800
Subject: [PATCH] CHROMIUM: libdrm: Add header for Mediatek DRM userspace
interface
Add a header defining the userspace interface exposed by Mediatek DRM
driver.
Old-BUG=chrome-os-partner:38389
Old-BUG=b:26575005
Old-TEST=Use kmstest on oak to verify
Signed-off-by: JB Tsai <jb.tsai@mediatek.com>
(rebased from chromeos-2.4.70)
(stripped down to the header alone)
BUG=b:112720782
Signed-off-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Change-Id: Idcbe76bbc710c4ee5b08af640fd3ccaadf9d33a0
---
Makefile.sources | 1 +
include/drm/mediatek_drm.h | 59 ++++++++++++++++++++++++++++++++++++++
meson.build | 2 +-
3 files changed, 61 insertions(+), 1 deletion(-)
create mode 100644 include/drm/mediatek_drm.h
diff --git a/Makefile.sources b/Makefile.sources
index 55290fe9..cf39acfb 100644
--- a/Makefile.sources
+++ b/Makefile.sources
@@ -24,6 +24,7 @@ LIBDRM_INCLUDE_H_FILES := \
include/drm/drm_sarea.h \
include/drm/i915_drm.h \
include/drm/mach64_drm.h \
+ include/drm/mediatek_drm.h \
include/drm/mga_drm.h \
include/drm/msm_drm.h \
include/drm/nouveau_drm.h \
diff --git a/include/drm/mediatek_drm.h b/include/drm/mediatek_drm.h
new file mode 100644
index 00000000..6d87d9c7
--- /dev/null
+++ b/include/drm/mediatek_drm.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2015 MediaTek Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+
+#ifndef _UAPI_MEDIATEK_DRM_H
+#define _UAPI_MEDIATEK_DRM_H
+
+#include "drm.h"
+
+/**
+ * User-desired buffer creation information structure.
+ *
+ * @size: user-desired memory allocation size.
+ * - this size value would be page-aligned internally.
+ * @flags: user request for setting memory type or cache attributes.
+ * @handle: returned a handle to created gem object.
+ * - this handle will be set by gem module of kernel side.
+ */
+struct drm_mtk_gem_create {
+ uint64_t size;
+ uint32_t flags;
+ uint32_t handle;
+};
+
+/**
+ * A structure for getting buffer offset.
+ *
+ * @handle: a pointer to gem object created.
+ * @pad: just padding to be 64-bit aligned.
+ * @offset: relatived offset value of the memory region allocated.
+ * - this value should be set by user.
+ */
+struct drm_mtk_gem_map_off {
+ uint32_t handle;
+ uint32_t pad;
+ uint64_t offset;
+};
+
+#define DRM_MTK_GEM_CREATE 0x00
+#define DRM_MTK_GEM_MAP_OFFSET 0x01
+
+#define DRM_IOCTL_MTK_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + \
+ DRM_MTK_GEM_CREATE, struct drm_mtk_gem_create)
+
+#define DRM_IOCTL_MTK_GEM_MAP_OFFSET DRM_IOWR(DRM_COMMAND_BASE + \
+ DRM_MTK_GEM_MAP_OFFSET, struct drm_mtk_gem_map_off)
+
+
+#endif /* _UAPI_MEDIATEK_DRM_H */
diff --git a/meson.build b/meson.build
index fc02f552..2b21a318 100644
--- a/meson.build
+++ b/meson.build
@@ -310,7 +310,7 @@ install_headers('libsync.h', 'xf86drm.h', 'xf86drmMode.h')
install_headers(
'include/drm/drm.h', 'include/drm/drm_fourcc.h', 'include/drm/drm_mode.h',
'include/drm/drm_sarea.h', 'include/drm/i915_drm.h',
- 'include/drm/mach64_drm.h', 'include/drm/mga_drm.h',
+ 'include/drm/mach64_drm.h', 'include/drm/mediatek_drm.h', 'include/drm/mga_drm.h',
'include/drm/msm_drm.h', 'include/drm/nouveau_drm.h',
'include/drm/qxl_drm.h', 'include/drm/r128_drm.h',
'include/drm/radeon_drm.h', 'include/drm/amdgpu_drm.h',
--
2.30.0.365.g02bc693789-goog