d3d12videosink: Present on GstVideoOverlay::expose()

... so that updated backbuffer can be swapped and presented

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7079>
This commit is contained in:
Seungha Yang 2024-06-21 18:38:04 +09:00 committed by GStreamer Marge Bot
parent 25514c8fc1
commit 69ea20b739
7 changed files with 35 additions and 1 deletions

View file

@ -1532,7 +1532,7 @@ gst_d3d12_video_sink_overlay_expose (GstVideoOverlay * overlay)
auto self = GST_D3D12_VIDEO_SINK (overlay);
auto priv = self->priv;
gst_d3d12_window_set_buffer (priv->window, nullptr);
gst_d3d12_window_expose (priv->window);
}
static void

View file

@ -585,6 +585,18 @@ SwapChain::present ()
return GST_FLOW_OK;
}
void
SwapChain::expose (GstD3D12Window * window)
{
std::lock_guard <std::recursive_mutex> lk (lock_);
if (!resource_->swapchain || !resource_->cached_buf)
return;
auto ret = set_buffer (window, resource_->cached_buf);
if (ret == GST_FLOW_OK)
present ();
}
void
SwapChain::before_rendering ()
{

View file

@ -40,6 +40,7 @@ public:
GstFlowReturn resize_buffer (GstD3D12Window * window);
GstFlowReturn set_buffer (GstD3D12Window * window, GstBuffer * buffer);
GstFlowReturn present ();
void expose (GstD3D12Window * window);
private:
void before_rendering ();

View file

@ -547,6 +547,14 @@ SwapChainProxy::present ()
return sc->present ();
}
void
SwapChainProxy::expose ()
{
auto sc = get_swapchain ();
if (sc)
sc->expose (window_);
}
void
HwndServer::register_window (GstD3D12Window * window)
{

View file

@ -69,6 +69,7 @@ public:
GstFlowReturn resize_buffer (INT width, INT height);
GstFlowReturn set_buffer (GstBuffer * buffer);
GstFlowReturn present ();
void expose ();
private:
std::shared_ptr<SwapChain> get_swapchain ();

View file

@ -720,6 +720,16 @@ gst_d3d12_window_render (GstD3D12Window * self, SwapChainResource * resource,
return GST_FLOW_OK;
}
void
gst_d3d12_window_expose (GstD3D12Window * window)
{
auto priv = window->priv;
auto proxy = priv->proxy.lock ();
if (proxy)
proxy->expose ();
}
GstFlowReturn
gst_d3d12_window_set_buffer (GstD3D12Window * window, GstBuffer * buffer)
{

View file

@ -76,6 +76,8 @@ void gst_d3d12_window_unlock (GstD3D12Window * window);
void gst_d3d12_window_unlock_stop (GstD3D12Window * window);
void gst_d3d12_window_expose (GstD3D12Window * window);
GstFlowReturn gst_d3d12_window_set_buffer (GstD3D12Window * window,
GstBuffer * buffer);