dawn_native: Use an internal GetQueue that doesn't add a ref
Previously various places in dawn_native were using Device::GetQueue to get the queue for some operations, and were inadvertently adding a reference to the queue. Fix this by adding a getter that doesn't add a ref. Bug: dawn:723 Bug: chromium:1185070 Change-Id: Iba127dbd631305762f4cc6c37816407056c52cff Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/46001 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Auto-Submit: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Stephen White <senorblanco@chromium.org>
This commit is contained in:
parent
2ce4b905b2
commit
e91975c79e
|
@ -289,9 +289,8 @@ namespace dawn_native {
|
|||
}
|
||||
std::unique_ptr<MapRequestTask> request =
|
||||
std::make_unique<MapRequestTask>(this, mLastMapID);
|
||||
// TODO(dawn:723): do not get a new reference to the Queue.
|
||||
GetDevice()->APIGetQueue()->TrackTask(std::move(request),
|
||||
GetDevice()->GetPendingCommandSerial());
|
||||
GetDevice()->GetQueue()->TrackTask(std::move(request),
|
||||
GetDevice()->GetPendingCommandSerial());
|
||||
}
|
||||
|
||||
void* BufferBase::APIGetMappedRange(size_t offset, size_t size) {
|
||||
|
|
|
@ -419,10 +419,9 @@ namespace dawn_native {
|
|||
// TODO(dawn:723): change to not use AcquireRef for reentrant object creation.
|
||||
Ref<BufferBase> availabilityBuffer =
|
||||
AcquireRef(device->APICreateBuffer(&availabilityDesc));
|
||||
// TODO(dawn:723): do not get a new reference to the Queue.
|
||||
// TODO(dawn:723): propagate any errors from WriteBuffer.
|
||||
device->APIGetQueue()->APIWriteBuffer(availabilityBuffer.Get(), 0, availability.data(),
|
||||
availability.size() * sizeof(uint32_t));
|
||||
device->GetQueue()->APIWriteBuffer(availabilityBuffer.Get(), 0, availability.data(),
|
||||
availability.size() * sizeof(uint32_t));
|
||||
|
||||
// Timestamp params uniform buffer
|
||||
TimestampParams params = {queryCount, static_cast<uint32_t>(destinationOffset),
|
||||
|
@ -432,9 +431,8 @@ namespace dawn_native {
|
|||
parmsDesc.size = sizeof(params);
|
||||
// TODO(dawn:723): change to not use AcquireRef for reentrant object creation.
|
||||
Ref<BufferBase> paramsBuffer = AcquireRef(device->APICreateBuffer(&parmsDesc));
|
||||
// TODO(dawn:723): do not get a new reference to the Queue.
|
||||
// TODO(dawn:723): propagate any errors from WriteBuffer.
|
||||
device->APIGetQueue()->APIWriteBuffer(paramsBuffer.Get(), 0, ¶ms, sizeof(params));
|
||||
device->GetQueue()->APIWriteBuffer(paramsBuffer.Get(), 0, ¶ms, sizeof(params));
|
||||
|
||||
EncodeConvertTimestampsToNanoseconds(encoder, destination, availabilityBuffer.Get(),
|
||||
paramsBuffer.Get());
|
||||
|
|
|
@ -273,10 +273,9 @@ namespace dawn_native {
|
|||
// TODO(dawn:723): change to not use AcquireRef for reentrant object creation.
|
||||
Ref<BufferBase> uniformBuffer = AcquireRef(device->APICreateBuffer(&uniformDesc));
|
||||
|
||||
// TODO(dawn:723): change to not use AcquireRef for reentrant object creation.
|
||||
// TODO(dawn:723): propagate any errors from WriteBuffer.
|
||||
device->APIGetQueue()->APIWriteBuffer(uniformBuffer.Get(), 0, uniformData,
|
||||
sizeof(uniformData));
|
||||
device->GetQueue()->APIWriteBuffer(uniformBuffer.Get(), 0, uniformData,
|
||||
sizeof(uniformData));
|
||||
|
||||
// Prepare binding 1 resource: sampler
|
||||
// Use default configuration, filterMode set to Nearest for min and mag.
|
||||
|
@ -347,9 +346,7 @@ namespace dawn_native {
|
|||
CommandBufferBase* submitCommandBuffer = commandBuffer.Get();
|
||||
|
||||
// Submit command buffer.
|
||||
// TODO(dawn:723): do not get a new reference to the Queue.
|
||||
Ref<QueueBase> queue = AcquireRef(device->APIGetQueue());
|
||||
queue->APISubmit(1, &submitCommandBuffer);
|
||||
device->GetQueue()->APISubmit(1, &submitCommandBuffer);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
|
|
@ -176,8 +176,7 @@ namespace dawn_native {
|
|||
// Tick the queue-related tasks since they should be complete. This must be done before
|
||||
// ShutDownImpl() it may relinquish resources that will be freed by backends in the
|
||||
// ShutDownImpl() call.
|
||||
// TODO(dawn:723): do not get a new reference to the Queue.
|
||||
APIGetQueue()->Tick(GetCompletedCommandSerial());
|
||||
mQueue->Tick(GetCompletedCommandSerial());
|
||||
// Call TickImpl once last time to clean up resources
|
||||
// Ignore errors so that we can continue with destruction
|
||||
IgnoreErrors(TickImpl());
|
||||
|
@ -896,8 +895,7 @@ namespace dawn_native {
|
|||
// tick the dynamic uploader before the backend resource allocators. This would allow
|
||||
// reclaiming resources one tick earlier.
|
||||
mDynamicUploader->Deallocate(mCompletedSerial);
|
||||
// TODO(dawn:723): do not get a new reference to the Queue.
|
||||
APIGetQueue()->Tick(mCompletedSerial);
|
||||
mQueue->Tick(mCompletedSerial);
|
||||
|
||||
mCreatePipelineAsyncTracker->Tick(mCompletedSerial);
|
||||
}
|
||||
|
@ -963,6 +961,10 @@ namespace dawn_native {
|
|||
}
|
||||
}
|
||||
|
||||
QueueBase* DeviceBase::GetQueue() const {
|
||||
return mQueue.Get();
|
||||
}
|
||||
|
||||
// Implementation details of object creation
|
||||
|
||||
MaybeError DeviceBase::CreateBindGroupInternal(BindGroupBase** result,
|
||||
|
|
|
@ -229,6 +229,7 @@ namespace dawn_native {
|
|||
size_t GetDeprecationWarningCountForTesting();
|
||||
void EmitDeprecationWarning(const char* warning);
|
||||
void APILoseForTesting();
|
||||
QueueBase* GetQueue() const;
|
||||
|
||||
// AddFutureSerial is used to update the mFutureSerial with the max serial needed to be
|
||||
// ticked in order to clean up all pending callback work or to execute asynchronous resource
|
||||
|
|
|
@ -136,9 +136,8 @@ namespace dawn_native {
|
|||
std::make_unique<FenceInFlight>(fence, value);
|
||||
|
||||
// TODO: use GetLastSubmittedCommandSerial in the future for perforamnce
|
||||
// TODO(dawn:723): do not get a new reference to the Queue.
|
||||
GetDevice()->APIGetQueue()->TrackTask(std::move(fenceInFlight),
|
||||
GetDevice()->GetPendingCommandSerial());
|
||||
GetDevice()->GetQueue()->TrackTask(std::move(fenceInFlight),
|
||||
GetDevice()->GetPendingCommandSerial());
|
||||
}
|
||||
|
||||
MaybeError Fence::ValidateOnCompletion(FenceAPISerial value,
|
||||
|
|
Loading…
Reference in New Issue