renderer: Add buffer to flush_damage

We already have the buffer in the caller, and every no-op implementation
will want to access the buffer. So might as well pass it.

Signed-off-by: Daniel Stone <daniels@collabora.com>
dev
Daniel Stone 3 years ago
parent f8ac6f940f
commit 12675ed19f
  1. 3
      include/libweston/libweston.h
  2. 7
      libweston/compositor.c
  3. 3
      libweston/noop-renderer.c
  4. 3
      libweston/pixman-renderer.c
  5. 12
      libweston/renderer-gl/gl-renderer.c

@ -926,7 +926,8 @@ struct weston_renderer {
uint32_t width, uint32_t height);
void (*repaint_output)(struct weston_output *output,
pixman_region32_t *output_damage);
void (*flush_damage)(struct weston_surface *surface);
void (*flush_damage)(struct weston_surface *surface,
struct weston_buffer *buffer);
void (*attach)(struct weston_surface *es, struct weston_buffer *buffer);
void (*surface_set_color)(struct weston_surface *surface,
float red, float green,

@ -2553,9 +2553,10 @@ weston_output_damage(struct weston_output *output)
static void
surface_flush_damage(struct weston_surface *surface)
{
if (surface->buffer_ref.buffer &&
wl_shm_buffer_get(surface->buffer_ref.buffer->resource))
surface->compositor->renderer->flush_damage(surface);
struct weston_buffer *buffer = surface->buffer_ref.buffer;
if (buffer && wl_shm_buffer_get(buffer->resource))
surface->compositor->renderer->flush_damage(surface, buffer);
if (pixman_region32_not_empty(&surface->damage))
TL_POINT(surface->compositor, "core_flush_damage", TLP_SURFACE(surface),

@ -47,7 +47,8 @@ noop_renderer_repaint_output(struct weston_output *output,
}
static void
noop_renderer_flush_damage(struct weston_surface *surface)
noop_renderer_flush_damage(struct weston_surface *surface,
struct weston_buffer *buffer)
{
}

@ -598,7 +598,8 @@ pixman_renderer_repaint_output(struct weston_output *output,
}
static void
pixman_renderer_flush_damage(struct weston_surface *surface)
pixman_renderer_flush_damage(struct weston_surface *surface,
struct weston_buffer *buffer)
{
/* No-op for pixman renderer */
}

@ -1832,12 +1832,12 @@ gl_format_from_internal(GLenum internal_format)
}
static void
gl_renderer_flush_damage(struct weston_surface *surface)
gl_renderer_flush_damage(struct weston_surface *surface,
struct weston_buffer *buffer)
{
const struct weston_testsuite_quirks *quirks =
&surface->compositor->test_data.test_quirks;
struct gl_surface_state *gs = get_surface_state(surface);
struct weston_buffer *buffer = gs->buffer_ref.buffer;
struct weston_view *view;
bool texture_used;
pixman_box32_t *rectangles;
@ -3081,7 +3081,7 @@ gl_renderer_surface_copy_content(struct weston_surface *surface,
*(uint32_t *)target = pack_color(format, gs->color);
return 0;
case BUFFER_TYPE_SHM:
gl_renderer_flush_damage(surface);
gl_renderer_flush_damage(surface, gs->buffer_ref.buffer);
/* fall through */
case BUFFER_TYPE_EGL:
break;
@ -3228,7 +3228,11 @@ gl_renderer_create_surface(struct weston_surface *surface)
if (surface->buffer_ref.buffer) {
gl_renderer_attach(surface, surface->buffer_ref.buffer);
gl_renderer_flush_damage(surface);
if (surface->buffer_ref.buffer->resource &&
wl_shm_buffer_get(surface->buffer_ref.buffer->resource)) {
gl_renderer_flush_damage(surface,
surface->buffer_ref.buffer);
}
}
return 0;

Loading…
Cancel
Save