libweston: add weston_head_get_display_info()

This new public API is intended to deliver EDID etc. information to the
frontend. The use case here is display colorimetry, to help the frontend
craft output image descriptions (color profiles).

The frontend will need to link to and use libdisplay-info to make use of
this. This avoids having to replicate in libweston the high-level API
that libdisplay-info already has. The libdisplay-info API is also likely
to be extended, and it is not nice to play catch-up with it.

As a di_info can only be destroyed by calling into libdisplay-info,
libweston core can only ensure it has already been freed. There is not
enough reason to make libweston core depend on libdisplay-info, only the
DRM-backend is.

It will be up to DRM-backend to ensure display_info is updated and
device_changed is set only when necessary.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This commit is contained in:
Pekka Paalanen 2023-08-29 15:40:37 +03:00 committed by Daniel Stone
parent 85593d2e4a
commit 39b577e3a6
2 changed files with 25 additions and 0 deletions

View File

@ -92,6 +92,7 @@ struct pixel_format_info;
struct weston_output_capture_info;
struct weston_output_color_outcome;
struct weston_tearing_control;
struct di_info;
enum weston_keyboard_modifier {
MODIFIER_CTRL = (1 << 0),
@ -505,6 +506,7 @@ struct weston_head {
bool non_desktop; /**< non-desktop display, e.g. HMD */
uint32_t supported_eotf_mask; /**< supported weston_eotf_mode bits */
uint32_t supported_colorimetry_mask; /**< supported weston_colorimetry_mode bits */
struct di_info *display_info; /**< libdisplay-info, from DRM */
/** Current content protection status */
enum weston_hdcp_protection current_protection;
@ -2626,6 +2628,9 @@ weston_head_get_output(struct weston_head *head);
uint32_t
weston_head_get_transform(struct weston_head *head);
const struct di_info *
weston_head_get_display_info(const struct weston_head *head);
void
weston_head_detach(struct weston_head *head);

View File

@ -6715,6 +6715,8 @@ weston_head_release(struct weston_head *head)
free(head->name);
wl_list_remove(&head->compositor_link);
assert(head->display_info == NULL);
}
/** Propagate device information changes
@ -7142,6 +7144,24 @@ weston_head_get_transform(struct weston_head *head)
return head->transform;
}
/** Get display information (EDID, DisplayID)
*
* \param head The head to query.
* \return libdisplay-info structure, or NULL.
*
* Hardware heads (monitors, TVs, etc.) driven directly by this compositor may
* provide EDID or DisplayID information. If a backend has that information,
* it may expose it as a libdisplay-info structure. The caller needs to use
* libdisplay-info to extract information from the returned pointer.
*
* \ingroup head
*/
WL_EXPORT const struct di_info *
weston_head_get_display_info(const struct weston_head *head)
{
return head->display_info;
}
/** Add destroy callback for a head
*
* \param head The head to watch for.