From 0b0bf1b0bffa8ab47c8b6ac672ff91ddafbd349d Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Wed, 27 Jan 2021 04:34:13 +0900 Subject: [PATCH] d3d11: Suppress some warning debug messages * Don't warn for live object, since ID3D11Debug itself seems to be holding refcount of ID3D11Device at the moment we called ID3D11Debug::ReportLiveDeviceObjects(). It would report live object always * Device might not be able to support some formats (e.g., P010) especially in case of WARP device. We don't need to warn about that. * gst_d3d11_device_new() can be used for device enumeration. Don't warn even if we cannot create D3D11 device with given adapter index therefore. * Don't warn for HLSL compiler warning. It's just noise and should not be critical thing at all Part-of: --- gst-libs/gst/d3d11/gstd3d11device.c | 19 +++++++++++++------ sys/d3d11/gstd3d11shader.c | 3 ++- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/gst-libs/gst/d3d11/gstd3d11device.c b/gst-libs/gst/d3d11/gstd3d11device.c index 82139fcd64..2de71364a5 100644 --- a/gst-libs/gst/d3d11/gstd3d11device.c +++ b/gst-libs/gst/d3d11/gstd3d11device.c @@ -212,6 +212,13 @@ gst_d3d11_device_d3d11_debug (GstD3D11Device * device, hr = ID3D11InfoQueue_GetMessage (priv->d3d11_info_queue, i, msg, &msg_len); level = d3d11_message_severity_to_gst (msg->Severity); + if (msg->Category == D3D11_MESSAGE_CATEGORY_STATE_CREATION && + level > GST_LEVEL_ERROR) { + /* Do not warn for live object, since there would be live object + * when ReportLiveDeviceObjects was called */ + level = GST_LEVEL_INFO; + } + gst_debug_log (gst_d3d11_debug_layer_debug, level, file, function, line, G_OBJECT (device), "D3D11InfoQueue: %s", msg->pDescription); } @@ -439,20 +446,20 @@ can_support_format (GstD3D11Device * self, DXGI_FORMAT format, flags |= extra_flags; if (!is_windows_8_or_greater ()) { - GST_WARNING_OBJECT (self, "DXGI format %d needs Windows 8 or greater", + GST_INFO_OBJECT (self, "DXGI format %d needs Windows 8 or greater", (guint) format); return FALSE; } hr = ID3D11Device_CheckFormatSupport (handle, format, &supported); - if (!gst_d3d11_result (hr, NULL)) { - GST_WARNING_OBJECT (self, "DXGI format %d is not supported by device", + if (FAILED (hr)) { + GST_DEBUG_OBJECT (self, "DXGI format %d is not supported by device", (guint) format); return FALSE; } if ((supported & flags) != flags) { - GST_WARNING_OBJECT (self, + GST_DEBUG_OBJECT (self, "DXGI format %d doesn't support flag 0x%x (supported flag 0x%x)", (guint) format, (guint) supported, (guint) flags); return FALSE; @@ -682,7 +689,7 @@ gst_d3d11_device_constructed (GObject * object) if (IDXGIFactory1_EnumAdapters1 (factory, priv->adapter, &adapter) == DXGI_ERROR_NOT_FOUND) { - GST_WARNING_OBJECT (self, "No adapter for index %d", priv->adapter); + GST_DEBUG_OBJECT (self, "No adapter for index %d", priv->adapter); goto error; } else { DXGI_ADAPTER_DESC1 desc; @@ -971,7 +978,7 @@ gst_d3d11_device_new (guint adapter, guint flags) priv = device->priv; if (!priv->device || !priv->device_context) { - GST_WARNING ("Cannot create d3d11 device with adapter %d", adapter); + GST_DEBUG ("Cannot create d3d11 device with adapter %d", adapter); gst_clear_object (&device); } else { gst_object_ref_sink (device); diff --git a/sys/d3d11/gstd3d11shader.c b/sys/d3d11/gstd3d11shader.c index b10fe34570..064bb1d7b8 100644 --- a/sys/d3d11/gstd3d11shader.c +++ b/sys/d3d11/gstd3d11shader.c @@ -137,7 +137,8 @@ compile_shader (GstD3D11Device * device, const gchar * shader_source, if (error) { const gchar *err = ID3D10Blob_GetBufferPointer (error); - GST_WARNING ("HLSL compiler warnings:\n%s", GST_STR_NULL (err)); + GST_DEBUG ("HLSL compiler warnings:\n%s\nShader code:\n%s", + GST_STR_NULL (err), GST_STR_NULL (shader_source)); ID3D10Blob_Release (error); }