* ``PIPE_CAP_MULTISAMPLE_Z_RESOLVE``: Whether the driver supports blitting
a multisampled depth buffer into a single-sampled texture (or depth buffer).
Only the first sampled should be copied.
+* ``PIPE_CAP_RESOURCE_FROM_USER_MEMORY``: Whether the driver can create
+ a pipe_resource where an already-existing piece of (malloc'd) user memory
+ is used as its backing storage. In other words, whether the driver can map
+ existing user memory into the device address space for direct device access.
+ The create function is pipe_screen::resource_from_user_memory. The address
+ and size must be page-aligned.
.. _pipe_capf:
case PIPE_CAP_VERTEXID_NOBASE:
case PIPE_CAP_POLYGON_OFFSET_CLAMP:
case PIPE_CAP_MULTISAMPLE_Z_RESOLVE:
+ case PIPE_CAP_RESOURCE_FROM_USER_MEMORY:
return 0;
case PIPE_CAP_MAX_DUAL_SOURCE_RENDER_TARGETS:
case PIPE_CAP_CONDITIONAL_RENDER_INVERTED:
case PIPE_CAP_SAMPLER_VIEW_TARGET:
case PIPE_CAP_MULTISAMPLE_Z_RESOLVE:
+ case PIPE_CAP_RESOURCE_FROM_USER_MEMORY:
return 0;
case PIPE_CAP_VENDOR_ID:
case PIPE_CAP_POLYGON_OFFSET_CLAMP:
return 1;
case PIPE_CAP_MULTISAMPLE_Z_RESOLVE:
+ case PIPE_CAP_RESOURCE_FROM_USER_MEMORY:
return 0;
}
/* should only get here on unhandled cases */
case PIPE_CAP_VERTEXID_NOBASE:
case PIPE_CAP_POLYGON_OFFSET_CLAMP:
case PIPE_CAP_MULTISAMPLE_Z_RESOLVE:
+ case PIPE_CAP_RESOURCE_FROM_USER_MEMORY:
return 0;
case PIPE_CAP_VENDOR_ID:
case PIPE_CAP_DRAW_INDIRECT:
case PIPE_CAP_VERTEXID_NOBASE:
case PIPE_CAP_MULTISAMPLE_Z_RESOLVE: /* potentially supported on some hw */
+ case PIPE_CAP_RESOURCE_FROM_USER_MEMORY:
return 0;
case PIPE_CAP_VENDOR_ID:
case PIPE_CAP_FAKE_SW_MSAA:
case PIPE_CAP_TGSI_VS_WINDOW_SPACE_POSITION:
case PIPE_CAP_VERTEXID_NOBASE:
+ case PIPE_CAP_RESOURCE_FROM_USER_MEMORY:
return 0;
case PIPE_CAP_VENDOR_ID:
case PIPE_CAP_VERTEXID_NOBASE:
case PIPE_CAP_POLYGON_OFFSET_CLAMP:
case PIPE_CAP_MULTISAMPLE_Z_RESOLVE:
+ case PIPE_CAP_RESOURCE_FROM_USER_MEMORY:
return 0;
/* SWTCL-only features. */
case PIPE_CAP_POLYGON_OFFSET_CLAMP:
return 0;
case PIPE_CAP_MULTISAMPLE_Z_RESOLVE:
+ case PIPE_CAP_RESOURCE_FROM_USER_MEMORY:
return 0;
}
/* should only get here on unhandled cases */
/* XXX: Query the host ? */
return 1;
case PIPE_CAP_UMA:
+ case PIPE_CAP_RESOURCE_FROM_USER_MEMORY:
return 0;
}
case PIPE_CAP_VERTEXID_NOBASE:
case PIPE_CAP_POLYGON_OFFSET_CLAMP:
case PIPE_CAP_MULTISAMPLE_Z_RESOLVE:
+ case PIPE_CAP_RESOURCE_FROM_USER_MEMORY:
return 0;
/* Stream output. */
PIPE_CAP_VERTEXID_NOBASE = 112,
PIPE_CAP_POLYGON_OFFSET_CLAMP = 113,
PIPE_CAP_MULTISAMPLE_Z_RESOLVE = 114,
+ PIPE_CAP_RESOURCE_FROM_USER_MEMORY = 115,
};
#define PIPE_QUIRK_TEXTURE_BORDER_COLOR_SWIZZLE_NV50 (1 << 0)
const struct pipe_resource *templat,
struct winsys_handle *handle);
+ /**
+ * Create a resource from user memory. This maps the user memory into
+ * the device address space.
+ */
+ struct pipe_resource * (*resource_from_user_memory)(struct pipe_screen *,
+ const struct pipe_resource *t,
+ void *user_memory);
+
/**
* Get a winsys_handle from a texture. Some platforms/winsys requires
* that the texture is created with a special usage flag like
struct st_buffer_object *st_obj = st_buffer_object(obj);
unsigned bind, pipe_usage, pipe_flags = 0;
- if (size && data && st_obj->buffer &&
+ if (target != GL_EXTERNAL_VIRTUAL_MEMORY_BUFFER_AMD &&
+ size && data && st_obj->buffer &&
st_obj->Base.Size == size &&
st_obj->Base.Usage == usage &&
st_obj->Base.StorageFlags == storageFlags) {
}
if (size != 0) {
+ struct pipe_screen *screen = pipe->screen;
struct pipe_resource buffer;
memset(&buffer, 0, sizeof buffer);
buffer.depth0 = 1;
buffer.array_size = 1;
- st_obj->buffer = pipe->screen->resource_create(pipe->screen, &buffer);
+ if (target == GL_EXTERNAL_VIRTUAL_MEMORY_BUFFER_AMD) {
+ st_obj->buffer =
+ screen->resource_from_user_memory(screen, &buffer, (void*)data);
+ }
+ else {
+ st_obj->buffer = screen->resource_create(screen, &buffer);
+
+ if (st_obj->buffer && data)
+ pipe_buffer_write(pipe, st_obj->buffer, 0, size, data);
+ }
if (!st_obj->buffer) {
/* out of memory */
st_obj->Base.Size = 0;
return GL_FALSE;
}
-
- if (data)
- pipe_buffer_write(pipe, st_obj->buffer, 0, size, data);
}
/* BufferData may change an array or uniform buffer, need to update it */
{ o(EXT_texture_swizzle), PIPE_CAP_TEXTURE_SWIZZLE },
{ o(EXT_transform_feedback), PIPE_CAP_MAX_STREAM_OUTPUT_BUFFERS },
+ { o(AMD_pinned_memory), PIPE_CAP_RESOURCE_FROM_USER_MEMORY },
{ o(AMD_seamless_cubemap_per_texture), PIPE_CAP_SEAMLESS_CUBE_MAP_PER_TEXTURE },
{ o(ATI_separate_stencil), PIPE_CAP_TWO_SIDED_STENCIL },
{ o(ATI_texture_mirror_once), PIPE_CAP_TEXTURE_MIRROR_CLAMP },