summaryrefslogtreecommitdiffstats
path: root/src/egl
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2011-04-21 10:51:14 +0200
committerKristian Høgsberg <krh@bitplanet.net>2011-04-22 08:56:33 -0400
commitf09c66b3cc9542b0a8f795e34b882c2b8f9f26f7 (patch)
tree3657e7a260a534b5282f71280278418cb411cb18 /src/egl
parent1617b268ef79bd7dc527f6dc65f3ef0d3c51a77d (diff)
egl_dri2: Create wl_buffers for pixmap surfaces
Needed since wayland-egl doesnt do this anymore.
Diffstat (limited to 'src/egl')
-rw-r--r--src/egl/drivers/dri2/platform_wayland.c33
-rw-r--r--src/egl/wayland/wayland-egl/wayland-egl.c2
2 files changed, 23 insertions, 12 deletions
diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
index c3dee7ff0f7..c0860a73778 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -208,6 +208,19 @@ dri2_wl_egl_pixmap_destroy(struct wl_egl_pixmap *egl_pixmap)
egl_pixmap->destroy = NULL;
}
+static struct wl_buffer *
+wayland_create_buffer(struct dri2_egl_surface *dri2_surf,
+ __DRIbuffer *buffer,
+ struct wl_visual *visual)
+{
+ struct dri2_egl_display *dri2_dpy =
+ dri2_egl_display(dri2_surf->base.Resource.Display);
+
+ return wl_drm_create_buffer(dri2_dpy->wl_drm, buffer->name,
+ dri2_surf->base.Width, dri2_surf->base.Height,
+ buffer->pitch, visual);
+}
+
static void
dri2_process_back_buffer(struct dri2_egl_surface *dri2_surf, unsigned format)
{
@@ -356,6 +369,12 @@ dri2_get_buffers_with_format(__DRIdrawable * driDrawable,
assert(dri2_surf->type == DRI2_PIXMAP_SURFACE ||
dri2_surf->dri_buffers[__DRI_BUFFER_BACK_LEFT]);
+ if (dri2_surf->type == DRI2_PIXMAP_SURFACE && !dri2_surf->wl_pix->buffer)
+ dri2_surf->wl_pix->buffer =
+ wayland_create_buffer(dri2_surf,
+ dri2_surf->dri_buffers[__DRI_BUFFER_FRONT_LEFT],
+ dri2_surf->wl_pix->visual);
+
*out_count = dri2_surf->buffer_count;
if (dri2_surf->buffer_count == 0)
return NULL;
@@ -416,17 +435,6 @@ dri2_flush_front_buffer(__DRIdrawable * driDrawable, void *loaderPrivate)
#endif
}
-static struct wl_buffer *
-wayland_create_buffer(struct dri2_egl_surface *dri2_surf, __DRIbuffer *buffer)
-{
- struct dri2_egl_display *dri2_dpy =
- dri2_egl_display(dri2_surf->base.Resource.Display);
-
- return wl_drm_create_buffer(dri2_dpy->wl_drm, buffer->name,
- dri2_surf->base.Width, dri2_surf->base.Height,
- buffer->pitch, dri2_surf->wl_win->visual);
-}
-
static void
wayland_frame_callback(struct wl_surface *surface, void *data, uint32_t time)
{
@@ -477,7 +485,8 @@ dri2_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw)
if (!dri2_surf->wl_drm_buffer[WL_BUFFER_FRONT])
dri2_surf->wl_drm_buffer[WL_BUFFER_FRONT] =
wayland_create_buffer(dri2_surf,
- dri2_surf->dri_buffers[__DRI_BUFFER_FRONT_LEFT]);
+ dri2_surf->dri_buffers[__DRI_BUFFER_FRONT_LEFT],
+ dri2_surf->wl_win->visual);
wl_surface_attach(dri2_surf->wl_win->surface,
dri2_surf->wl_drm_buffer[WL_BUFFER_FRONT],
diff --git a/src/egl/wayland/wayland-egl/wayland-egl.c b/src/egl/wayland/wayland-egl/wayland-egl.c
index 891a497d1d1..3e1a9c45bdc 100644
--- a/src/egl/wayland/wayland-egl/wayland-egl.c
+++ b/src/egl/wayland/wayland-egl/wayland-egl.c
@@ -79,6 +79,8 @@ wl_egl_pixmap_create(int width, int height,
egl_pixmap->visual = visual;
egl_pixmap->destroy = NULL;
+ egl_pixmap->buffer = NULL;
+ egl_pixmap->driver_private = NULL;
return egl_pixmap;
}