aboutsummaryrefslogtreecommitdiffstats
path: root/src/gbm/backends
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/gbm/backends
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/gbm/backends')
-rw-r--r--src/gbm/backends/dri/gbm_dri.c38
1 files changed, 34 insertions, 4 deletions
diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
index 7b28be1ba0f..258e8a84a6e 100644
--- a/src/gbm/backends/dri/gbm_dri.c
+++ b/src/gbm/backends/dri/gbm_dri.c
@@ -403,12 +403,13 @@ dri_load_driver_swrast(struct gbm_dri_device *dri)
}
static int
-dri_screen_create(struct gbm_dri_device *dri)
+dri_screen_create_dri2(struct gbm_dri_device *dri,
+ const char *driver_name)
{
const __DRIextension **extensions;
int ret = 0;
- dri->base.driver_name = loader_get_driver_for_fd(dri->base.base.fd, 0);
+ dri->base.driver_name = driver_name;
if (dri->base.driver_name == NULL)
return -1;
@@ -491,6 +492,35 @@ dri_screen_create_swrast(struct gbm_dri_device *dri)
}
static int
+dri_screen_create(struct gbm_dri_device *dri)
+{
+ const char *driver_name;
+
+ driver_name = loader_get_driver_for_fd(dri->base.base.fd, 0);
+ if (!driver_name)
+ return -1;
+
+ return dri_screen_create_dri2(dri, driver_name);
+}
+
+static int
+dri_screen_create_sw(struct gbm_dri_device *dri)
+{
+ const char *driver_name;
+ int ret;
+
+ driver_name = strdup("kms_swrast");
+ if (!driver_name)
+ return -errno;
+
+ ret = dri_screen_create_dri2(dri, driver_name);
+ if (ret == 0)
+ return ret;
+
+ return dri_screen_create_swrast(dri);
+}
+
+static int
gbm_dri_is_format_supported(struct gbm_device *gbm,
uint32_t format,
uint32_t usage)
@@ -920,9 +950,9 @@ dri_device_create(int fd)
if (!force_sw) {
ret = dri_screen_create(dri);
if (ret)
- ret = dri_screen_create_swrast(dri);
+ ret = dri_screen_create_sw(dri);
} else {
- ret = dri_screen_create_swrast(dri);
+ ret = dri_screen_create_sw(dri);
}
if (ret)