mirror of
https://gitlab.freedesktop.org/wayland/weston
synced 2024-09-06 18:05:39 +00:00
libweston: move color-management protocol init call to core
This reverts commit 188a3ebd5e
.
Call weston_compositor_enable_color_management_protocol() after
compositor->color_manager has been set, and so allows to check if the
color manager supports the features mandatory in protocol. The check is
added in the next patch.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This commit is contained in:
parent
35a580dab6
commit
d9a7b3795a
|
@ -32,7 +32,7 @@
|
|||
|
||||
#include "color.h"
|
||||
#include "color-lcms.h"
|
||||
#include "color-management.h"
|
||||
#include "color-properties.h"
|
||||
#include "shared/helpers.h"
|
||||
#include "shared/xalloc.h"
|
||||
#include "shared/weston-assert.h"
|
||||
|
@ -470,6 +470,7 @@ weston_color_manager_create(struct weston_compositor *compositor)
|
|||
|
||||
cm->base.name = "work-in-progress";
|
||||
cm->base.compositor = compositor;
|
||||
cm->base.supports_client_protocol = true;
|
||||
cm->base.init = cmlcms_init;
|
||||
cm->base.destroy = cmlcms_destroy;
|
||||
cm->base.destroy_color_profile = cmlcms_destroy_color_profile;
|
||||
|
@ -480,10 +481,6 @@ weston_color_manager_create(struct weston_compositor *compositor)
|
|||
cm->base.get_surface_color_transform = cmlcms_get_surface_color_transform;
|
||||
cm->base.create_output_color_outcome = cmlcms_create_output_color_outcome;
|
||||
|
||||
/* We support the CM&HDR protocol extension when using LittleCMS. */
|
||||
if (weston_compositor_enable_color_management_protocol(compositor) < 0)
|
||||
goto err;
|
||||
|
||||
/* We still do not support creating parametric color profiles. */
|
||||
cm->base.supported_color_features = (1 << WESTON_COLOR_FEATURE_ICC);
|
||||
|
||||
|
|
|
@ -1105,7 +1105,7 @@ bind_color_management(struct wl_client *client, void *data, uint32_t version,
|
|||
* \param compositor The compositor to init for.
|
||||
* \return Zero on success, -1 on failure.
|
||||
*/
|
||||
WL_EXPORT int
|
||||
int
|
||||
weston_compositor_enable_color_management_protocol(struct weston_compositor *compositor)
|
||||
{
|
||||
uint32_t version = 1;
|
||||
|
|
|
@ -250,6 +250,7 @@ weston_color_manager_noop_create(struct weston_compositor *compositor)
|
|||
|
||||
cm->base.name = "no-op";
|
||||
cm->base.compositor = compositor;
|
||||
cm->base.supports_client_protocol = false;
|
||||
cm->base.init = cmnoop_init;
|
||||
cm->base.destroy = cmnoop_destroy;
|
||||
cm->base.destroy_color_profile = cmnoop_destroy_color_profile;
|
||||
|
|
|
@ -252,6 +252,9 @@ struct weston_color_manager {
|
|||
/** This compositor instance */
|
||||
struct weston_compositor *compositor;
|
||||
|
||||
/** Supports the Wayland CM&HDR protocol extension? */
|
||||
bool supports_client_protocol;
|
||||
|
||||
/**
|
||||
* Supported color features from Wayland CM&HDR protocol extension.
|
||||
*
|
||||
|
|
|
@ -9455,6 +9455,17 @@ weston_compositor_backends_loaded(struct weston_compositor *compositor)
|
|||
return -1;
|
||||
|
||||
weston_log("Color manager: %s\n", compositor->color_manager->name);
|
||||
weston_log_continue(STAMP_SPACE " protocol support: %s\n",
|
||||
yesno(compositor->color_manager->supports_client_protocol));
|
||||
|
||||
if (compositor->color_manager->supports_client_protocol &&
|
||||
weston_compositor_enable_color_management_protocol(compositor) < 0) {
|
||||
/*
|
||||
* The only way out is to quit the compositor,
|
||||
* and that will clean up.
|
||||
*/
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue