2019-07-10 13:46:39 +03:00
|
|
|
/*
|
|
|
|
* Copyright © 2008-2011 Kristian Høgsberg
|
|
|
|
* Copyright © 2017, 2018 General Electric Company
|
2021-04-30 14:48:52 +03:00
|
|
|
* Copyright © 2012, 2017-2019, 2021 Collabora, Ltd.
|
2019-07-10 13:46:39 +03:00
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining
|
|
|
|
* a copy of this software and associated documentation files (the
|
|
|
|
* "Software"), to deal in the Software without restriction, including
|
|
|
|
* without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
|
|
* permit persons to whom the Software is furnished to do so, subject to
|
|
|
|
* the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice (including the
|
|
|
|
* next paragraph) shall be included in all copies or substantial
|
|
|
|
* portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
|
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
|
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
|
|
|
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
|
|
|
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
|
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
|
* SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef LIBWESTON_INTERNAL_H
|
|
|
|
#define LIBWESTON_INTERNAL_H
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This is the internal (private) part of libweston. All symbols found here
|
|
|
|
* are, and should be only (with a few exceptions) used within the internal
|
|
|
|
* parts of libweston. Notable exception(s) include a few files in tests/ that
|
|
|
|
* need access to these functions, screen-share file from compositor/ and those
|
|
|
|
* remoting/. Those will require some further fixing as to avoid including this
|
|
|
|
* private header.
|
|
|
|
*
|
|
|
|
* Eventually, these symbols should reside naturally into their own scope. New
|
|
|
|
* features should either provide their own (internal) header or use this one.
|
|
|
|
*/
|
|
|
|
|
2021-04-30 14:48:52 +03:00
|
|
|
#include <libweston/libweston.h>
|
2022-07-22 11:30:04 +03:00
|
|
|
#include <assert.h>
|
libweston: introduce CMS component architecture
See: https://gitlab.freedesktop.org/wayland/weston/-/issues/467#note_814985
This starts building the framework required for implementing color
management.
The main new interface is struct weston_color_manager. This commit also
adds a no-op color manager implementation, which is used if no other
color manager is loaded. This no-op color manager simply provides
identity color transforms for everything, so that Weston keeps running
exactly like before.
weston_color_manager interface is incomplete and will be extended later.
Colorspace objects are not introduced in this commit. However, when
client content colorspace and output colorspace definitions are
combined, they will produce color transformations from client content to
output blending space and from output blending space to output space.
This commit introduces a placeholder struct for color transforms,
weston_color_transform. Objects of this type are expected to be heavy to
create and store, which is why they are designed to be shared as much as
possible, ideally making their instances unique. As color transform
description is intended to be generic in libweston core, renderers and
backends are expected to derive their own state for each transform
object as necessary. Creating and storing the derived state maybe be
expensive as well, more the reason to re-use these objects as much as
possible. E.g. GL-renderer might upload a 3D LUT into a texture and keep
the texture around. DRM-backend might create a KMS blob for a LUT and
keep that around.
As a color transform depends on both the surface and the output, a
transform object may need to be created for each unique pair of them.
Therefore color transforms are referenced from weston_paint_node. As
paint nodes exist for not just surface+output but surface+view+output
triplets, the code ensures that all paint nodes (having different view)
for the same surface+output have the same color transform state.
As a special case, if weston_color_transform is NULL, it means identity
transform. This short-circuits some checks and memory allocations, but
it does mean we use a separate member on weston_paint_node to know if
the color transform has been initialized or not.
Color transformations are pre-created at the weston_output
paint_node_z_order_list creation step. Currently the z order lists
contain all views globally, which means we populate color transforms we
may never need, e.g. a view is never shown on a particular output.
This problem should get fixed naturally when z order lists are
constructed "pruned" in the future: to contain only those paint nodes
that actually contribute to the output's image.
As nothing actually supports color transforms yet, both renderers and
the DRM-backend assert that they only get identity transforms. This
check has the side-effect that all surface-output pairs actually get a
weston_surface_color_transform_ref even though it points to NULL
weston_color_transform.
This design is inspired by Sebastian Wick's Weston color management
work.
Co-authored-by: Sebastian Wick <sebastian@sebastianwick.net>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-02-25 13:03:28 +03:00
|
|
|
#include "color.h"
|
2019-07-10 13:46:39 +03:00
|
|
|
|
2022-01-19 03:14:51 +03:00
|
|
|
/* compositor <-> renderer interface */
|
|
|
|
|
2023-01-11 23:53:43 +03:00
|
|
|
struct weston_renderbuffer {
|
2023-01-12 01:34:39 +03:00
|
|
|
pixman_region32_t damage;
|
2023-01-24 09:36:59 +03:00
|
|
|
int refcount;
|
|
|
|
|
|
|
|
void (*destroy)(struct weston_renderbuffer *renderbuffer);
|
2023-01-11 23:53:43 +03:00
|
|
|
};
|
|
|
|
|
2023-01-24 09:36:59 +03:00
|
|
|
struct weston_renderbuffer *
|
|
|
|
weston_renderbuffer_ref(struct weston_renderbuffer *renderbuffer);
|
|
|
|
|
|
|
|
void
|
|
|
|
weston_renderbuffer_unref(struct weston_renderbuffer *renderbuffer);
|
|
|
|
|
2022-12-14 18:29:29 +03:00
|
|
|
struct weston_renderer_options {
|
|
|
|
};
|
|
|
|
|
2022-01-19 03:14:51 +03:00
|
|
|
struct weston_renderer {
|
|
|
|
int (*read_pixels)(struct weston_output *output,
|
2022-08-01 13:31:27 +03:00
|
|
|
const struct pixel_format_info *format, void *pixels,
|
|
|
|
uint32_t x, uint32_t y,
|
|
|
|
uint32_t width, uint32_t height);
|
2022-01-19 03:14:51 +03:00
|
|
|
void (*repaint_output)(struct weston_output *output,
|
2023-01-12 01:01:15 +03:00
|
|
|
pixman_region32_t *output_damage,
|
|
|
|
struct weston_renderbuffer *renderbuffer);
|
2022-07-22 11:30:04 +03:00
|
|
|
|
|
|
|
/** See weston_renderer_resize_output()
|
|
|
|
*
|
|
|
|
* \return True for success, false for leaving the output in a mess.
|
|
|
|
*/
|
|
|
|
bool (*resize_output)(struct weston_output *output,
|
|
|
|
const struct weston_size *fb_size,
|
|
|
|
const struct weston_geometry *area);
|
|
|
|
|
2022-01-19 03:14:51 +03:00
|
|
|
void (*flush_damage)(struct weston_surface *surface,
|
2023-07-07 21:04:29 +03:00
|
|
|
struct weston_buffer *buffer,
|
|
|
|
struct weston_output *output);
|
2022-01-19 03:14:51 +03:00
|
|
|
void (*attach)(struct weston_surface *es, struct weston_buffer *buffer);
|
|
|
|
void (*destroy)(struct weston_compositor *ec);
|
|
|
|
|
|
|
|
/** See weston_surface_copy_content() */
|
|
|
|
int (*surface_copy_content)(struct weston_surface *surface,
|
|
|
|
void *target, size_t size,
|
|
|
|
int src_x, int src_y,
|
|
|
|
int width, int height);
|
|
|
|
|
|
|
|
/** See weston_compositor_import_dmabuf() */
|
|
|
|
bool (*import_dmabuf)(struct weston_compositor *ec,
|
|
|
|
struct linux_dmabuf_buffer *buffer);
|
|
|
|
|
|
|
|
const struct weston_drm_format_array *
|
|
|
|
(*get_supported_formats)(struct weston_compositor *ec);
|
|
|
|
|
|
|
|
bool (*fill_buffer_info)(struct weston_compositor *ec,
|
|
|
|
struct weston_buffer *buffer);
|
2022-11-30 12:34:52 +03:00
|
|
|
|
|
|
|
enum weston_renderer_type type;
|
2022-12-14 18:29:29 +03:00
|
|
|
const struct gl_renderer_interface *gl;
|
2023-01-11 23:28:52 +03:00
|
|
|
const struct pixman_renderer_interface *pixman;
|
2022-01-19 03:14:51 +03:00
|
|
|
};
|
|
|
|
|
2022-11-24 23:05:28 +03:00
|
|
|
struct weston_tearing_control {
|
|
|
|
struct weston_surface *surface;
|
|
|
|
bool may_tear;
|
|
|
|
};
|
|
|
|
|
2022-07-22 11:30:04 +03:00
|
|
|
void
|
|
|
|
weston_renderer_resize_output(struct weston_output *output,
|
|
|
|
const struct weston_size *fb_size,
|
|
|
|
const struct weston_geometry *area);
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
check_compositing_area(const struct weston_size *fb_size,
|
|
|
|
const struct weston_geometry *area)
|
|
|
|
{
|
|
|
|
assert(fb_size);
|
|
|
|
assert(fb_size->width > 0);
|
|
|
|
assert(fb_size->height > 0);
|
|
|
|
|
|
|
|
assert(area);
|
|
|
|
assert(area->x >= 0);
|
|
|
|
assert(area->width > 0);
|
|
|
|
assert(area->x <= fb_size->width - area->width);
|
|
|
|
assert(area->y >= 0);
|
|
|
|
assert(area->height > 0);
|
|
|
|
assert(area->y <= fb_size->height - area->height);
|
|
|
|
}
|
|
|
|
|
2019-07-10 13:46:39 +03:00
|
|
|
/* weston_buffer */
|
|
|
|
|
|
|
|
void
|
|
|
|
weston_buffer_send_server_error(struct weston_buffer *buffer,
|
|
|
|
const char *msg);
|
|
|
|
void
|
|
|
|
weston_buffer_reference(struct weston_buffer_reference *ref,
|
2022-01-15 06:12:53 +03:00
|
|
|
struct weston_buffer *buffer,
|
|
|
|
enum weston_buffer_reference_type type);
|
2019-07-10 13:46:39 +03:00
|
|
|
|
|
|
|
void
|
|
|
|
weston_buffer_release_move(struct weston_buffer_release_reference *dest,
|
|
|
|
struct weston_buffer_release_reference *src);
|
|
|
|
|
|
|
|
void
|
|
|
|
weston_buffer_release_reference(struct weston_buffer_release_reference *ref,
|
|
|
|
struct weston_buffer_release *buf_release);
|
|
|
|
|
2019-07-10 14:48:39 +03:00
|
|
|
/* weston_bindings */
|
|
|
|
void
|
|
|
|
weston_binding_list_destroy_all(struct wl_list *list);
|
|
|
|
|
|
|
|
/* weston_compositor */
|
|
|
|
|
|
|
|
void
|
|
|
|
touch_calibrator_mode_changed(struct weston_compositor *compositor);
|
|
|
|
|
|
|
|
int
|
|
|
|
noop_renderer_init(struct weston_compositor *ec);
|
|
|
|
|
|
|
|
void
|
|
|
|
weston_compositor_add_head(struct weston_compositor *compositor,
|
|
|
|
struct weston_head *head);
|
|
|
|
void
|
|
|
|
weston_compositor_add_pending_output(struct weston_output *output,
|
|
|
|
struct weston_compositor *compositor);
|
|
|
|
bool
|
|
|
|
weston_compositor_import_dmabuf(struct weston_compositor *compositor,
|
|
|
|
struct linux_dmabuf_buffer *buffer);
|
2019-11-16 21:26:52 +03:00
|
|
|
bool
|
|
|
|
weston_compositor_dmabuf_can_scanout(struct weston_compositor *compositor,
|
|
|
|
struct linux_dmabuf_buffer *buffer);
|
2019-07-10 14:48:39 +03:00
|
|
|
void
|
|
|
|
weston_compositor_offscreen(struct weston_compositor *compositor);
|
|
|
|
|
|
|
|
char *
|
|
|
|
weston_compositor_print_scene_graph(struct weston_compositor *ec);
|
|
|
|
|
|
|
|
void
|
|
|
|
weston_compositor_read_presentation_clock(
|
2022-11-03 22:29:50 +03:00
|
|
|
struct weston_compositor *compositor,
|
2019-07-10 14:48:39 +03:00
|
|
|
struct timespec *ts);
|
|
|
|
|
2022-12-14 18:29:29 +03:00
|
|
|
int
|
|
|
|
weston_compositor_init_renderer(struct weston_compositor *compositor,
|
|
|
|
enum weston_renderer_type renderer_type,
|
|
|
|
const struct weston_renderer_options *options);
|
|
|
|
|
2019-07-10 14:48:39 +03:00
|
|
|
int
|
|
|
|
weston_compositor_run_axis_binding(struct weston_compositor *compositor,
|
|
|
|
struct weston_pointer *pointer,
|
|
|
|
const struct timespec *time,
|
|
|
|
struct weston_pointer_axis_event *event);
|
|
|
|
void
|
|
|
|
weston_compositor_run_button_binding(struct weston_compositor *compositor,
|
|
|
|
struct weston_pointer *pointer,
|
|
|
|
const struct timespec *time,
|
|
|
|
uint32_t button,
|
|
|
|
enum wl_pointer_button_state value);
|
|
|
|
int
|
|
|
|
weston_compositor_run_debug_binding(struct weston_compositor *compositor,
|
|
|
|
struct weston_keyboard *keyboard,
|
|
|
|
const struct timespec *time,
|
|
|
|
uint32_t key,
|
|
|
|
enum wl_keyboard_key_state state);
|
|
|
|
void
|
|
|
|
weston_compositor_run_key_binding(struct weston_compositor *compositor,
|
|
|
|
struct weston_keyboard *keyboard,
|
|
|
|
const struct timespec *time,
|
|
|
|
uint32_t key,
|
|
|
|
enum wl_keyboard_key_state state);
|
|
|
|
void
|
|
|
|
weston_compositor_run_modifier_binding(struct weston_compositor *compositor,
|
|
|
|
struct weston_keyboard *keyboard,
|
|
|
|
enum weston_keyboard_modifier modifier,
|
|
|
|
enum wl_keyboard_key_state state);
|
|
|
|
void
|
|
|
|
weston_compositor_run_touch_binding(struct weston_compositor *compositor,
|
|
|
|
struct weston_touch *touch,
|
|
|
|
const struct timespec *time,
|
|
|
|
int touch_type);
|
|
|
|
void
|
2021-01-20 11:34:09 +03:00
|
|
|
weston_compositor_run_tablet_tool_binding(struct weston_compositor *compositor,
|
|
|
|
struct weston_tablet_tool *tool,
|
|
|
|
uint32_t button, uint32_t state_w);
|
|
|
|
void
|
2019-07-10 14:48:39 +03:00
|
|
|
weston_compositor_stack_plane(struct weston_compositor *ec,
|
|
|
|
struct weston_plane *plane,
|
|
|
|
struct weston_plane *above);
|
|
|
|
void
|
|
|
|
weston_compositor_set_touch_mode_normal(struct weston_compositor *compositor);
|
|
|
|
|
|
|
|
void
|
|
|
|
weston_compositor_set_touch_mode_calib(struct weston_compositor *compositor);
|
|
|
|
|
|
|
|
void
|
|
|
|
weston_compositor_xkb_destroy(struct weston_compositor *ec);
|
|
|
|
|
|
|
|
int
|
|
|
|
weston_input_init(struct weston_compositor *compositor);
|
|
|
|
|
2019-07-08 09:16:42 +03:00
|
|
|
/* weston_output */
|
|
|
|
|
|
|
|
void
|
|
|
|
weston_output_disable_planes_incr(struct weston_output *output);
|
|
|
|
|
|
|
|
void
|
|
|
|
weston_output_disable_planes_decr(struct weston_output *output);
|
|
|
|
|
2023-01-19 17:31:57 +03:00
|
|
|
void
|
|
|
|
weston_output_set_single_mode(struct weston_output *output,
|
|
|
|
struct weston_mode *target);
|
|
|
|
|
2019-07-10 16:29:05 +03:00
|
|
|
/* weston_plane */
|
|
|
|
|
|
|
|
void
|
2022-02-08 19:33:08 +03:00
|
|
|
weston_plane_init(struct weston_plane *plane, struct weston_compositor *ec);
|
|
|
|
|
2019-07-10 16:29:05 +03:00
|
|
|
void
|
|
|
|
weston_plane_release(struct weston_plane *plane);
|
2019-07-10 17:32:42 +03:00
|
|
|
|
|
|
|
/* weston_seat */
|
|
|
|
|
|
|
|
struct clipboard *
|
|
|
|
clipboard_create(struct weston_seat *seat);
|
|
|
|
|
|
|
|
void
|
|
|
|
weston_seat_init(struct weston_seat *seat, struct weston_compositor *ec,
|
|
|
|
const char *seat_name);
|
|
|
|
|
|
|
|
void
|
|
|
|
weston_seat_repick(struct weston_seat *seat);
|
|
|
|
|
|
|
|
void
|
|
|
|
weston_seat_release(struct weston_seat *seat);
|
|
|
|
|
|
|
|
void
|
|
|
|
weston_seat_send_selection(struct weston_seat *seat, struct wl_client *client);
|
|
|
|
|
2021-03-30 23:09:05 +03:00
|
|
|
int
|
2019-07-10 17:32:42 +03:00
|
|
|
weston_seat_init_pointer(struct weston_seat *seat);
|
|
|
|
|
|
|
|
int
|
|
|
|
weston_seat_init_keyboard(struct weston_seat *seat, struct xkb_keymap *keymap);
|
|
|
|
|
2021-03-30 23:09:05 +03:00
|
|
|
int
|
2019-07-10 17:32:42 +03:00
|
|
|
weston_seat_init_touch(struct weston_seat *seat);
|
|
|
|
|
|
|
|
void
|
|
|
|
weston_seat_release_keyboard(struct weston_seat *seat);
|
|
|
|
|
|
|
|
void
|
|
|
|
weston_seat_release_pointer(struct weston_seat *seat);
|
|
|
|
|
|
|
|
void
|
|
|
|
weston_seat_release_touch(struct weston_seat *seat);
|
|
|
|
|
2021-01-20 11:05:45 +03:00
|
|
|
struct weston_tablet *
|
|
|
|
weston_seat_add_tablet(struct weston_seat *seat);
|
|
|
|
struct weston_tablet_tool *
|
|
|
|
weston_seat_add_tablet_tool(struct weston_seat *seat);
|
|
|
|
void
|
|
|
|
weston_seat_release_tablet_tool(struct weston_tablet_tool *tablet_tool);
|
|
|
|
void
|
|
|
|
weston_seat_release_tablet(struct weston_tablet *tablet);
|
|
|
|
|
2019-07-10 17:32:42 +03:00
|
|
|
void
|
|
|
|
weston_seat_update_keymap(struct weston_seat *seat, struct xkb_keymap *keymap);
|
|
|
|
|
|
|
|
void
|
|
|
|
wl_data_device_set_keyboard_focus(struct weston_seat *seat);
|
|
|
|
|
2019-07-10 18:23:43 +03:00
|
|
|
/* weston_pointer */
|
|
|
|
|
2023-02-07 01:44:51 +03:00
|
|
|
struct weston_coord_global
|
2019-07-10 18:23:43 +03:00
|
|
|
weston_pointer_clamp(struct weston_pointer *pointer,
|
2023-02-07 01:44:51 +03:00
|
|
|
struct weston_coord_global pos);
|
|
|
|
|
2019-07-10 18:23:43 +03:00
|
|
|
void
|
|
|
|
weston_pointer_set_default_grab(struct weston_pointer *pointer,
|
|
|
|
const struct weston_pointer_grab_interface *interface);
|
|
|
|
|
|
|
|
void
|
|
|
|
weston_pointer_constraint_destroy(struct weston_pointer_constraint *constraint);
|
|
|
|
|
|
|
|
/* weston_keyboard */
|
|
|
|
bool
|
|
|
|
weston_keyboard_has_focus_resource(struct weston_keyboard *keyboard);
|
|
|
|
|
|
|
|
/* weston_touch */
|
|
|
|
|
|
|
|
struct weston_touch_device *
|
|
|
|
weston_touch_create_touch_device(struct weston_touch *touch,
|
|
|
|
const char *syspath,
|
|
|
|
void *backend_data,
|
|
|
|
const struct weston_touch_device_ops *ops);
|
|
|
|
|
|
|
|
void
|
|
|
|
weston_touch_device_destroy(struct weston_touch_device *device);
|
|
|
|
|
|
|
|
bool
|
|
|
|
weston_touch_has_focus_resource(struct weston_touch *touch);
|
|
|
|
|
|
|
|
int
|
|
|
|
weston_touch_start_drag(struct weston_touch *touch,
|
|
|
|
struct weston_data_source *source,
|
|
|
|
struct weston_surface *icon,
|
|
|
|
struct wl_client *client);
|
|
|
|
|
|
|
|
|
|
|
|
/* weston_touch_device */
|
|
|
|
|
|
|
|
bool
|
|
|
|
weston_touch_device_can_calibrate(struct weston_touch_device *device);
|
|
|
|
|
2021-01-20 11:05:45 +03:00
|
|
|
/* weston_tablet */
|
|
|
|
|
|
|
|
void
|
|
|
|
weston_tablet_manager_init(struct weston_compositor *ec);
|
|
|
|
|
|
|
|
struct weston_tablet *
|
|
|
|
weston_tablet_create(void);
|
|
|
|
|
|
|
|
void
|
|
|
|
weston_tablet_destroy(struct weston_tablet *tablet);
|
|
|
|
|
|
|
|
/* weston_tablet_tool */
|
|
|
|
|
|
|
|
struct weston_tablet_tool *
|
|
|
|
weston_tablet_tool_create(void);
|
|
|
|
|
|
|
|
void
|
|
|
|
weston_tablet_tool_destroy(struct weston_tablet_tool *tool);
|
|
|
|
|
2019-07-10 20:42:45 +03:00
|
|
|
/* weston_surface */
|
|
|
|
pixman_box32_t
|
|
|
|
weston_surface_to_buffer_rect(struct weston_surface *surface,
|
|
|
|
pixman_box32_t rect);
|
|
|
|
void
|
|
|
|
weston_surface_to_buffer_region(struct weston_surface *surface,
|
|
|
|
pixman_region32_t *surface_region,
|
|
|
|
pixman_region32_t *buffer_region);
|
|
|
|
void
|
|
|
|
weston_surface_schedule_repaint(struct weston_surface *surface);
|
2019-07-10 20:56:04 +03:00
|
|
|
|
|
|
|
/* weston_spring */
|
|
|
|
|
|
|
|
void
|
|
|
|
weston_spring_init(struct weston_spring *spring,
|
|
|
|
double k, double current, double target);
|
|
|
|
int
|
|
|
|
weston_spring_done(struct weston_spring *spring);
|
|
|
|
|
|
|
|
void
|
|
|
|
weston_spring_update(struct weston_spring *spring, const struct timespec *time);
|
2019-07-10 21:06:15 +03:00
|
|
|
|
|
|
|
/* weston_view */
|
|
|
|
|
|
|
|
bool
|
|
|
|
weston_view_is_opaque(struct weston_view *ev, pixman_region32_t *region);
|
|
|
|
|
2019-09-11 16:41:04 +03:00
|
|
|
bool
|
|
|
|
weston_view_has_valid_buffer(struct weston_view *ev);
|
|
|
|
|
2019-09-11 16:53:08 +03:00
|
|
|
bool
|
|
|
|
weston_view_matches_output_entirely(struct weston_view *ev,
|
|
|
|
struct weston_output *output);
|
2022-10-28 20:34:15 +03:00
|
|
|
|
|
|
|
bool
|
2023-02-07 01:05:42 +03:00
|
|
|
weston_view_takes_input_at_point(struct weston_view *view,
|
|
|
|
struct weston_coord_surface surf_pos);
|
2022-10-28 20:34:15 +03:00
|
|
|
|
2019-07-10 21:06:15 +03:00
|
|
|
void
|
2023-06-15 22:22:37 +03:00
|
|
|
weston_paint_node_move_to_plane(struct weston_paint_node *pnode,
|
|
|
|
struct weston_plane *plane);
|
2022-01-27 20:29:50 +03:00
|
|
|
void
|
|
|
|
weston_view_buffer_to_output_matrix(const struct weston_view *view,
|
|
|
|
const struct weston_output *output,
|
|
|
|
struct weston_matrix *matrix);
|
2019-07-10 21:06:15 +03:00
|
|
|
|
2022-01-20 00:52:41 +03:00
|
|
|
pixman_box32_t
|
|
|
|
weston_matrix_transform_rect(struct weston_matrix *matrix,
|
|
|
|
pixman_box32_t rect);
|
2019-07-10 21:27:49 +03:00
|
|
|
void
|
|
|
|
weston_matrix_transform_region(pixman_region32_t *dest,
|
|
|
|
struct weston_matrix *matrix,
|
|
|
|
pixman_region32_t *src);
|
|
|
|
|
2019-07-10 21:31:20 +03:00
|
|
|
/* protected_surface */
|
|
|
|
void
|
|
|
|
weston_protected_surface_send_event(struct protected_surface *psurface,
|
|
|
|
enum weston_hdcp_protection protection);
|
|
|
|
|
2020-12-01 22:39:47 +03:00
|
|
|
/* weston_drm_format */
|
|
|
|
|
|
|
|
struct weston_drm_format {
|
|
|
|
uint32_t format;
|
|
|
|
struct wl_array modifiers;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct weston_drm_format_array {
|
|
|
|
struct wl_array arr;
|
|
|
|
};
|
|
|
|
|
|
|
|
void
|
|
|
|
weston_drm_format_array_init(struct weston_drm_format_array *formats);
|
|
|
|
|
|
|
|
void
|
|
|
|
weston_drm_format_array_fini(struct weston_drm_format_array *formats);
|
|
|
|
|
|
|
|
int
|
|
|
|
weston_drm_format_array_replace(struct weston_drm_format_array *formats,
|
|
|
|
const struct weston_drm_format_array *source_formats);
|
|
|
|
|
|
|
|
struct weston_drm_format *
|
|
|
|
weston_drm_format_array_add_format(struct weston_drm_format_array *formats,
|
|
|
|
uint32_t format);
|
|
|
|
|
|
|
|
void
|
|
|
|
weston_drm_format_array_remove_latest_format(struct weston_drm_format_array *formats);
|
|
|
|
|
|
|
|
struct weston_drm_format *
|
|
|
|
weston_drm_format_array_find_format(const struct weston_drm_format_array *formats,
|
|
|
|
uint32_t format);
|
|
|
|
|
2021-10-06 18:05:40 +03:00
|
|
|
unsigned int
|
|
|
|
weston_drm_format_array_count_pairs(const struct weston_drm_format_array *formats);
|
|
|
|
|
2020-12-01 22:39:47 +03:00
|
|
|
bool
|
|
|
|
weston_drm_format_array_equal(const struct weston_drm_format_array *formats_A,
|
|
|
|
const struct weston_drm_format_array *formats_B);
|
|
|
|
|
|
|
|
int
|
|
|
|
weston_drm_format_array_join(struct weston_drm_format_array *formats_A,
|
|
|
|
const struct weston_drm_format_array *formats_B);
|
|
|
|
|
2021-08-30 18:52:26 +03:00
|
|
|
int
|
|
|
|
weston_drm_format_array_intersect(struct weston_drm_format_array *formats_A,
|
2020-12-01 22:39:47 +03:00
|
|
|
const struct weston_drm_format_array *formats_B);
|
|
|
|
|
|
|
|
int
|
|
|
|
weston_drm_format_array_subtract(struct weston_drm_format_array *formats_A,
|
|
|
|
const struct weston_drm_format_array *formats_B);
|
|
|
|
|
|
|
|
int
|
|
|
|
weston_drm_format_add_modifier(struct weston_drm_format *format,
|
|
|
|
uint64_t modifier);
|
|
|
|
|
|
|
|
bool
|
|
|
|
weston_drm_format_has_modifier(const struct weston_drm_format *format,
|
|
|
|
uint64_t modifier);
|
|
|
|
|
|
|
|
const uint64_t *
|
|
|
|
weston_drm_format_get_modifiers(const struct weston_drm_format *format,
|
|
|
|
unsigned int *count_out);
|
|
|
|
|
2022-04-07 20:04:25 +03:00
|
|
|
void
|
|
|
|
weston_compositor_destroy_touch_calibrator(struct weston_compositor *compositor);
|
2023-01-17 18:01:49 +03:00
|
|
|
|
|
|
|
enum paint_node_status {
|
|
|
|
PAINT_NODE_CLEAN = 0,
|
2023-06-22 18:33:36 +03:00
|
|
|
PAINT_NODE_OUTPUT_DIRTY = 1 << 0,
|
|
|
|
PAINT_NODE_VIEW_DIRTY = 1 << 1,
|
2023-06-15 21:52:53 +03:00
|
|
|
PAINT_NODE_VISIBILITY_DIRTY = 1 << 2,
|
2023-06-15 22:22:37 +03:00
|
|
|
PAINT_NODE_PLANE_DIRTY = 1 << 3,
|
2023-06-22 21:02:08 +03:00
|
|
|
PAINT_NODE_CONTENT_DIRTY = 1 << 4,
|
|
|
|
PAINT_NODE_ALL_DIRTY = (1 << 5) - 1,
|
2023-01-17 18:01:49 +03:00
|
|
|
};
|
|
|
|
|
2021-04-30 14:48:52 +03:00
|
|
|
/**
|
|
|
|
* paint node
|
|
|
|
*
|
|
|
|
* A generic data structure unique for surface-view-output combination.
|
|
|
|
*/
|
|
|
|
struct weston_paint_node {
|
2021-04-30 17:41:29 +03:00
|
|
|
/* Immutable members: */
|
|
|
|
|
2021-04-30 14:48:52 +03:00
|
|
|
/* struct weston_surface::paint_node_list */
|
|
|
|
struct wl_list surface_link;
|
|
|
|
struct weston_surface *surface;
|
|
|
|
|
|
|
|
/* struct weston_view::paint_node_list */
|
|
|
|
struct wl_list view_link;
|
|
|
|
struct weston_view *view;
|
|
|
|
|
|
|
|
/* struct weston_output::paint_node_list */
|
|
|
|
struct wl_list output_link;
|
|
|
|
struct weston_output *output;
|
2021-04-30 17:41:29 +03:00
|
|
|
|
|
|
|
/* Mutable members: */
|
|
|
|
|
2023-01-17 18:01:49 +03:00
|
|
|
enum paint_node_status status;
|
2023-01-06 20:59:14 +03:00
|
|
|
struct weston_matrix buffer_to_output_matrix;
|
2023-01-11 22:57:05 +03:00
|
|
|
struct weston_matrix output_to_buffer_matrix;
|
2022-01-27 20:31:26 +03:00
|
|
|
bool needs_filtering;
|
|
|
|
|
2023-01-19 00:50:50 +03:00
|
|
|
bool valid_transform;
|
|
|
|
enum wl_output_transform transform;
|
|
|
|
|
2021-04-30 17:41:29 +03:00
|
|
|
/* struct weston_output::paint_node_z_order_list */
|
|
|
|
struct wl_list z_order_link;
|
libweston: introduce CMS component architecture
See: https://gitlab.freedesktop.org/wayland/weston/-/issues/467#note_814985
This starts building the framework required for implementing color
management.
The main new interface is struct weston_color_manager. This commit also
adds a no-op color manager implementation, which is used if no other
color manager is loaded. This no-op color manager simply provides
identity color transforms for everything, so that Weston keeps running
exactly like before.
weston_color_manager interface is incomplete and will be extended later.
Colorspace objects are not introduced in this commit. However, when
client content colorspace and output colorspace definitions are
combined, they will produce color transformations from client content to
output blending space and from output blending space to output space.
This commit introduces a placeholder struct for color transforms,
weston_color_transform. Objects of this type are expected to be heavy to
create and store, which is why they are designed to be shared as much as
possible, ideally making their instances unique. As color transform
description is intended to be generic in libweston core, renderers and
backends are expected to derive their own state for each transform
object as necessary. Creating and storing the derived state maybe be
expensive as well, more the reason to re-use these objects as much as
possible. E.g. GL-renderer might upload a 3D LUT into a texture and keep
the texture around. DRM-backend might create a KMS blob for a LUT and
keep that around.
As a color transform depends on both the surface and the output, a
transform object may need to be created for each unique pair of them.
Therefore color transforms are referenced from weston_paint_node. As
paint nodes exist for not just surface+output but surface+view+output
triplets, the code ensures that all paint nodes (having different view)
for the same surface+output have the same color transform state.
As a special case, if weston_color_transform is NULL, it means identity
transform. This short-circuits some checks and memory allocations, but
it does mean we use a separate member on weston_paint_node to know if
the color transform has been initialized or not.
Color transformations are pre-created at the weston_output
paint_node_z_order_list creation step. Currently the z order lists
contain all views globally, which means we populate color transforms we
may never need, e.g. a view is never shown on a particular output.
This problem should get fixed naturally when z order lists are
constructed "pruned" in the future: to contain only those paint nodes
that actually contribute to the output's image.
As nothing actually supports color transforms yet, both renderers and
the DRM-backend assert that they only get identity transforms. This
check has the side-effect that all surface-output pairs actually get a
weston_surface_color_transform_ref even though it points to NULL
weston_color_transform.
This design is inspired by Sebastian Wick's Weston color management
work.
Co-authored-by: Sebastian Wick <sebastian@sebastianwick.net>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-02-25 13:03:28 +03:00
|
|
|
|
2023-06-15 21:52:53 +03:00
|
|
|
pixman_region32_t visible;
|
2023-06-19 20:23:56 +03:00
|
|
|
pixman_region32_t damage; /* In global coordinates */
|
2023-06-15 22:22:37 +03:00
|
|
|
struct weston_plane *plane;
|
|
|
|
struct weston_plane *plane_next;
|
2023-06-15 21:52:53 +03:00
|
|
|
|
libweston: introduce CMS component architecture
See: https://gitlab.freedesktop.org/wayland/weston/-/issues/467#note_814985
This starts building the framework required for implementing color
management.
The main new interface is struct weston_color_manager. This commit also
adds a no-op color manager implementation, which is used if no other
color manager is loaded. This no-op color manager simply provides
identity color transforms for everything, so that Weston keeps running
exactly like before.
weston_color_manager interface is incomplete and will be extended later.
Colorspace objects are not introduced in this commit. However, when
client content colorspace and output colorspace definitions are
combined, they will produce color transformations from client content to
output blending space and from output blending space to output space.
This commit introduces a placeholder struct for color transforms,
weston_color_transform. Objects of this type are expected to be heavy to
create and store, which is why they are designed to be shared as much as
possible, ideally making their instances unique. As color transform
description is intended to be generic in libweston core, renderers and
backends are expected to derive their own state for each transform
object as necessary. Creating and storing the derived state maybe be
expensive as well, more the reason to re-use these objects as much as
possible. E.g. GL-renderer might upload a 3D LUT into a texture and keep
the texture around. DRM-backend might create a KMS blob for a LUT and
keep that around.
As a color transform depends on both the surface and the output, a
transform object may need to be created for each unique pair of them.
Therefore color transforms are referenced from weston_paint_node. As
paint nodes exist for not just surface+output but surface+view+output
triplets, the code ensures that all paint nodes (having different view)
for the same surface+output have the same color transform state.
As a special case, if weston_color_transform is NULL, it means identity
transform. This short-circuits some checks and memory allocations, but
it does mean we use a separate member on weston_paint_node to know if
the color transform has been initialized or not.
Color transformations are pre-created at the weston_output
paint_node_z_order_list creation step. Currently the z order lists
contain all views globally, which means we populate color transforms we
may never need, e.g. a view is never shown on a particular output.
This problem should get fixed naturally when z order lists are
constructed "pruned" in the future: to contain only those paint nodes
that actually contribute to the output's image.
As nothing actually supports color transforms yet, both renderers and
the DRM-backend assert that they only get identity transforms. This
check has the side-effect that all surface-output pairs actually get a
weston_surface_color_transform_ref even though it points to NULL
weston_color_transform.
This design is inspired by Sebastian Wick's Weston color management
work.
Co-authored-by: Sebastian Wick <sebastian@sebastianwick.net>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-02-25 13:03:28 +03:00
|
|
|
struct weston_surface_color_transform surf_xform;
|
|
|
|
bool surf_xform_valid;
|
2021-09-13 20:52:53 +03:00
|
|
|
|
|
|
|
uint32_t try_view_on_plane_failure_reasons;
|
2021-04-30 14:48:52 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
struct weston_paint_node *
|
|
|
|
weston_view_find_paint_node(struct weston_view *view,
|
|
|
|
struct weston_output *output);
|
|
|
|
|
2019-07-11 14:54:46 +03:00
|
|
|
/* others */
|
|
|
|
int
|
|
|
|
wl_data_device_manager_init(struct wl_display *display);
|
|
|
|
|
2022-03-17 14:13:14 +03:00
|
|
|
/* Exclusively for unit tests */
|
|
|
|
|
|
|
|
bool
|
|
|
|
weston_output_set_color_outcome(struct weston_output *output);
|
|
|
|
|
2022-11-21 22:55:35 +03:00
|
|
|
void
|
|
|
|
weston_surface_build_buffer_matrix(const struct weston_surface *surface,
|
|
|
|
struct weston_matrix *matrix);
|
|
|
|
|
|
|
|
void
|
|
|
|
weston_output_update_matrix(struct weston_output *output);
|
|
|
|
|
|
|
|
void
|
|
|
|
convert_size_by_transform_scale(int32_t *width_out, int32_t *height_out,
|
|
|
|
int32_t width, int32_t height,
|
|
|
|
uint32_t transform,
|
|
|
|
int32_t scale);
|
|
|
|
|
2022-11-19 11:52:01 +03:00
|
|
|
/* User authentication for remote backends */
|
|
|
|
|
|
|
|
bool
|
|
|
|
weston_authenticate_user(const char *username, const char *password);
|
|
|
|
|
2019-07-10 13:46:39 +03:00
|
|
|
#endif
|