summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta-xilinx-core/dynamic-layers/openembedded-layer/recipes-graphics/xorg-driver/xf86-video-armsoc/0001-xf86-video-armsoc-Add-shadow-buffer-hooks.patch141
-rw-r--r--meta-xilinx-core/dynamic-layers/openembedded-layer/recipes-graphics/xorg-driver/xf86-video-armsoc_%.bbappend1
2 files changed, 142 insertions, 0 deletions
diff --git a/meta-xilinx-core/dynamic-layers/openembedded-layer/recipes-graphics/xorg-driver/xf86-video-armsoc/0001-xf86-video-armsoc-Add-shadow-buffer-hooks.patch b/meta-xilinx-core/dynamic-layers/openembedded-layer/recipes-graphics/xorg-driver/xf86-video-armsoc/0001-xf86-video-armsoc-Add-shadow-buffer-hooks.patch
new file mode 100644
index 00000000..8a1a8ca7
--- /dev/null
+++ b/meta-xilinx-core/dynamic-layers/openembedded-layer/recipes-graphics/xorg-driver/xf86-video-armsoc/0001-xf86-video-armsoc-Add-shadow-buffer-hooks.patch
@@ -0,0 +1,141 @@
1From 8c62932a848c3c9eef8b663a24d90026687d5b02 Mon Sep 17 00:00:00 2001
2From: Anatoliy Klymenko <anatoliy.klymenko@amd.com>
3Date: Thu, 13 Jun 2024 17:37:46 -0700
4Subject: [PATCH] xf86-video-armsoc: Add shadow buffer hooks
5
6Add shadow buffer management callbacks. These callbacks are required for
7RandR extension to operate. Implement the shadow buffer as a dumb DRM
8framebuffer. Use the shadow buffer as page flip souce. Fix armsoc_dri2.c
9file mode (drop exec bits).
10
11Signed-off-by: Anatoliy Klymenko <anatoliy.klymenko@amd.com>
12---
13 src/armsoc_dri2.c | 3 ++
14 src/armsoc_driver.h | 3 ++
15 src/drmmode_display.c | 65 +++++++++++++++++++++++++++++++++++++++++++
16 3 files changed, 71 insertions(+)
17 mode change 100755 => 100644 src/armsoc_dri2.c
18
19diff --git a/src/armsoc_dri2.c b/src/armsoc_dri2.c
20old mode 100755
21new mode 100644
22index dc502e4..af5d074
23--- a/src/armsoc_dri2.c
24+++ b/src/armsoc_dri2.c
25@@ -853,6 +853,9 @@ ARMSOCDRI2ScheduleSwap(ClientPtr client, DrawablePtr pDraw,
26 (armsoc_bo_height(src_bo) == armsoc_bo_height(dst_bo));
27
28 if (do_flip) {
29+ if (pARMSOC->shadow)
30+ src_fb_id = armsoc_bo_get_fb(pARMSOC->shadow);
31+
32 DEBUG_MSG("FLIPPING: FB%d -> FB%d", src_fb_id, dst_fb_id);
33 cmd->type = DRI2_FLIP_COMPLETE;
34
35diff --git a/src/armsoc_driver.h b/src/armsoc_driver.h
36index ef2836f..eae76ca 100644
37--- a/src/armsoc_driver.h
38+++ b/src/armsoc_driver.h
39@@ -149,6 +149,9 @@ struct ARMSOCRec {
40 /** Scan-out buffer. */
41 struct armsoc_bo *scanout;
42
43+ /** Rotation shadow buffer */
44+ struct armsoc_bo *shadow;
45+
46 /** Pointer to the options for this screen. */
47 OptionInfoPtr pOptionInfo;
48
49diff --git a/src/drmmode_display.c b/src/drmmode_display.c
50index 39fa75c..f054b3a 100644
51--- a/src/drmmode_display.c
52+++ b/src/drmmode_display.c
53@@ -333,6 +333,9 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
54 goto cleanup;
55 }
56
57+ if (pARMSOC->shadow)
58+ fb_id = armsoc_bo_get_fb(pARMSOC->shadow);
59+
60 if (crtc->funcs->gamma_set)
61 crtc->funcs->gamma_set(crtc, crtc->gamma_red, crtc->gamma_green,
62 crtc->gamma_blue, crtc->gamma_size);
63@@ -860,6 +863,65 @@ drmmode_gamma_set(xf86CrtcPtr crtc, CARD16 *red, CARD16 *green, CARD16 *blue,
64 }
65 #endif
66
67+static void*
68+drmmode_shadow_allocate(xf86CrtcPtr crtc, int width, int height)
69+{
70+ ScrnInfoPtr pScrn = crtc->scrn;
71+ struct ARMSOCRec *pARMSOC = ARMSOCPTR(pScrn);
72+ struct armsoc_bo *bo;
73+ int ret;
74+
75+ bo = armsoc_bo_new_with_dim(pARMSOC->dev, width, height,
76+ pScrn->bitsPerPixel, pScrn->bitsPerPixel, ARMSOC_BO_SCANOUT);
77+ if (!bo)
78+ return NULL;
79+
80+ /* We will use this bo as a scanout, so add it as a framebuffer */
81+ ret = armsoc_bo_add_fb(bo);
82+ if (ret) {
83+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
84+ "failed to add framebuffer: %s\n", strerror(-ret));
85+ armsoc_bo_unreference(bo);
86+ return NULL;
87+ }
88+
89+ pARMSOC->shadow = bo;
90+
91+ return bo;
92+}
93+
94+static PixmapPtr
95+drmmode_shadow_create(xf86CrtcPtr crtc, void *data, int width, int height)
96+{
97+ ScrnInfoPtr pScrn = crtc->scrn;
98+ ScreenPtr pScreen = pScrn->pScreen;
99+ struct armsoc_bo *bo = data;
100+ PixmapPtr pixmap;
101+
102+ pixmap = (*pScreen->CreatePixmap)(pScreen, 0, 0, armsoc_bo_depth(bo), 0);
103+ if (!pixmap) {
104+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "failed to create pixmap.\n");
105+ return NULL;
106+ }
107+ (*pScreen->ModifyPixmapHeader)(pixmap, armsoc_bo_width(bo),
108+ armsoc_bo_height(bo), armsoc_bo_depth(bo), armsoc_bo_bpp(bo),
109+ armsoc_bo_pitch(bo), armsoc_bo_map(bo));
110+
111+ return pixmap;
112+}
113+
114+static void
115+drmmode_shadow_destroy(xf86CrtcPtr crtc, PixmapPtr rotate_pixmap, void *data)
116+{
117+ ScrnInfoPtr pScrn = crtc->scrn;
118+ struct ARMSOCRec *pARMSOC = ARMSOCPTR(pScrn);
119+ struct armsoc_bo *bo = data;
120+
121+ armsoc_bo_unreference(bo);
122+
123+ pARMSOC->shadow = NULL;
124+}
125+
126 static const xf86CrtcFuncsRec drmmode_crtc_funcs = {
127 .dpms = drmmode_crtc_dpms,
128 .set_mode_major = drmmode_set_mode_major,
129@@ -870,6 +932,9 @@ static const xf86CrtcFuncsRec drmmode_crtc_funcs = {
130 #if 1 == ARMSOC_SUPPORT_GAMMA
131 .gamma_set = drmmode_gamma_set,
132 #endif
133+ .shadow_allocate = drmmode_shadow_allocate,
134+ .shadow_create = drmmode_shadow_create,
135+ .shadow_destroy = drmmode_shadow_destroy,
136 };
137
138
139--
1402.25.1
141
diff --git a/meta-xilinx-core/dynamic-layers/openembedded-layer/recipes-graphics/xorg-driver/xf86-video-armsoc_%.bbappend b/meta-xilinx-core/dynamic-layers/openembedded-layer/recipes-graphics/xorg-driver/xf86-video-armsoc_%.bbappend
index f7b52f58..82736cc8 100644
--- a/meta-xilinx-core/dynamic-layers/openembedded-layer/recipes-graphics/xorg-driver/xf86-video-armsoc_%.bbappend
+++ b/meta-xilinx-core/dynamic-layers/openembedded-layer/recipes-graphics/xorg-driver/xf86-video-armsoc_%.bbappend
@@ -2,4 +2,5 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/xf86-video-armsoc:"
2 2
3SRC_URI:append = " file://0001-src-drmmode_xilinx-Add-the-dumb-gem-support-for-Xili.patch \ 3SRC_URI:append = " file://0001-src-drmmode_xilinx-Add-the-dumb-gem-support-for-Xili.patch \
4 file://0001-armsoc_driver.c-Bypass-the-exa-layer-to-free-the-roo.patch \ 4 file://0001-armsoc_driver.c-Bypass-the-exa-layer-to-free-the-roo.patch \
5 file://0001-xf86-video-armsoc-Add-shadow-buffer-hooks.patch \
5 " 6 "