summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2018-08-03 16:18:09 -0700
committerKenneth Graunke <[email protected]>2019-02-21 10:26:08 -0800
commit7972599eab442f5692d0a0496a8ebb5ea4df0ddf (patch)
treefab099cff38e65cc522d6cbb6552405b0f87acee
parent753646dd6bd83007494cc2fb1405b08dea92c36c (diff)
iris: actually emit stencil packets
-rw-r--r--src/gallium/drivers/iris/iris_clear.c28
-rw-r--r--src/gallium/drivers/iris/iris_resource.c24
-rw-r--r--src/gallium/drivers/iris/iris_resource.h4
-rw-r--r--src/gallium/drivers/iris/iris_state.c44
4 files changed, 52 insertions, 48 deletions
diff --git a/src/gallium/drivers/iris/iris_clear.c b/src/gallium/drivers/iris/iris_clear.c
index 2ee70855bf8..d05e69df16b 100644
--- a/src/gallium/drivers/iris/iris_clear.c
+++ b/src/gallium/drivers/iris/iris_clear.c
@@ -35,24 +35,6 @@
#include "iris_screen.h"
#include "intel/compiler/brw_compiler.h"
-static void
-split_depth_stencil_resources(struct pipe_resource *res,
- struct pipe_resource **out_z,
- struct pipe_resource **out_s)
-{
- const struct util_format_description *desc =
- util_format_description(res->format);
-
- if (util_format_has_depth(desc)) {
- *out_z = res;
- *out_s = iris_resource_get_separate_stencil(res);
- } else {
- assert(util_format_has_stencil(desc));
- *out_z = NULL;
- *out_s = res;
- }
-}
-
/**
* The pipe->clear() driver hook.
*
@@ -78,22 +60,22 @@ iris_clear(struct pipe_context *ctx,
if (buffers & PIPE_CLEAR_DEPTHSTENCIL) {
struct pipe_surface *psurf = cso_fb->zsbuf;
- struct pipe_resource *z_res;
- struct pipe_resource *stencil_res;
+ struct iris_resource *z_res;
+ struct iris_resource *stencil_res;
struct blorp_surf z_surf;
struct blorp_surf stencil_surf;
const unsigned num_layers =
psurf->u.tex.last_layer - psurf->u.tex.first_layer + 1;
- split_depth_stencil_resources(psurf->texture, &z_res, &stencil_res);
+ iris_get_depth_stencil_resources(psurf->texture, &z_res, &stencil_res);
if (z_res) {
- iris_blorp_surf_for_resource(&z_surf, z_res,
+ iris_blorp_surf_for_resource(&z_surf, &z_res->base,
ISL_AUX_USAGE_NONE, true);
}
if (stencil_res) {
- iris_blorp_surf_for_resource(&stencil_surf, stencil_res,
+ iris_blorp_surf_for_resource(&stencil_surf, &stencil_res->base,
ISL_AUX_USAGE_NONE, true);
}
diff --git a/src/gallium/drivers/iris/iris_resource.c b/src/gallium/drivers/iris/iris_resource.c
index 3417cef893c..6a2a6c3b79f 100644
--- a/src/gallium/drivers/iris/iris_resource.c
+++ b/src/gallium/drivers/iris/iris_resource.c
@@ -170,6 +170,30 @@ iris_resource_get_separate_stencil(struct pipe_resource *p_res)
return p_res->next;
}
+void
+iris_get_depth_stencil_resources(struct pipe_resource *res,
+ struct iris_resource **out_z,
+ struct iris_resource **out_s)
+{
+ if (!res) {
+ *out_z = NULL;
+ *out_s = NULL;
+ return;
+ }
+
+ const struct util_format_description *desc =
+ util_format_description(res->format);
+
+ if (util_format_has_depth(desc)) {
+ *out_z = (void *) res;
+ *out_s = (void *) iris_resource_get_separate_stencil(res);
+ } else {
+ assert(util_format_has_stencil(desc));
+ *out_z = NULL;
+ *out_s = (void *) res;
+ }
+}
+
static void
iris_resource_destroy(struct pipe_screen *screen,
struct pipe_resource *resource)
diff --git a/src/gallium/drivers/iris/iris_resource.h b/src/gallium/drivers/iris/iris_resource.h
index 4679036fcd5..06ade481921 100644
--- a/src/gallium/drivers/iris/iris_resource.h
+++ b/src/gallium/drivers/iris/iris_resource.h
@@ -89,6 +89,10 @@ enum isl_format iris_isl_format_for_pipe_format(enum pipe_format pf);
struct pipe_resource *iris_resource_get_separate_stencil(struct pipe_resource *);
+void iris_get_depth_stencil_resources(struct pipe_resource *res,
+ struct iris_resource **out_z,
+ struct iris_resource **out_s);
+
void iris_init_screen_resource_functions(struct pipe_screen *pscreen);
#endif
diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c
index d67c9bd84b2..c8ae43fa01d 100644
--- a/src/gallium/drivers/iris/iris_state.c
+++ b/src/gallium/drivers/iris/iris_state.c
@@ -1641,6 +1641,8 @@ iris_set_framebuffer_state(struct pipe_context *ctx,
struct iris_screen *screen = (struct iris_screen *)ctx->screen;
struct isl_device *isl_dev = &screen->isl_dev;
struct pipe_framebuffer_state *cso = &ice->state.framebuffer;
+ struct iris_resource *zres;
+ struct iris_resource *stencil_res;
unsigned samples = util_framebuffer_get_num_samples(state);
@@ -1674,41 +1676,33 @@ iris_set_framebuffer_state(struct pipe_context *ctx,
.mocs = MOCS_WB,
};
- struct iris_resource *zres =
- (void *) (cso->zsbuf ? cso->zsbuf->texture : NULL);
-
- if (zres) {
- view.usage |= ISL_SURF_USAGE_DEPTH_BIT;
-
- info.depth_surf = &zres->surf;
- info.depth_address = zres->bo->gtt_offset;
-
- view.format = zres->surf.format;
+ if (cso->zsbuf) {
+ iris_get_depth_stencil_resources(cso->zsbuf->texture, &zres,
+ &stencil_res);
view.base_level = cso->zsbuf->u.tex.level;
view.base_array_layer = cso->zsbuf->u.tex.first_layer;
view.array_len =
cso->zsbuf->u.tex.last_layer - cso->zsbuf->u.tex.first_layer + 1;
- info.hiz_usage = ISL_AUX_USAGE_NONE;
- }
+ if (zres) {
+ view.usage |= ISL_SURF_USAGE_DEPTH_BIT;
-#if 0
- if (stencil_mt) {
- view.usage |= ISL_SURF_USAGE_STENCIL_BIT;
- info.stencil_surf = &stencil_mt->surf;
-
- if (!depth_mt) {
- view.base_level = stencil_irb->mt_level - stencil_irb->mt->first_level;
- view.base_array_layer = stencil_irb->mt_layer;
- view.array_len = MAX2(stencil_irb->layer_count, 1);
- view.format = stencil_mt->surf.format;
+ info.depth_surf = &zres->surf;
+ info.depth_address = zres->bo->gtt_offset;
+ info.hiz_usage = ISL_AUX_USAGE_NONE;
+
+ view.format = zres->surf.format;
}
- uint32_t stencil_offset = 0;
- info.stencil_address = stencil_mt->bo->gtt_offset + stencil_mt->offset;
+ if (stencil_res) {
+ view.usage |= ISL_SURF_USAGE_STENCIL_BIT;
+ info.stencil_surf = &stencil_res->surf;
+ info.stencil_address = stencil_res->bo->gtt_offset;
+ if (!zres)
+ view.format = stencil_res->surf.format;
+ }
}
-#endif
isl_emit_depth_stencil_hiz_s(isl_dev, cso_z->packets, &info);