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

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