[PATCH] fullscreen-shell: Fix modeset on transformed outputs

Jason Ekstrand jason at jlekstrand.net
Thu Jan 8 21:11:11 PST 2015


Hi Imran,
Looking over things some more, it looks like the patch I sent is correct
and so is the DRM backend.  The problem is that weston's wayland backend
isn't handling transformed outputs nicely.  In particular, it doesn't swap
the width and height of the surface.  As far as I can tell, it does nothing
whatsoever with the transform it receives.  It would be good if someone
fixed that.

The real question is how best to handle it.  I think the answer to that is
that we want to just follow the parent compositor's lead and transform the
window the same way it does.  However, this gets tricky if the parent
compositor says an output is transformed by 90 and the child wants it
transformed by 180.  Do you add the transformations?  Just let the client
override?  Lots of interesting questions there.

--Jason Ekstrand

On Thu, Jan 8, 2015 at 1:37 PM, Imran Zaman <imran.zaman at gmail.com> wrote:

> Hi Ekstrand!
>
> I have tested it in nested compositors case; unfortunately it is not
> enough and doesn't work :-)
>
> The reason is that drm compositor (choose_mode) function rejects the mode
> if width and height are swapped so similar patch is needed for choose_mode
> in drm compositor based on transform.
>
> I tested the setup as below..
> - System compositor (drm backend) with weston.ini file containing
> transform=90 for the output.
> - Child compositor (wayland backend)
>
> - child compositor receives e.g. 1920x1080 + transform= 90 info.
> - it creates the surface and DOESN'T do any transformation (other than
> swapping width and height) as it is disabled.
> - then surface is presented to system compositor's fullscreen shell
> - fullscreen shell uses the outputs' data received from system compositor
> when module is initialized and surface data received from child
> compositor which may not be in sync..
> - fullscreen shell then ask system compositor to switch mode
> - system compositor verifies the mode first (if not it fails)
> - then system compositor does the transformation
>
> Hope it gives u some idea to update the patch. I would be eager to test if
> you update the patch :-)
>
> BR
> imran
>
> On Thu, Jan 8, 2015 at 6:57 PM, Jason Ekstrand <jason at jlekstrand.net>
> wrote:
>
>> Previously, we blindly created a mode for the output based on surface size
>> and completely ignoring the output transform.  This caused modesets to
>> fail
>> on outputs that were transformed by 90 or 270 degrees.  We should be
>> swapping the width and the height in this case.
>> ---
>>  fullscreen-shell/fullscreen-shell.c | 23 +++++++++++++++++++++--
>>  1 file changed, 21 insertions(+), 2 deletions(-)
>>
>> diff --git a/fullscreen-shell/fullscreen-shell.c
>> b/fullscreen-shell/fullscreen-shell.c
>> index 35e6d8f..5fd7cd6 100644
>> --- a/fullscreen-shell/fullscreen-shell.c
>> +++ b/fullscreen-shell/fullscreen-shell.c
>> @@ -463,9 +463,28 @@ fs_output_configure_for_mode(struct fs_output *fsout,
>>                                         &surf_x, &surf_y,
>>                                         &surf_width, &surf_height);
>>
>> +       /* The actual output mode is in physical units.  We need to
>> +        * transform the surface size to physical unit size by flipping
>> ans
>> +        * possibly scaling it.
>> +        */
>> +       switch (fsout->output->transform) {
>> +       case WL_OUTPUT_TRANSFORM_90:
>> +       case WL_OUTPUT_TRANSFORM_FLIPPED_90:
>> +       case WL_OUTPUT_TRANSFORM_270:
>> +       case WL_OUTPUT_TRANSFORM_FLIPPED_270:
>> +               mode.width = surf_height * fsout->output->native_scale;
>> +               mode.height = surf_width * fsout->output->native_scale;
>> +               break;
>> +
>> +       case WL_OUTPUT_TRANSFORM_NORMAL:
>> +       case WL_OUTPUT_TRANSFORM_FLIPPED:
>> +       case WL_OUTPUT_TRANSFORM_180:
>> +       case WL_OUTPUT_TRANSFORM_FLIPPED_180:
>> +       default:
>> +               mode.width = surf_width * fsout->output->native_scale;
>> +               mode.height = surf_height * fsout->output->native_scale;
>> +       }
>>         mode.flags = 0;
>> -       mode.width = surf_width * fsout->output->native_scale;
>> -       mode.height = surf_height * fsout->output->native_scale;
>>         mode.refresh = fsout->pending.framerate;
>>
>>         ret = weston_output_mode_switch_to_temporary(fsout->output, &mode,
>> --
>> 2.2.0
>>
>> _______________________________________________
>> wayland-devel mailing list
>> wayland-devel at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20150108/63df9576/attachment.html>


More information about the wayland-devel mailing list