[PATCH weston v2 1/1] Allow simple-dmabuf-drm to pass y_inverted flag

Pekka Paalanen ppaalanen at gmail.com
Fri Mar 16 11:55:41 UTC 2018


On Thu, 15 Mar 2018 17:34:55 +0100
Guido Günther <agx at sigxcpu.org> 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;
>  

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20180316/b911d307/attachment-0001.sig>


More information about the wayland-devel mailing list