mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-25 19:21:06 +00:00
d3d12: Shorten various names
Update names of various objects and method to be shorter, for instance GstD3D12CommandAllocator is changed to GstD3D12CmdAlloc. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7642>
This commit is contained in:
parent
024f450204
commit
7c06001705
44 changed files with 1517 additions and 1534 deletions
|
@ -24,7 +24,7 @@
|
|||
#include <gst/d3d12/gstd3d12device-private.h>
|
||||
#include <gst/d3d12/gstd3d12format-private.h>
|
||||
#include <gst/d3d12/gstd3d12converter-private.h>
|
||||
#include <gst/d3d12/gstd3d12commandqueue-private.h>
|
||||
#include <gst/d3d12/gstd3d12cmdqueue-private.h>
|
||||
#include <gst/d3d12/gstd3d12compat.h>
|
||||
|
||||
/*
|
||||
|
|
|
@ -27,10 +27,10 @@
|
|||
#include <gst/gst.h>
|
||||
#include <gst/d3d12/gstd3d12_fwd.h>
|
||||
#include <gst/d3d12/gstd3d12bufferpool.h>
|
||||
#include <gst/d3d12/gstd3d12commandallocatorpool.h>
|
||||
#include <gst/d3d12/gstd3d12commandqueue.h>
|
||||
#include <gst/d3d12/gstd3d12cmdallocpool.h>
|
||||
#include <gst/d3d12/gstd3d12cmdqueue.h>
|
||||
#include <gst/d3d12/gstd3d12converter.h>
|
||||
#include <gst/d3d12/gstd3d12descriptorpool.h>
|
||||
#include <gst/d3d12/gstd3d12descheappool.h>
|
||||
#include <gst/d3d12/gstd3d12device.h>
|
||||
#include <gst/d3d12/gstd3d12fencedatapool.h>
|
||||
#include <gst/d3d12/gstd3d12format.h>
|
||||
|
|
|
@ -65,23 +65,23 @@ typedef struct _GstD3D12BufferPool GstD3D12BufferPool;
|
|||
typedef struct _GstD3D12BufferPoolClass GstD3D12BufferPoolClass;
|
||||
typedef struct _GstD3D12BufferPoolPrivate GstD3D12BufferPoolPrivate;
|
||||
|
||||
typedef struct _GstD3D12CommandAllocatorPool GstD3D12CommandAllocatorPool;
|
||||
typedef struct _GstD3D12CommandAllocatorPoolClass GstD3D12CommandAllocatorPoolClass;
|
||||
typedef struct _GstD3D12CommandAllocatorPoolPrivate GstD3D12CommandAllocatorPoolPrivate;
|
||||
typedef struct _GstD3D12CommandAllocator GstD3D12CommandAllocator;
|
||||
typedef struct _GstD3D12CmdAllocPool GstD3D12CmdAllocPool;
|
||||
typedef struct _GstD3D12CmdAllocPoolClass GstD3D12CmdAllocPoolClass;
|
||||
typedef struct _GstD3D12CmdAllocPoolPrivate GstD3D12CmdAllocPoolPrivate;
|
||||
typedef struct _GstD3D12CmdAlloc GstD3D12CmdAlloc;
|
||||
|
||||
typedef struct _GstD3D12CommandQueue GstD3D12CommandQueue;
|
||||
typedef struct _GstD3D12CommandQueueClass GstD3D12CommandQueueClass;
|
||||
typedef struct _GstD3D12CommandQueuePrivate GstD3D12CommandQueuePrivate;
|
||||
typedef struct _GstD3D12CmdQueue GstD3D12CmdQueue;
|
||||
typedef struct _GstD3D12CmdQueueClass GstD3D12CmdQueueClass;
|
||||
typedef struct _GstD3D12CmdQueuePrivate GstD3D12CmdQueuePrivate;
|
||||
|
||||
typedef struct _GstD3D12Converter GstD3D12Converter;
|
||||
typedef struct _GstD3D12ConverterClass GstD3D12ConverterClass;
|
||||
typedef struct _GstD3D12ConverterPrivate GstD3D12ConverterPrivate;
|
||||
|
||||
typedef struct _GstD3D12DescriptorPool GstD3D12DescriptorPool;
|
||||
typedef struct _GstD3D12DescriptorPoolClass GstD3D12DescriptorPoolClass;
|
||||
typedef struct _GstD3D12DescriptorPoolPrivate GstD3D12DescriptorPoolPrivate;
|
||||
typedef struct _GstD3D12Descriptor GstD3D12Descriptor;
|
||||
typedef struct _GstD3D12DescHeapPool GstD3D12DescHeapPool;
|
||||
typedef struct _GstD3D12DescHeapPoolClass GstD3D12DescHeapPoolClass;
|
||||
typedef struct _GstD3D12DescHeapPoolPrivate GstD3D12DescHeapPoolPrivate;
|
||||
typedef struct _GstD3D12DescHeap GstD3D12DescHeap;
|
||||
|
||||
typedef struct _GstD3D12FenceDataPool GstD3D12FenceDataPool;
|
||||
typedef struct _GstD3D12FenceDataPoolClass GstD3D12FenceDataPoolClass;
|
||||
|
|
|
@ -0,0 +1,283 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) 2023 Seungha Yang <seungha@centricular.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "gstd3d12.h"
|
||||
#include <wrl.h>
|
||||
#include <queue>
|
||||
#include <mutex>
|
||||
|
||||
GST_DEBUG_CATEGORY_STATIC (gst_d3d12_cmd_alloc_pool_debug);
|
||||
#define GST_CAT_DEFAULT gst_d3d12_cmd_alloc_pool_debug
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
using namespace Microsoft::WRL;
|
||||
|
||||
struct _GstD3D12CmdAlloc : public GstMiniObject
|
||||
{
|
||||
GstD3D12CmdAllocPool *pool = nullptr;
|
||||
D3D12_COMMAND_LIST_TYPE type;
|
||||
ComPtr < ID3D12CommandAllocator > ca;
|
||||
};
|
||||
|
||||
struct _GstD3D12CmdAllocPoolPrivate
|
||||
{
|
||||
~_GstD3D12CmdAllocPoolPrivate ()
|
||||
{
|
||||
while (!cmd_pool.empty ()) {
|
||||
auto ca = cmd_pool.front ();
|
||||
cmd_pool.pop ();
|
||||
gst_mini_object_unref (ca);
|
||||
}
|
||||
}
|
||||
|
||||
ComPtr<ID3D12Device> device;
|
||||
|
||||
std::mutex lock;
|
||||
std::queue<GstD3D12CmdAlloc *>cmd_pool;
|
||||
D3D12_COMMAND_LIST_TYPE cmd_type;
|
||||
};
|
||||
/* *INDENT-ON* */
|
||||
|
||||
GST_DEFINE_MINI_OBJECT_TYPE (GstD3D12CmdAlloc, gst_d3d12_cmd_alloc);
|
||||
|
||||
static void gst_d3d12_cmd_alloc_pool_finalize (GObject * object);
|
||||
|
||||
#define gst_d3d12_cmd_alloc_pool_parent_class parent_class
|
||||
G_DEFINE_TYPE (GstD3D12CmdAllocPool, gst_d3d12_cmd_alloc_pool, GST_TYPE_OBJECT);
|
||||
|
||||
static void
|
||||
gst_d3d12_cmd_alloc_pool_class_init (GstD3D12CmdAllocPoolClass * klass)
|
||||
{
|
||||
auto object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->finalize = gst_d3d12_cmd_alloc_pool_finalize;
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (gst_d3d12_cmd_alloc_pool_debug,
|
||||
"d3d12cmdallocpool", 0, "d3d12cmdallocpool");
|
||||
}
|
||||
|
||||
static void
|
||||
gst_d3d12_cmd_alloc_pool_init (GstD3D12CmdAllocPool * self)
|
||||
{
|
||||
self->priv = new GstD3D12CmdAllocPoolPrivate ();
|
||||
}
|
||||
|
||||
static void
|
||||
gst_d3d12_cmd_alloc_pool_finalize (GObject * object)
|
||||
{
|
||||
auto self = GST_D3D12_CMD_ALLOC_POOL (object);
|
||||
|
||||
delete self->priv;
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_d3d12_cmd_alloc_pool_new:
|
||||
* @device: a #GstD3D12Device
|
||||
* @type: D3D12_COMMAND_LIST_TYPE
|
||||
*
|
||||
* Returns: (transfer full): a new #GstD3D12CmdAllocPool instance
|
||||
*
|
||||
* Since: 1.26
|
||||
*/
|
||||
GstD3D12CmdAllocPool *
|
||||
gst_d3d12_cmd_alloc_pool_new (ID3D12Device * device,
|
||||
D3D12_COMMAND_LIST_TYPE type)
|
||||
{
|
||||
g_return_val_if_fail (device, nullptr);
|
||||
|
||||
auto self = (GstD3D12CmdAllocPool *)
|
||||
g_object_new (GST_TYPE_D3D12_CMD_ALLOC_POOL, nullptr);
|
||||
gst_object_ref_sink (self);
|
||||
|
||||
auto priv = self->priv;
|
||||
priv->device = device;
|
||||
priv->cmd_type = type;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_d3d12_cmd_alloc_pool_release (GstD3D12CmdAllocPool * pool,
|
||||
GstD3D12CmdAlloc * ca)
|
||||
{
|
||||
auto priv = pool->priv;
|
||||
{
|
||||
std::lock_guard < std::mutex > lk (priv->lock);
|
||||
ca->dispose = nullptr;
|
||||
ca->pool = nullptr;
|
||||
priv->cmd_pool.push (ca);
|
||||
}
|
||||
|
||||
gst_object_unref (pool);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_d3d12_cmd_alloc_dispose (GstD3D12CmdAlloc * ca)
|
||||
{
|
||||
if (!ca->pool)
|
||||
return TRUE;
|
||||
|
||||
gst_mini_object_ref (ca);
|
||||
gst_d3d12_cmd_alloc_pool_release (ca->pool, ca);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_d3d12_cmd_alloc_free (GstD3D12CmdAlloc * ca)
|
||||
{
|
||||
delete ca;
|
||||
}
|
||||
|
||||
static GstD3D12CmdAlloc *
|
||||
gst_d3d12_cmd_alloc_new (ID3D12CommandAllocator * handle,
|
||||
D3D12_COMMAND_LIST_TYPE type)
|
||||
{
|
||||
auto ca = new GstD3D12CmdAlloc ();
|
||||
ca->ca = handle;
|
||||
ca->type = type;
|
||||
|
||||
gst_mini_object_init (ca, 0, gst_d3d12_cmd_alloc_get_type (),
|
||||
nullptr, nullptr, (GstMiniObjectFreeFunction) gst_d3d12_cmd_alloc_free);
|
||||
|
||||
return ca;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_d3d12_cmd_alloc_pool_acquire:
|
||||
* @pool: a #GstD3D12CmdAllocPool
|
||||
* @ca: (out) (transfer full): a pointer to #GstD3D12CmdAlloc
|
||||
*
|
||||
* Acquire #GstD3D12CmdAlloc object
|
||||
*
|
||||
* Returns: %TRUE if successful
|
||||
*
|
||||
* Since: 1.26
|
||||
*/
|
||||
gboolean
|
||||
gst_d3d12_cmd_alloc_pool_acquire (GstD3D12CmdAllocPool * pool,
|
||||
GstD3D12CmdAlloc ** ca)
|
||||
{
|
||||
g_return_val_if_fail (GST_IS_D3D12_CMD_ALLOC_POOL (pool), FALSE);
|
||||
g_return_val_if_fail (ca, FALSE);
|
||||
|
||||
*ca = nullptr;
|
||||
|
||||
auto priv = pool->priv;
|
||||
GstD3D12CmdAlloc *new_ca = nullptr;
|
||||
HRESULT hr;
|
||||
|
||||
{
|
||||
std::lock_guard < std::mutex > lk (priv->lock);
|
||||
if (!priv->cmd_pool.empty ()) {
|
||||
new_ca = priv->cmd_pool.front ();
|
||||
priv->cmd_pool.pop ();
|
||||
}
|
||||
}
|
||||
|
||||
if (!new_ca) {
|
||||
ComPtr < ID3D12CommandAllocator > ca_handle;
|
||||
hr = priv->device->CreateCommandAllocator (priv->cmd_type,
|
||||
IID_PPV_ARGS (&ca_handle));
|
||||
if (FAILED (hr)) {
|
||||
GST_ERROR_OBJECT (pool, "Couldn't create command allocator, hr: 0x%x",
|
||||
(guint) hr);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
new_ca = gst_d3d12_cmd_alloc_new (ca_handle.Get (), priv->cmd_type);
|
||||
if (GST_OBJECT_FLAG_IS_SET (pool, GST_OBJECT_FLAG_MAY_BE_LEAKED))
|
||||
GST_MINI_OBJECT_FLAG_SET (new_ca, GST_MINI_OBJECT_FLAG_MAY_BE_LEAKED);
|
||||
}
|
||||
|
||||
new_ca->pool = (GstD3D12CmdAllocPool *) gst_object_ref (pool);
|
||||
new_ca->dispose = (GstMiniObjectDisposeFunction) gst_d3d12_cmd_alloc_dispose;
|
||||
|
||||
*ca = new_ca;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_d3d12_cmd_alloc_ref:
|
||||
* @ca: a #GstD3D12CmdAlloc
|
||||
*
|
||||
* Increments the refcount of @ca
|
||||
*
|
||||
* Returns: (transfer full): a #GstD3D12CmdAlloc
|
||||
*
|
||||
* Since: 1.26
|
||||
*/
|
||||
GstD3D12CmdAlloc *
|
||||
gst_d3d12_cmd_alloc_ref (GstD3D12CmdAlloc * ca)
|
||||
{
|
||||
return (GstD3D12CmdAlloc *) gst_mini_object_ref (ca);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_d3d12_cmd_alloc_unref:
|
||||
* @ca: a #GstD3D12CmdAlloc
|
||||
*
|
||||
* Decrements the refcount of @ca
|
||||
*
|
||||
* Since: 1.26
|
||||
*/
|
||||
void
|
||||
gst_d3d12_cmd_alloc_unref (GstD3D12CmdAlloc * ca)
|
||||
{
|
||||
gst_mini_object_unref (ca);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_clear_d3d12_cmd_alloc:
|
||||
* @ca: a pointer to #GstD3D12CmdAlloc
|
||||
*
|
||||
* Clears a reference to a #GstD3D12CmdAlloc
|
||||
*
|
||||
* Since: 1.26
|
||||
*/
|
||||
void
|
||||
gst_clear_d3d12_cmd_alloc (GstD3D12CmdAlloc ** ca)
|
||||
{
|
||||
gst_clear_mini_object (ca);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_d3d12_cmd_alloc_get_handle:
|
||||
* @ca: a #GstD3D12CmdAlloc
|
||||
*
|
||||
* Gets ID3D12CommandAllocator handle.
|
||||
*
|
||||
* Returns: (transfer none): ID3D12CommandAllocator handle
|
||||
*
|
||||
* Since: 1.26
|
||||
*/
|
||||
ID3D12CommandAllocator *
|
||||
gst_d3d12_cmd_alloc_get_handle (GstD3D12CmdAlloc * ca)
|
||||
{
|
||||
g_return_val_if_fail (ca, nullptr);
|
||||
|
||||
return ca->ca.Get ();
|
||||
}
|
|
@ -0,0 +1,94 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) 2023 Seungha Yang <seungha@centricular.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <gst/gst.h>
|
||||
#include <gst/video/video.h>
|
||||
#include <gst/d3d12/gstd3d12_fwd.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_D3D12_CMD_ALLOC_POOL (gst_d3d12_cmd_alloc_pool_get_type ())
|
||||
#define GST_D3D12_CMD_ALLOC_POOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_D3D12_CMD_ALLOC_POOL, GstD3D12CmdAllocPool))
|
||||
#define GST_D3D12_CMD_ALLOC_POOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_D3D12_CMD_ALLOC_POOL, GstD3D12CmdAllocPoolClass))
|
||||
#define GST_IS_D3D12_CMD_ALLOC_POOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_D3D12_CMD_ALLOC_POOL))
|
||||
#define GST_IS_D3D12_CMD_ALLOC_POOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_D3D12_CMD_ALLOC_POOL))
|
||||
#define GST_D3D12_CMD_ALLOC_POOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_D3D12_CMD_ALLOC_POOL, GstD3D12CmdAllocPoolClass))
|
||||
#define GST_D3D12_CMD_ALLOC_POOL_CAST(obj) ((GstD3D12CmdAllocPool*)(obj))
|
||||
|
||||
/**
|
||||
* GstD3D12CmdAllocPool:
|
||||
*
|
||||
* Opaque GstD3D12CmdAllocPool struct
|
||||
*
|
||||
* Since: 1.26
|
||||
*/
|
||||
struct _GstD3D12CmdAllocPool
|
||||
{
|
||||
GstObject parent;
|
||||
|
||||
/*< private >*/
|
||||
GstD3D12CmdAllocPoolPrivate *priv;
|
||||
gpointer _gst_reserved[GST_PADDING];
|
||||
};
|
||||
|
||||
/**
|
||||
* GstD3D12CmdAllocPoolClass:
|
||||
*
|
||||
* Opaque GstD3D12CmdAllocPoolClass struct
|
||||
*
|
||||
* Since: 1.26
|
||||
*/
|
||||
struct _GstD3D12CmdAllocPoolClass
|
||||
{
|
||||
GstObjectClass parent_class;
|
||||
|
||||
/*< private >*/
|
||||
gpointer _gst_reserved[GST_PADDING];
|
||||
};
|
||||
|
||||
GST_D3D12_API
|
||||
GType gst_d3d12_cmd_alloc_pool_get_type (void);
|
||||
|
||||
GST_D3D12_API
|
||||
GType gst_d3d12_cmd_alloc_get_type (void);
|
||||
|
||||
GST_D3D12_API
|
||||
GstD3D12CmdAllocPool * gst_d3d12_cmd_alloc_pool_new (ID3D12Device * device,
|
||||
D3D12_COMMAND_LIST_TYPE type);
|
||||
|
||||
GST_D3D12_API
|
||||
gboolean gst_d3d12_cmd_alloc_pool_acquire (GstD3D12CmdAllocPool * pool,
|
||||
GstD3D12CmdAlloc ** ca);
|
||||
|
||||
GST_D3D12_API
|
||||
GstD3D12CmdAlloc * gst_d3d12_cmd_alloc_ref (GstD3D12CmdAlloc * ca);
|
||||
|
||||
GST_D3D12_API
|
||||
void gst_d3d12_cmd_alloc_unref (GstD3D12CmdAlloc * ca);
|
||||
|
||||
GST_D3D12_API
|
||||
void gst_clear_d3d12_cmd_alloc (GstD3D12CmdAlloc ** ca);
|
||||
|
||||
GST_D3D12_API
|
||||
ID3D12CommandAllocator * gst_d3d12_cmd_alloc_get_handle (GstD3D12CmdAlloc * ca);
|
||||
|
||||
G_END_DECLS
|
||||
|
|
@ -0,0 +1,256 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) 2023 Seungha Yang <seungha@centricular.com>
|
||||
*
|
||||
* This library is free software; you cln redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "gstd3d12.h"
|
||||
#include "gstd3d12cmdlistpool.h"
|
||||
#include <wrl.h>
|
||||
#include <queue>
|
||||
#include <mutex>
|
||||
|
||||
GST_DEBUG_CATEGORY_STATIC (gst_d3d12_cmd_list_pool_debug);
|
||||
#define GST_CAT_DEFAULT gst_d3d12_cmd_list_pool_debug
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
using namespace Microsoft::WRL;
|
||||
|
||||
struct _GstD3D12CmdList : public GstMiniObject
|
||||
{
|
||||
GstD3D12CmdListPool *pool = nullptr;
|
||||
D3D12_COMMAND_LIST_TYPE type;
|
||||
ComPtr < ID3D12CommandList > cl;
|
||||
};
|
||||
|
||||
struct GstD3D12CmdListPoolPrivate
|
||||
{
|
||||
~GstD3D12CmdListPoolPrivate ()
|
||||
{
|
||||
while (!cmd_pool.empty ()) {
|
||||
auto cmd = cmd_pool.front ();
|
||||
cmd_pool.pop ();
|
||||
gst_mini_object_unref (cmd);
|
||||
}
|
||||
}
|
||||
|
||||
ComPtr<ID3D12Device> device;
|
||||
|
||||
std::mutex lock;
|
||||
std::queue<GstD3D12CmdList *>cmd_pool;
|
||||
D3D12_COMMAND_LIST_TYPE cmd_type;
|
||||
};
|
||||
/* *INDENT-ON* */
|
||||
|
||||
struct _GstD3D12CmdListPool
|
||||
{
|
||||
GstObject parent;
|
||||
|
||||
GstD3D12CmdListPoolPrivate *priv;
|
||||
};
|
||||
|
||||
GST_DEFINE_MINI_OBJECT_TYPE (GstD3D12CmdList, gst_d3d12_cmd_list);
|
||||
|
||||
static void gst_d3d12_cmd_list_pool_finalize (GObject * object);
|
||||
|
||||
#define gst_d3d12_cmd_list_pool_parent_class parent_class
|
||||
G_DEFINE_TYPE (GstD3D12CmdListPool, gst_d3d12_cmd_list_pool, GST_TYPE_OBJECT);
|
||||
|
||||
static void
|
||||
gst_d3d12_cmd_list_pool_class_init (GstD3D12CmdListPoolClass * klass)
|
||||
{
|
||||
auto object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->finalize = gst_d3d12_cmd_list_pool_finalize;
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (gst_d3d12_cmd_list_pool_debug,
|
||||
"d3d12cmdlistpool", 0, "d3d12cmdlistpool");
|
||||
}
|
||||
|
||||
static void
|
||||
gst_d3d12_cmd_list_pool_init (GstD3D12CmdListPool * self)
|
||||
{
|
||||
self->priv = new GstD3D12CmdListPoolPrivate ();
|
||||
}
|
||||
|
||||
static void
|
||||
gst_d3d12_cmd_list_pool_finalize (GObject * object)
|
||||
{
|
||||
auto self = GST_D3D12_CMD_LIST_POOL (object);
|
||||
|
||||
delete self->priv;
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
GstD3D12CmdListPool *
|
||||
gst_d3d12_cmd_list_pool_new (ID3D12Device * device,
|
||||
D3D12_COMMAND_LIST_TYPE type)
|
||||
{
|
||||
g_return_val_if_fail (device, nullptr);
|
||||
|
||||
if (type != D3D12_COMMAND_LIST_TYPE_DIRECT &&
|
||||
type != D3D12_COMMAND_LIST_TYPE_COMPUTE &&
|
||||
type != D3D12_COMMAND_LIST_TYPE_COPY) {
|
||||
GST_ERROR ("Not supported command list type");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto self = (GstD3D12CmdListPool *)
|
||||
g_object_new (GST_TYPE_D3D12_CMD_LIST_POOL, nullptr);
|
||||
gst_object_ref_sink (self);
|
||||
|
||||
auto priv = self->priv;
|
||||
priv->device = device;
|
||||
priv->cmd_type = type;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_d3d12_cmd_list_pool_release (GstD3D12CmdListPool * pool,
|
||||
GstD3D12CmdList * cmd)
|
||||
{
|
||||
auto priv = pool->priv;
|
||||
{
|
||||
std::lock_guard < std::mutex > lk (priv->lock);
|
||||
cmd->dispose = nullptr;
|
||||
cmd->pool = nullptr;
|
||||
priv->cmd_pool.push (cmd);
|
||||
}
|
||||
|
||||
gst_object_unref (pool);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_d3d12_cmd_list_dispose (GstD3D12CmdList * cmd)
|
||||
{
|
||||
if (!cmd->pool)
|
||||
return TRUE;
|
||||
|
||||
gst_mini_object_ref (cmd);
|
||||
gst_d3d12_cmd_list_pool_release (cmd->pool, cmd);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_d3d12_cmd_list_free (GstD3D12CmdList * cmd)
|
||||
{
|
||||
delete cmd;
|
||||
}
|
||||
|
||||
static GstD3D12CmdList *
|
||||
gst_d3d12_cmd_list_new (ID3D12CommandList * cl, D3D12_COMMAND_LIST_TYPE type)
|
||||
{
|
||||
auto cmd = new GstD3D12CmdList ();
|
||||
cmd->cl = cl;
|
||||
cmd->type = type;
|
||||
|
||||
gst_mini_object_init (cmd, 0, gst_d3d12_cmd_list_get_type (),
|
||||
nullptr, nullptr, (GstMiniObjectFreeFunction) gst_d3d12_cmd_list_free);
|
||||
|
||||
return cmd;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_d3d12_cmd_list_pool_acquire (GstD3D12CmdListPool * pool,
|
||||
ID3D12CommandAllocator * ca, GstD3D12CmdList ** cl)
|
||||
{
|
||||
g_return_val_if_fail (GST_IS_D3D12_CMD_LIST_POOL (pool), FALSE);
|
||||
g_return_val_if_fail (ca, FALSE);
|
||||
g_return_val_if_fail (cl, FALSE);
|
||||
|
||||
*cl = nullptr;
|
||||
|
||||
auto priv = pool->priv;
|
||||
GstD3D12CmdList *new_cl = nullptr;
|
||||
HRESULT hr;
|
||||
|
||||
hr = ca->Reset ();
|
||||
if (FAILED (hr)) {
|
||||
GST_ERROR_OBJECT (pool, "Couldn't reset command allocator");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
{
|
||||
std::lock_guard < std::mutex > lk (priv->lock);
|
||||
if (!priv->cmd_pool.empty ()) {
|
||||
new_cl = priv->cmd_pool.front ();
|
||||
priv->cmd_pool.pop ();
|
||||
}
|
||||
}
|
||||
|
||||
ComPtr < ID3D12GraphicsCommandList > handle;
|
||||
if (!new_cl) {
|
||||
hr = priv->device->CreateCommandList (0, priv->cmd_type,
|
||||
ca, nullptr, IID_PPV_ARGS (&handle));
|
||||
if (FAILED (hr)) {
|
||||
GST_ERROR_OBJECT (pool, "Couldn't create command list, hr: 0x%x",
|
||||
(guint) hr);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
new_cl = gst_d3d12_cmd_list_new (handle.Get (), priv->cmd_type);
|
||||
if (GST_OBJECT_FLAG_IS_SET (pool, GST_OBJECT_FLAG_MAY_BE_LEAKED))
|
||||
GST_MINI_OBJECT_FLAG_SET (new_cl, GST_MINI_OBJECT_FLAG_MAY_BE_LEAKED);
|
||||
} else {
|
||||
new_cl->cl->QueryInterface (IID_PPV_ARGS (&handle));
|
||||
hr = handle->Reset (ca, nullptr);
|
||||
if (FAILED (hr)) {
|
||||
GST_ERROR_OBJECT (pool, "Couldn't reset command list");
|
||||
gst_mini_object_unref (new_cl);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
new_cl->pool = (GstD3D12CmdListPool *) gst_object_ref (pool);
|
||||
new_cl->dispose = (GstMiniObjectDisposeFunction) gst_d3d12_cmd_list_dispose;
|
||||
|
||||
*cl = new_cl;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
GstD3D12CmdList *
|
||||
gst_d3d12_cmd_list_ref (GstD3D12CmdList * cl)
|
||||
{
|
||||
return (GstD3D12CmdList *) gst_mini_object_ref (cl);
|
||||
}
|
||||
|
||||
void
|
||||
gst_d3d12_cmd_list_unref (GstD3D12CmdList * cl)
|
||||
{
|
||||
gst_mini_object_unref (cl);
|
||||
}
|
||||
|
||||
void
|
||||
gst_clear_d3d12_cmd_list (GstD3D12CmdList ** cl)
|
||||
{
|
||||
gst_clear_mini_object (cl);
|
||||
}
|
||||
|
||||
ID3D12CommandList *
|
||||
gst_d3d12_cmd_list_get_handle (GstD3D12CmdList * cl)
|
||||
{
|
||||
g_return_val_if_fail (cl, nullptr);
|
||||
|
||||
return cl->cl.Get ();
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) 2023 Seungha Yang <seungha@centricular.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <gst/gst.h>
|
||||
#include <gst/video/video.h>
|
||||
#include <gst/d3d12/gstd3d12_fwd.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_D3D12_CMD_LIST_POOL (gst_d3d12_cmd_list_pool_get_type())
|
||||
G_DECLARE_FINAL_TYPE (GstD3D12CmdListPool,
|
||||
gst_d3d12_cmd_list_pool, GST, D3D12_CMD_LIST_POOL, GstObject);
|
||||
|
||||
typedef struct _GstD3D12CmdList GstD3D12CmdList;
|
||||
|
||||
GType gst_d3d12_cmd_list_get_type (void);
|
||||
|
||||
GstD3D12CmdListPool * gst_d3d12_cmd_list_pool_new (ID3D12Device * device,
|
||||
D3D12_COMMAND_LIST_TYPE type);
|
||||
|
||||
gboolean gst_d3d12_cmd_list_pool_acquire (GstD3D12CmdListPool * pool,
|
||||
ID3D12CommandAllocator * ca,
|
||||
GstD3D12CmdList ** cl);
|
||||
|
||||
GstD3D12CmdList * gst_d3d12_cmd_list_ref (GstD3D12CmdList * cl);
|
||||
|
||||
void gst_d3d12_cmd_list_unref (GstD3D12CmdList * cl);
|
||||
|
||||
void gst_clear_d3d12_cmd_list (GstD3D12CmdList ** cl);
|
||||
|
||||
ID3D12CommandList * gst_d3d12_cmd_list_get_handle (GstD3D12CmdList * cl);
|
||||
|
||||
G_END_DECLS
|
||||
|
|
@ -25,7 +25,7 @@
|
|||
G_BEGIN_DECLS
|
||||
|
||||
GST_D3D12_API
|
||||
HRESULT gst_d3d12_command_queue_idle_for_swapchain (GstD3D12CommandQueue * queue,
|
||||
guint64 fence_value);
|
||||
HRESULT gst_d3d12_cmd_queue_idle_for_swapchain (GstD3D12CmdQueue * queue,
|
||||
guint64 fence_value);
|
||||
|
||||
G_END_DECLS
|
|
@ -29,8 +29,8 @@
|
|||
#include <memory>
|
||||
#include <condition_variable>
|
||||
|
||||
GST_DEBUG_CATEGORY_STATIC (gst_d3d12_command_queue_debug);
|
||||
#define GST_CAT_DEFAULT gst_d3d12_command_queue_debug
|
||||
GST_DEBUG_CATEGORY_STATIC (gst_d3d12_cmd_queue_debug);
|
||||
#define GST_CAT_DEFAULT gst_d3d12_cmd_queue_debug
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
using namespace Microsoft::WRL;
|
||||
|
@ -60,9 +60,9 @@ struct gc_cmp {
|
|||
}
|
||||
};
|
||||
|
||||
struct _GstD3D12CommandQueuePrivate
|
||||
struct _GstD3D12CmdQueuePrivate
|
||||
{
|
||||
~_GstD3D12CommandQueuePrivate ()
|
||||
~_GstD3D12CmdQueuePrivate ()
|
||||
{
|
||||
{
|
||||
std::lock_guard <std::mutex> lk (lock);
|
||||
|
@ -95,29 +95,29 @@ struct _GstD3D12CommandQueuePrivate
|
|||
};
|
||||
/* *INDENT-ON* */
|
||||
|
||||
static void gst_d3d12_command_queue_finalize (GObject * object);
|
||||
static void gst_d3d12_cmd_queue_finalize (GObject * object);
|
||||
|
||||
#define gst_d3d12_command_queue_parent_class parent_class
|
||||
G_DEFINE_TYPE (GstD3D12CommandQueue, gst_d3d12_command_queue, GST_TYPE_OBJECT);
|
||||
#define gst_d3d12_cmd_queue_parent_class parent_class
|
||||
G_DEFINE_TYPE (GstD3D12CmdQueue, gst_d3d12_cmd_queue, GST_TYPE_OBJECT);
|
||||
|
||||
static void
|
||||
gst_d3d12_command_queue_class_init (GstD3D12CommandQueueClass * klass)
|
||||
gst_d3d12_cmd_queue_class_init (GstD3D12CmdQueueClass * klass)
|
||||
{
|
||||
auto object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->finalize = gst_d3d12_command_queue_finalize;
|
||||
object_class->finalize = gst_d3d12_cmd_queue_finalize;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_d3d12_command_queue_init (GstD3D12CommandQueue * self)
|
||||
gst_d3d12_cmd_queue_init (GstD3D12CmdQueue * self)
|
||||
{
|
||||
self->priv = new GstD3D12CommandQueuePrivate ();
|
||||
self->priv = new GstD3D12CmdQueuePrivate ();
|
||||
}
|
||||
|
||||
static void
|
||||
gst_d3d12_command_queue_finalize (GObject * object)
|
||||
gst_d3d12_cmd_queue_finalize (GObject * object)
|
||||
{
|
||||
auto self = GST_D3D12_COMMAND_QUEUE (object);
|
||||
auto self = GST_D3D12_CMD_QUEUE (object);
|
||||
|
||||
delete self->priv;
|
||||
|
||||
|
@ -125,20 +125,20 @@ gst_d3d12_command_queue_finalize (GObject * object)
|
|||
}
|
||||
|
||||
/**
|
||||
* gst_d3d12_command_queue_new:
|
||||
* gst_d3d12_cmd_queue_new:
|
||||
* @device: a #GstD3D12Device
|
||||
* @desc: a D3D12_COMMAND_QUEUE_DESC
|
||||
* @fence_flags: a D3D12_FENCE_FLAGS
|
||||
* @queue_size: command queue size, Sets zero for unlimited queue size
|
||||
*
|
||||
* Creates GstD3D12CommandQueue with given parameters.
|
||||
* Creates GstD3D12CmdQueue with given parameters.
|
||||
*
|
||||
* Returns: (transfer full): a new #GstD3D12CommandQueue instance
|
||||
* Returns: (transfer full): a new #GstD3D12CmdQueue instance
|
||||
*
|
||||
* Since: 1.26
|
||||
*/
|
||||
GstD3D12CommandQueue *
|
||||
gst_d3d12_command_queue_new (ID3D12Device * device,
|
||||
GstD3D12CmdQueue *
|
||||
gst_d3d12_cmd_queue_new (ID3D12Device * device,
|
||||
const D3D12_COMMAND_QUEUE_DESC * desc, D3D12_FENCE_FLAGS fence_flags,
|
||||
guint queue_size)
|
||||
{
|
||||
|
@ -146,7 +146,7 @@ gst_d3d12_command_queue_new (ID3D12Device * device,
|
|||
g_return_val_if_fail (desc, nullptr);
|
||||
|
||||
GST_D3D12_CALL_ONCE_BEGIN {
|
||||
GST_DEBUG_CATEGORY_INIT (gst_d3d12_command_queue_debug,
|
||||
GST_DEBUG_CATEGORY_INIT (gst_d3d12_cmd_queue_debug,
|
||||
"d3d12commandqueue", 0, "d3d12commandqueue");
|
||||
} GST_D3D12_CALL_ONCE_END;
|
||||
|
||||
|
@ -164,8 +164,8 @@ gst_d3d12_command_queue_new (ID3D12Device * device,
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
auto self = (GstD3D12CommandQueue *)
|
||||
g_object_new (GST_TYPE_D3D12_COMMAND_QUEUE, nullptr);
|
||||
auto self = (GstD3D12CmdQueue *)
|
||||
g_object_new (GST_TYPE_D3D12_CMD_QUEUE, nullptr);
|
||||
gst_object_ref_sink (self);
|
||||
|
||||
auto priv = self->priv;
|
||||
|
@ -178,8 +178,8 @@ gst_d3d12_command_queue_new (ID3D12Device * device,
|
|||
}
|
||||
|
||||
/**
|
||||
* gst_d3d12_command_queue_get_handle:
|
||||
* @queue: a #GstD3D12CommandQueue
|
||||
* gst_d3d12_cmd_queue_get_handle:
|
||||
* @queue: a #GstD3D12CmdQueue
|
||||
*
|
||||
* Gets command queue handle
|
||||
*
|
||||
|
@ -188,16 +188,16 @@ gst_d3d12_command_queue_new (ID3D12Device * device,
|
|||
* Since: 1.26
|
||||
*/
|
||||
ID3D12CommandQueue *
|
||||
gst_d3d12_command_queue_get_handle (GstD3D12CommandQueue * queue)
|
||||
gst_d3d12_cmd_queue_get_handle (GstD3D12CmdQueue * queue)
|
||||
{
|
||||
g_return_val_if_fail (GST_IS_D3D12_COMMAND_QUEUE (queue), nullptr);
|
||||
g_return_val_if_fail (GST_IS_D3D12_CMD_QUEUE (queue), nullptr);
|
||||
|
||||
return queue->priv->cq.Get ();
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_d3d12_command_queue_get_fence_handle:
|
||||
* @queue: a #GstD3D12CommandQueue
|
||||
* gst_d3d12_cmd_queue_get_fence_handle:
|
||||
* @queue: a #GstD3D12CmdQueue
|
||||
*
|
||||
* Gets fence handle handle
|
||||
*
|
||||
|
@ -206,15 +206,15 @@ gst_d3d12_command_queue_get_handle (GstD3D12CommandQueue * queue)
|
|||
* Since: 1.26
|
||||
*/
|
||||
ID3D12Fence *
|
||||
gst_d3d12_command_queue_get_fence_handle (GstD3D12CommandQueue * queue)
|
||||
gst_d3d12_cmd_queue_get_fence_handle (GstD3D12CmdQueue * queue)
|
||||
{
|
||||
g_return_val_if_fail (GST_IS_D3D12_COMMAND_QUEUE (queue), nullptr);
|
||||
g_return_val_if_fail (GST_IS_D3D12_CMD_QUEUE (queue), nullptr);
|
||||
|
||||
return queue->priv->fence.Get ();
|
||||
}
|
||||
|
||||
static HRESULT
|
||||
gst_d3d12_command_queue_execute_command_lists_unlocked (GstD3D12CommandQueue *
|
||||
gst_d3d12_cmd_queue_execute_command_lists_unlocked (GstD3D12CmdQueue *
|
||||
queue, guint num_command_lists, ID3D12CommandList ** command_lists,
|
||||
guint64 * fence_value)
|
||||
{
|
||||
|
@ -254,8 +254,8 @@ gst_d3d12_command_queue_execute_command_lists_unlocked (GstD3D12CommandQueue *
|
|||
}
|
||||
|
||||
/**
|
||||
* gst_d3d12_command_queue_execute_command_lists:
|
||||
* @queue: a #GstD3D12CommandQueue
|
||||
* gst_d3d12_cmd_queue_execute_command_lists:
|
||||
* @queue: a #GstD3D12CmdQueue
|
||||
* @num_command_lists: command list size
|
||||
* @command_lists: (allow-none): array of ID3D12CommandList
|
||||
* @fence_value: (out) (optional): fence value of submitted command
|
||||
|
@ -268,22 +268,22 @@ gst_d3d12_command_queue_execute_command_lists_unlocked (GstD3D12CommandQueue *
|
|||
* Since: 1.26
|
||||
*/
|
||||
HRESULT
|
||||
gst_d3d12_command_queue_execute_command_lists (GstD3D12CommandQueue * queue,
|
||||
gst_d3d12_cmd_queue_execute_command_lists (GstD3D12CmdQueue * queue,
|
||||
guint num_command_lists, ID3D12CommandList ** command_lists,
|
||||
guint64 * fence_value)
|
||||
{
|
||||
g_return_val_if_fail (GST_IS_D3D12_COMMAND_QUEUE (queue), E_INVALIDARG);
|
||||
g_return_val_if_fail (GST_IS_D3D12_CMD_QUEUE (queue), E_INVALIDARG);
|
||||
|
||||
auto priv = queue->priv;
|
||||
|
||||
std::lock_guard < std::mutex > lk (priv->execute_lock);
|
||||
return gst_d3d12_command_queue_execute_command_lists_unlocked (queue,
|
||||
return gst_d3d12_cmd_queue_execute_command_lists_unlocked (queue,
|
||||
num_command_lists, command_lists, fence_value);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_d3d12_command_queue_execute_command_lists_full:
|
||||
* @queue: a #GstD3D12CommandQueue
|
||||
* gst_d3d12_cmd_queue_execute_command_lists_full:
|
||||
* @queue: a #GstD3D12CmdQueue
|
||||
* @num_fences_to_wait: the number of fences to wait
|
||||
* @fences_to_wait: (allow-none): array of ID3D11Fence
|
||||
* @fence_values_to_wait: (allow-none): array of fence value to wait
|
||||
|
@ -298,12 +298,12 @@ gst_d3d12_command_queue_execute_command_lists (GstD3D12CommandQueue * queue,
|
|||
* Since: 1.26
|
||||
*/
|
||||
HRESULT
|
||||
gst_d3d12_command_queue_execute_command_lists_full (GstD3D12CommandQueue *
|
||||
gst_d3d12_cmd_queue_execute_command_lists_full (GstD3D12CmdQueue *
|
||||
queue, guint num_fences_to_wait, ID3D12Fence ** fences_to_wait,
|
||||
const guint64 * fence_values_to_wait, guint num_command_lists,
|
||||
ID3D12CommandList ** command_lists, guint64 * fence_value)
|
||||
{
|
||||
g_return_val_if_fail (GST_IS_D3D12_COMMAND_QUEUE (queue), E_INVALIDARG);
|
||||
g_return_val_if_fail (GST_IS_D3D12_CMD_QUEUE (queue), E_INVALIDARG);
|
||||
g_return_val_if_fail (num_fences_to_wait == 0 ||
|
||||
(fences_to_wait && fence_values_to_wait), E_INVALIDARG);
|
||||
|
||||
|
@ -320,13 +320,13 @@ gst_d3d12_command_queue_execute_command_lists_full (GstD3D12CommandQueue *
|
|||
}
|
||||
}
|
||||
|
||||
return gst_d3d12_command_queue_execute_command_lists_unlocked (queue,
|
||||
return gst_d3d12_cmd_queue_execute_command_lists_unlocked (queue,
|
||||
num_command_lists, command_lists, fence_value);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_d3d12_command_queue_execute_wait:
|
||||
* @queue: a #GstD3D12CommandQueue
|
||||
* gst_d3d12_cmd_queue_execute_wait:
|
||||
* @queue: a #GstD3D12CmdQueue
|
||||
* @fence: a ID3D12Fence
|
||||
* @fence_value: fence value to wait
|
||||
*
|
||||
|
@ -337,10 +337,10 @@ gst_d3d12_command_queue_execute_command_lists_full (GstD3D12CommandQueue *
|
|||
* Since: 1.26
|
||||
*/
|
||||
HRESULT
|
||||
gst_d3d12_command_queue_execute_wait (GstD3D12CommandQueue * queue,
|
||||
gst_d3d12_cmd_queue_execute_wait (GstD3D12CmdQueue * queue,
|
||||
ID3D12Fence * fence, guint64 fence_value)
|
||||
{
|
||||
g_return_val_if_fail (GST_IS_D3D12_COMMAND_QUEUE (queue), E_INVALIDARG);
|
||||
g_return_val_if_fail (GST_IS_D3D12_CMD_QUEUE (queue), E_INVALIDARG);
|
||||
g_return_val_if_fail (fence, E_INVALIDARG);
|
||||
|
||||
auto priv = queue->priv;
|
||||
|
@ -349,8 +349,8 @@ gst_d3d12_command_queue_execute_wait (GstD3D12CommandQueue * queue,
|
|||
}
|
||||
|
||||
/**
|
||||
* gst_d3d12_command_queue_get_completed_value:
|
||||
* @queue: a #GstD3D12CommandQueue
|
||||
* gst_d3d12_cmd_queue_get_completed_value:
|
||||
* @queue: a #GstD3D12CmdQueue
|
||||
*
|
||||
* Gets completed fence value
|
||||
*
|
||||
|
@ -359,16 +359,16 @@ gst_d3d12_command_queue_execute_wait (GstD3D12CommandQueue * queue,
|
|||
* Since: 1.26
|
||||
*/
|
||||
guint64
|
||||
gst_d3d12_command_queue_get_completed_value (GstD3D12CommandQueue * queue)
|
||||
gst_d3d12_cmd_queue_get_completed_value (GstD3D12CmdQueue * queue)
|
||||
{
|
||||
g_return_val_if_fail (GST_IS_D3D12_COMMAND_QUEUE (queue), G_MAXUINT64);
|
||||
g_return_val_if_fail (GST_IS_D3D12_CMD_QUEUE (queue), G_MAXUINT64);
|
||||
|
||||
return queue->priv->fence->GetCompletedValue ();
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_d3d12_command_queue_fence_wait:
|
||||
* @queue: a #GstD3D12CommandQueue
|
||||
* gst_d3d12_cmd_queue_fence_wait:
|
||||
* @queue: a #GstD3D12CmdQueue
|
||||
* @fence_value: fence value to wait
|
||||
*
|
||||
* Blocks calling CPU thread until command corresponding @fence_value
|
||||
|
@ -380,10 +380,9 @@ gst_d3d12_command_queue_get_completed_value (GstD3D12CommandQueue * queue)
|
|||
* Since: 1.26
|
||||
*/
|
||||
HRESULT
|
||||
gst_d3d12_command_queue_fence_wait (GstD3D12CommandQueue * queue,
|
||||
guint64 fence_value)
|
||||
gst_d3d12_cmd_queue_fence_wait (GstD3D12CmdQueue * queue, guint64 fence_value)
|
||||
{
|
||||
g_return_val_if_fail (GST_IS_D3D12_COMMAND_QUEUE (queue), E_INVALIDARG);
|
||||
g_return_val_if_fail (GST_IS_D3D12_CMD_QUEUE (queue), E_INVALIDARG);
|
||||
|
||||
auto priv = queue->priv;
|
||||
guint64 fence_to_wait = fence_value;
|
||||
|
@ -414,7 +413,7 @@ gst_d3d12_command_queue_fence_wait (GstD3D12CommandQueue * queue,
|
|||
}
|
||||
|
||||
static gpointer
|
||||
gst_d3d12_command_queue_gc_thread (GstD3D12CommandQueue * self)
|
||||
gst_d3d12_cmd_queue_gc_thread (GstD3D12CmdQueue * self)
|
||||
{
|
||||
auto priv = self->priv;
|
||||
|
||||
|
@ -467,8 +466,8 @@ gst_d3d12_command_queue_gc_thread (GstD3D12CommandQueue * self)
|
|||
}
|
||||
|
||||
/**
|
||||
* gst_d3d12_command_queue_set_notify:
|
||||
* @queue: a #GstD3D12CommandQueue
|
||||
* gst_d3d12_cmd_queue_set_notify:
|
||||
* @queue: a #GstD3D12CmdQueue
|
||||
* @fence_value: target fence value
|
||||
* @fence_data: user data
|
||||
* @notify: a #GDestroyNotify
|
||||
|
@ -481,16 +480,16 @@ gst_d3d12_command_queue_gc_thread (GstD3D12CommandQueue * self)
|
|||
* the storage with destructor, in order to keep resources alive during
|
||||
* command execution.
|
||||
*
|
||||
* GstD3D12CommandQueue launches internal worker thread to monitor fence value
|
||||
* GstD3D12CmdQueue launches internal worker thread to monitor fence value
|
||||
* and once it reaches the scheduled value, @notify will be called with @fence_data
|
||||
*
|
||||
* Since: 1.26
|
||||
*/
|
||||
void
|
||||
gst_d3d12_command_queue_set_notify (GstD3D12CommandQueue * queue,
|
||||
gst_d3d12_cmd_queue_set_notify (GstD3D12CmdQueue * queue,
|
||||
guint64 fence_value, gpointer fence_data, GDestroyNotify notify)
|
||||
{
|
||||
g_return_if_fail (GST_IS_D3D12_COMMAND_QUEUE (queue));
|
||||
g_return_if_fail (GST_IS_D3D12_CMD_QUEUE (queue));
|
||||
|
||||
auto priv = queue->priv;
|
||||
|
||||
|
@ -498,7 +497,7 @@ gst_d3d12_command_queue_set_notify (GstD3D12CommandQueue * queue,
|
|||
auto gc_data = std::make_shared < GCData > (fence_data, notify, fence_value);
|
||||
if (!priv->gc_thread) {
|
||||
priv->gc_thread = g_thread_new ("GstD3D12Gc",
|
||||
(GThreadFunc) gst_d3d12_command_queue_gc_thread, queue);
|
||||
(GThreadFunc) gst_d3d12_cmd_queue_gc_thread, queue);
|
||||
}
|
||||
|
||||
GST_LOG_OBJECT (queue, "Pushing GC data %" G_GUINT64_FORMAT, fence_value);
|
||||
|
@ -509,8 +508,8 @@ gst_d3d12_command_queue_set_notify (GstD3D12CommandQueue * queue,
|
|||
}
|
||||
|
||||
/**
|
||||
* gst_d3d12_command_queue_drain:
|
||||
* @queue: a #GstD3D12CommandQueue
|
||||
* gst_d3d12_cmd_queue_drain:
|
||||
* @queue: a #GstD3D12CmdQueue
|
||||
*
|
||||
* Waits for all scheduled GPU commands to be finished
|
||||
*
|
||||
|
@ -519,9 +518,9 @@ gst_d3d12_command_queue_set_notify (GstD3D12CommandQueue * queue,
|
|||
* Since: 1.26
|
||||
*/
|
||||
HRESULT
|
||||
gst_d3d12_command_queue_drain (GstD3D12CommandQueue * queue)
|
||||
gst_d3d12_cmd_queue_drain (GstD3D12CmdQueue * queue)
|
||||
{
|
||||
g_return_val_if_fail (GST_IS_D3D12_COMMAND_QUEUE (queue), E_INVALIDARG);
|
||||
g_return_val_if_fail (GST_IS_D3D12_CMD_QUEUE (queue), E_INVALIDARG);
|
||||
|
||||
auto priv = queue->priv;
|
||||
|
||||
|
@ -561,10 +560,10 @@ gst_d3d12_command_queue_drain (GstD3D12CommandQueue * queue)
|
|||
}
|
||||
|
||||
HRESULT
|
||||
gst_d3d12_command_queue_idle_for_swapchain (GstD3D12CommandQueue * queue,
|
||||
gst_d3d12_cmd_queue_idle_for_swapchain (GstD3D12CmdQueue * queue,
|
||||
guint64 fence_value)
|
||||
{
|
||||
g_return_val_if_fail (GST_IS_D3D12_COMMAND_QUEUE (queue), E_INVALIDARG);
|
||||
g_return_val_if_fail (GST_IS_D3D12_CMD_QUEUE (queue), E_INVALIDARG);
|
||||
|
||||
auto priv = queue->priv;
|
||||
guint64 fence_to_wait = fence_value;
|
|
@ -0,0 +1,118 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) 2023 Seungha Yang <seungha@centricular.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <gst/gst.h>
|
||||
#include <gst/video/video.h>
|
||||
#include <gst/d3d12/gstd3d12_fwd.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_D3D12_CMD_QUEUE (gst_d3d12_cmd_queue_get_type ())
|
||||
#define GST_D3D12_CMD_QUEUE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_D3D12_CMD_QUEUE, GstD3D12CmdQueue))
|
||||
#define GST_D3D12_CMD_QUEUE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_D3D12_CMD_QUEUE, GstD3D12CmdQueueClass))
|
||||
#define GST_IS_D3D12_CMD_QUEUE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_D3D12_CMD_QUEUE))
|
||||
#define GST_IS_D3D12_CMD_QUEUE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_D3D12_CMD_QUEUE))
|
||||
#define GST_D3D12_CMD_QUEUE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_D3D12_CMD_QUEUE, GstD3D12CmdQueueClass))
|
||||
#define GST_D3D12_CMD_QUEUE_CAST(obj) ((GstD3D12CmdQueue*)(obj))
|
||||
|
||||
/**
|
||||
* GstD3D12CmdQueue:
|
||||
*
|
||||
* Opaque GstD3D12CmdQueue struct
|
||||
*
|
||||
* Since: 1.26
|
||||
*/
|
||||
struct _GstD3D12CmdQueue
|
||||
{
|
||||
GstObject parent;
|
||||
|
||||
/*< private >*/
|
||||
GstD3D12CmdQueuePrivate *priv;
|
||||
gpointer _gst_reserved[GST_PADDING];
|
||||
};
|
||||
|
||||
/**
|
||||
* GstD3D12CmdQueueClass:
|
||||
*
|
||||
* Opaque GstD3D12CmdQueueClass struct
|
||||
*
|
||||
* Since: 1.26
|
||||
*/
|
||||
struct _GstD3D12CmdQueueClass
|
||||
{
|
||||
GstObjectClass parent_class;
|
||||
|
||||
/*< private >*/
|
||||
gpointer _gst_reserved[GST_PADDING];
|
||||
};
|
||||
|
||||
GST_D3D12_API
|
||||
GType gst_d3d12_cmd_queue_get_type (void);
|
||||
|
||||
GST_D3D12_API
|
||||
GstD3D12CmdQueue * gst_d3d12_cmd_queue_new (ID3D12Device * device,
|
||||
const D3D12_COMMAND_QUEUE_DESC * desc,
|
||||
D3D12_FENCE_FLAGS fence_flags,
|
||||
guint queue_size);
|
||||
|
||||
GST_D3D12_API
|
||||
ID3D12CommandQueue * gst_d3d12_cmd_queue_get_handle (GstD3D12CmdQueue * queue);
|
||||
|
||||
GST_D3D12_API
|
||||
ID3D12Fence * gst_d3d12_cmd_queue_get_fence_handle (GstD3D12CmdQueue * queue);
|
||||
|
||||
GST_D3D12_API
|
||||
HRESULT gst_d3d12_cmd_queue_execute_command_lists (GstD3D12CmdQueue * queue,
|
||||
guint num_command_lists,
|
||||
ID3D12CommandList ** command_lists,
|
||||
guint64 * fence_value);
|
||||
|
||||
GST_D3D12_API
|
||||
HRESULT gst_d3d12_cmd_queue_execute_command_lists_full (GstD3D12CmdQueue * queue,
|
||||
guint num_fences_to_wait,
|
||||
ID3D12Fence ** fences_to_wait,
|
||||
const guint64 * fence_values_to_wait,
|
||||
guint num_command_lists,
|
||||
ID3D12CommandList ** command_lists,
|
||||
guint64 * fence_value);
|
||||
|
||||
GST_D3D12_API
|
||||
HRESULT gst_d3d12_cmd_queue_execute_wait (GstD3D12CmdQueue * queue,
|
||||
ID3D12Fence * fence,
|
||||
guint64 fence_value);
|
||||
|
||||
GST_D3D12_API
|
||||
guint64 gst_d3d12_cmd_queue_get_completed_value (GstD3D12CmdQueue * queue);
|
||||
|
||||
GST_D3D12_API
|
||||
HRESULT gst_d3d12_cmd_queue_fence_wait (GstD3D12CmdQueue * queue,
|
||||
guint64 fence_value);
|
||||
|
||||
GST_D3D12_API
|
||||
void gst_d3d12_cmd_queue_set_notify (GstD3D12CmdQueue * queue,
|
||||
guint64 fence_value,
|
||||
gpointer fence_data,
|
||||
GDestroyNotify notify);
|
||||
|
||||
GST_D3D12_API
|
||||
HRESULT gst_d3d12_cmd_queue_drain (GstD3D12CmdQueue * queue);
|
||||
|
||||
G_END_DECLS
|
|
@ -1,288 +0,0 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) 2023 Seungha Yang <seungha@centricular.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "gstd3d12.h"
|
||||
#include <wrl.h>
|
||||
#include <queue>
|
||||
#include <mutex>
|
||||
|
||||
GST_DEBUG_CATEGORY_STATIC (gst_d3d12_command_allocator_pool_debug);
|
||||
#define GST_CAT_DEFAULT gst_d3d12_command_allocator_pool_debug
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
using namespace Microsoft::WRL;
|
||||
|
||||
struct _GstD3D12CommandAllocator : public GstMiniObject
|
||||
{
|
||||
GstD3D12CommandAllocatorPool *pool = nullptr;
|
||||
D3D12_COMMAND_LIST_TYPE type;
|
||||
ComPtr < ID3D12CommandAllocator > ca;
|
||||
};
|
||||
|
||||
struct _GstD3D12CommandAllocatorPoolPrivate
|
||||
{
|
||||
~_GstD3D12CommandAllocatorPoolPrivate ()
|
||||
{
|
||||
while (!cmd_pool.empty ()) {
|
||||
auto cmd = cmd_pool.front ();
|
||||
cmd_pool.pop ();
|
||||
gst_mini_object_unref (cmd);
|
||||
}
|
||||
}
|
||||
|
||||
ComPtr<ID3D12Device> device;
|
||||
|
||||
std::mutex lock;
|
||||
std::queue<GstD3D12CommandAllocator *>cmd_pool;
|
||||
D3D12_COMMAND_LIST_TYPE cmd_type;
|
||||
};
|
||||
/* *INDENT-ON* */
|
||||
|
||||
GST_DEFINE_MINI_OBJECT_TYPE (GstD3D12CommandAllocator,
|
||||
gst_d3d12_command_allocator);
|
||||
|
||||
static void gst_d3d12_command_allocator_pool_finalize (GObject * object);
|
||||
|
||||
#define gst_d3d12_command_allocator_pool_parent_class parent_class
|
||||
G_DEFINE_TYPE (GstD3D12CommandAllocatorPool,
|
||||
gst_d3d12_command_allocator_pool, GST_TYPE_OBJECT);
|
||||
|
||||
static void
|
||||
gst_d3d12_command_allocator_pool_class_init (GstD3D12CommandAllocatorPoolClass *
|
||||
klass)
|
||||
{
|
||||
auto object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->finalize = gst_d3d12_command_allocator_pool_finalize;
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (gst_d3d12_command_allocator_pool_debug,
|
||||
"d3d12commandallocatorpool", 0, "d3d12commandallocatorpool");
|
||||
}
|
||||
|
||||
static void
|
||||
gst_d3d12_command_allocator_pool_init (GstD3D12CommandAllocatorPool * self)
|
||||
{
|
||||
self->priv = new GstD3D12CommandAllocatorPoolPrivate ();
|
||||
}
|
||||
|
||||
static void
|
||||
gst_d3d12_command_allocator_pool_finalize (GObject * object)
|
||||
{
|
||||
auto self = GST_D3D12_COMMAND_ALLOCATOR_POOL (object);
|
||||
|
||||
delete self->priv;
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_d3d12_command_allocator_pool_new:
|
||||
* @device: a #GstD3D12Device
|
||||
* @type: D3D12_COMMAND_LIST_TYPE
|
||||
*
|
||||
* Returns: (transfer full): a new #GstD3D12CommandAllocatorPool instance
|
||||
*
|
||||
* Since: 1.26
|
||||
*/
|
||||
GstD3D12CommandAllocatorPool *
|
||||
gst_d3d12_command_allocator_pool_new (ID3D12Device * device,
|
||||
D3D12_COMMAND_LIST_TYPE type)
|
||||
{
|
||||
g_return_val_if_fail (device, nullptr);
|
||||
|
||||
auto self = (GstD3D12CommandAllocatorPool *)
|
||||
g_object_new (GST_TYPE_D3D12_COMMAND_ALLOCATOR_POOL, nullptr);
|
||||
gst_object_ref_sink (self);
|
||||
|
||||
auto priv = self->priv;
|
||||
priv->device = device;
|
||||
priv->cmd_type = type;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_d3d12_command_allocator_pool_release (GstD3D12CommandAllocatorPool * pool,
|
||||
GstD3D12CommandAllocator * cmd)
|
||||
{
|
||||
auto priv = pool->priv;
|
||||
{
|
||||
std::lock_guard < std::mutex > lk (priv->lock);
|
||||
cmd->dispose = nullptr;
|
||||
cmd->pool = nullptr;
|
||||
priv->cmd_pool.push (cmd);
|
||||
}
|
||||
|
||||
gst_object_unref (pool);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_d3d12_command_allocator_dispose (GstD3D12CommandAllocator * cmd)
|
||||
{
|
||||
if (!cmd->pool)
|
||||
return TRUE;
|
||||
|
||||
gst_mini_object_ref (cmd);
|
||||
gst_d3d12_command_allocator_pool_release (cmd->pool, cmd);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_d3d12_command_allocator_free (GstD3D12CommandAllocator * cmd)
|
||||
{
|
||||
delete cmd;
|
||||
}
|
||||
|
||||
static GstD3D12CommandAllocator *
|
||||
gst_d3d12_command_allocator_new (ID3D12CommandAllocator * ca,
|
||||
D3D12_COMMAND_LIST_TYPE type)
|
||||
{
|
||||
auto cmd = new GstD3D12CommandAllocator ();
|
||||
cmd->ca = ca;
|
||||
cmd->type = type;
|
||||
|
||||
gst_mini_object_init (cmd, 0, gst_d3d12_command_allocator_get_type (),
|
||||
nullptr, nullptr,
|
||||
(GstMiniObjectFreeFunction) gst_d3d12_command_allocator_free);
|
||||
|
||||
return cmd;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_d3d12_command_allocator_pool_acquire:
|
||||
* @pool: a #GstD3D12CommandAllocatorPool
|
||||
* @cmd: (out) (transfer full): a pointer to #GstD3D12CommandAllocator
|
||||
*
|
||||
* Acquire #GstD3D12CommandAllocator object
|
||||
*
|
||||
* Returns: %TRUE if successful
|
||||
*
|
||||
* Since: 1.26
|
||||
*/
|
||||
gboolean
|
||||
gst_d3d12_command_allocator_pool_acquire (GstD3D12CommandAllocatorPool * pool,
|
||||
GstD3D12CommandAllocator ** cmd)
|
||||
{
|
||||
g_return_val_if_fail (GST_IS_D3D12_COMMAND_ALLOCATOR_POOL (pool), FALSE);
|
||||
g_return_val_if_fail (cmd, FALSE);
|
||||
|
||||
*cmd = nullptr;
|
||||
|
||||
auto priv = pool->priv;
|
||||
GstD3D12CommandAllocator *new_cmd = nullptr;
|
||||
HRESULT hr;
|
||||
|
||||
{
|
||||
std::lock_guard < std::mutex > lk (priv->lock);
|
||||
if (!priv->cmd_pool.empty ()) {
|
||||
new_cmd = priv->cmd_pool.front ();
|
||||
priv->cmd_pool.pop ();
|
||||
}
|
||||
}
|
||||
|
||||
if (!new_cmd) {
|
||||
ComPtr < ID3D12CommandAllocator > ca;
|
||||
hr = priv->device->CreateCommandAllocator (priv->cmd_type,
|
||||
IID_PPV_ARGS (&ca));
|
||||
if (FAILED (hr)) {
|
||||
GST_ERROR_OBJECT (pool, "Couldn't create command allocator, hr: 0x%x",
|
||||
(guint) hr);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
new_cmd = gst_d3d12_command_allocator_new (ca.Get (), priv->cmd_type);
|
||||
if (GST_OBJECT_FLAG_IS_SET (pool, GST_OBJECT_FLAG_MAY_BE_LEAKED))
|
||||
GST_MINI_OBJECT_FLAG_SET (new_cmd, GST_MINI_OBJECT_FLAG_MAY_BE_LEAKED);
|
||||
}
|
||||
|
||||
new_cmd->pool = (GstD3D12CommandAllocatorPool *) gst_object_ref (pool);
|
||||
new_cmd->dispose =
|
||||
(GstMiniObjectDisposeFunction) gst_d3d12_command_allocator_dispose;
|
||||
|
||||
*cmd = new_cmd;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_d3d12_command_allocator_ref:
|
||||
* @cmd: a #GstD3D12CommandAllocator
|
||||
*
|
||||
* Increments the refcount of @cmd
|
||||
*
|
||||
* Returns: (transfer full): a #GstD3D12CommandAllocator
|
||||
*
|
||||
* Since: 1.26
|
||||
*/
|
||||
GstD3D12CommandAllocator *
|
||||
gst_d3d12_command_allocator_ref (GstD3D12CommandAllocator * cmd)
|
||||
{
|
||||
return (GstD3D12CommandAllocator *) gst_mini_object_ref (cmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_d3d12_command_allocator_unref:
|
||||
* @cmd: a #GstD3D12CommandAllocator
|
||||
*
|
||||
* Decrements the refcount of @cmd
|
||||
*
|
||||
* Since: 1.26
|
||||
*/
|
||||
void
|
||||
gst_d3d12_command_allocator_unref (GstD3D12CommandAllocator * cmd)
|
||||
{
|
||||
gst_mini_object_unref (cmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_clear_d3d12_command_allocator:
|
||||
* @cmd: a pointer to #GstD3D12CommandAllocator
|
||||
*
|
||||
* Clears a reference to a #GstD3D12CommandAllocator
|
||||
*
|
||||
* Since: 1.26
|
||||
*/
|
||||
void
|
||||
gst_clear_d3d12_command_allocator (GstD3D12CommandAllocator ** cmd)
|
||||
{
|
||||
gst_clear_mini_object (cmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_d3d12_command_allocator_get_handle:
|
||||
* @cmd: a #GstD3D12CommandAllocator
|
||||
*
|
||||
* Gets ID3D12CommandAllocator handle.
|
||||
*
|
||||
* Returns: (transfer none): ID3D12CommandAllocator handle
|
||||
*
|
||||
* Since: 1.26
|
||||
*/
|
||||
ID3D12CommandAllocator *
|
||||
gst_d3d12_command_allocator_get_handle (GstD3D12CommandAllocator * cmd)
|
||||
{
|
||||
g_return_val_if_fail (cmd, nullptr);
|
||||
|
||||
return cmd->ca.Get ();
|
||||
}
|
|
@ -1,94 +0,0 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) 2023 Seungha Yang <seungha@centricular.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <gst/gst.h>
|
||||
#include <gst/video/video.h>
|
||||
#include <gst/d3d12/gstd3d12_fwd.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_D3D12_COMMAND_ALLOCATOR_POOL (gst_d3d12_command_allocator_pool_get_type ())
|
||||
#define GST_D3D12_COMMAND_ALLOCATOR_POOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_D3D12_COMMAND_ALLOCATOR_POOL, GstD3D12CommandAllocatorPool))
|
||||
#define GST_D3D12_COMMAND_ALLOCATOR_POOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_D3D12_COMMAND_ALLOCATOR_POOL, GstD3D12CommandAllocatorPoolClass))
|
||||
#define GST_IS_D3D12_COMMAND_ALLOCATOR_POOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_D3D12_COMMAND_ALLOCATOR_POOL))
|
||||
#define GST_IS_D3D12_COMMAND_ALLOCATOR_POOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_D3D12_COMMAND_ALLOCATOR_POOL))
|
||||
#define GST_D3D12_COMMAND_ALLOCATOR_POOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_D3D12_COMMAND_ALLOCATOR_POOL, GstD3D12CommandAllocatorPoolClass))
|
||||
#define GST_D3D12_COMMAND_ALLOCATOR_POOL_CAST(obj) ((GstD3D12CommandAllocatorPool*)(obj))
|
||||
|
||||
/**
|
||||
* GstD3D12CommandAllocatorPool:
|
||||
*
|
||||
* Opaque GstD3D12CommandAllocatorPool struct
|
||||
*
|
||||
* Since: 1.26
|
||||
*/
|
||||
struct _GstD3D12CommandAllocatorPool
|
||||
{
|
||||
GstObject parent;
|
||||
|
||||
/*< private >*/
|
||||
GstD3D12CommandAllocatorPoolPrivate *priv;
|
||||
gpointer _gst_reserved[GST_PADDING];
|
||||
};
|
||||
|
||||
/**
|
||||
* GstD3D12CommandAllocatorPoolClass:
|
||||
*
|
||||
* Opaque GstD3D12CommandAllocatorPoolClass struct
|
||||
*
|
||||
* Since: 1.26
|
||||
*/
|
||||
struct _GstD3D12CommandAllocatorPoolClass
|
||||
{
|
||||
GstObjectClass parent_class;
|
||||
|
||||
/*< private >*/
|
||||
gpointer _gst_reserved[GST_PADDING];
|
||||
};
|
||||
|
||||
GST_D3D12_API
|
||||
GType gst_d3d12_command_allocator_pool_get_type (void);
|
||||
|
||||
GST_D3D12_API
|
||||
GType gst_d3d12_command_allocator_get_type (void);
|
||||
|
||||
GST_D3D12_API
|
||||
GstD3D12CommandAllocatorPool * gst_d3d12_command_allocator_pool_new (ID3D12Device * device,
|
||||
D3D12_COMMAND_LIST_TYPE type);
|
||||
|
||||
GST_D3D12_API
|
||||
gboolean gst_d3d12_command_allocator_pool_acquire (GstD3D12CommandAllocatorPool * pool,
|
||||
GstD3D12CommandAllocator ** cmd);
|
||||
|
||||
GST_D3D12_API
|
||||
GstD3D12CommandAllocator * gst_d3d12_command_allocator_ref (GstD3D12CommandAllocator * cmd);
|
||||
|
||||
GST_D3D12_API
|
||||
void gst_d3d12_command_allocator_unref (GstD3D12CommandAllocator * cmd);
|
||||
|
||||
GST_D3D12_API
|
||||
void gst_clear_d3d12_command_allocator (GstD3D12CommandAllocator ** cmd);
|
||||
|
||||
GST_D3D12_API
|
||||
ID3D12CommandAllocator * gst_d3d12_command_allocator_get_handle (GstD3D12CommandAllocator * cmd);
|
||||
|
||||
G_END_DECLS
|
||||
|
|
@ -1,260 +0,0 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) 2023 Seungha Yang <seungha@centricular.com>
|
||||
*
|
||||
* This library is free software; you cln redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "gstd3d12.h"
|
||||
#include "gstd3d12commandlistpool.h"
|
||||
#include <wrl.h>
|
||||
#include <queue>
|
||||
#include <mutex>
|
||||
|
||||
GST_DEBUG_CATEGORY_STATIC (gst_d3d12_command_list_pool_debug);
|
||||
#define GST_CAT_DEFAULT gst_d3d12_command_list_pool_debug
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
using namespace Microsoft::WRL;
|
||||
|
||||
struct _GstD3D12CommandList : public GstMiniObject
|
||||
{
|
||||
GstD3D12CommandListPool *pool = nullptr;
|
||||
D3D12_COMMAND_LIST_TYPE type;
|
||||
ComPtr < ID3D12CommandList > cl;
|
||||
};
|
||||
|
||||
struct GstD3D12CommandListPoolPrivate
|
||||
{
|
||||
~GstD3D12CommandListPoolPrivate ()
|
||||
{
|
||||
while (!cmd_pool.empty ()) {
|
||||
auto cmd = cmd_pool.front ();
|
||||
cmd_pool.pop ();
|
||||
gst_mini_object_unref (cmd);
|
||||
}
|
||||
}
|
||||
|
||||
ComPtr<ID3D12Device> device;
|
||||
|
||||
std::mutex lock;
|
||||
std::queue<GstD3D12CommandList *>cmd_pool;
|
||||
D3D12_COMMAND_LIST_TYPE cmd_type;
|
||||
};
|
||||
/* *INDENT-ON* */
|
||||
|
||||
struct _GstD3D12CommandListPool
|
||||
{
|
||||
GstObject parent;
|
||||
|
||||
GstD3D12CommandListPoolPrivate *priv;
|
||||
};
|
||||
|
||||
GST_DEFINE_MINI_OBJECT_TYPE (GstD3D12CommandList, gst_d3d12_command_list);
|
||||
|
||||
static void gst_d3d12_command_list_pool_finalize (GObject * object);
|
||||
|
||||
#define gst_d3d12_command_list_pool_parent_class parent_class
|
||||
G_DEFINE_TYPE (GstD3D12CommandListPool,
|
||||
gst_d3d12_command_list_pool, GST_TYPE_OBJECT);
|
||||
|
||||
static void
|
||||
gst_d3d12_command_list_pool_class_init (GstD3D12CommandListPoolClass * klass)
|
||||
{
|
||||
auto object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->finalize = gst_d3d12_command_list_pool_finalize;
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (gst_d3d12_command_list_pool_debug,
|
||||
"d3d12commandlistpool", 0, "d3d12commandlistpool");
|
||||
}
|
||||
|
||||
static void
|
||||
gst_d3d12_command_list_pool_init (GstD3D12CommandListPool * self)
|
||||
{
|
||||
self->priv = new GstD3D12CommandListPoolPrivate ();
|
||||
}
|
||||
|
||||
static void
|
||||
gst_d3d12_command_list_pool_finalize (GObject * object)
|
||||
{
|
||||
auto self = GST_D3D12_COMMAND_LIST_POOL (object);
|
||||
|
||||
delete self->priv;
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
GstD3D12CommandListPool *
|
||||
gst_d3d12_command_list_pool_new (ID3D12Device * device,
|
||||
D3D12_COMMAND_LIST_TYPE type)
|
||||
{
|
||||
g_return_val_if_fail (device, nullptr);
|
||||
|
||||
if (type != D3D12_COMMAND_LIST_TYPE_DIRECT &&
|
||||
type != D3D12_COMMAND_LIST_TYPE_COMPUTE &&
|
||||
type != D3D12_COMMAND_LIST_TYPE_COPY) {
|
||||
GST_ERROR ("Not supported command list type");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto self = (GstD3D12CommandListPool *)
|
||||
g_object_new (GST_TYPE_D3D12_COMMAND_LIST_POOL, nullptr);
|
||||
gst_object_ref_sink (self);
|
||||
|
||||
auto priv = self->priv;
|
||||
priv->device = device;
|
||||
priv->cmd_type = type;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_d3d12_command_list_pool_release (GstD3D12CommandListPool * pool,
|
||||
GstD3D12CommandList * cmd)
|
||||
{
|
||||
auto priv = pool->priv;
|
||||
{
|
||||
std::lock_guard < std::mutex > lk (priv->lock);
|
||||
cmd->dispose = nullptr;
|
||||
cmd->pool = nullptr;
|
||||
priv->cmd_pool.push (cmd);
|
||||
}
|
||||
|
||||
gst_object_unref (pool);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_d3d12_command_list_dispose (GstD3D12CommandList * cmd)
|
||||
{
|
||||
if (!cmd->pool)
|
||||
return TRUE;
|
||||
|
||||
gst_mini_object_ref (cmd);
|
||||
gst_d3d12_command_list_pool_release (cmd->pool, cmd);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_d3d12_command_list_free (GstD3D12CommandList * cmd)
|
||||
{
|
||||
delete cmd;
|
||||
}
|
||||
|
||||
static GstD3D12CommandList *
|
||||
gst_d3d12_command_list_new (ID3D12CommandList * cl,
|
||||
D3D12_COMMAND_LIST_TYPE type)
|
||||
{
|
||||
auto cmd = new GstD3D12CommandList ();
|
||||
cmd->cl = cl;
|
||||
cmd->type = type;
|
||||
|
||||
gst_mini_object_init (cmd, 0, gst_d3d12_command_list_get_type (),
|
||||
nullptr, nullptr,
|
||||
(GstMiniObjectFreeFunction) gst_d3d12_command_list_free);
|
||||
|
||||
return cmd;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_d3d12_command_list_pool_acquire (GstD3D12CommandListPool * pool,
|
||||
ID3D12CommandAllocator * ca, GstD3D12CommandList ** cmd)
|
||||
{
|
||||
g_return_val_if_fail (GST_IS_D3D12_COMMAND_LIST_POOL (pool), FALSE);
|
||||
g_return_val_if_fail (ca, FALSE);
|
||||
g_return_val_if_fail (cmd, FALSE);
|
||||
|
||||
*cmd = nullptr;
|
||||
|
||||
auto priv = pool->priv;
|
||||
GstD3D12CommandList *new_cmd = nullptr;
|
||||
HRESULT hr;
|
||||
|
||||
hr = ca->Reset ();
|
||||
if (FAILED (hr)) {
|
||||
GST_ERROR_OBJECT (pool, "Couldn't reset command allocator");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
{
|
||||
std::lock_guard < std::mutex > lk (priv->lock);
|
||||
if (!priv->cmd_pool.empty ()) {
|
||||
new_cmd = priv->cmd_pool.front ();
|
||||
priv->cmd_pool.pop ();
|
||||
}
|
||||
}
|
||||
|
||||
ComPtr < ID3D12GraphicsCommandList > cl;
|
||||
if (!new_cmd) {
|
||||
hr = priv->device->CreateCommandList (0, priv->cmd_type,
|
||||
ca, nullptr, IID_PPV_ARGS (&cl));
|
||||
if (FAILED (hr)) {
|
||||
GST_ERROR_OBJECT (pool, "Couldn't create command list, hr: 0x%x",
|
||||
(guint) hr);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
new_cmd = gst_d3d12_command_list_new (cl.Get (), priv->cmd_type);
|
||||
if (GST_OBJECT_FLAG_IS_SET (pool, GST_OBJECT_FLAG_MAY_BE_LEAKED))
|
||||
GST_MINI_OBJECT_FLAG_SET (new_cmd, GST_MINI_OBJECT_FLAG_MAY_BE_LEAKED);
|
||||
} else {
|
||||
new_cmd->cl->QueryInterface (IID_PPV_ARGS (&cl));
|
||||
hr = cl->Reset (ca, nullptr);
|
||||
if (FAILED (hr)) {
|
||||
GST_ERROR_OBJECT (pool, "Couldn't reset command list");
|
||||
gst_mini_object_unref (new_cmd);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
new_cmd->pool = (GstD3D12CommandListPool *) gst_object_ref (pool);
|
||||
new_cmd->dispose =
|
||||
(GstMiniObjectDisposeFunction) gst_d3d12_command_list_dispose;
|
||||
|
||||
*cmd = new_cmd;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
GstD3D12CommandList *
|
||||
gst_d3d12_command_list_ref (GstD3D12CommandList * cmd)
|
||||
{
|
||||
return (GstD3D12CommandList *) gst_mini_object_ref (cmd);
|
||||
}
|
||||
|
||||
void
|
||||
gst_d3d12_command_list_unref (GstD3D12CommandList * cmd)
|
||||
{
|
||||
gst_mini_object_unref (cmd);
|
||||
}
|
||||
|
||||
void
|
||||
gst_clear_d3d12_command_list (GstD3D12CommandList ** cmd)
|
||||
{
|
||||
gst_clear_mini_object (cmd);
|
||||
}
|
||||
|
||||
ID3D12CommandList *
|
||||
gst_d3d12_command_list_get_handle (GstD3D12CommandList * cmd)
|
||||
{
|
||||
g_return_val_if_fail (cmd, nullptr);
|
||||
|
||||
return cmd->cl.Get ();
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) 2023 Seungha Yang <seungha@centricular.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <gst/gst.h>
|
||||
#include <gst/video/video.h>
|
||||
#include <gst/d3d12/gstd3d12_fwd.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_D3D12_COMMAND_LIST_POOL (gst_d3d12_command_list_pool_get_type())
|
||||
G_DECLARE_FINAL_TYPE (GstD3D12CommandListPool,
|
||||
gst_d3d12_command_list_pool, GST, D3D12_COMMAND_LIST_POOL, GstObject);
|
||||
|
||||
typedef struct _GstD3D12CommandList GstD3D12CommandList;
|
||||
|
||||
GType gst_d3d12_command_list_get_type (void);
|
||||
|
||||
GstD3D12CommandListPool * gst_d3d12_command_list_pool_new (ID3D12Device * device,
|
||||
D3D12_COMMAND_LIST_TYPE type);
|
||||
|
||||
gboolean gst_d3d12_command_list_pool_acquire (GstD3D12CommandListPool * pool,
|
||||
ID3D12CommandAllocator * ca,
|
||||
GstD3D12CommandList ** cmd);
|
||||
|
||||
GstD3D12CommandList * gst_d3d12_command_list_ref (GstD3D12CommandList * cmd);
|
||||
|
||||
void gst_d3d12_command_list_unref (GstD3D12CommandList * cmd);
|
||||
|
||||
void gst_clear_d3d12_command_list (GstD3D12CommandList ** cmd);
|
||||
|
||||
ID3D12CommandList * gst_d3d12_command_list_get_handle (GstD3D12CommandList * cmd);
|
||||
|
||||
G_END_DECLS
|
||||
|
|
@ -1,118 +0,0 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) 2023 Seungha Yang <seungha@centricular.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <gst/gst.h>
|
||||
#include <gst/video/video.h>
|
||||
#include <gst/d3d12/gstd3d12_fwd.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_D3D12_COMMAND_QUEUE (gst_d3d12_command_queue_get_type ())
|
||||
#define GST_D3D12_COMMAND_QUEUE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_D3D12_COMMAND_QUEUE, GstD3D12CommandQueue))
|
||||
#define GST_D3D12_COMMAND_QUEUE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_D3D12_COMMAND_QUEUE, GstD3D12CommandQueueClass))
|
||||
#define GST_IS_D3D12_COMMAND_QUEUE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_D3D12_COMMAND_QUEUE))
|
||||
#define GST_IS_D3D12_COMMAND_QUEUE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_D3D12_COMMAND_QUEUE))
|
||||
#define GST_D3D12_COMMAND_QUEUE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_D3D12_COMMAND_QUEUE, GstD3D12CommandQueueClass))
|
||||
#define GST_D3D12_COMMAND_QUEUE_CAST(obj) ((GstD3D12CommandQueue*)(obj))
|
||||
|
||||
/**
|
||||
* GstD3D12CommandQueue:
|
||||
*
|
||||
* Opaque GstD3D12CommandQueue struct
|
||||
*
|
||||
* Since: 1.26
|
||||
*/
|
||||
struct _GstD3D12CommandQueue
|
||||
{
|
||||
GstObject parent;
|
||||
|
||||
/*< private >*/
|
||||
GstD3D12CommandQueuePrivate *priv;
|
||||
gpointer _gst_reserved[GST_PADDING];
|
||||
};
|
||||
|
||||
/**
|
||||
* GstD3D12CommandQueueClass:
|
||||
*
|
||||
* Opaque GstD3D12CommandQueueClass struct
|
||||
*
|
||||
* Since: 1.26
|
||||
*/
|
||||
struct _GstD3D12CommandQueueClass
|
||||
{
|
||||
GstObjectClass parent_class;
|
||||
|
||||
/*< private >*/
|
||||
gpointer _gst_reserved[GST_PADDING];
|
||||
};
|
||||
|
||||
GST_D3D12_API
|
||||
GType gst_d3d12_command_queue_get_type (void);
|
||||
|
||||
GST_D3D12_API
|
||||
GstD3D12CommandQueue * gst_d3d12_command_queue_new (ID3D12Device * device,
|
||||
const D3D12_COMMAND_QUEUE_DESC * desc,
|
||||
D3D12_FENCE_FLAGS fence_flags,
|
||||
guint queue_size);
|
||||
|
||||
GST_D3D12_API
|
||||
ID3D12CommandQueue * gst_d3d12_command_queue_get_handle (GstD3D12CommandQueue * queue);
|
||||
|
||||
GST_D3D12_API
|
||||
ID3D12Fence * gst_d3d12_command_queue_get_fence_handle (GstD3D12CommandQueue * queue);
|
||||
|
||||
GST_D3D12_API
|
||||
HRESULT gst_d3d12_command_queue_execute_command_lists (GstD3D12CommandQueue * queue,
|
||||
guint num_command_lists,
|
||||
ID3D12CommandList ** command_lists,
|
||||
guint64 * fence_value);
|
||||
|
||||
GST_D3D12_API
|
||||
HRESULT gst_d3d12_command_queue_execute_command_lists_full (GstD3D12CommandQueue * queue,
|
||||
guint num_fences_to_wait,
|
||||
ID3D12Fence ** fences_to_wait,
|
||||
const guint64 * fence_values_to_wait,
|
||||
guint num_command_lists,
|
||||
ID3D12CommandList ** command_lists,
|
||||
guint64 * fence_value);
|
||||
|
||||
GST_D3D12_API
|
||||
HRESULT gst_d3d12_command_queue_execute_wait (GstD3D12CommandQueue * queue,
|
||||
ID3D12Fence * fence,
|
||||
guint64 fence_value);
|
||||
|
||||
GST_D3D12_API
|
||||
guint64 gst_d3d12_command_queue_get_completed_value (GstD3D12CommandQueue * queue);
|
||||
|
||||
GST_D3D12_API
|
||||
HRESULT gst_d3d12_command_queue_fence_wait (GstD3D12CommandQueue * queue,
|
||||
guint64 fence_value);
|
||||
|
||||
GST_D3D12_API
|
||||
void gst_d3d12_command_queue_set_notify (GstD3D12CommandQueue * queue,
|
||||
guint64 fence_value,
|
||||
gpointer fence_data,
|
||||
GDestroyNotify notify);
|
||||
|
||||
GST_D3D12_API
|
||||
HRESULT gst_d3d12_command_queue_drain (GstD3D12CommandQueue * queue);
|
||||
|
||||
G_END_DECLS
|
|
@ -56,7 +56,7 @@ struct GstD3D12PackPrivate
|
|||
guint tg_x = 0;
|
||||
guint tg_y = 0;
|
||||
|
||||
GstD3D12DescriptorPool *desc_pool = nullptr;
|
||||
GstD3D12DescHeapPool *desc_pool = nullptr;
|
||||
|
||||
GstBufferPool *render_target_pool = nullptr;
|
||||
bool need_process = false;
|
||||
|
@ -215,7 +215,7 @@ gst_d3d12_pack_new (GstD3D12Device * device,
|
|||
heap_desc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE;
|
||||
heap_desc.NumDescriptors = 2;
|
||||
|
||||
priv->desc_pool = gst_d3d12_descriptor_pool_new (dev_handle, &heap_desc);
|
||||
priv->desc_pool = gst_d3d12_desc_heap_pool_new (dev_handle, &heap_desc);
|
||||
|
||||
D3D12_ROOT_SIGNATURE_FLAGS rs_flags =
|
||||
D3D12_ROOT_SIGNATURE_FLAG_DENY_HULL_SHADER_ROOT_ACCESS |
|
||||
|
@ -365,8 +365,8 @@ gst_d3d12_pack_execute (GstD3D12Pack * pack, GstBuffer * in_buf,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
GstD3D12Descriptor *descriptor;
|
||||
if (!gst_d3d12_descriptor_pool_acquire (priv->desc_pool, &descriptor)) {
|
||||
GstD3D12DescHeap *descriptor;
|
||||
if (!gst_d3d12_desc_heap_pool_acquire (priv->desc_pool, &descriptor)) {
|
||||
GST_ERROR_OBJECT (pack, "Couldn't acquire descriptor heap");
|
||||
gst_d3d12_frame_unmap (&in_frame);
|
||||
gst_d3d12_frame_unmap (&out_frame);
|
||||
|
@ -378,7 +378,7 @@ gst_d3d12_pack_execute (GstD3D12Pack * pack, GstBuffer * in_buf,
|
|||
auto device = gst_d3d12_device_get_device_handle (priv->device);
|
||||
auto in_resource = in_frame.data[0];
|
||||
|
||||
auto desc_handle = gst_d3d12_descriptor_get_handle (descriptor);
|
||||
auto desc_handle = gst_d3d12_desc_heap_get_handle (descriptor);
|
||||
auto desc_cpu_handle = CD3DX12_CPU_DESCRIPTOR_HANDLE
|
||||
(GetCPUDescriptorHandleForHeapStart (desc_handle));
|
||||
device->CopyDescriptorsSimple (1, desc_cpu_handle,
|
||||
|
|
|
@ -63,7 +63,7 @@ struct GstD3D12UnpackPrivate
|
|||
guint x_unit = 8;
|
||||
guint y_unit = 8;
|
||||
|
||||
GstD3D12DescriptorPool *desc_pool = nullptr;
|
||||
GstD3D12DescHeapPool *desc_pool = nullptr;
|
||||
|
||||
GstBufferPool *upload_pool = nullptr;
|
||||
GstBufferPool *output_pool = nullptr;
|
||||
|
@ -219,7 +219,7 @@ gst_d3d12_unpack_new (GstD3D12Device * device,
|
|||
heap_desc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE;
|
||||
heap_desc.NumDescriptors = 2;
|
||||
|
||||
priv->desc_pool = gst_d3d12_descriptor_pool_new (dev_handle, &heap_desc);
|
||||
priv->desc_pool = gst_d3d12_desc_heap_pool_new (dev_handle, &heap_desc);
|
||||
|
||||
D3D12_ROOT_SIGNATURE_FLAGS rs_flags =
|
||||
D3D12_ROOT_SIGNATURE_FLAG_DENY_HULL_SHADER_ROOT_ACCESS |
|
||||
|
@ -461,8 +461,8 @@ gst_d3d12_unpack_execute (GstD3D12Unpack * unpack, GstBuffer * buffer,
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
GstD3D12Descriptor *descriptor;
|
||||
if (!gst_d3d12_descriptor_pool_acquire (priv->desc_pool, &descriptor)) {
|
||||
GstD3D12DescHeap *descriptor;
|
||||
if (!gst_d3d12_desc_heap_pool_acquire (priv->desc_pool, &descriptor)) {
|
||||
GST_ERROR_OBJECT (unpack, "Couldn't acquire descriptor heap");
|
||||
gst_d3d12_frame_unmap (&in_frame);
|
||||
gst_buffer_unref (upload_buf);
|
||||
|
@ -473,7 +473,7 @@ gst_d3d12_unpack_execute (GstD3D12Unpack * unpack, GstBuffer * buffer,
|
|||
gst_d3d12_fence_data_push (fence_data, FENCE_NOTIFY_MINI_OBJECT (descriptor));
|
||||
|
||||
auto device = gst_d3d12_device_get_device_handle (priv->device);
|
||||
auto desc_handle = gst_d3d12_descriptor_get_handle (descriptor);
|
||||
auto desc_handle = gst_d3d12_desc_heap_get_handle (descriptor);
|
||||
auto desc_cpu_handle = CD3DX12_CPU_DESCRIPTOR_HANDLE
|
||||
(GetCPUDescriptorHandleForHeapStart (desc_handle));
|
||||
device->CopyDescriptorsSimple (1, desc_cpu_handle,
|
||||
|
|
|
@ -240,7 +240,7 @@ struct _GstD3D12ConverterPrivate
|
|||
~_GstD3D12ConverterPrivate ()
|
||||
{
|
||||
if (fence_val > 0 && cq)
|
||||
gst_d3d12_command_queue_fence_wait (cq, fence_val);
|
||||
gst_d3d12_cmd_queue_fence_wait (cq, fence_val);
|
||||
|
||||
gst_clear_object (&srv_heap_pool);
|
||||
gst_clear_object (&cq);
|
||||
|
@ -248,7 +248,7 @@ struct _GstD3D12ConverterPrivate
|
|||
gst_clear_object (&unpack);
|
||||
}
|
||||
|
||||
GstD3D12CommandQueue *cq = nullptr;
|
||||
GstD3D12CmdQueue *cq = nullptr;
|
||||
GstD3D12Unpack *unpack = nullptr;
|
||||
GstD3D12Pack *pack = nullptr;
|
||||
|
||||
|
@ -283,7 +283,7 @@ struct _GstD3D12ConverterPrivate
|
|||
|
||||
std::vector<QuadData> quad_data;
|
||||
|
||||
GstD3D12DescriptorPool *srv_heap_pool = nullptr;
|
||||
GstD3D12DescHeapPool *srv_heap_pool = nullptr;
|
||||
|
||||
guint srv_inc_size;
|
||||
guint rtv_inc_size;
|
||||
|
@ -862,7 +862,7 @@ gst_d3d12_converter_setup_resource (GstD3D12Converter * self,
|
|||
|
||||
srv_heap_desc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE;
|
||||
|
||||
priv->srv_heap_pool = gst_d3d12_descriptor_pool_new (device, &srv_heap_desc);
|
||||
priv->srv_heap_pool = gst_d3d12_desc_heap_pool_new (device, &srv_heap_desc);
|
||||
|
||||
/* bottom left */
|
||||
vertex_data[0].position.x = -1.0f;
|
||||
|
@ -1117,7 +1117,7 @@ gst_d3d12_converter_setup_resource (GstD3D12Converter * self,
|
|||
|
||||
ID3D12CommandList *cmd_list[] = { cl.Get () };
|
||||
|
||||
hr = gst_d3d12_command_queue_execute_command_lists (priv->cq, 1, cmd_list,
|
||||
hr = gst_d3d12_cmd_queue_execute_command_lists (priv->cq, 1, cmd_list,
|
||||
&priv->fence_val);
|
||||
if (!gst_d3d12_result (hr, self->device)) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't execute command list");
|
||||
|
@ -1140,7 +1140,7 @@ gst_d3d12_converter_setup_resource (GstD3D12Converter * self,
|
|||
FENCE_NOTIFY_COM (gamma_enc_lut_upload.Detach ()));
|
||||
}
|
||||
|
||||
gst_d3d12_command_queue_set_notify (priv->cq, priv->fence_val,
|
||||
gst_d3d12_cmd_queue_set_notify (priv->cq, priv->fence_val,
|
||||
FENCE_NOTIFY_MINI_OBJECT (fence_data));
|
||||
|
||||
return TRUE;
|
||||
|
@ -1859,7 +1859,7 @@ gst_d3d12_converter_calculate_border_color (GstD3D12Converter * self)
|
|||
/**
|
||||
* gst_d3d12_converter_new:
|
||||
* @device: a #GstD3D12Device
|
||||
* @queue: (allow-none): a #GstD3D12CommandQueue
|
||||
* @queue: (allow-none): a #GstD3D12CmdQueue
|
||||
* @in_info: a #GstVideoInfo
|
||||
* @out_info: a #GstVideoInfo
|
||||
* @blend_desc: (nullable): D3D12_BLEND_DESC
|
||||
|
@ -1874,7 +1874,7 @@ gst_d3d12_converter_calculate_border_color (GstD3D12Converter * self)
|
|||
* Since: 1.26
|
||||
*/
|
||||
GstD3D12Converter *
|
||||
gst_d3d12_converter_new (GstD3D12Device * device, GstD3D12CommandQueue * queue,
|
||||
gst_d3d12_converter_new (GstD3D12Device * device, GstD3D12CmdQueue * queue,
|
||||
const GstVideoInfo * in_info, const GstVideoInfo * out_info,
|
||||
const D3D12_BLEND_DESC * blend_desc, const gfloat blend_factor[4],
|
||||
GstStructure * config)
|
||||
|
@ -1893,15 +1893,14 @@ gst_d3d12_converter_new (GstD3D12Device * device, GstD3D12CommandQueue * queue,
|
|||
g_return_val_if_fail (GST_IS_D3D12_DEVICE (device), nullptr);
|
||||
g_return_val_if_fail (in_info != nullptr, nullptr);
|
||||
g_return_val_if_fail (out_info != nullptr, nullptr);
|
||||
g_return_val_if_fail (queue == nullptr || GST_IS_D3D12_COMMAND_QUEUE (queue),
|
||||
nullptr);
|
||||
g_return_val_if_fail (!queue || GST_IS_D3D12_CMD_QUEUE (queue), nullptr);
|
||||
|
||||
self = (GstD3D12Converter *) g_object_new (GST_TYPE_D3D12_CONVERTER, nullptr);
|
||||
gst_object_ref_sink (self);
|
||||
auto priv = self->priv;
|
||||
priv->cq = queue;
|
||||
if (!priv->cq) {
|
||||
priv->cq = gst_d3d12_device_get_command_queue (device,
|
||||
priv->cq = gst_d3d12_device_get_cmd_queue (device,
|
||||
D3D12_COMMAND_LIST_TYPE_DIRECT);
|
||||
}
|
||||
gst_object_ref (priv->cq);
|
||||
|
@ -2218,13 +2217,13 @@ gst_d3d12_converter_execute (GstD3D12Converter * self, GstD3D12Frame * in_frame,
|
|||
|
||||
auto device = gst_d3d12_device_get_device_handle (self->device);
|
||||
|
||||
GstD3D12Descriptor *descriptor;
|
||||
if (!gst_d3d12_descriptor_pool_acquire (priv->srv_heap_pool, &descriptor)) {
|
||||
GstD3D12DescHeap *descriptor;
|
||||
if (!gst_d3d12_desc_heap_pool_acquire (priv->srv_heap_pool, &descriptor)) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't acquire srv heap");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
auto srv_heap = gst_d3d12_descriptor_get_handle (descriptor);
|
||||
auto srv_heap = gst_d3d12_desc_heap_get_handle (descriptor);
|
||||
gst_d3d12_fence_data_push (fence_data, FENCE_NOTIFY_MINI_OBJECT (descriptor));
|
||||
|
||||
auto cpu_handle =
|
||||
|
|
|
@ -174,7 +174,7 @@ GType gst_d3d12_converter_get_type (void);
|
|||
|
||||
GST_D3D12_API
|
||||
GstD3D12Converter * gst_d3d12_converter_new (GstD3D12Device * device,
|
||||
GstD3D12CommandQueue * queue,
|
||||
GstD3D12CmdQueue * queue,
|
||||
const GstVideoInfo * in_info,
|
||||
const GstVideoInfo * out_info,
|
||||
const D3D12_BLEND_DESC * blend_desc,
|
||||
|
|
|
@ -0,0 +1,280 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) 2023 Seungha Yang <seungha@centricular.com>
|
||||
*
|
||||
* This library is free software; you cln redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "gstd3d12.h"
|
||||
#include <wrl.h>
|
||||
#include <queue>
|
||||
#include <mutex>
|
||||
|
||||
GST_DEBUG_CATEGORY_STATIC (gst_d3d12_desc_heap_pool_debug);
|
||||
#define GST_CAT_DEFAULT gst_d3d12_desc_heap_pool_debug
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
using namespace Microsoft::WRL;
|
||||
|
||||
struct _GstD3D12DescHeap : public GstMiniObject
|
||||
{
|
||||
GstD3D12DescHeapPool *pool = nullptr;
|
||||
ComPtr < ID3D12DescriptorHeap > heap;
|
||||
};
|
||||
|
||||
struct _GstD3D12DescHeapPoolPrivate
|
||||
{
|
||||
~_GstD3D12DescHeapPoolPrivate ()
|
||||
{
|
||||
while (!heap_pool.empty ()) {
|
||||
auto heap = heap_pool.front ();
|
||||
heap_pool.pop ();
|
||||
gst_mini_object_unref (heap);
|
||||
}
|
||||
}
|
||||
|
||||
ComPtr<ID3D12Device> device;
|
||||
|
||||
std::mutex lock;
|
||||
std::queue<GstD3D12DescHeap *>heap_pool;
|
||||
D3D12_DESCRIPTOR_HEAP_DESC heap_desc;
|
||||
};
|
||||
/* *INDENT-ON* */
|
||||
|
||||
GST_DEFINE_MINI_OBJECT_TYPE (GstD3D12DescHeap, gst_d3d12_desc_heap);
|
||||
|
||||
static void gst_d3d12_desc_heap_pool_finalize (GObject * object);
|
||||
|
||||
#define gst_d3d12_desc_heap_pool_parent_class parent_class
|
||||
G_DEFINE_TYPE (GstD3D12DescHeapPool, gst_d3d12_desc_heap_pool, GST_TYPE_OBJECT);
|
||||
|
||||
static void
|
||||
gst_d3d12_desc_heap_pool_class_init (GstD3D12DescHeapPoolClass * klass)
|
||||
{
|
||||
auto object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->finalize = gst_d3d12_desc_heap_pool_finalize;
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (gst_d3d12_desc_heap_pool_debug,
|
||||
"d3d12descheappool", 0, "d3d12descheappool");
|
||||
}
|
||||
|
||||
static void
|
||||
gst_d3d12_desc_heap_pool_init (GstD3D12DescHeapPool * self)
|
||||
{
|
||||
self->priv = new GstD3D12DescHeapPoolPrivate ();
|
||||
}
|
||||
|
||||
static void
|
||||
gst_d3d12_desc_heap_pool_finalize (GObject * object)
|
||||
{
|
||||
auto self = GST_D3D12_DESC_HEAP_POOL (object);
|
||||
|
||||
delete self->priv;
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_d3d12_desc_heap_pool_new:
|
||||
* @device: a #GstD3D12Device
|
||||
* @type: D3D12_DESCRIPTOR_HEAP_DESC
|
||||
*
|
||||
* Returns: (transfer full): a new #GstD3D12DescHeapPool instance
|
||||
*
|
||||
* Since: 1.26
|
||||
*/
|
||||
GstD3D12DescHeapPool *
|
||||
gst_d3d12_desc_heap_pool_new (ID3D12Device * device,
|
||||
const D3D12_DESCRIPTOR_HEAP_DESC * desc)
|
||||
{
|
||||
g_return_val_if_fail (device, nullptr);
|
||||
g_return_val_if_fail (desc, nullptr);
|
||||
|
||||
auto self = (GstD3D12DescHeapPool *)
|
||||
g_object_new (GST_TYPE_D3D12_DESC_HEAP_POOL, nullptr);
|
||||
gst_object_ref_sink (self);
|
||||
|
||||
auto priv = self->priv;
|
||||
priv->device = device;
|
||||
priv->heap_desc = *desc;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_d3d12_desc_heap_pool_release (GstD3D12DescHeapPool * pool,
|
||||
GstD3D12DescHeap * heap)
|
||||
{
|
||||
auto priv = pool->priv;
|
||||
{
|
||||
std::lock_guard < std::mutex > lk (priv->lock);
|
||||
heap->dispose = nullptr;
|
||||
heap->pool = nullptr;
|
||||
priv->heap_pool.push (heap);
|
||||
}
|
||||
|
||||
gst_object_unref (pool);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_d3d12_desc_heap_dispose (GstD3D12DescHeap * heap)
|
||||
{
|
||||
if (!heap->pool)
|
||||
return TRUE;
|
||||
|
||||
gst_mini_object_ref (heap);
|
||||
gst_d3d12_desc_heap_pool_release (heap->pool, heap);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_d3d12_desc_heap_free (GstD3D12DescHeap * heap)
|
||||
{
|
||||
delete heap;
|
||||
}
|
||||
|
||||
static GstD3D12DescHeap *
|
||||
gst_d3d12_desc_heap_new (ID3D12DescriptorHeap * handle)
|
||||
{
|
||||
auto heap = new GstD3D12DescHeap ();
|
||||
heap->heap = handle;
|
||||
|
||||
gst_mini_object_init (heap, 0, gst_d3d12_desc_heap_get_type (),
|
||||
nullptr, nullptr, (GstMiniObjectFreeFunction) gst_d3d12_desc_heap_free);
|
||||
|
||||
return heap;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_d3d12_desc_heap_pool_acquire:
|
||||
* @pool: a #GstD3D12DescHeapPool
|
||||
* @heap: (out) (transfer full): a pointer to GstD3D12DescHeap
|
||||
*
|
||||
* Acquire #GstD3D12DescHeap object
|
||||
*
|
||||
* Returns: %TRUE if successful
|
||||
*
|
||||
* Since: 1.26
|
||||
*/
|
||||
gboolean
|
||||
gst_d3d12_desc_heap_pool_acquire (GstD3D12DescHeapPool * pool,
|
||||
GstD3D12DescHeap ** heap)
|
||||
{
|
||||
g_return_val_if_fail (GST_IS_D3D12_DESC_HEAP_POOL (pool), FALSE);
|
||||
g_return_val_if_fail (heap, FALSE);
|
||||
|
||||
*heap = nullptr;
|
||||
|
||||
auto priv = pool->priv;
|
||||
GstD3D12DescHeap *new_heap = nullptr;
|
||||
HRESULT hr;
|
||||
|
||||
{
|
||||
std::lock_guard < std::mutex > lk (priv->lock);
|
||||
if (!priv->heap_pool.empty ()) {
|
||||
new_heap = priv->heap_pool.front ();
|
||||
priv->heap_pool.pop ();
|
||||
}
|
||||
}
|
||||
|
||||
if (!new_heap) {
|
||||
ComPtr < ID3D12DescriptorHeap > heap;
|
||||
hr = priv->device->CreateDescriptorHeap (&priv->heap_desc,
|
||||
IID_PPV_ARGS (&heap));
|
||||
if (FAILED (hr)) {
|
||||
GST_ERROR_OBJECT (pool, "Couldn't create descriptor heap, hr: 0x%x",
|
||||
(guint) hr);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
new_heap = gst_d3d12_desc_heap_new (heap.Get ());
|
||||
}
|
||||
|
||||
new_heap->pool = (GstD3D12DescHeapPool *) gst_object_ref (pool);
|
||||
new_heap->dispose =
|
||||
(GstMiniObjectDisposeFunction) gst_d3d12_desc_heap_dispose;
|
||||
|
||||
*heap = new_heap;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_d3d12_desc_heap_ref:
|
||||
* @heap: a #GstD3D12DescHeap
|
||||
*
|
||||
* Increments the refcount of @desc
|
||||
*
|
||||
* Returns: (transfer full): a #GstD3D12DescHeap
|
||||
*
|
||||
* Since: 1.26
|
||||
*/
|
||||
GstD3D12DescHeap *
|
||||
gst_d3d12_desc_heap_ref (GstD3D12DescHeap * heap)
|
||||
{
|
||||
return (GstD3D12DescHeap *) gst_mini_object_ref (heap);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_d3d12_desc_heap_unref:
|
||||
* @heap: a #GstD3D12DescHeap
|
||||
*
|
||||
* Decrements the refcount of @heap
|
||||
*
|
||||
* Since: 1.26
|
||||
*/
|
||||
void
|
||||
gst_d3d12_desc_heap_unref (GstD3D12DescHeap * heap)
|
||||
{
|
||||
gst_mini_object_unref (heap);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_clear_d3d12_desc_heap:
|
||||
* @heap: a pointer to #GstD3D12DescHeap
|
||||
*
|
||||
* Clears a reference to a #GstD3D12DescHeap
|
||||
*
|
||||
* Since: 1.26
|
||||
*/
|
||||
void
|
||||
gst_clear_d3d12_desc_heap (GstD3D12DescHeap ** heap)
|
||||
{
|
||||
gst_clear_mini_object (heap);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_d3d12_desc_heap_get_handle:
|
||||
* @desc: a #GstD3D12DescHeap
|
||||
*
|
||||
* Gets ID3D12DescriptorHeap handle.
|
||||
*
|
||||
* Returns: (transfer none): ID3D12DescriptorHeap handle
|
||||
*
|
||||
* Since: 1.26
|
||||
*/
|
||||
ID3D12DescriptorHeap *
|
||||
gst_d3d12_desc_heap_get_handle (GstD3D12DescHeap * heap)
|
||||
{
|
||||
g_return_val_if_fail (heap, nullptr);
|
||||
|
||||
return heap->heap.Get ();
|
||||
}
|
|
@ -0,0 +1,94 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) 2023 Seungha Yang <seungha@centricular.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <gst/gst.h>
|
||||
#include <gst/video/video.h>
|
||||
#include <gst/d3d12/gstd3d12_fwd.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_D3D12_DESC_HEAP_POOL (gst_d3d12_desc_heap_pool_get_type ())
|
||||
#define GST_D3D12_DESC_HEAP_POOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_D3D12_DESC_HEAP_POOL, GstD3D12DescHeapPool))
|
||||
#define GST_D3D12_DESC_HEAP_POOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_D3D12_DESC_HEAP_POOL, GstD3D12DescHeapPoolClass))
|
||||
#define GST_IS_D3D12_DESC_HEAP_POOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_D3D12_DESC_HEAP_POOL))
|
||||
#define GST_IS_D3D12_DESC_HEAP_POOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_D3D12_DESC_HEAP_POOL))
|
||||
#define GST_D3D12_DESC_HEAP_POOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_D3D12_DESC_HEAP_POOL, GstD3D12DescHeapPoolClass))
|
||||
#define GST_D3D12_DESC_HEAP_POOL_CAST(obj) ((GstD3D12DescHeapPool*)(obj))
|
||||
|
||||
/**
|
||||
* GstD3D12DescHeapPool:
|
||||
*
|
||||
* Opaque GstD3D12DescHeapPool struct
|
||||
*
|
||||
* Since: 1.26
|
||||
*/
|
||||
struct _GstD3D12DescHeapPool
|
||||
{
|
||||
GstObject parent;
|
||||
|
||||
/*< private >*/
|
||||
GstD3D12DescHeapPoolPrivate *priv;
|
||||
gpointer _gst_reserved[GST_PADDING];
|
||||
};
|
||||
|
||||
/**
|
||||
* GstD3D12DescHeapPoolClass:
|
||||
*
|
||||
* Opaque GstD3D12DescHeapPoolClass struct
|
||||
*
|
||||
* Since: 1.26
|
||||
*/
|
||||
struct _GstD3D12DescHeapPoolClass
|
||||
{
|
||||
GstObjectClass parent_class;
|
||||
|
||||
/*< private >*/
|
||||
gpointer _gst_reserved[GST_PADDING];
|
||||
};
|
||||
|
||||
GST_D3D12_API
|
||||
GType gst_d3d12_desc_heap_pool_get_type (void);
|
||||
|
||||
GST_D3D12_API
|
||||
GType gst_d3d12_desc_heap_get_type (void);
|
||||
|
||||
GST_D3D12_API
|
||||
GstD3D12DescHeapPool * gst_d3d12_desc_heap_pool_new (ID3D12Device * device,
|
||||
const D3D12_DESCRIPTOR_HEAP_DESC * desc);
|
||||
|
||||
GST_D3D12_API
|
||||
gboolean gst_d3d12_desc_heap_pool_acquire (GstD3D12DescHeapPool * pool,
|
||||
GstD3D12DescHeap ** heap);
|
||||
|
||||
GST_D3D12_API
|
||||
GstD3D12DescHeap * gst_d3d12_desc_heap_ref (GstD3D12DescHeap * heap);
|
||||
|
||||
GST_D3D12_API
|
||||
void gst_d3d12_desc_heap_unref (GstD3D12DescHeap * heap);
|
||||
|
||||
GST_D3D12_API
|
||||
void gst_clear_d3d12_desc_heap (GstD3D12DescHeap ** heap);
|
||||
|
||||
GST_D3D12_API
|
||||
ID3D12DescriptorHeap * gst_d3d12_desc_heap_get_handle (GstD3D12DescHeap * heap);
|
||||
|
||||
G_END_DECLS
|
||||
|
|
@ -1,281 +0,0 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) 2023 Seungha Yang <seungha@centricular.com>
|
||||
*
|
||||
* This library is free software; you cln redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "gstd3d12.h"
|
||||
#include <wrl.h>
|
||||
#include <queue>
|
||||
#include <mutex>
|
||||
|
||||
GST_DEBUG_CATEGORY_STATIC (gst_d3d12_descriptor_pool_debug);
|
||||
#define GST_CAT_DEFAULT gst_d3d12_descriptor_pool_debug
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
using namespace Microsoft::WRL;
|
||||
|
||||
struct _GstD3D12Descriptor : public GstMiniObject
|
||||
{
|
||||
GstD3D12DescriptorPool *pool = nullptr;
|
||||
ComPtr < ID3D12DescriptorHeap > heap;
|
||||
};
|
||||
|
||||
struct _GstD3D12DescriptorPoolPrivate
|
||||
{
|
||||
~_GstD3D12DescriptorPoolPrivate ()
|
||||
{
|
||||
while (!heap_pool.empty ()) {
|
||||
auto desc = heap_pool.front ();
|
||||
heap_pool.pop ();
|
||||
gst_mini_object_unref (desc);
|
||||
}
|
||||
}
|
||||
|
||||
ComPtr<ID3D12Device> device;
|
||||
|
||||
std::mutex lock;
|
||||
std::queue<GstD3D12Descriptor *>heap_pool;
|
||||
D3D12_DESCRIPTOR_HEAP_DESC heap_desc;
|
||||
};
|
||||
/* *INDENT-ON* */
|
||||
|
||||
GST_DEFINE_MINI_OBJECT_TYPE (GstD3D12Descriptor, gst_d3d12_descriptor);
|
||||
|
||||
static void gst_d3d12_descriptor_pool_finalize (GObject * object);
|
||||
|
||||
#define gst_d3d12_descriptor_pool_parent_class parent_class
|
||||
G_DEFINE_TYPE (GstD3D12DescriptorPool,
|
||||
gst_d3d12_descriptor_pool, GST_TYPE_OBJECT);
|
||||
|
||||
static void
|
||||
gst_d3d12_descriptor_pool_class_init (GstD3D12DescriptorPoolClass * klass)
|
||||
{
|
||||
auto object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->finalize = gst_d3d12_descriptor_pool_finalize;
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (gst_d3d12_descriptor_pool_debug,
|
||||
"d3d12descriptorpool", 0, "d3d12descriptorpool");
|
||||
}
|
||||
|
||||
static void
|
||||
gst_d3d12_descriptor_pool_init (GstD3D12DescriptorPool * self)
|
||||
{
|
||||
self->priv = new GstD3D12DescriptorPoolPrivate ();
|
||||
}
|
||||
|
||||
static void
|
||||
gst_d3d12_descriptor_pool_finalize (GObject * object)
|
||||
{
|
||||
auto self = GST_D3D12_DESCRIPTOR_POOL (object);
|
||||
|
||||
delete self->priv;
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_d3d12_descriptor_pool_new:
|
||||
* @device: a #GstD3D12Device
|
||||
* @type: D3D12_DESCRIPTOR_HEAP_DESC
|
||||
*
|
||||
* Returns: (transfer full): a new #GstD3D12DescriptorPool instance
|
||||
*
|
||||
* Since: 1.26
|
||||
*/
|
||||
GstD3D12DescriptorPool *
|
||||
gst_d3d12_descriptor_pool_new (ID3D12Device * device,
|
||||
const D3D12_DESCRIPTOR_HEAP_DESC * desc)
|
||||
{
|
||||
g_return_val_if_fail (device, nullptr);
|
||||
g_return_val_if_fail (desc, nullptr);
|
||||
|
||||
auto self = (GstD3D12DescriptorPool *)
|
||||
g_object_new (GST_TYPE_D3D12_DESCRIPTOR_POOL, nullptr);
|
||||
gst_object_ref_sink (self);
|
||||
|
||||
auto priv = self->priv;
|
||||
priv->device = device;
|
||||
priv->heap_desc = *desc;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_d3d12_descriptor_pool_release (GstD3D12DescriptorPool * pool,
|
||||
GstD3D12Descriptor * desc)
|
||||
{
|
||||
auto priv = pool->priv;
|
||||
{
|
||||
std::lock_guard < std::mutex > lk (priv->lock);
|
||||
desc->dispose = nullptr;
|
||||
desc->pool = nullptr;
|
||||
priv->heap_pool.push (desc);
|
||||
}
|
||||
|
||||
gst_object_unref (pool);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_d3d12_descriptor_dispose (GstD3D12Descriptor * desc)
|
||||
{
|
||||
if (!desc->pool)
|
||||
return TRUE;
|
||||
|
||||
gst_mini_object_ref (desc);
|
||||
gst_d3d12_descriptor_pool_release (desc->pool, desc);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_d3d12_descriptor_free (GstD3D12Descriptor * desc)
|
||||
{
|
||||
delete desc;
|
||||
}
|
||||
|
||||
static GstD3D12Descriptor *
|
||||
gst_d3d12_descriptor_new (ID3D12DescriptorHeap * heap)
|
||||
{
|
||||
auto desc = new GstD3D12Descriptor ();
|
||||
desc->heap = heap;
|
||||
|
||||
gst_mini_object_init (desc, 0, gst_d3d12_descriptor_get_type (),
|
||||
nullptr, nullptr, (GstMiniObjectFreeFunction) gst_d3d12_descriptor_free);
|
||||
|
||||
return desc;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_d3d12_descriptor_pool_acquire:
|
||||
* @pool: a #GstD3D12DescriptorPool
|
||||
* @cmd: (out) (transfer full): a pointer to GstD3D12Descriptor
|
||||
*
|
||||
* Acquire #GstD3D12Descriptor object
|
||||
*
|
||||
* Returns: %TRUE if successful
|
||||
*
|
||||
* Since: 1.26
|
||||
*/
|
||||
gboolean
|
||||
gst_d3d12_descriptor_pool_acquire (GstD3D12DescriptorPool * pool,
|
||||
GstD3D12Descriptor ** desc)
|
||||
{
|
||||
g_return_val_if_fail (GST_IS_D3D12_DESCRIPTOR_POOL (pool), FALSE);
|
||||
g_return_val_if_fail (desc, FALSE);
|
||||
|
||||
*desc = nullptr;
|
||||
|
||||
auto priv = pool->priv;
|
||||
GstD3D12Descriptor *new_desc = nullptr;
|
||||
HRESULT hr;
|
||||
|
||||
{
|
||||
std::lock_guard < std::mutex > lk (priv->lock);
|
||||
if (!priv->heap_pool.empty ()) {
|
||||
new_desc = priv->heap_pool.front ();
|
||||
priv->heap_pool.pop ();
|
||||
}
|
||||
}
|
||||
|
||||
if (!new_desc) {
|
||||
ComPtr < ID3D12DescriptorHeap > heap;
|
||||
hr = priv->device->CreateDescriptorHeap (&priv->heap_desc,
|
||||
IID_PPV_ARGS (&heap));
|
||||
if (FAILED (hr)) {
|
||||
GST_ERROR_OBJECT (pool, "Couldn't create descriptor heap, hr: 0x%x",
|
||||
(guint) hr);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
new_desc = gst_d3d12_descriptor_new (heap.Get ());
|
||||
}
|
||||
|
||||
new_desc->pool = (GstD3D12DescriptorPool *) gst_object_ref (pool);
|
||||
new_desc->dispose =
|
||||
(GstMiniObjectDisposeFunction) gst_d3d12_descriptor_dispose;
|
||||
|
||||
*desc = new_desc;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_d3d12_descriptor_ref:
|
||||
* @desc: a #GstD3D12Descriptor
|
||||
*
|
||||
* Increments the refcount of @desc
|
||||
*
|
||||
* Returns: (transfer full): a #GstD3D12Descriptor
|
||||
*
|
||||
* Since: 1.26
|
||||
*/
|
||||
GstD3D12Descriptor *
|
||||
gst_d3d12_descriptor_ref (GstD3D12Descriptor * desc)
|
||||
{
|
||||
return (GstD3D12Descriptor *) gst_mini_object_ref (desc);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_d3d12_descriptor_unref:
|
||||
* @desc: a #GstD3D12Descriptor
|
||||
*
|
||||
* Decrements the refcount of @desc
|
||||
*
|
||||
* Since: 1.26
|
||||
*/
|
||||
void
|
||||
gst_d3d12_descriptor_unref (GstD3D12Descriptor * desc)
|
||||
{
|
||||
gst_mini_object_unref (desc);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_clear_d3d12_descriptor:
|
||||
* @desc: a pointer to #GstD3D12Descriptor
|
||||
*
|
||||
* Clears a reference to a #GstD3D12Descriptor
|
||||
*
|
||||
* Since: 1.26
|
||||
*/
|
||||
void
|
||||
gst_clear_d3d12_descriptor (GstD3D12Descriptor ** desc)
|
||||
{
|
||||
gst_clear_mini_object (desc);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_d3d12_descriptor_get_handle:
|
||||
* @desc: a #GstD3D12Descriptor
|
||||
*
|
||||
* Gets ID3D12DescriptorHeap handle.
|
||||
*
|
||||
* Returns: (transfer none): ID3D12DescriptorHeap handle
|
||||
*
|
||||
* Since: 1.26
|
||||
*/
|
||||
ID3D12DescriptorHeap *
|
||||
gst_d3d12_descriptor_get_handle (GstD3D12Descriptor * desc)
|
||||
{
|
||||
g_return_val_if_fail (desc, nullptr);
|
||||
|
||||
return desc->heap.Get ();
|
||||
}
|
|
@ -1,94 +0,0 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) 2023 Seungha Yang <seungha@centricular.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <gst/gst.h>
|
||||
#include <gst/video/video.h>
|
||||
#include <gst/d3d12/gstd3d12_fwd.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_D3D12_DESCRIPTOR_POOL (gst_d3d12_descriptor_pool_get_type ())
|
||||
#define GST_D3D12_DESCRIPTOR_POOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_D3D12_DESCRIPTOR_POOL, GstD3D12DescriptorPool))
|
||||
#define GST_D3D12_DESCRIPTOR_POOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_D3D12_DESCRIPTOR_POOL, GstD3D12DescriptorPoolClass))
|
||||
#define GST_IS_D3D12_DESCRIPTOR_POOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_D3D12_DESCRIPTOR_POOL))
|
||||
#define GST_IS_D3D12_DESCRIPTOR_POOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_D3D12_DESCRIPTOR_POOL))
|
||||
#define GST_D3D12_DESCRIPTOR_POOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_D3D12_DESCRIPTOR_POOL, GstD3D12DescriptorPoolClass))
|
||||
#define GST_D3D12_DESCRIPTOR_POOL_CAST(obj) ((GstD3D12DescriptorPool*)(obj))
|
||||
|
||||
/**
|
||||
* GstD3D12DescriptorPool:
|
||||
*
|
||||
* Opaque GstD3D12DescriptorPool struct
|
||||
*
|
||||
* Since: 1.26
|
||||
*/
|
||||
struct _GstD3D12DescriptorPool
|
||||
{
|
||||
GstObject parent;
|
||||
|
||||
/*< private >*/
|
||||
GstD3D12DescriptorPoolPrivate *priv;
|
||||
gpointer _gst_reserved[GST_PADDING];
|
||||
};
|
||||
|
||||
/**
|
||||
* GstD3D12DescriptorPoolClass:
|
||||
*
|
||||
* Opaque GstD3D12DescriptorPoolClass struct
|
||||
*
|
||||
* Since: 1.26
|
||||
*/
|
||||
struct _GstD3D12DescriptorPoolClass
|
||||
{
|
||||
GstObjectClass parent_class;
|
||||
|
||||
/*< private >*/
|
||||
gpointer _gst_reserved[GST_PADDING];
|
||||
};
|
||||
|
||||
GST_D3D12_API
|
||||
GType gst_d3d12_descriptor_pool_get_type (void);
|
||||
|
||||
GST_D3D12_API
|
||||
GType gst_d3d12_descriptor_get_type (void);
|
||||
|
||||
GST_D3D12_API
|
||||
GstD3D12DescriptorPool * gst_d3d12_descriptor_pool_new (ID3D12Device * device,
|
||||
const D3D12_DESCRIPTOR_HEAP_DESC * desc);
|
||||
|
||||
GST_D3D12_API
|
||||
gboolean gst_d3d12_descriptor_pool_acquire (GstD3D12DescriptorPool * pool,
|
||||
GstD3D12Descriptor ** desc);
|
||||
|
||||
GST_D3D12_API
|
||||
GstD3D12Descriptor * gst_d3d12_descriptor_ref (GstD3D12Descriptor * desc);
|
||||
|
||||
GST_D3D12_API
|
||||
void gst_d3d12_descriptor_unref (GstD3D12Descriptor * desc);
|
||||
|
||||
GST_D3D12_API
|
||||
void gst_clear_d3d12_descriptor (GstD3D12Descriptor ** desc);
|
||||
|
||||
GST_D3D12_API
|
||||
ID3D12DescriptorHeap * gst_d3d12_descriptor_get_handle (GstD3D12Descriptor * desc);
|
||||
|
||||
G_END_DECLS
|
||||
|
|
@ -81,7 +81,7 @@ GST_D3D12_API
|
|||
void gst_d3d12_device_check_device_removed (GstD3D12Device * device);
|
||||
|
||||
GST_D3D12_API
|
||||
GstD3D12CommandQueue * gst_d3d12_device_get_decode_queue (GstD3D12Device * device);
|
||||
GstD3D12CmdQueue * gst_d3d12_device_get_decode_queue (GstD3D12Device * device);
|
||||
|
||||
GST_D3D12_API
|
||||
void gst_d3d12_device_decoder_lock (GstD3D12Device * device);
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include "gstd3d12.h"
|
||||
#include "gstd3d12-private.h"
|
||||
#include "gstd3d12commandlistpool.h"
|
||||
#include "gstd3d12cmdlistpool.h"
|
||||
#include <directx/d3dx12.h>
|
||||
#include <d3d11on12.h>
|
||||
#include <wrl.h>
|
||||
|
@ -160,16 +160,16 @@ struct DeviceInner
|
|||
void Drain ()
|
||||
{
|
||||
if (direct_queue)
|
||||
gst_d3d12_command_queue_drain (direct_queue);
|
||||
gst_d3d12_cmd_queue_drain (direct_queue);
|
||||
|
||||
if (compute_queue)
|
||||
gst_d3d12_command_queue_drain (compute_queue);
|
||||
gst_d3d12_cmd_queue_drain (compute_queue);
|
||||
|
||||
if (copy_queue)
|
||||
gst_d3d12_command_queue_drain (copy_queue);
|
||||
gst_d3d12_cmd_queue_drain (copy_queue);
|
||||
|
||||
for (guint i = 0; i < num_decode_queue; i++)
|
||||
gst_d3d12_command_queue_drain (decode_queue[i]);
|
||||
gst_d3d12_cmd_queue_drain (decode_queue[i]);
|
||||
}
|
||||
|
||||
void ReportLiveObjects ()
|
||||
|
@ -244,23 +244,23 @@ struct DeviceInner
|
|||
|
||||
ComPtr<ID3D12InfoQueue> info_queue;
|
||||
|
||||
GstD3D12CommandQueue *direct_queue = nullptr;
|
||||
GstD3D12CommandQueue *compute_queue = nullptr;
|
||||
GstD3D12CommandQueue *copy_queue = nullptr;
|
||||
GstD3D12CommandQueue *decode_queue[2] = { nullptr, };
|
||||
GstD3D12CmdQueue *direct_queue = nullptr;
|
||||
GstD3D12CmdQueue *compute_queue = nullptr;
|
||||
GstD3D12CmdQueue *copy_queue = nullptr;
|
||||
GstD3D12CmdQueue *decode_queue[2] = { nullptr, };
|
||||
guint num_decode_queue = 0;
|
||||
guint decode_queue_index = 0;
|
||||
std::recursive_mutex decoder_lock;
|
||||
GstD3D12WAFlags wa_flags = GST_D3D12_WA_NONE;
|
||||
|
||||
GstD3D12CommandListPool *direct_cl_pool = nullptr;
|
||||
GstD3D12CommandAllocatorPool *direct_ca_pool = nullptr;
|
||||
GstD3D12CmdListPool *direct_cl_pool = nullptr;
|
||||
GstD3D12CmdAllocPool *direct_ca_pool = nullptr;
|
||||
|
||||
GstD3D12CommandListPool *compute_cl_pool = nullptr;
|
||||
GstD3D12CommandAllocatorPool *compute_ca_pool = nullptr;
|
||||
GstD3D12CmdListPool *compute_cl_pool = nullptr;
|
||||
GstD3D12CmdAllocPool *compute_ca_pool = nullptr;
|
||||
|
||||
GstD3D12CommandListPool *copy_cl_pool = nullptr;
|
||||
GstD3D12CommandAllocatorPool *copy_ca_pool = nullptr;
|
||||
GstD3D12CmdListPool *copy_cl_pool = nullptr;
|
||||
GstD3D12CmdAllocPool *copy_ca_pool = nullptr;
|
||||
|
||||
GstD3D12FenceDataPool *fence_data_pool = nullptr;
|
||||
|
||||
|
@ -1298,49 +1298,49 @@ gst_d3d12_device_new_internal (const GstD3D12DeviceConstructData * data)
|
|||
queue_desc.Type = D3D12_COMMAND_LIST_TYPE_DIRECT;
|
||||
queue_desc.Flags = D3D12_COMMAND_QUEUE_FLAG_NONE;
|
||||
|
||||
priv->direct_queue = gst_d3d12_command_queue_new (device.Get (),
|
||||
priv->direct_queue = gst_d3d12_cmd_queue_new (device.Get (),
|
||||
&queue_desc, D3D12_FENCE_FLAG_SHARED, 32);
|
||||
if (!priv->direct_queue)
|
||||
goto error;
|
||||
|
||||
priv->direct_cl_pool = gst_d3d12_command_list_pool_new (device.Get (),
|
||||
priv->direct_cl_pool = gst_d3d12_cmd_list_pool_new (device.Get (),
|
||||
D3D12_COMMAND_LIST_TYPE_DIRECT);
|
||||
if (!priv->direct_cl_pool)
|
||||
goto error;
|
||||
|
||||
priv->direct_ca_pool = gst_d3d12_command_allocator_pool_new (device.Get (),
|
||||
priv->direct_ca_pool = gst_d3d12_cmd_alloc_pool_new (device.Get (),
|
||||
D3D12_COMMAND_LIST_TYPE_DIRECT);
|
||||
if (!priv->direct_ca_pool)
|
||||
goto error;
|
||||
|
||||
queue_desc.Type = D3D12_COMMAND_LIST_TYPE_COMPUTE;
|
||||
priv->compute_queue = gst_d3d12_command_queue_new (device.Get (),
|
||||
priv->compute_queue = gst_d3d12_cmd_queue_new (device.Get (),
|
||||
&queue_desc, D3D12_FENCE_FLAG_SHARED, 32);
|
||||
if (!priv->compute_queue)
|
||||
goto error;
|
||||
|
||||
priv->compute_cl_pool = gst_d3d12_command_list_pool_new (device.Get (),
|
||||
priv->compute_cl_pool = gst_d3d12_cmd_list_pool_new (device.Get (),
|
||||
D3D12_COMMAND_LIST_TYPE_COMPUTE);
|
||||
if (!priv->compute_cl_pool)
|
||||
goto error;
|
||||
|
||||
priv->compute_ca_pool = gst_d3d12_command_allocator_pool_new (device.Get (),
|
||||
priv->compute_ca_pool = gst_d3d12_cmd_alloc_pool_new (device.Get (),
|
||||
D3D12_COMMAND_LIST_TYPE_COMPUTE);
|
||||
if (!priv->compute_ca_pool)
|
||||
goto error;
|
||||
|
||||
queue_desc.Type = D3D12_COMMAND_LIST_TYPE_COPY;
|
||||
priv->copy_queue = gst_d3d12_command_queue_new (device.Get (),
|
||||
priv->copy_queue = gst_d3d12_cmd_queue_new (device.Get (),
|
||||
&queue_desc, D3D12_FENCE_FLAG_NONE, 32);
|
||||
if (!priv->copy_queue)
|
||||
goto error;
|
||||
|
||||
priv->copy_cl_pool = gst_d3d12_command_list_pool_new (device.Get (),
|
||||
priv->copy_cl_pool = gst_d3d12_cmd_list_pool_new (device.Get (),
|
||||
D3D12_COMMAND_LIST_TYPE_COPY);
|
||||
if (!priv->copy_cl_pool)
|
||||
goto error;
|
||||
|
||||
priv->copy_ca_pool = gst_d3d12_command_allocator_pool_new (device.Get (),
|
||||
priv->copy_ca_pool = gst_d3d12_cmd_alloc_pool_new (device.Get (),
|
||||
D3D12_COMMAND_LIST_TYPE_COPY);
|
||||
if (!priv->copy_ca_pool)
|
||||
goto error;
|
||||
|
@ -1356,7 +1356,7 @@ gst_d3d12_device_new_internal (const GstD3D12DeviceConstructData * data)
|
|||
if (SUCCEEDED (hr)) {
|
||||
queue_desc.Type = D3D12_COMMAND_LIST_TYPE_VIDEO_DECODE;
|
||||
for (guint i = 0; i < G_N_ELEMENTS (priv->decode_queue); i++) {
|
||||
priv->decode_queue[i] = gst_d3d12_command_queue_new (device.Get (),
|
||||
priv->decode_queue[i] = gst_d3d12_cmd_queue_new (device.Get (),
|
||||
&queue_desc, D3D12_FENCE_FLAG_NONE, 8);
|
||||
if (!priv->decode_queue[i])
|
||||
break;
|
||||
|
@ -1519,7 +1519,7 @@ gst_d3d12_device_get_factory_handle (GstD3D12Device * device)
|
|||
return device->priv->inner->factory.Get ();
|
||||
}
|
||||
|
||||
static GstD3D12CommandQueue *
|
||||
static GstD3D12CmdQueue *
|
||||
gst_d3d12_device_get_queue_unchecked (GstD3D12Device * device,
|
||||
D3D12_COMMAND_LIST_TYPE queue_type)
|
||||
{
|
||||
|
@ -1561,7 +1561,7 @@ gst_d3d12_device_get_fence_handle (GstD3D12Device * device,
|
|||
if (!queue)
|
||||
return nullptr;
|
||||
|
||||
return gst_d3d12_command_queue_get_fence_handle (queue);
|
||||
return gst_d3d12_cmd_queue_get_fence_handle (queue);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1595,18 +1595,18 @@ gst_d3d12_device_get_format (GstD3D12Device * device,
|
|||
}
|
||||
|
||||
/**
|
||||
* gst_d3d12_device_get_command_queue:
|
||||
* gst_d3d12_device_get_cmd_queue:
|
||||
* @device: a #GstD3D12Device
|
||||
* @queue_type: a D3D12_COMMAND_LIST_TYPE
|
||||
*
|
||||
* Gets #GstD3D12CommandQueue corresponding to @queue_type
|
||||
* Gets #GstD3D12CmdQueue corresponding to @queue_type
|
||||
*
|
||||
* Returns: (transfer none): a #GstD3D12CommandQueue
|
||||
* Returns: (transfer none): a #GstD3D12CmdQueue
|
||||
*
|
||||
* Since: 1.26
|
||||
*/
|
||||
GstD3D12CommandQueue *
|
||||
gst_d3d12_device_get_command_queue (GstD3D12Device * device,
|
||||
GstD3D12CmdQueue *
|
||||
gst_d3d12_device_get_cmd_queue (GstD3D12Device * device,
|
||||
D3D12_COMMAND_LIST_TYPE queue_type)
|
||||
{
|
||||
g_return_val_if_fail (GST_IS_D3D12_DEVICE (device), nullptr);
|
||||
|
@ -1622,8 +1622,8 @@ gst_d3d12_device_get_command_queue (GstD3D12Device * device,
|
|||
* @command_lists: array of ID3D12CommandList
|
||||
* @fence_value: (out) (optional): fence value of submitted command
|
||||
*
|
||||
* Exectues gst_d3d12_command_queue_execute_command_lists ()
|
||||
* using a #GstD3D12CommandQueue corresponding to @queue_type
|
||||
* Exectues gst_d3d12_cmd_queue_execute_command_lists ()
|
||||
* using a #GstD3D12CmdQueue corresponding to @queue_type
|
||||
*
|
||||
* Returns: HRESULT code
|
||||
*
|
||||
|
@ -1640,7 +1640,7 @@ gst_d3d12_device_execute_command_lists (GstD3D12Device * device,
|
|||
if (!queue)
|
||||
return E_INVALIDARG;
|
||||
|
||||
return gst_d3d12_command_queue_execute_command_lists (queue,
|
||||
return gst_d3d12_cmd_queue_execute_command_lists (queue,
|
||||
num_command_lists, command_lists, fence_value);
|
||||
}
|
||||
|
||||
|
@ -1649,8 +1649,8 @@ gst_d3d12_device_execute_command_lists (GstD3D12Device * device,
|
|||
* @device: a #GstD3D12Device
|
||||
* @queue_type: a D3D12_COMMAND_LIST_TYPE
|
||||
*
|
||||
* Exectues gst_d3d12_command_queue_get_completed_value ()
|
||||
* using a #GstD3D12CommandQueue corresponding to @queue_type
|
||||
* Exectues gst_d3d12_cmd_queue_get_completed_value ()
|
||||
* using a #GstD3D12CmdQueue corresponding to @queue_type
|
||||
*
|
||||
* Returns: Completed fence value
|
||||
*
|
||||
|
@ -1666,7 +1666,7 @@ gst_d3d12_device_get_completed_value (GstD3D12Device * device,
|
|||
if (!queue)
|
||||
return G_MAXUINT64;
|
||||
|
||||
return gst_d3d12_command_queue_get_completed_value (queue);
|
||||
return gst_d3d12_cmd_queue_get_completed_value (queue);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1677,8 +1677,8 @@ gst_d3d12_device_get_completed_value (GstD3D12Device * device,
|
|||
* @fence_data: user data
|
||||
* @notify: a #GDestroyNotify
|
||||
*
|
||||
* Exectues gst_d3d12_command_queue_set_notify ()
|
||||
* using a #GstD3D12CommandQueue corresponding to @queue_type
|
||||
* Exectues gst_d3d12_cmd_queue_set_notify ()
|
||||
* using a #GstD3D12CmdQueue corresponding to @queue_type
|
||||
*
|
||||
* Returns: %TRUE if successful
|
||||
*
|
||||
|
@ -1696,7 +1696,7 @@ gst_d3d12_device_set_fence_notify (GstD3D12Device * device,
|
|||
if (!queue)
|
||||
return FALSE;
|
||||
|
||||
gst_d3d12_command_queue_set_notify (queue, fence_value, fence_data, notify);
|
||||
gst_d3d12_cmd_queue_set_notify (queue, fence_value, fence_data, notify);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -1707,8 +1707,8 @@ gst_d3d12_device_set_fence_notify (GstD3D12Device * device,
|
|||
* @queue_type: a D3D12_COMMAND_LIST_TYPE
|
||||
* @fence_value: target fence value
|
||||
*
|
||||
* Exectues gst_d3d12_command_queue_fence_wait ()
|
||||
* using a #GstD3D12CommandQueue corresponding to @queue_type
|
||||
* Exectues gst_d3d12_cmd_queue_fence_wait ()
|
||||
* using a #GstD3D12CmdQueue corresponding to @queue_type
|
||||
*
|
||||
* Returns: HRESULT code
|
||||
*
|
||||
|
@ -1724,7 +1724,7 @@ gst_d3d12_device_fence_wait (GstD3D12Device * device,
|
|||
if (!queue)
|
||||
return E_INVALIDARG;
|
||||
|
||||
return gst_d3d12_command_queue_fence_wait (queue, fence_value);
|
||||
return gst_d3d12_cmd_queue_fence_wait (queue, fence_value);
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
@ -1740,11 +1740,11 @@ gst_d3d12_device_copy_texture_region (GstD3D12Device * device,
|
|||
|
||||
HRESULT hr;
|
||||
auto priv = device->priv->inner;
|
||||
GstD3D12CommandAllocatorPool *ca_pool;
|
||||
GstD3D12CommandAllocator *gst_ca = nullptr;
|
||||
GstD3D12CommandListPool *cl_pool;
|
||||
GstD3D12CommandList *gst_cl = nullptr;
|
||||
GstD3D12CommandQueue *queue = nullptr;
|
||||
GstD3D12CmdAllocPool *ca_pool;
|
||||
GstD3D12CmdAlloc *gst_ca = nullptr;
|
||||
GstD3D12CmdListPool *cl_pool;
|
||||
GstD3D12CmdList *gst_cl = nullptr;
|
||||
GstD3D12CmdQueue *queue = nullptr;
|
||||
guint64 fence_val = 0;
|
||||
|
||||
if (!fence_data)
|
||||
|
@ -1773,7 +1773,7 @@ gst_d3d12_device_copy_texture_region (GstD3D12Device * device,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
gst_d3d12_command_allocator_pool_acquire (ca_pool, &gst_ca);
|
||||
gst_d3d12_cmd_alloc_pool_acquire (ca_pool, &gst_ca);
|
||||
if (!gst_ca) {
|
||||
GST_ERROR_OBJECT (device, "Couldn't acquire command allocator");
|
||||
gst_d3d12_fence_data_unref (fence_data);
|
||||
|
@ -1782,8 +1782,8 @@ gst_d3d12_device_copy_texture_region (GstD3D12Device * device,
|
|||
|
||||
gst_d3d12_fence_data_push (fence_data, FENCE_NOTIFY_MINI_OBJECT (gst_ca));
|
||||
|
||||
auto ca = gst_d3d12_command_allocator_get_handle (gst_ca);
|
||||
gst_d3d12_command_list_pool_acquire (cl_pool, ca, &gst_cl);
|
||||
auto ca = gst_d3d12_cmd_alloc_get_handle (gst_ca);
|
||||
gst_d3d12_cmd_list_pool_acquire (cl_pool, ca, &gst_cl);
|
||||
|
||||
if (!gst_cl) {
|
||||
GST_ERROR_OBJECT (device, "Couldn't acquire command list");
|
||||
|
@ -1794,7 +1794,7 @@ gst_d3d12_device_copy_texture_region (GstD3D12Device * device,
|
|||
ComPtr < ID3D12CommandList > cl_base;
|
||||
ComPtr < ID3D12GraphicsCommandList > cl;
|
||||
|
||||
cl_base = gst_d3d12_command_list_get_handle (gst_cl);
|
||||
cl_base = gst_d3d12_cmd_list_get_handle (gst_cl);
|
||||
cl_base.As (&cl);
|
||||
|
||||
for (guint i = 0; i < num_args; i++) {
|
||||
|
@ -1806,23 +1806,23 @@ gst_d3d12_device_copy_texture_region (GstD3D12Device * device,
|
|||
hr = cl->Close ();
|
||||
if (!gst_d3d12_result (hr, device)) {
|
||||
GST_ERROR_OBJECT (device, "Couldn't close command list");
|
||||
gst_clear_d3d12_command_list (&gst_cl);
|
||||
gst_clear_d3d12_cmd_list (&gst_cl);
|
||||
gst_d3d12_fence_data_unref (fence_data);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
ID3D12CommandList *cmd_list[] = { cl.Get () };
|
||||
|
||||
hr = gst_d3d12_command_queue_execute_command_lists_full (queue,
|
||||
hr = gst_d3d12_cmd_queue_execute_command_lists_full (queue,
|
||||
num_fences_to_wait, fences_to_wait, fence_values_to_wait, 1, cmd_list,
|
||||
&fence_val);
|
||||
auto ret = gst_d3d12_result (hr, device);
|
||||
|
||||
/* We can release command list since command list pool will hold it */
|
||||
gst_d3d12_command_list_unref (gst_cl);
|
||||
gst_d3d12_cmd_list_unref (gst_cl);
|
||||
|
||||
if (ret) {
|
||||
gst_d3d12_command_queue_set_notify (queue, fence_val, fence_data,
|
||||
gst_d3d12_cmd_queue_set_notify (queue, fence_val, fence_data,
|
||||
(GDestroyNotify) gst_d3d12_fence_data_unref);
|
||||
} else {
|
||||
gst_d3d12_fence_data_unref (fence_data);
|
||||
|
@ -1975,24 +1975,24 @@ gst_d3d12_device_clear_yuv_texture (GstD3D12Device * device, GstMemory * mem)
|
|||
if (!gst_d3d12_memory_get_plane_rectangle (dmem, 1, &rect))
|
||||
return;
|
||||
|
||||
GstD3D12CommandAllocator *gst_ca = nullptr;
|
||||
gst_d3d12_command_allocator_pool_acquire (priv->direct_ca_pool, &gst_ca);
|
||||
GstD3D12CmdAlloc *gst_ca = nullptr;
|
||||
gst_d3d12_cmd_alloc_pool_acquire (priv->direct_ca_pool, &gst_ca);
|
||||
if (!gst_ca)
|
||||
return;
|
||||
|
||||
auto ca = gst_d3d12_command_allocator_get_handle (gst_ca);
|
||||
auto ca = gst_d3d12_cmd_alloc_get_handle (gst_ca);
|
||||
|
||||
GstD3D12CommandList *gst_cl = nullptr;
|
||||
gst_d3d12_command_list_pool_acquire (priv->direct_cl_pool, ca, &gst_cl);
|
||||
GstD3D12CmdList *gst_cl = nullptr;
|
||||
gst_d3d12_cmd_list_pool_acquire (priv->direct_cl_pool, ca, &gst_cl);
|
||||
if (!gst_cl) {
|
||||
gst_d3d12_command_allocator_unref (gst_ca);
|
||||
gst_d3d12_cmd_alloc_unref (gst_ca);
|
||||
return;
|
||||
}
|
||||
|
||||
ComPtr < ID3D12CommandList > cl_base;
|
||||
ComPtr < ID3D12GraphicsCommandList > cl;
|
||||
|
||||
cl_base = gst_d3d12_command_list_get_handle (gst_cl);
|
||||
cl_base = gst_d3d12_cmd_list_get_handle (gst_cl);
|
||||
cl_base.As (&cl);
|
||||
|
||||
auto rtv_handle =
|
||||
|
@ -2004,25 +2004,25 @@ gst_d3d12_device_clear_yuv_texture (GstD3D12Device * device, GstMemory * mem)
|
|||
|
||||
auto hr = cl->Close ();
|
||||
if (!gst_d3d12_result (hr, device)) {
|
||||
gst_clear_d3d12_command_list (&gst_cl);
|
||||
gst_clear_d3d12_command_allocator (&gst_ca);
|
||||
gst_clear_d3d12_cmd_list (&gst_cl);
|
||||
gst_clear_d3d12_cmd_alloc (&gst_ca);
|
||||
return;
|
||||
}
|
||||
|
||||
ID3D12CommandList *cmd_list[] = { cl.Get () };
|
||||
guint64 fence_val = 0;
|
||||
auto fence = gst_d3d12_command_queue_get_fence_handle (priv->direct_queue);
|
||||
hr = gst_d3d12_command_queue_execute_command_lists (priv->direct_queue,
|
||||
auto fence = gst_d3d12_cmd_queue_get_fence_handle (priv->direct_queue);
|
||||
hr = gst_d3d12_cmd_queue_execute_command_lists (priv->direct_queue,
|
||||
1, cmd_list, &fence_val);
|
||||
auto ret = gst_d3d12_result (hr, device);
|
||||
gst_d3d12_command_list_unref (gst_cl);
|
||||
gst_d3d12_cmd_list_unref (gst_cl);
|
||||
|
||||
if (ret) {
|
||||
gst_d3d12_command_queue_set_notify (priv->direct_queue, fence_val,
|
||||
gst_ca, (GDestroyNotify) gst_d3d12_command_allocator_unref);
|
||||
gst_d3d12_cmd_queue_set_notify (priv->direct_queue, fence_val,
|
||||
gst_ca, (GDestroyNotify) gst_d3d12_cmd_alloc_unref);
|
||||
gst_d3d12_memory_set_fence (dmem, fence, fence_val, FALSE);
|
||||
} else {
|
||||
gst_d3d12_command_allocator_unref (gst_ca);
|
||||
gst_d3d12_cmd_alloc_unref (gst_ca);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2076,8 +2076,7 @@ gst_d3d12_device_get_11on12_handle (GstD3D12Device * device)
|
|||
D3D_FEATURE_LEVEL_11_0,
|
||||
};
|
||||
|
||||
IUnknown *cq[] =
|
||||
{ gst_d3d12_command_queue_get_handle (priv->direct_queue) };
|
||||
IUnknown *cq[] = { gst_d3d12_cmd_queue_get_handle (priv->direct_queue) };
|
||||
ComPtr < ID3D11Device > device11;
|
||||
auto hr = GstD3D11On12CreateDevice (priv->device.Get (),
|
||||
D3D11_CREATE_DEVICE_BGRA_SUPPORT, feature_levels,
|
||||
|
@ -2129,7 +2128,7 @@ gst_d3d12_device_check_device_removed (GstD3D12Device * device)
|
|||
}
|
||||
}
|
||||
|
||||
GstD3D12CommandQueue *
|
||||
GstD3D12CmdQueue *
|
||||
gst_d3d12_device_get_decode_queue (GstD3D12Device * device)
|
||||
{
|
||||
g_return_val_if_fail (GST_IS_D3D12_DEVICE (device), nullptr);
|
||||
|
|
|
@ -94,7 +94,7 @@ gboolean gst_d3d12_device_get_format (GstD3D12Devic
|
|||
GstD3D12Format * device_format);
|
||||
|
||||
GST_D3D12_API
|
||||
GstD3D12CommandQueue * gst_d3d12_device_get_command_queue (GstD3D12Device * device,
|
||||
GstD3D12CmdQueue * gst_d3d12_device_get_cmd_queue (GstD3D12Device * device,
|
||||
D3D12_COMMAND_LIST_TYPE queue_type);
|
||||
|
||||
GST_D3D12_API
|
||||
|
|
|
@ -442,9 +442,9 @@ gst_d3d12_frame_copy_plane (GstD3D12Frame * dest, const GstD3D12Frame * src,
|
|||
gst_d3d12_fence_data_push (fence_data,
|
||||
FENCE_NOTIFY_MINI_OBJECT (gst_buffer_ref (src->buffer)));
|
||||
|
||||
auto cq = gst_d3d12_device_get_command_queue (src->device,
|
||||
auto cq = gst_d3d12_device_get_cmd_queue (src->device,
|
||||
D3D12_COMMAND_LIST_TYPE_DIRECT);
|
||||
auto cq_handle = gst_d3d12_command_queue_get_handle (cq);
|
||||
auto cq_handle = gst_d3d12_cmd_queue_get_handle (cq);
|
||||
|
||||
if (src->fence[plane].fence)
|
||||
cq_handle->Wait (src->fence[plane].fence, src->fence[plane].fence_value);
|
||||
|
@ -460,7 +460,7 @@ gst_d3d12_frame_copy_plane (GstD3D12Frame * dest, const GstD3D12Frame * src,
|
|||
/**
|
||||
* gst_d3d12_frame_fence_gpu_wait:
|
||||
* @frame: a #GstD3D12Frame
|
||||
* @queue: a GstD3D12CommandQueue
|
||||
* @queue: a GstD3D12CmdQueue
|
||||
*
|
||||
* Executes ID3D12CommandQueue::Wait() if @frame has different fence object
|
||||
*
|
||||
|
@ -470,15 +470,15 @@ gst_d3d12_frame_copy_plane (GstD3D12Frame * dest, const GstD3D12Frame * src,
|
|||
*/
|
||||
gboolean
|
||||
gst_d3d12_frame_fence_gpu_wait (const GstD3D12Frame * frame,
|
||||
GstD3D12CommandQueue * queue)
|
||||
GstD3D12CmdQueue * queue)
|
||||
{
|
||||
g_return_val_if_fail (frame, FALSE);
|
||||
g_return_val_if_fail (GST_IS_D3D12_DEVICE (frame->device), FALSE);
|
||||
g_return_val_if_fail (GST_IS_D3D12_COMMAND_QUEUE (queue), FALSE);
|
||||
g_return_val_if_fail (GST_IS_D3D12_CMD_QUEUE (queue), FALSE);
|
||||
|
||||
ID3D12Fence *last_fence = nullptr;
|
||||
guint64 last_fence_val = 0;
|
||||
auto fence = gst_d3d12_command_queue_get_fence_handle (queue);
|
||||
auto fence = gst_d3d12_cmd_queue_get_fence_handle (queue);
|
||||
|
||||
for (guint i = 0; i < G_N_ELEMENTS (frame->fence); i++) {
|
||||
if (frame->fence[i].fence && frame->fence[i].fence != fence) {
|
||||
|
@ -489,7 +489,7 @@ gst_d3d12_frame_fence_gpu_wait (const GstD3D12Frame * frame,
|
|||
last_fence = frame->fence[i].fence;
|
||||
last_fence_val = frame->fence[i].fence_value;
|
||||
|
||||
auto hr = gst_d3d12_command_queue_execute_wait (queue,
|
||||
auto hr = gst_d3d12_cmd_queue_execute_wait (queue,
|
||||
frame->fence[i].fence, frame->fence[i].fence_value);
|
||||
if (!gst_d3d12_result (hr, frame->device))
|
||||
return FALSE;
|
||||
|
|
|
@ -115,7 +115,7 @@ gboolean gst_d3d12_frame_copy_plane (GstD3D12Frame * dest,
|
|||
|
||||
GST_D3D12_API
|
||||
gboolean gst_d3d12_frame_fence_gpu_wait (const GstD3D12Frame * frame,
|
||||
GstD3D12CommandQueue * queue);
|
||||
GstD3D12CmdQueue * queue);
|
||||
|
||||
GST_D3D12_API
|
||||
gboolean gst_d3d12_frame_fence_cpu_wait (const GstD3D12Frame * frame);
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
d3d12_sources = [
|
||||
'gstd3d12bufferpool.cpp',
|
||||
'gstd3d12commandallocatorpool.cpp',
|
||||
'gstd3d12commandlistpool.cpp',
|
||||
'gstd3d12commandqueue.cpp',
|
||||
'gstd3d12cmdallocpool.cpp',
|
||||
'gstd3d12cmdlistpool.cpp',
|
||||
'gstd3d12cmdqueue.cpp',
|
||||
'gstd3d12converter-builder.cpp',
|
||||
'gstd3d12converter-unpack.cpp',
|
||||
'gstd3d12converter-pack.cpp',
|
||||
'gstd3d12converter.cpp',
|
||||
'gstd3d12descriptorpool.cpp',
|
||||
'gstd3d12descheappool.cpp',
|
||||
'gstd3d12device.cpp',
|
||||
'gstd3d12fencedatapool.cpp',
|
||||
'gstd3d12format.cpp',
|
||||
|
@ -21,10 +21,10 @@ d3d12_headers = [
|
|||
'gstd3d12_fwd.h',
|
||||
'gstd3d12.h',
|
||||
'gstd3d12bufferpool.h',
|
||||
'gstd3d12commandallocatorpool.h',
|
||||
'gstd3d12commandqueue.h',
|
||||
'gstd3d12cmdallocpool.h',
|
||||
'gstd3d12cmdqueue.h',
|
||||
'gstd3d12converter.h',
|
||||
'gstd3d12descriptorpool.h',
|
||||
'gstd3d12descheappool.h',
|
||||
'gstd3d12device.h',
|
||||
'gstd3d12fencedatapool.h',
|
||||
'gstd3d12format.h',
|
||||
|
|
|
@ -234,7 +234,7 @@ struct PadContext
|
|||
{
|
||||
device = (GstD3D12Device *) gst_object_ref (dev);
|
||||
auto device_handle = gst_d3d12_device_get_device_handle (device);
|
||||
ca_pool = gst_d3d12_command_allocator_pool_new (device_handle,
|
||||
ca_pool = gst_d3d12_cmd_alloc_pool_new (device_handle,
|
||||
D3D12_COMMAND_LIST_TYPE_DIRECT);
|
||||
gst_video_info_init (&info);
|
||||
}
|
||||
|
@ -253,7 +253,7 @@ struct PadContext
|
|||
}
|
||||
|
||||
GstVideoInfo info;
|
||||
GstD3D12CommandAllocatorPool *ca_pool;
|
||||
GstD3D12CmdAllocPool *ca_pool;
|
||||
ComPtr < ID3D12GraphicsCommandList > cl;
|
||||
GstD3D12FenceData *fence_data = nullptr;
|
||||
GstD3D12Device *device;
|
||||
|
@ -322,7 +322,7 @@ struct BackgroundRender
|
|||
{
|
||||
device = (GstD3D12Device *) gst_object_ref (dev);
|
||||
auto device_handle = gst_d3d12_device_get_device_handle (device);
|
||||
ca_pool = gst_d3d12_command_allocator_pool_new (device_handle,
|
||||
ca_pool = gst_d3d12_cmd_alloc_pool_new (device_handle,
|
||||
D3D12_COMMAND_LIST_TYPE_DIRECT);
|
||||
|
||||
D3D12_VERSIONED_ROOT_SIGNATURE_DESC rs_desc = { };
|
||||
|
@ -524,7 +524,7 @@ struct BackgroundRender
|
|||
D3D12_VERTEX_BUFFER_VIEW vbv;
|
||||
D3D12_INDEX_BUFFER_VIEW ibv;
|
||||
ComPtr < ID3D12GraphicsCommandList > cl;
|
||||
GstD3D12CommandAllocatorPool *ca_pool;
|
||||
GstD3D12CmdAllocPool *ca_pool;
|
||||
D3D12_VIEWPORT viewport;
|
||||
D3D12_RECT scissor_rect;
|
||||
guint rtv_inc_size;
|
||||
|
@ -1117,8 +1117,8 @@ gst_d3d12_compositor_preprare_func (GstVideoAggregatorPad * pad,
|
|||
g_object_set (priv->ctx->conv, "src-x", x, "src-y", y, "src-width", w,
|
||||
"src-height", h, nullptr);
|
||||
|
||||
GstD3D12CommandAllocator *gst_ca;
|
||||
if (!gst_d3d12_command_allocator_pool_acquire (priv->ctx->ca_pool, &gst_ca)) {
|
||||
GstD3D12CmdAlloc *gst_ca;
|
||||
if (!gst_d3d12_cmd_alloc_pool_acquire (priv->ctx->ca_pool, &gst_ca)) {
|
||||
GST_ERROR_OBJECT (cpad, "Couldn't acquire command allocator");
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -1127,7 +1127,7 @@ gst_d3d12_compositor_preprare_func (GstVideoAggregatorPad * pad,
|
|||
gst_d3d12_fence_data_pool_acquire (self->priv->fence_data_pool, &fence_data);
|
||||
gst_d3d12_fence_data_push (fence_data, FENCE_NOTIFY_MINI_OBJECT (gst_ca));
|
||||
|
||||
auto ca = gst_d3d12_command_allocator_get_handle (gst_ca);
|
||||
auto ca = gst_d3d12_cmd_alloc_get_handle (gst_ca);
|
||||
|
||||
auto hr = ca->Reset ();
|
||||
if (!gst_d3d12_result (hr, priv->ctx->device)) {
|
||||
|
@ -2237,8 +2237,8 @@ gst_d3d12_compositor_draw_background (GstD3D12Compositor * self)
|
|||
}
|
||||
}
|
||||
|
||||
GstD3D12CommandAllocator *gst_ca;
|
||||
if (!gst_d3d12_command_allocator_pool_acquire (bg_render->ca_pool, &gst_ca)) {
|
||||
GstD3D12CmdAlloc *gst_ca;
|
||||
if (!gst_d3d12_cmd_alloc_pool_acquire (bg_render->ca_pool, &gst_ca)) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't acquire command allocator");
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -2247,7 +2247,7 @@ gst_d3d12_compositor_draw_background (GstD3D12Compositor * self)
|
|||
gst_d3d12_fence_data_pool_acquire (priv->fence_data_pool, &fence_data);
|
||||
gst_d3d12_fence_data_push (fence_data, FENCE_NOTIFY_MINI_OBJECT (gst_ca));
|
||||
|
||||
auto ca = gst_d3d12_command_allocator_get_handle (gst_ca);
|
||||
auto ca = gst_d3d12_cmd_alloc_get_handle (gst_ca);
|
||||
|
||||
auto hr = ca->Reset ();
|
||||
if (!gst_d3d12_result (hr, self->device)) {
|
||||
|
|
|
@ -77,7 +77,7 @@ struct ConvertContext
|
|||
{
|
||||
device = (GstD3D12Device *) gst_object_ref (dev);
|
||||
auto device_handle = gst_d3d12_device_get_device_handle (device);
|
||||
ca_pool = gst_d3d12_command_allocator_pool_new (device_handle,
|
||||
ca_pool = gst_d3d12_cmd_alloc_pool_new (device_handle,
|
||||
D3D12_COMMAND_LIST_TYPE_DIRECT);
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,7 @@ struct ConvertContext
|
|||
GstD3D12Converter *conv = nullptr;
|
||||
ComPtr<ID3D12GraphicsCommandList> cl;
|
||||
std::queue<guint64> scheduled;
|
||||
GstD3D12CommandAllocatorPool *ca_pool;
|
||||
GstD3D12CmdAllocPool *ca_pool;
|
||||
guint64 fence_val = 0;
|
||||
};
|
||||
|
||||
|
@ -1965,18 +1965,18 @@ gst_d3d12_base_convert_transform (GstBaseTransform * trans, GstBuffer * inbuf,
|
|||
"src-height", (gint) in_rect.bottom - in_rect.top, nullptr);
|
||||
}
|
||||
|
||||
GstD3D12CommandAllocator *gst_ca;
|
||||
if (!gst_d3d12_command_allocator_pool_acquire (priv->ctx->ca_pool, &gst_ca)) {
|
||||
GstD3D12CmdAlloc *gst_ca;
|
||||
if (!gst_d3d12_cmd_alloc_pool_acquire (priv->ctx->ca_pool, &gst_ca)) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't acquire command allocator");
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
|
||||
auto ca = gst_d3d12_command_allocator_get_handle (gst_ca);
|
||||
auto ca = gst_d3d12_cmd_alloc_get_handle (gst_ca);
|
||||
|
||||
auto hr = ca->Reset ();
|
||||
if (!gst_d3d12_result (hr, priv->ctx->device)) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't reset command allocator");
|
||||
gst_d3d12_command_allocator_unref (gst_ca);
|
||||
gst_d3d12_cmd_alloc_unref (gst_ca);
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
|
||||
|
@ -1986,14 +1986,14 @@ gst_d3d12_base_convert_transform (GstBaseTransform * trans, GstBuffer * inbuf,
|
|||
ca, nullptr, IID_PPV_ARGS (&priv->ctx->cl));
|
||||
if (!gst_d3d12_result (hr, priv->ctx->device)) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't create command list");
|
||||
gst_d3d12_command_allocator_unref (gst_ca);
|
||||
gst_d3d12_cmd_alloc_unref (gst_ca);
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
} else {
|
||||
hr = priv->ctx->cl->Reset (ca, nullptr);
|
||||
if (!gst_d3d12_result (hr, priv->ctx->device)) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't reset command list");
|
||||
gst_d3d12_command_allocator_unref (gst_ca);
|
||||
gst_d3d12_cmd_alloc_unref (gst_ca);
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -2002,9 +2002,9 @@ gst_d3d12_base_convert_transform (GstBaseTransform * trans, GstBuffer * inbuf,
|
|||
gst_d3d12_fence_data_pool_acquire (priv->fence_data_pool, &fence_data);
|
||||
gst_d3d12_fence_data_push (fence_data, FENCE_NOTIFY_MINI_OBJECT (gst_ca));
|
||||
|
||||
auto cq = gst_d3d12_device_get_command_queue (priv->ctx->device,
|
||||
auto cq = gst_d3d12_device_get_cmd_queue (priv->ctx->device,
|
||||
D3D12_COMMAND_LIST_TYPE_DIRECT);
|
||||
auto fence = gst_d3d12_command_queue_get_fence_handle (cq);
|
||||
auto fence = gst_d3d12_cmd_queue_get_fence_handle (cq);
|
||||
if (!gst_d3d12_converter_convert_buffer (priv->ctx->conv,
|
||||
inbuf, outbuf, fence_data, priv->ctx->cl.Get (), TRUE)) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't build command list");
|
||||
|
@ -2021,7 +2021,7 @@ gst_d3d12_base_convert_transform (GstBaseTransform * trans, GstBuffer * inbuf,
|
|||
|
||||
ID3D12CommandList *cmd_list[] = { priv->ctx->cl.Get () };
|
||||
|
||||
hr = gst_d3d12_command_queue_execute_command_lists (cq,
|
||||
hr = gst_d3d12_cmd_queue_execute_command_lists (cq,
|
||||
1, cmd_list, &priv->ctx->fence_val);
|
||||
if (!gst_d3d12_result (hr, priv->ctx->device)) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't execute command list");
|
||||
|
@ -2030,7 +2030,7 @@ gst_d3d12_base_convert_transform (GstBaseTransform * trans, GstBuffer * inbuf,
|
|||
}
|
||||
|
||||
gst_d3d12_buffer_set_fence (outbuf, fence, priv->ctx->fence_val, FALSE);
|
||||
gst_d3d12_command_queue_set_notify (cq, priv->ctx->fence_val,
|
||||
gst_d3d12_cmd_queue_set_notify (cq, priv->ctx->fence_val,
|
||||
FENCE_NOTIFY_MINI_OBJECT (fence_data));
|
||||
|
||||
priv->ctx->scheduled.push (priv->ctx->fence_val);
|
||||
|
|
|
@ -230,7 +230,7 @@ struct DecoderCmdData
|
|||
ComPtr<ID3D12Device> device;
|
||||
ComPtr<ID3D12VideoDevice> video_device;
|
||||
ComPtr<ID3D12VideoDecodeCommandList> cl;
|
||||
GstD3D12CommandQueue *queue = nullptr;
|
||||
GstD3D12CmdQueue *queue = nullptr;
|
||||
bool need_full_drain = false;
|
||||
|
||||
/* Fence to wait at command record thread */
|
||||
|
@ -480,7 +480,7 @@ gst_d3d12_decoder_drain (GstD3D12Decoder * decoder, GstVideoDecoder * videodec)
|
|||
|
||||
GST_DEBUG_OBJECT (decoder, "Draining");
|
||||
if (priv->cmd)
|
||||
gst_d3d12_command_queue_fence_wait (priv->cmd->queue, priv->cmd->fence_val);
|
||||
gst_d3d12_cmd_queue_fence_wait (priv->cmd->queue, priv->cmd->fence_val);
|
||||
|
||||
GST_VIDEO_DECODER_STREAM_UNLOCK (videodec);
|
||||
if (priv->output_thread && priv->session) {
|
||||
|
@ -825,10 +825,9 @@ gst_d3d12_decoder_stop (GstD3D12Decoder * decoder)
|
|||
priv->flushing = true;
|
||||
if (priv->cmd) {
|
||||
if (priv->cmd->need_full_drain) {
|
||||
gst_d3d12_command_queue_drain (priv->cmd->queue);
|
||||
gst_d3d12_cmd_queue_drain (priv->cmd->queue);
|
||||
} else {
|
||||
gst_d3d12_command_queue_fence_wait (priv->cmd->queue,
|
||||
priv->cmd->fence_val);
|
||||
gst_d3d12_cmd_queue_fence_wait (priv->cmd->queue, priv->cmd->fence_val);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1243,7 +1242,7 @@ gst_d3d12_decoder_end_picture (GstD3D12Decoder * decoder,
|
|||
|
||||
ID3D12CommandList *cl[] = { priv->cmd->cl.Get () };
|
||||
|
||||
hr = gst_d3d12_command_queue_execute_command_lists (priv->cmd->queue,
|
||||
hr = gst_d3d12_cmd_queue_execute_command_lists (priv->cmd->queue,
|
||||
1, cl, &priv->cmd->fence_val);
|
||||
if (!gst_d3d12_result (hr, decoder->device)) {
|
||||
GST_ERROR_OBJECT (decoder, "Couldn't execute command list");
|
||||
|
@ -1264,7 +1263,7 @@ gst_d3d12_decoder_end_picture (GstD3D12Decoder * decoder,
|
|||
}
|
||||
gst_d3d12_fence_data_push (fence_data, FENCE_NOTIFY_MINI_OBJECT (cpb));
|
||||
|
||||
gst_d3d12_command_queue_set_notify (priv->cmd->queue, priv->cmd->fence_val,
|
||||
gst_d3d12_cmd_queue_set_notify (priv->cmd->queue, priv->cmd->fence_val,
|
||||
fence_data, (GDestroyNotify) gst_d3d12_fence_data_unref);
|
||||
|
||||
return GST_FLOW_OK;
|
||||
|
@ -1691,8 +1690,7 @@ gst_d3d12_decoder_output_loop (GstD3D12Decoder * self)
|
|||
auto decoder_pic = get_decoder_picture (output_data.picture);
|
||||
g_assert (decoder_pic);
|
||||
|
||||
gst_d3d12_command_queue_fence_wait (priv->cmd->queue,
|
||||
decoder_pic->fence_val);
|
||||
gst_d3d12_cmd_queue_fence_wait (priv->cmd->queue, decoder_pic->fence_val);
|
||||
|
||||
if (priv->flushing) {
|
||||
GST_DEBUG_OBJECT (self, "Drop framem, we are flushing");
|
||||
|
|
|
@ -851,7 +851,7 @@ struct GstD3D12DxgiCapturePrivate
|
|||
|
||||
std::unique_ptr<DesktopDupCtx> ctx;
|
||||
ComPtr<IDXGIOutput1> output;
|
||||
GstD3D12CommandAllocatorPool *ca_pool = nullptr;
|
||||
GstD3D12CmdAllocPool *ca_pool = nullptr;
|
||||
GstD3D12FenceDataPool *fence_data_pool;
|
||||
ComPtr<ID3D12GraphicsCommandList> cl;
|
||||
ComPtr<ID3D12Fence> shared_fence;
|
||||
|
@ -1044,7 +1044,7 @@ gst_d3d12_dxgi_capture_open (GstD3D12DxgiCapture * self,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
priv->ca_pool = gst_d3d12_command_allocator_pool_new (device,
|
||||
priv->ca_pool = gst_d3d12_cmd_alloc_pool_new (device,
|
||||
D3D12_COMMAND_LIST_TYPE_DIRECT);
|
||||
|
||||
D3D_FEATURE_LEVEL feature_level = D3D_FEATURE_LEVEL_11_1;
|
||||
|
@ -1368,8 +1368,8 @@ gst_d3d12_dxgi_capture_draw_mouse (GstD3D12DxgiCapture * self,
|
|||
GstD3D12FenceData *fence_data = nullptr;
|
||||
gst_d3d12_fence_data_pool_acquire (priv->fence_data_pool, &fence_data);
|
||||
|
||||
GstD3D12CommandAllocator *gst_ca = nullptr;
|
||||
if (!gst_d3d12_command_allocator_pool_acquire (priv->ca_pool, &gst_ca)) {
|
||||
GstD3D12CmdAlloc *gst_ca = nullptr;
|
||||
if (!gst_d3d12_cmd_alloc_pool_acquire (priv->ca_pool, &gst_ca)) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't acquire command allocator");
|
||||
gst_d3d12_fence_data_unref (fence_data);
|
||||
return FALSE;
|
||||
|
@ -1377,7 +1377,7 @@ gst_d3d12_dxgi_capture_draw_mouse (GstD3D12DxgiCapture * self,
|
|||
|
||||
gst_d3d12_fence_data_push (fence_data, FENCE_NOTIFY_MINI_OBJECT (gst_ca));
|
||||
|
||||
auto ca = gst_d3d12_command_allocator_get_handle (gst_ca);
|
||||
auto ca = gst_d3d12_cmd_alloc_get_handle (gst_ca);
|
||||
hr = ca->Reset ();
|
||||
if (!gst_d3d12_result (hr, self->device)) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't reset command allocator");
|
||||
|
@ -1408,7 +1408,7 @@ gst_d3d12_dxgi_capture_draw_mouse (GstD3D12DxgiCapture * self,
|
|||
ptr_w, "src-height", ptr_h, "dest-x", ptr_x, "dest-y", ptr_y,
|
||||
"dest-width", ptr_w, "dest-height", ptr_h, nullptr);
|
||||
|
||||
auto cq = gst_d3d12_device_get_command_queue (self->device,
|
||||
auto cq = gst_d3d12_device_get_cmd_queue (self->device,
|
||||
D3D12_COMMAND_LIST_TYPE_DIRECT);
|
||||
if (!gst_d3d12_converter_convert_buffer (priv->mouse_blend,
|
||||
priv->mouse_buf, buffer, fence_data, cl.Get (), TRUE)) {
|
||||
|
@ -1440,18 +1440,17 @@ gst_d3d12_dxgi_capture_draw_mouse (GstD3D12DxgiCapture * self,
|
|||
ID3D12CommandList *cmd_list[] = { cl.Get () };
|
||||
|
||||
guint64 fence_val = 0;
|
||||
hr = gst_d3d12_command_queue_execute_command_lists (cq, 1, cmd_list,
|
||||
&fence_val);
|
||||
hr = gst_d3d12_cmd_queue_execute_command_lists (cq, 1, cmd_list, &fence_val);
|
||||
if (!gst_d3d12_result (hr, self->device)) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't execute command list");
|
||||
gst_d3d12_fence_data_unref (fence_data);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gst_d3d12_command_queue_set_notify (cq, fence_val, fence_data,
|
||||
gst_d3d12_cmd_queue_set_notify (cq, fence_val, fence_data,
|
||||
(GDestroyNotify) gst_d3d12_fence_data_unref);
|
||||
gst_d3d12_buffer_set_fence (buffer,
|
||||
gst_d3d12_command_queue_get_fence_handle (cq), fence_val, FALSE);
|
||||
gst_d3d12_cmd_queue_get_fence_handle (cq), fence_val, FALSE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@ struct EncoderCmdData
|
|||
~EncoderCmdData ()
|
||||
{
|
||||
if (queue)
|
||||
gst_d3d12_command_queue_fence_wait (queue, G_MAXUINT64);
|
||||
gst_d3d12_cmd_queue_fence_wait (queue, G_MAXUINT64);
|
||||
|
||||
gst_clear_object (&ca_pool);
|
||||
gst_clear_object (&queue);
|
||||
|
@ -99,8 +99,8 @@ struct EncoderCmdData
|
|||
|
||||
ComPtr<ID3D12VideoDevice3> video_device;
|
||||
ComPtr<ID3D12VideoEncodeCommandList2> cl;
|
||||
GstD3D12CommandQueue *queue = nullptr;
|
||||
GstD3D12CommandAllocatorPool *ca_pool = nullptr;
|
||||
GstD3D12CmdQueue *queue = nullptr;
|
||||
GstD3D12CmdAllocPool *ca_pool = nullptr;
|
||||
guint64 fence_val = 0;
|
||||
};
|
||||
|
||||
|
@ -297,14 +297,14 @@ gst_d3d12_encoder_open (GstVideoEncoder * encoder)
|
|||
queue_desc.Type = D3D12_COMMAND_LIST_TYPE_VIDEO_ENCODE;
|
||||
|
||||
auto cmd = std::make_unique < EncoderCmdData > ();
|
||||
cmd->queue = gst_d3d12_command_queue_new (device, &queue_desc,
|
||||
cmd->queue = gst_d3d12_cmd_queue_new (device, &queue_desc,
|
||||
D3D12_FENCE_FLAG_NONE, ASYNC_DEPTH);
|
||||
if (!cmd->queue) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't create command queue");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
cmd->ca_pool = gst_d3d12_command_allocator_pool_new (device,
|
||||
cmd->ca_pool = gst_d3d12_cmd_alloc_pool_new (device,
|
||||
D3D12_COMMAND_LIST_TYPE_VIDEO_ENCODE);
|
||||
cmd->video_device = video_device;
|
||||
|
||||
|
@ -346,7 +346,7 @@ gst_d3d12_encoder_drain (GstD3D12Encoder * self, gboolean locked)
|
|||
if (priv->cmd) {
|
||||
GST_DEBUG_OBJECT (self, "Waiting for command finish %" G_GUINT64_FORMAT,
|
||||
priv->cmd->fence_val);
|
||||
gst_d3d12_command_queue_fence_wait (priv->cmd->queue, priv->cmd->fence_val);
|
||||
gst_d3d12_cmd_queue_fence_wait (priv->cmd->queue, priv->cmd->fence_val);
|
||||
}
|
||||
|
||||
if (priv->session && priv->output_thread) {
|
||||
|
@ -1157,8 +1157,7 @@ gst_d3d12_encoder_output_loop (GstD3D12Encoder * self)
|
|||
GST_LOG_OBJECT (self, "Processing output %" G_GUINT64_FORMAT,
|
||||
output_data.fence_val);
|
||||
|
||||
gst_d3d12_command_queue_fence_wait (priv->cmd->queue,
|
||||
output_data.fence_val);
|
||||
gst_d3d12_cmd_queue_fence_wait (priv->cmd->queue, output_data.fence_val);
|
||||
|
||||
if (priv->flushing) {
|
||||
GST_DEBUG_OBJECT (self, "We are flushing");
|
||||
|
@ -1247,8 +1246,8 @@ gst_d3d12_encoder_handle_frame (GstVideoEncoder * encoder,
|
|||
gst_d3d12_fence_data_pool_acquire (priv->fence_data_pool, &fence_data);
|
||||
gst_d3d12_fence_data_push (fence_data, FENCE_NOTIFY_MINI_OBJECT (upload));
|
||||
|
||||
GstD3D12CommandAllocator *gst_ca;
|
||||
if (!gst_d3d12_command_allocator_pool_acquire (priv->cmd->ca_pool, &gst_ca)) {
|
||||
GstD3D12CmdAlloc *gst_ca;
|
||||
if (!gst_d3d12_cmd_alloc_pool_acquire (priv->cmd->ca_pool, &gst_ca)) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't acquire command allocator");
|
||||
gst_d3d12_fence_data_unref (fence_data);
|
||||
gst_video_encoder_finish_frame (encoder, frame);
|
||||
|
@ -1257,7 +1256,7 @@ gst_d3d12_encoder_handle_frame (GstVideoEncoder * encoder,
|
|||
|
||||
gst_d3d12_fence_data_push (fence_data, FENCE_NOTIFY_MINI_OBJECT (gst_ca));
|
||||
|
||||
auto ca = gst_d3d12_command_allocator_get_handle (gst_ca);
|
||||
auto ca = gst_d3d12_cmd_alloc_get_handle (gst_ca);
|
||||
auto hr = ca->Reset ();
|
||||
if (!gst_d3d12_result (hr, self->device)) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't reset command allocator");
|
||||
|
@ -1431,12 +1430,12 @@ gst_d3d12_encoder_handle_frame (GstVideoEncoder * encoder,
|
|||
ComPtr < ID3D12Fence > fence_to_wait;
|
||||
guint64 fence_val_to_wait = 0;
|
||||
if (gst_d3d12_memory_get_fence (mem, &fence_to_wait, &fence_val_to_wait)) {
|
||||
gst_d3d12_command_queue_execute_wait (priv->cmd->queue,
|
||||
gst_d3d12_cmd_queue_execute_wait (priv->cmd->queue,
|
||||
fence_to_wait.Get (), fence_val_to_wait);
|
||||
}
|
||||
|
||||
ID3D12CommandList *cmd_list[] = { cl.Get () };
|
||||
hr = gst_d3d12_command_queue_execute_command_lists (priv->cmd->queue,
|
||||
hr = gst_d3d12_cmd_queue_execute_command_lists (priv->cmd->queue,
|
||||
1, cmd_list, &priv->cmd->fence_val);
|
||||
if (!gst_d3d12_result (hr, self->device)) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't execute command list");
|
||||
|
@ -1446,7 +1445,7 @@ gst_d3d12_encoder_handle_frame (GstVideoEncoder * encoder,
|
|||
return GST_FLOW_ERROR;
|
||||
}
|
||||
|
||||
gst_d3d12_command_queue_set_notify (priv->cmd->queue, priv->cmd->fence_val,
|
||||
gst_d3d12_cmd_queue_set_notify (priv->cmd->queue, priv->cmd->fence_val,
|
||||
fence_data, (GDestroyNotify) gst_d3d12_fence_data_unref);
|
||||
|
||||
auto output_data = EncoderOutputData ();
|
||||
|
|
|
@ -503,11 +503,11 @@ gst_d3d12_ipc_client_have_data (GstD3D12IpcClient * self)
|
|||
copy_args.push_back (args);
|
||||
}
|
||||
|
||||
auto queue = gst_d3d12_device_get_command_queue (priv->device,
|
||||
auto queue = gst_d3d12_device_get_cmd_queue (priv->device,
|
||||
D3D12_COMMAND_LIST_TYPE_DIRECT);
|
||||
auto completed = priv->server_fence->GetCompletedValue ();
|
||||
if (completed < fence_val) {
|
||||
gst_d3d12_command_queue_execute_wait (queue, priv->server_fence.Get (),
|
||||
gst_d3d12_cmd_queue_execute_wait (queue, priv->server_fence.Get (),
|
||||
fence_val);
|
||||
}
|
||||
|
||||
|
@ -522,7 +522,7 @@ gst_d3d12_ipc_client_have_data (GstD3D12IpcClient * self)
|
|||
data->self = (GstD3D12IpcClient *) gst_object_ref (self);
|
||||
data->imported = import_data;
|
||||
|
||||
gst_d3d12_command_queue_set_notify (queue, copy_fence_val, data,
|
||||
gst_d3d12_cmd_queue_set_notify (queue, copy_fence_val, data,
|
||||
(GDestroyNotify) gst_d3d12_ipc_client_release_imported_data);
|
||||
|
||||
gst_d3d12_buffer_set_fence (buffer,
|
||||
|
|
|
@ -83,7 +83,7 @@ struct GstD3D12MipGenPrivate
|
|||
}
|
||||
|
||||
GstD3D12Device *device = nullptr;
|
||||
GstD3D12DescriptorPool *desc_pool = nullptr;
|
||||
GstD3D12DescHeapPool *desc_pool = nullptr;
|
||||
ComPtr < ID3D12PipelineState > pso;
|
||||
ComPtr < ID3D12RootSignature > rs;
|
||||
guint desc_inc_size;
|
||||
|
@ -222,7 +222,7 @@ gst_d3d12_mip_gen_new (GstD3D12Device * device)
|
|||
desc_heap_desc.NumDescriptors = 5;
|
||||
desc_heap_desc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE;
|
||||
|
||||
priv->desc_pool = gst_d3d12_descriptor_pool_new (device_handle,
|
||||
priv->desc_pool = gst_d3d12_desc_heap_pool_new (device_handle,
|
||||
&desc_heap_desc);
|
||||
if (!priv->desc_pool) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't create descriptor pool");
|
||||
|
@ -319,15 +319,15 @@ gst_d3d12_mip_gen_execute (GstD3D12MipGen * gen, ID3D12Resource * resource,
|
|||
cl->ResourceBarrier (1, &barrier);
|
||||
}
|
||||
|
||||
GstD3D12Descriptor *desc_heap;
|
||||
if (!gst_d3d12_descriptor_pool_acquire (priv->desc_pool, &desc_heap)) {
|
||||
GstD3D12DescHeap *desc_heap;
|
||||
if (!gst_d3d12_desc_heap_pool_acquire (priv->desc_pool, &desc_heap)) {
|
||||
GST_ERROR_OBJECT (gen, "Couldn't acquire descriptor heap");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gst_d3d12_fence_data_push (fence_data,
|
||||
FENCE_NOTIFY_MINI_OBJECT (desc_heap));
|
||||
auto desc_handle = gst_d3d12_descriptor_get_handle (desc_heap);
|
||||
auto desc_handle = gst_d3d12_desc_heap_get_handle (desc_heap);
|
||||
auto cpu_handle = CD3DX12_CPU_DESCRIPTOR_HANDLE
|
||||
(GetCPUDescriptorHandleForHeapStart (desc_handle));
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ struct MipMappingContext
|
|||
{
|
||||
device = (GstD3D12Device *) gst_object_ref (dev);
|
||||
auto device_handle = gst_d3d12_device_get_device_handle (device);
|
||||
ca_pool = gst_d3d12_command_allocator_pool_new (device_handle,
|
||||
ca_pool = gst_d3d12_cmd_alloc_pool_new (device_handle,
|
||||
D3D12_COMMAND_LIST_TYPE_DIRECT);
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ struct MipMappingContext
|
|||
GstD3D12MipGen *gen = nullptr;
|
||||
ComPtr<ID3D12GraphicsCommandList> cl;
|
||||
std::queue<guint64> scheduled;
|
||||
GstD3D12CommandAllocatorPool *ca_pool;
|
||||
GstD3D12CmdAllocPool *ca_pool;
|
||||
guint64 fence_val = 0;
|
||||
};
|
||||
|
||||
|
@ -914,17 +914,17 @@ gst_d3d12_mip_mapping_transform (GstBaseTransform * trans, GstBuffer * inbuf,
|
|||
"src-height", (gint) in_rect.bottom - in_rect.top, nullptr);
|
||||
}
|
||||
|
||||
GstD3D12CommandAllocator *gst_ca;
|
||||
if (!gst_d3d12_command_allocator_pool_acquire (priv->ctx->ca_pool, &gst_ca)) {
|
||||
GstD3D12CmdAlloc *gst_ca;
|
||||
if (!gst_d3d12_cmd_alloc_pool_acquire (priv->ctx->ca_pool, &gst_ca)) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't acquire command allocator");
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
|
||||
auto ca = gst_d3d12_command_allocator_get_handle (gst_ca);
|
||||
auto ca = gst_d3d12_cmd_alloc_get_handle (gst_ca);
|
||||
auto hr = ca->Reset ();
|
||||
if (!gst_d3d12_result (hr, priv->ctx->device)) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't reset command allocator");
|
||||
gst_d3d12_command_allocator_unref (gst_ca);
|
||||
gst_d3d12_cmd_alloc_unref (gst_ca);
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
|
||||
|
@ -934,14 +934,14 @@ gst_d3d12_mip_mapping_transform (GstBaseTransform * trans, GstBuffer * inbuf,
|
|||
ca, nullptr, IID_PPV_ARGS (&priv->ctx->cl));
|
||||
if (!gst_d3d12_result (hr, priv->ctx->device)) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't create command list");
|
||||
gst_d3d12_command_allocator_unref (gst_ca);
|
||||
gst_d3d12_cmd_alloc_unref (gst_ca);
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
} else {
|
||||
hr = priv->ctx->cl->Reset (ca, nullptr);
|
||||
if (!gst_d3d12_result (hr, priv->ctx->device)) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't reset command list");
|
||||
gst_d3d12_command_allocator_unref (gst_ca);
|
||||
gst_d3d12_cmd_alloc_unref (gst_ca);
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -950,9 +950,9 @@ gst_d3d12_mip_mapping_transform (GstBaseTransform * trans, GstBuffer * inbuf,
|
|||
gst_d3d12_fence_data_pool_acquire (priv->fence_data_pool, &fence_data);
|
||||
gst_d3d12_fence_data_push (fence_data, FENCE_NOTIFY_MINI_OBJECT (gst_ca));
|
||||
|
||||
auto cq = gst_d3d12_device_get_command_queue (priv->ctx->device,
|
||||
auto cq = gst_d3d12_device_get_cmd_queue (priv->ctx->device,
|
||||
D3D12_COMMAND_LIST_TYPE_DIRECT);
|
||||
auto fence = gst_d3d12_command_queue_get_fence_handle (cq);
|
||||
auto fence = gst_d3d12_cmd_queue_get_fence_handle (cq);
|
||||
if (!gst_d3d12_converter_convert_buffer (priv->ctx->conv,
|
||||
inbuf, outbuf, fence_data, priv->ctx->cl.Get (), TRUE)) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't build command list");
|
||||
|
@ -984,7 +984,7 @@ gst_d3d12_mip_mapping_transform (GstBaseTransform * trans, GstBuffer * inbuf,
|
|||
|
||||
ID3D12CommandList *cmd_list[] = { priv->ctx->cl.Get () };
|
||||
|
||||
hr = gst_d3d12_command_queue_execute_command_lists (cq,
|
||||
hr = gst_d3d12_cmd_queue_execute_command_lists (cq,
|
||||
1, cmd_list, &priv->ctx->fence_val);
|
||||
if (!gst_d3d12_result (hr, priv->ctx->device)) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't execute command list");
|
||||
|
@ -993,7 +993,7 @@ gst_d3d12_mip_mapping_transform (GstBaseTransform * trans, GstBuffer * inbuf,
|
|||
}
|
||||
|
||||
gst_d3d12_buffer_set_fence (outbuf, fence, priv->ctx->fence_val, FALSE);
|
||||
gst_d3d12_command_queue_set_notify (cq, priv->ctx->fence_val,
|
||||
gst_d3d12_cmd_queue_set_notify (cq, priv->ctx->fence_val,
|
||||
FENCE_NOTIFY_MINI_OBJECT (fence_data));
|
||||
|
||||
priv->ctx->scheduled.push (priv->ctx->fence_val);
|
||||
|
|
|
@ -56,14 +56,14 @@ struct GstD3D12OverlayRect : public GstMiniObject
|
|||
if (overlay_rect)
|
||||
gst_video_overlay_rectangle_unref (overlay_rect);
|
||||
|
||||
gst_clear_d3d12_descriptor (&srv_heap);
|
||||
gst_clear_d3d12_desc_heap (&srv_heap);
|
||||
}
|
||||
|
||||
GstVideoOverlayRectangle *overlay_rect = nullptr;
|
||||
ComPtr<ID3D12Resource> texture;
|
||||
ComPtr<ID3D12Resource> staging;
|
||||
ComPtr<ID3D12Resource> vertex_buf;
|
||||
GstD3D12Descriptor *srv_heap = nullptr;
|
||||
GstD3D12DescHeap *srv_heap = nullptr;
|
||||
D3D12_VERTEX_BUFFER_VIEW vbv;
|
||||
D3D12_PLACED_SUBRESOURCE_FOOTPRINT layout;
|
||||
gboolean premul_alpha = FALSE;
|
||||
|
@ -105,8 +105,8 @@ struct GstD3D12OverlayCompositorPrivate
|
|||
D3D12_INDEX_BUFFER_VIEW idv;
|
||||
ComPtr<ID3D12Resource> index_buf;
|
||||
ComPtr<ID3D12GraphicsCommandList> cl;
|
||||
GstD3D12CommandAllocatorPool *ca_pool = nullptr;
|
||||
GstD3D12DescriptorPool *srv_heap_pool = nullptr;
|
||||
GstD3D12CmdAllocPool *ca_pool = nullptr;
|
||||
GstD3D12DescHeapPool *srv_heap_pool = nullptr;
|
||||
|
||||
GList *overlays = nullptr;
|
||||
|
||||
|
@ -353,13 +353,13 @@ gst_d3d12_overlay_rect_new (GstD3D12OverlayCompositor * self,
|
|||
memcpy (map_data, vertex_data, sizeof (VertexData) * 4);
|
||||
vertex_buf->Unmap (0, nullptr);
|
||||
|
||||
GstD3D12Descriptor *srv_heap;
|
||||
if (!gst_d3d12_descriptor_pool_acquire (priv->srv_heap_pool, &srv_heap)) {
|
||||
GstD3D12DescHeap *srv_heap;
|
||||
if (!gst_d3d12_desc_heap_pool_acquire (priv->srv_heap_pool, &srv_heap)) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't acquire command allocator");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto srv_heap_handle = gst_d3d12_descriptor_get_handle (srv_heap);
|
||||
auto srv_heap_handle = gst_d3d12_desc_heap_get_handle (srv_heap);
|
||||
D3D12_SHADER_RESOURCE_VIEW_DESC srv_desc = { };
|
||||
srv_desc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2D;
|
||||
srv_desc.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING;
|
||||
|
@ -583,8 +583,8 @@ gst_d3d12_overlay_compositor_setup_shader (GstD3D12OverlayCompositor * self)
|
|||
priv->idv.SizeInBytes = sizeof (indices);
|
||||
priv->idv.Format = DXGI_FORMAT_R16_UINT;
|
||||
priv->index_buf = index_buf;
|
||||
priv->srv_heap_pool = gst_d3d12_descriptor_pool_new (device, &heap_desc);
|
||||
priv->ca_pool = gst_d3d12_command_allocator_pool_new (device,
|
||||
priv->srv_heap_pool = gst_d3d12_desc_heap_pool_new (device, &heap_desc);
|
||||
priv->ca_pool = gst_d3d12_cmd_alloc_pool_new (device,
|
||||
D3D12_COMMAND_LIST_TYPE_DIRECT);
|
||||
|
||||
priv->viewport.TopLeftX = 0;
|
||||
|
@ -790,7 +790,7 @@ gst_d3d12_overlay_compositor_execute (GstD3D12OverlayCompositor * self,
|
|||
cl->SetPipelineState (pso.Get ());
|
||||
}
|
||||
|
||||
auto srv_heap = gst_d3d12_descriptor_get_handle (rect->srv_heap);
|
||||
auto srv_heap = gst_d3d12_desc_heap_get_handle (rect->srv_heap);
|
||||
ID3D12DescriptorHeap *heaps[] = { srv_heap };
|
||||
cl->SetDescriptorHeaps (1, heaps);
|
||||
cl->SetGraphicsRootDescriptorTable (0,
|
||||
|
|
|
@ -126,7 +126,7 @@ struct GstD3D12SwapChainSinkPrivate
|
|||
void stop ()
|
||||
{
|
||||
if (cq && swapchain && fence_val > 0)
|
||||
gst_d3d12_command_queue_idle_for_swapchain (cq, fence_val);
|
||||
gst_d3d12_cmd_queue_idle_for_swapchain (cq, fence_val);
|
||||
if (pool) {
|
||||
gst_buffer_pool_set_active (pool, FALSE);
|
||||
gst_clear_object (&pool);
|
||||
|
@ -165,8 +165,8 @@ struct GstD3D12SwapChainSinkPrivate
|
|||
GstStructure *convert_config = nullptr;
|
||||
GstD3D12FenceDataPool *fence_data_pool = nullptr;
|
||||
GstBufferPool *pool = nullptr;
|
||||
GstD3D12CommandQueue *cq = nullptr;
|
||||
GstD3D12CommandAllocatorPool *ca_pool = nullptr;
|
||||
GstD3D12CmdQueue *cq = nullptr;
|
||||
GstD3D12CmdAllocPool *ca_pool = nullptr;
|
||||
GstBuffer *cached_buf = nullptr;
|
||||
GstBuffer *msaa_buf = nullptr;
|
||||
GstCaps *caps = nullptr;
|
||||
|
@ -411,7 +411,7 @@ gst_d3d12_swapchain_sink_resize_unlocked (GstD3D12SwapChainSink * self,
|
|||
GST_DEBUG_OBJECT (self, "Resizing swapchain, %ux%u -> %ux%u",
|
||||
priv->width, priv->height, width, height);
|
||||
if (priv->cq && priv->swapchain && priv->fence_val > 0)
|
||||
gst_d3d12_command_queue_idle_for_swapchain (priv->cq, priv->fence_val);
|
||||
gst_d3d12_cmd_queue_idle_for_swapchain (priv->cq, priv->fence_val);
|
||||
|
||||
priv->backbuf.clear ();
|
||||
priv->width = width;
|
||||
|
@ -500,10 +500,10 @@ gst_d3d12_swapchain_sink_ensure_swapchain (GstD3D12SwapChainSink * self)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
priv->cq = gst_d3d12_device_get_command_queue (self->device,
|
||||
priv->cq = gst_d3d12_device_get_cmd_queue (self->device,
|
||||
D3D12_COMMAND_LIST_TYPE_DIRECT);
|
||||
|
||||
auto cq = gst_d3d12_command_queue_get_handle (priv->cq);
|
||||
auto cq = gst_d3d12_cmd_queue_get_handle (priv->cq);
|
||||
auto factory = gst_d3d12_device_get_factory_handle (self->device);
|
||||
|
||||
DXGI_SWAP_CHAIN_DESC1 desc = { };
|
||||
|
@ -532,7 +532,7 @@ gst_d3d12_swapchain_sink_ensure_swapchain (GstD3D12SwapChainSink * self)
|
|||
}
|
||||
|
||||
auto device = gst_d3d12_device_get_device_handle (self->device);
|
||||
priv->ca_pool = gst_d3d12_command_allocator_pool_new (device,
|
||||
priv->ca_pool = gst_d3d12_cmd_alloc_pool_new (device,
|
||||
D3D12_COMMAND_LIST_TYPE_DIRECT);
|
||||
|
||||
GstVideoInfo info;
|
||||
|
@ -752,17 +752,17 @@ gst_d3d12_swapchain_sink_render (GstD3D12SwapChainSink * self)
|
|||
|
||||
gst_d3d12_overlay_compositor_upload (priv->comp, priv->cached_buf);
|
||||
|
||||
GstD3D12CommandAllocator *gst_ca;
|
||||
if (!gst_d3d12_command_allocator_pool_acquire (priv->ca_pool, &gst_ca)) {
|
||||
GstD3D12CmdAlloc *gst_ca;
|
||||
if (!gst_d3d12_cmd_alloc_pool_acquire (priv->ca_pool, &gst_ca)) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't acquire command allocator");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
auto ca = gst_d3d12_command_allocator_get_handle (gst_ca);
|
||||
auto ca = gst_d3d12_cmd_alloc_get_handle (gst_ca);
|
||||
auto hr = ca->Reset ();
|
||||
if (!gst_d3d12_result (hr, self->device)) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't reset command list");
|
||||
gst_d3d12_command_allocator_unref (gst_ca);
|
||||
gst_d3d12_cmd_alloc_unref (gst_ca);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -773,7 +773,7 @@ gst_d3d12_swapchain_sink_render (GstD3D12SwapChainSink * self)
|
|||
ca, nullptr, IID_PPV_ARGS (&cl));
|
||||
if (!gst_d3d12_result (hr, self->device)) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't create command list");
|
||||
gst_d3d12_command_allocator_unref (gst_ca);
|
||||
gst_d3d12_cmd_alloc_unref (gst_ca);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -783,7 +783,7 @@ gst_d3d12_swapchain_sink_render (GstD3D12SwapChainSink * self)
|
|||
hr = cl->Reset (ca, nullptr);
|
||||
if (!gst_d3d12_result (hr, self->device)) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't reset command list");
|
||||
gst_d3d12_command_allocator_unref (gst_ca);
|
||||
gst_d3d12_cmd_alloc_unref (gst_ca);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
@ -869,7 +869,7 @@ gst_d3d12_swapchain_sink_render (GstD3D12SwapChainSink * self)
|
|||
}
|
||||
|
||||
ID3D12CommandList *cmd_list[] = { cl.Get () };
|
||||
hr = gst_d3d12_command_queue_execute_command_lists (priv->cq,
|
||||
hr = gst_d3d12_cmd_queue_execute_command_lists (priv->cq,
|
||||
1, cmd_list, &priv->fence_val);
|
||||
if (!gst_d3d12_result (hr, self->device)) {
|
||||
GST_ERROR_OBJECT (self, "Signal failed");
|
||||
|
@ -877,7 +877,7 @@ gst_d3d12_swapchain_sink_render (GstD3D12SwapChainSink * self)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
gst_d3d12_command_queue_set_notify (priv->cq, priv->fence_val,
|
||||
gst_d3d12_cmd_queue_set_notify (priv->cq, priv->fence_val,
|
||||
fence_data, (GDestroyNotify) gst_d3d12_fence_data_unref);
|
||||
|
||||
return TRUE;
|
||||
|
@ -922,7 +922,7 @@ gst_d3d12_swapchain_sink_set_buffer (GstD3D12SwapChainSink * self,
|
|||
}
|
||||
|
||||
if (update_converter) {
|
||||
gst_d3d12_command_queue_idle_for_swapchain (priv->cq, priv->fence_val);
|
||||
gst_d3d12_cmd_queue_idle_for_swapchain (priv->cq, priv->fence_val);
|
||||
|
||||
auto format = GST_VIDEO_INFO_FORMAT (&priv->info);
|
||||
if (priv->convert_format != format)
|
||||
|
@ -1036,7 +1036,7 @@ gst_d3d12_swapchain_sink_resize_internal (GstD3D12SwapChainSink * self,
|
|||
if (!gst_d3d12_result (hr, self->device))
|
||||
GST_ERROR_OBJECT (self, "Present failed");
|
||||
|
||||
gst_d3d12_command_queue_execute_command_lists (priv->cq,
|
||||
gst_d3d12_cmd_queue_execute_command_lists (priv->cq,
|
||||
0, nullptr, &priv->fence_val);
|
||||
}
|
||||
}
|
||||
|
@ -1240,7 +1240,7 @@ gst_d3d12_swapchain_sink_show_frame (GstVideoSink * sink, GstBuffer * buf)
|
|||
}
|
||||
|
||||
/* To update fence value */
|
||||
gst_d3d12_command_queue_execute_command_lists (priv->cq,
|
||||
gst_d3d12_cmd_queue_execute_command_lists (priv->cq,
|
||||
0, nullptr, &priv->fence_val);
|
||||
|
||||
return GST_FLOW_OK;
|
||||
|
|
|
@ -229,7 +229,7 @@ struct RenderContext
|
|||
{
|
||||
device = (GstD3D12Device *) gst_object_ref (dev);
|
||||
auto device_handle = gst_d3d12_device_get_device_handle (device);
|
||||
ca_pool = gst_d3d12_command_allocator_pool_new (device_handle,
|
||||
ca_pool = gst_d3d12_cmd_alloc_pool_new (device_handle,
|
||||
D3D12_COMMAND_LIST_TYPE_DIRECT);
|
||||
}
|
||||
|
||||
|
@ -280,7 +280,7 @@ struct RenderContext
|
|||
|
||||
ComPtr<ID3D12GraphicsCommandList> cl;
|
||||
std::queue<guint64> scheduled;
|
||||
GstD3D12CommandAllocatorPool *ca_pool;
|
||||
GstD3D12CmdAllocPool *ca_pool;
|
||||
|
||||
D3D12_VIEWPORT viewport;
|
||||
D3D12_RECT scissor_rect;
|
||||
|
@ -2189,19 +2189,19 @@ gst_d3d12_test_src_create (GstBaseSrc * bsrc, guint64 offset,
|
|||
if (ret != GST_FLOW_OK)
|
||||
return ret;
|
||||
|
||||
GstD3D12CommandAllocator *gst_ca;
|
||||
if (!gst_d3d12_command_allocator_pool_acquire (priv->ctx->ca_pool, &gst_ca)) {
|
||||
GstD3D12CmdAlloc *gst_ca;
|
||||
if (!gst_d3d12_cmd_alloc_pool_acquire (priv->ctx->ca_pool, &gst_ca)) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't acquire command allocator");
|
||||
gst_clear_buffer (&convert_buffer);
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
|
||||
auto ca = gst_d3d12_command_allocator_get_handle (gst_ca);
|
||||
auto ca = gst_d3d12_cmd_alloc_get_handle (gst_ca);
|
||||
|
||||
auto hr = ca->Reset ();
|
||||
if (!gst_d3d12_result (hr, self->device)) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't reset command allocator");
|
||||
gst_d3d12_command_allocator_unref (gst_ca);
|
||||
gst_d3d12_cmd_alloc_unref (gst_ca);
|
||||
gst_clear_buffer (&convert_buffer);
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
|
@ -2212,7 +2212,7 @@ gst_d3d12_test_src_create (GstBaseSrc * bsrc, guint64 offset,
|
|||
ca, nullptr, IID_PPV_ARGS (&priv->ctx->cl));
|
||||
if (!gst_d3d12_result (hr, self->device)) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't reset command list");
|
||||
gst_d3d12_command_allocator_unref (gst_ca);
|
||||
gst_d3d12_cmd_alloc_unref (gst_ca);
|
||||
gst_clear_buffer (&convert_buffer);
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
|
@ -2220,7 +2220,7 @@ gst_d3d12_test_src_create (GstBaseSrc * bsrc, guint64 offset,
|
|||
hr = priv->ctx->cl->Reset (ca, nullptr);
|
||||
if (!gst_d3d12_result (hr, self->device)) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't reset command list");
|
||||
gst_d3d12_command_allocator_unref (gst_ca);
|
||||
gst_d3d12_cmd_alloc_unref (gst_ca);
|
||||
gst_clear_buffer (&convert_buffer);
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ struct SwapChainResource
|
|||
GstD3D12Converter *conv = nullptr;
|
||||
GstD3D12OverlayCompositor *comp = nullptr;
|
||||
GstD3D12Device *device = nullptr;
|
||||
GstD3D12CommandAllocatorPool *ca_pool = nullptr;
|
||||
GstD3D12CmdAllocPool *ca_pool = nullptr;
|
||||
UINT64 fence_val = 0;
|
||||
std::queue<UINT64> prev_fence_val;
|
||||
DXGI_FORMAT render_format = DXGI_FORMAT_UNKNOWN;
|
||||
|
|
|
@ -51,7 +51,7 @@ SwapChainResource::SwapChainResource (GstD3D12Device * dev)
|
|||
{
|
||||
device = (GstD3D12Device *) gst_object_ref (dev);
|
||||
auto device_handle = gst_d3d12_device_get_device_handle (device);
|
||||
ca_pool = gst_d3d12_command_allocator_pool_new (device_handle,
|
||||
ca_pool = gst_d3d12_cmd_alloc_pool_new (device_handle,
|
||||
D3D12_COMMAND_LIST_TYPE_DIRECT);
|
||||
}
|
||||
|
||||
|
@ -85,9 +85,9 @@ void
|
|||
SwapChainResource::clear_resource ()
|
||||
{
|
||||
if (!buffers.empty ()) {
|
||||
auto cq = gst_d3d12_device_get_command_queue (device,
|
||||
auto cq = gst_d3d12_device_get_cmd_queue (device,
|
||||
D3D12_COMMAND_LIST_TYPE_DIRECT);
|
||||
gst_d3d12_command_queue_idle_for_swapchain (cq, fence_val);
|
||||
gst_d3d12_cmd_queue_idle_for_swapchain (cq, fence_val);
|
||||
prev_fence_val = { };
|
||||
}
|
||||
|
||||
|
@ -229,9 +229,9 @@ SwapChain::~SwapChain()
|
|||
{
|
||||
lock_.lock ();
|
||||
if (!resource_->buffers.empty ()) {
|
||||
auto cq = gst_d3d12_device_get_command_queue (resource_->device,
|
||||
auto cq = gst_d3d12_device_get_cmd_queue (resource_->device,
|
||||
D3D12_COMMAND_LIST_TYPE_DIRECT);
|
||||
gst_d3d12_command_queue_idle_for_swapchain (cq, resource_->fence_val);
|
||||
gst_d3d12_cmd_queue_idle_for_swapchain (cq, resource_->fence_val);
|
||||
}
|
||||
|
||||
resource_ = nullptr;
|
||||
|
@ -279,9 +279,9 @@ SwapChain::setup_swapchain (GstD3D12Window * window, GstD3D12Device * device,
|
|||
|
||||
auto device = resource_->device;
|
||||
auto factory = gst_d3d12_device_get_factory_handle (device);
|
||||
auto cq = gst_d3d12_device_get_command_queue (device,
|
||||
auto cq = gst_d3d12_device_get_cmd_queue (device,
|
||||
D3D12_COMMAND_LIST_TYPE_DIRECT);
|
||||
auto cq_handle = gst_d3d12_command_queue_get_handle (cq);
|
||||
auto cq_handle = gst_d3d12_cmd_queue_get_handle (cq);
|
||||
|
||||
ComPtr < IDXGISwapChain1 > swapchain;
|
||||
auto hr = factory->CreateSwapChainForHwnd (cq_handle, hwnd, &desc, nullptr,
|
||||
|
|
|
@ -501,17 +501,17 @@ gst_d3d12_window_render (GstD3D12Window * self, SwapChainResource * resource,
|
|||
|
||||
gst_d3d12_overlay_compositor_upload (resource->comp, buffer);
|
||||
|
||||
GstD3D12CommandAllocator *gst_ca;
|
||||
if (!gst_d3d12_command_allocator_pool_acquire (resource->ca_pool, &gst_ca)) {
|
||||
GstD3D12CmdAlloc *gst_ca;
|
||||
if (!gst_d3d12_cmd_alloc_pool_acquire (resource->ca_pool, &gst_ca)) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't acquire command allocator");
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
|
||||
auto ca = gst_d3d12_command_allocator_get_handle (gst_ca);
|
||||
auto ca = gst_d3d12_cmd_alloc_get_handle (gst_ca);
|
||||
auto hr = ca->Reset ();
|
||||
if (!gst_d3d12_result (hr, device)) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't reset command list");
|
||||
gst_d3d12_command_allocator_unref (gst_ca);
|
||||
gst_d3d12_cmd_alloc_unref (gst_ca);
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
|
||||
|
@ -522,7 +522,7 @@ gst_d3d12_window_render (GstD3D12Window * self, SwapChainResource * resource,
|
|||
ca, nullptr, IID_PPV_ARGS (&cl));
|
||||
if (!gst_d3d12_result (hr, device)) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't create command list");
|
||||
gst_d3d12_command_allocator_unref (gst_ca);
|
||||
gst_d3d12_cmd_alloc_unref (gst_ca);
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
|
||||
|
@ -532,7 +532,7 @@ gst_d3d12_window_render (GstD3D12Window * self, SwapChainResource * resource,
|
|||
hr = cl->Reset (ca, nullptr);
|
||||
if (!gst_d3d12_result (hr, device)) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't reset command list");
|
||||
gst_d3d12_command_allocator_unref (gst_ca);
|
||||
gst_d3d12_cmd_alloc_unref (gst_ca);
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -567,9 +567,9 @@ gst_d3d12_window_render (GstD3D12Window * self, SwapChainResource * resource,
|
|||
|
||||
swapbuf->is_first = false;
|
||||
|
||||
auto cq = gst_d3d12_device_get_command_queue (device,
|
||||
auto cq = gst_d3d12_device_get_cmd_queue (device,
|
||||
D3D12_COMMAND_LIST_TYPE_DIRECT);
|
||||
auto cq_handle = gst_d3d12_command_queue_get_handle (cq);
|
||||
auto cq_handle = gst_d3d12_cmd_queue_get_handle (cq);
|
||||
if (!gst_d3d12_converter_convert_buffer (resource->conv,
|
||||
buffer, conv_outbuf, fence_data, cl.Get (), TRUE)) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't build convert command");
|
||||
|
@ -646,7 +646,7 @@ gst_d3d12_window_render (GstD3D12Window * self, SwapChainResource * resource,
|
|||
}
|
||||
|
||||
ID3D12CommandList *cmd_list[] = { cl.Get () };
|
||||
hr = gst_d3d12_command_queue_execute_command_lists (cq,
|
||||
hr = gst_d3d12_cmd_queue_execute_command_lists (cq,
|
||||
1, cmd_list, &resource->fence_val);
|
||||
if (!gst_d3d12_result (hr, device)) {
|
||||
GST_ERROR_OBJECT (self, "Signal failed");
|
||||
|
@ -654,7 +654,7 @@ gst_d3d12_window_render (GstD3D12Window * self, SwapChainResource * resource,
|
|||
return GST_FLOW_ERROR;
|
||||
}
|
||||
|
||||
gst_d3d12_command_queue_set_notify (cq, resource->fence_val,
|
||||
gst_d3d12_cmd_queue_set_notify (cq, resource->fence_val,
|
||||
fence_data, (GDestroyNotify) gst_d3d12_fence_data_unref);
|
||||
|
||||
if (selected_overlay_mode != GST_D3D12_WINDOW_OVERLAY_NONE) {
|
||||
|
@ -675,23 +675,23 @@ gst_d3d12_window_render (GstD3D12Window * self, SwapChainResource * resource,
|
|||
}
|
||||
|
||||
if (state_after != D3D12_RESOURCE_STATE_COMMON) {
|
||||
if (!gst_d3d12_command_allocator_pool_acquire (resource->ca_pool, &gst_ca)) {
|
||||
if (!gst_d3d12_cmd_alloc_pool_acquire (resource->ca_pool, &gst_ca)) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't acquire command allocator");
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
|
||||
ca = gst_d3d12_command_allocator_get_handle (gst_ca);
|
||||
ca = gst_d3d12_cmd_alloc_get_handle (gst_ca);
|
||||
hr = ca->Reset ();
|
||||
if (!gst_d3d12_result (hr, device)) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't reset command allocator");
|
||||
gst_d3d12_command_allocator_unref (gst_ca);
|
||||
gst_d3d12_cmd_alloc_unref (gst_ca);
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
|
||||
hr = cl->Reset (ca, nullptr);
|
||||
if (!gst_d3d12_result (hr, device)) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't reset command list");
|
||||
gst_d3d12_command_allocator_unref (gst_ca);
|
||||
gst_d3d12_cmd_alloc_unref (gst_ca);
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
|
||||
|
@ -709,7 +709,7 @@ gst_d3d12_window_render (GstD3D12Window * self, SwapChainResource * resource,
|
|||
return GST_FLOW_ERROR;
|
||||
}
|
||||
|
||||
hr = gst_d3d12_command_queue_execute_command_lists (cq,
|
||||
hr = gst_d3d12_cmd_queue_execute_command_lists (cq,
|
||||
1, cmd_list, &resource->fence_val);
|
||||
if (!gst_d3d12_result (hr, device)) {
|
||||
GST_ERROR_OBJECT (self, "Signal failed");
|
||||
|
@ -717,7 +717,7 @@ gst_d3d12_window_render (GstD3D12Window * self, SwapChainResource * resource,
|
|||
return GST_FLOW_ERROR;
|
||||
}
|
||||
|
||||
gst_d3d12_command_queue_set_notify (cq, resource->fence_val,
|
||||
gst_d3d12_cmd_queue_set_notify (cq, resource->fence_val,
|
||||
fence_data, (GDestroyNotify) gst_d3d12_fence_data_unref);
|
||||
}
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ struct GstDWriteD3D12RenderPrivate
|
|||
|
||||
ComPtr<ID3D12GraphicsCommandList> cl;
|
||||
GstD3D12FenceDataPool *fence_data_pool;
|
||||
GstD3D12CommandAllocatorPool *ca_pool = nullptr;
|
||||
GstD3D12CmdAllocPool *ca_pool = nullptr;
|
||||
ComPtr<ID3D11On12Device> device11on12;
|
||||
ComPtr<ID3D11Device> device11;
|
||||
ComPtr<ID3D11DeviceContext> d3d11_context;
|
||||
|
@ -393,17 +393,17 @@ gst_dwrite_d3d12_render_blend (GstDWriteRender * render, GstBuffer * layout_buf,
|
|||
}
|
||||
gst_d3d12_frame_unmap (&out_frame);
|
||||
|
||||
GstD3D12CommandAllocator *gst_ca;
|
||||
if (!gst_d3d12_command_allocator_pool_acquire (priv->ca_pool, &gst_ca)) {
|
||||
GstD3D12CmdAlloc *gst_ca;
|
||||
if (!gst_d3d12_cmd_alloc_pool_acquire (priv->ca_pool, &gst_ca)) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't acquire command allocator");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
auto ca = gst_d3d12_command_allocator_get_handle (gst_ca);
|
||||
auto ca = gst_d3d12_cmd_alloc_get_handle (gst_ca);
|
||||
auto hr = ca->Reset ();
|
||||
if (!gst_d3d12_result (hr, priv->device)) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't reset command allocator");
|
||||
gst_d3d12_command_allocator_unref (gst_ca);
|
||||
gst_d3d12_cmd_alloc_unref (gst_ca);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -413,14 +413,14 @@ gst_dwrite_d3d12_render_blend (GstDWriteRender * render, GstBuffer * layout_buf,
|
|||
ca, nullptr, IID_PPV_ARGS (&priv->cl));
|
||||
if (!gst_d3d12_result (hr, priv->device)) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't create command list");
|
||||
gst_d3d12_command_allocator_unref (gst_ca);
|
||||
gst_d3d12_cmd_alloc_unref (gst_ca);
|
||||
return FALSE;
|
||||
}
|
||||
} else {
|
||||
hr = priv->cl->Reset (ca, nullptr);
|
||||
if (!gst_d3d12_result (hr, priv->device)) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't reset command list");
|
||||
gst_d3d12_command_allocator_unref (gst_ca);
|
||||
gst_d3d12_cmd_alloc_unref (gst_ca);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
@ -436,9 +436,9 @@ gst_dwrite_d3d12_render_blend (GstDWriteRender * render, GstBuffer * layout_buf,
|
|||
|
||||
gboolean ret = TRUE;
|
||||
GstBuffer *bgra_buf = nullptr;
|
||||
auto cq = gst_d3d12_device_get_command_queue (priv->device,
|
||||
auto cq = gst_d3d12_device_get_cmd_queue (priv->device,
|
||||
D3D12_COMMAND_LIST_TYPE_DIRECT);
|
||||
auto fence = gst_d3d12_command_queue_get_fence_handle (cq);
|
||||
auto fence = gst_d3d12_cmd_queue_get_fence_handle (cq);
|
||||
|
||||
if (priv->direct_blend) {
|
||||
GST_LOG_OBJECT (self, "Direct blend");
|
||||
|
@ -515,13 +515,13 @@ gst_dwrite_d3d12_render_blend (GstDWriteRender * render, GstBuffer * layout_buf,
|
|||
|
||||
if (ret) {
|
||||
ID3D12CommandList *cl[] = { priv->cl.Get () };
|
||||
hr = gst_d3d12_command_queue_execute_command_lists (cq,
|
||||
hr = gst_d3d12_cmd_queue_execute_command_lists (cq,
|
||||
1, cl, &priv->fence_val);
|
||||
ret = gst_d3d12_result (hr, priv->device);
|
||||
}
|
||||
|
||||
if (ret) {
|
||||
gst_d3d12_command_queue_set_notify (cq, priv->fence_val,
|
||||
gst_d3d12_cmd_queue_set_notify (cq, priv->fence_val,
|
||||
FENCE_NOTIFY_MINI_OBJECT (fence_data));
|
||||
|
||||
for (guint i = 0; i < gst_buffer_n_memory (output); i++) {
|
||||
|
@ -821,7 +821,7 @@ gst_dwrite_d3d12_render_prepare (GstDWriteD3D12Render * self)
|
|||
priv->device11->GetImmediateContext (&priv->d3d11_context);
|
||||
|
||||
auto device = gst_d3d12_device_get_device_handle (priv->device);
|
||||
priv->ca_pool = gst_d3d12_command_allocator_pool_new (device,
|
||||
priv->ca_pool = gst_d3d12_cmd_alloc_pool_new (device,
|
||||
D3D12_COMMAND_LIST_TYPE_DIRECT);
|
||||
|
||||
GST_DEBUG_OBJECT (self, "Resource prepared");
|
||||
|
|
Loading…
Reference in a new issue