diff --git a/compositor/main.c b/compositor/main.c index ecc5a352c..58b52d0dc 100644 --- a/compositor/main.c +++ b/compositor/main.c @@ -781,6 +781,7 @@ static const struct { } capability_strings[] = { { WESTON_CAP_ROTATION_ANY, "arbitrary surface rotation:" }, { WESTON_CAP_CAPTURE_YFLIP, "screen capture uses y-flip:" }, + { WESTON_CAP_COLOR_OPS, "color operations:" }, }; static void diff --git a/include/libweston/libweston.h b/include/libweston/libweston.h index a7b1dbafb..07bb3209f 100644 --- a/include/libweston/libweston.h +++ b/include/libweston/libweston.h @@ -359,6 +359,8 @@ struct weston_output { bool enabled; /**< is in the output_list, not pending list */ int scale; + bool use_renderer_shadow_buffer; + int (*enable)(struct weston_output *output); int (*disable)(struct weston_output *output); @@ -970,6 +972,9 @@ enum weston_capability { /* renderer supports explicit synchronization */ WESTON_CAP_EXPLICIT_SYNC = 0x0020, + + /* renderer supports color management operations */ + WESTON_CAP_COLOR_OPS = 0x0040, }; /* Configuration struct for a backend. @@ -2053,6 +2058,9 @@ void weston_output_set_transform(struct weston_output *output, uint32_t transform); +bool +weston_output_set_renderer_shadow_buffer(struct weston_output *output); + void weston_output_init(struct weston_output *output, struct weston_compositor *compositor, diff --git a/libweston/compositor.c b/libweston/compositor.c index 12eb3cd81..89fa7c48b 100644 --- a/libweston/compositor.c +++ b/libweston/compositor.c @@ -6224,6 +6224,39 @@ weston_output_set_transform(struct weston_output *output, } } +/** Make the output use renderer shadow buffer. + * + * \param output The weston_output object to modify. + * \return True on success, false if unsupported. + * + * This can only be set on a disabled output object. + * + * This is a temporary API to demonstrate WESTON_CAP_COLOR_OPS and allow + * testing related features. This will be superseded with color management + * API. + * + * By default, a renderer is not using a shadow buffer of its own. Enabling + * a shadow buffer may enable other color related features. + * + * Support depends on the chosen renderer and the graphics driver stack in use. + * + * \ingroup output + */ +WL_EXPORT bool +weston_output_set_renderer_shadow_buffer(struct weston_output *output) +{ + struct weston_compositor *compositor = output->compositor; + + assert(!output->enabled); + + if (compositor->capabilities & WESTON_CAP_COLOR_OPS) { + output->use_renderer_shadow_buffer = true; + return true; + } + + return false; +} + /** Initializes a weston_output object with enough data so ** an output can be configured. *