aboutsummaryrefslogtreecommitdiffstats
path: root/src/gbm/backends
diff options
context:
space:
mode:
authorDaniel Stone <[email protected]>2017-06-16 14:19:40 +0100
committerDaniel Stone <[email protected]>2017-07-18 22:16:20 +0100
commit7ac09e0c5511c1d2f622ab7271e33f6fe8c27841 (patch)
treeb95df6174dd9f793aa6a05aaa24af9aa0a285b8c /src/gbm/backends
parent2ede8943848b139afca7ac281df4c3e982e73b33 (diff)
gbm: Check harder for supported formats
Luckily no-one really used the is_format_supported() call, because it only supported three formats. Also, since buffers with alpha can be displayed on planes, stop banning them from use. Reviewed-by: Emil Velikov <[email protected]>
Diffstat (limited to 'src/gbm/backends')
-rw-r--r--src/gbm/backends/dri/gbm_dri.c41
1 files changed, 26 insertions, 15 deletions
diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
index dab7ce0e092..e50ce04c863 100644
--- a/src/gbm/backends/dri/gbm_dri.c
+++ b/src/gbm/backends/dri/gbm_dri.c
@@ -600,31 +600,42 @@ gbm_dri_to_gbm_format(int dri_format)
return 0;
}
-
static int
gbm_dri_is_format_supported(struct gbm_device *gbm,
uint32_t format,
uint32_t usage)
{
- switch (format) {
- case GBM_BO_FORMAT_XRGB8888:
- case GBM_FORMAT_XBGR8888:
- case GBM_FORMAT_XRGB8888:
- break;
- case GBM_BO_FORMAT_ARGB8888:
- case GBM_FORMAT_ARGB8888:
- if (usage & GBM_BO_USE_SCANOUT)
- return 0;
- break;
- default:
+ struct gbm_dri_device *dri = gbm_dri_device(gbm);
+ int count;
+
+ if ((usage & GBM_BO_USE_CURSOR) && (usage & GBM_BO_USE_RENDERING))
+ return 0;
+
+ format = gbm_format_canonicalize(format);
+ if (gbm_format_to_dri_format(format) == 0)
return 0;
+
+ /* If there is no query, fall back to the small table which was originally
+ * here. */
+ if (dri->image->base.version <= 15 || !dri->image->queryDmaBufModifiers) {
+ switch (format) {
+ case GBM_FORMAT_XRGB8888:
+ case GBM_FORMAT_ARGB8888:
+ case GBM_FORMAT_XBGR8888:
+ return 1;
+ default:
+ return 0;
+ }
}
- if (usage & GBM_BO_USE_CURSOR &&
- usage & GBM_BO_USE_RENDERING)
+ /* Check if the driver returns any modifiers for this format; since linear
+ * is counted as a modifier, we will have at least one modifier for any
+ * supported format. */
+ if (!dri->image->queryDmaBufModifiers(dri->screen, format, 0, NULL, NULL,
+ &count))
return 0;
- return 1;
+ return (count > 0);
}
static int