[PATCH weston 08/12 v2] weston: Port Wayland backend to new output handling API
Armin Krezović
krezovic.armin at gmail.com
Thu Aug 18 14:52:33 UTC 2016
On 18.08.2016 12:31, Pekka Paalanen wrote:
> On Wed, 17 Aug 2016 19:49:06 +0200
> Armin Krezović <krezovic.armin at gmail.com> wrote:
>
>> On 17.08.2016 17:07, Pekka Paalanen wrote:
>>> On Sun, 14 Aug 2016 17:28:17 +0200
>>> Armin Krezović <krezovic.armin at gmail.com> wrote:
SNIP
>>>> +static int
>>>> +wayland_output_configure_hotplug(struct weston_output *base)
>>>> +{
>>>> + struct wayland_output *output = to_wayland_output(base);
>>>> + struct wayland_parent_output *poutput = output->user_data;
>>>>
>>>> if (poutput->current_mode) {
>>>> - mode = poutput->current_mode;
>>>> + output->poutput_mode = poutput->current_mode;
>>>> } else if (poutput->preferred_mode) {
>>>> - mode = poutput->preferred_mode;
>>>> + output->poutput_mode = poutput->preferred_mode;
>>>> } else if (!wl_list_empty(&poutput->mode_list)) {
>>>> - mode = container_of(poutput->mode_list.next,
>>>> - struct weston_mode, link);
>>>> - } else {
>>>> - weston_log("No valid modes found. Skipping output\n");
>>>> - return NULL;
>>>> - }
>>>> -
>>>> - if (!wl_list_empty(&b->compositor->output_list)) {
>>>> - output = container_of(b->compositor->output_list.prev,
>>>> - struct wayland_output, base.link);
>>>> - x = output->base.x + output->base.current_mode->width;
>>>> + output->poutput_mode = container_of(poutput->mode_list.next,
>>>> + struct weston_mode, link);
>>>> } else {
>>>> - x = 0;
>>>> + weston_log("No valid modes found. Cannot configure an output.\n");
>>>> + return -1;
>>>> }
>>>>
>>>> - output = wayland_output_create(b, x, 0, mode->width, mode->height,
>>>> - NULL, 0,
>>>> - WL_OUTPUT_TRANSFORM_NORMAL, 1);
>>>> - if (!output)
>>>> - return NULL;
>>>> + if (wayland_output_configure(&output->base, output->poutput_mode->width,
>>>> + output->poutput_mode->height) < 0)
>>>
>>> If wayland_output_configure() multiplies by scale and applies
>>> transformation, then passing mode->width and mode->height directly here
>>> is wrong.
>>>
>>> The "video mode" is given in output pixels, so it is already multiplied
>>> by scale and rotated by transform.
>>>
>>> I see the old code was equally wrong, particularly if the output was
>>> rotated 90 degrees it would create a window with inverted aspect ratio.
>>> Ok, so if this keeps the old broken behaviour, it's fine.
>>>
>>> Testing the upstream x11-backend, it looks like we expect to put the
>>> logical output size (in global coordinates) in weston.ini, and then
>>> expect the scale and transform to be applied on that to get the output
>>> resolution in output pixels.
>>>
>>
>> This is for parent output (fs shell and sprawl). You can't change the size
>> here. Scale and transform are also hardcoded to "scale = 1, transform = WL_OUTPUT_TRANSFORM_NORMAL"
>> (well, they used to be and I let them remain that way).
>>
>> See:
>>
>> https://cgit.freedesktop.org/wayland/weston/tree/libweston/compositor-wayland.c#n1148
>>
>> and:
>>
>> https://github.com/krezovic/weston/blob/gsoc-v10/compositor/main.c#L1545
>>
>> Those values are set just for sake of it, it's not that anything uses them.
>
> Yes, but ideally we might use also the scale and transform from the
> parent output.
>
But, if parent output was transformed, wouldn't that display the surface
just as it should be? Applying transform might further scale/rotate it. If
it were to be used for "show off" (in weston-info, for example), we could
do that. But I doubt we want any additional transformations if parent output
is already transformed.
So, for *_for_parent_output case, I've hardcoded transform and scale values
in the backend, just before calls to wayland_output_set_size().
> Those values are no longer hardcoded in this site here, which makes
> things harder to follow, and wayland_output_configure() does use them.
>
> However, that doesn't really affect this patch. Except maybe needing a
> comment about scale and transform.
>
> Btw. wayland_output_configure() forgets to apply transform, but that's
> how it was already.
>
Backend functions don't do that. It's done in libweston, (current) weston_output_init, rather.
>>>> + return -1;
>>>>
>>>> output->parent.output = poutput->global;
>>>>
>
>
> Thanks,
> pq
>
Cheers.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 855 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20160818/1d1baa99/attachment-0001.sig>
More information about the wayland-devel
mailing list