| 1 |
/* |
| 2 |
* Copyright 2018 Google LLC |
| 3 |
* SPDX-License-Identifier: MIT |
| 4 |
*/ |
| 5 |
(void)doLock; |
| 6 |
|
| 7 |
auto stream = mImpl->stream(); |
| 8 |
auto pool = mImpl->pool(); |
| 9 |
VkQueue local_queue; |
| 10 |
VkCommandBuffer local_commandBuffer; |
| 11 |
VkDeviceSize local_dataSize; |
| 12 |
void* local_pData; |
| 13 |
local_queue = queue; |
| 14 |
local_commandBuffer = commandBuffer; |
| 15 |
local_dataSize = dataSize; |
| 16 |
// Avoiding deepcopy for pData |
| 17 |
local_pData = (void*)pData; |
| 18 |
size_t count = 0; |
| 19 |
size_t* countPtr = &count; |
| 20 |
{ |
| 21 |
*countPtr += 1 * 8; |
| 22 |
*countPtr += 1 * 8; |
| 23 |
*countPtr += sizeof(VkDeviceSize); |
| 24 |
*countPtr += ((dataSize)) * sizeof(uint8_t); |
| 25 |
} |
| 26 |
bool queueSubmitWithCommandsEnabled = sFeatureBits & VULKAN_STREAM_FEATURE_QUEUE_SUBMIT_WITH_COMMANDS_BIT; |
| 27 |
uint32_t packetSize_vkQueueFlushCommandsGOOGLE = 4 + 4 + (queueSubmitWithCommandsEnabled ? 4 : 0) + count; |
| 28 |
uint8_t* streamPtr = stream->reserve(packetSize_vkQueueFlushCommandsGOOGLE - local_dataSize); |
| 29 |
uint8_t** streamPtrPtr = &streamPtr; |
| 30 |
uint32_t opcode_vkQueueFlushCommandsGOOGLE = OP_vkQueueFlushCommandsGOOGLE; |
| 31 |
uint32_t seqno = ResourceTracker::nextSeqno(); |
| 32 |
memcpy(streamPtr, &opcode_vkQueueFlushCommandsGOOGLE, sizeof(uint32_t)); streamPtr += sizeof(uint32_t); |
| 33 |
memcpy(streamPtr, &packetSize_vkQueueFlushCommandsGOOGLE, sizeof(uint32_t)); streamPtr += sizeof(uint32_t); |
| 34 |
memcpy(streamPtr, &seqno, sizeof(uint32_t)); streamPtr += sizeof(uint32_t); |
| 35 |
uint64_t cgen_var_1407; |
| 36 |
*&cgen_var_1407 = get_host_u64_VkQueue((*&local_queue)); |
| 37 |
memcpy(*streamPtrPtr, (uint64_t*)&cgen_var_1407, 1 * 8); |
| 38 |
*streamPtrPtr += 1 * 8; |
| 39 |
uint64_t cgen_var_1408; |
| 40 |
*&cgen_var_1408 = get_host_u64_VkCommandBuffer((*&local_commandBuffer)); |
| 41 |
memcpy(*streamPtrPtr, (uint64_t*)&cgen_var_1408, 1 * 8); |
| 42 |
*streamPtrPtr += 1 * 8; |
| 43 |
memcpy(*streamPtrPtr, (VkDeviceSize*)&local_dataSize, sizeof(VkDeviceSize)); |
| 44 |
*streamPtrPtr += sizeof(VkDeviceSize); |
| 45 |
|
| 46 |
MESA_TRACE_SCOPE("vkQueueFlush large xfer"); |
| 47 |
stream->flush(); |
| 48 |
stream->writeLarge(local_pData, dataSize); |
| 49 |
|
| 50 |
++encodeCount;; |
| 51 |
if (0 == encodeCount % POOL_CLEAR_INTERVAL) |
| 52 |
{ |
| 53 |
pool->freeAll(); |
| 54 |
stream->clearPool(); |
| 55 |
} |