diff options
Diffstat (limited to 'src/egl/drivers/dri2/platform_wayland.c')
-rw-r--r-- | src/egl/drivers/dri2/platform_wayland.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c index 0cc20bbc0b..d0b7dac050 100644 --- a/src/egl/drivers/dri2/platform_wayland.c +++ b/src/egl/drivers/dri2/platform_wayland.c @@ -91,6 +91,7 @@ dri2_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type, dri2_surf->pending_buffer = NULL; dri2_surf->block_swap_buffers = EGL_FALSE; + dri2_surf->buffer_use = __DRI_BUFFER_USE_SHARE; switch (type) { case EGL_WINDOW_BIT: @@ -99,6 +100,10 @@ dri2_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type, dri2_surf->base.Width = -1; dri2_surf->base.Height = -1; + + if (dri2_surf->wl_win->flags & WL_EGL_USE_SCANOUT); + dri2_surf->buffer_use |= __DRI_BUFFER_USE_SCANOUT; + break; case EGL_PIXMAP_BIT: dri2_surf->wl_pix = (struct wl_egl_pixmap *) window; @@ -107,6 +112,9 @@ dri2_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type, dri2_surf->base.Width = dri2_surf->wl_pix->width; dri2_surf->base.Height = dri2_surf->wl_pix->height; + if (dri2_surf->wl_pix->flags & WL_EGL_USE_SCANOUT); + dri2_surf->buffer_use |= __DRI_BUFFER_USE_SCANOUT; + if (dri2_surf->wl_pix->name > 0) { dri2_buf = dri2_surf->wl_pix->driver_private; dri2_surf->dri_buffers[__DRI_BUFFER_FRONT_LEFT] = dri2_buf->dri_buffer; @@ -221,7 +229,8 @@ dri2_process_back_buffer(struct dri2_egl_surface *dri2_surf, unsigned format) dri2_surf->dri_buffers[__DRI_BUFFER_FRONT_LEFT] = dri2_dpy->dri2->allocateBuffer(dri2_dpy->dri_screen, __DRI_BUFFER_FRONT_LEFT, format, - dri2_surf->base.Width, dri2_surf->base.Height); + dri2_surf->base.Width, dri2_surf->base.Height, + dri2_surf->buffer_use); break; default: break; @@ -332,11 +341,11 @@ dri2_get_buffers_with_format(__DRIdrawable * driDrawable, assert(dri2_surf->buffer_count < 5); if (dri2_surf->dri_buffers[attachments[i]] == NULL) { - dri2_surf->dri_buffers[attachments[i]] = dri2_dpy->dri2->allocateBuffer(dri2_dpy->dri_screen, attachments[i], attachments[i+1], - dri2_surf->base.Width, dri2_surf->base.Height); + dri2_surf->base.Width, dri2_surf->base.Height, + dri2_surf->buffer_use); if (!dri2_surf->dri_buffers[attachments[i]]) continue; @@ -524,17 +533,22 @@ dri2_create_image_khr_pixmap(_EGLDisplay *disp, _EGLContext *ctx, EGL_DRM_BUFFER_FORMAT_MESA, EGL_DRM_BUFFER_FORMAT_ARGB32_MESA, EGL_NONE }; + unsigned use = __DRI_BUFFER_USE_SHARE; dri2_buf = malloc(sizeof *dri2_buf); if (!dri2_buf) return NULL; + if (wl_egl_pixmap->flags & WL_EGL_USE_SCANOUT) + use |= __DRI_BUFFER_USE_SCANOUT; + dri2_buf->dri2_dpy = dri2_dpy; dri2_buf->dri_buffer = dri2_dpy->dri2->allocateBuffer(dri2_dpy->dri_screen, __DRI_BUFFER_FRONT_LEFT, 32, wl_egl_pixmap->width, - wl_egl_pixmap->height); + wl_egl_pixmap->height, + use); wl_egl_pixmap->name = dri2_buf->dri_buffer->name; wl_egl_pixmap->stride = dri2_buf->dri_buffer->pitch; |