targets/dri: Add __driDriverGetExtensions_nouveau symbol
authorEmil Velikov <emil.l.velikov@gmail.com>
Mon, 16 Jun 2014 22:30:44 +0000 (23:30 +0100)
committerEmil Velikov <emil.l.velikov@gmail.com>
Thu, 10 Jul 2014 00:06:47 +0000 (01:06 +0100)
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.

v2: Rebase on top of gallium dri3.

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/auxiliary/target-helpers/inline_drm_helper.h
src/gallium/state_trackers/dri/common/dri_screen.h
src/gallium/state_trackers/dri/drm/dri2.c
src/gallium/targets/dri/Makefile.am
src/gallium/targets/dri/dri.sym

index 3b36316f1a258933e69ab2ee92c3ab8abe396952..62c4f8e29a1babee96eb44978848e2a332d72a38 100644 (file)
@@ -83,6 +83,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)
 {
index 2d07f517db6ae819ad3e46f0b00b4b6dba6d63ce..106dcc3a711008be69900f8746ab6911dbe9fc26 100644 (file)
@@ -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
index 898fd0ab1f68027e5657976886ab00fe39646cc2..1d26522ca966cdd7bbfe224834fef52a45c623b9 100644 (file)
@@ -1342,6 +1342,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,
@@ -1351,4 +1365,12 @@ PUBLIC const __DRIextension *__driDriverExtensions[] = {
     NULL
 };
 
+const __DRIextension *galliumdrm_driver_extensions[] = {
+    &driCoreExtension.base,
+    &driImageDriverExtension.base,
+    &driDRI2Extension.base,
+    &gallium_config_options.base,
+    NULL
+};
+
 /* vim: set sw=3 ts=8 sts=3 expandtab: */
index cb1206452e43334ab7f64b8e285dc5266660c8bd..f9d348284521c30ec038f684bfcde701ea103647 100644 (file)
@@ -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
 
index c99aa09b4d9140da43ba4a176abbc2173a29d845..49a2cc9fcf29bcf992ce9b12559ba2f91dd4b929 100644 (file)
@@ -1,6 +1,7 @@
 {
        global:
                __driDriverExtensions;
+               __driDriverGetExtensions*;
                nouveau_drm_screen_create;
                radeon_drm_winsys_create;
        local: