Blame SOURCES/0009-modesetting-Use-EGL_MESA_query_driver-to-select-DRI-.patch

cf7b2a
From ae40c508fbd88869157412a1b159c0d71eb1e708 Mon Sep 17 00:00:00 2001
cf7b2a
From: Kenneth Graunke <kenneth@whitecape.org>
cf7b2a
Date: Thu, 21 Nov 2019 23:03:50 -0800
cf7b2a
Subject: [PATCH xserver 09/11] modesetting: Use EGL_MESA_query_driver to
cf7b2a
 select DRI driver if possible
cf7b2a
cf7b2a
New now ask Glamor to use EGL_MESA_query_driver to obtain the DRI driver
cf7b2a
name; if successful, we use that as the DRI driver name.  Following the
cf7b2a
existing dri2.c logic, we also use the same name for the VDPAU driver,
cf7b2a
except for i965 (and now iris), where we switch to the "va_gl" fallback.
cf7b2a
cf7b2a
This allows us to bypass the PCI ID lists in xserver and centralize the
cf7b2a
driver selection mechanism inside Mesa.  The hope is that we no longer
cf7b2a
have to update these lists for any future hardware.
cf7b2a
cf7b2a
(cherry picked from commit 8d4be7f6c4f7c673d7ec1a6bfdef944907a3916e)
cf7b2a
---
cf7b2a
 hw/xfree86/drivers/modesetting/dri2.c   | 3 ++-
cf7b2a
 hw/xfree86/drivers/modesetting/driver.c | 1 +
cf7b2a
 hw/xfree86/drivers/modesetting/driver.h | 1 +
cf7b2a
 3 files changed, 4 insertions(+), 1 deletion(-)
cf7b2a
cf7b2a
diff --git a/hw/xfree86/drivers/modesetting/dri2.c b/hw/xfree86/drivers/modesetting/dri2.c
cf7b2a
index 724d9d34c..255c72cac 100644
cf7b2a
--- a/hw/xfree86/drivers/modesetting/dri2.c
cf7b2a
+++ b/hw/xfree86/drivers/modesetting/dri2.c
cf7b2a
@@ -1076,7 +1076,8 @@ ms_dri2_screen_init(ScreenPtr screen)
cf7b2a
     info.CopyRegion2 = ms_dri2_copy_region2;
cf7b2a
 
cf7b2a
     /* Ask Glamor to obtain the DRI driver name via EGL_MESA_query_driver. */
cf7b2a
-    driver_names[0] = glamor_egl_get_driver_name(screen);
cf7b2a
+    if (ms->glamor.egl_get_driver_name)
cf7b2a
+        driver_names[0] = ms->glamor.egl_get_driver_name(screen);
cf7b2a
 
cf7b2a
     if (driver_names[0]) {
cf7b2a
         /* There is no VDPAU driver for Intel, fallback to the generic
cf7b2a
diff --git a/hw/xfree86/drivers/modesetting/driver.c b/hw/xfree86/drivers/modesetting/driver.c
cf7b2a
index afba8538a..08cf6a1b4 100644
cf7b2a
--- a/hw/xfree86/drivers/modesetting/driver.c
cf7b2a
+++ b/hw/xfree86/drivers/modesetting/driver.c
cf7b2a
@@ -761,6 +761,7 @@ bind_glamor_api(void *mod, modesettingPtr ms)
cf7b2a
     ms->glamor.shareable_fd_from_pixmap = LoaderSymbolFromModule(mod, "glamor_shareable_fd_from_pixmap");
cf7b2a
     ms->glamor.supports_pixmap_import_export = LoaderSymbolFromModule(mod, "glamor_supports_pixmap_import_export");
cf7b2a
     ms->glamor.xv_init = LoaderSymbolFromModule(mod, "glamor_xv_init");
cf7b2a
+    ms->glamor.egl_get_driver_name = LoaderSymbolFromModule(mod, "glamor_egl_get_driver_name");
cf7b2a
 }
cf7b2a
 
cf7b2a
 static void
cf7b2a
diff --git a/hw/xfree86/drivers/modesetting/driver.h b/hw/xfree86/drivers/modesetting/driver.h
cf7b2a
index c6e7cd0c8..328a97de1 100644
cf7b2a
--- a/hw/xfree86/drivers/modesetting/driver.h
cf7b2a
+++ b/hw/xfree86/drivers/modesetting/driver.h
cf7b2a
@@ -154,6 +154,7 @@ typedef struct _modesettingRec {
cf7b2a
                                         CARD32 *);
cf7b2a
         Bool (*supports_pixmap_import_export)(ScreenPtr);
cf7b2a
         XF86VideoAdaptorPtr (*xv_init)(ScreenPtr, int);
cf7b2a
+        const char *(*egl_get_driver_name)(ScreenPtr);
cf7b2a
     } glamor;
cf7b2a
 
cf7b2a
 } modesettingRec, *modesettingPtr;
cf7b2a
-- 
cf7b2a
2.33.1
cf7b2a