[PIPE_FORMAT_Z16_UNORM] = ISL_FORMAT_R16_UNORM,
[PIPE_FORMAT_Z32_UNORM] = ISL_FORMAT_R32_UNORM,
[PIPE_FORMAT_Z32_FLOAT] = ISL_FORMAT_R32_FLOAT,
- //[PIPE_FORMAT_Z24_UNORM_S8_UINT] = ISL_FORMAT_R24_UNORM_S8_UINT,
+ /* XXX: separate stencil */
+ [PIPE_FORMAT_Z24_UNORM_S8_UINT] = ISL_FORMAT_R24_UNORM_X8_TYPELESS,
//[PIPE_FORMAT_S8_UINT_Z24_UNORM] = ISL_FORMAT_S8_UINT_Z24_UNORM,
- [PIPE_FORMAT_Z24X8_UNORM] = ISL_FORMAT_R24_UNORM_X8_TYPELESS,
- //[PIPE_FORMAT_X8Z24_UNORM] = ISL_FORMAT_R24_UNORM_X8_TYPELESS,
+ //[PIPE_FORMAT_Z24X8_UNORM] = ISL_FORMAT_R24_UNORM_X8_TYPELESS,
+ [PIPE_FORMAT_X8Z24_UNORM] = ISL_FORMAT_R24_UNORM_X8_TYPELESS,
[PIPE_FORMAT_S8_UINT] = ISL_FORMAT_R8_UINT,
[PIPE_FORMAT_R64_FLOAT] = ISL_FORMAT_R64_FLOAT,
[PIPE_FORMAT_R64G64_FLOAT] = ISL_FORMAT_R64G64_FLOAT,
#include "drm-uapi/drm_fourcc.h"
#include "drm-uapi/i915_drm.h"
+// XXX: u_transfer_helper...for separate stencil...
+
enum modifier_priority {
MODIFIER_PRIORITY_INVALID = 0,
MODIFIER_PRIORITY_LINEAR,
{
isl_surf_usage_flags_t usage = 0;
- if (bindings & PIPE_BIND_DEPTH_STENCIL)
- usage |= ISL_SURF_USAGE_DEPTH_BIT | ISL_SURF_USAGE_STENCIL_BIT;
-
if (bindings & PIPE_BIND_RENDER_TARGET)
usage |= ISL_SURF_USAGE_RENDER_TARGET_BIT;
- if (bindings & PIPE_BIND_SHADER_IMAGE)
+ if (bindings & PIPE_BIND_SAMPLER_VIEW)
+ usage |= ISL_SURF_USAGE_TEXTURE_BIT;
+
+ if (bindings & (PIPE_BIND_SHADER_IMAGE | PIPE_BIND_SHADER_BUFFER))
usage |= ISL_SURF_USAGE_STORAGE_BIT;
if (bindings & PIPE_BIND_DISPLAY_TARGET)
usage |= ISL_SURF_USAGE_DISPLAY_BIT;
- /* XXX: what to do with these? */
- if (bindings & PIPE_BIND_BLENDABLE)
- ;
- if (bindings & PIPE_BIND_SAMPLER_VIEW)
- ;
- if (bindings & PIPE_BIND_VERTEX_BUFFER)
- ;
- if (bindings & PIPE_BIND_INDEX_BUFFER)
- ;
- if (bindings & PIPE_BIND_CONSTANT_BUFFER)
- ;
-
- if (bindings & PIPE_BIND_STREAM_OUTPUT)
- ;
- if (bindings & PIPE_BIND_CURSOR)
- ;
- if (bindings & PIPE_BIND_CUSTOM)
- ;
-
- if (bindings & PIPE_BIND_GLOBAL)
- ;
- if (bindings & PIPE_BIND_SHADER_BUFFER)
- ;
- if (bindings & PIPE_BIND_COMPUTE_RESOURCE)
- ;
- if (bindings & PIPE_BIND_COMMAND_ARGS_BUFFER)
- ;
- if (bindings & PIPE_BIND_QUERY_BUFFER)
- ;
-
return usage;
}
if (!res)
return NULL;
+ bool depth = util_format_is_depth_or_stencil(templ->format);
+
uint64_t modifier = DRM_FORMAT_MOD_INVALID;
- if (modifiers_count == 0) {
- /* Display is X-tiled for historical reasons. */
- modifier = (templ->bind & PIPE_BIND_DISPLAY_TARGET) ?
- I915_FORMAT_MOD_X_TILED : I915_FORMAT_MOD_Y_TILED;
+ if (modifiers_count == 0 || !modifiers) {
+ if (depth) {
+ modifier = I915_FORMAT_MOD_Y_TILED;
+ } else if (templ->bind & PIPE_BIND_DISPLAY_TARGET) {
+ /* Display is X-tiled for historical reasons. */
+ modifier = I915_FORMAT_MOD_X_TILED;
+ } else {
+ modifier = I915_FORMAT_MOD_Y_TILED;
+ }
/* XXX: make sure this doesn't do stupid things for internal textures */
}
if (templ->target == PIPE_TEXTURE_CUBE)
usage |= ISL_SURF_USAGE_CUBE_BIT;
+ // XXX: separate stencil...
+ enum pipe_format pfmt = templ->format;
+
+ if (util_format_is_depth_or_stencil(pfmt) &&
+ templ->usage != PIPE_USAGE_STAGING)
+ usage |= ISL_SURF_USAGE_DEPTH_BIT;
+
+ if (util_format_is_depth_and_stencil(pfmt)) {
+ // XXX: Z32S8
+ pfmt = PIPE_FORMAT_X8Z24_UNORM;
+ }
+
+ enum isl_format isl_format = iris_isl_format_for_pipe_format(pfmt);
+ assert(isl_format != ISL_FORMAT_UNSUPPORTED);
+
UNUSED const bool isl_surf_created_successfully =
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),
+ .format = isl_format,
.width = templ->width0,
.height = templ->height0,
.depth = templ->depth0,
#include "pipe/p_context.h"
#include "pipe/p_screen.h"
#include "util/u_inlines.h"
+#include "util/u_format.h"
#include "util/u_transfer.h"
#include "util/u_upload_mgr.h"
#include "i915_drm.h"
struct iris_screen *screen = (struct iris_screen *)ctx->screen;
struct iris_surface *surf = calloc(1, sizeof(struct iris_surface));
struct pipe_surface *psurf = &surf->pipe;
- struct iris_resource *itex = (struct iris_resource *) tex;
+ struct iris_resource *res = (struct iris_resource *) tex;
if (!surf)
return NULL;
psurf->u.tex.last_layer = tmpl->u.tex.last_layer;
psurf->u.tex.level = tmpl->u.tex.level;
+ unsigned usage = 0;
+ if (tmpl->writable)
+ usage = ISL_SURF_USAGE_STORAGE_BIT;
+ else if (util_format_is_depth_or_stencil(tmpl->format))
+ usage = ISL_SURF_USAGE_DEPTH_BIT;
+ else
+ usage = ISL_SURF_USAGE_RENDER_TARGET_BIT;
+
surf->view = (struct isl_view) {
.format = iris_isl_format_for_pipe_format(tmpl->format),
.base_level = tmpl->u.tex.level,
.base_array_layer = tmpl->u.tex.first_layer,
.array_len = tmpl->u.tex.last_layer - tmpl->u.tex.first_layer + 1,
.swizzle = ISL_SWIZZLE_IDENTITY,
- // XXX: DEPTH_BIt, STENCIL_BIT...CUBE_BIT? Other bits?!
- .usage = ISL_SURF_USAGE_RENDER_TARGET_BIT,
+ .usage = usage,
};
+ /* Bail early for depth/stencil */
+ if (res->surf.usage & (ISL_SURF_USAGE_DEPTH_BIT |
+ ISL_SURF_USAGE_STENCIL_BIT))
+ return psurf;
+
void *map = NULL;
u_upload_alloc(ice->state.surface_uploader, 0,
4 * GENX(RENDER_SURFACE_STATE_length), 64,
surf->surface_state_offset += iris_bo_offset_from_base_address(state_bo);
isl_surf_fill_state(&screen->isl_dev, map,
- .surf = &itex->surf, .view = &surf->view,
+ .surf = &res->surf, .view = &surf->view,
.mocs = MOCS_WB,
- .address = itex->bo->gtt_offset);
+ .address = res->bo->gtt_offset);
// .aux_surf =
// .clear_color = clear_color,