From 20d5c88760dd260998b73fc0a6156a9d95e6e836 Mon Sep 17 00:00:00 2001 From: Alok Hota Date: Thu, 19 Jul 2018 10:32:55 -0500 Subject: [PATCH] swr/rast: Convert system memory pointers to gfxptr_t Fulfills an unused internal interface Reviewed-by: Bruce Cherniak --- src/gallium/drivers/swr/rasterizer/core/api.cpp | 1 + src/gallium/drivers/swr/rasterizer/core/api.h | 4 ++++ src/gallium/drivers/swr/rasterizer/core/context.h | 1 + src/gallium/drivers/swr/rasterizer/core/frontend.cpp | 7 ++++--- src/gallium/drivers/swr/swr_context.cpp | 1 + src/gallium/drivers/swr/swr_memory.h | 7 +++++++ 6 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/swr/rasterizer/core/api.cpp b/src/gallium/drivers/swr/rasterizer/core/api.cpp index 00f331303ee..acbc7e077b1 100644 --- a/src/gallium/drivers/swr/rasterizer/core/api.cpp +++ b/src/gallium/drivers/swr/rasterizer/core/api.cpp @@ -196,6 +196,7 @@ HANDLE SwrCreateContext(SWR_CREATECONTEXT_INFO* pCreateInfo) pContext->pfnLoadTile = pCreateInfo->pfnLoadTile; pContext->pfnStoreTile = pCreateInfo->pfnStoreTile; pContext->pfnClearTile = pCreateInfo->pfnClearTile; + pContext->pfnMakeGfxPtr = pCreateInfo->pfnMakeGfxPtr; pContext->pfnUpdateSoWriteOffset = pCreateInfo->pfnUpdateSoWriteOffset; pContext->pfnUpdateStats = pCreateInfo->pfnUpdateStats; pContext->pfnUpdateStatsFE = pCreateInfo->pfnUpdateStatsFE; diff --git a/src/gallium/drivers/swr/rasterizer/core/api.h b/src/gallium/drivers/swr/rasterizer/core/api.h index 9cc5292e7b0..b33dc96e339 100644 --- a/src/gallium/drivers/swr/rasterizer/core/api.h +++ b/src/gallium/drivers/swr/rasterizer/core/api.h @@ -145,6 +145,9 @@ typedef void(SWR_API* PFN_CLEAR_TILE)(HANDLE hPrivateContex uint32_t renderTargetArrayIndex, const float* pClearColor); +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. /// This is call is made for any draw operation that has streamout enabled @@ -241,6 +244,7 @@ struct SWR_CREATECONTEXT_INFO PFN_LOAD_TILE pfnLoadTile; PFN_STORE_TILE pfnStoreTile; PFN_CLEAR_TILE pfnClearTile; + PFN_MAKE_GFXPTR pfnMakeGfxPtr; PFN_UPDATE_SO_WRITE_OFFSET pfnUpdateSoWriteOffset; PFN_UPDATE_STATS pfnUpdateStats; PFN_UPDATE_STATS_FE pfnUpdateStatsFE; diff --git a/src/gallium/drivers/swr/rasterizer/core/context.h b/src/gallium/drivers/swr/rasterizer/core/context.h index 6d378ed36e4..5a9ccfb5ded 100644 --- a/src/gallium/drivers/swr/rasterizer/core/context.h +++ b/src/gallium/drivers/swr/rasterizer/core/context.h @@ -528,6 +528,7 @@ struct SWR_CONTEXT PFN_LOAD_TILE pfnLoadTile; PFN_STORE_TILE pfnStoreTile; PFN_CLEAR_TILE pfnClearTile; + PFN_MAKE_GFXPTR pfnMakeGfxPtr; PFN_UPDATE_SO_WRITE_OFFSET pfnUpdateSoWriteOffset; PFN_UPDATE_STATS pfnUpdateStats; PFN_UPDATE_STATS_FE pfnUpdateStatsFE; diff --git a/src/gallium/drivers/swr/rasterizer/core/frontend.cpp b/src/gallium/drivers/swr/rasterizer/core/frontend.cpp index b510feadee9..8bc97c743eb 100644 --- a/src/gallium/drivers/swr/rasterizer/core/frontend.cpp +++ b/src/gallium/drivers/swr/rasterizer/core/frontend.cpp @@ -1840,9 +1840,10 @@ void ProcessDraw(SWR_CONTEXT* pContext, DRAW_CONTEXT* pDC, uint32_t workerId, vo { vIndex = _simd16_add_epi32(_simd16_set1_epi32(work.startVertexID), vScale); - fetchInfo_lo.xpIndices = (gfxptr_t)&vIndex; - fetchInfo_hi.xpIndices = - (gfxptr_t)&vIndex + KNOB_SIMD_WIDTH * sizeof(int32_t); // 1/2 of KNOB_SIMD16_WIDTH + fetchInfo_lo.xpIndices = + pDC->pContext->pfnMakeGfxPtr(GetPrivateState(pDC), &vIndex); + fetchInfo_hi.xpIndices = + pDC->pContext->pfnMakeGfxPtr(GetPrivateState(pDC), &vIndex + KNOB_SIMD_WIDTH * sizeof(int32_t)); // 1/2 of KNOB_SIMD16_WIDTH } fetchInfo_lo.CurInstance = instanceNum; diff --git a/src/gallium/drivers/swr/swr_context.cpp b/src/gallium/drivers/swr/swr_context.cpp index b61720cd300..7aa14d60710 100644 --- a/src/gallium/drivers/swr/swr_context.cpp +++ b/src/gallium/drivers/swr/swr_context.cpp @@ -494,6 +494,7 @@ swr_create_context(struct pipe_screen *p_screen, void *priv, unsigned flags) createInfo.pfnClearTile = swr_StoreHotTileClear; createInfo.pfnUpdateStats = swr_UpdateStats; createInfo.pfnUpdateStatsFE = swr_UpdateStatsFE; + createInfo.pfnMakeGfxPtr = swr_MakeGfxPtr; SWR_THREADING_INFO threadingInfo {0}; diff --git a/src/gallium/drivers/swr/swr_memory.h b/src/gallium/drivers/swr/swr_memory.h index bab7800c604..7ccbf5a5497 100644 --- a/src/gallium/drivers/swr/swr_memory.h +++ b/src/gallium/drivers/swr/swr_memory.h @@ -68,3 +68,10 @@ swr_StoreHotTileClear(HANDLE hPrivateContext, pDC->pAPI->pfnSwrStoreHotTileClear(hWorkerPrivateData, pDstSurface, renderTargetIndex, x, y, renderTargetArrayIndex, pClearColor); } + +INLINE gfxptr_t +swr_MakeGfxPtr(HANDLE hPrivateContext, void* sysAddr) +{ + // Fulfill an unused internal interface + return (gfxptr_t)sysAddr; +} -- 2.30.2