cms-colord: find a good head

The 'head' member of 'struct weston_output' is going to go unused and
then disappear, so stop using it and find a head from the proper list.

However, this leaves a problem in cms-colord: if you have multiple
monitors driver with the same CRTC, what do you say to the color
management system? The monitors could be different, but all the color
LUTs etc. are in the CRTC and are shared, as is the framebuffer.

Do the simple hack here and just use whatever head happens to be the
first in the list.

The warning is printed in get_output_id(), because if heads are added or
removed while the output is enabled, the id could change.

v6:
- add weston_output_get_first_head(), at first use
- add warning message for nr. heads > 1

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
dev
Pekka Paalanen 8 years ago
parent 06f99efc9c
commit cf0a476b8e
  1. 17
      compositor/cms-colord.c
  2. 18
      libweston/compositor.c
  3. 3
      libweston/compositor.h

@ -102,10 +102,20 @@ edid_value_valid(const char *str)
static gchar * static gchar *
get_output_id(struct cms_colord *cms, struct weston_output *o) get_output_id(struct cms_colord *cms, struct weston_output *o)
{ {
struct weston_head *head = &o->head; struct weston_head *head;
const gchar *tmp; const gchar *tmp;
GString *device_id; GString *device_id;
/* XXX: What to do with multiple heads?
* This is potentially unstable, if head configuration is changed
* while the output is enabled. */
head = weston_output_get_first_head(o);
if (wl_list_length(&o->head_list) > 1) {
weston_log("colord: WARNING: multiple heads are not supported (output %s).\n",
o->name);
}
/* see https://github.com/hughsie/colord/blob/master/doc/device-and-profile-naming-spec.txt /* see https://github.com/hughsie/colord/blob/master/doc/device-and-profile-naming-spec.txt
* for format and allowed values */ * for format and allowed values */
device_id = g_string_new("xrandr"); device_id = g_string_new("xrandr");
@ -231,7 +241,7 @@ colord_notifier_output_destroy(struct wl_listener *listener, void *data)
static void static void
colord_output_created(struct cms_colord *cms, struct weston_output *o) colord_output_created(struct cms_colord *cms, struct weston_output *o)
{ {
struct weston_head *head = &o->head; struct weston_head *head;
CdDevice *device; CdDevice *device;
const gchar *tmp; const gchar *tmp;
gchar *device_id; gchar *device_id;
@ -239,6 +249,9 @@ colord_output_created(struct cms_colord *cms, struct weston_output *o)
GHashTable *device_props; GHashTable *device_props;
struct cms_output *ocms; struct cms_output *ocms;
/* XXX: What to do with multiple heads? */
head = weston_output_get_first_head(o);
/* create device */ /* create device */
device_id = get_output_id(cms, o); device_id = get_output_id(cms, o);
weston_log("colord: output added %s\n", device_id); weston_log("colord: output added %s\n", device_id);

@ -5249,6 +5249,24 @@ weston_output_release(struct weston_output *output)
free(output->name); free(output->name);
} }
/** When you need a head...
*
* This function is a hack, used until all code has been converted to become
* multi-head aware.
*
* \param output The weston_output whose head to get.
* \return The first head in the output's list.
*/
WL_EXPORT struct weston_head *
weston_output_get_first_head(struct weston_output *output)
{
if (wl_list_empty(&output->head_list))
return NULL;
return container_of(output->head_list.next,
struct weston_head, output_link);
}
static void static void
destroy_viewport(struct wl_resource *resource) destroy_viewport(struct wl_resource *resource)
{ {

@ -2000,6 +2000,9 @@ weston_pending_output_coldplug(struct weston_compositor *compositor);
struct weston_head * struct weston_head *
weston_head_from_resource(struct wl_resource *resource); weston_head_from_resource(struct wl_resource *resource);
struct weston_head *
weston_output_get_first_head(struct weston_output *output);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

Loading…
Cancel
Save