Snap for 8819477 from 43df99cbc940c853840106ab62477d0e514ab509 to mainline-resolv-release Change-Id: Ibec83e644a6c79f9b86b99c64d1058018e4060af
diff --git a/system/codecs/c2/decoders/hevcdec/C2GoldfishHevcDec.cpp b/system/codecs/c2/decoders/hevcdec/C2GoldfishHevcDec.cpp index 7008bd5..7914c29 100644 --- a/system/codecs/c2/decoders/hevcdec/C2GoldfishHevcDec.cpp +++ b/system/codecs/c2/decoders/hevcdec/C2GoldfishHevcDec.cpp
@@ -404,10 +404,11 @@ } void C2GoldfishHevcDec::decodeHeaderAfterFlush() { - if (mContext && !mCsd0.empty() && !mCsd1.empty()) { + DDD("calling %s", __func__); + if (mContext && !mCsd0.empty()) { mContext->decodeFrame(&(mCsd0[0]), mCsd0.size(), 0); - mContext->decodeFrame(&(mCsd1[0]), mCsd1.size(), 0); - DDD("resending csd0 and csd1"); + DDD("resending csd0"); + DDD("calling %s success", __func__); } } @@ -874,9 +875,6 @@ if (mCsd0.empty()) { mCsd0.assign(mInPBuffer, mInPBuffer + mInPBufferSize); DDD("assign to csd0 with %d bytpes", mInPBufferSize); - } else if (mCsd1.empty()) { - mCsd1.assign(mInPBuffer, mInPBuffer + mInPBufferSize); - DDD("assign to csd1 with %d bytpes", mInPBufferSize); } // this is not really a valid pts from config removePts(mPts);
diff --git a/system/vulkan_enc/ResourceTracker.cpp b/system/vulkan_enc/ResourceTracker.cpp index 76e8677..6cc7010 100644 --- a/system/vulkan_enc/ResourceTracker.cpp +++ b/system/vulkan_enc/ResourceTracker.cpp
@@ -7816,6 +7816,63 @@ return VK_SUCCESS; } + VkResult on_vkCreateGraphicsPipelines( + void* context, + VkResult input_result, + VkDevice device, + VkPipelineCache pipelineCache, + uint32_t createInfoCount, + const VkGraphicsPipelineCreateInfo* pCreateInfos, + const VkAllocationCallbacks* pAllocator, + VkPipeline* pPipelines) { + (void)input_result; + VkEncoder* enc = (VkEncoder*)context; + std::vector<VkGraphicsPipelineCreateInfo> localCreateInfos( + pCreateInfos, pCreateInfos + createInfoCount); + for (VkGraphicsPipelineCreateInfo& graphicsPipelineCreateInfo : localCreateInfos) { + // dEQP-VK.api.pipeline.pipeline_invalid_pointers_unused_structs#graphics + bool requireViewportState = false; + // VUID-VkGraphicsPipelineCreateInfo-rasterizerDiscardEnable-00750 + requireViewportState |= graphicsPipelineCreateInfo.pRasterizationState != nullptr && + graphicsPipelineCreateInfo.pRasterizationState->rasterizerDiscardEnable + == VK_FALSE; + // VUID-VkGraphicsPipelineCreateInfo-pViewportState-04892 +#ifdef VK_EXT_extended_dynamic_state2 + if (!requireViewportState && graphicsPipelineCreateInfo.pDynamicState) { + for (uint32_t i = 0; i < + graphicsPipelineCreateInfo.pDynamicState->dynamicStateCount; i++) { + if (VK_DYNAMIC_STATE_RASTERIZER_DISCARD_ENABLE_EXT == + graphicsPipelineCreateInfo.pDynamicState->pDynamicStates[i]) { + requireViewportState = true; + break; + } + } + } +#endif // VK_EXT_extended_dynamic_state2 + if (!requireViewportState) { + graphicsPipelineCreateInfo.pViewportState = nullptr; + } + + // It has the same requirement as for pViewportState. + bool shouldIncludeFragmentShaderState = requireViewportState; + + // VUID-VkGraphicsPipelineCreateInfo-rasterizerDiscardEnable-00751 + if (!shouldIncludeFragmentShaderState) { + graphicsPipelineCreateInfo.pMultisampleState = nullptr; + } + + // VUID-VkGraphicsPipelineCreateInfo-renderPass-06043 + // VUID-VkGraphicsPipelineCreateInfo-renderPass-06044 + if (graphicsPipelineCreateInfo.renderPass == VK_NULL_HANDLE + || !shouldIncludeFragmentShaderState) { + graphicsPipelineCreateInfo.pDepthStencilState = nullptr; + graphicsPipelineCreateInfo.pColorBlendState = nullptr; + } + } + return enc->vkCreateGraphicsPipelines(device, pipelineCache, localCreateInfos.size(), + localCreateInfos.data(), pAllocator, pPipelines, true /* do lock */); + } + uint32_t getApiVersionFromInstance(VkInstance instance) const { AutoLock<RecursiveLock> lock(mLock); uint32_t api = kDefaultApiVersion; @@ -9046,6 +9103,18 @@ return mImpl->on_vkQueueSignalReleaseImageANDROID(context, input_result, queue, waitSemaphoreCount, pWaitSemaphores, image, pNativeFenceFd); } +VkResult ResourceTracker::on_vkCreateGraphicsPipelines( + void* context, + VkResult input_result, + VkDevice device, + VkPipelineCache pipelineCache, + uint32_t createInfoCount, + const VkGraphicsPipelineCreateInfo* pCreateInfos, + const VkAllocationCallbacks* pAllocator, + VkPipeline* pPipelines) { + return mImpl->on_vkCreateGraphicsPipelines(context, input_result, device, pipelineCache, createInfoCount, pCreateInfos, pAllocator, pPipelines); +} + void ResourceTracker::deviceMemoryTransform_tohost( VkDeviceMemory* memory, uint32_t memoryCount, VkDeviceSize* offset, uint32_t offsetCount,
diff --git a/system/vulkan_enc/ResourceTracker.h b/system/vulkan_enc/ResourceTracker.h index e25e75d..b50635d 100644 --- a/system/vulkan_enc/ResourceTracker.h +++ b/system/vulkan_enc/ResourceTracker.h
@@ -627,6 +627,16 @@ VkImage image, int* pNativeFenceFd); + VkResult on_vkCreateGraphicsPipelines( + void* context, + VkResult input_result, + VkDevice device, + VkPipelineCache pipelineCache, + uint32_t createInfoCount, + const VkGraphicsPipelineCreateInfo* pCreateInfos, + const VkAllocationCallbacks* pAllocator, + VkPipeline* pPipelines); + uint8_t* getMappedPointer(VkDeviceMemory memory); VkDeviceSize getMappedSize(VkDeviceMemory memory); VkDeviceSize getNonCoherentExtendedSize(VkDevice device, VkDeviceSize basicSize) const;
diff --git a/system/vulkan_enc/func_table.cpp b/system/vulkan_enc/func_table.cpp index 4e17d42..54b232e 100644 --- a/system/vulkan_enc/func_table.cpp +++ b/system/vulkan_enc/func_table.cpp
@@ -769,7 +769,8 @@ AEMU_SCOPED_TRACE("vkCreateGraphicsPipelines"); auto vkEnc = ResourceTracker::getThreadLocalEncoder(); VkResult vkCreateGraphicsPipelines_VkResult_return = (VkResult)0; - vkCreateGraphicsPipelines_VkResult_return = vkEnc->vkCreateGraphicsPipelines(device, pipelineCache, createInfoCount, pCreateInfos, pAllocator, pPipelines, true /* do lock */); + auto resources = ResourceTracker::get(); + vkCreateGraphicsPipelines_VkResult_return = resources->on_vkCreateGraphicsPipelines(vkEnc, VK_SUCCESS, device, pipelineCache, createInfoCount, pCreateInfos, pAllocator, pPipelines); return vkCreateGraphicsPipelines_VkResult_return; } static VkResult entry_vkCreateComputePipelines(