aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArmin Kuster <akuster808@gmail.com>2018-07-25 13:50:52 -0700
committerArmin Kuster <akuster808@gmail.com>2018-07-25 13:50:52 -0700
commitf030f971034b4df937c6b197a0cd70fee1daee6d (patch)
tree2afa6ba832accab06775427cafaa207de716eb03
parent0aff7abedc1c7727c88029a123107f4faf5ba4f1 (diff)
downloadmeta-openembedded-contrib-akuster/armsoc-meson.tar.gz
meta-openembedded-contrib-akuster/armsoc-meson.tar.bz2
meta-openembedded-contrib-akuster/armsoc-meson.zip
xf86-video-armsoc: add meson supportakuster/armsoc-meson
segaults currently Signed-off-by: Armin Kuster <akuster808@gmail.com>
-rw-r--r--meta-oe/recipes-graphics/xorg-driver/xf86-video-armsoc/0001-Add-meson-drmmode.patch164
-rw-r--r--meta-oe/recipes-graphics/xorg-driver/xf86-video-armsoc/0003-Use-DRM-dumb-ioctl.patch169
-rw-r--r--meta-oe/recipes-graphics/xorg-driver/xf86-video-armsoc_1.4.1.bb3
3 files changed, 336 insertions, 0 deletions
diff --git a/meta-oe/recipes-graphics/xorg-driver/xf86-video-armsoc/0001-Add-meson-drmmode.patch b/meta-oe/recipes-graphics/xorg-driver/xf86-video-armsoc/0001-Add-meson-drmmode.patch
new file mode 100644
index 0000000000..ff3b7a37b1
--- /dev/null
+++ b/meta-oe/recipes-graphics/xorg-driver/xf86-video-armsoc/0001-Add-meson-drmmode.patch
@@ -0,0 +1,164 @@
+From ee88bf84d9d777dde8154c1176093ba59996d289 Mon Sep 17 00:00:00 2001
+From: Neil Armstrong <narmstrong@baylibre.com>
+Date: Wed, 1 Feb 2017 10:03:57 +0000
+Subject: [PATCH 1/3] Add meson drmmode
+
+Upstream-Status: Backport
+https://github.com/superna9999/xf86-video-armsoc
+
+Hand applied as sunxi-mali changes not backported.
+
+Signed-off-by: Armin Kuster <akuster808@gmail.com>
+
+---
+ src/Makefile.am | 3 +-
+ src/armsoc_driver.c | 1 +
+ src/drmmode_driver.h | 1 +
+ src/drmmode_meson/drmmode_meson.c | 101 ++++++++++++++++++++++++++++++++++++++
+ 4 files changed, 105 insertions(+), 1 deletion(-)
+ create mode 100644 src/drmmode_meson/drmmode_meson.c
+
+Index: git/src/drmmode_meson/drmmode_meson.c
+===================================================================
+--- /dev/null
++++ git/src/drmmode_meson/drmmode_meson.c
+@@ -0,0 +1,101 @@
++/*
++ * Copyright © 2013 ARM Limited.
++ *
++ * Permission is hereby granted, free of charge, to any person obtaining a
++ * copy of this software and associated documentation files (the "Software"),
++ * to deal in the Software without restriction, including without limitation
++ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
++ * and/or sell copies of the Software, and to permit persons to whom the
++ * Software is furnished to do so, subject to the following conditions:
++ *
++ * The above copyright notice and this permission notice (including the next
++ * paragraph) shall be included in all copies or substantial portions of the
++ * Software.
++ *
++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
++ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
++ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
++ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
++ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
++ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
++ * SOFTWARE.
++ *
++ */
++
++#include <xf86drm.h>
++
++#include "../drmmode_driver.h"
++
++#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
++
++#define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask))
++#define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1)
++#define ALIGN(x, a) __ALIGN_KERNEL((x), (a))
++
++/* This should be included from uapi headers once the driver is
++ * mainlined
++ */
++struct drm_meson_gem_create {
++ uint64_t size;
++ uint32_t flags;
++ uint32_t handle;
++};
++
++#define DRM_MESON_GEM_CREATE 0x00
++
++#define DRM_IOCTL_MESON_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_MESON_GEM_CREATE, \
++ struct drm_meson_gem_create)
++
++/* Cursor dimensions
++ * Technically we probably don't have any size limit.. since we
++ * are just using an overlay... but xserver will always create
++ * cursor images in the max size, so don't use width/height values
++ * that are too big
++ */
++/* width */
++#define CURSORW (64)
++/* height */
++#define CURSORH (64)
++/* Padding added down each side of cursor image */
++#define CURSORPAD (0)
++
++static int create_custom_gem(int fd, struct armsoc_create_gem *create_gem)
++{
++ struct drm_meson_gem_create create_meson;
++ int ret;
++ unsigned int pitch;
++
++ assert((create_gem->buf_type == ARMSOC_BO_SCANOUT) ||
++ (create_gem->buf_type == ARMSOC_BO_NON_SCANOUT));
++
++ /* make pitch a multiple of 64 bytes for best performance */
++ pitch = DIV_ROUND_UP(create_gem->width * create_gem->bpp, 8);
++ pitch = ALIGN(pitch, 64);
++
++ memset(&create_meson, 0, sizeof(create_meson));
++ create_meson.size = create_gem->height * pitch;
++
++ ret = drmIoctl(fd, DRM_IOCTL_MESON_GEM_CREATE, &create_meson);
++ if (ret)
++ return ret;
++
++ /* Convert custom create_meson to generic create_gem */
++ create_gem->handle = create_meson.handle;
++ create_gem->pitch = pitch;
++ create_gem->size = create_meson.size;
++
++ return 0;
++}
++
++struct drmmode_interface meson_interface = {
++ "meson" /* name of drm driver*/,
++ 1 /* use_page_flip_events */,
++ 1 /* use_early_display */,
++ CURSORW /* cursor width */,
++ CURSORH /* cursor_height */,
++ CURSORPAD /* cursor padding */,
++ HWCURSOR_API_PLANE /* cursor_api */,
++ NULL /* init_plane_for_cursor */,
++ 0 /* vblank_query_supported */,
++ create_custom_gem /* create_custom_gem */,
++};
+Index: git/src/armsoc_driver.c
+===================================================================
+--- git.orig/src/armsoc_driver.c
++++ git/src/armsoc_driver.c
+@@ -737,6 +737,7 @@ static struct drmmode_interface *get_drm
+ &pl111_interface,
+ &kirin_interface,
+ &sti_interface,
++ &meson_interface,
+ };
+ int i;
+
+Index: git/src/drmmode_driver.h
+===================================================================
+--- git.orig/src/drmmode_driver.h
++++ git/src/drmmode_driver.h
+@@ -106,6 +106,6 @@ extern struct drmmode_interface exynos_i
+ extern struct drmmode_interface pl111_interface;
+ extern struct drmmode_interface kirin_interface;
+ extern struct drmmode_interface sti_interface;
+-
++extern struct drmmode_interface meson_interface;
+
+ #endif
+Index: git/src/Makefile.am
+===================================================================
+--- git.orig/src/Makefile.am
++++ git/src/Makefile.am
+@@ -43,7 +43,8 @@ armsoc_drv_ladir = @moduledir@/drivers
+ DRMMODE_SRCS = drmmode_exynos/drmmode_exynos.c \
+ drmmode_pl111/drmmode_pl111.c \
+ drmmode_kirin/drmmode_kirin.c \
+- drmmode_sti/drmmode_sti.c
++ drmmode_sti/drmmode_sti.c \
++ drmmode_meson/drmmode_meson.c
+
+
+ armsoc_drv_la_SOURCES = \
diff --git a/meta-oe/recipes-graphics/xorg-driver/xf86-video-armsoc/0003-Use-DRM-dumb-ioctl.patch b/meta-oe/recipes-graphics/xorg-driver/xf86-video-armsoc/0003-Use-DRM-dumb-ioctl.patch
new file mode 100644
index 0000000000..8b132932f6
--- /dev/null
+++ b/meta-oe/recipes-graphics/xorg-driver/xf86-video-armsoc/0003-Use-DRM-dumb-ioctl.patch
@@ -0,0 +1,169 @@
+From 9fc01df9bf5596f4bd2d4223b7549e28729d01d1 Mon Sep 17 00:00:00 2001
+From: Neil Armstrong <narmstrong@baylibre.com>
+Date: Tue, 14 Feb 2017 11:05:38 +0000
+Subject: [PATCH 3/3] Use DRM dumb ioctl
+
+Upstream-Status: Backport
+Signed-off-by: Armin Kuster <akuster808@gmail.com>
+
+---
+ src/drmmode_meson/drmmode_meson.c | 109 +++++++++++++++++++-------------------
+ 1 file changed, 55 insertions(+), 54 deletions(-)
+
+diff --git a/src/drmmode_meson/drmmode_meson.c b/src/drmmode_meson/drmmode_meson.c
+index 9fcc8ad..a286cfe 100644
+--- a/src/drmmode_meson/drmmode_meson.c
++++ b/src/drmmode_meson/drmmode_meson.c
+@@ -1,51 +1,45 @@
+ /*
+- * Copyright © 2013 ARM Limited.
++ * Copyright 2013 ARM Limited.
++ * Copyright 2016 Linaro Limited.
++ * Copyright 2017 BayLibre SAS.
+ *
+- * Permission is hereby granted, free of charge, to any person obtaining a
+- * copy of this software and associated documentation files (the "Software"),
+- * to deal in the Software without restriction, including without limitation
+- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+- * and/or sell copies of the Software, and to permit persons to whom the
++ * Permission is hereby granted, free of charge, to any person
++obtaining a
++ * copy of this software and associated documentation files (the
++"Software"),
++ * to deal in the Software without restriction, including without
++limitation
++ * the rights to use, copy, modify, merge, publish, distribute,
++sublicense,
++ * and/or sell copies of the Software, and to permit persons to whom
++the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+- * The above copyright notice and this permission notice (including the next
+- * paragraph) shall be included in all copies or substantial portions of the
++ * The above copyright notice and this permission notice (including the
++next
++ * paragraph) shall be included in all copies or substantial portions
++of the
+ * Software.
+ *
+- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
++EXPRESS OR
++ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
++MERCHANTABILITY,
++ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
++SHALL
++ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
++OTHER
++ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
++ARISING FROM,
++ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
++DEALINGS IN THE
+ * SOFTWARE.
+ *
+ */
+
+ #include <xf86drm.h>
+-
+ #include "../drmmode_driver.h"
+
+-#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
+-
+-#define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask))
+-#define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1)
+-#define ALIGN(x, a) __ALIGN_KERNEL((x), (a))
+-
+-/* This should be included from uapi headers once the driver is
+- * mainlined
+- */
+-struct drm_meson_gem_create {
+- uint64_t size;
+- uint32_t flags;
+- uint32_t handle;
+-};
+-
+-#define DRM_MESON_GEM_CREATE 0x00
+-
+-#define DRM_IOCTL_MESON_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_MESON_GEM_CREATE, \
+- struct drm_meson_gem_create)
+-
+ /* Cursor dimensions
+ * Technically we probably don't have any size limit.. since we
+ * are just using an overlay... but xserver will always create
+@@ -59,11 +53,14 @@ struct drm_meson_gem_create {
+ /* Padding added down each side of cursor image */
+ #define CURSORPAD (0)
+
++#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
++#define ALIGN(val, align) (((val) + (align) - 1) & ~((align) - 1))
++
+ static int create_custom_gem(int fd, struct armsoc_create_gem *create_gem)
+ {
+- struct drm_meson_gem_create create_meson;
+- int ret;
++ struct drm_mode_create_dumb arg;
+ unsigned int pitch;
++ int ret;
+
+ assert((create_gem->buf_type == ARMSOC_BO_SCANOUT) ||
+ (create_gem->buf_type == ARMSOC_BO_NON_SCANOUT));
+@@ -72,30 +69,34 @@ static int create_custom_gem(int fd, struct armsoc_create_gem *create_gem)
+ pitch = DIV_ROUND_UP(create_gem->width * create_gem->bpp, 8);
+ pitch = ALIGN(pitch, 64);
+
+- memset(&create_meson, 0, sizeof(create_meson));
+- create_meson.size = create_gem->height * pitch;
++ memset(&arg, 0, sizeof(arg));
++ arg.width = create_gem->width;
++ arg.height = create_gem->height;
++ arg.bpp = create_gem->bpp;
++ arg.pitch = pitch;
++ arg.size = pitch * create_gem->height;
+
+- ret = drmIoctl(fd, DRM_IOCTL_MESON_GEM_CREATE, &create_meson);
++ ret = drmIoctl(fd, DRM_IOCTL_MODE_CREATE_DUMB, &arg);
+ if (ret)
+ return ret;
+
+- /* Convert custom create_meson to generic create_gem */
+- create_gem->handle = create_meson.handle;
+- create_gem->pitch = pitch;
+- create_gem->size = create_meson.size;
++ create_gem->handle = arg.handle;
++ create_gem->pitch = arg.pitch;
++ create_gem->size = arg.size;
+
+ return 0;
+ }
+
+ struct drmmode_interface meson_interface = {
+- "meson" /* name of drm driver*/,
+- 1 /* use_page_flip_events */,
+- 1 /* use_early_display */,
+- CURSORW /* cursor width */,
+- CURSORH /* cursor_height */,
+- CURSORPAD /* cursor padding */,
+- HWCURSOR_API_PLANE /* cursor_api */,
+- NULL /* init_plane_for_cursor */,
+- 0 /* vblank_query_supported */,
+- create_custom_gem /* create_custom_gem */,
++ "meson" /* name of drm driver */,
++ 1 /* use_page_flip_events */,
++ 1 /* use_early_display */,
++ CURSORW /* cursor width */,
++ CURSORH /* cursor_height */,
++ CURSORPAD /* cursor padding */,
++ HWCURSOR_API_NONE /* software cursor */,
++ NULL /* no plane for cursor */,
++ 0 /* vblank_query_supported */,
++ create_custom_gem /* create_custom_gem */,
+ };
++
+--
+2.7.4
+
diff --git a/meta-oe/recipes-graphics/xorg-driver/xf86-video-armsoc_1.4.1.bb b/meta-oe/recipes-graphics/xorg-driver/xf86-video-armsoc_1.4.1.bb
index b436ef1e4a..e7ad961f64 100644
--- a/meta-oe/recipes-graphics/xorg-driver/xf86-video-armsoc_1.4.1.bb
+++ b/meta-oe/recipes-graphics/xorg-driver/xf86-video-armsoc_1.4.1.bb
@@ -9,6 +9,9 @@ DEPENDS += "virtual/libx11 libdrm xorgproto"
SRCREV = "8bbdb2ae3bb8ef649999a8da33ddbe11a04763b8"
SRC_URI = "git://anongit.freedesktop.org/xorg/driver/xf86-video-armsoc"
+SRC_URI += "file://0001-Add-meson-drmmode.patch \
+ file://0003-Use-DRM-dumb-ioctl.patch"
+
S = "${WORKDIR}/git"
RDEPENDS_${PN} += "xserver-xorg-module-exa"