From: Marek Olšák Date: Tue, 27 Aug 2019 23:35:25 +0000 (-0400) Subject: r300,r600,radeonsi: set winsys_handle::stride,offset in drivers, not winsyses X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=66338631502b572594dce61ddce0406f0eaac5c3;p=mesa.git r300,r600,radeonsi: set winsys_handle::stride,offset in drivers, not winsyses Acked-by: Pierre-Eric Pelloux-Prayer --- diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c index 737a4f90418..f977dd14dc7 100644 --- a/src/gallium/drivers/r300/r300_texture.c +++ b/src/gallium/drivers/r300/r300_texture.c @@ -1049,8 +1049,10 @@ bool r300_resource_get_handle(struct pipe_screen* screen, return false; } - return rws->buffer_get_handle(rws, tex->buf, tex->tex.stride_in_bytes[0], - 0, 0, whandle); + whandle->stride = tex->tex.stride_in_bytes[0]; + whandle->offset = 0; + + return rws->buffer_get_handle(rws, tex->buf, whandle); } static const struct u_resource_vtbl r300_texture_vtbl = diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index 03f217b988a..4b9b15bc0cd 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -570,8 +570,10 @@ static bool r600_texture_get_handle(struct pipe_screen* screen, res->external_usage = usage; } - return rscreen->ws->buffer_get_handle(rscreen->ws, res->buf, stride, - offset, slice_size, whandle); + whandle->stride = stride; + whandle->offset = offset + slice_size * whandle->layer; + + return rscreen->ws->buffer_get_handle(rscreen->ws, res->buf, whandle); } static void r600_texture_destroy(struct pipe_screen *screen, diff --git a/src/gallium/drivers/radeon/radeon_winsys.h b/src/gallium/drivers/radeon/radeon_winsys.h index 505b6c9a2cb..31eed8f5300 100644 --- a/src/gallium/drivers/radeon/radeon_winsys.h +++ b/src/gallium/drivers/radeon/radeon_winsys.h @@ -412,13 +412,10 @@ struct radeon_winsys { * \param ws The winsys instance for which the handle is to be valid * \param buf A winsys buffer object to get the handle from. * \param whandle A winsys handle pointer. - * \param stride A stride of the buffer in bytes, for texturing. * \return true on success. */ bool (*buffer_get_handle)(struct radeon_winsys *ws, struct pb_buffer *buf, - unsigned stride, unsigned offset, - unsigned slice_size, struct winsys_handle *whandle); /** diff --git a/src/gallium/drivers/radeonsi/si_texture.c b/src/gallium/drivers/radeonsi/si_texture.c index a4a08a6e321..64fcd50f3a1 100644 --- a/src/gallium/drivers/radeonsi/si_texture.c +++ b/src/gallium/drivers/radeonsi/si_texture.c @@ -1029,8 +1029,10 @@ static bool si_texture_get_handle(struct pipe_screen* screen, res->external_usage = usage; } - return sscreen->ws->buffer_get_handle(sscreen->ws, res->buf, stride, - offset, slice_size, whandle); + whandle->stride = stride; + whandle->offset = offset + slice_size * whandle->layer; + + return sscreen->ws->buffer_get_handle(sscreen->ws, res->buf, whandle); } static void si_texture_destroy(struct pipe_screen *screen, diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c index 53f2bd67ea9..6a395967117 100644 --- a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c @@ -1519,8 +1519,6 @@ error: static bool amdgpu_bo_get_handle(struct radeon_winsys *rws, struct pb_buffer *buffer, - unsigned stride, unsigned offset, - unsigned slice_size, struct winsys_handle *whandle) { struct amdgpu_screen_winsys *sws = amdgpu_screen_winsys(rws); @@ -1565,9 +1563,6 @@ static bool amdgpu_bo_get_handle(struct radeon_winsys *rws, util_hash_table_set(ws->bo_export_table, bo->bo, bo); simple_mtx_unlock(&ws->bo_export_table_lock); - whandle->stride = stride; - whandle->offset = offset; - whandle->offset += slice_size * whandle->layer; bo->is_shared = true; return true; } diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c index f8a7b89966a..c0a763d45ba 100644 --- a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c +++ b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c @@ -1274,8 +1274,6 @@ fail: static bool radeon_winsys_bo_get_handle(struct radeon_winsys *rws, struct pb_buffer *buffer, - unsigned stride, unsigned offset, - unsigned slice_size, struct winsys_handle *whandle) { struct drm_gem_flink flink; @@ -1312,10 +1310,6 @@ static bool radeon_winsys_bo_get_handle(struct radeon_winsys *rws, return false; } - whandle->stride = stride; - whandle->offset = offset; - whandle->offset += slice_size * whandle->layer; - return true; }