d3d12: Additional fixes for MinGW build

Various fixes for GCC build, including actual bug fixes

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7722>
This commit is contained in:
Seungha Yang 2024-10-24 06:10:13 +09:00
parent 5e8359d407
commit 8c3d516a14
10 changed files with 26 additions and 38 deletions

View file

@ -773,20 +773,6 @@ gst_d3d12_device_get_property (GObject * object, guint prop_id,
} }
} }
static void
make_buffer_format (GstVideoFormat format, GstD3D12Format * d3d12_format)
{
d3d12_format->format = format;
d3d12_format->dimension = D3D12_RESOURCE_DIMENSION_BUFFER;
d3d12_format->dxgi_format = DXGI_FORMAT_UNKNOWN;
d3d12_format->support1 = D3D12_FORMAT_SUPPORT1_NONE;
d3d12_format->support2 = D3D12_FORMAT_SUPPORT2_NONE;
for (guint i = 0; i < GST_VIDEO_MAX_PLANES; i++) {
d3d12_format->resource_format[i] = DXGI_FORMAT_UNKNOWN;
d3d12_format->uav_format[i] = DXGI_FORMAT_UNKNOWN;
}
}
static void static void
gst_d3d12_device_setup_format_table (GstD3D12Device * self) gst_d3d12_device_setup_format_table (GstD3D12Device * self)
{ {

View file

@ -54,6 +54,10 @@ else
'-Wno-redundant-decls', '-Wno-redundant-decls',
# include/directxmath/DirectXMathMatrix.inl:1161:16: error: variable 'aa' set but not used # include/directxmath/DirectXMathMatrix.inl:1161:16: error: variable 'aa' set but not used
'-Wno-unused-but-set-variable', '-Wno-unused-but-set-variable',
# include/directx/d3dx12_pipeline_state_stream.h:28: error: ignoring '#pragma warning '
'-Wno-unknown-pragmas',
# Various warnings in DirectX-Headers headers
'-Wno-switch',
]) ])
endif endif

View file

@ -947,8 +947,8 @@ gst_d3d12_decoder_new_picture_with_size (GstD3D12Decoder * decoder,
return GST_FLOW_ERROR; return GST_FLOW_ERROR;
} }
if (priv->session->coded_width >= width && if (priv->session->coded_width >= (gint) width &&
priv->session->coded_height >= height) { priv->session->coded_height >= (gint) height) {
return gst_d3d12_decoder_new_picture (decoder, videodec, picture); return gst_d3d12_decoder_new_picture (decoder, videodec, picture);
} }

View file

