Restore hardened builds
Resolves: rhbz#2024556
This commit is contained in:
parent
2f43e361f7
commit
da8b560041
153
0002-xfree86-Link-fb-statically.patch
Normal file
153
0002-xfree86-Link-fb-statically.patch
Normal file
@ -0,0 +1,153 @@
|
||||
From c2eb1e2eac99ef0b8e6cf47ab0a94371cf47e939 Mon Sep 17 00:00:00 2001
|
||||
From: Adam Jackson <ajax@redhat.com>
|
||||
Date: Tue, 23 Jul 2019 11:54:15 -0400
|
||||
Subject: [PATCH xserver 02/11] xfree86: Link fb statically
|
||||
|
||||
There's no real benefit to leaving this loadable, virtually every driver
|
||||
is going to load it.
|
||||
|
||||
Reviewed-by: Jon Turney <jon.turney@dronecode.org.uk>
|
||||
(cherry picked from commit c1703cdf3b0d6663fcac68598eefe324ae4e1e71)
|
||||
---
|
||||
hw/xfree86/Makefile.am | 1 +
|
||||
hw/xfree86/dixmods/Makefile.am | 8 +-------
|
||||
hw/xfree86/dixmods/meson.build | 14 --------------
|
||||
hw/xfree86/drivers/modesetting/meson.build | 1 -
|
||||
hw/xfree86/loader/loadmod.c | 1 +
|
||||
hw/xfree86/meson.build | 1 +
|
||||
hw/xfree86/sdksyms.sh | 6 +++---
|
||||
test/Makefile.am | 1 +
|
||||
8 files changed, 8 insertions(+), 25 deletions(-)
|
||||
|
||||
diff --git a/hw/xfree86/Makefile.am b/hw/xfree86/Makefile.am
|
||||
index 9aeaea1a6..1d494cd0f 100644
|
||||
--- a/hw/xfree86/Makefile.am
|
||||
+++ b/hw/xfree86/Makefile.am
|
||||
@@ -75,6 +75,7 @@ LOCAL_LIBS = \
|
||||
$(DRI2_LIB) \
|
||||
$(DRI3_LIB) \
|
||||
$(GLXVND_LIB) \
|
||||
+ $(top_builddir)/fb/libfb.la \
|
||||
$(top_builddir)/miext/sync/libsync.la \
|
||||
$(top_builddir)/mi/libmi.la \
|
||||
$(top_builddir)/os/libos.la \
|
||||
diff --git a/hw/xfree86/dixmods/Makefile.am b/hw/xfree86/dixmods/Makefile.am
|
||||
index 856659f98..a1f97056a 100644
|
||||
--- a/hw/xfree86/dixmods/Makefile.am
|
||||
+++ b/hw/xfree86/dixmods/Makefile.am
|
||||
@@ -4,8 +4,7 @@ if GLX
|
||||
GLXMODS = libglx.la
|
||||
endif
|
||||
|
||||
-module_LTLIBRARIES = libfb.la \
|
||||
- libwfb.la \
|
||||
+module_LTLIBRARIES = libwfb.la \
|
||||
libshadow.la
|
||||
|
||||
extsmoduledir = $(moduledir)/extensions
|
||||
@@ -17,11 +16,6 @@ AM_CPPFLAGS = @XORG_INCS@ \
|
||||
-I$(top_srcdir)/miext/shadow \
|
||||
-I$(top_srcdir)/glx
|
||||
|
||||
-libfb_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG)
|
||||
-libfb_la_LIBADD = $(top_builddir)/fb/libfb.la
|
||||
-libfb_la_SOURCES = fbmodule.c
|
||||
-libfb_la_CFLAGS = $(AM_CFLAGS)
|
||||
-
|
||||
libwfb_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG)
|
||||
libwfb_la_LIBADD = $(top_builddir)/fb/libwfb.la
|
||||
libwfb_la_SOURCES = fbmodule.c
|
||||
diff --git a/hw/xfree86/dixmods/meson.build b/hw/xfree86/dixmods/meson.build
|
||||
index 0562b630f..e4ac02228 100644
|
||||
--- a/hw/xfree86/dixmods/meson.build
|
||||
+++ b/hw/xfree86/dixmods/meson.build
|
||||
@@ -1,17 +1,3 @@
|
||||
-fb = shared_module(
|
||||
- 'fb',
|
||||
- 'fbmodule.c',
|
||||
-
|
||||
- include_directories: [inc, xorg_inc],
|
||||
- c_args: xorg_c_args,
|
||||
- dependencies: common_dep,
|
||||
- link_whole: libxserver_fb,
|
||||
- link_with: e,
|
||||
-
|
||||
- install: true,
|
||||
- install_dir: module_dir,
|
||||
-)
|
||||
-
|
||||
shared_module(
|
||||
'wfb',
|
||||
'fbmodule.c',
|
||||
diff --git a/hw/xfree86/drivers/modesetting/meson.build b/hw/xfree86/drivers/modesetting/meson.build
|
||||
index 5e13f1a53..02852a716 100644
|
||||
--- a/hw/xfree86/drivers/modesetting/meson.build
|
||||
+++ b/hw/xfree86/drivers/modesetting/meson.build
|
||||
@@ -30,7 +30,6 @@ shared_module(
|
||||
xorg_build_root = join_paths(meson.build_root(), 'hw', 'xfree86')
|
||||
symbol_test_args = []
|
||||
symbol_test_args += join_paths(xorg_build_root, 'libxorgserver.so')
|
||||
-symbol_test_args += join_paths(xorg_build_root, 'dixmods', 'libfb.so')
|
||||
symbol_test_args += join_paths(xorg_build_root, 'dixmods', 'libshadow.so')
|
||||
if gbm_dep.found()
|
||||
symbol_test_args += join_paths(xorg_build_root, 'glamor_egl', 'libglamoregl.so')
|
||||
diff --git a/hw/xfree86/loader/loadmod.c b/hw/xfree86/loader/loadmod.c
|
||||
index a6356bd8f..f0983b2f8 100644
|
||||
--- a/hw/xfree86/loader/loadmod.c
|
||||
+++ b/hw/xfree86/loader/loadmod.c
|
||||
@@ -621,6 +621,7 @@ DuplicateModule(ModuleDescPtr mod, ModuleDescPtr parent)
|
||||
|
||||
static const char *compiled_in_modules[] = {
|
||||
"ddc",
|
||||
+ "fb",
|
||||
"i2c",
|
||||
"ramdac",
|
||||
"dbe",
|
||||
diff --git a/hw/xfree86/meson.build b/hw/xfree86/meson.build
|
||||
index cacf56d4c..c80964ea4 100644
|
||||
--- a/hw/xfree86/meson.build
|
||||
+++ b/hw/xfree86/meson.build
|
||||
@@ -61,6 +61,7 @@ xorg_link = [
|
||||
xorg_os_support,
|
||||
xorg_parser,
|
||||
xorg_ramdac,
|
||||
+ libxserver_fb,
|
||||
libxserver_xext_vidmode,
|
||||
libxserver_main,
|
||||
libxserver_config,
|
||||
diff --git a/hw/xfree86/sdksyms.sh b/hw/xfree86/sdksyms.sh
|
||||
index 7897aae22..2ebc4c019 100755
|
||||
--- a/hw/xfree86/sdksyms.sh
|
||||
+++ b/hw/xfree86/sdksyms.sh
|
||||
@@ -21,13 +21,13 @@ cat > sdksyms.c << EOF
|
||||
#include "picturestr.h"
|
||||
|
||||
|
||||
-/* fb/Makefile.am -- module */
|
||||
-/*
|
||||
+/* fb/Makefile.am */
|
||||
#include "fb.h"
|
||||
#include "fbrop.h"
|
||||
#include "fboverlay.h"
|
||||
-#include "wfbrename.h"
|
||||
#include "fbpict.h"
|
||||
+/* wfb is still a module
|
||||
+#include "wfbrename.h"
|
||||
*/
|
||||
|
||||
|
||||
diff --git a/test/Makefile.am b/test/Makefile.am
|
||||
index 12ac327a3..ce07c3551 100644
|
||||
--- a/test/Makefile.am
|
||||
+++ b/test/Makefile.am
|
||||
@@ -146,6 +146,7 @@ tests_LDADD += \
|
||||
$(top_builddir)/hw/xfree86/i2c/libi2c.la \
|
||||
$(top_builddir)/hw/xfree86/xkb/libxorgxkb.la \
|
||||
$(top_builddir)/Xext/libXvidmode.la \
|
||||
+ $(top_builddir)/fb/libfb.la \
|
||||
$(XSERVER_LIBS) \
|
||||
$(XORG_LIBS)
|
||||
|
||||
--
|
||||
2.33.1
|
||||
|
42
0004-loader-Move-LoaderSymbolFromModule-to-public-API.patch
Normal file
42
0004-loader-Move-LoaderSymbolFromModule-to-public-API.patch
Normal file
@ -0,0 +1,42 @@
|
||||
From e763a4fa114ba6c0abddf2b43a7297b8b9054855 Mon Sep 17 00:00:00 2001
|
||||
From: Adam Jackson <ajax@redhat.com>
|
||||
Date: Tue, 8 Oct 2019 13:29:22 -0400
|
||||
Subject: [PATCH xserver 04/11] loader: Move LoaderSymbolFromModule() to public
|
||||
API
|
||||
|
||||
Bare LoaderSymbol() isn't really a great API, this is more of a direct
|
||||
map to dlsym like you want.
|
||||
|
||||
Gitlab: https://gitlab.freedesktop.org/xorg/xserver/issues/692
|
||||
(cherry picked from commit 8760fab0a15805bdd12bb8f12bb1c665fde86cc2)
|
||||
---
|
||||
hw/xfree86/common/xf86Module.h | 1 +
|
||||
hw/xfree86/loader/loader.h | 1 -
|
||||
2 files changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/hw/xfree86/common/xf86Module.h b/hw/xfree86/common/xf86Module.h
|
||||
index 00aa84ae2..fab8842c4 100644
|
||||
--- a/hw/xfree86/common/xf86Module.h
|
||||
+++ b/hw/xfree86/common/xf86Module.h
|
||||
@@ -156,6 +156,7 @@ extern _X_EXPORT void *LoadSubModule(void *, const char *, const char **,
|
||||
extern _X_EXPORT void UnloadSubModule(void *);
|
||||
extern _X_EXPORT void UnloadModule(void *);
|
||||
extern _X_EXPORT void *LoaderSymbol(const char *);
|
||||
+extern _X_EXPORT void *LoaderSymbolFromModule(void *, const char *);
|
||||
extern _X_EXPORT void LoaderErrorMsg(const char *, const char *, int, int);
|
||||
extern _X_EXPORT Bool LoaderShouldIgnoreABI(void);
|
||||
extern _X_EXPORT int LoaderGetABIVersion(const char *abiclass);
|
||||
diff --git a/hw/xfree86/loader/loader.h b/hw/xfree86/loader/loader.h
|
||||
index 5a2fe6c60..4e83730a2 100644
|
||||
--- a/hw/xfree86/loader/loader.h
|
||||
+++ b/hw/xfree86/loader/loader.h
|
||||
@@ -72,6 +72,5 @@ extern unsigned long LoaderOptions;
|
||||
|
||||
/* Internal Functions */
|
||||
void *LoaderOpen(const char *, int *);
|
||||
-void *LoaderSymbolFromModule(void *, const char *);
|
||||
|
||||
#endif /* _LOADER_H */
|
||||
--
|
||||
2.33.1
|
||||
|
@ -0,0 +1,50 @@
|
||||
From b01ca791b9ba62e25e3533ba35f8e825f02f0f80 Mon Sep 17 00:00:00 2001
|
||||
From: Adam Jackson <ajax@redhat.com>
|
||||
Date: Mon, 18 Nov 2019 16:43:50 -0500
|
||||
Subject: [PATCH xserver 05/11] loader: Make LoaderSymbolFromModule take a
|
||||
ModuleDescPtr
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The thing you get back from xf86LoadSubModule is a ModuleDescPtr, not a
|
||||
dlsym handle. We don't expose ModuleDescPtr to the drivers, so change
|
||||
LoaderSymbolFromModule to cast its void * argument to a ModuleDescPtr.
|
||||
|
||||
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
|
||||
(cherry picked from commit ab61c16ef07fde6eb7110c63c344c54eb2a2d117)
|
||||
---
|
||||
hw/xfree86/loader/loader.c | 3 ++-
|
||||
hw/xfree86/loader/loadmod.c | 2 +-
|
||||
2 files changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/hw/xfree86/loader/loader.c b/hw/xfree86/loader/loader.c
|
||||
index 503c47e3a..2580e93d9 100644
|
||||
--- a/hw/xfree86/loader/loader.c
|
||||
+++ b/hw/xfree86/loader/loader.c
|
||||
@@ -135,7 +135,8 @@ LoaderSymbol(const char *name)
|
||||
void *
|
||||
LoaderSymbolFromModule(void *handle, const char *name)
|
||||
{
|
||||
- return dlsym(handle, name);
|
||||
+ ModuleDescPtr mod = handle;
|
||||
+ return dlsym(mod->handle, name);
|
||||
}
|
||||
|
||||
void
|
||||
diff --git a/hw/xfree86/loader/loadmod.c b/hw/xfree86/loader/loadmod.c
|
||||
index a93a76aa9..81a3a1dd9 100644
|
||||
--- a/hw/xfree86/loader/loadmod.c
|
||||
+++ b/hw/xfree86/loader/loadmod.c
|
||||
@@ -776,7 +776,7 @@ LoadModule(const char *module, void *options, const XF86ModReqInfo *modreq,
|
||||
*errmaj = LDR_NOMEM;
|
||||
goto LoadModule_fail;
|
||||
}
|
||||
- initdata = LoaderSymbolFromModule(ret->handle, p);
|
||||
+ initdata = LoaderSymbolFromModule(ret, p);
|
||||
if (initdata) {
|
||||
ModuleSetupProc setup;
|
||||
ModuleTearDownProc teardown;
|
||||
--
|
||||
2.33.1
|
||||
|
144
0006-modesetting-Indirect-the-shadow-API-through-LoaderSy.patch
Normal file
144
0006-modesetting-Indirect-the-shadow-API-through-LoaderSy.patch
Normal file
@ -0,0 +1,144 @@
|
||||
From 13d3bc7a05eb7500c8987358c68c20a4bfe18079 Mon Sep 17 00:00:00 2001
|
||||
From: Adam Jackson <ajax@redhat.com>
|
||||
Date: Tue, 8 Oct 2019 12:52:28 -0400
|
||||
Subject: [PATCH xserver 06/11] modesetting: Indirect the shadow API through
|
||||
LoaderSymbol
|
||||
|
||||
Prerequisite for building all of xserver with -z now.
|
||||
|
||||
Gitlab: https://gitlab.freedesktop.org/xorg/xserver/issues/692
|
||||
(cherry picked from commit 45f35a0c6666c5f35df482948e0c8e91167429ef)
|
||||
---
|
||||
hw/xfree86/drivers/modesetting/driver.c | 34 +++++++++++--------------
|
||||
hw/xfree86/drivers/modesetting/driver.h | 12 ++++++++-
|
||||
2 files changed, 26 insertions(+), 20 deletions(-)
|
||||
|
||||
diff --git a/hw/xfree86/drivers/modesetting/driver.c b/hw/xfree86/drivers/modesetting/driver.c
|
||||
index ec4189a2c..a385e7ee2 100644
|
||||
--- a/hw/xfree86/drivers/modesetting/driver.c
|
||||
+++ b/hw/xfree86/drivers/modesetting/driver.c
|
||||
@@ -50,7 +50,6 @@
|
||||
#include "xf86Crtc.h"
|
||||
#include "miscstruct.h"
|
||||
#include "dixstruct.h"
|
||||
-#include "shadow.h"
|
||||
#include "xf86xv.h"
|
||||
#include <X11/extensions/Xv.h>
|
||||
#include <xorg-config.h>
|
||||
@@ -60,7 +59,6 @@
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
#include <pciaccess.h>
|
||||
#endif
|
||||
-
|
||||
#include "driver.h"
|
||||
|
||||
static void AdjustFrame(ScrnInfoPtr pScrn, int x, int y);
|
||||
@@ -1084,9 +1082,16 @@ PreInit(ScrnInfoPtr pScrn, int flags)
|
||||
}
|
||||
|
||||
if (ms->drmmode.shadow_enable) {
|
||||
- if (!xf86LoadSubModule(pScrn, "shadow")) {
|
||||
+ void *mod = xf86LoadSubModule(pScrn, "shadow");
|
||||
+
|
||||
+ if (!mod)
|
||||
return FALSE;
|
||||
- }
|
||||
+
|
||||
+ ms->shadow.Setup = LoaderSymbolFromModule(mod, "shadowSetup");
|
||||
+ ms->shadow.Add = LoaderSymbolFromModule(mod, "shadowAdd");
|
||||
+ ms->shadow.Remove = LoaderSymbolFromModule(mod, "shadowRemove");
|
||||
+ ms->shadow.Update32to24 = LoaderSymbolFromModule(mod, "shadowUpdate32to24");
|
||||
+ ms->shadow.UpdatePacked = LoaderSymbolFromModule(mod, "shadowUpdatePacked");
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
@@ -1191,9 +1196,9 @@ msUpdatePacked(ScreenPtr pScreen, shadowBufPtr pBuf)
|
||||
} while (0);
|
||||
|
||||
if (use_3224)
|
||||
- shadowUpdate32to24(pScreen, pBuf);
|
||||
+ ms->shadow.Update32to24(pScreen, pBuf);
|
||||
else
|
||||
- shadowUpdatePacked(pScreen, pBuf);
|
||||
+ ms->shadow.UpdatePacked(pScreen, pBuf);
|
||||
}
|
||||
|
||||
static Bool
|
||||
@@ -1380,8 +1385,8 @@ CreateScreenResources(ScreenPtr pScreen)
|
||||
FatalError("Couldn't adjust screen pixmap\n");
|
||||
|
||||
if (ms->drmmode.shadow_enable) {
|
||||
- if (!shadowAdd(pScreen, rootPixmap, msUpdatePacked, msShadowWindow,
|
||||
- 0, 0))
|
||||
+ if (!ms->shadow.Add(pScreen, rootPixmap, msUpdatePacked, msShadowWindow,
|
||||
+ 0, 0))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -1415,15 +1420,6 @@ CreateScreenResources(ScreenPtr pScreen)
|
||||
return ret;
|
||||
}
|
||||
|
||||
-static Bool
|
||||
-msShadowInit(ScreenPtr pScreen)
|
||||
-{
|
||||
- if (!shadowSetup(pScreen)) {
|
||||
- return FALSE;
|
||||
- }
|
||||
- return TRUE;
|
||||
-}
|
||||
-
|
||||
static Bool
|
||||
msSharePixmapBacking(PixmapPtr ppix, ScreenPtr screen, void **handle)
|
||||
{
|
||||
@@ -1643,7 +1639,7 @@ ScreenInit(ScreenPtr pScreen, int argc, char **argv)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
- if (ms->drmmode.shadow_enable && !msShadowInit(pScreen)) {
|
||||
+ if (ms->drmmode.shadow_enable && !ms->shadow.Setup(pScreen)) {
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "shadow fb init failed\n");
|
||||
return FALSE;
|
||||
}
|
||||
@@ -1887,7 +1883,7 @@ CloseScreen(ScreenPtr pScreen)
|
||||
}
|
||||
|
||||
if (ms->drmmode.shadow_enable) {
|
||||
- shadowRemove(pScreen, pScreen->GetScreenPixmap(pScreen));
|
||||
+ ms->shadow.Remove(pScreen, pScreen->GetScreenPixmap(pScreen));
|
||||
free(ms->drmmode.shadow_fb);
|
||||
ms->drmmode.shadow_fb = NULL;
|
||||
free(ms->drmmode.shadow_fb2);
|
||||
diff --git a/hw/xfree86/drivers/modesetting/driver.h b/hw/xfree86/drivers/modesetting/driver.h
|
||||
index a99f37871..394a20fc1 100644
|
||||
--- a/hw/xfree86/drivers/modesetting/driver.h
|
||||
+++ b/hw/xfree86/drivers/modesetting/driver.h
|
||||
@@ -33,7 +33,7 @@
|
||||
#include <xf86Crtc.h>
|
||||
#include <damage.h>
|
||||
#include <X11/extensions/dpmsconst.h>
|
||||
-
|
||||
+#include <shadow.h>
|
||||
#ifdef GLAMOR_HAS_GBM
|
||||
#define GLAMOR_FOR_XORG 1
|
||||
#include "glamor.h"
|
||||
@@ -122,6 +122,16 @@ typedef struct _modesettingRec {
|
||||
|
||||
Bool kms_has_modifiers;
|
||||
|
||||
+ /* shadow API */
|
||||
+ struct {
|
||||
+ Bool (*Setup)(ScreenPtr);
|
||||
+ Bool (*Add)(ScreenPtr, PixmapPtr, ShadowUpdateProc, ShadowWindowProc,
|
||||
+ int, void *);
|
||||
+ void (*Remove)(ScreenPtr, PixmapPtr);
|
||||
+ void (*Update32to24)(ScreenPtr, shadowBufPtr);
|
||||
+ void (*UpdatePacked)(ScreenPtr, shadowBufPtr);
|
||||
+ } shadow;
|
||||
+
|
||||
} modesettingRec, *modesettingPtr;
|
||||
|
||||
#define modesettingPTR(p) ((modesettingPtr)((p)->driverPrivate))
|
||||
--
|
||||
2.33.1
|
||||
|
332
0007-modesetting-Indirect-the-glamor-API-through-LoaderSy.patch
Normal file
332
0007-modesetting-Indirect-the-glamor-API-through-LoaderSy.patch
Normal file
@ -0,0 +1,332 @@
|
||||
From 94612044171975466f605d5f01769d1c2b9acc5d Mon Sep 17 00:00:00 2001
|
||||
From: Adam Jackson <ajax@redhat.com>
|
||||
Date: Tue, 8 Oct 2019 13:11:09 -0400
|
||||
Subject: [PATCH xserver 07/11] modesetting: Indirect the glamor API through
|
||||
LoaderSymbol
|
||||
|
||||
Prerequisite for building all of xserver with -z now.
|
||||
|
||||
Gitlab: https://gitlab.freedesktop.org/xorg/xserver/issues/692
|
||||
(cherry picked from commit dd63f717fe8636315343f421f4f2ee299258f079)
|
||||
---
|
||||
hw/xfree86/drivers/modesetting/dri2.c | 10 ++--
|
||||
hw/xfree86/drivers/modesetting/driver.c | 49 ++++++++++++++-----
|
||||
hw/xfree86/drivers/modesetting/driver.h | 24 +++++++++
|
||||
.../drivers/modesetting/drmmode_display.c | 17 ++++---
|
||||
hw/xfree86/drivers/modesetting/pageflip.c | 4 +-
|
||||
hw/xfree86/drivers/modesetting/present.c | 4 +-
|
||||
6 files changed, 82 insertions(+), 26 deletions(-)
|
||||
|
||||
diff --git a/hw/xfree86/drivers/modesetting/dri2.c b/hw/xfree86/drivers/modesetting/dri2.c
|
||||
index d89904b53..724d9d34c 100644
|
||||
--- a/hw/xfree86/drivers/modesetting/dri2.c
|
||||
+++ b/hw/xfree86/drivers/modesetting/dri2.c
|
||||
@@ -123,6 +123,7 @@ ms_dri2_create_buffer2(ScreenPtr screen, DrawablePtr drawable,
|
||||
unsigned int attachment, unsigned int format)
|
||||
{
|
||||
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
|
||||
+ modesettingPtr ms = modesettingPTR(scrn);
|
||||
DRI2Buffer2Ptr buffer;
|
||||
PixmapPtr pixmap;
|
||||
CARD32 size;
|
||||
@@ -200,7 +201,7 @@ ms_dri2_create_buffer2(ScreenPtr screen, DrawablePtr drawable,
|
||||
*/
|
||||
buffer->flags = 0;
|
||||
|
||||
- buffer->name = glamor_name_from_pixmap(pixmap, &pitch, &size);
|
||||
+ buffer->name = ms->glamor.name_from_pixmap(pixmap, &pitch, &size);
|
||||
buffer->pitch = pitch;
|
||||
if (buffer->name == -1) {
|
||||
xf86DrvMsg(scrn->scrnIndex, X_ERROR,
|
||||
@@ -509,11 +510,12 @@ update_front(DrawablePtr draw, DRI2BufferPtr front)
|
||||
ScreenPtr screen = draw->pScreen;
|
||||
PixmapPtr pixmap = get_drawable_pixmap(draw);
|
||||
ms_dri2_buffer_private_ptr priv = front->driverPrivate;
|
||||
+ modesettingPtr ms = modesettingPTR(xf86ScreenToScrn(screen));
|
||||
CARD32 size;
|
||||
CARD16 pitch;
|
||||
int name;
|
||||
|
||||
- name = glamor_name_from_pixmap(pixmap, &pitch, &size);
|
||||
+ name = ms->glamor.name_from_pixmap(pixmap, &pitch, &size);
|
||||
if (name < 0)
|
||||
return FALSE;
|
||||
|
||||
@@ -617,7 +619,7 @@ ms_dri2_exchange_buffers(DrawablePtr draw, DRI2BufferPtr front,
|
||||
*front_pix = *back_pix;
|
||||
*back_pix = tmp_pix;
|
||||
|
||||
- glamor_egl_exchange_buffers(front_priv->pixmap, back_priv->pixmap);
|
||||
+ ms->glamor.egl_exchange_buffers(front_priv->pixmap, back_priv->pixmap);
|
||||
|
||||
/* Post damage on the front buffer so that listeners, such
|
||||
* as DisplayLink know take a copy and shove it over the USB.
|
||||
@@ -1036,7 +1038,7 @@ ms_dri2_screen_init(ScreenPtr screen)
|
||||
DRI2InfoRec info;
|
||||
const char *driver_names[2] = { NULL, NULL };
|
||||
|
||||
- if (!glamor_supports_pixmap_import_export(screen)) {
|
||||
+ if (!ms->glamor.supports_pixmap_import_export(screen)) {
|
||||
xf86DrvMsg(scrn->scrnIndex, X_WARNING,
|
||||
"DRI2: glamor lacks support for pixmap import/export\n");
|
||||
}
|
||||
diff --git a/hw/xfree86/drivers/modesetting/driver.c b/hw/xfree86/drivers/modesetting/driver.c
|
||||
index a385e7ee2..4f4db67b7 100644
|
||||
--- a/hw/xfree86/drivers/modesetting/driver.c
|
||||
+++ b/hw/xfree86/drivers/modesetting/driver.c
|
||||
@@ -615,7 +615,7 @@ redisplay_dirty(ScreenPtr screen, PixmapDirtyUpdatePtr dirty, int *timeout)
|
||||
* the shared pixmap, but not all).
|
||||
*/
|
||||
if (ms->drmmode.glamor)
|
||||
- glamor_finish(screen);
|
||||
+ ms->glamor.finish(screen);
|
||||
#endif
|
||||
/* Ensure the slave processes the damage immediately */
|
||||
if (timeout)
|
||||
@@ -743,6 +743,26 @@ FreeRec(ScrnInfoPtr pScrn)
|
||||
|
||||
}
|
||||
|
||||
+static void
|
||||
+bind_glamor_api(void *mod, modesettingPtr ms)
|
||||
+{
|
||||
+ ms->glamor.back_pixmap_from_fd = LoaderSymbolFromModule(mod, "glamor_back_pixmap_from_fd");
|
||||
+ ms->glamor.block_handler = LoaderSymbolFromModule(mod, "glamor_block_handler");
|
||||
+ ms->glamor.egl_create_textured_pixmap = LoaderSymbolFromModule(mod, "glamor_egl_create_textured_pixmap");
|
||||
+ ms->glamor.egl_create_textured_pixmap_from_gbm_bo = LoaderSymbolFromModule(mod, "glamor_egl_create_textured_pixmap_from_gbm_bo");
|
||||
+ ms->glamor.egl_exchange_buffers = LoaderSymbolFromModule(mod, "glamor_egl_exchange_buffers");
|
||||
+ ms->glamor.egl_get_gbm_device = LoaderSymbolFromModule(mod, "glamor_egl_get_gbm_device");
|
||||
+ ms->glamor.egl_init = LoaderSymbolFromModule(mod, "glamor_egl_init");
|
||||
+ ms->glamor.finish = LoaderSymbolFromModule(mod, "glamor_finish");
|
||||
+ ms->glamor.gbm_bo_from_pixmap = LoaderSymbolFromModule(mod, "glamor_gbm_bo_from_pixmap");
|
||||
+ ms->glamor.init = LoaderSymbolFromModule(mod, "glamor_init");
|
||||
+ ms->glamor.name_from_pixmap = LoaderSymbolFromModule(mod, "glamor_name_from_pixmap");
|
||||
+ ms->glamor.set_drawable_modifiers_func = LoaderSymbolFromModule(mod, "glamor_set_drawable_modifiers_func");
|
||||
+ ms->glamor.shareable_fd_from_pixmap = LoaderSymbolFromModule(mod, "glamor_shareable_fd_from_pixmap");
|
||||
+ ms->glamor.supports_pixmap_import_export = LoaderSymbolFromModule(mod, "glamor_supports_pixmap_import_export");
|
||||
+ ms->glamor.xv_init = LoaderSymbolFromModule(mod, "glamor_xv_init");
|
||||
+}
|
||||
+
|
||||
static void
|
||||
try_enable_glamor(ScrnInfoPtr pScrn)
|
||||
{
|
||||
@@ -751,6 +771,7 @@ try_enable_glamor(ScrnInfoPtr pScrn)
|
||||
OPTION_ACCEL_METHOD);
|
||||
Bool do_glamor = (!accel_method_str ||
|
||||
strcmp(accel_method_str, "glamor") == 0);
|
||||
+ void *mod;
|
||||
|
||||
ms->drmmode.glamor = FALSE;
|
||||
|
||||
@@ -765,8 +786,10 @@ try_enable_glamor(ScrnInfoPtr pScrn)
|
||||
return;
|
||||
}
|
||||
|
||||
- if (xf86LoadSubModule(pScrn, GLAMOR_EGL_MODULE_NAME)) {
|
||||
- if (glamor_egl_init(pScrn, ms->fd)) {
|
||||
+ mod = xf86LoadSubModule(pScrn, GLAMOR_EGL_MODULE_NAME);
|
||||
+ if (mod) {
|
||||
+ bind_glamor_api(mod, ms);
|
||||
+ if (ms->glamor.egl_init(pScrn, ms->fd)) {
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "glamor initialized\n");
|
||||
ms->drmmode.glamor = TRUE;
|
||||
} else {
|
||||
@@ -1424,11 +1447,12 @@ static Bool
|
||||
msSharePixmapBacking(PixmapPtr ppix, ScreenPtr screen, void **handle)
|
||||
{
|
||||
#ifdef GLAMOR_HAS_GBM
|
||||
+ modesettingPtr ms = modesettingPTR(xf86ScreenToScrn(screen));
|
||||
int ret;
|
||||
CARD16 stride;
|
||||
CARD32 size;
|
||||
- ret = glamor_shareable_fd_from_pixmap(ppix->drawable.pScreen, ppix,
|
||||
- &stride, &size);
|
||||
+ ret = ms->glamor.shareable_fd_from_pixmap(ppix->drawable.pScreen, ppix,
|
||||
+ &stride, &size);
|
||||
if (ret == -1)
|
||||
return FALSE;
|
||||
|
||||
@@ -1453,11 +1477,12 @@ msSetSharedPixmapBacking(PixmapPtr ppix, void *fd_handle)
|
||||
return drmmode_SetSlaveBO(ppix, &ms->drmmode, ihandle, 0, 0);
|
||||
|
||||
if (ms->drmmode.reverse_prime_offload_mode) {
|
||||
- ret = glamor_back_pixmap_from_fd(ppix, ihandle,
|
||||
- ppix->drawable.width,
|
||||
- ppix->drawable.height,
|
||||
- ppix->devKind, ppix->drawable.depth,
|
||||
- ppix->drawable.bitsPerPixel);
|
||||
+ ret = ms->glamor.back_pixmap_from_fd(ppix, ihandle,
|
||||
+ ppix->drawable.width,
|
||||
+ ppix->drawable.height,
|
||||
+ ppix->devKind,
|
||||
+ ppix->drawable.depth,
|
||||
+ ppix->drawable.bitsPerPixel);
|
||||
} else {
|
||||
int size = ppix->devKind * ppix->drawable.height;
|
||||
ret = drmmode_SetSlaveBO(ppix, &ms->drmmode, ihandle, ppix->devKind, size);
|
||||
@@ -1574,7 +1599,7 @@ ScreenInit(ScreenPtr pScreen, int argc, char **argv)
|
||||
|
||||
#ifdef GLAMOR_HAS_GBM
|
||||
if (ms->drmmode.glamor)
|
||||
- ms->drmmode.gbm = glamor_egl_get_gbm_device(pScreen);
|
||||
+ ms->drmmode.gbm = ms->glamor.egl_get_gbm_device(pScreen);
|
||||
#endif
|
||||
|
||||
/* HW dependent - FIXME */
|
||||
@@ -1718,7 +1743,7 @@ ScreenInit(ScreenPtr pScreen, int argc, char **argv)
|
||||
if (ms->drmmode.glamor) {
|
||||
XF86VideoAdaptorPtr glamor_adaptor;
|
||||
|
||||
- glamor_adaptor = glamor_xv_init(pScreen, 16);
|
||||
+ glamor_adaptor = ms->glamor.xv_init(pScreen, 16);
|
||||
if (glamor_adaptor != NULL)
|
||||
xf86XVScreenInit(pScreen, &glamor_adaptor, 1);
|
||||
else
|
||||
diff --git a/hw/xfree86/drivers/modesetting/driver.h b/hw/xfree86/drivers/modesetting/driver.h
|
||||
index 394a20fc1..5e4d2509a 100644
|
||||
--- a/hw/xfree86/drivers/modesetting/driver.h
|
||||
+++ b/hw/xfree86/drivers/modesetting/driver.h
|
||||
@@ -132,6 +132,30 @@ typedef struct _modesettingRec {
|
||||
void (*UpdatePacked)(ScreenPtr, shadowBufPtr);
|
||||
} shadow;
|
||||
|
||||
+ /* glamor API */
|
||||
+ struct {
|
||||
+ Bool (*back_pixmap_from_fd)(PixmapPtr, int, CARD16, CARD16, CARD16,
|
||||
+ CARD8, CARD8);
|
||||
+ void (*block_handler)(ScreenPtr);
|
||||
+ Bool (*egl_create_textured_pixmap)(PixmapPtr, int, int);
|
||||
+ Bool (*egl_create_textured_pixmap_from_gbm_bo)(PixmapPtr,
|
||||
+ struct gbm_bo *,
|
||||
+ Bool);
|
||||
+ void (*egl_exchange_buffers)(PixmapPtr, PixmapPtr);
|
||||
+ struct gbm_device *(*egl_get_gbm_device)(ScreenPtr);
|
||||
+ Bool (*egl_init)(ScrnInfoPtr, int);
|
||||
+ void (*finish)(ScreenPtr);
|
||||
+ struct gbm_bo *(*gbm_bo_from_pixmap)(ScreenPtr, PixmapPtr);
|
||||
+ Bool (*init)(ScreenPtr, unsigned int);
|
||||
+ int (*name_from_pixmap)(PixmapPtr, CARD16 *, CARD32 *);
|
||||
+ void (*set_drawable_modifiers_func)(ScreenPtr,
|
||||
+ GetDrawableModifiersFuncPtr);
|
||||
+ int (*shareable_fd_from_pixmap)(ScreenPtr, PixmapPtr, CARD16 *,
|
||||
+ CARD32 *);
|
||||
+ Bool (*supports_pixmap_import_export)(ScreenPtr);
|
||||
+ XF86VideoAdaptorPtr (*xv_init)(ScreenPtr, int);
|
||||
+ } glamor;
|
||||
+
|
||||
} modesettingRec, *modesettingPtr;
|
||||
|
||||
#define modesettingPTR(p) ((modesettingPtr)((p)->driverPrivate))
|
||||
diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c b/hw/xfree86/drivers/modesetting/drmmode_display.c
|
||||
index 6f5f8caf6..28609db7c 100644
|
||||
--- a/hw/xfree86/drivers/modesetting/drmmode_display.c
|
||||
+++ b/hw/xfree86/drivers/modesetting/drmmode_display.c
|
||||
@@ -770,7 +770,7 @@ drmmode_crtc_set_mode(xf86CrtcPtr crtc, Bool test_only)
|
||||
#ifdef GLAMOR_HAS_GBM
|
||||
/* Make sure any pending drawing will be visible in a new scanout buffer */
|
||||
if (drmmode->glamor)
|
||||
- glamor_finish(screen);
|
||||
+ ms->glamor.finish(screen);
|
||||
#endif
|
||||
|
||||
if (ms->atomic_modeset) {
|
||||
@@ -1385,6 +1385,7 @@ create_pixmap_for_fbcon(drmmode_ptr drmmode, ScrnInfoPtr pScrn, int fbcon_id)
|
||||
PixmapPtr pixmap = drmmode->fbcon_pixmap;
|
||||
drmModeFBPtr fbcon;
|
||||
ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
|
||||
+ modesettingPtr ms = modesettingPTR(pScrn);
|
||||
Bool ret;
|
||||
|
||||
if (pixmap)
|
||||
@@ -1405,7 +1406,8 @@ create_pixmap_for_fbcon(drmmode_ptr drmmode, ScrnInfoPtr pScrn, int fbcon_id)
|
||||
if (!pixmap)
|
||||
goto out_free_fb;
|
||||
|
||||
- ret = glamor_egl_create_textured_pixmap(pixmap, fbcon->handle, fbcon->pitch);
|
||||
+ ret = ms->glamor.egl_create_textured_pixmap(pixmap, fbcon->handle,
|
||||
+ fbcon->pitch);
|
||||
if (!ret) {
|
||||
FreePixmap(pixmap);
|
||||
pixmap = NULL;
|
||||
@@ -1424,6 +1426,7 @@ drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
|
||||
#ifdef GLAMOR_HAS_GBM
|
||||
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
|
||||
ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
|
||||
+ modesettingPtr ms = modesettingPTR(pScrn);
|
||||
PixmapPtr src, dst;
|
||||
int fbcon_id = 0;
|
||||
GCPtr gc;
|
||||
@@ -3108,12 +3111,13 @@ drmmode_set_pixmap_bo(drmmode_ptr drmmode, PixmapPtr pixmap, drmmode_bo *bo)
|
||||
{
|
||||
#ifdef GLAMOR_HAS_GBM
|
||||
ScrnInfoPtr scrn = drmmode->scrn;
|
||||
+ modesettingPtr ms = modesettingPTR(scrn);
|
||||
|
||||
if (!drmmode->glamor)
|
||||
return TRUE;
|
||||
|
||||
- if (!glamor_egl_create_textured_pixmap_from_gbm_bo(pixmap, bo->gbm,
|
||||
- bo->used_modifiers)) {
|
||||
+ if (!ms->glamor.egl_create_textured_pixmap_from_gbm_bo(pixmap, bo->gbm,
|
||||
+ bo->used_modifiers)) {
|
||||
xf86DrvMsg(scrn->scrnIndex, X_ERROR, "Failed to create pixmap\n");
|
||||
return FALSE;
|
||||
}
|
||||
@@ -3436,13 +3440,14 @@ drmmode_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
|
||||
{
|
||||
#ifdef GLAMOR_HAS_GBM
|
||||
ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
|
||||
+ modesettingPtr ms = modesettingPTR(pScrn);
|
||||
|
||||
if (drmmode->glamor) {
|
||||
- if (!glamor_init(pScreen, GLAMOR_USE_EGL_SCREEN)) {
|
||||
+ if (!ms->glamor.init(pScreen, GLAMOR_USE_EGL_SCREEN)) {
|
||||
return FALSE;
|
||||
}
|
||||
#ifdef GBM_BO_WITH_MODIFIERS
|
||||
- glamor_set_drawable_modifiers_func(pScreen, get_drawable_modifiers);
|
||||
+ ms->glamor.set_drawable_modifiers_func(pScreen, get_drawable_modifiers);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
diff --git a/hw/xfree86/drivers/modesetting/pageflip.c b/hw/xfree86/drivers/modesetting/pageflip.c
|
||||
index 1d54816e2..841fa917c 100644
|
||||
--- a/hw/xfree86/drivers/modesetting/pageflip.c
|
||||
+++ b/hw/xfree86/drivers/modesetting/pageflip.c
|
||||
@@ -243,9 +243,9 @@ ms_do_pageflip(ScreenPtr screen,
|
||||
uint32_t flags;
|
||||
int i;
|
||||
struct ms_flipdata *flipdata;
|
||||
- glamor_block_handler(screen);
|
||||
+ ms->glamor.block_handler(screen);
|
||||
|
||||
- new_front_bo.gbm = glamor_gbm_bo_from_pixmap(screen, new_front);
|
||||
+ new_front_bo.gbm = ms->glamor.gbm_bo_from_pixmap(screen, new_front);
|
||||
new_front_bo.dumb = NULL;
|
||||
|
||||
if (!new_front_bo.gbm) {
|
||||
diff --git a/hw/xfree86/drivers/modesetting/present.c b/hw/xfree86/drivers/modesetting/present.c
|
||||
index 186309a29..c700cf116 100644
|
||||
--- a/hw/xfree86/drivers/modesetting/present.c
|
||||
+++ b/hw/xfree86/drivers/modesetting/present.c
|
||||
@@ -166,7 +166,7 @@ ms_present_flush(WindowPtr window)
|
||||
modesettingPtr ms = modesettingPTR(scrn);
|
||||
|
||||
if (ms->drmmode.glamor)
|
||||
- glamor_block_handler(screen);
|
||||
+ ms->glamor.block_handler(screen);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -262,7 +262,7 @@ ms_present_check_unflip(RRCrtcPtr crtc,
|
||||
|
||||
#ifdef GBM_BO_WITH_MODIFIERS
|
||||
/* Check if buffer format/modifier is supported by all active CRTCs */
|
||||
- gbm = glamor_gbm_bo_from_pixmap(screen, pixmap);
|
||||
+ gbm = ms->glamor.gbm_bo_from_pixmap(screen, pixmap);
|
||||
if (gbm) {
|
||||
uint32_t format;
|
||||
uint64_t modifier;
|
||||
--
|
||||
2.33.1
|
||||
|
58
0008-modesetting-Add-glamor_finish-convenience-macro.patch
Normal file
58
0008-modesetting-Add-glamor_finish-convenience-macro.patch
Normal file
@ -0,0 +1,58 @@
|
||||
From 7f1bedcf27cfd09162544ff1b18c21c8e5695a9d Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michel=20D=C3=A4nzer?= <mdaenzer@redhat.com>
|
||||
Date: Fri, 22 Nov 2019 18:05:04 +0100
|
||||
Subject: [PATCH xserver 08/11] modesetting: Add glamor_finish() convenience
|
||||
macro
|
||||
|
||||
This will simplify backporting the following fix to the 1.20 branch.
|
||||
|
||||
Reviewed-by: Adam Jackson <ajax@redhat.com>
|
||||
(cherry picked from commit 06ef320e9bc1f1098df9cd5581f072528f28128e)
|
||||
---
|
||||
hw/xfree86/drivers/modesetting/driver.c | 2 +-
|
||||
hw/xfree86/drivers/modesetting/driver.h | 2 ++
|
||||
hw/xfree86/drivers/modesetting/drmmode_display.c | 2 +-
|
||||
3 files changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/hw/xfree86/drivers/modesetting/driver.c b/hw/xfree86/drivers/modesetting/driver.c
|
||||
index 4f4db67b7..afba8538a 100644
|
||||
--- a/hw/xfree86/drivers/modesetting/driver.c
|
||||
+++ b/hw/xfree86/drivers/modesetting/driver.c
|
||||
@@ -615,7 +615,7 @@ redisplay_dirty(ScreenPtr screen, PixmapDirtyUpdatePtr dirty, int *timeout)
|
||||
* the shared pixmap, but not all).
|
||||
*/
|
||||
if (ms->drmmode.glamor)
|
||||
- ms->glamor.finish(screen);
|
||||
+ glamor_finish(screen);
|
||||
#endif
|
||||
/* Ensure the slave processes the damage immediately */
|
||||
if (timeout)
|
||||
diff --git a/hw/xfree86/drivers/modesetting/driver.h b/hw/xfree86/drivers/modesetting/driver.h
|
||||
index 5e4d2509a..c6e7cd0c8 100644
|
||||
--- a/hw/xfree86/drivers/modesetting/driver.h
|
||||
+++ b/hw/xfree86/drivers/modesetting/driver.h
|
||||
@@ -158,6 +158,8 @@ typedef struct _modesettingRec {
|
||||
|
||||
} modesettingRec, *modesettingPtr;
|
||||
|
||||
+#define glamor_finish(screen) ms->glamor.finish(screen)
|
||||
+
|
||||
#define modesettingPTR(p) ((modesettingPtr)((p)->driverPrivate))
|
||||
modesettingEntPtr ms_ent_priv(ScrnInfoPtr scrn);
|
||||
|
||||
diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c b/hw/xfree86/drivers/modesetting/drmmode_display.c
|
||||
index 28609db7c..6516fac5f 100644
|
||||
--- a/hw/xfree86/drivers/modesetting/drmmode_display.c
|
||||
+++ b/hw/xfree86/drivers/modesetting/drmmode_display.c
|
||||
@@ -770,7 +770,7 @@ drmmode_crtc_set_mode(xf86CrtcPtr crtc, Bool test_only)
|
||||
#ifdef GLAMOR_HAS_GBM
|
||||
/* Make sure any pending drawing will be visible in a new scanout buffer */
|
||||
if (drmmode->glamor)
|
||||
- ms->glamor.finish(screen);
|
||||
+ glamor_finish(screen);
|
||||
#endif
|
||||
|
||||
if (ms->atomic_modeset) {
|
||||
--
|
||||
2.33.1
|
||||
|
@ -0,0 +1,63 @@
|
||||
From ae40c508fbd88869157412a1b159c0d71eb1e708 Mon Sep 17 00:00:00 2001
|
||||
From: Kenneth Graunke <kenneth@whitecape.org>
|
||||
Date: Thu, 21 Nov 2019 23:03:50 -0800
|
||||
Subject: [PATCH xserver 09/11] modesetting: Use EGL_MESA_query_driver to
|
||||
select DRI driver if possible
|
||||
|
||||
New now ask Glamor to use EGL_MESA_query_driver to obtain the DRI driver
|
||||
name; if successful, we use that as the DRI driver name. Following the
|
||||
existing dri2.c logic, we also use the same name for the VDPAU driver,
|
||||
except for i965 (and now iris), where we switch to the "va_gl" fallback.
|
||||
|
||||
This allows us to bypass the PCI ID lists in xserver and centralize the
|
||||
driver selection mechanism inside Mesa. The hope is that we no longer
|
||||
have to update these lists for any future hardware.
|
||||
|
||||
(cherry picked from commit 8d4be7f6c4f7c673d7ec1a6bfdef944907a3916e)
|
||||
---
|
||||
hw/xfree86/drivers/modesetting/dri2.c | 3 ++-
|
||||
hw/xfree86/drivers/modesetting/driver.c | 1 +
|
||||
hw/xfree86/drivers/modesetting/driver.h | 1 +
|
||||
3 files changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/hw/xfree86/drivers/modesetting/dri2.c b/hw/xfree86/drivers/modesetting/dri2.c
|
||||
index 724d9d34c..255c72cac 100644
|
||||
--- a/hw/xfree86/drivers/modesetting/dri2.c
|
||||
+++ b/hw/xfree86/drivers/modesetting/dri2.c
|
||||
@@ -1076,7 +1076,8 @@ ms_dri2_screen_init(ScreenPtr screen)
|
||||
info.CopyRegion2 = ms_dri2_copy_region2;
|
||||
|
||||
/* Ask Glamor to obtain the DRI driver name via EGL_MESA_query_driver. */
|
||||
- driver_names[0] = glamor_egl_get_driver_name(screen);
|
||||
+ if (ms->glamor.egl_get_driver_name)
|
||||
+ driver_names[0] = ms->glamor.egl_get_driver_name(screen);
|
||||
|
||||
if (driver_names[0]) {
|
||||
/* There is no VDPAU driver for Intel, fallback to the generic
|
||||
diff --git a/hw/xfree86/drivers/modesetting/driver.c b/hw/xfree86/drivers/modesetting/driver.c
|
||||
index afba8538a..08cf6a1b4 100644
|
||||
--- a/hw/xfree86/drivers/modesetting/driver.c
|
||||
+++ b/hw/xfree86/drivers/modesetting/driver.c
|
||||
@@ -761,6 +761,7 @@ bind_glamor_api(void *mod, modesettingPtr ms)
|
||||
ms->glamor.shareable_fd_from_pixmap = LoaderSymbolFromModule(mod, "glamor_shareable_fd_from_pixmap");
|
||||
ms->glamor.supports_pixmap_import_export = LoaderSymbolFromModule(mod, "glamor_supports_pixmap_import_export");
|
||||
ms->glamor.xv_init = LoaderSymbolFromModule(mod, "glamor_xv_init");
|
||||
+ ms->glamor.egl_get_driver_name = LoaderSymbolFromModule(mod, "glamor_egl_get_driver_name");
|
||||
}
|
||||
|
||||
static void
|
||||
diff --git a/hw/xfree86/drivers/modesetting/driver.h b/hw/xfree86/drivers/modesetting/driver.h
|
||||
index c6e7cd0c8..328a97de1 100644
|
||||
--- a/hw/xfree86/drivers/modesetting/driver.h
|
||||
+++ b/hw/xfree86/drivers/modesetting/driver.h
|
||||
@@ -154,6 +154,7 @@ typedef struct _modesettingRec {
|
||||
CARD32 *);
|
||||
Bool (*supports_pixmap_import_export)(ScreenPtr);
|
||||
XF86VideoAdaptorPtr (*xv_init)(ScreenPtr, int);
|
||||
+ const char *(*egl_get_driver_name)(ScreenPtr);
|
||||
} glamor;
|
||||
|
||||
} modesettingRec, *modesettingPtr;
|
||||
--
|
||||
2.33.1
|
||||
|
94
0010-modesetting-Fix-build-with-glamor-disabled.patch
Normal file
94
0010-modesetting-Fix-build-with-glamor-disabled.patch
Normal file
@ -0,0 +1,94 @@
|
||||
From d8271417a5986240f1f81cbe269e0cd07a9104d1 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michel=20D=C3=A4nzer?= <mdaenzer@redhat.com>
|
||||
Date: Mon, 10 Feb 2020 18:41:44 +0100
|
||||
Subject: [PATCH xserver 10/11] modesetting: Fix build with glamor disabled
|
||||
|
||||
Fixes: cb1b1e184723 "modesetting: Indirect the glamor API through
|
||||
LoaderSymbol"
|
||||
Reviewed-by: Adam Jackson <ajax@redhat.com>
|
||||
(cherry picked from commit 0cb9fa7949d6c5398de220fbdbe1e262e943fcbb)
|
||||
---
|
||||
hw/xfree86/drivers/modesetting/driver.c | 21 +++++++++++++++------
|
||||
hw/xfree86/drivers/modesetting/driver.h | 3 ++-
|
||||
2 files changed, 17 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/hw/xfree86/drivers/modesetting/driver.c b/hw/xfree86/drivers/modesetting/driver.c
|
||||
index 08cf6a1b4..ce8bac9f5 100644
|
||||
--- a/hw/xfree86/drivers/modesetting/driver.c
|
||||
+++ b/hw/xfree86/drivers/modesetting/driver.c
|
||||
@@ -743,9 +743,17 @@ FreeRec(ScrnInfoPtr pScrn)
|
||||
|
||||
}
|
||||
|
||||
-static void
|
||||
-bind_glamor_api(void *mod, modesettingPtr ms)
|
||||
+#ifdef GLAMOR_HAS_GBM
|
||||
+
|
||||
+static Bool
|
||||
+load_glamor(ScrnInfoPtr pScrn)
|
||||
{
|
||||
+ void *mod = xf86LoadSubModule(pScrn, GLAMOR_EGL_MODULE_NAME);
|
||||
+ modesettingPtr ms = modesettingPTR(pScrn);
|
||||
+
|
||||
+ if (!mod)
|
||||
+ return FALSE;
|
||||
+
|
||||
ms->glamor.back_pixmap_from_fd = LoaderSymbolFromModule(mod, "glamor_back_pixmap_from_fd");
|
||||
ms->glamor.block_handler = LoaderSymbolFromModule(mod, "glamor_block_handler");
|
||||
ms->glamor.egl_create_textured_pixmap = LoaderSymbolFromModule(mod, "glamor_egl_create_textured_pixmap");
|
||||
@@ -762,8 +770,12 @@ bind_glamor_api(void *mod, modesettingPtr ms)
|
||||
ms->glamor.supports_pixmap_import_export = LoaderSymbolFromModule(mod, "glamor_supports_pixmap_import_export");
|
||||
ms->glamor.xv_init = LoaderSymbolFromModule(mod, "glamor_xv_init");
|
||||
ms->glamor.egl_get_driver_name = LoaderSymbolFromModule(mod, "glamor_egl_get_driver_name");
|
||||
+
|
||||
+ return TRUE;
|
||||
}
|
||||
|
||||
+#endif
|
||||
+
|
||||
static void
|
||||
try_enable_glamor(ScrnInfoPtr pScrn)
|
||||
{
|
||||
@@ -772,7 +784,6 @@ try_enable_glamor(ScrnInfoPtr pScrn)
|
||||
OPTION_ACCEL_METHOD);
|
||||
Bool do_glamor = (!accel_method_str ||
|
||||
strcmp(accel_method_str, "glamor") == 0);
|
||||
- void *mod;
|
||||
|
||||
ms->drmmode.glamor = FALSE;
|
||||
|
||||
@@ -787,9 +798,7 @@ try_enable_glamor(ScrnInfoPtr pScrn)
|
||||
return;
|
||||
}
|
||||
|
||||
- mod = xf86LoadSubModule(pScrn, GLAMOR_EGL_MODULE_NAME);
|
||||
- if (mod) {
|
||||
- bind_glamor_api(mod, ms);
|
||||
+ if (load_glamor(pScrn)) {
|
||||
if (ms->glamor.egl_init(pScrn, ms->fd)) {
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "glamor initialized\n");
|
||||
ms->drmmode.glamor = TRUE;
|
||||
diff --git a/hw/xfree86/drivers/modesetting/driver.h b/hw/xfree86/drivers/modesetting/driver.h
|
||||
index 328a97de1..261f1aac4 100644
|
||||
--- a/hw/xfree86/drivers/modesetting/driver.h
|
||||
+++ b/hw/xfree86/drivers/modesetting/driver.h
|
||||
@@ -132,6 +132,7 @@ typedef struct _modesettingRec {
|
||||
void (*UpdatePacked)(ScreenPtr, shadowBufPtr);
|
||||
} shadow;
|
||||
|
||||
+#ifdef GLAMOR_HAS_GBM
|
||||
/* glamor API */
|
||||
struct {
|
||||
Bool (*back_pixmap_from_fd)(PixmapPtr, int, CARD16, CARD16, CARD16,
|
||||
@@ -156,7 +157,7 @@ typedef struct _modesettingRec {
|
||||
XF86VideoAdaptorPtr (*xv_init)(ScreenPtr, int);
|
||||
const char *(*egl_get_driver_name)(ScreenPtr);
|
||||
} glamor;
|
||||
-
|
||||
+#endif
|
||||
} modesettingRec, *modesettingPtr;
|
||||
|
||||
#define glamor_finish(screen) ms->glamor.finish(screen)
|
||||
--
|
||||
2.33.1
|
||||
|
33
0011-modesetting-set-gbm-as-dependency-for-autotools.patch
Normal file
33
0011-modesetting-set-gbm-as-dependency-for-autotools.patch
Normal file
@ -0,0 +1,33 @@
|
||||
From 55fb707d037004e001623a0d066f748d8ba48d48 Mon Sep 17 00:00:00 2001
|
||||
From: Olivier Fourdan <ofourdan@redhat.com>
|
||||
Date: Tue, 23 Nov 2021 12:19:48 +0100
|
||||
Subject: [PATCH xserver 11/11] modesetting: set gbm as dependency for
|
||||
autotools
|
||||
|
||||
Same as commit 9d628ee5f for automake.
|
||||
|
||||
Modifiers support needs gbm as a dependency. Without setting the dependency
|
||||
included headers are not found reliably and the build might fail if the
|
||||
headers are not placed in the default system include paths.
|
||||
|
||||
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
|
||||
---
|
||||
hw/xfree86/drivers/modesetting/Makefile.am | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/hw/xfree86/drivers/modesetting/Makefile.am b/hw/xfree86/drivers/modesetting/Makefile.am
|
||||
index 961c57408..ac5091be3 100644
|
||||
--- a/hw/xfree86/drivers/modesetting/Makefile.am
|
||||
+++ b/hw/xfree86/drivers/modesetting/Makefile.am
|
||||
@@ -41,7 +41,7 @@ AM_CPPFLAGS = \
|
||||
|
||||
modesetting_drv_la_LTLIBRARIES = modesetting_drv.la
|
||||
modesetting_drv_la_LDFLAGS = -module -avoid-version
|
||||
-modesetting_drv_la_LIBADD = $(UDEV_LIBS) $(DRM_LIBS)
|
||||
+modesetting_drv_la_LIBADD = $(UDEV_LIBS) $(DRM_LIBS) $(GBM_LIBS)
|
||||
modesetting_drv_ladir = @moduledir@/drivers
|
||||
|
||||
modesetting_drv_la_SOURCES = \
|
||||
--
|
||||
2.33.1
|
||||
|
@ -8,10 +8,6 @@
|
||||
# format, and add a PatchN: line. If you want to push something upstream,
|
||||
# check out the master branch, pull, cherry-pick, and push.
|
||||
|
||||
# X.org requires lazy relocations to work.
|
||||
%undefine _hardened_build
|
||||
%undefine _strict_symbol_defs_build
|
||||
|
||||
#global gitdate 20161026
|
||||
%global stable_abi 1
|
||||
|
||||
@ -46,7 +42,7 @@
|
||||
Summary: X.Org X11 X server
|
||||
Name: xorg-x11-server
|
||||
Version: 1.20.11
|
||||
Release: 5%{?gitdate:.%{gitdate}}%{?dist}
|
||||
Release: 6%{?gitdate:.%{gitdate}}%{?dist}
|
||||
URL: http://www.x.org
|
||||
License: MIT
|
||||
|
||||
@ -103,7 +99,17 @@ Patch8: 0001-mustard-xfree86-Only-call-the-driver-s-platformProbe.patch
|
||||
# <empty>
|
||||
|
||||
# Backports from "master" upstream:
|
||||
# <empty>
|
||||
Patch102: 0002-xfree86-Link-fb-statically.patch
|
||||
Patch104: 0004-loader-Move-LoaderSymbolFromModule-to-public-API.patch
|
||||
Patch105: 0005-loader-Make-LoaderSymbolFromModule-take-a-ModuleDesc.patch
|
||||
Patch106: 0006-modesetting-Indirect-the-shadow-API-through-LoaderSy.patch
|
||||
Patch107: 0007-modesetting-Indirect-the-glamor-API-through-LoaderSy.patch
|
||||
Patch108: 0008-modesetting-Add-glamor_finish-convenience-macro.patch
|
||||
Patch109: 0009-modesetting-Use-EGL_MESA_query_driver-to-select-DRI-.patch
|
||||
Patch110: 0010-modesetting-Fix-build-with-glamor-disabled.patch
|
||||
# Because we still use automake
|
||||
Patch111: 0011-modesetting-set-gbm-as-dependency-for-autotools.patch
|
||||
|
||||
|
||||
BuildRequires: make
|
||||
BuildRequires: systemtap-sdt-devel
|
||||
@ -320,10 +326,6 @@ test `getminor extension` == %{extension_minor}
|
||||
|
||||
%build
|
||||
|
||||
export CFLAGS="$RPM_OPT_FLAGS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1"
|
||||
export CXXFLAGS="$RPM_OPT_FLAGS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1"
|
||||
export LDFLAGS="$RPM_LD_FLAGS -specs=/usr/lib/rpm/redhat/redhat-hardened-ld"
|
||||
|
||||
%if !0%{?rhel}
|
||||
%ifarch %{ix86} x86_64
|
||||
%global int10_arch 1
|
||||
@ -450,7 +452,6 @@ find %{inst_srcdir}/hw/xfree86 -name \*.c -delete
|
||||
%dir %{_libdir}/xorg/modules/input
|
||||
%{_libdir}/xorg/modules/libfbdevhw.so
|
||||
%{_libdir}/xorg/modules/libexa.so
|
||||
%{_libdir}/xorg/modules/libfb.so
|
||||
%{_libdir}/xorg/modules/libglamoregl.so
|
||||
%{_libdir}/xorg/modules/libshadow.so
|
||||
%{_libdir}/xorg/modules/libshadowfb.so
|
||||
@ -519,6 +520,10 @@ find %{inst_srcdir}/hw/xfree86 -name \*.c -delete
|
||||
|
||||
|
||||
%changelog
|
||||
* Tue Nov 23 2021 Olivier Fourdan <ofourdan@redhat.com> - 1.20.11-6
|
||||
- Restore hardened builds
|
||||
Resolves: #2024556
|
||||
|
||||
* Tue Nov 9 2021 Adam Jackson <ajax@redhat.com> - 1.20.11-5
|
||||
- Disable non-platform video driver probe, it should never be needed and the
|
||||
PCI probe code interferes with the (default) platform path.
|
||||
|
Loading…
Reference in New Issue
Block a user