}
}
-static inline uint32_t
-buf_3d_tiling_bits(enum i915_winsys_buffer_tile tiling)
-{
- uint32_t tiling_bits = 0;
-
- switch (tiling) {
- case I915_TILE_Y:
- tiling_bits |= BUF_3D_TILE_WALK_Y;
- FALLTHROUGH;
- case I915_TILE_X:
- tiling_bits |= BUF_3D_TILED_SURFACE;
- FALLTHROUGH;
- case I915_TILE_NONE:
- break;
- }
-
- return tiling_bits;
-}
-
static void update_framebuffer(struct i915_context *i915)
{
struct pipe_surface *cbuf_surface = i915->framebuffer.cbufs[0];
uint32_t draw_offset, draw_size;
if (cbuf_surface) {
+ struct i915_surface *surf = i915_surface(cbuf_surface);
struct i915_texture *tex = i915_texture(cbuf_surface->texture);
assert(tex);
i915->current.cbuf_bo = tex->buffer;
- i915->current.cbuf_flags = BUF_3D_ID_COLOR_BACK |
- BUF_3D_PITCH(tex->stride) | /* pitch in bytes */
- buf_3d_tiling_bits(tex->tiling);
+ i915->current.cbuf_flags = surf->buf_info;
layer = cbuf_surface->u.tex.first_layer;
/* What happens if no zbuf??
*/
if (depth_surface) {
+ struct i915_surface *surf = i915_surface(depth_surface);
struct i915_texture *tex = i915_texture(depth_surface->texture);
unsigned offset = i915_texture_offset(tex, depth_surface->u.tex.level,
depth_surface->u.tex.first_layer);
debug_printf("Depth offset is %d\n",offset);
i915->current.depth_bo = tex->buffer;
- i915->current.depth_flags = BUF_3D_ID_DEPTH |
- BUF_3D_PITCH(tex->stride) | /* pitch in bytes */
- buf_3d_tiling_bits(tex->tiling);
+ i915->current.depth_flags = surf->buf_info;
} else
i915->current.depth_bo = NULL;
i915->static_dirty |= I915_DST_BUF_DEPTH;
unsigned width0,
unsigned height0)
{
+ struct i915_texture *tex = i915_texture(pt);
struct i915_surface *surf;
assert(surf_tmpl->u.tex.first_layer == surf_tmpl->u.tex.last_layer);
ps->u.tex.last_layer = surf_tmpl->u.tex.last_layer;
ps->context = ctx;
+ if (util_format_is_depth_or_stencil(ps->format)) {
+ surf->buf_info = BUF_3D_ID_DEPTH;
+ } else {
+ surf->buf_info = BUF_3D_ID_COLOR_BACK;
+ }
+
+ surf->buf_info |= BUF_3D_PITCH(tex->stride); /* pitch in bytes */
+
+ switch (tex->tiling) {
+ case I915_TILE_Y:
+ surf->buf_info |= BUF_3D_TILED_SURFACE | BUF_3D_TILE_WALK_Y;
+ break;
+ case I915_TILE_X:
+ surf->buf_info |= BUF_3D_TILED_SURFACE;
+ break;
+ case I915_TILE_NONE:
+ break;
+ }
+
return ps;
}