[Mesa-dev] [PATCH kmscube 1/2] Rework default modifier handling
Emil Velikov
emil.l.velikov at gmail.com
Fri Mar 30 14:17:10 UTC 2018
From: Emil Velikov <emil.velikov at collabora.com>
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 at collabora.com>
---
common.c | 23 ++---------------------
kmscube.c | 2 +-
2 files changed, 3 insertions(+), 22 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) {
diff --git a/kmscube.c b/kmscube.c
index 3a2c4dd..87a4205 100644
--- a/kmscube.c
+++ b/kmscube.c
@@ -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;
--
2.16.0
More information about the mesa-dev
mailing list