egl/wayland-drm: Only announce formats via wl_drm which the driver supports.
authorMario Kleiner <mario.kleiner.de@gmail.com>
Wed, 13 Jun 2018 04:04:15 +0000 (06:04 +0200)
committerAdam Jackson <ajax@nwnk.net>
Tue, 29 Jan 2019 20:03:20 +0000 (20:03 +0000)
commit820dfcea431e4f96f25e6b340edd9cd1e449158b
tree1964b1200cc3fb9b8e99305011187d175ae250ca
parenta34b0d68bbf8571e4d858cf4e1176766a50364de
egl/wayland-drm: Only announce formats via wl_drm which the driver supports.

Check if a pixel format is supported by the Wayland servers gpu driver
before exposing it to the client via wl_drm, so we avoid reporting formats
to the client which the server gpu can't handle.

Restrict this reporting to the new color depth 30 formats for now, as the
ARGB/XRGB8888 and RGB565 formats are probably supported by every gpu under
the sun.

Atm. this is mostly useful to allow proper PRIME renderoffload for depth
30 formats on the typical Intel iGPU + NVidia dGPU "NVidia Optimus" laptop
combo.

Tested on Intel, AMD, NVidia with single-gpu setup and on a Intel + NVidia
Optimus setup.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
src/egl/drivers/dri2/egl_dri2.c
src/egl/drivers/dri2/egl_dri2.h
src/egl/drivers/dri2/platform_wayland.c
src/egl/wayland/wayland-drm/wayland-drm.c
src/egl/wayland/wayland-drm/wayland-drm.h