summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/target-helpers
diff options
context:
space:
mode:
authorGiovanni Campagna <[email protected]>2014-07-23 19:37:31 +0100
committerEmil Velikov <[email protected]>2014-07-30 16:33:09 +0100
commit3b176c441b7ddc5f7d2f891da3f76cf3c1814ce1 (patch)
treea99421810f0150b9759363fb56910a160d10ad97 /src/gallium/auxiliary/target-helpers
parent8430af5ebe1ee8119e14ae8fe00ec98fda40c57f (diff)
gallium: Add a dumb drm/kms winsys backed swrast provider
Add a new winsys and target that can be used with a dri2 state tracker and loader instead of drisw. This allows to use gbm as a dri2/image loader and avoid the extra copy from the backbuffer to the shadow frontbuffer. The new driver is called "kms_swrast", and is loaded by gbm as a fallback, because it is only useful with the gbm platform (as no buffer sharing is possible) To force select the driver set the environment variable GBM_ALWAYS_SOFTWARE [Emil Velikov] - Rebase on top of gallium megadriver. - s/text/test/ in configure.ac (Spotted by Andreas Pokorny). - Add scons support for winsys/sw/kms-dri and fix the build. - Provide separate DriverAPI, due to different InitScreen hook. Signed-off-by: Emil Velikov <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/target-helpers')
-rw-r--r--src/gallium/auxiliary/target-helpers/inline_drm_helper.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/target-helpers/inline_drm_helper.h b/src/gallium/auxiliary/target-helpers/inline_drm_helper.h
index 5656ef076cf..751ceb1e70e 100644
--- a/src/gallium/auxiliary/target-helpers/inline_drm_helper.h
+++ b/src/gallium/auxiliary/target-helpers/inline_drm_helper.h
@@ -8,6 +8,11 @@
#include "dri_screen.h"
#endif
+#if GALLIUM_SOFTPIPE
+#include "target-helpers/inline_sw_helper.h"
+#include "sw/kms-dri/kms_dri_sw_winsys.h"
+#endif
+
#if GALLIUM_I915
#include "i915/drm/i915_drm_public.h"
#include "i915/i915_public.h"
@@ -53,6 +58,33 @@ static char* driver_name = NULL;
/* XXX: We need to teardown the winsys if *screen_create() fails. */
+#if defined(GALLIUM_SOFTPIPE)
+#if defined(DRI_TARGET)
+
+const __DRIextension **__driDriverGetExtensions_kms_swrast(void);
+
+PUBLIC const __DRIextension **__driDriverGetExtensions_kms_swrast(void)
+{
+ globalDriverAPI = &dri_kms_driver_api;
+ return galliumdrm_driver_extensions;
+}
+
+struct pipe_screen *
+kms_swrast_create_screen(int fd)
+{
+ struct sw_winsys *sws;
+ struct pipe_screen *screen;
+
+ sws = kms_dri_create_winsys(fd);
+ if (!sws)
+ return NULL;
+
+ screen = sw_screen_create(sws);
+ return screen ? debug_screen_wrap(screen) : NULL;
+}
+#endif
+#endif
+
#if defined(GALLIUM_I915)
#if defined(DRI_TARGET)