d3d12memory: Define new D3D12 map flags

Define GST_MAP_READ_D3D12 and GST_MAP_READ_D3D12 flags

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6494>
This commit is contained in:
Seungha Yang 2024-03-31 20:28:27 +09:00 committed by GStreamer Marge Bot
parent abeccdd6bc
commit 7829315305
5 changed files with 20 additions and 12 deletions

View file

@ -704,8 +704,7 @@ gst_d3d12_encoder_upload_frame (GstD3D12Encoder * self, GstBuffer * buffer)
auto dmem = GST_D3D12_MEMORY_CAST (mem);
if (gst_d3d12_device_is_equal (dmem->device, self->device)) {
GstMapInfo map_info;
if (!gst_memory_map (mem, &map_info,
(GstMapFlags) (GST_MAP_READ | GST_MAP_D3D12))) {
if (!gst_memory_map (mem, &map_info, GST_MAP_READ_D3D12)) {
GST_ERROR_OBJECT (self, "Couldn't map memory");
return nullptr;
}
@ -813,8 +812,7 @@ gst_d3d12_encoder_upload_frame (GstD3D12Encoder * self, GstBuffer * buffer)
GstMapInfo map_info;
mem = gst_buffer_peek_memory (upload, 0);
if (!gst_memory_map (mem, &map_info,
(GstMapFlags) (GST_MAP_READ | GST_MAP_D3D12))) {
if (!gst_memory_map (mem, &map_info, GST_MAP_READ_D3D12)) {
GST_ERROR_OBJECT (self, "Couldn't map memory");
gst_buffer_unref (upload);
return nullptr;

View file

@ -582,8 +582,7 @@ public:
shared_data, (GDestroyNotify) shared_texture_data_free);
}
if (!gst_memory_map (mem,
&map_info, (GstMapFlags) (GST_MAP_WRITE | GST_MAP_D3D12))) {
if (!gst_memory_map (mem, &map_info, GST_MAP_WRITE_D3D12)) {
GST_ERROR_OBJECT (obj_, "Couldn't map memory");
gst_buffer_unref (outbuf);
return GST_FLOW_ERROR;

View file

@ -620,8 +620,7 @@ gst_d3d12_ipc_sink_prepare (GstBaseSink * sink, GstBuffer * buf)
dmem = (GstD3D12Memory *) gst_buffer_peek_memory (uploaded, 0);
/* Upload staging to device memory */
if (!gst_video_frame_map (&frame, &priv->info, uploaded,
(GstMapFlags) (GST_MAP_READ | GST_MAP_D3D12))) {
if (!gst_video_frame_map (&frame, &priv->info, uploaded, GST_MAP_READ_D3D12)) {
GST_ERROR_OBJECT (self, "Couldn't upload memory");
gst_buffer_unref (uploaded);
return GST_FLOW_ERROR;

View file

@ -68,6 +68,20 @@ G_BEGIN_DECLS
*/
#define GST_MAP_D3D12 (GST_MAP_FLAG_LAST << 1)
/**
* GST_MAP_READ_D3D12:
*
* GstMapFlags value alias for GST_MAP_READ | GST_MAP_D3D12
*/
#define GST_MAP_READ_D3D12 ((GstMapFlags) (GST_MAP_READ | GST_MAP_D3D12))
/**
* GST_MAP_WRITE_D3D12:
*
* GstMapFlags value alias for GST_MAP_WRITE | GST_MAP_D3D12
*/
#define GST_MAP_WRITE_D3D12 ((GstMapFlags) (GST_MAP_WRITE | GST_MAP_D3D12))
/**
* GstD3D12MemoryTransfer:
*

View file

@ -228,15 +228,13 @@ gst_d3d12_buffer_copy_into (GstBuffer * dst, GstBuffer * src,
/* Map memory to execute pending upload and wait for external fence */
GstMapInfo map_info;
if (!gst_memory_map (src_mem, &map_info,
(GstMapFlags) (GST_MAP_READ | GST_MAP_D3D12))) {
if (!gst_memory_map (src_mem, &map_info, GST_MAP_READ_D3D12)) {
GST_ERROR ("Cannot map src d3d12 memory");
return FALSE;
}
gst_memory_unmap (src_mem, &map_info);
if (!gst_memory_map (dst_mem, &map_info,
(GstMapFlags) (GST_MAP_WRITE | GST_MAP_D3D12))) {
if (!gst_memory_map (dst_mem, &map_info, GST_MAP_WRITE_D3D12)) {
GST_ERROR ("Cannot map dst d3d12 memory");
return FALSE;
}