isl: Add a null surface fill function.
authorKenneth Graunke <kenneth@whitecape.org>
Thu, 17 Aug 2017 07:17:05 +0000 (00:17 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Sat, 19 Aug 2017 07:46:36 +0000 (00:46 -0700)
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 <jason@jlekstrand.net>
src/intel/isl/isl.c
src/intel/isl/isl.h
src/intel/isl/isl_genX_priv.h
src/intel/isl/isl_surface_state.c

index 3788f9c2ead7219ed672cef0f1eb312e48ffcc02..59f512fc05047612f18c0307c9bd006c125191d6 100644 (file)
@@ -1811,6 +1811,13 @@ isl_buffer_fill_state_s(const struct isl_device *dev, void *state,
    isl_genX_call(dev, buffer_fill_state_s, state, info);
 }
 
+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)
index 0e6fc7748621f926084f962840df33433205f709..ca4556ffcff9663d76cd3f7e881822ec859c3f99 100644 (file)
@@ -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__ })
index f6336cbcd2d0700a177afb772e113d82abf4845c..a005e1c7b32c958bd908654e48ecc980d0c5382e 100644 (file)
@@ -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);
index cd8bef257fed0207e3fa5b250971f6bf624c2d7f..61cd4c69fc9d32163ba3a93054c10cf5dd868c8d 100644 (file)
@@ -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);
+}