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

Guido Günther agx at sigxcpu.org
Fri Mar 16 12:18:42 UTC 2018


On Fri, Mar 16, 2018 at 01:55:41PM +0200, Pekka Paalanen wrote:
> 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?

I had that first but then decided to use OPT_* so we can do other stuff
like changing buffer content via options later on. We could also fold
--import-immediate/is_immediate into that.

> > @@ -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()? :-)

Can do. Just let me know if the above OPT_ is o.k. (in this case it
would be a follow up).
Cheers,
 -- Guido


More information about the wayland-devel mailing list