From 5db9757bd76ce920b302974ca107802c6a6fbba9 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Thu, 17 Aug 2017 00:17:05 -0700 Subject: [PATCH] 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 --- src/intel/isl/isl.c | 7 +++++++ src/intel/isl/isl.h | 4 ++++ src/intel/isl/isl_genX_priv.h | 3 +++ src/intel/isl/isl_surface_state.c | 26 ++++++++++++++++++++++++++ 4 files changed, 40 insertions(+) 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 @@ -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) 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); +} -- 2.30.2