backend-drm: Use aspect-ratio bit definitions from libdrm

When the aspect-ratio-aware mode support was added to Weston, it was
done before the libdrm support was finalised and merged. Between it
being added to Weston and being merged, it changed to no longer provide
the offset for the bitmask.

Instead of using the mask and a compatible enum, if we update our
libdrm dependency, we can use the flag definitions directly from libdrm.

In 94e4068ba1, the libdrm dependency was bumped to 2.4.83, which
enabled us to remove a bunch of error-prone ifdefs by making atomic and
modifier support mandatory.

We determined in the discussion of !311 that it was safe to push the
dependency as high as 2.4.91, as that was what was available in major
distributions.

Bumping to 2.4.86 allows us to safely remove the ifdef and go with
upstream flags, as that was added in mesa/drm@0d889201d1.

Signed-off-by: Daniel Stone <daniels@collabora.com>
This commit is contained in:
Daniel Stone 2019-11-26 10:48:12 +00:00
parent 0f6bd69752
commit 6093772f45
3 changed files with 14 additions and 12 deletions

View file

@ -114,15 +114,6 @@
#define MAX_CLONED_CONNECTORS 4
/**
* aspect ratio info taken from the drmModeModeInfo flag bits 19-22,
* which should be used to fill the aspect ratio field in weston_mode.
*/
#define DRM_MODE_FLAG_PIC_AR_BITS_POS 19
#ifndef DRM_MODE_FLAG_PIC_AR_MASK
#define DRM_MODE_FLAG_PIC_AR_MASK (0xF << DRM_MODE_FLAG_PIC_AR_BITS_POS)
#endif
/**
* Represents the values of an enum-type KMS property
*/

View file

@ -52,8 +52,19 @@ static const char *const aspect_ratio_as_string[] = {
static enum weston_mode_aspect_ratio
drm_to_weston_mode_aspect_ratio(uint32_t drm_mode_flags)
{
return (drm_mode_flags & DRM_MODE_FLAG_PIC_AR_MASK) >>
DRM_MODE_FLAG_PIC_AR_BITS_POS;
switch (drm_mode_flags & DRM_MODE_FLAG_PIC_AR_MASK) {
case DRM_MODE_FLAG_PIC_AR_4_3:
return WESTON_MODE_PIC_AR_4_3;
case DRM_MODE_FLAG_PIC_AR_16_9:
return WESTON_MODE_PIC_AR_16_9;
case DRM_MODE_FLAG_PIC_AR_64_27:
return WESTON_MODE_PIC_AR_64_27;
case DRM_MODE_FLAG_PIC_AR_256_135:
return WESTON_MODE_PIC_AR_256_135;
case DRM_MODE_FLAG_PIC_AR_NONE:
default:
return WESTON_MODE_PIC_AR_NONE;
}
}
static const char *

View file

@ -139,7 +139,7 @@ dep_libinput = dependency('libinput', version: '>= 0.8.0')
dep_libevdev = dependency('libevdev')
dep_libm = cc.find_library('m')
dep_libdl = cc.find_library('dl')
dep_libdrm = dependency('libdrm', version: '>= 2.4.83')
dep_libdrm = dependency('libdrm', version: '>= 2.4.86')
dep_libdrm_headers = dep_libdrm.partial_dependency(compile_args: true)
dep_threads = dependency('threads')