diff options
author | Jason Ekstrand <[email protected]> | 2016-02-22 16:48:19 -0800 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2016-02-27 10:26:14 -0800 |
commit | a0cd20eb7fc9396f5ba2ad201018989074091b8f (patch) | |
tree | 9c73d84b8ff138efdbde989eb9d95d71192dc1ac /src/intel/isl/isl_surface_state.c | |
parent | 9d5b8f7709d7cce1493cc0b38c750ad1173f7327 (diff) |
isl: Add a helper for filling a buffer surface state
Diffstat (limited to 'src/intel/isl/isl_surface_state.c')
-rw-r--r-- | src/intel/isl/isl_surface_state.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/intel/isl/isl_surface_state.c b/src/intel/isl/isl_surface_state.c index fe3c083c574..12f4fb6bd98 100644 --- a/src/intel/isl/isl_surface_state.c +++ b/src/intel/isl/isl_surface_state.c @@ -392,3 +392,48 @@ isl_genX(surf_fill_state_s)(const struct isl_device *dev, void *state, GENX(RENDER_SURFACE_STATE_pack)(NULL, state, &s); } + +void +isl_genX(buffer_fill_state_s)(void *state, + const struct isl_buffer_fill_state_info *restrict info) +{ + uint32_t num_elements = info->size / info->stride; + + struct GENX(RENDER_SURFACE_STATE) surface_state = { + .SurfaceType = SURFTYPE_BUFFER, + .SurfaceArray = false, + .SurfaceFormat = info->format, + .SurfaceVerticalAlignment = isl_to_gen_valign[4], + .SurfaceHorizontalAlignment = isl_to_gen_halign[4], + .Height = ((num_elements - 1) >> 7) & 0x3fff, + .Width = (num_elements - 1) & 0x7f, + .Depth = ((num_elements - 1) >> 21) & 0x3f, + .SurfacePitch = info->stride - 1, + .NumberofMultisamples = MULTISAMPLECOUNT_1, + +#if (GEN_GEN >= 8) + .TileMode = LINEAR, +#else + .TiledSurface = false, +#endif + +#if (GEN_GEN >= 8) + .SamplerL2BypassModeDisable = true, + .RenderCacheReadWriteMode = WriteOnlyCache, +#else + .RenderCacheReadWriteMode = 0, +#endif + + .MOCS = info->mocs, + +#if (GEN_GEN >= 8 || GEN_IS_HASWELL) + .ShaderChannelSelectRed = SCS_RED, + .ShaderChannelSelectGreen = SCS_GREEN, + .ShaderChannelSelectBlue = SCS_BLUE, + .ShaderChannelSelectAlpha = SCS_ALPHA, +#endif + .SurfaceBaseAddress = info->address, + }; + + GENX(RENDER_SURFACE_STATE_pack)(NULL, state, &surface_state); +} |