On Thu, 15 Mar 2018 17:34:55 +0100
Guido Günther <[email protected]> wrote:

> This allows to check if ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_Y_INVERT is
> interpreted correctly by the compositor.
> ---
>  clients/simple-dmabuf-drm.c | 31 +++++++++++++++++++++++--------
>  1 file changed, 23 insertions(+), 8 deletions(-)
> 
> diff --git a/clients/simple-dmabuf-drm.c b/clients/simple-dmabuf-drm.c
> index 14d716de..a6e8d870 100644
> --- a/clients/simple-dmabuf-drm.c
> +++ b/clients/simple-dmabuf-drm.c
> @@ -59,6 +59,10 @@
>  extern const unsigned nv12_tiled[];
>  struct buffer;
>  
> +/* Possible options that affect the displayed image */
> +#define OPT_Y_INVERTED 1

Hi,

why not use ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_Y_INVERT directly?


> @@ -852,22 +860,29 @@ main(int argc, char **argv)
>       struct display *display;
>       struct window *window;
>       int is_immediate = 0;
> +     int opts = 0;
>       int import_format = DRM_FORMAT_XRGB8888;
>       int ret = 0, i = 0;
>  
>       if (argc > 1) {
>               static const char import_mode[] = "--import-immediate=";
>               static const char format[] = "--import-format=";
> +             static const char y_inverted[] = "--y-inverted=";
>               for (i = 1; i < argc; i++) {
>                       if (!strncmp(argv[i], import_mode,
>                                    sizeof(import_mode) - 1)) {
> -                             is_immediate = is_import_mode_immediate(argv[i]
> +                             is_immediate = is_true(argv[i]
>                                                       + sizeof(import_mode) - 
> 1);
>                       }
>                       else if (!strncmp(argv[i], format, sizeof(format) - 1)) 
> {
>                               import_format = parse_import_format(argv[i]
>                                                       + sizeof(format) - 1);
>                       }
> +                     else if (!strncmp(argv[i], y_inverted,
> +                                       sizeof(y_inverted) - 1)) {
> +                             if (is_true(argv[i] + sizeof(y_inverted) - 1))
> +                                     opts |= OPT_Y_INVERTED;
> +                     }

Could I persuade you to change this all to use getopt_long()? :-)


Thanks,
pq

>                       else {
>                               print_usage_and_exit();
>                       }
> @@ -875,7 +890,7 @@ main(int argc, char **argv)
>       }
>  
>       display = create_display(is_immediate, import_format);
> -     window = create_window(display, 256, 256, import_format);
> +     window = create_window(display, 256, 256, import_format, opts);
>       if (!window)
>               return 1;
>  

Attachment: pgp5vv_U9pACV.pgp
Description: OpenPGP digital signature

_______________________________________________
wayland-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to