diff options
author | Simon Ser <contact@emersion.fr> | 2022-09-05 16:56:47 +0200 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2022-09-22 09:38:27 +0200 |
commit | 0cabc83046474618b9ed619649b819dc7ef23d28 (patch) | |
tree | fb6126e68ea7b75b2cc96e0015caffb38e96f15e /backend/drm/util.c | |
parent | 2178573b0a5a8160564da1fd85c1f16f7d4d7bdd (diff) |
backend/drm: pass through mode picture aspect ratio
Diffstat (limited to 'backend/drm/util.c')
-rw-r--r-- | backend/drm/util.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/backend/drm/util.c b/backend/drm/util.c index 2083e617..3f460317 100644 --- a/backend/drm/util.c +++ b/backend/drm/util.c @@ -30,6 +30,25 @@ int32_t calculate_refresh_rate(const drmModeModeInfo *mode) { return refresh; } +enum wlr_output_mode_aspect_ratio get_picture_aspect_ratio(const drmModeModeInfo *mode) { + switch (mode->flags & DRM_MODE_FLAG_PIC_AR_MASK) { + case DRM_MODE_FLAG_PIC_AR_NONE: + return WLR_OUTPUT_MODE_ASPECT_RATIO_NONE; + case DRM_MODE_FLAG_PIC_AR_4_3: + return WLR_OUTPUT_MODE_ASPECT_RATIO_4_3; + case DRM_MODE_FLAG_PIC_AR_16_9: + return WLR_OUTPUT_MODE_ASPECT_RATIO_16_9; + case DRM_MODE_FLAG_PIC_AR_64_27: + return WLR_OUTPUT_MODE_ASPECT_RATIO_64_27; + case DRM_MODE_FLAG_PIC_AR_256_135: + return WLR_OUTPUT_MODE_ASPECT_RATIO_256_135; + default: + wlr_log(WLR_ERROR, "Unknown mode picture aspect ratio: %u", + mode->flags & DRM_MODE_FLAG_PIC_AR_MASK); + return WLR_OUTPUT_MODE_ASPECT_RATIO_NONE; + } +} + static const char *get_manufacturer(struct udev_hwdb *hwdb, uint16_t code) { static char pnp_id[4]; |