mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-03-23 20:10:36 +01:00
wsi/display: retrieve monitor size from EDID
When libdisplay-info is available and we are able to retrieve the physical size of a display from its EDID, use that to populate the physicalDimensions field of VkDisplayPropertiesKHR. Signed-off-by: Erik Kurzinger <ekurzinger@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39989>
This commit is contained in:
parent
64f2f97fb8
commit
addadd20df
1 changed files with 13 additions and 1 deletions
|
|
@ -166,6 +166,8 @@ typedef struct wsi_display_connector_metadata {
|
|||
VkHdrMetadataEXT hdr_metadata;
|
||||
bool supports_st2084;
|
||||
char *display_name;
|
||||
uint16_t physical_width_cm;
|
||||
uint16_t physical_height_cm;
|
||||
} wsi_display_connector_metadata;
|
||||
|
||||
typedef struct wsi_display_connector {
|
||||
|
|
@ -303,6 +305,10 @@ wsi_display_parse_edid(struct wsi_display_connector *connector, drmModePropertyB
|
|||
free(make);
|
||||
free(model);
|
||||
|
||||
const struct di_edid_screen_size *screen_size = di_edid_get_screen_size(edid);
|
||||
metadata->physical_width_cm = screen_size->width_cm;
|
||||
metadata->physical_height_cm = screen_size->height_cm;
|
||||
|
||||
di_info_destroy(info);
|
||||
#endif
|
||||
}
|
||||
|
|
@ -816,10 +822,16 @@ wsi_display_fill_in_display_properties(struct wsi_display_connector *connector,
|
|||
properties->physicalResolution.height = 768;
|
||||
}
|
||||
|
||||
/* Make up physical size based on 96dpi */
|
||||
/* Use physical size from EDID if available,
|
||||
* otherwise make up physical size based on 96dpi.
|
||||
*/
|
||||
properties->physicalDimensions.width =
|
||||
metadata->physical_width_cm ?
|
||||
metadata->physical_width_cm * 10 :
|
||||
floor(properties->physicalResolution.width * MM_PER_PIXEL + 0.5);
|
||||
properties->physicalDimensions.height =
|
||||
metadata->physical_height_cm ?
|
||||
metadata->physical_height_cm * 10 :
|
||||
floor(properties->physicalResolution.height * MM_PER_PIXEL + 0.5);
|
||||
|
||||
properties->supportedTransforms = VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue