libweston: set default monitor strings
Allow passing NULL to monitor string in order to set the default "unknown" strings. This allows a head to be initialized with the default strings, meaning that it will no longer be mandatory for a backend to call weston_head_set_monitor_strings(). In DRM-backend case this makes future changes more convenient. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This commit is contained in:
parent
c26335bfdb
commit
d79fc78152
libweston
@ -599,8 +599,8 @@ update_head_from_connector(struct drm_head *head)
|
|||||||
|
|
||||||
find_and_parse_output_edid(head, props, &dhi);
|
find_and_parse_output_edid(head, props, &dhi);
|
||||||
|
|
||||||
weston_head_set_monitor_strings(&head->base, dhi.make ?: "unknown",
|
weston_head_set_monitor_strings(&head->base, dhi.make,
|
||||||
dhi.model ?: "unknown",
|
dhi.model,
|
||||||
dhi.serial_number);
|
dhi.serial_number);
|
||||||
|
|
||||||
prune_eotf_modes_by_kms_support(head, &dhi.eotf_mask);
|
prune_eotf_modes_by_kms_support(head, &dhi.eotf_mask);
|
||||||
|
@ -5932,6 +5932,8 @@ weston_head_init(struct weston_head *head, const char *name)
|
|||||||
head->name = xstrdup(name);
|
head->name = xstrdup(name);
|
||||||
head->supported_eotf_mask = WESTON_EOTF_MODE_SDR;
|
head->supported_eotf_mask = WESTON_EOTF_MODE_SDR;
|
||||||
head->current_protection = WESTON_HDCP_DISABLE;
|
head->current_protection = WESTON_HDCP_DISABLE;
|
||||||
|
|
||||||
|
weston_head_set_monitor_strings(head, NULL, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Send output heads changed signal
|
/** Send output heads changed signal
|
||||||
@ -6325,9 +6327,9 @@ str_null_eq(const char *a, const char *b)
|
|||||||
*
|
*
|
||||||
* \param head The head to modify.
|
* \param head The head to modify.
|
||||||
* \param make The monitor make. If EDID is available, the PNP ID. Otherwise
|
* \param make The monitor make. If EDID is available, the PNP ID. Otherwise
|
||||||
* any string, or NULL for none.
|
* any string, or NULL for "unknown".
|
||||||
* \param model The monitor model or name, or a made-up string, or NULL for
|
* \param model The monitor model or name, or a made-up string, or NULL for
|
||||||
* none.
|
* "unknown".
|
||||||
* \param serialno The monitor serial number, a made-up string, or NULL for
|
* \param serialno The monitor serial number, a made-up string, or NULL for
|
||||||
* none.
|
* none.
|
||||||
*
|
*
|
||||||
@ -6342,6 +6344,11 @@ weston_head_set_monitor_strings(struct weston_head *head,
|
|||||||
const char *model,
|
const char *model,
|
||||||
const char *serialno)
|
const char *serialno)
|
||||||
{
|
{
|
||||||
|
if (!make)
|
||||||
|
make = "unknown";
|
||||||
|
if (!model)
|
||||||
|
model = "unknown";
|
||||||
|
|
||||||
if (str_null_eq(head->make, make) &&
|
if (str_null_eq(head->make, make) &&
|
||||||
str_null_eq(head->model, model) &&
|
str_null_eq(head->model, model) &&
|
||||||
str_null_eq(head->serial_number, serialno))
|
str_null_eq(head->serial_number, serialno))
|
||||||
@ -6351,8 +6358,8 @@ weston_head_set_monitor_strings(struct weston_head *head,
|
|||||||
free(head->model);
|
free(head->model);
|
||||||
free(head->serial_number);
|
free(head->serial_number);
|
||||||
|
|
||||||
head->make = make ? xstrdup(make) : NULL;
|
head->make = xstrdup(make);
|
||||||
head->model = model ? xstrdup(model) : NULL;
|
head->model = xstrdup(model);
|
||||||
head->serial_number = serialno ? xstrdup(serialno) : NULL;
|
head->serial_number = serialno ? xstrdup(serialno) : NULL;
|
||||||
|
|
||||||
weston_head_set_device_changed(head);
|
weston_head_set_device_changed(head);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user