targets/dri-swrast: convert to gallium megadrivers :)
authorEmil Velikov <emil.l.velikov@gmail.com>
Sat, 21 Jun 2014 12:48:52 +0000 (13:48 +0100)
committerEmil Velikov <emil.l.velikov@gmail.com>
Thu, 10 Jul 2014 00:06:48 +0000 (01:06 +0100)
Export the approapriate new symbol, and keep backwards compat
via the megadriver_stub helper library.

Our next step would be to unify dri/drm and dri/sw, leading to
a complete megadrivers solution, and having a single library
that provides dri across all targets.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Tested-by: Rob Clark <robclark@freedesktop.org>
Tested-by: Thomas Helland <thomashelland90 at gmail.com>
Acked-by: Tom Stellard <thomas.stellard@amd.com>
src/gallium/Automake.inc
src/gallium/state_trackers/dri/common/dri_screen.h
src/gallium/state_trackers/dri/sw/drisw.c
src/gallium/targets/dri-swrast/Makefile.am
src/gallium/targets/dri-swrast/SConscript
src/gallium/targets/dri-swrast/swrast_drm_api.c

index e70a1363e1a049dd84b7883e4703ff3e37c0dcce..1a21cad01284bb64b2046f48cb109c04acb21676 100644 (file)
@@ -28,6 +28,8 @@ GALLIUM_DRIVER_CXXFLAGS = \
 
 GALLIUM_DRI_CFLAGS = \
        -I$(top_srcdir)/include \
+       -I$(top_srcdir)/src/gallium/state_trackers/dri/common \
+       -I$(top_srcdir)/src/mesa/drivers/dri/common \
        -I$(top_srcdir)/src/gallium/include \
        -I$(top_srcdir)/src/gallium/auxiliary \
        -I$(top_srcdir)/src/gallium/drivers \
index 106dcc3a711008be69900f8746ab6911dbe9fc26..63758d2f7f7d9bb56ce70c3b4b4ba0f8d3c64c95 100644 (file)
@@ -147,6 +147,8 @@ dri_destroy_screen(__DRIscreen * sPriv);
 
 extern const struct __DriverAPIRec galliumdrm_driver_api;
 extern const __DRIextension *galliumdrm_driver_extensions[];
+extern const struct __DriverAPIRec galliumsw_driver_api;
+extern const __DRIextension *galliumsw_driver_extensions[];
 extern const __DRIconfigOptionsExtension gallium_config_options;
 
 #endif
index 6f50b05c2becb81d9d22dcb9c34d05492eee0163..f1d5a067148be70a1fce800de37ec9c3f90d9a1b 100644 (file)
@@ -397,7 +397,7 @@ drisw_create_buffer(__DRIscreen * sPriv,
  *
  * DRI versions differ in their implementation of init_screen and swap_buffers.
  */
-const struct __DriverAPIRec driDriverAPI = {
+const struct __DriverAPIRec galliumsw_driver_api = {
    .InitScreen = drisw_init_screen,
    .DestroyScreen = dri_destroy_screen,
    .CreateContext = dri_create_context,
@@ -411,7 +411,7 @@ const struct __DriverAPIRec driDriverAPI = {
 };
 
 /* This is the table of extensions that the loader will dlsym() for. */
-PUBLIC const __DRIextension *__driDriverExtensions[] = {
+const __DRIextension *galliumsw_driver_extensions[] = {
     &driCoreExtension.base,
     &driSWRastExtension.base,
     &driCopySubBufferExtension.base,
index 7db7d40cfc69c3a7f94100ffe9ccad2473a4746f..b52c4c2f3c973a93c129438f2e7ca11871b401c8 100644 (file)
@@ -39,6 +39,7 @@ swrast_dri_la_LDFLAGS = $(GALLIUM_DRI_LINKER_FLAGS)
 
 swrast_dri_la_LIBADD = \
        $(top_builddir)/src/mesa/drivers/dri/common/libdricommon.la \
+       $(top_builddir)/src/mesa/drivers/dri/common/libmegadriver_stub.la \
        $(top_builddir)/src/gallium/state_trackers/dri/sw/libdrisw.la \
        $(top_builddir)/src/gallium/winsys/sw/dri/libswdri.la \
        $(top_builddir)/src/gallium/drivers/softpipe/libsoftpipe.la \
index 029bb033e43b0862544a91c6dc635a98966d1caf..2497ec6583295df9f0ff9f8881031cd8f448a44e 100644 (file)
@@ -2,6 +2,14 @@ Import('*')
 
 env = drienv.Clone()
 
+env.Append(CPPPATH = [
+    '#/src/loader',
+    '#/src/mapi',
+    '#/src/mesa',
+    '#/src/mesa/drivers/dri/common',
+    '#/src/gallium/state_trackers/dri/common',
+])
+
 env.Prepend(LIBS = [
     st_drisw,
     ws_dri,
@@ -10,6 +18,7 @@ env.Prepend(LIBS = [
     mesa,
     glsl,
     gallium,
+    megadrivers_stub,
     dri_common,
 ])
 
index 3394722f6f9456db076ca8d096861f5086936a15..102d5bd1a3845bd41c7cae1fa27c2f621af0657e 100644 (file)
 
 #include "state_tracker/drm_driver.h"
 #include "sw/dri/dri_sw_winsys.h"
+#include "dri_screen.h"
+
+const __DRIextension **__driDriverGetExtensions_swrast(void);
+
+PUBLIC const __DRIextension **__driDriverGetExtensions_swrast(void)
+{
+   globalDriverAPI = &galliumsw_driver_api;
+   return galliumsw_driver_extensions;
+}
 
 DRM_DRIVER_DESCRIPTOR("swrast", NULL, NULL, NULL);