aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2017-08-17 00:17:05 -0700
committerKenneth Graunke <[email protected]>2017-08-19 00:46:36 -0700
commit5db9757bd76ce920b302974ca107802c6a6fbba9 (patch)
treeceabadf2e8bb0ba29e7fa626c4d7271c9be2d8bc
parent288621b1b7bdfaeab58a3b720c58c3417b206a06 (diff)
isl: Add a null surface fill function.
ISL already offers functions to fill out most kinds of SURFACE_STATE, so why not handle null surfaces too? Null surfaces are simple, so we can just take the dimensions, rather than an entirte fill structure. Reviewed-by: Jason Ekstrand <[email protected]>
-rw-r--r--src/intel/isl/isl.c7
-rw-r--r--src/intel/isl/isl.h4
-rw-r--r--src/intel/isl/isl_genX_priv.h3
-rw-r--r--src/intel/isl/isl_surface_state.c26
4 files changed, 40 insertions, 0 deletions
diff --git a/src/intel/isl/isl.c b/src/intel/isl/isl.c
index 3788f9c2ead..59f512fc050 100644
--- a/src/intel/isl/isl.c
+++ b/src/intel/isl/isl.c
@@ -1812,6 +1812,13 @@ isl_buffer_fill_state_s(const struct isl_device *dev, void *state,
}
void
+isl_null_fill_state(const struct isl_device *dev, void *state,
+ struct isl_extent3d size)
+{
+ isl_genX_call(dev, null_fill_state, state, size);
+}
+
+void
isl_emit_depth_stencil_hiz_s(const struct isl_device *dev, void *batch,
const struct isl_depth_stencil_hiz_emit_info *restrict info)
{
diff --git a/src/intel/isl/isl.h b/src/intel/isl/isl.h
index 0e6fc774862..ca4556ffcff 100644
--- a/src/intel/isl/isl.h
+++ b/src/intel/isl/isl.h
@@ -1691,6 +1691,10 @@ void
isl_buffer_fill_state_s(const struct isl_device *dev, void *state,
const struct isl_buffer_fill_state_info *restrict info);
+void
+isl_null_fill_state(const struct isl_device *dev, void *state,
+ struct isl_extent3d size);
+
#define isl_emit_depth_stencil_hiz(dev, batch, ...) \
isl_emit_depth_stencil_hiz_s((dev), (batch), \
&(struct isl_depth_stencil_hiz_emit_info) { __VA_ARGS__ })
diff --git a/src/intel/isl/isl_genX_priv.h b/src/intel/isl/isl_genX_priv.h
index f6336cbcd2d..a005e1c7b32 100644
--- a/src/intel/isl/isl_genX_priv.h
+++ b/src/intel/isl/isl_genX_priv.h
@@ -43,3 +43,6 @@ isl_genX(buffer_fill_state_s)(void *state,
void
isl_genX(emit_depth_stencil_hiz_s)(const struct isl_device *dev, void *batch,
const struct isl_depth_stencil_hiz_emit_info *restrict info);
+
+void
+isl_genX(null_fill_state)(void *state, struct isl_extent3d size);
diff --git a/src/intel/isl/isl_surface_state.c b/src/intel/isl/isl_surface_state.c
index cd8bef257fe..61cd4c69fc9 100644
--- a/src/intel/isl/isl_surface_state.c
+++ b/src/intel/isl/isl_surface_state.c
@@ -753,3 +753,29 @@ isl_genX(buffer_fill_state_s)(void *state,
GENX(RENDER_SURFACE_STATE_pack)(NULL, state, &s);
}
+
+void
+isl_genX(null_fill_state)(void *state, struct isl_extent3d size)
+{
+ struct GENX(RENDER_SURFACE_STATE) s = {
+ .SurfaceType = SURFTYPE_NULL,
+ .SurfaceFormat = ISL_FORMAT_B8G8R8A8_UNORM,
+#if GEN_GEN >= 7
+ .SurfaceArray = size.depth > 0,
+#endif
+#if GEN_GEN >= 8
+ .TileMode = YMAJOR,
+#else
+ .TiledSurface = true,
+ .TileWalk = TILEWALK_YMAJOR,
+#endif
+ .Width = size.width - 1,
+ .Height = size.height - 1,
+ .Depth = size.depth - 1,
+ .RenderTargetViewExtent = size.depth - 1,
+#if GEN_GEN <= 5
+ .ColorBufferComponentWriteDisables = 0xf,
+#endif
+ };
+ GENX(RENDER_SURFACE_STATE_pack)(NULL, state, &s);
+}