pepper_renderer_attach_surface(output->renderer, surface, w, h);
}
+static void
+drm_output_flush_surface(void *o, pepper_surface_t *surface)
+{
+ pepper_renderer_flush_surface_damage(((drm_output_t *)o)->renderer, surface);
+}
+
struct pepper_output_backend drm_output_backend =
{
drm_output_destroy,
drm_output_assign_planes,
drm_output_repaint,
drm_output_attach_surface,
+ drm_output_flush_surface,
};
static int
pepper_renderer_attach_surface(((fbdev_output_t *)o)->renderer, surface, w, h);
}
+static void
+fbdev_output_flush_surface(void *o, pepper_surface_t *surface)
+{
+ pepper_renderer_flush_surface_damage(((fbdev_output_t *)o)->renderer, surface);
+}
+
struct pepper_output_backend fbdev_output_backend =
{
fbdev_output_destroy,
fbdev_output_assign_planes,
fbdev_output_repaint,
fbdev_output_attach_surface,
+ fbdev_output_flush_surface,
};
static pepper_bool_t
void (*assign_planes)(void *output, const pepper_list_t *view_list);
void (*repaint)(void *output, const pepper_list_t *plane_list);
void (*attach_surface)(void *output, pepper_surface_t *surface, int *w, int *h);
+ void (*flush_surface)(void *output, pepper_surface_t *surface);
};
PEPPER_API pepper_output_t *
PEPPER_API int32_t
pepper_surface_get_buffer_transform(pepper_surface_t *surface);
-PEPPER_API const pixman_region32_t *
+PEPPER_API pixman_region32_t *
pepper_surface_get_damage_region(pepper_surface_t *surface);
-PEPPER_API const pixman_region32_t *
+PEPPER_API pixman_region32_t *
pepper_surface_get_opaque_region(pepper_surface_t *surface);
-PEPPER_API const pixman_region32_t *
+PEPPER_API pixman_region32_t *
pepper_surface_get_input_region(pepper_surface_t *surface);
/* Buffer. */
return surface->buffer.transform;
}
-PEPPER_API const pixman_region32_t *
+PEPPER_API pixman_region32_t *
pepper_surface_get_damage_region(pepper_surface_t *surface)
{
return &surface->damage_region;
}
-PEPPER_API const pixman_region32_t *
+PEPPER_API pixman_region32_t *
pepper_surface_get_opaque_region(pepper_surface_t *surface)
{
return &surface->opaque_region;
}
-PEPPER_API const pixman_region32_t *
+PEPPER_API pixman_region32_t *
pepper_surface_get_input_region(pepper_surface_t *surface)
{
return &surface->input_region;
void
pepper_surface_flush_damage(pepper_surface_t *surface)
{
- pepper_view_t *view;
+ pepper_view_t *view;
+ pepper_output_t *output;
if (!pixman_region32_not_empty(&surface->damage_region))
return;
pepper_list_for_each(view, &surface->view_list, surface_link)
pepper_view_surface_damage(view);
- /* TODO: Call backend.urface_flush(). */
+ pepper_list_for_each(output, &surface->compositor->output_list, link)
+ output->backend->flush_surface(output->data, surface);
}
if (state->buffer_type != BUFFER_TYPE_SHM)
return PEPPER_TRUE;
- /* TODO: Texture upload. */
+ /* Texture upload. */
+ if (state->shm.need_full_upload)
+ {
+ glBindTexture(GL_TEXTURE_2D, state->textures[0]);
+ wl_shm_buffer_begin_access(state->shm.buffer);
+ glTexImage2D(GL_TEXTURE_2D, 0, state->shm.format,
+ state->buffer_width, state->buffer_height, 0,
+ state->shm.format, state->shm.pixel_format,
+ wl_shm_buffer_get_data(state->shm.buffer));
+ wl_shm_buffer_end_access(state->shm.buffer);
+ }
+ else
+ {
+ int i, nrects;
+ pixman_box32_t *rects;
+ pixman_region32_t *damage;
+
+ damage = pepper_surface_get_damage_region(surface);
+ rects = pixman_region32_rectangles(damage, &nrects); /* FIXME: compile warning */
+
+ glBindTexture(GL_TEXTURE_2D, state->textures[0]);
+ wl_shm_buffer_begin_access(state->shm.buffer);
+ for (i = 0; i < nrects; i++)
+ {
+ glTexSubImage2D(GL_TEXTURE_2D, 0, rects[i].x1, rects[i].x2,
+ rects[i].x2 - rects[i].x1, rects[i].y2 - rects[i].y1,
+ state->shm.format, state->shm.pixel_format,
+ wl_shm_buffer_get_data(state->shm.buffer));
+ }
+ wl_shm_buffer_end_access(state->shm.buffer);
+ }
return PEPPER_TRUE;
}
pepper_renderer_attach_surface(((wayland_output_t *)o)->renderer, surface, w, h);
}
+static void
+wayland_output_flush_surface(void *o, pepper_surface_t *surface)
+{
+ pepper_renderer_flush_surface_damage(((wayland_output_t *)o)->renderer, surface);
+}
+
static const pepper_output_backend_t wayland_output_backend =
{
wayland_output_destroy,
wayland_output_assign_planes,
wayland_output_repaint,
wayland_output_attach_surface,
+ wayland_output_flush_surface,
};
static void
pepper_renderer_attach_surface(((x11_output_t *)o)->renderer, surface, w, h);
}
+static void
+x11_output_flush_surface(void *o, pepper_surface_t *surface)
+{
+ pepper_renderer_flush_surface_damage(((x11_output_t *)o)->renderer, surface);
+}
+
/* X11 output backend to export for PePPer core */
static const pepper_output_backend_t x11_output_backend =
{
x11_output_assign_planes,
x11_output_repaint,
x11_output_attach_surface,
+ x11_output_flush_surface,
};
PEPPER_API pepper_output_t *