mirror of
https://gitlab.freedesktop.org/wayland/weston.git
synced 2025-12-20 14:00:10 +01:00
compositor/renderer: Only attach buffer to renderer in repaint
Instead of doing this in several places, just do it when we're updating the paint nodes in the repaint loop, or when we're about to copy content via weston_surface_copy_content(). Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This commit is contained in:
parent
da6622f1d6
commit
c08a6ff8bd
3 changed files with 15 additions and 12 deletions
|
|
@ -221,9 +221,11 @@ paint_node_update_early(struct weston_paint_node *pnode)
|
||||||
static void
|
static void
|
||||||
paint_node_update_late(struct weston_paint_node *pnode)
|
paint_node_update_late(struct weston_paint_node *pnode)
|
||||||
{
|
{
|
||||||
|
struct weston_surface *surf = pnode->surface;
|
||||||
bool vis_dirty = pnode->status & PAINT_NODE_VISIBILITY_DIRTY;
|
bool vis_dirty = pnode->status & PAINT_NODE_VISIBILITY_DIRTY;
|
||||||
bool plane_dirty = pnode->status & PAINT_NODE_PLANE_DIRTY;
|
bool plane_dirty = pnode->status & PAINT_NODE_PLANE_DIRTY;
|
||||||
bool content_dirty = pnode->status & PAINT_NODE_CONTENT_DIRTY;
|
bool content_dirty = pnode->status & PAINT_NODE_CONTENT_DIRTY;
|
||||||
|
bool buffer_dirty = pnode->status & PAINT_NODE_BUFFER_DIRTY;
|
||||||
|
|
||||||
/* The geoemtry may be shrinking, so we shouldn't just
|
/* The geoemtry may be shrinking, so we shouldn't just
|
||||||
* add the old visible region to our damage region, because
|
* add the old visible region to our damage region, because
|
||||||
|
|
@ -264,6 +266,10 @@ paint_node_update_late(struct weston_paint_node *pnode)
|
||||||
pnode->plane_next = NULL;
|
pnode->plane_next = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (buffer_dirty)
|
||||||
|
surf->compositor->renderer->attach(surf,
|
||||||
|
surf->buffer_ref.buffer);
|
||||||
|
|
||||||
pnode->status &= ~(PAINT_NODE_VISIBILITY_DIRTY |
|
pnode->status &= ~(PAINT_NODE_VISIBILITY_DIRTY |
|
||||||
PAINT_NODE_PLANE_DIRTY |
|
PAINT_NODE_PLANE_DIRTY |
|
||||||
PAINT_NODE_CONTENT_DIRTY |
|
PAINT_NODE_CONTENT_DIRTY |
|
||||||
|
|
@ -2981,7 +2987,6 @@ weston_surface_attach_solid(struct weston_surface *surface,
|
||||||
assert(buffer->type == WESTON_BUFFER_SOLID);
|
assert(buffer->type == WESTON_BUFFER_SOLID);
|
||||||
weston_buffer_reference(&surface->buffer_ref, buffer,
|
weston_buffer_reference(&surface->buffer_ref, buffer,
|
||||||
BUFFER_MAY_BE_ACCESSED);
|
BUFFER_MAY_BE_ACCESSED);
|
||||||
surface->compositor->renderer->attach(surface, buffer);
|
|
||||||
|
|
||||||
weston_surface_set_size(surface, w, h);
|
weston_surface_set_size(surface, w, h);
|
||||||
|
|
||||||
|
|
@ -3117,7 +3122,6 @@ weston_surface_attach(struct weston_surface *surface,
|
||||||
|
|
||||||
weston_buffer_reference(&surface->buffer_ref, NULL,
|
weston_buffer_reference(&surface->buffer_ref, NULL,
|
||||||
BUFFER_WILL_NOT_BE_ACCESSED);
|
BUFFER_WILL_NOT_BE_ACCESSED);
|
||||||
surface->compositor->renderer->attach(surface, buffer);
|
|
||||||
|
|
||||||
surface->width_from_buffer = 0;
|
surface->width_from_buffer = 0;
|
||||||
surface->height_from_buffer = 0;
|
surface->height_from_buffer = 0;
|
||||||
|
|
@ -3162,7 +3166,6 @@ weston_surface_attach(struct weston_surface *surface,
|
||||||
old_buffer = NULL;
|
old_buffer = NULL;
|
||||||
weston_buffer_reference(&surface->buffer_ref, buffer,
|
weston_buffer_reference(&surface->buffer_ref, buffer,
|
||||||
BUFFER_MAY_BE_ACCESSED);
|
BUFFER_MAY_BE_ACCESSED);
|
||||||
surface->compositor->renderer->attach(surface, buffer);
|
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -897,6 +897,8 @@ pixman_renderer_surface_copy_content(struct weston_surface *surface,
|
||||||
if (!ps->image)
|
if (!ps->image)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
pixman_renderer_attach(surface, surface->buffer_ref.buffer);
|
||||||
|
|
||||||
out_buf = pixman_image_create_bits(format, width, height,
|
out_buf = pixman_image_create_bits(format, width, height,
|
||||||
target, width * bytespp);
|
target, width * bytespp);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3487,8 +3487,6 @@ gl_renderer_attach(struct weston_surface *es, struct weston_buffer *buffer)
|
||||||
{
|
{
|
||||||
struct gl_surface_state *gs = get_surface_state(es);
|
struct gl_surface_state *gs = get_surface_state(es);
|
||||||
|
|
||||||
/* If get_surface_state called gl_renderer_create_surface, it did
|
|
||||||
* attach the buffer */
|
|
||||||
if (gs->buffer_ref.buffer == buffer)
|
if (gs->buffer_ref.buffer == buffer)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -3593,15 +3591,19 @@ gl_renderer_surface_copy_content(struct weston_surface *surface,
|
||||||
const size_t bytespp = 4; /* PIXMAN_a8b8g8r8 */
|
const size_t bytespp = 4; /* PIXMAN_a8b8g8r8 */
|
||||||
const GLenum gl_format = GL_RGBA; /* PIXMAN_a8b8g8r8 little-endian */
|
const GLenum gl_format = GL_RGBA; /* PIXMAN_a8b8g8r8 little-endian */
|
||||||
struct gl_renderer *gr = get_renderer(surface->compositor);
|
struct gl_renderer *gr = get_renderer(surface->compositor);
|
||||||
struct gl_surface_state *gs = get_surface_state(surface);
|
struct gl_surface_state *gs;
|
||||||
struct gl_buffer_state *gb = gs->buffer;
|
struct gl_buffer_state *gb;
|
||||||
struct weston_buffer *buffer = gs->buffer_ref.buffer;
|
struct weston_buffer *buffer;
|
||||||
int cw, ch;
|
int cw, ch;
|
||||||
GLuint fbo;
|
GLuint fbo;
|
||||||
GLuint tex;
|
GLuint tex;
|
||||||
GLenum status;
|
GLenum status;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
|
gl_renderer_attach(surface, surface->buffer_ref.buffer);
|
||||||
|
gs = get_surface_state(surface);
|
||||||
|
gb = gs->buffer;
|
||||||
|
buffer = gs->buffer_ref.buffer;
|
||||||
assert(buffer);
|
assert(buffer);
|
||||||
|
|
||||||
cw = buffer->width;
|
cw = buffer->width;
|
||||||
|
|
@ -3750,10 +3752,6 @@ gl_renderer_create_surface(struct weston_surface *surface)
|
||||||
wl_signal_add(&gr->destroy_signal,
|
wl_signal_add(&gr->destroy_signal,
|
||||||
&gs->renderer_destroy_listener);
|
&gs->renderer_destroy_listener);
|
||||||
|
|
||||||
if (surface->buffer_ref.buffer) {
|
|
||||||
gl_renderer_attach(surface, surface->buffer_ref.buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue