libweston: add color ops cap and bool renderer shadow buffer

This adds the libweston capability bit for "color operations" which
refers to a renderer's support for operations needed for color
management. GL-renderer will grow the support while Pixman-renderer will
not, which is why the cap is needed.

To make an example use of the cap, this also adds new API:
weston_output_set_renderer_shadow_buffer(). This is a temporary API to
enable future experimental features. The first such feature will be the
renderer internal shadow buffer, the boolean variable for it taken from
Harish Krupo's "weston.ini: introduce use-shadow-fbo in output config".

Obviously this patch does not implement the renderer shadow buffer. No
renderer sets WESTON_CAP_COLOR_OPS yet so trying to enable it will fail.

The documentation here is deliberately vague, because the bits needed
for color management will come in trickling for a long time until we can
call it color management in any sense. Until then, the temporary API
shall remain, perhaps poorly named.

Cc: Harish Krupo <harishkrupo@gmail.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
dev
Pekka Paalanen 4 years ago
parent 71078b4044
commit b5265af620
  1. 1
      compositor/main.c
  2. 8
      include/libweston/libweston.h
  3. 33
      libweston/compositor.c

@ -781,6 +781,7 @@ static const struct {
} capability_strings[] = { } capability_strings[] = {
{ WESTON_CAP_ROTATION_ANY, "arbitrary surface rotation:" }, { WESTON_CAP_ROTATION_ANY, "arbitrary surface rotation:" },
{ WESTON_CAP_CAPTURE_YFLIP, "screen capture uses y-flip:" }, { WESTON_CAP_CAPTURE_YFLIP, "screen capture uses y-flip:" },
{ WESTON_CAP_COLOR_OPS, "color operations:" },
}; };
static void static void

@ -359,6 +359,8 @@ struct weston_output {
bool enabled; /**< is in the output_list, not pending list */ bool enabled; /**< is in the output_list, not pending list */
int scale; int scale;
bool use_renderer_shadow_buffer;
int (*enable)(struct weston_output *output); int (*enable)(struct weston_output *output);
int (*disable)(struct weston_output *output); int (*disable)(struct weston_output *output);
@ -970,6 +972,9 @@ enum weston_capability {
/* renderer supports explicit synchronization */ /* renderer supports explicit synchronization */
WESTON_CAP_EXPLICIT_SYNC = 0x0020, WESTON_CAP_EXPLICIT_SYNC = 0x0020,
/* renderer supports color management operations */
WESTON_CAP_COLOR_OPS = 0x0040,
}; };
/* Configuration struct for a backend. /* Configuration struct for a backend.
@ -2053,6 +2058,9 @@ void
weston_output_set_transform(struct weston_output *output, weston_output_set_transform(struct weston_output *output,
uint32_t transform); uint32_t transform);
bool
weston_output_set_renderer_shadow_buffer(struct weston_output *output);
void void
weston_output_init(struct weston_output *output, weston_output_init(struct weston_output *output,
struct weston_compositor *compositor, struct weston_compositor *compositor,

@ -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 /** Initializes a weston_output object with enough data so
** an output can be configured. ** an output can be configured.
* *

Loading…
Cancel
Save