diff options
author | Kristian Høgsberg <[email protected]> | 2012-07-05 14:19:48 -0400 |
---|---|---|
committer | Kristian Høgsberg <[email protected]> | 2012-07-11 15:28:35 -0400 |
commit | 379eb47ea61c87c9ac071fa6d93e49ae3f02ac2c (patch) | |
tree | 0edd148ee5870f6dae465edb0d4908c8326e2c16 /src/gallium/state_trackers | |
parent | 95bc0527e9f81c62cbfe02dace94e73d9950d04d (diff) |
wayland-drm: Pass struct wl_drm_buffer to the driver
We're going to extend this to support multi-plane buffers, so pass this
to the driver so it can access the details.
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r-- | src/gallium/state_trackers/egl/common/native_wayland_drm_bufmgr_helper.c | 23 | ||||
-rw-r--r-- | src/gallium/state_trackers/egl/common/native_wayland_drm_bufmgr_helper.h | 8 |
2 files changed, 16 insertions, 15 deletions
diff --git a/src/gallium/state_trackers/egl/common/native_wayland_drm_bufmgr_helper.c b/src/gallium/state_trackers/egl/common/native_wayland_drm_bufmgr_helper.c index 80b3f227d0b..6d72ce14774 100644 --- a/src/gallium/state_trackers/egl/common/native_wayland_drm_bufmgr_helper.c +++ b/src/gallium/state_trackers/egl/common/native_wayland_drm_bufmgr_helper.c @@ -12,17 +12,16 @@ #include "native_wayland_drm_bufmgr_helper.h" -void * +void egl_g3d_wl_drm_helper_reference_buffer(void *user_data, uint32_t name, - int32_t width, int32_t height, - uint32_t stride, uint32_t format) + struct wl_drm_buffer *buffer) { struct native_display *ndpy = user_data; struct pipe_resource templ; struct winsys_handle wsh; enum pipe_format pf; - switch (format) { + switch (buffer->format) { case WL_DRM_FORMAT_ARGB8888: pf = PIPE_FORMAT_B8G8R8A8_UNORM; break; @@ -35,28 +34,30 @@ egl_g3d_wl_drm_helper_reference_buffer(void *user_data, uint32_t name, } if (pf == PIPE_FORMAT_NONE) - return NULL; + return; memset(&templ, 0, sizeof(templ)); templ.target = PIPE_TEXTURE_2D; templ.format = pf; templ.bind = PIPE_BIND_RENDER_TARGET | PIPE_BIND_SAMPLER_VIEW; - templ.width0 = width; - templ.height0 = height; + templ.width0 = buffer->buffer.width; + templ.height0 = buffer->buffer.height; templ.depth0 = 1; templ.array_size = 1; memset(&wsh, 0, sizeof(wsh)); wsh.handle = name; - wsh.stride = stride; + wsh.stride = buffer->stride0; - return ndpy->screen->resource_from_handle(ndpy->screen, &templ, &wsh); + buffer->driver_buffer = + ndpy->screen->resource_from_handle(ndpy->screen, &templ, &wsh); } void -egl_g3d_wl_drm_helper_unreference_buffer(void *user_data, void *buffer) +egl_g3d_wl_drm_helper_unreference_buffer(void *user_data, + struct wl_drm_buffer *buffer) { - struct pipe_resource *resource = buffer; + struct pipe_resource *resource = buffer->driver_buffer; pipe_resource_reference(&resource, NULL); } diff --git a/src/gallium/state_trackers/egl/common/native_wayland_drm_bufmgr_helper.h b/src/gallium/state_trackers/egl/common/native_wayland_drm_bufmgr_helper.h index 6085875f098..e7a21717aeb 100644 --- a/src/gallium/state_trackers/egl/common/native_wayland_drm_bufmgr_helper.h +++ b/src/gallium/state_trackers/egl/common/native_wayland_drm_bufmgr_helper.h @@ -28,13 +28,13 @@ #include "wayland-drm.h" -void * +void egl_g3d_wl_drm_helper_reference_buffer(void *user_data, uint32_t name, - int32_t width, int32_t height, - uint32_t stride, uint32_t format); + struct wl_drm_buffer *buffer); void -egl_g3d_wl_drm_helper_unreference_buffer(void *user_data, void *buffer); +egl_g3d_wl_drm_helper_unreference_buffer(void *user_data, + struct wl_drm_buffer *buffer); struct pipe_resource * egl_g3d_wl_drm_common_wl_buffer_get_resource(struct native_display *ndpy, |