summaryrefslogtreecommitdiff
path: root/common.c
diff options
context:
space:
mode:
authorEmil Velikov <emil.velikov@collabora.com>2018-03-30 15:17:10 +0100
committerChristian Gmeiner <christian.gmeiner@gmail.com>2018-04-02 13:55:52 +0200
commitaac3788d2844872a0b66eb2994f773e13326d642 (patch)
tree1454ead69d8922c1e0b97bd01b993c0e67f8328d /common.c
parent56c3917ffd1f05942246e2532ca4a5707554a2fc (diff)
downloadkmscube-aac3788d2844872a0b66eb2994f773e13326d642.tar.gz
Rework default modifier handling
Currently the default modifier is MOD_INVALID. At a later stage, if the modifier is the same (the user may have explicit selected MOD_INVALID), we'll fallback to MOD_LINEAR. Simplify things to a) use MOD_LINEAR by default b) use the user modifier - even if they request MOD_INVALID. Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com> Reviewed-by: Rob Clark <robdclark@gmail.com>
Diffstat (limited to 'common.c')
-rw-r--r--common.c23
1 files changed, 2 insertions, 21 deletions
diff --git a/common.c b/common.c
index a092cdb..332e3e9 100644
--- a/common.c
+++ b/common.c
@@ -33,24 +33,13 @@
static struct gbm gbm;
-#ifdef HAVE_GBM_MODIFIERS
-static int
-get_modifiers(uint64_t **mods)
-{
- /* Assumed LINEAR is supported everywhere */
- static uint64_t modifiers[] = {DRM_FORMAT_MOD_LINEAR};
- *mods = modifiers;
- return 1;
-}
-#endif
-
const struct gbm * init_gbm(int drm_fd, int w, int h, uint64_t modifier)
{
gbm.dev = gbm_create_device(drm_fd);
gbm.format = GBM_FORMAT_XRGB8888;
#ifndef HAVE_GBM_MODIFIERS
- if (modifier != DRM_FORMAT_MOD_INVALID) {
+ if (modifier != DRM_FORMAT_MOD_LINEAR) {
fprintf(stderr, "Modifiers requested but support isn't available\n");
return NULL;
}
@@ -58,16 +47,8 @@ const struct gbm * init_gbm(int drm_fd, int w, int h, uint64_t modifier)
gbm.format,
GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING);
#else
- uint64_t *mods;
- int count;
- if (modifier != DRM_FORMAT_MOD_INVALID) {
- count = 1;
- mods = &modifier;
- } else {
- count = get_modifiers(&mods);
- }
gbm.surface = gbm_surface_create_with_modifiers(gbm.dev, w, h,
- gbm.format, mods, count);
+ gbm.format, &modifier, 1);
#endif
if (!gbm.surface) {