gfxstream: Add "transformList" method for VkFences, in addition to VkSemaphores
Reviewed-by: Aaron Ruby <aruby@blackberry.com> Acked-by: Yonggang Luo <luoyonggang@gmail.com> Acked-by: Adam Jackson <ajax@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
This commit is contained in:
@@ -165,6 +165,7 @@ HANDLES_MESA_VK = {
|
||||
# Types that have a corresponding method for transforming
|
||||
# an input list to its internal counterpart
|
||||
TYPES_TRANSFORM_LIST_METHOD = {
|
||||
"VkFence",
|
||||
"VkSemaphore",
|
||||
"VkSemaphoreSubmitInfo",
|
||||
}
|
||||
@@ -488,17 +489,23 @@ class VulkanFuncTable(VulkanWrapperGenerator):
|
||||
cgen.endIf()
|
||||
|
||||
def genInternalArray(param, countParamName, outArrayName, inArrayName, loopVar):
|
||||
cgen.beginFor("uint32_t %s = 0" % loopVar, "%s < %s" % (loopVar, countParamName), "++%s" % loopVar)
|
||||
if param.isOptional:
|
||||
cgen.beginIf(inArrayName)
|
||||
if isCompoundType(param.typeName):
|
||||
genInternalCompoundType(param, ("%s[%s]" % (outArrayName, loopVar)), "%s[%s]" % (inArrayName, loopVar), loopVar)
|
||||
if param.typeName in TYPES_TRANSFORM_LIST_METHOD:
|
||||
# Use the corresponding transformList call
|
||||
cgen.funcCall(outArrayName, transformListFuncName(param.typeName), [inArrayName, countParamName])
|
||||
cgen.stmt("%s = %s.data()" % (inArrayName, outArrayName))
|
||||
cgen.stmt("%s = %s.size()" % (countParamName, outArrayName))
|
||||
else:
|
||||
gfxstreamObject = genVkFromHandle(param, "%s[%s]" % (inArrayName, loopVar))
|
||||
cgen.stmt("%s[%s] = %s->%s" % (outArrayName, loopVar, gfxstreamObject, INTERNAL_OBJECT_NAME))
|
||||
if param.isOptional:
|
||||
cgen.endIf()
|
||||
cgen.endFor()
|
||||
cgen.beginFor("uint32_t %s = 0" % loopVar, "%s < %s" % (loopVar, countParamName), "++%s" % loopVar)
|
||||
if param.isOptional:
|
||||
cgen.beginIf(inArrayName)
|
||||
if isCompoundType(param.typeName):
|
||||
genInternalCompoundType(param, ("%s[%s]" % (outArrayName, loopVar)), "%s[%s]" % (inArrayName, loopVar), loopVar)
|
||||
else:
|
||||
gfxstreamObject = genVkFromHandle(param, "%s[%s]" % (inArrayName, loopVar))
|
||||
cgen.stmt("%s[%s] = %s->%s" % (outArrayName, loopVar, gfxstreamObject, INTERNAL_OBJECT_NAME))
|
||||
if param.isOptional:
|
||||
cgen.endIf()
|
||||
cgen.endFor()
|
||||
return "%s.data()" % outArrayName
|
||||
|
||||
# Translate params into params needed for gfxstream-internal
|
||||
|
@@ -16,16 +16,32 @@
|
||||
|
||||
#include "vk_sync_dummy.h"
|
||||
|
||||
/* Under the assumption that Mesa VK runtime queue submission is used, WSI flow
|
||||
* sets this temporary state to a dummy sync type (when no explicit dma-buf
|
||||
* synchronization is available). For gfxstream, ignore this sync object when
|
||||
* this is the case. Synchronization will be done on the host.
|
||||
*/
|
||||
|
||||
static bool isNoopFence(gfxstream_vk_fence* fence) {
|
||||
return (fence && fence->vk.temporary && vk_sync_type_is_dummy(fence->vk.temporary->type));
|
||||
}
|
||||
|
||||
static bool isNoopSemaphore(gfxstream_vk_semaphore* semaphore) {
|
||||
/* Under the assumption that Mesa VK runtime queue submission is used, WSI flow
|
||||
* sets this temporary state to a dummy sync type (when no explicit dma-buf
|
||||
* synchronization is available). For gfxstream case, ignore this semaphore
|
||||
* when this is the case. Synchronization will be done on the host.
|
||||
*/
|
||||
return (semaphore && semaphore->vk.temporary &&
|
||||
vk_sync_type_is_dummy(semaphore->vk.temporary->type));
|
||||
}
|
||||
|
||||
std::vector<VkFence> transformVkFenceList(const VkFence* pFences, uint32_t fenceCount) {
|
||||
std::vector<VkFence> outFences;
|
||||
for (uint32_t j = 0; j < fenceCount; ++j) {
|
||||
VK_FROM_HANDLE(gfxstream_vk_fence, gfxstream_fence, pFences[j]);
|
||||
if (!isNoopFence(gfxstream_fence)) {
|
||||
outFences.push_back(gfxstream_fence->internal_object);
|
||||
}
|
||||
}
|
||||
return outFences;
|
||||
}
|
||||
|
||||
std::vector<VkSemaphore> transformVkSemaphoreList(const VkSemaphore* pSemaphores,
|
||||
uint32_t semaphoreCount) {
|
||||
std::vector<VkSemaphore> outSemaphores;
|
||||
|
@@ -240,6 +240,8 @@ void gfxstream_vk_wsi_finish(struct gfxstream_vk_physical_device* physical_devic
|
||||
std::vector<VkSemaphore> transformVkSemaphoreList(const VkSemaphore* pSemaphores,
|
||||
uint32_t semaphoreCount);
|
||||
|
||||
std::vector<VkFence> transformVkFenceList(const VkFence* pFences, uint32_t fenceCount);
|
||||
|
||||
std::vector<VkSemaphoreSubmitInfo> transformVkSemaphoreSubmitInfoList(
|
||||
const VkSemaphoreSubmitInfo* pSemaphoreSubmitInfos, uint32_t semaphoreSubmitInfoCount);
|
||||
|
||||
|
Reference in New Issue
Block a user