summaryrefslogtreecommitdiff
path: root/recipes-graphics/drm
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-graphics/drm')
-rw-r--r--recipes-graphics/drm/files/0001-Add-drmModeAddFB2WithModifiers-which-takes-format-mo.patch82
-rw-r--r--recipes-graphics/drm/files/0001-sync-kernel-UAPI.patch51
-rw-r--r--recipes-graphics/drm/libdrm_%.bbappend16
3 files changed, 149 insertions, 0 deletions
diff --git a/recipes-graphics/drm/files/0001-Add-drmModeAddFB2WithModifiers-which-takes-format-mo.patch b/recipes-graphics/drm/files/0001-Add-drmModeAddFB2WithModifiers-which-takes-format-mo.patch
new file mode 100644
index 0000000..36cc8e2
--- /dev/null
+++ b/recipes-graphics/drm/files/0001-Add-drmModeAddFB2WithModifiers-which-takes-format-mo.patch
@@ -0,0 +1,82 @@
+From abfa680dbdfa4600105d904f4903c047d453cdb5 Mon Sep 17 00:00:00 2001
+From: "Kristian H. Kristensen" <hoegsberg@chromium.org>
+Date: Thu, 8 Sep 2016 13:08:59 -0700
+Subject: [PATCH] Add drmModeAddFB2WithModifiers() which takes format modifiers
+
+The only other user of this feature open codes the ioctl. Let's add an
+entry point for this to libdrm.
+
+Signed-off-by: Kristian H. Kristensen <hoegsberg@chromium.org>
+Reviewed-by: Rob Clark <robdclark@gmail.com>
+---
+ xf86drmMode.c | 21 +++++++++++++++++----
+ xf86drmMode.h | 7 +++++++
+ 2 files changed, 24 insertions(+), 4 deletions(-)
+
+diff --git a/xf86drmMode.c b/xf86drmMode.c
+index f7b5948..228c6e4 100644
+--- a/xf86drmMode.c
++++ b/xf86drmMode.c
+@@ -270,10 +270,10 @@ int drmModeAddFB(int fd, uint32_t width, uint32_t height, uint8_t depth,
+ return 0;
+ }
+
+-int drmModeAddFB2(int fd, uint32_t width, uint32_t height,
+- uint32_t pixel_format, uint32_t bo_handles[4],
+- uint32_t pitches[4], uint32_t offsets[4],
+- uint32_t *buf_id, uint32_t flags)
++int drmModeAddFB2WithModifiers(int fd, uint32_t width, uint32_t height,
++ uint32_t pixel_format, uint32_t bo_handles[4],
++ uint32_t pitches[4], uint32_t offsets[4],
++ uint64_t modifier[4], uint32_t *buf_id, uint32_t flags)
+ {
+ struct drm_mode_fb_cmd2 f;
+ int ret;
+@@ -286,6 +286,8 @@ int drmModeAddFB2(int fd, uint32_t width, uint32_t height,
+ memcpy(f.handles, bo_handles, 4 * sizeof(bo_handles[0]));
+ memcpy(f.pitches, pitches, 4 * sizeof(pitches[0]));
+ memcpy(f.offsets, offsets, 4 * sizeof(offsets[0]));
++ if (modifier)
++ memcpy(f.modifier, modifier, 4 * sizeof(modifier[0]));
+
+ if ((ret = DRM_IOCTL(fd, DRM_IOCTL_MODE_ADDFB2, &f)))
+ return ret;
+@@ -294,6 +296,17 @@ int drmModeAddFB2(int fd, uint32_t width, uint32_t height,
+ return 0;
+ }
+
++int drmModeAddFB2(int fd, uint32_t width, uint32_t height,
++ uint32_t pixel_format, uint32_t bo_handles[4],
++ uint32_t pitches[4], uint32_t offsets[4],
++ uint32_t *buf_id, uint32_t flags)
++{
++ return drmModeAddFB2WithModifiers(fd, width, height,
++ pixel_format, bo_handles,
++ pitches, offsets, NULL,
++ buf_id, flags);
++}
++
+ int drmModeRmFB(int fd, uint32_t bufferId)
+ {
+ return DRM_IOCTL(fd, DRM_IOCTL_MODE_RMFB, &bufferId);
+diff --git a/xf86drmMode.h b/xf86drmMode.h
+index 4de7bbb..1a02fed 100644
+--- a/xf86drmMode.h
++++ b/xf86drmMode.h
+@@ -369,6 +369,13 @@ extern int drmModeAddFB2(int fd, uint32_t width, uint32_t height,
+ uint32_t pixel_format, uint32_t bo_handles[4],
+ uint32_t pitches[4], uint32_t offsets[4],
+ uint32_t *buf_id, uint32_t flags);
++
++/* ...with format modifiers */
++int drmModeAddFB2WithModifiers(int fd, uint32_t width, uint32_t height,
++ uint32_t pixel_format, uint32_t bo_handles[4],
++ uint32_t pitches[4], uint32_t offsets[4],
++ uint64_t modifier[4], uint32_t *buf_id, uint32_t flags);
++
+ /**
+ * Destroies the given framebuffer.
+ */
+--
+2.9.3
+
diff --git a/recipes-graphics/drm/files/0001-sync-kernel-UAPI.patch b/recipes-graphics/drm/files/0001-sync-kernel-UAPI.patch
new file mode 100644
index 0000000..19e69aa
--- /dev/null
+++ b/recipes-graphics/drm/files/0001-sync-kernel-UAPI.patch
@@ -0,0 +1,51 @@
+From 9bfdb183a7c50266caa97e5fcbabeaf54db6c2a1 Mon Sep 17 00:00:00 2001
+From: Alexandre Courbot <acourbot@nvidia.com>
+Date: Tue, 20 Sep 2016 11:33:51 +0900
+Subject: [PATCH] sync kernel UAPI
+
+---
+ include/drm/drm_fourcc.h | 23 +++++++++++++++++++++++
+ 1 file changed, 23 insertions(+)
+
+diff --git a/include/drm/drm_fourcc.h b/include/drm/drm_fourcc.h
+index 4d8da69..7fed8a2 100644
+--- a/include/drm/drm_fourcc.h
++++ b/include/drm/drm_fourcc.h
+@@ -26,6 +26,10 @@
+
+ #include "drm.h"
+
++#if defined(__cplusplus)
++extern "C" {
++#endif
++
+ #define fourcc_code(a, b, c, d) ((__u32)(a) | ((__u32)(b) << 8) | \
+ ((__u32)(c) << 16) | ((__u32)(d) << 24))
+
+@@ -229,4 +233,23 @@
+ */
+ #define DRM_FORMAT_MOD_SAMSUNG_64_32_TILE fourcc_mod_code(SAMSUNG, 1)
+
++
++/* NVIDIA Frame buffer modifiers */
++
++#define NV_FORMAT_MOD_TEGRA_SHIFT 32
++
++#define NV_FORMAT_MOD_TEGRA_TILED \
++ fourcc_mod_code(NV, 1ULL << NV_FORMAT_MOD_TEGRA_SHIFT)
++
++#define NV_FORMAT_MOD_TEGRA_BLOCK_MASK \
++ fourcc_mod_code(NV, 2ULL << NV_FORMAT_MOD_TEGRA_SHIFT)
++#define NV_FORMAT_MOD_TEGRA_BLOCK_VALUE(m) \
++ (m & ((1ULL << NV_FORMAT_MOD_TEGRA_SHIFT) - 1))
++#define NV_FORMAT_MOD_TEGRA_BLOCK(v) \
++ (NV_FORMAT_MOD_TEGRA_BLOCK_MASK | NV_FORMAT_MOD_TEGRA_BLOCK_VALUE(v))
++
++#if defined(__cplusplus)
++}
++#endif
++
+ #endif /* DRM_FOURCC_H */
+--
+2.9.3
+
diff --git a/recipes-graphics/drm/libdrm_%.bbappend b/recipes-graphics/drm/libdrm_%.bbappend
new file mode 100644
index 0000000..c035f18
--- /dev/null
+++ b/recipes-graphics/drm/libdrm_%.bbappend
@@ -0,0 +1,16 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
+
+SRC_URI += "\
+ file://0001-Add-drmModeAddFB2WithModifiers-which-takes-format-mo.patch \
+ file://0001-sync-kernel-UAPI.patch \
+ "
+PACKAGES += "\
+ ${PN}-tegra \
+ \
+ "
+FILES_${PN}-tegra = "${libdir}/libdrm_tegra.so.*"
+
+EXTRA_OECONF_append += "\
+ --enable-tegra-experimental-api \
+ "
+