diff options
author | Jan Zielinski <[email protected]> | 2019-07-17 17:22:16 +0200 |
---|---|---|
committer | Jan Zielinski <[email protected]> | 2019-07-18 16:17:00 +0200 |
commit | 6f7306c029a7ebe776b513a157b939c866f4d240 (patch) | |
tree | 4a32632558b8c5eae6a46bbc2bee0b764b95002b /src/gallium/drivers/swr/rasterizer/core | |
parent | 4627a0c4ebc777716e7cadfd80e4f9d5b411762b (diff) |
swr/rast: Refactor memory API between rasterizer core and swr
This commit cleans up API between the core of the rasterizer and swr.
Some formatting changes are also done.
Reviewed-by: Alok Hota <[email protected]>
Diffstat (limited to 'src/gallium/drivers/swr/rasterizer/core')
8 files changed, 25 insertions, 134 deletions
diff --git a/src/gallium/drivers/swr/rasterizer/core/api.cpp b/src/gallium/drivers/swr/rasterizer/core/api.cpp index 04eabc4d468..228e85a25c9 100644 --- a/src/gallium/drivers/swr/rasterizer/core/api.cpp +++ b/src/gallium/drivers/swr/rasterizer/core/api.cpp @@ -193,15 +193,14 @@ HANDLE SwrCreateContext(SWR_CREATECONTEXT_INFO* pCreateInfo) pContext->pHotTileMgr = new HotTileMgr(); // initialize callback functions - pContext->pfnLoadTile = pCreateInfo->pfnLoadTile; - pContext->pfnStoreTile = pCreateInfo->pfnStoreTile; - pContext->pfnClearTile = pCreateInfo->pfnClearTile; - pContext->pfnTranslateGfxptrForRead = pCreateInfo->pfnTranslateGfxptrForRead; - pContext->pfnTranslateGfxptrForWrite = pCreateInfo->pfnTranslateGfxptrForWrite; - pContext->pfnMakeGfxPtr = pCreateInfo->pfnMakeGfxPtr; - pContext->pfnUpdateSoWriteOffset = pCreateInfo->pfnUpdateSoWriteOffset; - pContext->pfnUpdateStats = pCreateInfo->pfnUpdateStats; - pContext->pfnUpdateStatsFE = pCreateInfo->pfnUpdateStatsFE; + pContext->pfnLoadTile = pCreateInfo->pfnLoadTile; + pContext->pfnStoreTile = pCreateInfo->pfnStoreTile; + pContext->pfnTranslateGfxptrForRead = pCreateInfo->pfnTranslateGfxptrForRead; + pContext->pfnTranslateGfxptrForWrite = pCreateInfo->pfnTranslateGfxptrForWrite; + pContext->pfnMakeGfxPtr = pCreateInfo->pfnMakeGfxPtr; + pContext->pfnUpdateSoWriteOffset = pCreateInfo->pfnUpdateSoWriteOffset; + pContext->pfnUpdateStats = pCreateInfo->pfnUpdateStats; + pContext->pfnUpdateStatsFE = pCreateInfo->pfnUpdateStatsFE; // pass pointer to bucket manager back to caller @@ -1769,7 +1768,4 @@ void SwrGetInterface(SWR_INTERFACE& out_funcs) out_funcs.pfnSwrEnableStatsBE = SwrEnableStatsBE; out_funcs.pfnSwrEndFrame = SwrEndFrame; out_funcs.pfnSwrInit = SwrInit; - out_funcs.pfnSwrLoadHotTile = SwrLoadHotTile; - out_funcs.pfnSwrStoreHotTileToSurface = SwrStoreHotTileToSurface; - out_funcs.pfnSwrStoreHotTileClear = SwrStoreHotTileClear; } diff --git a/src/gallium/drivers/swr/rasterizer/core/api.h b/src/gallium/drivers/swr/rasterizer/core/api.h index e31e0446ba6..c842859ba32 100644 --- a/src/gallium/drivers/swr/rasterizer/core/api.h +++ b/src/gallium/drivers/swr/rasterizer/core/api.h @@ -145,17 +145,15 @@ typedef void(SWR_API* PFN_CLEAR_TILE)(HANDLE hPrivateContex uint32_t renderTargetArrayIndex, const float* pClearColor); +typedef void*(SWR_API* PFN_TRANSLATE_GFXPTR_FOR_READ)(HANDLE hPrivateContext, + gfxptr_t xpAddr, + bool* pbNullTileAccessed); -typedef void* (SWR_API* PFN_TRANSLATE_GFXPTR_FOR_READ)(HANDLE hPrivateContext, - gfxptr_t xpAddr, - bool* pbNullTileAccessed); +typedef void*(SWR_API* PFN_TRANSLATE_GFXPTR_FOR_WRITE)(HANDLE hPrivateContext, + gfxptr_t xpAddr, + bool* pbNullTileAccessed); -typedef void* (SWR_API* PFN_TRANSLATE_GFXPTR_FOR_WRITE)(HANDLE hPrivateContext, - gfxptr_t xpAddr, - bool* pbNullTileAccessed); - -typedef gfxptr_t(SWR_API* PFN_MAKE_GFXPTR)(HANDLE hPrivateContext, - void* sysAddr); +typedef gfxptr_t(SWR_API* PFN_MAKE_GFXPTR)(HANDLE hPrivateContext, void* sysAddr); ////////////////////////////////////////////////////////////////////////// /// @brief Callback to allow driver to update their copy of streamout write offset. @@ -250,15 +248,14 @@ struct SWR_CREATECONTEXT_INFO SWR_WORKER_PRIVATE_STATE* pWorkerPrivateState; // Callback functions - PFN_LOAD_TILE pfnLoadTile; - PFN_STORE_TILE pfnStoreTile; - PFN_CLEAR_TILE pfnClearTile; - PFN_TRANSLATE_GFXPTR_FOR_READ pfnTranslateGfxptrForRead; - PFN_TRANSLATE_GFXPTR_FOR_WRITE pfnTranslateGfxptrForWrite; - PFN_MAKE_GFXPTR pfnMakeGfxPtr; - PFN_UPDATE_SO_WRITE_OFFSET pfnUpdateSoWriteOffset; - PFN_UPDATE_STATS pfnUpdateStats; - PFN_UPDATE_STATS_FE pfnUpdateStatsFE; + PFN_LOAD_TILE pfnLoadTile; + PFN_STORE_TILE pfnStoreTile; + PFN_TRANSLATE_GFXPTR_FOR_READ pfnTranslateGfxptrForRead; + PFN_TRANSLATE_GFXPTR_FOR_WRITE pfnTranslateGfxptrForWrite; + PFN_MAKE_GFXPTR pfnMakeGfxPtr; + PFN_UPDATE_SO_WRITE_OFFSET pfnUpdateSoWriteOffset; + PFN_UPDATE_STATS pfnUpdateStats; + PFN_UPDATE_STATS_FE pfnUpdateStatsFE; // Pointer to rdtsc buckets mgr returned to the caller. @@ -687,58 +684,6 @@ SWR_FUNC(void, SwrEndFrame, HANDLE hContext); SWR_FUNC(void, SwrInit); -////////////////////////////////////////////////////////////////////////// -/// @brief Loads a full hottile from a render surface -/// @param hPrivateContext - Handle to private DC -/// @param dstFormat - Format for hot tile. -/// @param renderTargetIndex - Index to src render target -/// @param x, y - Coordinates to raster tile. -/// @param pDstHotTile - Pointer to Hot Tile -SWR_FUNC(void, - SwrLoadHotTile, - HANDLE hWorkerPrivateData, - const SWR_SURFACE_STATE* pSrcSurface, - SWR_FORMAT dstFormat, - SWR_RENDERTARGET_ATTACHMENT renderTargetIndex, - uint32_t x, - uint32_t y, - uint32_t renderTargetArrayIndex, - uint8_t* pDstHotTile); - -////////////////////////////////////////////////////////////////////////// -/// @brief Deswizzles and stores a full hottile to a render surface -/// @param hPrivateContext - Handle to private DC -/// @param srcFormat - Format for hot tile. -/// @param renderTargetIndex - Index to destination render target -/// @param x, y - Coordinates to raster tile. -/// @param pSrcHotTile - Pointer to Hot Tile -SWR_FUNC(void, - SwrStoreHotTileToSurface, - HANDLE hWorkerPrivateData, - SWR_SURFACE_STATE* pDstSurface, - SWR_FORMAT srcFormat, - SWR_RENDERTARGET_ATTACHMENT renderTargetIndex, - uint32_t x, - uint32_t y, - uint32_t renderTargetArrayIndex, - uint8_t* pSrcHotTile); - -////////////////////////////////////////////////////////////////////////// -/// @brief Writes clear color to every pixel of a render surface -/// @param hPrivateContext - Handle to private DC -/// @param renderTargetIndex - Index to destination render target -/// @param x, y - Coordinates to raster tile. -/// @param pClearColor - Pointer to clear color -SWR_FUNC(void, - SwrStoreHotTileClear, - HANDLE hWorkerPrivateData, - SWR_SURFACE_STATE* pDstSurface, - SWR_RENDERTARGET_ATTACHMENT renderTargetIndex, - uint32_t x, - uint32_t y, - uint32_t renderTargetArrayIndex, - const float* pClearColor); - struct SWR_INTERFACE { PFNSwrCreateContext pfnSwrCreateContext; @@ -788,9 +733,6 @@ struct SWR_INTERFACE PFNSwrEnableStatsBE pfnSwrEnableStatsBE; PFNSwrEndFrame pfnSwrEndFrame; PFNSwrInit pfnSwrInit; - PFNSwrLoadHotTile pfnSwrLoadHotTile; - PFNSwrStoreHotTileToSurface pfnSwrStoreHotTileToSurface; - PFNSwrStoreHotTileClear pfnSwrStoreHotTileClear; }; extern "C" { diff --git a/src/gallium/drivers/swr/rasterizer/core/backend_impl.h b/src/gallium/drivers/swr/rasterizer/core/backend_impl.h index b3de4e3e4e9..83d662bd9a7 100644 --- a/src/gallium/drivers/swr/rasterizer/core/backend_impl.h +++ b/src/gallium/drivers/swr/rasterizer/core/backend_impl.h @@ -1056,7 +1056,6 @@ void BackendPixelRate(DRAW_CONTEXT* pDC, { const bool useAlternateOffset = ((xx & SIMD_TILE_X_DIM) != 0); - psContext.alternateOffset = useAlternateOffset ? 1 : 0; simdscalar activeLanes; if (!(work.anyCoveredSamples & MASK)) diff --git a/src/gallium/drivers/swr/rasterizer/core/backend_sample.cpp b/src/gallium/drivers/swr/rasterizer/core/backend_sample.cpp index 03152bb0cf7..9b0b80f766f 100644 --- a/src/gallium/drivers/swr/rasterizer/core/backend_sample.cpp +++ b/src/gallium/drivers/swr/rasterizer/core/backend_sample.cpp @@ -83,7 +83,6 @@ void BackendSampleRate(DRAW_CONTEXT* pDC, { const bool useAlternateOffset = ((xx & SIMD_TILE_X_DIM) != 0); - psContext.alternateOffset = useAlternateOffset ? 1 : 0; if (T::InputCoverage != SWR_INPUT_COVERAGE_NONE) { diff --git a/src/gallium/drivers/swr/rasterizer/core/backend_singlesample.cpp b/src/gallium/drivers/swr/rasterizer/core/backend_singlesample.cpp index fe76d50fbfa..46aabcdf34b 100644 --- a/src/gallium/drivers/swr/rasterizer/core/backend_singlesample.cpp +++ b/src/gallium/drivers/swr/rasterizer/core/backend_singlesample.cpp @@ -84,7 +84,6 @@ void BackendSingleSample(DRAW_CONTEXT* pDC, { const bool useAlternateOffset = ((xx & SIMD_TILE_X_DIM) != 0); - psContext.alternateOffset = useAlternateOffset ? 1 : 0; simdmask coverageMask = work.coverageMask[0] & MASK; diff --git a/src/gallium/drivers/swr/rasterizer/core/context.h b/src/gallium/drivers/swr/rasterizer/core/context.h index a8182559791..8849e60c91f 100644 --- a/src/gallium/drivers/swr/rasterizer/core/context.h +++ b/src/gallium/drivers/swr/rasterizer/core/context.h @@ -525,7 +525,6 @@ struct SWR_CONTEXT // Callback functions, passed in at create context time PFN_LOAD_TILE pfnLoadTile; PFN_STORE_TILE pfnStoreTile; - PFN_CLEAR_TILE pfnClearTile; PFN_TRANSLATE_GFXPTR_FOR_READ pfnTranslateGfxptrForRead; PFN_TRANSLATE_GFXPTR_FOR_WRITE pfnTranslateGfxptrForWrite; PFN_MAKE_GFXPTR pfnMakeGfxPtr; diff --git a/src/gallium/drivers/swr/rasterizer/core/format_conversion.h b/src/gallium/drivers/swr/rasterizer/core/format_conversion.h index 247ba0b0dcd..ce908099e33 100644 --- a/src/gallium/drivers/swr/rasterizer/core/format_conversion.h +++ b/src/gallium/drivers/swr/rasterizer/core/format_conversion.h @@ -139,7 +139,7 @@ INLINE Float<SIMD_T> SIMDCALL Clamp(Float<SIMD_T> const& v, uint32_t Component) } template <SWR_FORMAT Format> -INLINE simdscalar SIMDCALL Clamp(simdscalar const& v, uint32_t Component) +INLINE simd16scalar SIMDCALL Clamp(simdscalar const& v, uint32_t Component) { return Clamp<SIMD256, Format>(v, Component); } @@ -168,7 +168,7 @@ INLINE Float<SIMD_T> SIMDCALL Normalize(Float<SIMD_T> const& vComp, uint32_t Com } template <SWR_FORMAT Format> -INLINE simdscalar SIMDCALL Normalize(simdscalar const& vComp, uint32_t Component) +INLINE simd16scalar SIMDCALL Normalize(simdscalar const& vComp, uint32_t Component) { return Normalize<SIMD256, Format>(vComp, Component); } diff --git a/src/gallium/drivers/swr/rasterizer/core/state.h b/src/gallium/drivers/swr/rasterizer/core/state.h index a4d5e873d51..3731c41c4e4 100644 --- a/src/gallium/drivers/swr/rasterizer/core/state.h +++ b/src/gallium/drivers/swr/rasterizer/core/state.h @@ -380,8 +380,6 @@ struct SWR_PS_CONTEXT uint8_t* pColorBuffer[SWR_NUM_RENDERTARGETS]; // IN: Pointers to render target hottiles - uint32_t alternateOffset; // IN: for 8x2 tile backend, which 4x2 do we need to read from - SWR_SHADER_STATS stats; // OUT: shader statistics used for archrast. }; @@ -538,47 +536,6 @@ enum SWR_AUX_MODE AUX_MODE_DEPTH, }; -struct SWR_LOD_OFFSETS -{ - uint32_t offsets[2][15]; -}; - -////////////////////////////////////////////////////////////////////////// -/// SWR_SURFACE_STATE -////////////////////////////////////////////////////////////////////////// -struct SWR_SURFACE_STATE -{ - gfxptr_t xpBaseAddress; - SWR_SURFACE_TYPE type; // @llvm_enum - SWR_FORMAT format; // @llvm_enum - uint32_t width; - uint32_t height; - uint32_t depth; - uint32_t numSamples; - uint32_t samplePattern; - uint32_t pitch; - uint32_t qpitch; - uint32_t minLod; // for sampled surfaces, the most detailed LOD that can be accessed by sampler - uint32_t maxLod; // for sampled surfaces, the max LOD that can be accessed - float resourceMinLod; // for sampled surfaces, the most detailed fractional mip that can be - // accessed by sampler - uint32_t lod; // for render targets, the lod being rendered to - uint32_t arrayIndex; // for render targets, the array index being rendered to for arrayed surfaces - SWR_TILE_MODE tileMode; // @llvm_enum - uint32_t halign; - uint32_t valign; - uint32_t xOffset; - uint32_t yOffset; - - uint32_t lodOffsets[2][15]; // lod offsets for sampled surfaces - - gfxptr_t xpAuxBaseAddress; // Used for compression, append/consume counter, etc. - SWR_AUX_MODE auxMode; // @llvm_enum - - - bool bInterleavedSamples; // are MSAA samples stored interleaved or planar -}; - // vertex fetch state // WARNING- any changes to this struct need to be reflected // in the fetch shader jit |