Revert "Enable Queue, Device labels to be set."

This reverts commit 0126761de8.

Reason for revert:
Causing Dawn->Chromium roll to fail

BUG=dawn:1346

Original change's description:
> Enable Queue, Device labels to be set.
>
> Queue labels can be set by the defaultQueue.label member of the device
> descriptor or the setQueue method.
>
> Device labels can be set label member of the device
> descriptor or the setQueue method.
>
> D3D12 and VK backend label support included.
>
> Change-Id: Id12dd6e1fc8f1519c55e4efb35e1ead67c085e46
> Bug: dawn:1323
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85540
> Reviewed-by: Kai Ninomiya <kainino@chromium.org>
> Commit-Queue: Brandon Jones <bajones@chromium.org>

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: dawn:1323
Change-Id: I62e4b508d2c55fd89f2f4c5cbe5d04d22681aeef
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/85700
Reviewed-by: Brandon Jones <bajones@chromium.org>
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
Ryan Harrison 2022-04-05 22:09:43 +00:00 committed by Dawn LUCI CQ
parent 7bcf9d8fa3
commit 8d9d132f7c
17 changed files with 24 additions and 95 deletions

View File

@ -153,7 +153,7 @@
{"name": "required features count", "type": "uint32_t", "default": 0}, {"name": "required features count", "type": "uint32_t", "default": 0},
{"name": "required features", "type": "feature name", "annotation": "const*", "length": "required features count", "default": "nullptr"}, {"name": "required features", "type": "feature name", "annotation": "const*", "length": "required features count", "default": "nullptr"},
{"name": "required limits", "type": "required limits", "annotation": "const*", "optional": true}, {"name": "required limits", "type": "required limits", "annotation": "const*", "optional": true},
{"name": "default queue", "type": "queue descriptor"} {"name": "default queue", "type": "queue descriptor", "tags": ["upstream"]}
] ]
}, },
"dawn toggles device descriptor": { "dawn toggles device descriptor": {
@ -1152,15 +1152,6 @@
{"name": "callback", "type": "error callback"}, {"name": "callback", "type": "error callback"},
{"name": "userdata", "type": "void", "annotation": "*"} {"name": "userdata", "type": "void", "annotation": "*"}
] ]
},
{
"name": "set label",
"returns": "void",
"tags": ["dawn"],
"_TODO": "needs an upstream equivalent",
"args": [
{"name": "label", "type": "char", "annotation": "const*", "length": "strlen"}
]
} }
] ]
}, },
@ -1672,21 +1663,13 @@
{"name": "copy size", "type": "extent 3D", "annotation": "const*"}, {"name": "copy size", "type": "extent 3D", "annotation": "const*"},
{"name": "options", "type": "copy texture for browser options", "annotation": "const*"} {"name": "options", "type": "copy texture for browser options", "annotation": "const*"}
] ]
},
{
"name": "set label",
"returns": "void",
"tags": ["dawn"],
"_TODO": "needs an upstream equivalent",
"args": [
{"name": "label", "type": "char", "annotation": "const*", "length": "strlen"}
]
} }
] ]
}, },
"queue descriptor": { "queue descriptor": {
"category": "structure", "category": "structure",
"extensible": "in", "extensible": "in",
"tags": ["upstream"],
"members": [ "members": [
{"name": "label", "type": "char", "annotation": "const*", "length": "strlen", "optional": true} {"name": "label", "type": "char", "annotation": "const*", "length": "strlen", "optional": true}
] ]

View File

@ -198,10 +198,6 @@ namespace dawn::native {
mFormatTable = BuildFormatTable(this); mFormatTable = BuildFormatTable(this);
SetDefaultToggles(); SetDefaultToggles();
if (descriptor->label != nullptr && strlen(descriptor->label) != 0) {
mLabel = descriptor->label;
}
} }
DeviceBase::DeviceBase() : mState(State::Alive) { DeviceBase::DeviceBase() : mState(State::Alive) {
@ -214,15 +210,9 @@ namespace dawn::native {
mQueue = nullptr; mQueue = nullptr;
} }
MaybeError DeviceBase::Initialize(QueueBase* defaultQueue, const DeviceDescriptor* descriptor) { MaybeError DeviceBase::Initialize(QueueBase* defaultQueue) {
mQueue = AcquireRef(defaultQueue); mQueue = AcquireRef(defaultQueue);
// If an label was specified for the default queue in the device descriptor, set it now.
if (descriptor->defaultQueue.label != nullptr &&
strlen(descriptor->defaultQueue.label) != 0) {
mQueue->APISetLabel(descriptor->defaultQueue.label);
}
#if defined(DAWN_ENABLE_ASSERTS) #if defined(DAWN_ENABLE_ASSERTS)
mUncapturedErrorCallback = [](WGPUErrorType, char const*, void*) { mUncapturedErrorCallback = [](WGPUErrorType, char const*, void*) {
static bool calledOnce = false; static bool calledOnce = false;

View File

@ -382,7 +382,7 @@ namespace dawn::native {
void SetToggle(Toggle toggle, bool isEnabled); void SetToggle(Toggle toggle, bool isEnabled);
void ForceSetToggle(Toggle toggle, bool isEnabled); void ForceSetToggle(Toggle toggle, bool isEnabled);
MaybeError Initialize(QueueBase* defaultQueue, const DeviceDescriptor* descriptor); MaybeError Initialize(QueueBase* defaultQueue);
void DestroyObjects(); void DestroyObjects();
void Destroy(); void Destroy();

View File

@ -59,11 +59,11 @@ namespace dawn::native::d3d12 {
ResultOrError<Ref<Device>> Device::Create(Adapter* adapter, ResultOrError<Ref<Device>> Device::Create(Adapter* adapter,
const DeviceDescriptor* descriptor) { const DeviceDescriptor* descriptor) {
Ref<Device> device = AcquireRef(new Device(adapter, descriptor)); Ref<Device> device = AcquireRef(new Device(adapter, descriptor));
DAWN_TRY(device->Initialize(descriptor)); DAWN_TRY(device->Initialize());
return device; return device;
} }
MaybeError Device::Initialize(const DeviceDescriptor* descriptor) { MaybeError Device::Initialize() {
InitTogglesFromDriver(); InitTogglesFromDriver();
mD3d12Device = ToBackend(GetAdapter())->GetDevice(); mD3d12Device = ToBackend(GetAdapter())->GetDevice();
@ -163,7 +163,7 @@ namespace dawn::native::d3d12 {
GetD3D12Device()->CreateCommandSignature(&programDesc, NULL, GetD3D12Device()->CreateCommandSignature(&programDesc, NULL,
IID_PPV_ARGS(&mDrawIndexedIndirectSignature)); IID_PPV_ARGS(&mDrawIndexedIndirectSignature));
DAWN_TRY(DeviceBase::Initialize(new Queue(this), descriptor)); DAWN_TRY(DeviceBase::Initialize(new Queue(this)));
// Device shouldn't be used until after DeviceBase::Initialize so we must wait until after // Device shouldn't be used until after DeviceBase::Initialize so we must wait until after
// device initialization to call NextSerial // device initialization to call NextSerial
DAWN_TRY(NextSerial()); DAWN_TRY(NextSerial());
@ -174,8 +174,6 @@ namespace dawn::native::d3d12 {
DAWN_TRY(CreateZeroBuffer()); DAWN_TRY(CreateZeroBuffer());
SetLabelImpl();
return {}; return {};
} }
@ -743,8 +741,4 @@ namespace dawn::native::d3d12 {
return ToBackend(computePipeline)->UsesNumWorkgroups(); return ToBackend(computePipeline)->UsesNumWorkgroups();
} }
void Device::SetLabelImpl() {
SetDebugName(this, mD3d12Device.Get(), "Dawn_Device", GetLabel());
}
} // namespace dawn::native::d3d12 } // namespace dawn::native::d3d12

View File

@ -45,7 +45,7 @@ namespace dawn::native::d3d12 {
const DeviceDescriptor* descriptor); const DeviceDescriptor* descriptor);
~Device() override; ~Device() override;
MaybeError Initialize(const DeviceDescriptor* descriptor); MaybeError Initialize();
ResultOrError<Ref<CommandBufferBase>> CreateCommandBuffer( ResultOrError<Ref<CommandBufferBase>> CreateCommandBuffer(
CommandEncoder* encoder, CommandEncoder* encoder,
@ -147,9 +147,6 @@ namespace dawn::native::d3d12 {
bool ShouldDuplicateNumWorkgroupsForDispatchIndirect( bool ShouldDuplicateNumWorkgroupsForDispatchIndirect(
ComputePipelineBase* computePipeline) const override; ComputePipelineBase* computePipeline) const override;
// Dawn API
void SetLabelImpl() override;
private: private:
using DeviceBase::DeviceBase; using DeviceBase::DeviceBase;

View File

@ -21,14 +21,12 @@
#include "dawn/native/d3d12/CommandBufferD3D12.h" #include "dawn/native/d3d12/CommandBufferD3D12.h"
#include "dawn/native/d3d12/D3D12Error.h" #include "dawn/native/d3d12/D3D12Error.h"
#include "dawn/native/d3d12/DeviceD3D12.h" #include "dawn/native/d3d12/DeviceD3D12.h"
#include "dawn/native/d3d12/UtilsD3D12.h"
#include "dawn/platform/DawnPlatform.h" #include "dawn/platform/DawnPlatform.h"
#include "dawn/platform/tracing/TraceEvent.h" #include "dawn/platform/tracing/TraceEvent.h"
namespace dawn::native::d3d12 { namespace dawn::native::d3d12 {
Queue::Queue(Device* device) : QueueBase(device) { Queue::Queue(Device* device) : QueueBase(device) {
SetLabelImpl();
} }
MaybeError Queue::SubmitImpl(uint32_t commandCount, CommandBufferBase* const* commands) { MaybeError Queue::SubmitImpl(uint32_t commandCount, CommandBufferBase* const* commands) {
@ -53,11 +51,4 @@ namespace dawn::native::d3d12 {
return {}; return {};
} }
void Queue::SetLabelImpl() {
Device* device = ToBackend(GetDevice());
// TODO(crbug.com/dawn/1344): When we start using multiple queues this needs to be adjusted
// so it doesn't always change the default queue's label.
SetDebugName(device, device->GetCommandQueue().Get(), "Dawn_Queue", GetLabel());
}
} // namespace dawn::native::d3d12 } // namespace dawn::native::d3d12

View File

@ -30,9 +30,6 @@ namespace dawn::native::d3d12 {
private: private:
MaybeError SubmitImpl(uint32_t commandCount, CommandBufferBase* const* commands) override; MaybeError SubmitImpl(uint32_t commandCount, CommandBufferBase* const* commands) override;
// Dawn API
void SetLabelImpl() override;
}; };
} // namespace dawn::native::d3d12 } // namespace dawn::native::d3d12

View File

@ -43,7 +43,7 @@ namespace dawn::native::metal {
const DeviceDescriptor* descriptor); const DeviceDescriptor* descriptor);
~Device() override; ~Device() override;
MaybeError Initialize(const DeviceDescriptor* descriptor); MaybeError Initialize();
MaybeError TickImpl() override; MaybeError TickImpl() override;

View File

@ -110,7 +110,7 @@ namespace dawn::native::metal {
NSPRef<id<MTLDevice>> mtlDevice, NSPRef<id<MTLDevice>> mtlDevice,
const DeviceDescriptor* descriptor) { const DeviceDescriptor* descriptor) {
Ref<Device> device = AcquireRef(new Device(adapter, std::move(mtlDevice), descriptor)); Ref<Device> device = AcquireRef(new Device(adapter, std::move(mtlDevice), descriptor));
DAWN_TRY(device->Initialize(descriptor)); DAWN_TRY(device->Initialize());
return device; return device;
} }
@ -124,7 +124,7 @@ namespace dawn::native::metal {
Destroy(); Destroy();
} }
MaybeError Device::Initialize(const DeviceDescriptor* descriptor) { MaybeError Device::Initialize() {
InitTogglesFromDriver(); InitTogglesFromDriver();
mCommandQueue.Acquire([*mMtlDevice newCommandQueue]); mCommandQueue.Acquire([*mMtlDevice newCommandQueue]);
@ -155,7 +155,7 @@ namespace dawn::native::metal {
} }
} }
return DeviceBase::Initialize(new Queue(this), descriptor); return DeviceBase::Initialize(new Queue(this));
} }
void Device::InitTogglesFromDriver() { void Device::InitTogglesFromDriver() {

View File

@ -103,7 +103,7 @@ namespace dawn::native::null {
ResultOrError<Ref<Device>> Device::Create(Adapter* adapter, ResultOrError<Ref<Device>> Device::Create(Adapter* adapter,
const DeviceDescriptor* descriptor) { const DeviceDescriptor* descriptor) {
Ref<Device> device = AcquireRef(new Device(adapter, descriptor)); Ref<Device> device = AcquireRef(new Device(adapter, descriptor));
DAWN_TRY(device->Initialize(descriptor)); DAWN_TRY(device->Initialize());
return device; return device;
} }
@ -111,8 +111,8 @@ namespace dawn::native::null {
Destroy(); Destroy();
} }
MaybeError Device::Initialize(const DeviceDescriptor* descriptor) { MaybeError Device::Initialize() {
return DeviceBase::Initialize(new Queue(this), descriptor); return DeviceBase::Initialize(new Queue(this));
} }
ResultOrError<Ref<BindGroupBase>> Device::CreateBindGroupImpl( ResultOrError<Ref<BindGroupBase>> Device::CreateBindGroupImpl(

View File

@ -90,7 +90,7 @@ namespace dawn::native::null {
const DeviceDescriptor* descriptor); const DeviceDescriptor* descriptor);
~Device() override; ~Device() override;
MaybeError Initialize(const DeviceDescriptor* descriptor); MaybeError Initialize();
ResultOrError<Ref<CommandBufferBase>> CreateCommandBuffer( ResultOrError<Ref<CommandBufferBase>> CreateCommandBuffer(
CommandEncoder* encoder, CommandEncoder* encoder,

View File

@ -39,7 +39,7 @@ namespace dawn::native::opengl {
const DeviceDescriptor* descriptor, const DeviceDescriptor* descriptor,
const OpenGLFunctions& functions) { const OpenGLFunctions& functions) {
Ref<Device> device = AcquireRef(new Device(adapter, descriptor, functions)); Ref<Device> device = AcquireRef(new Device(adapter, descriptor, functions));
DAWN_TRY(device->Initialize(descriptor)); DAWN_TRY(device->Initialize());
return device; return device;
} }
@ -53,11 +53,11 @@ namespace dawn::native::opengl {
Destroy(); Destroy();
} }
MaybeError Device::Initialize(const DeviceDescriptor* descriptor) { MaybeError Device::Initialize() {
InitTogglesFromDriver(); InitTogglesFromDriver();
mFormatTable = BuildGLFormatTable(); mFormatTable = BuildGLFormatTable();
return DeviceBase::Initialize(new Queue(this), descriptor); return DeviceBase::Initialize(new Queue(this));
} }
void Device::InitTogglesFromDriver() { void Device::InitTogglesFromDriver() {

View File

@ -42,7 +42,7 @@ namespace dawn::native::opengl {
const OpenGLFunctions& functions); const OpenGLFunctions& functions);
~Device() override; ~Device() override;
MaybeError Initialize(const DeviceDescriptor* descriptor); MaybeError Initialize();
// Contains all the OpenGL entry points, glDoFoo is called via device->gl.DoFoo. // Contains all the OpenGL entry points, glDoFoo is called via device->gl.DoFoo.
const OpenGLFunctions gl; const OpenGLFunctions gl;

View File

@ -48,7 +48,7 @@ namespace dawn::native::vulkan {
ResultOrError<Ref<Device>> Device::Create(Adapter* adapter, ResultOrError<Ref<Device>> Device::Create(Adapter* adapter,
const DeviceDescriptor* descriptor) { const DeviceDescriptor* descriptor) {
Ref<Device> device = AcquireRef(new Device(adapter, descriptor)); Ref<Device> device = AcquireRef(new Device(adapter, descriptor));
DAWN_TRY(device->Initialize(descriptor)); DAWN_TRY(device->Initialize());
return device; return device;
} }
@ -57,7 +57,7 @@ namespace dawn::native::vulkan {
InitTogglesFromDriver(); InitTogglesFromDriver();
} }
MaybeError Device::Initialize(const DeviceDescriptor* descriptor) { MaybeError Device::Initialize() {
// Copy the adapter's device info to the device so that we can change the "knobs" // Copy the adapter's device info to the device so that we can change the "knobs"
mDeviceInfo = ToBackend(GetAdapter())->GetDeviceInfo(); mDeviceInfo = ToBackend(GetAdapter())->GetDeviceInfo();
@ -101,9 +101,7 @@ namespace dawn::native::vulkan {
// extension is available. Override the decision if it is no applicable. // extension is available. Override the decision if it is no applicable.
ApplyUseZeroInitializeWorkgroupMemoryExtensionToggle(); ApplyUseZeroInitializeWorkgroupMemoryExtensionToggle();
SetLabelImpl(); return DeviceBase::Initialize(Queue::Create(this));
return DeviceBase::Initialize(Queue::Create(this), descriptor);
} }
Device::~Device() { Device::~Device() {
@ -1052,9 +1050,4 @@ namespace dawn::native::vulkan {
return mDeviceInfo.properties.limits.timestampPeriod; return mDeviceInfo.properties.limits.timestampPeriod;
} }
void Device::SetLabelImpl() {
SetDebugName(this, VK_OBJECT_TYPE_DEVICE, reinterpret_cast<uint64_t&>(mVkDevice),
"Dawn_Device", GetLabel());
}
} // namespace dawn::native::vulkan } // namespace dawn::native::vulkan

View File

@ -47,7 +47,7 @@ namespace dawn::native::vulkan {
const DeviceDescriptor* descriptor); const DeviceDescriptor* descriptor);
~Device() override; ~Device() override;
MaybeError Initialize(const DeviceDescriptor* descriptor); MaybeError Initialize();
// Contains all the Vulkan entry points, vkDoFoo is called via device->fn.DoFoo. // Contains all the Vulkan entry points, vkDoFoo is called via device->fn.DoFoo.
const VulkanFunctions fn; const VulkanFunctions fn;
@ -105,8 +105,6 @@ namespace dawn::native::vulkan {
float GetTimestampPeriodInNS() const override; float GetTimestampPeriodInNS() const override;
void SetLabelImpl() override;
private: private:
Device(Adapter* adapter, const DeviceDescriptor* descriptor); Device(Adapter* adapter, const DeviceDescriptor* descriptor);

View File

@ -22,7 +22,6 @@
#include "dawn/native/vulkan/CommandBufferVk.h" #include "dawn/native/vulkan/CommandBufferVk.h"
#include "dawn/native/vulkan/CommandRecordingContext.h" #include "dawn/native/vulkan/CommandRecordingContext.h"
#include "dawn/native/vulkan/DeviceVk.h" #include "dawn/native/vulkan/DeviceVk.h"
#include "dawn/native/vulkan/UtilsVulkan.h"
#include "dawn/platform/DawnPlatform.h" #include "dawn/platform/DawnPlatform.h"
#include "dawn/platform/tracing/TraceEvent.h" #include "dawn/platform/tracing/TraceEvent.h"
@ -34,7 +33,6 @@ namespace dawn::native::vulkan {
} }
Queue::Queue(Device* device) : QueueBase(device) { Queue::Queue(Device* device) : QueueBase(device) {
SetLabelImpl();
} }
Queue::~Queue() { Queue::~Queue() {
@ -58,13 +56,4 @@ namespace dawn::native::vulkan {
return {}; return {};
} }
void Queue::SetLabelImpl() {
Device* device = ToBackend(GetDevice());
VkQueue handle = device->GetQueue();
// TODO(crbug.com/dawn/1344): When we start using multiple queues this needs to be adjusted
// so it doesn't always change the default queue's label.
SetDebugName(device, VK_OBJECT_TYPE_QUEUE, reinterpret_cast<uint64_t&>(handle),
"Dawn_Queue", GetLabel());
}
} // namespace dawn::native::vulkan } // namespace dawn::native::vulkan

View File

@ -25,9 +25,6 @@ namespace dawn::native::vulkan {
public: public:
static Queue* Create(Device* device); static Queue* Create(Device* device);
// Dawn API
void SetLabelImpl() override;
private: private:
Queue(Device* device); Queue(Device* device);
~Queue() override; ~Queue() override;