#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,
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 */
return NULL;
}
- buffer = rws->buffer_from_handle(rws, whandle, 0, &stride, NULL);
+ buffer = rws->buffer_from_handle(rws, whandle, 0);
if (!buffer)
return NULL;
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:
#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>
{
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;
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;
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;
}
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;
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;
* \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
{
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 &&
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,
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;
memobj->b.dedicated = dedicated;
memobj->buf = buf;
- memobj->stride = stride;
+ memobj->stride = whandle->stride;
return (struct pipe_memory_object *)memobj;
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;
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;
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;
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,
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;