[Mesa-dev] [PATCH 15/15] swr: [rasterizer core/memory] Add memory api to SwrGetInterface

Tim Rowley timothy.o.rowley at intel.com
Tue Apr 25 14:50:40 UTC 2017


---
 src/gallium/drivers/swr/rasterizer/core/api.cpp    |  3 ++
 src/gallium/drivers/swr/rasterizer/core/api.h      | 45 ++++++++++++++++++++++
 .../drivers/swr/rasterizer/memory/ClearTile.cpp    |  2 +-
 .../drivers/swr/rasterizer/memory/LoadTile.cpp     |  2 +-
 .../drivers/swr/rasterizer/memory/StoreTile.cpp    |  2 +-
 src/gallium/drivers/swr/swr_memory.h               | 28 ++------------
 6 files changed, 54 insertions(+), 28 deletions(-)

diff --git a/src/gallium/drivers/swr/rasterizer/core/api.cpp b/src/gallium/drivers/swr/rasterizer/core/api.cpp
index a3870be..1d581ac 100644
--- a/src/gallium/drivers/swr/rasterizer/core/api.cpp
+++ b/src/gallium/drivers/swr/rasterizer/core/api.cpp
@@ -1705,4 +1705,7 @@ 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 0b07608..f9f3573 100644
--- a/src/gallium/drivers/swr/rasterizer/core/api.h
+++ b/src/gallium/drivers/swr/rasterizer/core/api.h
@@ -660,6 +660,48 @@ SWR_FUNC(void, SwrEndFrame,
 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,
+    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,
+    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,
+         SWR_SURFACE_STATE *pDstSurface,
+         SWR_RENDERTARGET_ATTACHMENT renderTargetIndex,
+         UINT x,
+         UINT y,
+         uint32_t renderTargetArrayIndex,
+         const float* pClearColor);
+
 struct SWR_INTERFACE
 {
     PFNSwrCreateContext pfnSwrCreateContext;
@@ -707,6 +749,9 @@ 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/memory/ClearTile.cpp b/src/gallium/drivers/swr/rasterizer/memory/ClearTile.cpp
index ee13f55..8a306cd 100644
--- a/src/gallium/drivers/swr/rasterizer/memory/ClearTile.cpp
+++ b/src/gallium/drivers/swr/rasterizer/memory/ClearTile.cpp
@@ -152,7 +152,7 @@ struct StoreMacroTileClear
 /// @param renderTargetIndex - Index to destination render target
 /// @param x, y - Coordinates to raster tile.
 /// @param pClearColor - Pointer to clear color
-void StoreHotTileClear(
+void SwrStoreHotTileClear(
     SWR_SURFACE_STATE *pDstSurface,
     SWR_RENDERTARGET_ATTACHMENT renderTargetIndex,
     UINT x,
diff --git a/src/gallium/drivers/swr/rasterizer/memory/LoadTile.cpp b/src/gallium/drivers/swr/rasterizer/memory/LoadTile.cpp
index 7d8b32a..9dbc16a 100644
--- a/src/gallium/drivers/swr/rasterizer/memory/LoadTile.cpp
+++ b/src/gallium/drivers/swr/rasterizer/memory/LoadTile.cpp
@@ -53,7 +53,7 @@ static std::mutex sBucketMutex;
 /// @param renderTargetIndex - Index to src render target
 /// @param x, y - Coordinates to raster tile.
 /// @param pDstHotTile - Pointer to Hot Tile
-void LoadHotTile(
+void SwrLoadHotTile(
     const SWR_SURFACE_STATE *pSrcSurface,
     SWR_FORMAT dstFormat,
     SWR_RENDERTARGET_ATTACHMENT renderTargetIndex,
diff --git a/src/gallium/drivers/swr/rasterizer/memory/StoreTile.cpp b/src/gallium/drivers/swr/rasterizer/memory/StoreTile.cpp
index 446bca4..9c20669 100644
--- a/src/gallium/drivers/swr/rasterizer/memory/StoreTile.cpp
+++ b/src/gallium/drivers/swr/rasterizer/memory/StoreTile.cpp
@@ -58,7 +58,7 @@ static std::vector<int32_t> sBuckets(NUM_SWR_FORMATS, -1);
 /// @param renderTargetIndex - Index to destination render target
 /// @param x, y - Coordinates to raster tile.
 /// @param pSrcHotTile - Pointer to Hot Tile
-void StoreHotTileToSurface(
+void SwrStoreHotTileToSurface(
     SWR_SURFACE_STATE *pDstSurface,
     SWR_FORMAT srcFormat,
     SWR_RENDERTARGET_ATTACHMENT renderTargetIndex,
diff --git a/src/gallium/drivers/swr/swr_memory.h b/src/gallium/drivers/swr/swr_memory.h
index 49b208f..ec68df3 100644
--- a/src/gallium/drivers/swr/swr_memory.h
+++ b/src/gallium/drivers/swr/swr_memory.h
@@ -23,28 +23,6 @@
 
 #pragma once
 
-void LoadHotTile(
-    const SWR_SURFACE_STATE *pSrcSurface,
-    SWR_FORMAT dstFormat,
-    SWR_RENDERTARGET_ATTACHMENT renderTargetIndex,
-    UINT x, UINT y, uint32_t renderTargetArrayIndex,
-    uint8_t *pDstHotTile);
-
-void StoreHotTileToSurface(
-    SWR_SURFACE_STATE *pDstSurface,
-    SWR_FORMAT srcFormat,
-    SWR_RENDERTARGET_ATTACHMENT renderTargetIndex,
-    UINT x, UINT y, uint32_t renderTargetArrayIndex,
-    uint8_t *pSrcHotTile);
-
-void StoreHotTileClear(
-    SWR_SURFACE_STATE *pDstSurface,
-    SWR_RENDERTARGET_ATTACHMENT renderTargetIndex,
-    UINT x,
-    UINT y,
-    uint32_t renderTargetArrayIndex,
-    const float* pClearColor);
-
 INLINE void
 swr_LoadHotTile(HANDLE hPrivateContext,
                 SWR_FORMAT dstFormat,
@@ -56,7 +34,7 @@ swr_LoadHotTile(HANDLE hPrivateContext,
    swr_draw_context *pDC = (swr_draw_context*)hPrivateContext;
    SWR_SURFACE_STATE *pSrcSurface = &pDC->renderTargets[renderTargetIndex];
 
-   LoadHotTile(pSrcSurface, dstFormat, renderTargetIndex, x, y, renderTargetArrayIndex, pDstHotTile);
+   SwrLoadHotTile(pSrcSurface, dstFormat, renderTargetIndex, x, y, renderTargetArrayIndex, pDstHotTile);
 }
 
 INLINE void
@@ -70,7 +48,7 @@ swr_StoreHotTile(HANDLE hPrivateContext,
    swr_draw_context *pDC = (swr_draw_context*)hPrivateContext;
    SWR_SURFACE_STATE *pDstSurface = &pDC->renderTargets[renderTargetIndex];
 
-   StoreHotTileToSurface(pDstSurface, srcFormat, renderTargetIndex, x, y, renderTargetArrayIndex, pSrcHotTile);
+   SwrStoreHotTileToSurface(pDstSurface, srcFormat, renderTargetIndex, x, y, renderTargetArrayIndex, pSrcHotTile);
 }
 
 INLINE void
@@ -85,5 +63,5 @@ swr_StoreHotTileClear(HANDLE hPrivateContext,
    swr_draw_context *pDC = (swr_draw_context*)hPrivateContext;
    SWR_SURFACE_STATE *pDstSurface = &pDC->renderTargets[renderTargetIndex];
 
-   StoreHotTileClear(pDstSurface, renderTargetIndex, x, y, renderTargetArrayIndex, pClearColor);
+   SwrStoreHotTileClear(pDstSurface, renderTargetIndex, x, y, renderTargetArrayIndex, pClearColor);
 }
-- 
2.7.4



More information about the mesa-dev mailing list