xserver/hw/xfree86/drivers/modesetting
Mario Kleiner e29d783278 modesetting: Only use modifiers on kms drivers which do support them.
Use the DRM_CAP_ADDFB2_MODIFIERS query to make sure the kms
driver supports modifiers in the addfb2 ioctl, and fall back
to addfb ioctl without modifiers if modifiers are unsupported.

E.g., as of Linux 4.17, nouveau-kms so far does not suppport
modifiers and gets angry if drmModeAddFB2WithModifiers() is
called (-> failure to set a video mode -> blank screen), but
Mesa's nvc0+ gallium driver causes gbm_bo_get_modifier() to
return a valid modifier by translating the default tiling of
bo's created via gbm_bo_create() into a modifier other than
DRM_FORMAT_MOD_INVALID (see Mesa's nvc0_miptree_get_modifier()).

Testing for != DRM_FORMAT_MOD_INVALID is apparently not
sufficient for safe use of drmModeAddFB2WithModifiers.

Bonus: Handle potential failure of populate_format_modifiers().

The required DRM_CAP is defined since libdrm v2.4.65, and we
require v2.4.89+ for the server, so we can use it unconditionally.

Tested on intel-kms, radeon-kms, nouveau-kms. Fixes failure on
NVidia Pascal.

Fixes: 2f807c2324 ("modesetting: Add support for multi-plane pixmaps when page-flipping")
Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Cc: Daniel Stone <daniels@collabora.com>
Cc: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Reviewed-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
2018-04-23 14:05:43 -04:00
..
Makefile.am shadow: Lift 32->24 conversion from modesetting to dix 2016-12-12 14:10:44 -05:00
dri2.c modesetting: Fix inverted check in dri2 WaitMSC 2018-04-17 10:26:25 -04:00
driver.c modesetting: Only use modifiers on kms drivers which do support them. 2018-04-23 14:05:43 -04:00
driver.h modesetting: Only use modifiers on kms drivers which do support them. 2018-04-23 14:05:43 -04:00
drmmode_display.c modesetting: Only use modifiers on kms drivers which do support them. 2018-04-23 14:05:43 -04:00
drmmode_display.h modesetting: Have consistent state when using atomic modesetting 2018-04-04 14:01:51 -04:00
dumb_bo.c modesetting: Include dix-config.h from dumb_bo.c 2015-05-12 08:02:11 -07:00
dumb_bo.h modesetting: Drop dumb_bo::map_count field and dead unmap code. 2014-12-11 11:26:19 -08:00
meson.build meson: Install man pages 2018-03-27 10:28:33 -04:00
modesetting.man man: s/__/@/g 2018-03-27 10:13:17 -04:00
pageflip.c modesetting: Use atomic modesetting to set DPMS mode 2018-04-04 14:01:48 -04:00
present.c modesetting: Fix up some XXX from removing GLAMOR_HAS_DRM_* 2018-03-22 15:00:06 -04:00
vblank.c modesetting: remove always true DRM_IOCTL_CRTC_QUEUE_SEQUENCE guard 2018-03-21 10:06:18 -04:00