Module: Mesa
Branch: main
Commit: f6f9e3fe08b60975e974afe88a99e48b67367a80
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f6f9e3fe08b60975e974afe88a99e48b67367a80

Author: Peyton Lee <peyto...@amd.com>
Date:   Wed Nov 29 18:01:23 2023 +0800

radeonsi/vpe: move flush to si_vpe_processor_end_frame

move cs_flush() to si_vpe_processor_end_frame() to fit the behavior as decoder.

Signed-off-by: Peyton Lee <peyto...@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26841>

---

 src/gallium/drivers/radeonsi/si_vpe.c | 24 +++++++++++-------------
 1 file changed, 11 insertions(+), 13 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_vpe.c 
b/src/gallium/drivers/radeonsi/si_vpe.c
index 3b78cb5bfdf..0b52b16850a 100755
--- a/src/gallium/drivers/radeonsi/si_vpe.c
+++ b/src/gallium/drivers/radeonsi/si_vpe.c
@@ -684,7 +684,6 @@ si_vpe_processor_process_frame(struct pipe_video_codec 
*codec,
    struct vpe_build_param *build_param = vpeproc->vpe_build_param;
    struct pipe_surface **src_surfaces;
    struct vpe_bufs_req bufs_required;
-   struct pipe_fence_handle *process_fence = NULL;
 
    assert(codec);
    assert(process_properties);
@@ -906,12 +905,6 @@ si_vpe_processor_process_frame(struct pipe_video_codec 
*codec,
    si_vpe_cs_add_surface_buffer(vpeproc, vpeproc->src_surfaces, 
RADEON_USAGE_READ);
    si_vpe_cs_add_surface_buffer(vpeproc, vpeproc->dst_surfaces, 
RADEON_USAGE_WRITE);
 
-   vpeproc->ws->cs_flush(&vpeproc->cs, PIPE_FLUSH_ASYNC, &process_fence);
-
-   if (process_fence)
-      vpeproc->process_fence = process_fence;
-   SIVPE_INFO(vpeproc->log_level, "Flush success\n");
-
    FREE(build_param->streams);
    SIVPE_DBG(vpeproc->log_level, "Success\n");
    return;
@@ -929,22 +922,27 @@ si_vpe_processor_end_frame(struct pipe_video_codec *codec,
                            struct pipe_picture_desc *picture)
 {
    struct vpe_video_processor *vpeproc = (struct vpe_video_processor *)codec;
+   struct pipe_fence_handle *process_fence = NULL;
    assert(codec);
 
-   if (picture->fence && vpeproc->process_fence) {
-      *picture->fence = vpeproc->process_fence;
+   vpeproc->ws->cs_flush(&vpeproc->cs, PIPE_FLUSH_ASYNC, &process_fence);
+
+   if (picture->fence && process_fence) {
+      *picture->fence = process_fence;
       SIVPE_INFO(vpeproc->log_level, "Assign process fence\n");
-   }
+   } else
+      SIVPE_WARN(vpeproc->log_level, "Fence may have problem!\n");
+
    SIVPE_INFO(vpeproc->log_level, "Success\n");
 }
 
 static void
 si_vpe_processor_flush(struct pipe_video_codec *codec)
 {
-   struct vpe_video_processor *vpeproc = (struct vpe_video_processor *)codec;
-   assert(codec);
+   //struct vpe_video_processor *vpeproc = (struct vpe_video_processor *)codec;
+   //assert(codec);
 
-   SIVPE_DBG(vpeproc->log_level, "Success\n");
+   //SIVPE_DBG(vpeproc->log_level, "Success\n");
    return;
 }
 

Reply via email to