Commit aac3788d authored by Emil Velikov's avatar Emil Velikov Committed by Christian Gmeiner

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: 's avatarEmil Velikov <emil.velikov@collabora.com>
Reviewed-by: 's avatarChristian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: 's avatarRob Clark <robdclark@gmail.com>
parent 56c3917f
......@@ -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) {
......
......@@ -76,7 +76,7 @@ int main(int argc, char *argv[])
const char *device = "/dev/dri/card0";
const char *video = NULL;
enum mode mode = SMOOTH;
uint64_t modifier = DRM_FORMAT_MOD_INVALID;
uint64_t modifier = DRM_FORMAT_MOD_LINEAR;
int atomic = 0;
int opt;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment