renderers: Pass a paint node to the attach callbacks
Since we only call this from the paint node update code now, we can pass the paint node directly. A bit of internal refactoring is required to support copy_content. Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This commit is contained in:
parent
c08a6ff8bd
commit
290301882f
|
@ -267,8 +267,7 @@ paint_node_update_late(struct weston_paint_node *pnode)
|
|||
}
|
||||
|
||||
if (buffer_dirty)
|
||||
surf->compositor->renderer->attach(surf,
|
||||
surf->buffer_ref.buffer);
|
||||
surf->compositor->renderer->attach(pnode);
|
||||
|
||||
pnode->status &= ~(PAINT_NODE_VISIBILITY_DIRTY |
|
||||
PAINT_NODE_PLANE_DIRTY |
|
||||
|
|
|
@ -80,7 +80,7 @@ struct weston_renderer {
|
|||
const struct weston_geometry *area);
|
||||
|
||||
void (*flush_damage)(struct weston_paint_node *pnode);
|
||||
void (*attach)(struct weston_surface *es, struct weston_buffer *buffer);
|
||||
void (*attach)(struct weston_paint_node *pnode);
|
||||
void (*destroy)(struct weston_compositor *ec);
|
||||
|
||||
/** See weston_surface_copy_content() */
|
||||
|
|
|
@ -67,8 +67,10 @@ noop_renderer_flush_damage(struct weston_paint_node *pnode)
|
|||
}
|
||||
|
||||
static void
|
||||
noop_renderer_attach(struct weston_surface *es, struct weston_buffer *buffer)
|
||||
noop_renderer_attach(struct weston_paint_node *pnode)
|
||||
{
|
||||
struct weston_surface *es = pnode->surface;
|
||||
struct weston_buffer *buffer = es->buffer_ref.buffer;
|
||||
struct noop_renderer *renderer =
|
||||
wl_container_of(es->compositor->renderer, renderer, base);
|
||||
struct wl_shm_buffer *shm_buffer;
|
||||
|
|
|
@ -730,7 +730,8 @@ pixman_renderer_surface_set_color(struct weston_surface *es,
|
|||
}
|
||||
|
||||
static void
|
||||
pixman_renderer_attach(struct weston_surface *es, struct weston_buffer *buffer)
|
||||
pixman_renderer_attach_internal(struct weston_surface *es,
|
||||
struct weston_buffer *buffer)
|
||||
{
|
||||
struct pixman_surface_state *ps = get_surface_state(es);
|
||||
struct wl_shm_buffer *shm_buffer;
|
||||
|
@ -800,6 +801,15 @@ pixman_renderer_attach(struct weston_surface *es, struct weston_buffer *buffer)
|
|||
&ps->buffer_destroy_listener);
|
||||
}
|
||||
|
||||
static void
|
||||
pixman_renderer_attach(struct weston_paint_node *pnode)
|
||||
{
|
||||
struct weston_surface *es = pnode->surface;
|
||||
struct weston_buffer *buffer = pnode->surface->buffer_ref.buffer;
|
||||
|
||||
pixman_renderer_attach_internal(es, buffer);
|
||||
}
|
||||
|
||||
static void
|
||||
pixman_renderer_surface_state_destroy(struct pixman_surface_state *ps)
|
||||
{
|
||||
|
@ -897,7 +907,7 @@ pixman_renderer_surface_copy_content(struct weston_surface *surface,
|
|||
if (!ps->image)
|
||||
return -1;
|
||||
|
||||
pixman_renderer_attach(surface, surface->buffer_ref.buffer);
|
||||
pixman_renderer_attach_internal(surface, surface->buffer_ref.buffer);
|
||||
|
||||
out_buf = pixman_image_create_bits(format, width, height,
|
||||
target, width * bytespp);
|
||||
|
|
|
@ -3483,7 +3483,8 @@ gl_renderer_attach_solid(struct weston_surface *surface,
|
|||
}
|
||||
|
||||
static void
|
||||
gl_renderer_attach(struct weston_surface *es, struct weston_buffer *buffer)
|
||||
gl_renderer_attach_internal(struct weston_surface *es,
|
||||
struct weston_buffer *buffer)
|
||||
{
|
||||
struct gl_surface_state *gs = get_surface_state(es);
|
||||
|
||||
|
@ -3542,6 +3543,15 @@ out:
|
|||
weston_buffer_release_reference(&gs->buffer_release_ref, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
gl_renderer_attach(struct weston_paint_node *pnode)
|
||||
{
|
||||
struct weston_surface *es = pnode->surface;
|
||||
struct weston_buffer *buffer = es->buffer_ref.buffer;
|
||||
|
||||
gl_renderer_attach_internal(es, buffer);
|
||||
}
|
||||
|
||||
static uint32_t
|
||||
pack_color(pixman_format_code_t format, float *c)
|
||||
{
|
||||
|
@ -3600,7 +3610,7 @@ gl_renderer_surface_copy_content(struct weston_surface *surface,
|
|||
GLenum status;
|
||||
int ret = -1;
|
||||
|
||||
gl_renderer_attach(surface, surface->buffer_ref.buffer);
|
||||
gl_renderer_attach_internal(surface, surface->buffer_ref.buffer);
|
||||
gs = get_surface_state(surface);
|
||||
gb = gs->buffer;
|
||||
buffer = gs->buffer_ref.buffer;
|
||||
|
|
Loading…
Reference in New Issue