[PATCH] Bug fix client apps because of output change

Pekka Paalanen ppaalanen at gmail.com
Tue Mar 11 01:33:23 PDT 2014


On Tue, 11 Mar 2014 01:40:18 +0000
"Wang, Quanxian" <quanxian.wang at intel.com> wrote:

> 
> 
> >-----Original Message-----
> >From: Pekka Paalanen [mailto:ppaalanen at gmail.com]
> >Sent: Monday, March 10, 2014 7:05 PM
> >To: Wang, Quanxian
> >Cc: wayland-devel at lists.freedesktop.org
> >Subject: Re: [PATCH] Bug fix client apps because of output change
> >
> >On Mon, 10 Mar 2014 10:58:00 +0000
> >"Wang, Quanxian" <quanxian.wang at intel.com> wrote:
> >
> >>
> >>
> >> >-----Original Message-----
> >> >From: Pekka Paalanen [mailto:ppaalanen at gmail.com]
> >> >Sent: Monday, March 10, 2014 5:58 PM
> >> >To: Wang, Quanxian
> >> >Cc: wayland-devel at lists.freedesktop.org
> >> >Subject: Re: [PATCH] Bug fix client apps because of output change
> >> >
> >> >On Mon, 10 Mar 2014 08:23:45 +0000
> >> >"Wang, Quanxian" <quanxian.wang at intel.com> wrote:
> >> >
> >> >> Thanks Pq. Comments below.
> >> >...
> >> >> >> @@ -1145,6 +1154,45 @@ desktop_destroy_outputs(struct desktop
> >> >> >> *desktop) }
> >> >> >>
> >> >> >>  static void
> >> >> >> +update_output(struct output *output) {
> >> >> >> +	struct panel *panel = output->panel;
> >> >> >> +	struct background *background = output->background;
> >> >> >> +	int width, height;
> >> >> >> +
> >> >> >> +	if (!output)
> >> >> >
> >> >> >You already dereferenced 'output' above, checking for NULL here is
> >> >> >useless. 'output' can never be NULL anyway, right?
> >> >> [Wang, Quanxian] right.
> >> >> >
> >> >> >> +		return;
> >> >> >> +
> >> >> >> +	width = output->mode.width;
> >> >> >> +	height = output->mode.height;
> >> >> >> +
> >> >> >> +	switch (output->transform) {
> >> >> >> +	case WL_OUTPUT_TRANSFORM_90:
> >> >> >> +	case WL_OUTPUT_TRANSFORM_270:
> >> >> >> +	case WL_OUTPUT_TRANSFORM_FLIPPED_90:
> >> >> >> +	case WL_OUTPUT_TRANSFORM_FLIPPED_270:
> >> >> >> +		/* Swap width and height */
> >> >> >> +		width = output->mode.height;
> >> >> >> +		height = output->mode.width;
> >> >> >> +		break;
> >> >> >> +	default:
> >> >> >> +		break;
> >> >> >> +	}
> >> >> >> +
> >> >> >> +	if (output->scale != 0) {
> >> >> >
> >> >> >If scale was initialized to 1, there would be no need for 'if'.
> >> >> >Right?
> >> >> [Wang, Quanxian] in testing, this cause the error because scale is
> >> >> set to 0, it happens when weston is started at the very beginning.
> >> >> Here we need to do that.
> >> >
> >> >Why does that happen? Is Weston sending an event with scale=0? If so,
> >> >then that is a Weston bug and should be fixed. Until you get any
> >> >event the scale is 1, because that is the implicit scale in interface version 1.
> >> [Wang, Quanxian] yes. Got geometry event with scale=0.
> >
> >What do you mean? wl_output.geometry does not carry scale at all, hence until
> >you receive the first wl_output.scale you should assume scale=1.
> >The easiest way to do that is to initialize output::scale to 1 in create_output(). You
> >should never have zero.
> [Wang, Quanxian] sorry, is scale event instead of geometry. Yes, I can initialize scale to be 1, but at the same time, I need to get the scale event from server. Basically I still need to do some checking for that.
> 

You cannot require receiving the scale event, because the
protocol specification says:

        This event contains scaling geometry information
        that is not in the geometry event. It may be sent after
        binding the output object or if the output scale changes
        later. If it is not sent, the client should assume a
        scale of 1.

However, if wl_output agreed interface version is at least 2, then you
are guaranteed to receive the done event when you have received all
output property events.

> After that, I will check why scale(0) is sent by wl_output and push the patch to fix that. 

I suspect it doesn't really happen, but if it does, it is a bug in the
compositor, yes.


Thanks,
pq


More information about the wayland-devel mailing list