Commit e5fb5659 authored by Ben Widawsky's avatar Ben Widawsky

common: Use the create with modifiers interface

Signed-off-by: 's avatarBen Widawsky <ben@bwidawsk.net>
Reviewed-by: 's avatarEmil Velikov <emil.velikov@collabora.com>
parent 1d57afe6
...@@ -31,10 +31,26 @@ ...@@ -31,10 +31,26 @@
static struct gbm gbm; static struct gbm gbm;
#ifndef DRM_FORMAT_MOD_LINEAR
#define DRM_FORMAT_MOD_LINEAR 0
#endif
#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) const struct gbm * init_gbm(int drm_fd, int w, int h)
{ {
gbm.dev = gbm_create_device(drm_fd); gbm.dev = gbm_create_device(drm_fd);
#ifndef HAVE_GBM_MODIFIERS
gbm.surface = gbm_surface_create(gbm.dev, w, h, gbm.surface = gbm_surface_create(gbm.dev, w, h,
GBM_FORMAT_XRGB8888, GBM_FORMAT_XRGB8888,
GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING); GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING);
...@@ -42,6 +58,12 @@ const struct gbm * init_gbm(int drm_fd, int w, int h) ...@@ -42,6 +58,12 @@ const struct gbm * init_gbm(int drm_fd, int w, int h)
printf("failed to create gbm surface\n"); printf("failed to create gbm surface\n");
return NULL; return NULL;
} }
#else
uint64_t *mods;
int count = get_modifiers(&mods);
gbm.surface = gbm_surface_create_with_modifiers(gbm.dev, w, h,
GBM_FORMAT_XRGB8888, mods, count);
#endif
gbm.width = w; gbm.width = w;
gbm.height = h; gbm.height = h;
......
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