mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-07 05:55:58 +01:00
backend/drm: pass through mode picture aspect ratio
This commit is contained in:
parent
2178573b0a
commit
0cabc83046
3 changed files with 21 additions and 0 deletions
|
@ -760,6 +760,7 @@ static struct wlr_drm_mode *drm_mode_create(const drmModeModeInfo *modeinfo) {
|
|||
mode->wlr_mode.width = mode->drm_mode.hdisplay;
|
||||
mode->wlr_mode.height = mode->drm_mode.vdisplay;
|
||||
mode->wlr_mode.refresh = calculate_refresh_rate(modeinfo);
|
||||
mode->wlr_mode.picture_aspect_ratio = get_picture_aspect_ratio(modeinfo);
|
||||
if (modeinfo->type & DRM_MODE_TYPE_PREFERRED) {
|
||||
mode->wlr_mode.preferred = true;
|
||||
}
|
||||
|
|
|
@ -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];
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ struct wlr_drm_connector;
|
|||
|
||||
// Calculates a more accurate refresh rate (mHz) than what mode itself provides
|
||||
int32_t calculate_refresh_rate(const drmModeModeInfo *mode);
|
||||
enum wlr_output_mode_aspect_ratio get_picture_aspect_ratio(const drmModeModeInfo *mode);
|
||||
// Populates the make/model/phys_{width,height} of output from the edid data
|
||||
void parse_edid(struct wlr_drm_connector *conn, size_t len, const uint8_t *data);
|
||||
|
||||
|
|
Loading…
Reference in a new issue