diff options
author | Ander Conselvan de Oliveira <[email protected]> | 2013-07-18 15:11:25 +0300 |
---|---|---|
committer | Kristian Høgsberg <[email protected]> | 2013-08-07 10:37:58 -0700 |
commit | 8d29b5271a2e66fc78436be31ed6748ff006f0cb (patch) | |
tree | b8a28a8c8fe46f04decaf3229a936c1bff110a80 /src/gallium/state_trackers/egl/common | |
parent | 602351dd58c11af072f706e41ff1a204dac26a86 (diff) |
egl: Update to Wayland 1.2 server API
Since Wayland 1.2, struct wl_buffer and a few functions are deprecated.
References to wl_buffer are replaced with wl_resource and some getter
functions and calls to deprecated functions are replaced with the proper
new API. The latter changes are related to resource versioning.
Signed-off-by: Ander Conselvan de Oliveira <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/egl/common')
4 files changed, 22 insertions, 15 deletions
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_api.c b/src/gallium/state_trackers/egl/common/egl_g3d_api.c index 2e5424ef007..3ee0d677017 100644 --- a/src/gallium/state_trackers/egl/common/egl_g3d_api.c +++ b/src/gallium/state_trackers/egl/common/egl_g3d_api.c @@ -874,7 +874,7 @@ egl_g3d_unbind_wayland_display_wl(_EGLDriver *drv, _EGLDisplay *dpy, static EGLBoolean egl_g3d_query_wayland_buffer_wl(_EGLDriver *drv, _EGLDisplay *dpy, - struct wl_buffer *buffer, + struct wl_resource *buffer, EGLint attribute, EGLint *value) { struct egl_g3d_display *gdpy = egl_g3d_display(dpy); diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_image.c b/src/gallium/state_trackers/egl/common/egl_g3d_image.c index aa1980b06d6..c459dc32320 100644 --- a/src/gallium/state_trackers/egl/common/egl_g3d_image.c +++ b/src/gallium/state_trackers/egl/common/egl_g3d_image.c @@ -183,7 +183,7 @@ egl_g3d_reference_drm_buffer(_EGLDisplay *dpy, EGLint name, #ifdef EGL_WL_bind_wayland_display static struct pipe_resource * -egl_g3d_reference_wl_buffer(_EGLDisplay *dpy, struct wl_buffer *buffer, +egl_g3d_reference_wl_buffer(_EGLDisplay *dpy, struct wl_resource *buffer, _EGLImage *img, const EGLint *attribs) { struct egl_g3d_display *gdpy = egl_g3d_display(dpy); @@ -253,7 +253,7 @@ egl_g3d_create_image(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx, #ifdef EGL_WL_bind_wayland_display case EGL_WAYLAND_BUFFER_WL: ptex = egl_g3d_reference_wl_buffer(dpy, - (struct wl_buffer *) buffer, &gimg->base, attribs); + (struct wl_resource *) buffer, &gimg->base, attribs); break; #endif #ifdef EGL_ANDROID_image_native_buffer diff --git a/src/gallium/state_trackers/egl/common/native_wayland_bufmgr.h b/src/gallium/state_trackers/egl/common/native_wayland_bufmgr.h index dd27828756a..eb324bf7ca3 100644 --- a/src/gallium/state_trackers/egl/common/native_wayland_bufmgr.h +++ b/src/gallium/state_trackers/egl/common/native_wayland_bufmgr.h @@ -27,7 +27,7 @@ struct native_display; struct wl_display; -struct wl_buffer; +struct wl_resource; struct pipe_resource; struct native_display_wayland_bufmgr { @@ -38,11 +38,11 @@ struct native_display_wayland_bufmgr { struct wl_display *wl_dpy); struct pipe_resource *(*buffer_get_resource)(struct native_display *ndpy, - struct wl_buffer *buffer); + struct wl_resource *buffer); boolean (*query_buffer)(struct native_display *ndpy, - struct wl_buffer *buffer, + struct wl_resource *buffer, int attribute, int *value); }; diff --git a/src/gallium/state_trackers/egl/common/native_wayland_drm_bufmgr.c b/src/gallium/state_trackers/egl/common/native_wayland_drm_bufmgr.c index 1603a3a71e2..9b69cb9b9d2 100644 --- a/src/gallium/state_trackers/egl/common/native_wayland_drm_bufmgr.c +++ b/src/gallium/state_trackers/egl/common/native_wayland_drm_bufmgr.c @@ -70,8 +70,8 @@ wayland_drm_bufmgr_reference_buffer(void *user_data, uint32_t name, int fd, templ.target = PIPE_TEXTURE_2D; templ.format = pf; templ.bind = PIPE_BIND_RENDER_TARGET | PIPE_BIND_SAMPLER_VIEW; - templ.width0 = buffer->buffer.width; - templ.height0 = buffer->buffer.height; + templ.width0 = buffer->width; + templ.height0 = buffer->height; templ.depth0 = 1; templ.array_size = 1; @@ -137,22 +137,29 @@ wayland_drm_bufmgr_unbind_display(struct native_display *ndpy, static struct pipe_resource * wayland_drm_bufmgr_wl_buffer_get_resource(struct native_display *ndpy, - struct wl_buffer *buffer) + struct wl_resource *buffer_resource) { + struct wl_drm_buffer *buffer = wayland_drm_buffer_get(buffer_resource); + + if (!buffer) + return NULL; + return wayland_drm_buffer_get_buffer(buffer); } static EGLBoolean wayland_drm_bufmgr_query_buffer(struct native_display *ndpy, - struct wl_buffer *_buffer, + struct wl_resource *buffer_resource, EGLint attribute, EGLint *value) { - struct wl_drm_buffer *buffer = (struct wl_drm_buffer *) _buffer; - struct pipe_resource *resource = buffer->driver_buffer; + struct wl_drm_buffer *buffer = wayland_drm_buffer_get(buffer_resource); + struct pipe_resource *resource; - if (!wayland_buffer_is_drm(&buffer->buffer)) + if (!buffer) return EGL_FALSE; + resource = buffer->driver_buffer; + switch (attribute) { case EGL_TEXTURE_FORMAT: switch (resource->format) { @@ -166,10 +173,10 @@ wayland_drm_bufmgr_query_buffer(struct native_display *ndpy, return EGL_FALSE; } case EGL_WIDTH: - *value = buffer->buffer.width; + *value = buffer->width; return EGL_TRUE; case EGL_HEIGHT: - *value = buffer->buffer.height; + *value = buffer->height; return EGL_TRUE; default: return EGL_FALSE; |