summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Oliveira <itrindade.oliveira@gmail.com>2010-05-30 10:16:36 -0400
committerIgor Oliveira <igor.oliveira@openbossa.org>2010-05-30 10:16:36 -0400
commitb3e52cfb1e3318d9ec859b186b7a68090e702f3a (patch)
tree9362b96144abf0cf149e26e263031869e0983462
parentb8ab40647eaf2f74758df876f79509ad29ee7247 (diff)
DRM/Gallium3D: make cairo gallium backend support softpipe
-rw-r--r--configure.ac4
-rw-r--r--src/drm/cairo-drm-gallium-surface.c34
2 files changed, 23 insertions, 15 deletions
diff --git a/configure.ac b/configure.ac
index dc54b588..33753ae1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -278,8 +278,8 @@ CAIRO_ENABLE_SURFACE_BACKEND(gallium, Gallium3D, no, [
[mesa_DIR="$withval"],
[mesa_DIR="`pwd`/../mesa"])
gallium_DIR="$mesa_DIR/src/gallium"
- gallium_NONPKGCONFIG_CFLAGS="-I$mesa_DIR/include -I$mesa_DIR/src/mesa -I$gallium_DIR/include -I$gallium_DIR/auxiliary"
- gallium_NONPKGCONFIG_LIBS="-lGL"
+ gallium_NONPKGCONFIG_CFLAGS="-I$mesa_DIR/include -I$mesa_DIR/src/mesa -I$gallium_DIR/include -I$gallium_DIR/auxiliary -I$gallium_DIR"
+ gallium_NONPKGCONFIG_LIBS="-lGL $gallium_DIR/drivers/softpipe/libsoftpipe.a $gallium_DIR/winsys/sw/null/libws_null.a $gallium_DIR/auxiliary/libgallium.a"
AC_SUBST(mesa_DIR)
AC_SUBST(gallium_DIR)
else
diff --git a/src/drm/cairo-drm-gallium-surface.c b/src/drm/cairo-drm-gallium-surface.c
index 24ead1fc..17ba136f 100644
--- a/src/drm/cairo-drm-gallium-surface.c
+++ b/src/drm/cairo-drm-gallium-surface.c
@@ -38,6 +38,8 @@
#include <dlfcn.h>
+#include <drivers/softpipe/sp_public.h>
+#include <winsys/sw/null/null_sw_winsys.h>
#include <state_tracker/drm_api.h>
#include <pipe/p_format.h>
#include <pipe/p_screen.h>
@@ -745,6 +747,7 @@ _cairo_drm_gallium_device_create (int fd, dev_t dev, int vendor_id, int chip_id)
const char *libdir;
char buf[4096];
struct drm_api *(*ctor) (void);
+ cairo_bool_t has_dri_driver = true;
/* XXX need search path + probe */
libdir = getenv ("CAIRO_GALLIUM_LIBDIR");
@@ -753,13 +756,8 @@ _cairo_drm_gallium_device_create (int fd, dev_t dev, int vendor_id, int chip_id)
buf[snprintf (buf, sizeof (buf)-1, "%s/i915_dri.so", libdir)] = '\0';
handle = dlopen (buf, RTLD_LAZY);
- if (handle == NULL)
- return NULL;
-
- ctor = dlsym (handle, "drm_api_create");
- if (ctor == NULL) {
- dlclose (handle);
- return NULL;
+ if (handle == NULL) {
+ has_dri_driver = false;
}
device = malloc (sizeof (gallium_device_t));
@@ -783,13 +781,23 @@ _cairo_drm_gallium_device_create (int fd, dev_t dev, int vendor_id, int chip_id)
device->drm.bo.release = _gallium_fake_bo_release;
- device->api = ctor ();
- if (device->api == NULL) {
- status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
- goto CLEANUP;
- }
+ if (has_dri_driver) {
+ ctor = dlsym (handle, "drm_api_create");
+ if (ctor == NULL) {
+ dlclose (handle);
+ return NULL;
+ }
+
+ device->api = ctor ();
+ if (device->api == NULL) {
+ status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
+ goto CLEANUP;
+ }
- device->screen = device->api->create_screen (device->api, fd);
+ device->screen = device->api->create_screen (device->api, fd);
+ } else{
+ device->screen = softpipe_create_screen(null_sw_create());
+ }
if (device->screen == NULL) {
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
goto CLEANUP_API;