2013-01-07 21:39:49 +04:00
|
|
|
/*
|
|
|
|
* Copyright © 2012 Intel Corporation
|
|
|
|
* Copyright © 2013 Vasily Khoruzhick <anarsoul@gmail.com>
|
2015-02-11 13:29:56 +03:00
|
|
|
* Copyright © 2015 Collabora, Ltd.
|
2013-01-07 21:39:49 +04:00
|
|
|
*
|
2015-06-12 01:35:43 +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:
|
2013-01-07 21:39:49 +04:00
|
|
|
*
|
2015-06-12 01:35:43 +03:00
|
|
|
* 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.
|
2013-01-07 21:39:49 +04:00
|
|
|
*/
|
|
|
|
|
2013-05-22 19:03:19 +04:00
|
|
|
#include "config.h"
|
2013-01-07 21:39:49 +04:00
|
|
|
|
|
|
|
#include <errno.h>
|
2016-07-19 14:16:27 +03:00
|
|
|
#include <stdint.h>
|
2013-01-07 21:39:49 +04:00
|
|
|
#include <stdlib.h>
|
2015-03-04 17:12:04 +03:00
|
|
|
#include <assert.h>
|
2013-01-07 21:39:49 +04:00
|
|
|
|
|
|
|
#include "pixman-renderer.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"
|
2021-07-27 05:29:20 +03:00
|
|
|
#include "pixel-formats.h"
|
2022-07-20 15:17:30 +03:00
|
|
|
#include "output-capture.h"
|
2015-06-16 01:37:10 +03:00
|
|
|
#include "shared/helpers.h"
|
2022-04-28 13:28:26 +03:00
|
|
|
#include "shared/signal.h"
|
2022-07-22 11:59:27 +03:00
|
|
|
#include "shared/weston-drm-fourcc.h"
|
2022-07-20 15:17:30 +03:00
|
|
|
#include "shared/xalloc.h"
|
2013-01-07 21:39:49 +04:00
|
|
|
|
2013-01-25 17:13:00 +04:00
|
|
|
#include <linux/input.h>
|
|
|
|
|
2013-01-07 21:39:49 +04:00
|
|
|
struct pixman_output_state {
|
2013-01-25 17:13:01 +04:00
|
|
|
pixman_image_t *shadow_image;
|
2022-07-22 11:59:27 +03:00
|
|
|
const struct pixel_format_info *shadow_format;
|
2013-01-07 21:39:49 +04:00
|
|
|
pixman_image_t *hw_buffer;
|
2022-07-20 15:17:30 +03:00
|
|
|
const struct pixel_format_info *hw_format;
|
2022-07-22 12:10:02 +03:00
|
|
|
struct weston_size fb_size;
|
2023-01-12 01:34:39 +03:00
|
|
|
struct wl_list renderbuffer_list;
|
2013-01-07 21:39:49 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
struct pixman_surface_state {
|
2013-10-25 17:26:33 +04:00
|
|
|
struct weston_surface *surface;
|
|
|
|
|
2013-01-07 21:39:49 +04:00
|
|
|
pixman_image_t *image;
|
|
|
|
struct weston_buffer_reference buffer_ref;
|
2018-10-19 12:14:11 +03:00
|
|
|
struct weston_buffer_release_reference buffer_release_ref;
|
2013-10-25 17:26:33 +04:00
|
|
|
|
pixman: Destroy pixman images when underlying buffer is destroyed
While the pixman image might be attached, the underlying buffer might be
already gone under certain circumstances. This is easily reproduced by
attempting to resize gnome-terminal on a fbdev backend.
$ WAYLAND_DEBUG=1 strace -emunmap weston --backend=fbdev-backend.so
...
[1524826.942] wl_shm@7.create_pool(new id wl_shm_pool@23, fd 40, 1563540)
[1524827.315] wl_shm_pool@23.create_buffer(new id wl_buffer@24, 0, 759, 515, 3036, 0)
...
[1524829.488] wl_surface@14.attach(wl_buffer@24, 0, 0)
[1524829.766] wl_surface@14.set_buffer_scale(1)
[1524829.904] wl_surface@14.damage(0, 0, 759, 515)
[1524830.248] wl_surface@14.frame(new id wl_callback@25)
[1524830.450] wl_surface@14.commit()
...
[1524846.706] wl_shm@7.create_pool(new id wl_shm_pool@26, fd 40, 1545000)
[1524847.215] wl_shm_pool@26.create_buffer(new id wl_buffer@27, 0, 750, 515, 3000, 0)
[1524847.735] wl_buffer@24.destroy()
[1524847.953] -> wl_display@1.delete_id(24)
[1524848.144] wl_shm_pool@23.destroy()
munmap(0xb5b2e000, 1563540) = 0
[1524849.021] -> wl_display@1.delete_id(23)
[1524849.425] wl_surface@14.attach(wl_buffer@27, 0, 0)
[1524849.730] wl_surface@14.set_buffer_scale(1)
[1524849.821] wl_surface@14.damage(0, 0, 750, 515)
<No commit yet, so drawing is attempted from older buffer that used to be
attached to the surface, which happens to come from a destroyed pool,
resulting it an invalid read from address 0xb5b2e000>
Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
2013-12-12 15:57:56 +04:00
|
|
|
struct wl_listener buffer_destroy_listener;
|
2013-10-25 17:26:33 +04:00
|
|
|
struct wl_listener surface_destroy_listener;
|
2013-10-25 17:26:34 +04:00
|
|
|
struct wl_listener renderer_destroy_listener;
|
2013-01-07 21:39:49 +04:00
|
|
|
};
|
|
|
|
|
2023-01-13 18:14:18 +03:00
|
|
|
struct pixman_renderbuffer {
|
|
|
|
struct weston_renderbuffer base;
|
|
|
|
|
|
|
|
pixman_image_t *image;
|
|
|
|
struct wl_list link;
|
|
|
|
};
|
|
|
|
|
2013-01-07 21:39:49 +04:00
|
|
|
struct pixman_renderer {
|
|
|
|
struct weston_renderer base;
|
2013-10-25 17:26:32 +04:00
|
|
|
|
2013-01-25 17:13:00 +04:00
|
|
|
int repaint_debug;
|
|
|
|
pixman_image_t *debug_color;
|
2013-10-25 17:26:32 +04:00
|
|
|
struct weston_binding *debug_binding;
|
2013-10-25 17:26:34 +04:00
|
|
|
|
|
|
|
struct wl_signal destroy_signal;
|
2013-01-07 21:39:49 +04:00
|
|
|
};
|
|
|
|
|
2023-06-09 11:20:56 +03:00
|
|
|
static inline struct pixman_renderbuffer *
|
|
|
|
to_pixman_renderbuffer(struct weston_renderbuffer *renderbuffer)
|
|
|
|
{
|
|
|
|
return container_of(renderbuffer, struct pixman_renderbuffer, base);
|
|
|
|
}
|
|
|
|
|
2023-01-13 18:14:18 +03:00
|
|
|
static pixman_image_t *
|
|
|
|
pixman_renderer_renderbuffer_get_image(struct weston_renderbuffer *renderbuffer)
|
|
|
|
{
|
2023-06-09 11:20:56 +03:00
|
|
|
struct pixman_renderbuffer *rb = to_pixman_renderbuffer(renderbuffer);
|
2023-01-13 18:14:18 +03:00
|
|
|
|
|
|
|
return rb->image;
|
|
|
|
}
|
|
|
|
|
2013-01-07 21:39:49 +04:00
|
|
|
static inline struct pixman_output_state *
|
|
|
|
get_output_state(struct weston_output *output)
|
|
|
|
{
|
|
|
|
return (struct pixman_output_state *)output->renderer_state;
|
|
|
|
}
|
|
|
|
|
2013-10-25 17:26:33 +04:00
|
|
|
static int
|
|
|
|
pixman_renderer_create_surface(struct weston_surface *surface);
|
|
|
|
|
2013-01-07 21:39:49 +04:00
|
|
|
static inline struct pixman_surface_state *
|
|
|
|
get_surface_state(struct weston_surface *surface)
|
|
|
|
{
|
2013-10-25 17:26:33 +04:00
|
|
|
if (!surface->renderer_state)
|
|
|
|
pixman_renderer_create_surface(surface);
|
|
|
|
|
2013-01-07 21:39:49 +04:00
|
|
|
return (struct pixman_surface_state *)surface->renderer_state;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline struct pixman_renderer *
|
|
|
|
get_renderer(struct weston_compositor *ec)
|
|
|
|
{
|
|
|
|
return (struct pixman_renderer *)ec->renderer;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
pixman_renderer_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)
|
2013-01-07 21:39:49 +04:00
|
|
|
{
|
|
|
|
struct pixman_output_state *po = get_output_state(output);
|
|
|
|
pixman_image_t *out_buf;
|
|
|
|
|
|
|
|
if (!po->hw_buffer) {
|
|
|
|
errno = ENODEV;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2022-08-01 13:31:27 +03:00
|
|
|
out_buf = pixman_image_create_bits(format->pixman_format,
|
2013-01-07 21:39:49 +04:00
|
|
|
width,
|
|
|
|
height,
|
|
|
|
pixels,
|
2022-08-01 13:31:27 +03:00
|
|
|
(PIXMAN_FORMAT_BPP(format->pixman_format) / 8) * width);
|
2013-01-07 21:39:49 +04:00
|
|
|
|
2013-05-29 14:01:33 +04:00
|
|
|
pixman_image_composite32(PIXMAN_OP_SRC,
|
|
|
|
po->hw_buffer, /* src */
|
|
|
|
NULL /* mask */,
|
|
|
|
out_buf, /* dest */
|
2019-06-17 00:28:15 +03:00
|
|
|
x, y, /* src_x, src_y */
|
2013-05-29 14:01:33 +04:00
|
|
|
0, 0, /* mask_x, mask_y */
|
|
|
|
0, 0, /* dest_x, dest_y */
|
2022-07-22 12:10:02 +03:00
|
|
|
po->fb_size.width, /* width */
|
|
|
|
po->fb_size.height /* height */);
|
2013-01-07 21:39:49 +04:00
|
|
|
|
|
|
|
pixman_image_unref(out_buf);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-05-22 16:41:36 +04:00
|
|
|
#define D2F(v) pixman_double_to_fixed((double)v)
|
|
|
|
|
2014-03-14 16:38:17 +04:00
|
|
|
static void
|
2014-05-21 00:53:19 +04:00
|
|
|
weston_matrix_to_pixman_transform(pixman_transform_t *pt,
|
|
|
|
const struct weston_matrix *wm)
|
2014-03-14 16:38:17 +04:00
|
|
|
{
|
2014-05-21 00:53:19 +04:00
|
|
|
/* Pixman supports only 2D transform matrix, but Weston uses 3D, *
|
|
|
|
* so we're omitting Z coordinate here. */
|
|
|
|
pt->matrix[0][0] = pixman_double_to_fixed(wm->d[0]);
|
|
|
|
pt->matrix[0][1] = pixman_double_to_fixed(wm->d[4]);
|
|
|
|
pt->matrix[0][2] = pixman_double_to_fixed(wm->d[12]);
|
|
|
|
pt->matrix[1][0] = pixman_double_to_fixed(wm->d[1]);
|
|
|
|
pt->matrix[1][1] = pixman_double_to_fixed(wm->d[5]);
|
|
|
|
pt->matrix[1][2] = pixman_double_to_fixed(wm->d[13]);
|
|
|
|
pt->matrix[2][0] = pixman_double_to_fixed(wm->d[3]);
|
|
|
|
pt->matrix[2][1] = pixman_double_to_fixed(wm->d[7]);
|
|
|
|
pt->matrix[2][2] = pixman_double_to_fixed(wm->d[15]);
|
2014-03-14 16:38:17 +04:00
|
|
|
}
|
|
|
|
|
2015-03-04 17:18:26 +03:00
|
|
|
static bool
|
|
|
|
view_transformation_is_translation(struct weston_view *view)
|
|
|
|
{
|
|
|
|
if (!view->transform.enabled)
|
|
|
|
return true;
|
|
|
|
|
|
|
|
if (view->transform.matrix.type <= WESTON_MATRIX_TRANSFORM_TRANSLATE)
|
|
|
|
return true;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-03-04 17:12:04 +03:00
|
|
|
static void
|
|
|
|
region_intersect_only_translation(pixman_region32_t *result_global,
|
|
|
|
pixman_region32_t *global,
|
|
|
|
pixman_region32_t *surf,
|
|
|
|
struct weston_view *view)
|
|
|
|
{
|
2022-02-09 02:31:55 +03:00
|
|
|
struct weston_coord_surface cs;
|
|
|
|
struct weston_coord_global cg;
|
2015-03-04 17:12:04 +03:00
|
|
|
|
2022-02-09 02:31:55 +03:00
|
|
|
cs = weston_coord_surface(0, 0, view->surface);
|
2015-03-04 17:12:04 +03:00
|
|
|
assert(view_transformation_is_translation(view));
|
|
|
|
|
|
|
|
/* Convert from surface to global coordinates */
|
|
|
|
pixman_region32_copy(result_global, surf);
|
2022-02-09 02:31:55 +03:00
|
|
|
cg = weston_coord_surface_to_global(view, cs);
|
|
|
|
pixman_region32_translate(result_global, cg.c.x, cg.c.y);
|
2015-03-04 17:12:04 +03:00
|
|
|
|
|
|
|
pixman_region32_intersect(result_global, result_global, global);
|
|
|
|
}
|
|
|
|
|
2015-03-05 14:25:19 +03:00
|
|
|
static void
|
|
|
|
composite_whole(pixman_op_t op,
|
|
|
|
pixman_image_t *src,
|
|
|
|
pixman_image_t *mask,
|
|
|
|
pixman_image_t *dest,
|
|
|
|
const pixman_transform_t *transform,
|
|
|
|
pixman_filter_t filter)
|
|
|
|
{
|
|
|
|
int32_t dest_width;
|
|
|
|
int32_t dest_height;
|
|
|
|
|
|
|
|
dest_width = pixman_image_get_width(dest);
|
|
|
|
dest_height = pixman_image_get_height(dest);
|
|
|
|
|
|
|
|
pixman_image_set_transform(src, transform);
|
|
|
|
pixman_image_set_filter(src, filter, NULL, 0);
|
|
|
|
|
pixman-renderer: half-fix bilinear sampling on edges
When weston-desktop-shell uses a solid color for the wallpaper, it creates a
1x1 buffer and uses wp_viewport to scale that up to fullscreen. It's a very
nice memory saving optimization.
If you also have output scale != buffer scale, it means pixman-renderer chooses
bilinear filter. Arguably pixman-renderer should choose bilinear filter also
when wp_viewport implies scaling, but it does not. As w-d-s always sets buffer
scale from output scale, triggering the bilinear filter needs some effort.
What happens when you sample with bilinear filter from a 1x1 buffer, stretching
it to cover a big area? Depends on the repeat mode. The default repeat mode is
NONE, which means that samples outside of the buffer come out as (0,0,0,0).
Bilinear filter makes it so that every sampling point on the 1x1 buffer except
the very center is actually a mixture of the pixel value and (0,0,0,0). The
resulting color is no longer opaque, but the renderer and damage tracking
assume it is. This leads to the issue 373.
Fix half of the issue by using repeat mode PAD which corresponds to OpenGL
CLAMP_TO_EDGE. GL-renderer already uses CLAMP_TO_EDGE always.
This is only a half-fix, because composite_clipped() cannot actually be fixed.
It relies on repeat mode NONE to work. It would need a whole different approach
to rendering potentially non-axis-aligned regions exactly like GL-renderer.
Fixes: https://gitlab.freedesktop.org/wayland/weston/issues/373
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2020-03-11 16:21:04 +03:00
|
|
|
/* bilinear filtering needs the equivalent of OpenGL CLAMP_TO_EDGE */
|
|
|
|
if (filter == PIXMAN_FILTER_NEAREST)
|
|
|
|
pixman_image_set_repeat(src, PIXMAN_REPEAT_NONE);
|
|
|
|
else
|
|
|
|
pixman_image_set_repeat(src, PIXMAN_REPEAT_PAD);
|
|
|
|
|
2015-03-05 14:25:19 +03:00
|
|
|
pixman_image_composite32(op, src, mask, dest,
|
|
|
|
0, 0, /* src_x, src_y */
|
|
|
|
0, 0, /* mask_x, mask_y */
|
|
|
|
0, 0, /* dest_x, dest_y */
|
|
|
|
dest_width, dest_height);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2022-11-03 22:34:17 +03:00
|
|
|
composite_clipped(struct weston_output *output,
|
|
|
|
pixman_image_t *src,
|
2015-03-05 14:25:19 +03:00
|
|
|
pixman_image_t *mask,
|
|
|
|
pixman_image_t *dest,
|
|
|
|
const pixman_transform_t *transform,
|
|
|
|
pixman_filter_t filter,
|
|
|
|
pixman_region32_t *src_clip)
|
|
|
|
{
|
|
|
|
int n_box;
|
|
|
|
pixman_box32_t *boxes;
|
|
|
|
int32_t dest_width;
|
|
|
|
int32_t dest_height;
|
|
|
|
int src_stride;
|
|
|
|
int bitspp;
|
|
|
|
pixman_format_code_t src_format;
|
|
|
|
void *src_data;
|
|
|
|
int i;
|
|
|
|
|
pixman-renderer: half-fix bilinear sampling on edges
When weston-desktop-shell uses a solid color for the wallpaper, it creates a
1x1 buffer and uses wp_viewport to scale that up to fullscreen. It's a very
nice memory saving optimization.
If you also have output scale != buffer scale, it means pixman-renderer chooses
bilinear filter. Arguably pixman-renderer should choose bilinear filter also
when wp_viewport implies scaling, but it does not. As w-d-s always sets buffer
scale from output scale, triggering the bilinear filter needs some effort.
What happens when you sample with bilinear filter from a 1x1 buffer, stretching
it to cover a big area? Depends on the repeat mode. The default repeat mode is
NONE, which means that samples outside of the buffer come out as (0,0,0,0).
Bilinear filter makes it so that every sampling point on the 1x1 buffer except
the very center is actually a mixture of the pixel value and (0,0,0,0). The
resulting color is no longer opaque, but the renderer and damage tracking
assume it is. This leads to the issue 373.
Fix half of the issue by using repeat mode PAD which corresponds to OpenGL
CLAMP_TO_EDGE. GL-renderer already uses CLAMP_TO_EDGE always.
This is only a half-fix, because composite_clipped() cannot actually be fixed.
It relies on repeat mode NONE to work. It would need a whole different approach
to rendering potentially non-axis-aligned regions exactly like GL-renderer.
Fixes: https://gitlab.freedesktop.org/wayland/weston/issues/373
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2020-03-11 16:21:04 +03:00
|
|
|
/*
|
|
|
|
* Hardcoded to use PIXMAN_OP_OVER, because sampling outside of
|
2015-03-05 14:25:19 +03:00
|
|
|
* a Pixman image produces (0,0,0,0) instead of discarding the
|
|
|
|
* fragment.
|
pixman-renderer: half-fix bilinear sampling on edges
When weston-desktop-shell uses a solid color for the wallpaper, it creates a
1x1 buffer and uses wp_viewport to scale that up to fullscreen. It's a very
nice memory saving optimization.
If you also have output scale != buffer scale, it means pixman-renderer chooses
bilinear filter. Arguably pixman-renderer should choose bilinear filter also
when wp_viewport implies scaling, but it does not. As w-d-s always sets buffer
scale from output scale, triggering the bilinear filter needs some effort.
What happens when you sample with bilinear filter from a 1x1 buffer, stretching
it to cover a big area? Depends on the repeat mode. The default repeat mode is
NONE, which means that samples outside of the buffer come out as (0,0,0,0).
Bilinear filter makes it so that every sampling point on the 1x1 buffer except
the very center is actually a mixture of the pixel value and (0,0,0,0). The
resulting color is no longer opaque, but the renderer and damage tracking
assume it is. This leads to the issue 373.
Fix half of the issue by using repeat mode PAD which corresponds to OpenGL
CLAMP_TO_EDGE. GL-renderer already uses CLAMP_TO_EDGE always.
This is only a half-fix, because composite_clipped() cannot actually be fixed.
It relies on repeat mode NONE to work. It would need a whole different approach
to rendering potentially non-axis-aligned regions exactly like GL-renderer.
Fixes: https://gitlab.freedesktop.org/wayland/weston/issues/373
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2020-03-11 16:21:04 +03:00
|
|
|
*
|
|
|
|
* Also repeat mode must be PIXMAN_REPEAT_NONE (the default) to
|
|
|
|
* actually sample (0,0,0,0). This may cause issues for clients that
|
|
|
|
* expect OpenGL CLAMP_TO_EDGE sampling behavior on their buffer.
|
|
|
|
* Using temporary 'boximg' it is not possible to apply CLAMP_TO_EDGE
|
|
|
|
* correctly with bilinear filter. Maybe trapezoid rendering could be
|
|
|
|
* the answer instead of source clip?
|
2015-03-05 14:25:19 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
dest_width = pixman_image_get_width(dest);
|
|
|
|
dest_height = pixman_image_get_height(dest);
|
|
|
|
src_format = pixman_image_get_format(src);
|
|
|
|
src_stride = pixman_image_get_stride(src);
|
|
|
|
bitspp = PIXMAN_FORMAT_BPP(src_format);
|
|
|
|
src_data = pixman_image_get_data(src);
|
|
|
|
|
|
|
|
assert(src_format);
|
|
|
|
|
|
|
|
/* This would be massive overdraw, except when n_box is 1. */
|
|
|
|
boxes = pixman_region32_rectangles(src_clip, &n_box);
|
|
|
|
for (i = 0; i < n_box; i++) {
|
|
|
|
uint8_t *ptr = src_data;
|
|
|
|
pixman_image_t *boximg;
|
|
|
|
pixman_transform_t adj = *transform;
|
|
|
|
|
|
|
|
ptr += boxes[i].y1 * src_stride;
|
|
|
|
ptr += boxes[i].x1 * bitspp / 8;
|
|
|
|
boximg = pixman_image_create_bits_no_clear(src_format,
|
|
|
|
boxes[i].x2 - boxes[i].x1,
|
|
|
|
boxes[i].y2 - boxes[i].y1,
|
|
|
|
(uint32_t *)ptr, src_stride);
|
|
|
|
|
|
|
|
pixman_transform_translate(&adj, NULL,
|
|
|
|
pixman_int_to_fixed(-boxes[i].x1),
|
|
|
|
pixman_int_to_fixed(-boxes[i].y1));
|
|
|
|
pixman_image_set_transform(boximg, &adj);
|
|
|
|
|
|
|
|
pixman_image_set_filter(boximg, filter, NULL, 0);
|
|
|
|
pixman_image_composite32(PIXMAN_OP_OVER, boximg, mask, dest,
|
|
|
|
0, 0, /* src_x, src_y */
|
|
|
|
0, 0, /* mask_x, mask_y */
|
|
|
|
0, 0, /* dest_x, dest_y */
|
|
|
|
dest_width, dest_height);
|
|
|
|
|
|
|
|
pixman_image_unref(boximg);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (n_box > 1) {
|
2022-11-03 22:34:17 +03:00
|
|
|
weston_log_paced(&output->pixman_overdraw_pacer, 1, 0,
|
|
|
|
"Pixman-renderer warning: %dx overdraw\n",
|
|
|
|
n_box);
|
2015-03-05 14:25:19 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-03-05 12:56:29 +03:00
|
|
|
/** Paint an intersected region
|
|
|
|
*
|
2023-01-11 22:42:06 +03:00
|
|
|
* \param pnode The paint node to be painted.
|
2015-03-05 12:56:29 +03:00
|
|
|
* \param repaint_output The region to be painted in output coordinates.
|
2015-03-05 14:25:19 +03:00
|
|
|
* \param source_clip The region of the source image to use, in source image
|
|
|
|
* coordinates. If NULL, use the whole source image.
|
2015-03-05 12:56:29 +03:00
|
|
|
* \param pixman_op Compositing operator, either SRC or OVER.
|
|
|
|
*/
|
2013-01-07 21:39:49 +04:00
|
|
|
static void
|
2023-01-11 22:42:06 +03:00
|
|
|
repaint_region(struct weston_paint_node *pnode,
|
2015-03-05 12:56:29 +03:00
|
|
|
pixman_region32_t *repaint_output,
|
2015-03-05 14:25:19 +03:00
|
|
|
pixman_region32_t *source_clip,
|
2013-05-22 16:41:36 +04:00
|
|
|
pixman_op_t pixman_op)
|
2013-01-07 21:39:49 +04:00
|
|
|
{
|
2023-01-11 22:42:06 +03:00
|
|
|
struct weston_output *output = pnode->output;
|
|
|
|
struct weston_view *ev = pnode->view;
|
2013-01-25 17:13:00 +04:00
|
|
|
struct pixman_renderer *pr =
|
|
|
|
(struct pixman_renderer *) output->compositor->renderer;
|
Split the geometry information from weston_surface out into weston_view
The weston_surface structure is split into two structures:
* The weston_surface structure storres everything required for a
client-side or server-side surface. This includes buffers; callbacks;
backend private data; input, damage, and opaque regions; and a few other
bookkeeping bits.
* The weston_view structure represents an entity in the scenegraph and
storres all of the geometry information. This includes clip region,
alpha, position, and the transformation list as well as all of the
temporary information derived from the geometry state. Because a view,
and not a surface, is a scenegraph element, the view is what is placed
in layers and planes.
There are a few things worth noting about the surface/view split:
1. This is *not* a modification to the protocol. It is, instead, a
modification to Weston's internal scenegraph to allow a single surface
to exist in multiple places at a time. Clients are completely unaware
of how many views to a particular surface exist.
2. A view is considered a direct child of a surface and is destroyed when
the surface is destroyed. Because of this, the view.surface pointer is
always valid and non-null.
3. The compositor's surface_list is replaced with a view_list. Due to
subsurfaces, building the view list is a little more complicated than
it used to be and involves building a tree of views on the fly whenever
subsurfaces are used. However, this means that backends can remain
completely subsurface-agnostic.
4. Surfaces and views both keep track of which outputs they are on.
5. The weston_surface structure now has width and height fields. These
are populated when a new buffer is attached before surface.configure
is called. This is because there are many surface-based operations
that really require the width and height and digging through the views
didn't work well.
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2013-10-13 07:38:11 +04:00
|
|
|
struct pixman_surface_state *ps = get_surface_state(ev->surface);
|
2013-01-07 21:39:49 +04:00
|
|
|
struct pixman_output_state *po = get_output_state(output);
|
2018-04-23 12:44:57 +03:00
|
|
|
pixman_image_t *target_image;
|
2013-05-22 16:41:36 +04:00
|
|
|
pixman_transform_t transform;
|
2015-03-05 14:25:19 +03:00
|
|
|
pixman_filter_t filter;
|
2014-04-07 13:58:45 +04:00
|
|
|
pixman_image_t *mask_image;
|
|
|
|
pixman_color_t mask = { 0, };
|
2013-01-07 21:39:49 +04:00
|
|
|
|
2018-04-23 12:44:57 +03:00
|
|
|
if (po->shadow_image)
|
|
|
|
target_image = po->shadow_image;
|
|
|
|
else
|
|
|
|
target_image = po->hw_buffer;
|
|
|
|
|
|
|
|
/* Clip rendering to the damaged output region */
|
|
|
|
pixman_image_set_clip_region32(target_image, repaint_output);
|
2013-05-22 16:41:36 +04:00
|
|
|
|
2023-01-11 22:59:35 +03:00
|
|
|
weston_matrix_to_pixman_transform(&transform,
|
|
|
|
&pnode->output_to_buffer_matrix);
|
2013-05-22 16:41:36 +04:00
|
|
|
|
2023-01-11 22:58:25 +03:00
|
|
|
if (pnode->needs_filtering)
|
2015-03-05 14:25:19 +03:00
|
|
|
filter = PIXMAN_FILTER_BILINEAR;
|
2013-05-22 16:41:36 +04:00
|
|
|
else
|
2015-03-05 14:25:19 +03:00
|
|
|
filter = PIXMAN_FILTER_NEAREST;
|
2013-05-22 16:41:36 +04:00
|
|
|
|
2013-11-13 19:44:06 +04:00
|
|
|
if (ps->buffer_ref.buffer)
|
|
|
|
wl_shm_buffer_begin_access(ps->buffer_ref.buffer->shm_buffer);
|
|
|
|
|
2014-04-05 07:31:37 +04:00
|
|
|
if (ev->alpha < 1.0) {
|
2014-04-07 13:58:45 +04:00
|
|
|
mask.alpha = 0xffff * ev->alpha;
|
2014-04-05 07:31:37 +04:00
|
|
|
mask_image = pixman_image_create_solid_fill(&mask);
|
2014-04-07 13:58:45 +04:00
|
|
|
} else {
|
2014-04-05 07:31:37 +04:00
|
|
|
mask_image = NULL;
|
2014-04-07 13:58:45 +04:00
|
|
|
}
|
2014-04-05 07:31:37 +04:00
|
|
|
|
2015-03-05 14:25:19 +03:00
|
|
|
if (source_clip)
|
2022-11-03 22:34:17 +03:00
|
|
|
composite_clipped(output, ps->image, mask_image, target_image,
|
2015-03-05 14:25:19 +03:00
|
|
|
&transform, filter, source_clip);
|
|
|
|
else
|
|
|
|
composite_whole(pixman_op, ps->image, mask_image,
|
2018-04-23 12:44:57 +03:00
|
|
|
target_image, &transform, filter);
|
2013-05-22 16:41:36 +04:00
|
|
|
|
2014-04-07 13:58:45 +04:00
|
|
|
if (mask_image)
|
|
|
|
pixman_image_unref(mask_image);
|
|
|
|
|
2013-11-13 19:44:06 +04:00
|
|
|
if (ps->buffer_ref.buffer)
|
|
|
|
wl_shm_buffer_end_access(ps->buffer_ref.buffer->shm_buffer);
|
|
|
|
|
2013-05-22 16:41:36 +04:00
|
|
|
if (pr->repaint_debug)
|
|
|
|
pixman_image_composite32(PIXMAN_OP_OVER,
|
|
|
|
pr->debug_color, /* src */
|
|
|
|
NULL /* mask */,
|
2018-04-23 12:44:57 +03:00
|
|
|
target_image, /* dest */
|
2013-05-22 16:41:36 +04:00
|
|
|
0, 0, /* src_x, src_y */
|
|
|
|
0, 0, /* mask_x, mask_y */
|
|
|
|
0, 0, /* dest_x, dest_y */
|
2022-07-22 12:10:02 +03:00
|
|
|
po->fb_size.width, /* width */
|
|
|
|
po->fb_size.height /* height */);
|
2013-05-22 16:41:36 +04:00
|
|
|
|
2018-04-23 12:44:57 +03:00
|
|
|
pixman_image_set_clip_region32(target_image, NULL);
|
2013-01-07 21:39:49 +04:00
|
|
|
}
|
|
|
|
|
2015-03-05 13:57:35 +03:00
|
|
|
static void
|
2023-01-11 22:42:06 +03:00
|
|
|
draw_node_translated(struct weston_paint_node *pnode,
|
2015-03-05 13:57:35 +03:00
|
|
|
pixman_region32_t *repaint_global)
|
|
|
|
{
|
2023-01-11 22:42:06 +03:00
|
|
|
struct weston_output *output = pnode->output;
|
|
|
|
struct weston_surface *surface = pnode->surface;
|
|
|
|
struct weston_view *view = pnode->view;
|
|
|
|
|
2015-03-05 13:57:35 +03:00
|
|
|
/* non-opaque region in surface coordinates: */
|
|
|
|
pixman_region32_t surface_blend;
|
|
|
|
/* region to be painted in output coordinates: */
|
|
|
|
pixman_region32_t repaint_output;
|
|
|
|
|
|
|
|
pixman_region32_init(&repaint_output);
|
|
|
|
|
|
|
|
/* Blended region is whole surface minus opaque region,
|
|
|
|
* unless surface alpha forces us to blend all.
|
|
|
|
*/
|
|
|
|
pixman_region32_init_rect(&surface_blend, 0, 0,
|
|
|
|
surface->width, surface->height);
|
|
|
|
|
|
|
|
if (!(view->alpha < 1.0)) {
|
|
|
|
pixman_region32_subtract(&surface_blend, &surface_blend,
|
|
|
|
&surface->opaque);
|
|
|
|
|
|
|
|
if (pixman_region32_not_empty(&surface->opaque)) {
|
|
|
|
region_intersect_only_translation(&repaint_output,
|
|
|
|
repaint_global,
|
|
|
|
&surface->opaque,
|
|
|
|
view);
|
2022-09-20 22:53:27 +03:00
|
|
|
weston_region_global_to_output(&repaint_output,
|
|
|
|
output,
|
|
|
|
&repaint_output);
|
2015-03-05 13:57:35 +03:00
|
|
|
|
2023-01-11 22:42:06 +03:00
|
|
|
repaint_region(pnode, &repaint_output, NULL,
|
2015-03-05 13:57:35 +03:00
|
|
|
PIXMAN_OP_SRC);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pixman_region32_not_empty(&surface_blend)) {
|
|
|
|
region_intersect_only_translation(&repaint_output,
|
|
|
|
repaint_global,
|
|
|
|
&surface_blend, view);
|
2022-09-20 22:53:27 +03:00
|
|
|
weston_region_global_to_output(&repaint_output,
|
|
|
|
output,
|
|
|
|
&repaint_output);
|
2015-03-05 13:57:35 +03:00
|
|
|
|
2023-01-11 22:42:06 +03:00
|
|
|
repaint_region(pnode, &repaint_output, NULL, PIXMAN_OP_OVER);
|
2015-03-05 13:57:35 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
pixman_region32_fini(&surface_blend);
|
|
|
|
pixman_region32_fini(&repaint_output);
|
|
|
|
}
|
|
|
|
|
2015-03-05 14:25:19 +03:00
|
|
|
static void
|
2023-01-11 22:42:06 +03:00
|
|
|
draw_node_source_clipped(struct weston_paint_node *pnode,
|
2015-03-05 14:25:19 +03:00
|
|
|
pixman_region32_t *repaint_global)
|
|
|
|
{
|
2023-01-11 22:42:06 +03:00
|
|
|
struct weston_surface *surface = pnode->surface;
|
|
|
|
struct weston_output *output = pnode->output;
|
|
|
|
struct weston_view *view = pnode->view;
|
2015-03-05 14:25:19 +03:00
|
|
|
pixman_region32_t surf_region;
|
|
|
|
pixman_region32_t buffer_region;
|
|
|
|
pixman_region32_t repaint_output;
|
|
|
|
|
|
|
|
/* Do not bother separating the opaque region from non-opaque.
|
|
|
|
* Source clipping requires PIXMAN_OP_OVER in all cases, so painting
|
|
|
|
* opaque separately has no benefit.
|
|
|
|
*/
|
|
|
|
|
|
|
|
pixman_region32_init_rect(&surf_region, 0, 0,
|
|
|
|
surface->width, surface->height);
|
2015-03-06 11:33:50 +03:00
|
|
|
if (view->geometry.scissor_enabled)
|
|
|
|
pixman_region32_intersect(&surf_region, &surf_region,
|
|
|
|
&view->geometry.scissor);
|
|
|
|
|
2015-03-05 14:25:19 +03:00
|
|
|
pixman_region32_init(&buffer_region);
|
|
|
|
weston_surface_to_buffer_region(surface, &surf_region, &buffer_region);
|
|
|
|
|
|
|
|
pixman_region32_init(&repaint_output);
|
|
|
|
pixman_region32_copy(&repaint_output, repaint_global);
|
2022-09-20 22:53:27 +03:00
|
|
|
weston_region_global_to_output(&repaint_output, output,
|
|
|
|
&repaint_output);
|
2015-03-05 14:25:19 +03:00
|
|
|
|
2023-01-11 22:42:06 +03:00
|
|
|
repaint_region(pnode, &repaint_output, &buffer_region, PIXMAN_OP_OVER);
|
2015-03-05 14:25:19 +03:00
|
|
|
|
|
|
|
pixman_region32_fini(&repaint_output);
|
|
|
|
pixman_region32_fini(&buffer_region);
|
|
|
|
pixman_region32_fini(&surf_region);
|
|
|
|
}
|
|
|
|
|
2013-01-07 21:39:49 +04:00
|
|
|
static void
|
2021-05-20 16:57:12 +03:00
|
|
|
draw_paint_node(struct weston_paint_node *pnode,
|
|
|
|
pixman_region32_t *damage /* in global coordinates */)
|
2013-01-07 21:39:49 +04:00
|
|
|
{
|
2021-05-20 16:57:12 +03:00
|
|
|
struct pixman_surface_state *ps = get_surface_state(pnode->surface);
|
2013-01-07 21:39:49 +04:00
|
|
|
/* repaint bounding region in global coordinates: */
|
|
|
|
pixman_region32_t repaint;
|
|
|
|
|
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
|
|
|
if (!pnode->surf_xform_valid)
|
|
|
|
return;
|
|
|
|
|
|
|
|
assert(pnode->surf_xform.transform == NULL);
|
|
|
|
|
2013-01-07 21:39:49 +04:00
|
|
|
/* No buffer attached */
|
|
|
|
if (!ps->image)
|
|
|
|
return;
|
|
|
|
|
2022-04-28 13:28:26 +03:00
|
|
|
/* if we still have a reference, but the underlying buffer is no longer
|
|
|
|
* available signal that we should unref image_t as well. This happens
|
|
|
|
* when using close animations, with the reference surviving the
|
|
|
|
* animation while the underlying buffer went away as the client was
|
|
|
|
* terminated. This is a particular use-case and should probably be
|
|
|
|
* refactored to provide some analogue with the GL-renderer (as in, to
|
|
|
|
* still maintain the buffer and let the compositor dispose of it). */
|
|
|
|
if (ps->buffer_ref.buffer && !ps->buffer_ref.buffer->shm_buffer) {
|
|
|
|
pixman_image_unref(ps->image);
|
|
|
|
ps->image = NULL;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-01-07 21:39:49 +04:00
|
|
|
pixman_region32_init(&repaint);
|
|
|
|
pixman_region32_intersect(&repaint,
|
2021-05-20 16:57:12 +03:00
|
|
|
&pnode->view->transform.boundingbox, damage);
|
|
|
|
pixman_region32_subtract(&repaint, &repaint, &pnode->view->clip);
|
2013-01-07 21:39:49 +04:00
|
|
|
|
|
|
|
if (!pixman_region32_not_empty(&repaint))
|
|
|
|
goto out;
|
|
|
|
|
2021-05-20 16:57:12 +03:00
|
|
|
if (view_transformation_is_translation(pnode->view)) {
|
2015-03-05 14:25:19 +03:00
|
|
|
/* The simple case: The surface regions opaque, non-opaque,
|
|
|
|
* etc. are convertible to global coordinate space.
|
|
|
|
* There is no need to use a source clip region.
|
|
|
|
* It is possible to paint opaque region as PIXMAN_OP_SRC.
|
2015-03-06 11:33:50 +03:00
|
|
|
* Also the boundingbox is accurate rather than an
|
|
|
|
* approximation.
|
2015-03-05 14:25:19 +03:00
|
|
|
*/
|
2023-01-11 22:42:06 +03:00
|
|
|
draw_node_translated(pnode, &repaint);
|
2015-03-05 13:57:35 +03:00
|
|
|
} else {
|
2015-03-05 14:25:19 +03:00
|
|
|
/* The complex case: the view transformation does not allow
|
|
|
|
* converting opaque etc. regions into global coordinate space.
|
|
|
|
* Therefore we need source clipping to avoid sampling from
|
|
|
|
* unwanted source image areas, unless the source image is
|
|
|
|
* to be used whole. Source clipping does not work with
|
|
|
|
* PIXMAN_OP_SRC.
|
|
|
|
*/
|
2023-01-11 22:42:06 +03:00
|
|
|
draw_node_source_clipped(pnode, &repaint);
|
2013-01-07 21:39:49 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
out:
|
|
|
|
pixman_region32_fini(&repaint);
|
|
|
|
}
|
|
|
|
static void
|
|
|
|
repaint_surfaces(struct weston_output *output, pixman_region32_t *damage)
|
|
|
|
{
|
|
|
|
struct weston_compositor *compositor = output->compositor;
|
2021-05-03 14:06:55 +03:00
|
|
|
struct weston_paint_node *pnode;
|
2013-01-07 21:39:49 +04:00
|
|
|
|
2021-05-03 14:06:55 +03:00
|
|
|
wl_list_for_each_reverse(pnode, &output->paint_node_z_order_list,
|
|
|
|
z_order_link) {
|
|
|
|
if (pnode->view->plane == &compositor->primary_plane)
|
2021-05-20 16:57:12 +03:00
|
|
|
draw_paint_node(pnode, damage);
|
2021-05-03 14:06:55 +03:00
|
|
|
}
|
2013-01-07 21:39:49 +04:00
|
|
|
}
|
|
|
|
|
2013-01-25 17:13:01 +04:00
|
|
|
static void
|
|
|
|
copy_to_hw_buffer(struct weston_output *output, pixman_region32_t *region)
|
|
|
|
{
|
|
|
|
struct pixman_output_state *po = get_output_state(output);
|
2013-05-22 16:41:36 +04:00
|
|
|
pixman_region32_t output_region;
|
2013-01-25 17:13:01 +04:00
|
|
|
|
2013-05-22 16:41:36 +04:00
|
|
|
pixman_region32_init(&output_region);
|
|
|
|
pixman_region32_copy(&output_region, region);
|
2013-01-25 17:13:01 +04:00
|
|
|
|
2022-09-20 22:53:27 +03:00
|
|
|
weston_region_global_to_output(&output_region, output, &output_region);
|
2013-01-25 17:13:01 +04:00
|
|
|
|
2013-05-22 16:41:36 +04:00
|
|
|
pixman_image_set_clip_region32 (po->hw_buffer, &output_region);
|
2014-09-03 20:56:53 +04:00
|
|
|
pixman_region32_fini(&output_region);
|
2013-05-22 16:41:36 +04:00
|
|
|
|
|
|
|
pixman_image_composite32(PIXMAN_OP_SRC,
|
|
|
|
po->shadow_image, /* src */
|
|
|
|
NULL /* mask */,
|
|
|
|
po->hw_buffer, /* dest */
|
|
|
|
0, 0, /* src_x, src_y */
|
|
|
|
0, 0, /* mask_x, mask_y */
|
|
|
|
0, 0, /* dest_x, dest_y */
|
2022-07-22 12:10:02 +03:00
|
|
|
po->fb_size.width, /* width */
|
|
|
|
po->fb_size.height /* height */);
|
2013-01-25 17:13:01 +04:00
|
|
|
|
2013-05-22 16:41:36 +04:00
|
|
|
pixman_image_set_clip_region32 (po->hw_buffer, NULL);
|
2013-01-25 17:13:01 +04:00
|
|
|
}
|
|
|
|
|
2022-07-20 15:17:30 +03:00
|
|
|
static void
|
|
|
|
pixman_renderer_do_capture(struct weston_buffer *into, pixman_image_t *from)
|
|
|
|
{
|
|
|
|
struct wl_shm_buffer *shm = into->shm_buffer;
|
|
|
|
pixman_image_t *dest;
|
|
|
|
|
|
|
|
assert(into->type == WESTON_BUFFER_SHM);
|
|
|
|
assert(shm);
|
|
|
|
|
|
|
|
wl_shm_buffer_begin_access(shm);
|
|
|
|
|
|
|
|
dest = pixman_image_create_bits(into->pixel_format->pixman_format,
|
|
|
|
into->width, into->height,
|
|
|
|
wl_shm_buffer_get_data(shm),
|
|
|
|
wl_shm_buffer_get_stride(shm));
|
|
|
|
abort_oom_if_null(dest);
|
|
|
|
|
|
|
|
pixman_image_composite32(PIXMAN_OP_SRC, from, NULL /* mask */, dest,
|
|
|
|
0, 0, /* src_x, src_y */
|
|
|
|
0, 0, /* mask_x, mask_y */
|
|
|
|
0, 0, /* dest_x, dest_y */
|
|
|
|
into->width, into->height);
|
|
|
|
|
|
|
|
pixman_image_unref(dest);
|
|
|
|
|
|
|
|
wl_shm_buffer_end_access(shm);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
pixman_renderer_do_capture_tasks(struct weston_output *output,
|
|
|
|
enum weston_output_capture_source source,
|
|
|
|
pixman_image_t *from,
|
|
|
|
const struct pixel_format_info *pfmt)
|
|
|
|
{
|
|
|
|
int width = pixman_image_get_width(from);
|
|
|
|
int height = pixman_image_get_height(from);
|
|
|
|
struct weston_capture_task *ct;
|
|
|
|
|
|
|
|
while ((ct = weston_output_pull_capture_task(output, source,
|
|
|
|
width, height,
|
|
|
|
pfmt))) {
|
|
|
|
struct weston_buffer *buffer = weston_capture_task_get_buffer(ct);
|
|
|
|
|
|
|
|
assert(buffer->width == width);
|
|
|
|
assert(buffer->height == height);
|
|
|
|
assert(buffer->pixel_format->format == pfmt->format);
|
|
|
|
|
|
|
|
if (buffer->type != WESTON_BUFFER_SHM) {
|
|
|
|
weston_capture_task_retire_failed(ct, "pixman: unsupported buffer");
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
pixman_renderer_do_capture(buffer, from);
|
|
|
|
weston_capture_task_retire_complete(ct);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-01-12 01:01:15 +03:00
|
|
|
static void
|
|
|
|
pixman_renderer_output_set_buffer(struct weston_output *output,
|
|
|
|
pixman_image_t *buffer);
|
|
|
|
|
2013-01-07 21:39:49 +04:00
|
|
|
static void
|
|
|
|
pixman_renderer_repaint_output(struct weston_output *output,
|
2023-01-12 01:01:15 +03:00
|
|
|
pixman_region32_t *output_damage,
|
|
|
|
struct weston_renderbuffer *renderbuffer)
|
2013-01-07 21:39:49 +04:00
|
|
|
{
|
|
|
|
struct pixman_output_state *po = get_output_state(output);
|
2023-01-13 18:14:18 +03:00
|
|
|
struct pixman_renderbuffer *rb;
|
2013-01-07 21:39:49 +04:00
|
|
|
|
2023-01-12 01:01:15 +03:00
|
|
|
assert(renderbuffer);
|
|
|
|
|
2023-06-09 11:20:56 +03:00
|
|
|
rb = to_pixman_renderbuffer(renderbuffer);
|
2023-01-13 18:14:18 +03:00
|
|
|
|
|
|
|
pixman_renderer_output_set_buffer(output, rb->image);
|
2023-01-12 01:01:15 +03:00
|
|
|
|
2021-02-25 13:03:28 +03:00
|
|
|
assert(output->from_blend_to_output_by_backend ||
|
2022-04-28 15:25:00 +03:00
|
|
|
output->color_outcome->from_blend_to_output == NULL);
|
2021-02-25 13:03:28 +03:00
|
|
|
|
2023-01-12 01:34:39 +03:00
|
|
|
if (!po->hw_buffer)
|
2018-04-23 12:44:56 +03:00
|
|
|
return;
|
|
|
|
|
2023-01-12 01:34:39 +03:00
|
|
|
/* Accumulate damage in all renderbuffers */
|
2023-01-13 18:14:18 +03:00
|
|
|
wl_list_for_each(rb, &po->renderbuffer_list, link) {
|
|
|
|
pixman_region32_union(&rb->base.damage,
|
|
|
|
&rb->base.damage,
|
|
|
|
output_damage);
|
|
|
|
}
|
2013-01-07 21:39:49 +04:00
|
|
|
|
2018-04-23 12:44:57 +03:00
|
|
|
if (po->shadow_image) {
|
|
|
|
repaint_surfaces(output, output_damage);
|
2022-07-20 15:17:30 +03:00
|
|
|
pixman_renderer_do_capture_tasks(output,
|
|
|
|
WESTON_OUTPUT_CAPTURE_SOURCE_BLENDING,
|
|
|
|
po->shadow_image, po->shadow_format);
|
2023-01-12 01:34:39 +03:00
|
|
|
copy_to_hw_buffer(output, &renderbuffer->damage);
|
2018-04-23 12:44:57 +03:00
|
|
|
} else {
|
2023-01-12 01:34:39 +03:00
|
|
|
repaint_surfaces(output, &renderbuffer->damage);
|
2018-04-23 12:44:57 +03:00
|
|
|
}
|
2022-07-20 15:17:30 +03:00
|
|
|
pixman_renderer_do_capture_tasks(output,
|
|
|
|
WESTON_OUTPUT_CAPTURE_SOURCE_FRAMEBUFFER,
|
|
|
|
po->hw_buffer, po->hw_format);
|
2023-01-12 01:34:39 +03:00
|
|
|
pixman_region32_clear(&renderbuffer->damage);
|
2013-01-07 21:39:49 +04:00
|
|
|
|
2019-12-09 15:26:57 +03:00
|
|
|
wl_signal_emit(&output->frame_signal, output_damage);
|
2013-01-07 21:39:49 +04:00
|
|
|
|
|
|
|
/* Actual flip should be done by caller */
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2022-01-14 03:03:24 +03:00
|
|
|
pixman_renderer_flush_damage(struct weston_surface *surface,
|
|
|
|
struct weston_buffer *buffer)
|
2013-01-07 21:39:49 +04:00
|
|
|
{
|
|
|
|
/* No-op for pixman renderer */
|
|
|
|
}
|
|
|
|
|
pixman: Destroy pixman images when underlying buffer is destroyed
While the pixman image might be attached, the underlying buffer might be
already gone under certain circumstances. This is easily reproduced by
attempting to resize gnome-terminal on a fbdev backend.
$ WAYLAND_DEBUG=1 strace -emunmap weston --backend=fbdev-backend.so
...
[1524826.942] wl_shm@7.create_pool(new id wl_shm_pool@23, fd 40, 1563540)
[1524827.315] wl_shm_pool@23.create_buffer(new id wl_buffer@24, 0, 759, 515, 3036, 0)
...
[1524829.488] wl_surface@14.attach(wl_buffer@24, 0, 0)
[1524829.766] wl_surface@14.set_buffer_scale(1)
[1524829.904] wl_surface@14.damage(0, 0, 759, 515)
[1524830.248] wl_surface@14.frame(new id wl_callback@25)
[1524830.450] wl_surface@14.commit()
...
[1524846.706] wl_shm@7.create_pool(new id wl_shm_pool@26, fd 40, 1545000)
[1524847.215] wl_shm_pool@26.create_buffer(new id wl_buffer@27, 0, 750, 515, 3000, 0)
[1524847.735] wl_buffer@24.destroy()
[1524847.953] -> wl_display@1.delete_id(24)
[1524848.144] wl_shm_pool@23.destroy()
munmap(0xb5b2e000, 1563540) = 0
[1524849.021] -> wl_display@1.delete_id(23)
[1524849.425] wl_surface@14.attach(wl_buffer@27, 0, 0)
[1524849.730] wl_surface@14.set_buffer_scale(1)
[1524849.821] wl_surface@14.damage(0, 0, 750, 515)
<No commit yet, so drawing is attempted from older buffer that used to be
attached to the surface, which happens to come from a destroyed pool,
resulting it an invalid read from address 0xb5b2e000>
Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
2013-12-12 15:57:56 +04:00
|
|
|
static void
|
|
|
|
buffer_state_handle_buffer_destroy(struct wl_listener *listener, void *data)
|
|
|
|
{
|
|
|
|
struct pixman_surface_state *ps;
|
|
|
|
|
|
|
|
ps = container_of(listener, struct pixman_surface_state,
|
|
|
|
buffer_destroy_listener);
|
|
|
|
|
|
|
|
if (ps->image) {
|
|
|
|
pixman_image_unref(ps->image);
|
|
|
|
ps->image = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
ps->buffer_destroy_listener.notify = NULL;
|
|
|
|
}
|
|
|
|
|
2022-01-15 20:56:15 +03:00
|
|
|
static void
|
|
|
|
pixman_renderer_surface_set_color(struct weston_surface *es,
|
|
|
|
float red, float green, float blue, float alpha)
|
|
|
|
{
|
|
|
|
struct pixman_surface_state *ps = get_surface_state(es);
|
|
|
|
pixman_color_t color;
|
|
|
|
|
|
|
|
color.red = red * 0xffff;
|
|
|
|
color.green = green * 0xffff;
|
|
|
|
color.blue = blue * 0xffff;
|
|
|
|
color.alpha = alpha * 0xffff;
|
|
|
|
|
|
|
|
if (ps->image) {
|
|
|
|
pixman_image_unref(ps->image);
|
|
|
|
ps->image = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
ps->image = pixman_image_create_solid_fill(&color);
|
|
|
|
}
|
|
|
|
|
2013-01-07 21:39:49 +04:00
|
|
|
static void
|
2013-06-21 05:38:23 +04:00
|
|
|
pixman_renderer_attach(struct weston_surface *es, struct weston_buffer *buffer)
|
2013-01-07 21:39:49 +04:00
|
|
|
{
|
|
|
|
struct pixman_surface_state *ps = get_surface_state(es);
|
2013-06-21 05:38:23 +04:00
|
|
|
struct wl_shm_buffer *shm_buffer;
|
2021-07-27 05:29:20 +03:00
|
|
|
const struct pixel_format_info *pixel_info;
|
2013-01-07 21:39:49 +04:00
|
|
|
|
2022-01-15 06:12:53 +03:00
|
|
|
weston_buffer_reference(&ps->buffer_ref, buffer,
|
|
|
|
buffer ? BUFFER_MAY_BE_ACCESSED :
|
|
|
|
BUFFER_WILL_NOT_BE_ACCESSED);
|
2018-10-19 12:14:11 +03:00
|
|
|
weston_buffer_release_reference(&ps->buffer_release_ref,
|
|
|
|
es->buffer_release_ref.buffer_release);
|
2013-01-07 21:39:49 +04:00
|
|
|
|
pixman: Destroy pixman images when underlying buffer is destroyed
While the pixman image might be attached, the underlying buffer might be
already gone under certain circumstances. This is easily reproduced by
attempting to resize gnome-terminal on a fbdev backend.
$ WAYLAND_DEBUG=1 strace -emunmap weston --backend=fbdev-backend.so
...
[1524826.942] wl_shm@7.create_pool(new id wl_shm_pool@23, fd 40, 1563540)
[1524827.315] wl_shm_pool@23.create_buffer(new id wl_buffer@24, 0, 759, 515, 3036, 0)
...
[1524829.488] wl_surface@14.attach(wl_buffer@24, 0, 0)
[1524829.766] wl_surface@14.set_buffer_scale(1)
[1524829.904] wl_surface@14.damage(0, 0, 759, 515)
[1524830.248] wl_surface@14.frame(new id wl_callback@25)
[1524830.450] wl_surface@14.commit()
...
[1524846.706] wl_shm@7.create_pool(new id wl_shm_pool@26, fd 40, 1545000)
[1524847.215] wl_shm_pool@26.create_buffer(new id wl_buffer@27, 0, 750, 515, 3000, 0)
[1524847.735] wl_buffer@24.destroy()
[1524847.953] -> wl_display@1.delete_id(24)
[1524848.144] wl_shm_pool@23.destroy()
munmap(0xb5b2e000, 1563540) = 0
[1524849.021] -> wl_display@1.delete_id(23)
[1524849.425] wl_surface@14.attach(wl_buffer@27, 0, 0)
[1524849.730] wl_surface@14.set_buffer_scale(1)
[1524849.821] wl_surface@14.damage(0, 0, 750, 515)
<No commit yet, so drawing is attempted from older buffer that used to be
attached to the surface, which happens to come from a destroyed pool,
resulting it an invalid read from address 0xb5b2e000>
Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
2013-12-12 15:57:56 +04:00
|
|
|
if (ps->buffer_destroy_listener.notify) {
|
|
|
|
wl_list_remove(&ps->buffer_destroy_listener.link);
|
|
|
|
ps->buffer_destroy_listener.notify = NULL;
|
|
|
|
}
|
|
|
|
|
2013-01-07 21:39:49 +04:00
|
|
|
if (ps->image) {
|
|
|
|
pixman_image_unref(ps->image);
|
|
|
|
ps->image = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!buffer)
|
|
|
|
return;
|
2015-11-19 01:32:29 +03:00
|
|
|
|
2022-01-15 20:56:15 +03:00
|
|
|
if (buffer->type == WESTON_BUFFER_SOLID) {
|
|
|
|
pixman_renderer_surface_set_color(es,
|
|
|
|
buffer->solid.r,
|
|
|
|
buffer->solid.g,
|
|
|
|
buffer->solid.b,
|
|
|
|
buffer->solid.a);
|
|
|
|
weston_buffer_reference(&ps->buffer_ref, NULL,
|
|
|
|
BUFFER_WILL_NOT_BE_ACCESSED);
|
|
|
|
weston_buffer_release_reference(&ps->buffer_release_ref, NULL);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-01-14 04:36:54 +03:00
|
|
|
if (buffer->type != WESTON_BUFFER_SHM) {
|
2013-01-07 21:39:49 +04:00
|
|
|
weston_log("Pixman renderer supports only SHM buffers\n");
|
2022-01-15 06:12:53 +03:00
|
|
|
weston_buffer_reference(&ps->buffer_ref, NULL,
|
|
|
|
BUFFER_WILL_NOT_BE_ACCESSED);
|
2018-10-19 12:14:11 +03:00
|
|
|
weston_buffer_release_reference(&ps->buffer_release_ref, NULL);
|
2013-01-07 21:39:49 +04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-01-14 04:36:54 +03:00
|
|
|
shm_buffer = buffer->shm_buffer;
|
|
|
|
|
2021-07-27 05:29:20 +03:00
|
|
|
pixel_info = pixel_format_get_info_shm(wl_shm_buffer_get_format(shm_buffer));
|
|
|
|
if (!pixel_info || !pixman_format_supported_source(pixel_info->pixman_format)) {
|
2018-10-10 17:14:55 +03:00
|
|
|
weston_log("Unsupported SHM buffer format 0x%x\n",
|
|
|
|
wl_shm_buffer_get_format(shm_buffer));
|
2022-01-15 06:12:53 +03:00
|
|
|
weston_buffer_reference(&ps->buffer_ref, NULL,
|
|
|
|
BUFFER_WILL_NOT_BE_ACCESSED);
|
2018-10-19 12:14:11 +03:00
|
|
|
weston_buffer_release_reference(&ps->buffer_release_ref, NULL);
|
2021-07-31 18:25:41 +03:00
|
|
|
weston_buffer_send_server_error(buffer,
|
2018-10-10 17:14:55 +03:00
|
|
|
"disconnecting due to unhandled buffer type");
|
2013-01-07 21:39:49 +04:00
|
|
|
return;
|
|
|
|
}
|
2013-06-21 05:38:23 +04:00
|
|
|
|
2021-07-27 05:29:20 +03:00
|
|
|
ps->image = pixman_image_create_bits(pixel_info->pixman_format,
|
2013-06-21 05:38:23 +04:00
|
|
|
buffer->width, buffer->height,
|
|
|
|
wl_shm_buffer_get_data(shm_buffer),
|
|
|
|
wl_shm_buffer_get_stride(shm_buffer));
|
pixman: Destroy pixman images when underlying buffer is destroyed
While the pixman image might be attached, the underlying buffer might be
already gone under certain circumstances. This is easily reproduced by
attempting to resize gnome-terminal on a fbdev backend.
$ WAYLAND_DEBUG=1 strace -emunmap weston --backend=fbdev-backend.so
...
[1524826.942] wl_shm@7.create_pool(new id wl_shm_pool@23, fd 40, 1563540)
[1524827.315] wl_shm_pool@23.create_buffer(new id wl_buffer@24, 0, 759, 515, 3036, 0)
...
[1524829.488] wl_surface@14.attach(wl_buffer@24, 0, 0)
[1524829.766] wl_surface@14.set_buffer_scale(1)
[1524829.904] wl_surface@14.damage(0, 0, 759, 515)
[1524830.248] wl_surface@14.frame(new id wl_callback@25)
[1524830.450] wl_surface@14.commit()
...
[1524846.706] wl_shm@7.create_pool(new id wl_shm_pool@26, fd 40, 1545000)
[1524847.215] wl_shm_pool@26.create_buffer(new id wl_buffer@27, 0, 750, 515, 3000, 0)
[1524847.735] wl_buffer@24.destroy()
[1524847.953] -> wl_display@1.delete_id(24)
[1524848.144] wl_shm_pool@23.destroy()
munmap(0xb5b2e000, 1563540) = 0
[1524849.021] -> wl_display@1.delete_id(23)
[1524849.425] wl_surface@14.attach(wl_buffer@27, 0, 0)
[1524849.730] wl_surface@14.set_buffer_scale(1)
[1524849.821] wl_surface@14.damage(0, 0, 750, 515)
<No commit yet, so drawing is attempted from older buffer that used to be
attached to the surface, which happens to come from a destroyed pool,
resulting it an invalid read from address 0xb5b2e000>
Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
2013-12-12 15:57:56 +04:00
|
|
|
|
|
|
|
ps->buffer_destroy_listener.notify =
|
|
|
|
buffer_state_handle_buffer_destroy;
|
|
|
|
wl_signal_add(&buffer->destroy_signal,
|
|
|
|
&ps->buffer_destroy_listener);
|
2013-01-07 21:39:49 +04:00
|
|
|
}
|
|
|
|
|
2013-10-25 17:26:33 +04:00
|
|
|
static void
|
2013-10-25 17:26:34 +04:00
|
|
|
pixman_renderer_surface_state_destroy(struct pixman_surface_state *ps)
|
2013-10-25 17:26:33 +04:00
|
|
|
{
|
2013-10-25 17:26:34 +04:00
|
|
|
wl_list_remove(&ps->surface_destroy_listener.link);
|
|
|
|
wl_list_remove(&ps->renderer_destroy_listener.link);
|
pixman: Destroy pixman images when underlying buffer is destroyed
While the pixman image might be attached, the underlying buffer might be
already gone under certain circumstances. This is easily reproduced by
attempting to resize gnome-terminal on a fbdev backend.
$ WAYLAND_DEBUG=1 strace -emunmap weston --backend=fbdev-backend.so
...
[1524826.942] wl_shm@7.create_pool(new id wl_shm_pool@23, fd 40, 1563540)
[1524827.315] wl_shm_pool@23.create_buffer(new id wl_buffer@24, 0, 759, 515, 3036, 0)
...
[1524829.488] wl_surface@14.attach(wl_buffer@24, 0, 0)
[1524829.766] wl_surface@14.set_buffer_scale(1)
[1524829.904] wl_surface@14.damage(0, 0, 759, 515)
[1524830.248] wl_surface@14.frame(new id wl_callback@25)
[1524830.450] wl_surface@14.commit()
...
[1524846.706] wl_shm@7.create_pool(new id wl_shm_pool@26, fd 40, 1545000)
[1524847.215] wl_shm_pool@26.create_buffer(new id wl_buffer@27, 0, 750, 515, 3000, 0)
[1524847.735] wl_buffer@24.destroy()
[1524847.953] -> wl_display@1.delete_id(24)
[1524848.144] wl_shm_pool@23.destroy()
munmap(0xb5b2e000, 1563540) = 0
[1524849.021] -> wl_display@1.delete_id(23)
[1524849.425] wl_surface@14.attach(wl_buffer@27, 0, 0)
[1524849.730] wl_surface@14.set_buffer_scale(1)
[1524849.821] wl_surface@14.damage(0, 0, 750, 515)
<No commit yet, so drawing is attempted from older buffer that used to be
attached to the surface, which happens to come from a destroyed pool,
resulting it an invalid read from address 0xb5b2e000>
Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
2013-12-12 15:57:56 +04:00
|
|
|
if (ps->buffer_destroy_listener.notify) {
|
|
|
|
wl_list_remove(&ps->buffer_destroy_listener.link);
|
|
|
|
ps->buffer_destroy_listener.notify = NULL;
|
|
|
|
}
|
2013-10-25 17:26:33 +04:00
|
|
|
|
|
|
|
ps->surface->renderer_state = NULL;
|
|
|
|
|
|
|
|
if (ps->image) {
|
|
|
|
pixman_image_unref(ps->image);
|
|
|
|
ps->image = NULL;
|
|
|
|
}
|
2022-01-15 06:12:53 +03:00
|
|
|
weston_buffer_reference(&ps->buffer_ref, NULL,
|
|
|
|
BUFFER_WILL_NOT_BE_ACCESSED);
|
2018-10-19 12:14:11 +03:00
|
|
|
weston_buffer_release_reference(&ps->buffer_release_ref, NULL);
|
2013-10-25 17:26:33 +04:00
|
|
|
free(ps);
|
|
|
|
}
|
|
|
|
|
2013-10-25 17:26:34 +04:00
|
|
|
static void
|
|
|
|
surface_state_handle_surface_destroy(struct wl_listener *listener, void *data)
|
|
|
|
{
|
|
|
|
struct pixman_surface_state *ps;
|
|
|
|
|
|
|
|
ps = container_of(listener, struct pixman_surface_state,
|
|
|
|
surface_destroy_listener);
|
|
|
|
|
|
|
|
pixman_renderer_surface_state_destroy(ps);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
surface_state_handle_renderer_destroy(struct wl_listener *listener, void *data)
|
|
|
|
{
|
|
|
|
struct pixman_surface_state *ps;
|
|
|
|
|
|
|
|
ps = container_of(listener, struct pixman_surface_state,
|
|
|
|
renderer_destroy_listener);
|
|
|
|
|
|
|
|
pixman_renderer_surface_state_destroy(ps);
|
|
|
|
}
|
|
|
|
|
2013-01-07 21:39:49 +04:00
|
|
|
static int
|
|
|
|
pixman_renderer_create_surface(struct weston_surface *surface)
|
|
|
|
{
|
|
|
|
struct pixman_surface_state *ps;
|
2013-10-25 17:26:34 +04:00
|
|
|
struct pixman_renderer *pr = get_renderer(surface->compositor);
|
2013-01-07 21:39:49 +04:00
|
|
|
|
2014-11-21 09:21:57 +03:00
|
|
|
ps = zalloc(sizeof *ps);
|
|
|
|
if (ps == NULL)
|
2013-01-07 21:39:49 +04:00
|
|
|
return -1;
|
|
|
|
|
|
|
|
surface->renderer_state = ps;
|
|
|
|
|
2013-10-25 17:26:33 +04:00
|
|
|
ps->surface = surface;
|
|
|
|
|
|
|
|
ps->surface_destroy_listener.notify =
|
|
|
|
surface_state_handle_surface_destroy;
|
|
|
|
wl_signal_add(&surface->destroy_signal,
|
|
|
|
&ps->surface_destroy_listener);
|
|
|
|
|
2013-10-25 17:26:34 +04:00
|
|
|
ps->renderer_destroy_listener.notify =
|
|
|
|
surface_state_handle_renderer_destroy;
|
|
|
|
wl_signal_add(&pr->destroy_signal,
|
|
|
|
&ps->renderer_destroy_listener);
|
|
|
|
|
2013-01-07 21:39:49 +04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-01-08 20:09:01 +04:00
|
|
|
static void
|
2013-01-07 21:39:49 +04:00
|
|
|
pixman_renderer_destroy(struct weston_compositor *ec)
|
|
|
|
{
|
2013-10-25 17:26:32 +04:00
|
|
|
struct pixman_renderer *pr = get_renderer(ec);
|
|
|
|
|
2013-10-25 17:26:34 +04:00
|
|
|
wl_signal_emit(&pr->destroy_signal, pr);
|
2013-10-25 17:26:32 +04:00
|
|
|
weston_binding_destroy(pr->debug_binding);
|
|
|
|
free(pr);
|
|
|
|
|
2013-01-07 21:39:49 +04:00
|
|
|
ec->renderer = NULL;
|
|
|
|
}
|
|
|
|
|
2015-02-11 13:29:56 +03:00
|
|
|
static int
|
|
|
|
pixman_renderer_surface_copy_content(struct weston_surface *surface,
|
|
|
|
void *target, size_t size,
|
|
|
|
int src_x, int src_y,
|
|
|
|
int width, int height)
|
|
|
|
{
|
|
|
|
const pixman_format_code_t format = PIXMAN_a8b8g8r8;
|
|
|
|
const size_t bytespp = 4; /* PIXMAN_a8b8g8r8 */
|
|
|
|
struct pixman_surface_state *ps = get_surface_state(surface);
|
|
|
|
pixman_image_t *out_buf;
|
|
|
|
|
|
|
|
if (!ps->image)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
out_buf = pixman_image_create_bits(format, width, height,
|
|
|
|
target, width * bytespp);
|
|
|
|
|
|
|
|
pixman_image_set_transform(ps->image, NULL);
|
|
|
|
pixman_image_composite32(PIXMAN_OP_SRC,
|
|
|
|
ps->image, /* src */
|
|
|
|
NULL, /* mask */
|
|
|
|
out_buf, /* dest */
|
|
|
|
src_x, src_y, /* src_x, src_y */
|
|
|
|
0, 0, /* mask_x, mask_y */
|
|
|
|
0, 0, /* dest_x, dest_y */
|
|
|
|
width, height);
|
|
|
|
|
|
|
|
pixman_image_unref(out_buf);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2022-07-22 11:30:04 +03:00
|
|
|
static bool
|
|
|
|
pixman_renderer_resize_output(struct weston_output *output,
|
|
|
|
const struct weston_size *fb_size,
|
|
|
|
const struct weston_geometry *area)
|
|
|
|
{
|
2022-07-22 11:59:27 +03:00
|
|
|
struct pixman_output_state *po = get_output_state(output);
|
2023-01-26 18:38:34 +03:00
|
|
|
struct pixman_renderbuffer *renderbuffer, *tmp;
|
2022-07-22 11:59:27 +03:00
|
|
|
|
2022-07-22 11:30:04 +03:00
|
|
|
check_compositing_area(fb_size, area);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Pixman-renderer does not implement output decorations blitting,
|
|
|
|
* wayland-backend does it on its own.
|
|
|
|
*/
|
|
|
|
assert(area->x == 0);
|
|
|
|
assert(area->y == 0);
|
|
|
|
assert(fb_size->width == area->width);
|
|
|
|
assert(fb_size->height == area->height);
|
|
|
|
|
2022-07-22 11:59:27 +03:00
|
|
|
pixman_renderer_output_set_buffer(output, NULL);
|
|
|
|
|
2023-01-26 18:38:34 +03:00
|
|
|
wl_list_for_each_safe(renderbuffer, tmp, &po->renderbuffer_list, link) {
|
|
|
|
wl_list_remove(&renderbuffer->link);
|
|
|
|
weston_renderbuffer_unref(&renderbuffer->base);
|
|
|
|
}
|
|
|
|
|
2022-07-22 12:10:02 +03:00
|
|
|
po->fb_size = *fb_size;
|
|
|
|
|
2022-07-20 15:17:30 +03:00
|
|
|
/*
|
|
|
|
* Have a hw_format only after the first call to
|
|
|
|
* pixman_renderer_output_set_buffer().
|
|
|
|
*/
|
|
|
|
if (po->hw_format) {
|
|
|
|
weston_output_update_capture_info(output,
|
|
|
|
WESTON_OUTPUT_CAPTURE_SOURCE_FRAMEBUFFER,
|
|
|
|
po->fb_size.width,
|
|
|
|
po->fb_size.height,
|
2023-01-26 14:07:15 +03:00
|
|
|
po->hw_format);
|
2022-07-20 15:17:30 +03:00
|
|
|
}
|
|
|
|
|
2022-07-22 11:59:27 +03:00
|
|
|
if (!po->shadow_format)
|
|
|
|
return true;
|
|
|
|
|
|
|
|
if (po->shadow_image)
|
|
|
|
pixman_image_unref(po->shadow_image);
|
|
|
|
|
|
|
|
po->shadow_image =
|
|
|
|
pixman_image_create_bits_no_clear(po->shadow_format->pixman_format,
|
|
|
|
fb_size->width, fb_size->height,
|
|
|
|
NULL, 0);
|
|
|
|
|
2022-07-20 15:17:30 +03:00
|
|
|
weston_output_update_capture_info(output,
|
|
|
|
WESTON_OUTPUT_CAPTURE_SOURCE_BLENDING,
|
|
|
|
po->fb_size.width,
|
|
|
|
po->fb_size.height,
|
2023-01-26 14:07:15 +03:00
|
|
|
po->shadow_format);
|
2022-07-20 15:17:30 +03:00
|
|
|
|
2022-07-22 11:59:27 +03:00
|
|
|
return !!po->shadow_image;
|
2022-07-22 11:30:04 +03:00
|
|
|
}
|
|
|
|
|
2013-01-25 17:13:00 +04:00
|
|
|
static void
|
2017-11-16 19:20:57 +03:00
|
|
|
debug_binding(struct weston_keyboard *keyboard, const struct timespec *time,
|
|
|
|
uint32_t key, void *data)
|
2013-01-25 17:13:00 +04:00
|
|
|
{
|
|
|
|
struct weston_compositor *ec = data;
|
|
|
|
struct pixman_renderer *pr = (struct pixman_renderer *) ec->renderer;
|
|
|
|
|
|
|
|
pr->repaint_debug ^= 1;
|
|
|
|
|
|
|
|
if (pr->repaint_debug) {
|
|
|
|
pixman_color_t red = {
|
|
|
|
0x3fff, 0x0000, 0x0000, 0x3fff
|
|
|
|
};
|
|
|
|
|
|
|
|
pr->debug_color = pixman_image_create_solid_fill(&red);
|
|
|
|
} else {
|
|
|
|
pixman_image_unref(pr->debug_color);
|
|
|
|
weston_compositor_damage_all(ec);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-01-11 23:28:52 +03:00
|
|
|
static struct pixman_renderer_interface pixman_renderer_interface;
|
|
|
|
|
2013-01-07 21:39:49 +04:00
|
|
|
WL_EXPORT int
|
|
|
|
pixman_renderer_init(struct weston_compositor *ec)
|
|
|
|
{
|
2013-01-25 17:13:00 +04:00
|
|
|
struct pixman_renderer *renderer;
|
2021-07-27 05:29:20 +03:00
|
|
|
const struct pixel_format_info *pixel_info, *info_argb8888, *info_xrgb8888;
|
|
|
|
unsigned int i, num_formats;
|
2013-01-07 21:39:49 +04:00
|
|
|
|
2014-11-21 09:21:57 +03:00
|
|
|
renderer = zalloc(sizeof *renderer);
|
2013-01-07 21:39:49 +04:00
|
|
|
if (renderer == NULL)
|
|
|
|
return -1;
|
|
|
|
|
2013-03-08 23:35:39 +04:00
|
|
|
renderer->repaint_debug = 0;
|
|
|
|
renderer->debug_color = NULL;
|
2013-01-25 17:13:00 +04:00
|
|
|
renderer->base.read_pixels = pixman_renderer_read_pixels;
|
|
|
|
renderer->base.repaint_output = pixman_renderer_repaint_output;
|
2022-07-22 11:30:04 +03:00
|
|
|
renderer->base.resize_output = pixman_renderer_resize_output;
|
2013-01-25 17:13:00 +04:00
|
|
|
renderer->base.flush_damage = pixman_renderer_flush_damage;
|
|
|
|
renderer->base.attach = pixman_renderer_attach;
|
|
|
|
renderer->base.destroy = pixman_renderer_destroy;
|
2015-02-11 13:29:56 +03:00
|
|
|
renderer->base.surface_copy_content =
|
|
|
|
pixman_renderer_surface_copy_content;
|
2022-11-30 12:34:52 +03:00
|
|
|
renderer->base.type = WESTON_RENDERER_PIXMAN;
|
2023-01-11 23:28:52 +03:00
|
|
|
renderer->base.pixman = &pixman_renderer_interface;
|
2013-01-25 17:13:00 +04:00
|
|
|
ec->renderer = &renderer->base;
|
2013-05-22 19:03:04 +04:00
|
|
|
ec->capabilities |= WESTON_CAP_ROTATION_ANY;
|
2015-03-06 11:33:50 +03:00
|
|
|
ec->capabilities |= WESTON_CAP_VIEW_CLIP_MASK;
|
2013-01-25 17:13:00 +04:00
|
|
|
|
2013-10-25 17:26:32 +04:00
|
|
|
renderer->debug_binding =
|
|
|
|
weston_compositor_add_debug_binding(ec, KEY_R,
|
|
|
|
debug_binding, ec);
|
2013-08-06 22:05:56 +04:00
|
|
|
|
2021-07-27 05:29:20 +03:00
|
|
|
info_argb8888 = pixel_format_get_info_shm(WL_SHM_FORMAT_ARGB8888);
|
|
|
|
info_xrgb8888 = pixel_format_get_info_shm(WL_SHM_FORMAT_XRGB8888);
|
|
|
|
|
|
|
|
num_formats = pixel_format_get_info_count();
|
|
|
|
for (i = 0; i < num_formats; i++) {
|
|
|
|
pixel_info = pixel_format_get_info_by_index(i);
|
|
|
|
if (!pixman_format_supported_source(pixel_info->pixman_format))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
/* skip formats which libwayland registers by default */
|
|
|
|
if (pixel_info == info_argb8888 || pixel_info == info_xrgb8888)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
wl_display_add_shm_format(ec->wl_display, pixel_info->format);
|
|
|
|
}
|
2013-08-06 22:05:56 +04:00
|
|
|
|
2013-10-25 17:26:34 +04:00
|
|
|
wl_signal_init(&renderer->destroy_signal);
|
|
|
|
|
2013-01-07 21:39:49 +04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2023-01-12 01:01:15 +03:00
|
|
|
static void
|
2018-04-23 12:44:56 +03:00
|
|
|
pixman_renderer_output_set_buffer(struct weston_output *output,
|
|
|
|
pixman_image_t *buffer)
|
2013-01-07 21:39:49 +04:00
|
|
|
{
|
2022-07-20 15:17:30 +03:00
|
|
|
struct weston_compositor *compositor = output->compositor;
|
2013-01-07 21:39:49 +04:00
|
|
|
struct pixman_output_state *po = get_output_state(output);
|
2022-08-01 13:31:27 +03:00
|
|
|
pixman_format_code_t pixman_format;
|
2013-01-07 21:39:49 +04:00
|
|
|
|
|
|
|
if (po->hw_buffer)
|
|
|
|
pixman_image_unref(po->hw_buffer);
|
|
|
|
po->hw_buffer = buffer;
|
|
|
|
|
2022-07-20 15:17:30 +03:00
|
|
|
if (!po->hw_buffer)
|
|
|
|
return;
|
2022-07-22 12:10:02 +03:00
|
|
|
|
2022-07-20 15:17:30 +03:00
|
|
|
pixman_format = pixman_image_get_format(po->hw_buffer);
|
|
|
|
po->hw_format = pixel_format_get_info_by_pixman(pixman_format);
|
|
|
|
compositor->read_format = po->hw_format;
|
|
|
|
assert(po->hw_format);
|
|
|
|
|
|
|
|
pixman_image_ref(po->hw_buffer);
|
|
|
|
|
|
|
|
assert(po->fb_size.width == pixman_image_get_width(po->hw_buffer));
|
|
|
|
assert(po->fb_size.height == pixman_image_get_height(po->hw_buffer));
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The size cannot change, but the format might, or we did not have
|
|
|
|
* hw_format in pixman_renderer_resize_output() yet.
|
|
|
|
*/
|
|
|
|
weston_output_update_capture_info(output,
|
|
|
|
WESTON_OUTPUT_CAPTURE_SOURCE_FRAMEBUFFER,
|
|
|
|
po->fb_size.width,
|
|
|
|
po->fb_size.height,
|
2023-01-26 14:07:15 +03:00
|
|
|
po->hw_format);
|
2013-01-07 21:39:49 +04:00
|
|
|
}
|
|
|
|
|
2023-01-11 23:28:52 +03:00
|
|
|
static int
|
2020-03-06 15:46:30 +03:00
|
|
|
pixman_renderer_output_create(struct weston_output *output,
|
|
|
|
const struct pixman_renderer_output_options *options)
|
2013-01-07 21:39:49 +04:00
|
|
|
{
|
2014-11-21 09:21:57 +03:00
|
|
|
struct pixman_output_state *po;
|
2022-07-22 11:59:27 +03:00
|
|
|
struct weston_geometry area = {
|
|
|
|
.x = 0,
|
|
|
|
.y = 0,
|
2022-07-22 14:47:03 +03:00
|
|
|
.width = options->fb_size.width,
|
|
|
|
.height = options->fb_size.height
|
2022-07-22 11:59:27 +03:00
|
|
|
};
|
2013-01-07 21:39:49 +04:00
|
|
|
|
2014-11-21 09:21:57 +03:00
|
|
|
po = zalloc(sizeof *po);
|
|
|
|
if (po == NULL)
|
2013-01-07 21:39:49 +04:00
|
|
|
return -1;
|
2013-01-25 17:13:01 +04:00
|
|
|
|
2022-07-22 11:59:27 +03:00
|
|
|
output->renderer_state = po;
|
2013-01-25 17:13:01 +04:00
|
|
|
|
2022-07-22 11:59:27 +03:00
|
|
|
if (options->use_shadow)
|
|
|
|
po->shadow_format = pixel_format_get_info(DRM_FORMAT_XRGB8888);
|
2013-01-25 17:13:01 +04:00
|
|
|
|
2023-01-26 18:38:34 +03:00
|
|
|
wl_list_init(&po->renderbuffer_list);
|
|
|
|
|
2022-07-22 14:47:03 +03:00
|
|
|
if (!pixman_renderer_resize_output(output, &options->fb_size, &area)) {
|
2022-07-22 11:59:27 +03:00
|
|
|
output->renderer_state = NULL;
|
|
|
|
free(po);
|
|
|
|
return -1;
|
2013-01-25 17:13:01 +04:00
|
|
|
}
|
|
|
|
|
2023-01-18 15:55:25 +03:00
|
|
|
weston_output_update_capture_info(output,
|
|
|
|
WESTON_OUTPUT_CAPTURE_SOURCE_FRAMEBUFFER,
|
|
|
|
area.width, area.height,
|
2023-01-26 14:07:15 +03:00
|
|
|
options->format);
|
2023-01-18 15:55:25 +03:00
|
|
|
|
2013-01-07 21:39:49 +04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2023-01-11 23:28:52 +03:00
|
|
|
static void
|
2013-01-07 21:39:49 +04:00
|
|
|
pixman_renderer_output_destroy(struct weston_output *output)
|
|
|
|
{
|
|
|
|
struct pixman_output_state *po = get_output_state(output);
|
2023-01-26 18:38:34 +03:00
|
|
|
struct pixman_renderbuffer *renderbuffer, *tmp;
|
2013-01-07 21:39:49 +04:00
|
|
|
|
2018-04-23 12:44:57 +03:00
|
|
|
if (po->shadow_image)
|
|
|
|
pixman_image_unref(po->shadow_image);
|
2013-01-25 17:13:06 +04:00
|
|
|
|
|
|
|
if (po->hw_buffer)
|
|
|
|
pixman_image_unref(po->hw_buffer);
|
2013-01-25 17:13:01 +04:00
|
|
|
|
|
|
|
po->shadow_image = NULL;
|
2013-01-07 21:39:49 +04:00
|
|
|
po->hw_buffer = NULL;
|
|
|
|
|
2023-01-26 18:38:34 +03:00
|
|
|
wl_list_for_each_safe(renderbuffer, tmp, &po->renderbuffer_list, link) {
|
|
|
|
wl_list_remove(&renderbuffer->link);
|
|
|
|
weston_renderbuffer_unref(&renderbuffer->base);
|
|
|
|
}
|
2023-01-12 01:34:39 +03:00
|
|
|
|
2013-01-07 21:39:49 +04:00
|
|
|
free(po);
|
|
|
|
}
|
2023-01-11 23:28:52 +03:00
|
|
|
|
2023-01-24 09:36:59 +03:00
|
|
|
static void
|
|
|
|
pixman_renderer_renderbuffer_destroy(struct weston_renderbuffer *renderbuffer);
|
|
|
|
|
2023-01-11 23:53:43 +03:00
|
|
|
static struct weston_renderbuffer *
|
|
|
|
pixman_renderer_create_image_from_ptr(struct weston_output *output,
|
2023-01-26 14:30:23 +03:00
|
|
|
const struct pixel_format_info *format,
|
|
|
|
int width, int height, uint32_t *ptr,
|
|
|
|
int rowstride)
|
2023-01-11 23:53:43 +03:00
|
|
|
{
|
2023-01-12 01:34:39 +03:00
|
|
|
struct pixman_output_state *po = get_output_state(output);
|
2023-01-13 18:14:18 +03:00
|
|
|
struct pixman_renderbuffer *renderbuffer;
|
2023-01-11 23:53:43 +03:00
|
|
|
|
2023-01-12 01:34:39 +03:00
|
|
|
assert(po);
|
|
|
|
|
2023-01-11 23:53:43 +03:00
|
|
|
renderbuffer = xzalloc(sizeof(*renderbuffer));
|
|
|
|
|
2023-01-26 14:30:23 +03:00
|
|
|
renderbuffer->image = pixman_image_create_bits(format->pixman_format,
|
|
|
|
width, height, ptr,
|
|
|
|
rowstride);
|
2023-01-11 23:53:43 +03:00
|
|
|
if (!renderbuffer->image) {
|
|
|
|
free(renderbuffer);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2023-01-13 18:14:18 +03:00
|
|
|
pixman_region32_init(&renderbuffer->base.damage);
|
2023-01-26 18:38:34 +03:00
|
|
|
renderbuffer->base.refcount = 2;
|
2023-01-24 09:36:59 +03:00
|
|
|
renderbuffer->base.destroy = pixman_renderer_renderbuffer_destroy;
|
2023-01-12 01:34:39 +03:00
|
|
|
wl_list_insert(&po->renderbuffer_list, &renderbuffer->link);
|
|
|
|
|
2023-01-13 18:14:18 +03:00
|
|
|
return &renderbuffer->base;
|
2023-01-11 23:53:43 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
static struct weston_renderbuffer *
|
2023-01-26 14:49:33 +03:00
|
|
|
pixman_renderer_create_image(struct weston_output *output,
|
2023-01-26 14:30:23 +03:00
|
|
|
const struct pixel_format_info *format, int width,
|
|
|
|
int height)
|
2023-01-11 23:53:43 +03:00
|
|
|
{
|
2023-01-12 01:34:39 +03:00
|
|
|
struct pixman_output_state *po = get_output_state(output);
|
2023-01-13 18:14:18 +03:00
|
|
|
struct pixman_renderbuffer *renderbuffer;
|
2023-01-11 23:53:43 +03:00
|
|
|
|
2023-01-12 01:34:39 +03:00
|
|
|
assert(po);
|
|
|
|
|
2023-01-11 23:53:43 +03:00
|
|
|
renderbuffer = xzalloc(sizeof(*renderbuffer));
|
|
|
|
|
|
|
|
renderbuffer->image =
|
2023-01-26 14:30:23 +03:00
|
|
|
pixman_image_create_bits_no_clear(format->pixman_format, width,
|
|
|
|
height, NULL, 0);
|
2023-01-11 23:53:43 +03:00
|
|
|
if (!renderbuffer->image) {
|
|
|
|
free(renderbuffer);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2023-01-13 18:14:18 +03:00
|
|
|
pixman_region32_init(&renderbuffer->base.damage);
|
2023-01-26 18:38:34 +03:00
|
|
|
renderbuffer->base.refcount = 2;
|
2023-01-24 09:36:59 +03:00
|
|
|
renderbuffer->base.destroy = pixman_renderer_renderbuffer_destroy;
|
2023-01-12 01:34:39 +03:00
|
|
|
wl_list_insert(&po->renderbuffer_list, &renderbuffer->link);
|
|
|
|
|
2023-01-13 18:14:18 +03:00
|
|
|
return &renderbuffer->base;
|
2023-01-11 23:53:43 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
pixman_renderer_renderbuffer_destroy(struct weston_renderbuffer *renderbuffer)
|
|
|
|
{
|
2023-06-09 11:20:56 +03:00
|
|
|
struct pixman_renderbuffer *rb = to_pixman_renderbuffer(renderbuffer);
|
2023-01-13 18:14:18 +03:00
|
|
|
|
|
|
|
pixman_image_unref(rb->image);
|
|
|
|
pixman_region32_fini(&rb->base.damage);
|
|
|
|
free(rb);
|
2023-01-11 23:53:43 +03:00
|
|
|
}
|
|
|
|
|
2023-01-11 23:28:52 +03:00
|
|
|
static struct pixman_renderer_interface pixman_renderer_interface = {
|
|
|
|
.output_create = pixman_renderer_output_create,
|
|
|
|
.output_destroy = pixman_renderer_output_destroy,
|
2023-01-11 23:53:43 +03:00
|
|
|
.create_image_from_ptr = pixman_renderer_create_image_from_ptr,
|
2023-01-26 14:49:33 +03:00
|
|
|
.create_image = pixman_renderer_create_image,
|
2023-01-13 18:14:18 +03:00
|
|
|
.renderbuffer_get_image = pixman_renderer_renderbuffer_get_image,
|
2023-01-11 23:28:52 +03:00
|
|
|
};
|