return map[tiling];
}
+static struct pipe_resource *
+iris_resource_from_user_memory(struct pipe_screen *pscreen,
+ const struct pipe_resource *templ,
+ void *user_memory)
+{
+ struct iris_screen *screen = (struct iris_screen *)pscreen;
+ struct iris_bufmgr *bufmgr = screen->bufmgr;
+ struct iris_resource *res = iris_alloc_resource(pscreen, templ);
+ if (!res)
+ return NULL;
+
+ res->bo = iris_bo_create_userptr(bufmgr, "user",
+ user_memory, templ->width0,
+ IRIS_MEMZONE_OTHER);
+ if (!res->bo) {
+ free(res);
+ return NULL;
+ }
+
+ res->internal_format = templ->format;
+
+ // XXX: usage...
+ isl_surf_usage_flags_t isl_usage = 0;
+
+ isl_surf_init(&screen->isl_dev, &res->surf,
+ .dim = target_to_isl_surf_dim(templ->target),
+ .format = iris_isl_format_for_pipe_format(templ->format),
+ .width = templ->width0,
+ .height = templ->height0,
+ .depth = templ->depth0,
+ .levels = templ->last_level + 1,
+ .array_len = templ->array_size,
+ .samples = MAX2(templ->nr_samples, 1),
+ .min_alignment_B = 0,
+ .row_pitch_B = 0,
+ .usage = isl_usage,
+ .tiling_flags = 1 << ISL_TILING_LINEAR);
+
+ assert(res->bo->tiling_mode == isl_tiling_to_i915_tiling(res->surf.tiling));
+
+ return &res->base;
+}
+
static struct pipe_resource *
iris_resource_from_handle(struct pipe_screen *pscreen,
const struct pipe_resource *templ,
pscreen->resource_create_with_modifiers =
iris_resource_create_with_modifiers;
pscreen->resource_create = u_transfer_helper_resource_create;
+ pscreen->resource_from_user_memory = iris_resource_from_user_memory;
pscreen->resource_from_handle = iris_resource_from_handle;
pscreen->resource_get_handle = iris_resource_get_handle;
pscreen->resource_destroy = u_transfer_helper_resource_destroy;
iris_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
{
struct iris_screen *screen = (struct iris_screen *)pscreen;
+ const struct gen_device_info *devinfo = &screen->devinfo;
switch (param) {
case PIPE_CAP_NPOT_TEXTURES:
case PIPE_CAP_FRAMEBUFFER_MSAA_CONSTRAINTS:
return 0;
case PIPE_CAP_RESOURCE_FROM_USER_MEMORY:
+ /* AMD_pinned_memory assumes the flexibility of using client memory
+ * for any buffer (incl. vertex buffers) which rules out the prospect
+ * of using snooped buffers, as using snooped buffers without
+ * cogniscience is likely to be detrimental to performance and require
+ * extensive checking in the driver for correctness, e.g. to prevent
+ * illegal snoop <-> snoop transfers.
+ */
+ return devinfo->has_llc;
case PIPE_CAP_DEVICE_RESET_STATUS_QUERY:
case PIPE_CAP_TGSI_TXQS:
case PIPE_CAP_SHAREABLE_SHADERS: