[Mesa-dev] [PATCH 11/23] targets/dri: Add __driDriverGetExtensions_nouveau symbol

Emil Velikov emil.l.velikov at gmail.com
Tue Jun 17 11:38:27 PDT 2014


The symbol is introduced by the mesa megadrivers, and adding
gallium support for it will allow us to merge st/dri/drm and
st/dri/sw. Resulting in a single dri library across gallium.

Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
---
 .../auxiliary/target-helpers/inline_drm_helper.h    | 12 ++++++++++++
 src/gallium/state_trackers/dri/common/dri_screen.h  |  2 ++
 src/gallium/state_trackers/dri/drm/dri2.c           | 21 +++++++++++++++++++++
 src/gallium/targets/dri/Makefile.am                 |  9 +++++++++
 src/gallium/targets/dri/dri.sym                     |  1 +
 5 files changed, 45 insertions(+)

diff --git a/src/gallium/auxiliary/target-helpers/inline_drm_helper.h b/src/gallium/auxiliary/target-helpers/inline_drm_helper.h
index 6da071a..f179202 100644
--- a/src/gallium/auxiliary/target-helpers/inline_drm_helper.h
+++ b/src/gallium/auxiliary/target-helpers/inline_drm_helper.h
@@ -90,6 +90,18 @@ pipe_ilo_create_screen(int fd)
 #endif
 
 #if defined(GALLIUM_NOUVEAU)
+#if defined(DRI_TARGET)
+#include "dri_screen.h"
+
+const __DRIextension **__driDriverGetExtensions_nouveau(void);
+
+PUBLIC const __DRIextension **__driDriverGetExtensions_nouveau(void)
+{
+   globalDriverAPI = &galliumdrm_driver_api;
+   return galliumdrm_driver_extensions;
+}
+#endif
+
 static struct pipe_screen *
 pipe_nouveau_create_screen(int fd)
 {
diff --git a/src/gallium/state_trackers/dri/common/dri_screen.h b/src/gallium/state_trackers/dri/common/dri_screen.h
index 2d07f51..106dcc3 100644
--- a/src/gallium/state_trackers/dri/common/dri_screen.h
+++ b/src/gallium/state_trackers/dri/common/dri_screen.h
@@ -145,6 +145,8 @@ dri_destroy_screen_helper(struct dri_screen * screen);
 void
 dri_destroy_screen(__DRIscreen * sPriv);
 
+extern const struct __DriverAPIRec galliumdrm_driver_api;
+extern const __DRIextension *galliumdrm_driver_extensions[];
 extern const __DRIconfigOptionsExtension gallium_config_options;
 
 #endif
diff --git a/src/gallium/state_trackers/dri/drm/dri2.c b/src/gallium/state_trackers/dri/drm/dri2.c
index 03fdf69..0c2b20e 100644
--- a/src/gallium/state_trackers/dri/drm/dri2.c
+++ b/src/gallium/state_trackers/dri/drm/dri2.c
@@ -1192,6 +1192,20 @@ const struct __DriverAPIRec driDriverAPI = {
    .ReleaseBuffer  = dri2_release_buffer,
 };
 
+const struct __DriverAPIRec galliumdrm_driver_api = {
+   .InitScreen = dri2_init_screen,
+   .DestroyScreen = dri_destroy_screen,
+   .CreateContext = dri_create_context,
+   .DestroyContext = dri_destroy_context,
+   .CreateBuffer = dri2_create_buffer,
+   .DestroyBuffer = dri_destroy_buffer,
+   .MakeCurrent = dri_make_current,
+   .UnbindContext = dri_unbind_context,
+
+   .AllocateBuffer = dri2_allocate_buffer,
+   .ReleaseBuffer  = dri2_release_buffer,
+};
+
 /* This is the table of extensions that the loader will dlsym() for. */
 PUBLIC const __DRIextension *__driDriverExtensions[] = {
     &driCoreExtension.base,
@@ -1200,4 +1214,11 @@ PUBLIC const __DRIextension *__driDriverExtensions[] = {
     NULL
 };
 
+const __DRIextension *galliumdrm_driver_extensions[] = {
+    &driCoreExtension.base,
+    &driDRI2Extension.base,
+    &gallium_config_options.base,
+    NULL
+};
+
 /* vim: set sw=3 ts=8 sts=3 expandtab: */
diff --git a/src/gallium/targets/dri/Makefile.am b/src/gallium/targets/dri/Makefile.am
index 3833217..e7f028d 100644
--- a/src/gallium/targets/dri/Makefile.am
+++ b/src/gallium/targets/dri/Makefile.am
@@ -1,6 +1,10 @@
 include $(top_srcdir)/src/gallium/Automake.inc
 
 AM_CFLAGS = \
+	-I$(top_srcdir)/src/mapi \
+	-I$(top_srcdir)/src/mesa \
+	-I$(top_srcdir)/src/mesa/drivers/dri/common \
+	-I$(top_srcdir)/src/gallium/state_trackers/dri/common \
 	$(GALLIUM_TARGET_CFLAGS)
 
 AM_CPPFLAGS = \
@@ -9,6 +13,11 @@ AM_CPPFLAGS = \
 	-DGALLIUM_RBUG \
 	-DGALLIUM_TRACE
 
+if HAVE_GALLIUM_NOUVEAU
+AM_CPPFLAGS += \
+	-DDRI_TARGET
+endif
+
 dridir = $(DRI_DRIVER_INSTALL_DIR)
 dri_LTLIBRARIES = gallium_dri.la
 
diff --git a/src/gallium/targets/dri/dri.sym b/src/gallium/targets/dri/dri.sym
index c99aa09..49a2cc9 100644
--- a/src/gallium/targets/dri/dri.sym
+++ b/src/gallium/targets/dri/dri.sym
@@ -1,6 +1,7 @@
 {
 	global:
 		__driDriverExtensions;
+		__driDriverGetExtensions*;
 		nouveau_drm_screen_create;
 		radeon_drm_winsys_create;
 	local:
-- 
2.0.0



More information about the mesa-dev mailing list