@ -113,12 +113,6 @@ struct _GstD3D12DecoderCpb : public GstMiniObject
D3D12_VIDEO_DECODE_COMPRESSED_BITSTREAM bs = { }; D3D12_VIDEO_DECODE_COMPRESSED_BITSTREAM bs = { };
}; };
bool operator<(const std::shared_ptr<DecoderBuffer> & a,
const std::shared_ptr<DecoderBuffer> & b)
{
return a->alloc_size_ < b->alloc_size_;
}
struct GstD3D12DecoderCpbPoolPrivate struct GstD3D12DecoderCpbPoolPrivate
{ {
~GstD3D12DecoderCpbPoolPrivate () ~GstD3D12DecoderCpbPoolPrivate ()

View file

@ -272,7 +272,7 @@ gst_d3d12_mip_gen_execute (GstD3D12MipGen * gen, ID3D12Resource * resource,
srv_desc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2D; srv_desc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2D;
srv_desc.Texture2D.MipLevels = desc.MipLevels; srv_desc.Texture2D.MipLevels = desc.MipLevels;
for (guint srcMip = 0; srcMip < desc.MipLevels - 1;) { for (UINT16 srcMip = 0; srcMip < desc.MipLevels - 1;) {
guint64 srcWidth = desc.Width >> srcMip; guint64 srcWidth = desc.Width >> srcMip;
guint srcHeight = desc.Height >> srcMip; guint srcHeight = desc.Height >> srcMip;
guint dstWidth = static_cast < guint > (srcWidth >> 1); guint dstWidth = static_cast < guint > (srcWidth >> 1);

View file

@ -32,6 +32,8 @@
using namespace DirectX; using namespace DirectX;
/* *INDENT-ON* */ /* *INDENT-ON* */
/* Enable this once we use debug print in this file */
#if 0
#ifndef GST_DISABLE_GST_DEBUG #ifndef GST_DISABLE_GST_DEBUG
#define GST_CAT_DEFAULT ensure_debug_category() #define GST_CAT_DEFAULT ensure_debug_category()
static GstDebugCategory * static GstDebugCategory *
@ -46,6 +48,7 @@ ensure_debug_category (void)
return cat; return cat;
} }
#endif /* GST_DISABLE_GST_DEBUG */ #endif /* GST_DISABLE_GST_DEBUG */
#endif
GType GType
gst_d3d12_sampling_method_get_type (void) gst_d3d12_sampling_method_get_type (void)

View file

@ -1188,13 +1188,6 @@ setup_d2d_render (GstD3D12TestSrc * self, RenderContext * ctx)
auto priv = self->priv; auto priv = self->priv;
HRESULT hr; HRESULT hr;
static const D3D_FEATURE_LEVEL feature_levels[] = {
D3D_FEATURE_LEVEL_12_1,
D3D_FEATURE_LEVEL_12_0,
D3D_FEATURE_LEVEL_11_1,
D3D_FEATURE_LEVEL_11_0,
};
if (!priv->d2d_factory) { if (!priv->d2d_factory) {
ComPtr < ID2D1Factory > d2d_factory; ComPtr < ID2D1Factory > d2d_factory;
hr = D2D1CreateFactory (D2D1_FACTORY_TYPE_MULTI_THREADED, hr = D2D1CreateFactory (D2D1_FACTORY_TYPE_MULTI_THREADED,

View file

@ -51,12 +51,12 @@ SwapChainProxy::SwapChainProxy (GstD3D12Window * window, SIZE_T id)
window_ = (GstD3D12Window *) gst_object_ref (window); window_ = (GstD3D12Window *) gst_object_ref (window);
id_ = id; id_ = id;
GST_DEBUG_OBJECT (window_, "Creating proxy %" G_GSIZE_FORMAT, id_); GST_DEBUG_OBJECT (window_, "Creating proxy %u", (guint) id_);
} }
SwapChainProxy::~SwapChainProxy () SwapChainProxy::~SwapChainProxy ()
{ {
GST_DEBUG_OBJECT (window_, "Destroying proxy %" G_GSIZE_FORMAT, id_); GST_DEBUG_OBJECT (window_, "Destroying proxy %u", (guint) id_);
swapchain_ = nullptr; swapchain_ = nullptr;
if (window_thread_ && hwnd_ && hwnd_ != parent_hwnd_) { if (window_thread_ && hwnd_ && hwnd_ != parent_hwnd_) {

View file

@ -56,6 +56,10 @@ else
'-Wno-redundant-decls', '-Wno-redundant-decls',
# include/directxmath/DirectXMathMatrix.inl:1161:16: error: variable 'aa' set but not used # include/directxmath/DirectXMathMatrix.inl:1161:16: error: variable 'aa' set but not used
'-Wno-unused-but-set-variable', '-Wno-unused-but-set-variable',
# include/directx/d3dx12_pipeline_state_stream.h:28: error: ignoring '#pragma warning '
'-Wno-unknown-pragmas',
# Various warnings in DirectX-Headers headers
'-Wno-switch',
]) ])
endif endif

View file

@ -576,13 +576,15 @@ gst_cuda_d3d12_interop_upload_async (GstCudaD3D12Interop * interop,
src_box[i].left = 0; src_box[i].left = 0;
src_box[i].top = 0; src_box[i].top = 0;
src_box[i].right = MIN (frame_12.plane_rect[i].right, src_box[i].right = MIN ((UINT) frame_12.plane_rect[i].right,
priv->layout[i].Footprint.Width); (UINT) priv->layout[i].Footprint.Width);
src_box[i].bottom = MIN (frame_12.plane_rect[i].bottom, src_box[i].bottom = MIN ((UINT) frame_12.plane_rect[i].bottom,
priv->layout[i].Footprint.Height); priv->layout[i].Footprint.Height);
src_box[i].front = 0; src_box[i].front = 0;
src_box[i].back = 1; src_box[i].back = 1;
args[i].src_box = &src_box[i];
args[i].src.Type = D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX; args[i].src.Type = D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX;
args[i].src.pResource = frame_12.data[i]; args[i].src.pResource = frame_12.data[i];
args[i].src.SubresourceIndex = frame_12.subresource_index[i]; args[i].src.SubresourceIndex = frame_12.subresource_index[i];
@ -790,13 +792,15 @@ gst_cuda_d3d12_interop_download_async (GstCudaD3D12Interop * interop,
for (guint i = 0; i < GST_VIDEO_INFO_N_PLANES (&priv->info); i++) { for (guint i = 0; i < GST_VIDEO_INFO_N_PLANES (&priv->info); i++) {
src_box[i].left = 0; src_box[i].left = 0;
src_box[i].top = 0; src_box[i].top = 0;
src_box[i].right = MIN (frame_12.plane_rect[i].right, src_box[i].right = MIN ((UINT) frame_12.plane_rect[i].right,
priv->layout[i].Footprint.Width); (UINT) priv->layout[i].Footprint.Width);
src_box[i].bottom = MIN (frame_12.plane_rect[i].bottom, src_box[i].bottom = MIN ((UINT) frame_12.plane_rect[i].bottom,
priv->layout[i].Footprint.Height); priv->layout[i].Footprint.Height);
src_box[i].front = 0; src_box[i].front = 0;
src_box[i].back = 1; src_box[i].back = 1;
args[i].src_box = &src_box[i];
args[i].src.Type = D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT; args[i].src.Type = D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT;
args[i].src.pResource = resource->resource.Get (); args[i].src.pResource = resource->resource.Get ();
args[i].src.PlacedFootprint = priv->layout[i]; args[i].src.PlacedFootprint = priv->layout[i];