summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2018-07-31 10:33:35 +1000
committerKenneth Graunke <[email protected]>2019-02-21 10:26:08 -0800
commit9d39e6921970013ecdbbe432369c4be4fd0e14a0 (patch)
tree83a5ea54c8fccd9c9fa413d8f87ad49c1295f921
parent02b82fe80a7536e072515f7a86f9f2ad374badb1 (diff)
iris: fix some hangs around null framebuffers
This fixes some cases in fbo-none* and framebuffer_no_attachments. I'm not sure this is correct otherwise, the tests don't all pass yet No idea if this is in any way the correct answer
-rw-r--r--src/gallium/drivers/iris/iris_context.h2
-rw-r--r--src/gallium/drivers/iris/iris_state.c28
2 files changed, 27 insertions, 3 deletions
diff --git a/src/gallium/drivers/iris/iris_context.h b/src/gallium/drivers/iris/iris_context.h
index 5aba49a2832..7db903acbc3 100644
--- a/src/gallium/drivers/iris/iris_context.h
+++ b/src/gallium/drivers/iris/iris_context.h
@@ -316,6 +316,8 @@ struct iris_context {
struct iris_state_ref unbound_tex;
+ struct iris_state_ref null_fb;
+
struct u_upload_mgr *surface_uploader;
// XXX: may want a separate uploader for "hey I made a CSO!" vs
// "I'm streaming this out at draw time and never want it again!"
diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c
index afe95d4f6fe..abbdcda97ca 100644
--- a/src/gallium/drivers/iris/iris_state.c
+++ b/src/gallium/drivers/iris/iris_state.c
@@ -1448,6 +1448,12 @@ iris_set_framebuffer_state(struct pipe_context *ctx,
isl_emit_depth_stencil_hiz_s(isl_dev, cso_z->packets, &info);
+ /* Make a null surface for unbound buffers */
+ void *null_surf_map =
+ upload_state(ice->state.surface_uploader, &ice->state.null_fb,
+ 4 * GENX(RENDER_SURFACE_STATE_length), 64);
+ isl_null_fill_state(&screen->isl_dev, null_surf_map, isl_extent3d(cso->width, cso->height, cso->layers ? cso->layers : 1));
+
ice->state.dirty |= IRIS_DIRTY_DEPTH_BUFFER;
/* Render target change */
@@ -2630,6 +2636,16 @@ use_null_surface(struct iris_batch *batch, struct iris_context *ice)
}
static uint32_t
+use_null_fb_surface(struct iris_batch *batch, struct iris_context *ice)
+{
+ struct iris_bo *state_bo = iris_resource_bo(ice->state.null_fb.res);
+
+ iris_use_pinned_bo(batch, state_bo, false);
+
+ return ice->state.null_fb.offset;
+}
+
+static uint32_t
use_ssbo(struct iris_batch *batch, struct iris_context *ice,
struct iris_shader_state *shs, int i)
{
@@ -2670,9 +2686,15 @@ iris_populate_binding_table(struct iris_context *ice,
if (stage == MESA_SHADER_FRAGMENT) {
struct pipe_framebuffer_state *cso_fb = &ice->state.framebuffer;
- for (unsigned i = 0; i < cso_fb->nr_cbufs; i++) {
- bt_map[s++] = use_surface(batch, cso_fb->cbufs[i], true);
- }
+ if (cso_fb->nr_cbufs) {
+ for (unsigned i = 0; i < cso_fb->nr_cbufs; i++) {
+ if (cso_fb->cbufs[i])
+ bt_map[s++] = use_surface(batch, cso_fb->cbufs[i], true);
+ else
+ bt_map[s++] = use_null_fb_surface(batch, ice);
+ }
+ } else
+ bt_map[s++] = use_null_fb_surface(batch, ice);
}
//assert(prog_data->binding_table.texture_start ==