summaryrefslogtreecommitdiffstats
path: root/src/gbm/backends
diff options
context:
space:
mode:
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)