diff options
author | Dominik Sliwa <dominik.sliwa@toradex.com> | 2017-01-09 17:35:46 +0100 |
---|---|---|
committer | Dominik Sliwa <dominik.sliwa@toradex.com> | 2017-01-11 21:59:33 +0100 |
commit | 6c22936df0c551961df61cc428e6590d2f8bbb6d (patch) | |
tree | 163ad22e51e402a02ac2fd98156f1db0f750d3a1 /recipes-graphics/xorg-xserver | |
parent | d54c4ca13c2976671fb2e91b774ae1a94039715a (diff) |
apalis-tk1-mainline: Move GPU acceleration support to mesa
Instead of patching every app, let's patch mesa to pretend
that we have a normal GPU.
based on: github.com/Gnurou/mesa/commits/renderonly
Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Diffstat (limited to 'recipes-graphics/xorg-xserver')
3 files changed, 0 insertions, 223 deletions
diff --git a/recipes-graphics/xorg-xserver/xserver-xorg-1.18.4/0001-HACK-use-render-nodes-and-tegra-tiling-format.patch b/recipes-graphics/xorg-xserver/xserver-xorg-1.18.4/0001-HACK-use-render-nodes-and-tegra-tiling-format.patch deleted file mode 100644 index 39b92e8..0000000 --- a/recipes-graphics/xorg-xserver/xserver-xorg-1.18.4/0001-HACK-use-render-nodes-and-tegra-tiling-format.patch +++ /dev/null @@ -1,145 +0,0 @@ -From c9ba24058a5cae32c8d8431911485fba7c6d3a14 Mon Sep 17 00:00:00 2001 -From: Alexandre Courbot <acourbot@nvidia.com> -Date: Thu, 24 Sep 2015 18:23:51 +0900 -Subject: [PATCH 1/7] [HACK] use render nodes and tegra tiling format - ---- - glamor/glamor_egl.c | 5 +++ - hw/xfree86/drivers/modesetting/drmmode_display.c | 56 ++++++++++++++++++++++-- - hw/xfree86/drivers/modesetting/drmmode_display.h | 1 + - 3 files changed, 58 insertions(+), 4 deletions(-) - -diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c -index 5aacbed..b6941f2 100644 ---- a/glamor/glamor_egl.c -+++ b/glamor/glamor_egl.c -@@ -809,6 +809,11 @@ glamor_egl_init(ScrnInfoPtr scrn, int fd) - xf86GlamorEGLPrivateIndex = xf86AllocateScrnInfoPrivateIndex(); - - scrn->privates[xf86GlamorEGLPrivateIndex].ptr = glamor_egl; -+ -+ -+ fd = open("/dev/dri/renderD128", O_RDWR); -+ xf86Msg(X_INFO, "Opening render node: %d\n", fd); -+ - glamor_egl->fd = fd; - #ifdef GLAMOR_HAS_GBM - glamor_egl->gbm = gbm_create_device(glamor_egl->fd); -diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c b/hw/xfree86/drivers/modesetting/drmmode_display.c -index 9c54310..9c9fa27 100644 ---- a/hw/xfree86/drivers/modesetting/drmmode_display.c -+++ b/hw/xfree86/drivers/modesetting/drmmode_display.c -@@ -50,6 +50,8 @@ - - #include "driver.h" - -+#include <tegra_drm.h> -+ - static Bool drmmode_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height); - - static Bool -@@ -160,15 +162,61 @@ drmmode_bo_map(drmmode_ptr drmmode, drmmode_bo *bo) - } - - static Bool -+drmmode_tegra_import(drmmode_ptr drmmode, drmmode_bo *bo) -+{ -+ struct drm_tegra_gem_set_tiling args; -+ int err; -+ -+ memset(&args, 0, sizeof(args)); -+ args.handle = bo->drm_handle; -+ args.mode = DRM_TEGRA_GEM_TILING_MODE_BLOCK; -+ args.value = 4; -+ -+ err = ioctl(drmmode->fd, DRM_IOCTL_TEGRA_GEM_SET_TILING, &args); -+ if (err < 0) { -+ xf86Msg(X_ERROR, "failed to set tiling parameters\n"); -+ return FALSE; -+ } -+ -+ return TRUE; -+} -+ -+static Bool - drmmode_create_bo(drmmode_ptr drmmode, drmmode_bo *bo, - unsigned width, unsigned height, unsigned bpp) - { - #ifdef GLAMOR_HAS_GBM -+ uint32_t handle; -+ int fd; -+ int ret; -+ - if (drmmode->glamor) { - bo->gbm = gbm_bo_create(drmmode->gbm, width, height, - GBM_FORMAT_ARGB8888, - GBM_BO_USE_RENDERING | GBM_BO_USE_SCANOUT); -- return bo->gbm != NULL; -+ -+ if (bo->gbm == NULL) -+ return FALSE; -+ -+ handle = gbm_bo_get_handle(bo->gbm).u32; -+ -+ ret = drmPrimeHandleToFD(gbm_device_get_fd(drmmode->gbm), handle, 0, &fd); -+ if (ret) { -+ xf86Msg(X_ERROR, "failed to export bo\n"); -+ return FALSE; -+ } -+ -+ ret = drmPrimeFDToHandle(drmmode->fd, fd, &handle); -+ if (ret) { -+ xf86Msg(X_ERROR, "failed to import bo\n"); -+ close(fd); -+ return FALSE; -+ } -+ -+ close(fd); -+ bo->drm_handle = handle; -+ -+ return drmmode_tegra_import(drmmode, bo); - } - #endif - -@@ -410,7 +458,7 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode, - pScrn->virtualX, pScrn->virtualY, - pScrn->depth, drmmode->kbpp, - drmmode_bo_get_pitch(&drmmode->front_bo), -- drmmode_bo_get_handle(&drmmode->front_bo), -+ drmmode->front_bo.drm_handle, - &drmmode->fb_id); - if (ret < 0) { - ErrorF("failed to add fb %d\n", ret); -@@ -712,7 +760,7 @@ drmmode_shadow_allocate(xf86CrtcPtr crtc, int width, int height) - ret = drmModeAddFB(drmmode->fd, width, height, crtc->scrn->depth, - drmmode->kbpp, - drmmode_bo_get_pitch(&drmmode_crtc->rotate_bo), -- drmmode_bo_get_handle(&drmmode_crtc->rotate_bo), -+ drmmode_crtc->rotate_bo.drm_handle, - &drmmode_crtc->rotate_fb_id); - - if (ret) { -@@ -1700,7 +1748,7 @@ drmmode_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height) - - ret = drmModeAddFB(drmmode->fd, width, height, scrn->depth, - scrn->bitsPerPixel, pitch, -- drmmode_bo_get_handle(&drmmode->front_bo), -+ drmmode->front_bo.drm_handle, - &drmmode->fb_id); - if (ret) - goto fail; -diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.h b/hw/xfree86/drivers/modesetting/drmmode_display.h -index 9139ed4..547fd0d 100644 ---- a/hw/xfree86/drivers/modesetting/drmmode_display.h -+++ b/hw/xfree86/drivers/modesetting/drmmode_display.h -@@ -41,6 +41,7 @@ typedef struct { - #ifdef GLAMOR_HAS_GBM - struct gbm_bo *gbm; - #endif -+ uint32_t drm_handle; - } drmmode_bo; - - typedef struct { --- -2.9.3 - diff --git a/recipes-graphics/xorg-xserver/xserver-xorg-1.18.4/0002-HACK-enable-GLX-with-DRI3.patch b/recipes-graphics/xorg-xserver/xserver-xorg-1.18.4/0002-HACK-enable-GLX-with-DRI3.patch deleted file mode 100644 index f27c2a9..0000000 --- a/recipes-graphics/xorg-xserver/xserver-xorg-1.18.4/0002-HACK-enable-GLX-with-DRI3.patch +++ /dev/null @@ -1,72 +0,0 @@ -From 1baf53e2b345ae7d883d4fa6c74f09188ea53b51 Mon Sep 17 00:00:00 2001 -From: Alexandre Courbot <acourbot@nvidia.com> -Date: Fri, 25 Sep 2015 14:37:01 +0900 -Subject: [PATCH 2/7] [HACK] enable GLX with DRI3 - ---- - glamor/glamor_egl.c | 5 ++++- - hw/xfree86/dri2/dri2.c | 5 ++++- - hw/xfree86/drivers/modesetting/dri2.c | 5 +++-- - 3 files changed, 11 insertions(+), 4 deletions(-) - -diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c -index b6941f2..8d25171 100644 ---- a/glamor/glamor_egl.c -+++ b/glamor/glamor_egl.c -@@ -724,6 +724,7 @@ glamor_egl_screen_init(ScreenPtr screen, struct glamor_context *glamor_ctx) - glamor_ctx->make_current = glamor_egl_make_current; - - #ifdef DRI3 -+ xf86Msg(X_INFO, "DRI3 capable: %d\n", glamor_egl->dri3_capable); - if (glamor_egl->dri3_capable) { - glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); - /* Tell the core that we have the interfaces for import/export -@@ -740,7 +741,9 @@ glamor_egl_screen_init(ScreenPtr screen, struct glamor_context *glamor_ctx) - /* To do DRI3 device FD generation, we need to open a new fd - * to the same device we were handed in originally. - */ -- glamor_egl->device_path = drmGetDeviceNameFromFd(glamor_egl->fd); -+ //glamor_egl->device_path = drmGetDeviceNameFromFd(glamor_egl->fd); -+ glamor_egl->device_path = "/dev/dri/renderD128"; -+ xf86Msg(X_INFO, "DRI3 device name: %s %d\n", glamor_egl->device_path, glamor_egl->fd); - - if (!dri3_screen_init(screen, &glamor_dri3_info)) { - xf86DrvMsg(scrn->scrnIndex, X_ERROR, -diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c -index d55be19..00c5c61 100644 ---- a/hw/xfree86/dri2/dri2.c -+++ b/hw/xfree86/dri2/dri2.c -@@ -1334,9 +1334,12 @@ DRI2Connect(ClientPtr client, ScreenPtr pScreen, - return FALSE; - - *driverName = ds->driverNames[driver_id]; -- *deviceName = ds->deviceName; -+ //*deviceName = ds->deviceName; -+ *deviceName = "/dev/dri/renderD128"; - *fd = ds->fd; - -+ xf86Msg(X_INFO, "%s: %s %s %d\n", __func__, *driverName, *deviceName, *fd); -+ - if (client) { - DRI2ClientPtr dri2_client; - dri2_client = dri2ClientPrivate(client); -diff --git a/hw/xfree86/drivers/modesetting/dri2.c b/hw/xfree86/drivers/modesetting/dri2.c -index 83cb3e0..3834a01 100644 ---- a/hw/xfree86/drivers/modesetting/dri2.c -+++ b/hw/xfree86/drivers/modesetting/dri2.c -@@ -831,9 +831,10 @@ ms_dri2_screen_init(ScreenPtr screen) - } - - memset(&info, '\0', sizeof(info)); -- info.fd = ms->fd; -+ info.fd = gbm_device_get_fd(ms->drmmode.gbm); -+ //info.fd = ms->fd; - info.driverName = NULL; /* Compat field, unused. */ -- info.deviceName = drmGetDeviceNameFromFd(ms->fd); -+ info.deviceName = drmGetDeviceNameFromFd(info.fd); - - info.version = 4; - info.CreateBuffer = ms_dri2_create_buffer; --- -2.9.3 - diff --git a/recipes-graphics/xorg-xserver/xserver-xorg_1.18.4.bbappend b/recipes-graphics/xorg-xserver/xserver-xorg_1.18.4.bbappend index 746f367..da88b89 100644 --- a/recipes-graphics/xorg-xserver/xserver-xorg_1.18.4.bbappend +++ b/recipes-graphics/xorg-xserver/xserver-xorg_1.18.4.bbappend @@ -1,12 +1,6 @@ # always latest and greatest. PE_tegra124m = "99" -FILESEXTRAPATHS_prepend := "${THISDIR}/xserver-xorg-${PV}:" - -SRC_URI_append_tegra124m = "\ - file://0001-HACK-use-render-nodes-and-tegra-tiling-format.patch \ - file://0002-HACK-enable-GLX-with-DRI3.patch \ - " PACKAGE_ARCH_tegra124m = "${MACHINE_ARCH}" COMPATIBLE_MACHINE_tegra124m = "(apalis-tk1-mainline)" |