[Mesa-dev] [PATCH kmscube 6/6] common: Give cmdline parameter for forcing modifiers

Emil Velikov emil.l.velikov at gmail.com
Fri Apr 14 17:36:40 UTC 2017


On 13 April 2017 at 19:22, Ben Widawsky <ben at bwidawsk.net> wrote:
> ---
>  common.c  | 13 ++++++++-----
>  common.h  | 11 ++++++++++-
>  kmscube.c | 14 +++++++++++---
>  3 files changed, 29 insertions(+), 9 deletions(-)
>
> diff --git a/common.c b/common.c
> index e63bb39..eaaa9a4 100644
> --- a/common.c
> +++ b/common.c
> @@ -31,9 +31,6 @@
>
>  static struct gbm gbm;
>
> -#ifndef DRM_FORMAT_MOD_LINEAR
> -#define DRM_FORMAT_MOD_LINEAR 0
> -#endif
>  static int
>  get_modifiers(uint64_t **mods)
>  {
> @@ -43,7 +40,7 @@ get_modifiers(uint64_t **mods)
>         return 1;
>  }
>
> -const struct gbm * init_gbm(int drm_fd, int w, int h)
> +const struct gbm * init_gbm(int drm_fd, int w, int h, uint64_t modifier)
>  {
>         gbm.dev = gbm_create_device(drm_fd);
>
> @@ -57,7 +54,13 @@ const struct gbm * init_gbm(int drm_fd, int w, int h)
>         }
>  #else
>         uint64_t *mods;
> -       int count = get_modifiers(&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_XRGB8888, mods, count);
>  #endif
> diff --git a/common.h b/common.h
> index f3d9d32..03634cc 100644
> --- a/common.h
> +++ b/common.h
> @@ -36,6 +36,14 @@
>    #include "config.h"
>  #endif
>
> +#ifndef DRM_FORMAT_MOD_LINEAR
> +#define DRM_FORMAT_MOD_LINEAR 0
> +#endif
> +
> +#ifndef DRM_FORMAT_MOD_INVALID
> +#define DRM_FORMAT_MOD_INVALID ((((__u64)0) << 56) | ((1ULL << 56) - 1))
> +#endif
> +
>  #ifndef EGL_KHR_platform_gbm
>  #define EGL_KHR_platform_gbm 1
>  #define EGL_PLATFORM_GBM_KHR              0x31D7
> @@ -57,9 +65,10 @@ struct gbm {
>         struct gbm_device *dev;
>         struct gbm_surface *surface;
>         int width, height;
> +       uint64_t forced_modifier;
Seems used. Drop for now?

With my trivial suggestions the series is
Reviewed-by: Emil Velikov <emil.velikov at collabora.com>

-Emil


More information about the mesa-dev mailing list