[PATCH] compositor: allow query of surface formats.

Gwenole Beauchesne gb.devel at gmail.com
Wed May 2 22:05:40 PDT 2012


Hi,

2012/5/2 Pekka Paalanen <ppaalanen at gmail.com>:
> On Fri, 27 Apr 2012 17:52:11 +0200
>> Add new query to collect surface formats supported for rendering through
>> surface_format events. This allows for checking whether the compositor
>> supports rendering YUV buffers for example.
>>
>> Note: this depends on the generic wl_buffer formats patch series. Is there
>> a way to let the server fill in a wl_array instead? I am not sure this model
>> that implies querying the server, iterate, and listen back for events is
>> viable.
>
> yeah, this smells like a roundtrip to me. Can't you do it the same way
> as e.g. wl_shm announces the supported formats?

Both wl_shm and wl_drm already announce supported formats but that
does not tell anything about the compositor's capabilities.

> I would still recommend thinking about adding the formats to the buffer
> factory objects (wl_shm, wl_drm) like the existing ones. We are trying
> hard to avoid the "X Visuals" disaster, but I must confess, I'm not
> exactly sure what that was in the first place.

I am sorry but defining formats in different factory objects like
wl_shm, wl_drm is... a total mess. Both client side, and Weston side.
You can't want a unique and generic EGL buffer type
(EGL_WAYLAND_BUFFER_WL) and no generic way to expose formats et al.
That's not logical. Otherwise, we could just split off compositor.c
rendering functions into the backends, where we could peek into wl_drm
internals for example and use MESA_drm_image appropriately. This is
still bad because (i) you are bound to duplicating code in the first
place, (ii) there is still no way to communicate the formats Weston
supports to the outside.

Regards,
Gwenole.

>>  protocol/wayland.xml |   17 +++++++++++++++++
>>  1 files changed, 17 insertions(+), 0 deletions(-)
>>
>> diff --git a/protocol/wayland.xml b/protocol/wayland.xml
>> index 15260f5..a09cb30 100644
>> --- a/protocol/wayland.xml
>> +++ b/protocol/wayland.xml
>> @@ -133,6 +133,23 @@
>>        </description>
>>        <arg name="id" type="new_id" interface="wl_region"/>
>>      </request>
>> +
>> +    <request name="query_surface_formats">
>> +      <description summary="query surface formats">
>> +        Ask the compositor to return the list of surface formats
>> +        supported for rendering as several surface_format events.
>> +      </description>
>> +    </request>
>> +
>> +    <event name="surface_format">
>> +      <description summary="surface format">
>> +        Sent as a result of the query_surface_formats() request.
>> +        This corresponds to a supported wl_buffer format for
>> +        rendering.
>> +      </description>
>> +      <arg name="format" type="uint"
>> +           summary="a wl_buffer_format"/>
>> +    </event>
>>    </interface>
>>
>>    <interface name="wl_shm_pool" version="1">
>


More information about the wayland-devel mailing list