summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2019-08-27 19:35:25 -0400
committerMarek Olšák <[email protected]>2019-09-09 23:43:03 -0400
commit5ac69082631d4179c268aa3decf6267f697332a4 (patch)
tree46668b10069483f5473591d4114ec791a859427d
parentd95afd8b9e7f9b3880813203292257bf0ed7babf (diff)
r300,r600,radeonsi: read winsys_handle::stride,offset in drivers, not winsyses
Acked-by: Pierre-Eric Pelloux-Prayer <[email protected]>
-rw-r--r--src/gallium/drivers/r300/r300_texture.c6
-rw-r--r--src/gallium/drivers/r600/r600_texture.c18
-rw-r--r--src/gallium/drivers/radeon/radeon_winsys.h4
-rw-r--r--src/gallium/drivers/radeonsi/si_texture.c15
-rw-r--r--src/gallium/winsys/amdgpu/drm/amdgpu_bo.c9
-rw-r--r--src/gallium/winsys/radeon/drm/radeon_drm_bo.c15
6 files changed, 20 insertions, 47 deletions
diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c
index 689341644fd..737a4f90418 100644
--- a/src/gallium/drivers/r300/r300_texture.c
+++ b/src/gallium/drivers/r300/r300_texture.c
@@ -36,6 +36,7 @@
#include "util/u_memory.h"
#include "pipe/p_screen.h"
+#include "state_tracker/winsys_handle.h"
/* These formats are supported by swapping their bytes.
* The swizzles must be set exactly like their non-swapped counterparts,
@@ -1179,7 +1180,6 @@ struct pipe_resource *r300_texture_from_handle(struct pipe_screen *screen,
struct r300_screen *rscreen = r300_screen(screen);
struct radeon_winsys *rws = rscreen->rws;
struct pb_buffer *buffer;
- unsigned stride;
struct radeon_bo_metadata tiling = {};
/* Support only 2D textures without mipmaps */
@@ -1190,7 +1190,7 @@ struct pipe_resource *r300_texture_from_handle(struct pipe_screen *screen,
return NULL;
}
- buffer = rws->buffer_from_handle(rws, whandle, 0, &stride, NULL);
+ buffer = rws->buffer_from_handle(rws, whandle, 0);
if (!buffer)
return NULL;
@@ -1212,7 +1212,7 @@ struct pipe_resource *r300_texture_from_handle(struct pipe_screen *screen,
return (struct pipe_resource*)
r300_texture_create_object(rscreen, base, tiling.u.legacy.microtile, tiling.u.legacy.macrotile,
- stride, buffer);
+ whandle->stride, buffer);
}
/* Not required to implement u_resource_vtbl, consider moving to another file:
diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c
index ddee3d9b833..03f217b988a 100644
--- a/src/gallium/drivers/r600/r600_texture.c
+++ b/src/gallium/drivers/r600/r600_texture.c
@@ -33,6 +33,7 @@
#include "util/u_pack_color.h"
#include "util/u_surface.h"
#include "util/os_time.h"
+#include "state_tracker/winsys_handle.h"
#include <errno.h>
#include <inttypes.h>
@@ -1115,7 +1116,6 @@ static struct pipe_resource *r600_texture_from_handle(struct pipe_screen *screen
{
struct r600_common_screen *rscreen = (struct r600_common_screen*)screen;
struct pb_buffer *buf = NULL;
- unsigned stride = 0, offset = 0;
enum radeon_surf_mode array_mode;
struct radeon_surf surface = {};
int r;
@@ -1129,8 +1129,7 @@ static struct pipe_resource *r600_texture_from_handle(struct pipe_screen *screen
return NULL;
buf = rscreen->ws->buffer_from_handle(rscreen->ws, whandle,
- rscreen->info.max_alignment,
- &stride, &offset);
+ rscreen->info.max_alignment);
if (!buf)
return NULL;
@@ -1138,8 +1137,9 @@ static struct pipe_resource *r600_texture_from_handle(struct pipe_screen *screen
r600_surface_import_metadata(rscreen, &surface, &metadata,
&array_mode, &is_scanout);
- r = r600_init_surface(rscreen, &surface, templ, array_mode, stride,
- offset, true, is_scanout, false);
+ r = r600_init_surface(rscreen, &surface, templ, array_mode,
+ whandle->stride, whandle->offset,
+ true, is_scanout, false);
if (r) {
return NULL;
}
@@ -1865,14 +1865,12 @@ r600_memobj_from_handle(struct pipe_screen *screen,
struct r600_common_screen *rscreen = (struct r600_common_screen*)screen;
struct r600_memory_object *memobj = CALLOC_STRUCT(r600_memory_object);
struct pb_buffer *buf = NULL;
- uint32_t stride, offset;
if (!memobj)
return NULL;
buf = rscreen->ws->buffer_from_handle(rscreen->ws, whandle,
- rscreen->info.max_alignment,
- &stride, &offset);
+ rscreen->info.max_alignment);
if (!buf) {
free(memobj);
return NULL;
@@ -1880,8 +1878,8 @@ r600_memobj_from_handle(struct pipe_screen *screen,
memobj->b.dedicated = dedicated;
memobj->buf = buf;
- memobj->stride = stride;
- memobj->offset = offset;
+ memobj->stride = whandle->stride;
+ memobj->offset = whandle->offset;
return (struct pipe_memory_object *)memobj;
diff --git a/src/gallium/drivers/radeon/radeon_winsys.h b/src/gallium/drivers/radeon/radeon_winsys.h
index 525c28182ed..505b6c9a2cb 100644
--- a/src/gallium/drivers/radeon/radeon_winsys.h
+++ b/src/gallium/drivers/radeon/radeon_winsys.h
@@ -378,12 +378,10 @@ struct radeon_winsys {
* \param ws The winsys this function is called from.
* \param whandle A winsys handle pointer as was received from a state
* tracker.
- * \param stride The returned buffer stride in bytes.
*/
struct pb_buffer *(*buffer_from_handle)(struct radeon_winsys *ws,
struct winsys_handle *whandle,
- unsigned vm_alignment,
- unsigned *stride, unsigned *offset);
+ unsigned vm_alignment);
/**
* Get a winsys buffer from a user pointer. The resulting buffer can't
diff --git a/src/gallium/drivers/radeonsi/si_texture.c b/src/gallium/drivers/radeonsi/si_texture.c
index cb239c3a6e6..a4a08a6e321 100644
--- a/src/gallium/drivers/radeonsi/si_texture.c
+++ b/src/gallium/drivers/radeonsi/si_texture.c
@@ -1792,7 +1792,6 @@ static struct pipe_resource *si_texture_from_handle(struct pipe_screen *screen,
{
struct si_screen *sscreen = (struct si_screen*)screen;
struct pb_buffer *buf = NULL;
- unsigned stride = 0, offset = 0;
/* Support only 2D textures without mipmaps */
if ((templ->target != PIPE_TEXTURE_2D && templ->target != PIPE_TEXTURE_RECT &&
@@ -1801,13 +1800,13 @@ static struct pipe_resource *si_texture_from_handle(struct pipe_screen *screen,
return NULL;
buf = sscreen->ws->buffer_from_handle(sscreen->ws, whandle,
- sscreen->info.max_alignment,
- &stride, &offset);
+ sscreen->info.max_alignment);
if (!buf)
return NULL;
- return si_texture_from_winsys_buffer(sscreen, templ, buf, stride,
- offset, usage, true);
+ return si_texture_from_winsys_buffer(sscreen, templ, buf,
+ whandle->stride, whandle->offset,
+ usage, true);
}
bool si_init_flushed_depth_texture(struct pipe_context *ctx,
@@ -2614,14 +2613,12 @@ si_memobj_from_handle(struct pipe_screen *screen,
struct si_screen *sscreen = (struct si_screen*)screen;
struct si_memory_object *memobj = CALLOC_STRUCT(si_memory_object);
struct pb_buffer *buf = NULL;
- uint32_t stride, offset;
if (!memobj)
return NULL;
buf = sscreen->ws->buffer_from_handle(sscreen->ws, whandle,
- sscreen->info.max_alignment,
- &stride, &offset);
+ sscreen->info.max_alignment);
if (!buf) {
free(memobj);
return NULL;
@@ -2629,7 +2626,7 @@ si_memobj_from_handle(struct pipe_screen *screen,
memobj->b.dedicated = dedicated;
memobj->buf = buf;
- memobj->stride = stride;
+ memobj->stride = whandle->stride;
return (struct pipe_memory_object *)memobj;
diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c
index 7ff84cfb175..53f2bd67ea9 100644
--- a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c
+++ b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c
@@ -1408,9 +1408,7 @@ amdgpu_buffer_create(struct radeon_winsys *ws,
static struct pb_buffer *amdgpu_bo_from_handle(struct radeon_winsys *rws,
struct winsys_handle *whandle,
- unsigned vm_alignment,
- unsigned *stride,
- unsigned *offset)
+ unsigned vm_alignment)
{
struct amdgpu_winsys *ws = amdgpu_winsys(rws);
struct amdgpu_winsys_bo *bo = NULL;
@@ -1433,11 +1431,6 @@ static struct pb_buffer *amdgpu_bo_from_handle(struct radeon_winsys *rws,
return NULL;
}
- if (stride)
- *stride = whandle->stride;
- if (offset)
- *offset = whandle->offset;
-
r = amdgpu_bo_import(ws->dev, type, whandle->handle, &result);
if (r)
return NULL;
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
index e9e0784e9ab..f8a7b89966a 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
@@ -1134,9 +1134,7 @@ static struct pb_buffer *radeon_winsys_bo_from_ptr(struct radeon_winsys *rws,
static struct pb_buffer *radeon_winsys_bo_from_handle(struct radeon_winsys *rws,
struct winsys_handle *whandle,
- unsigned vm_alignment,
- unsigned *stride,
- unsigned *offset)
+ unsigned vm_alignment)
{
struct radeon_drm_winsys *ws = radeon_drm_winsys(rws);
struct radeon_bo *bo;
@@ -1144,12 +1142,6 @@ static struct pb_buffer *radeon_winsys_bo_from_handle(struct radeon_winsys *rws,
unsigned handle;
uint64_t size = 0;
- if (!offset && whandle->offset != 0) {
- fprintf(stderr, "attempt to import unsupported winsys offset %u\n",
- whandle->offset);
- return NULL;
- }
-
/* We must maintain a list of pairs <handle, bo>, so that we always return
* the same BO for one particular handle. If we didn't do that and created
* more than one BO for the same handle and then relocated them in a CS,
@@ -1232,11 +1224,6 @@ static struct pb_buffer *radeon_winsys_bo_from_handle(struct radeon_winsys *rws,
done:
mtx_unlock(&ws->bo_handles_mutex);
- if (stride)
- *stride = whandle->stride;
- if (offset)
- *offset = whandle->offset;
-
if (ws->info.r600_has_virtual_memory && !bo->va) {
struct drm_radeon_gem_va va;