Mesa (main): radeon/vcn: reuse the dpb buffers when with the same size.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Aug 31 15:56:02 UTC 2021


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

Author: Leo Liu <leo.liu at amd.com>
Date:   Sun Aug 29 12:24:12 2021 -0400

radeon/vcn: reuse the dpb buffers when with the same size.

To avoid allocate/deallocate frequently.

Signed-off-by: Leo Liu <leo.liu at amd.com>
Reviewed-by: James Zhu <James.Zhu at amd.com>
Reviewed-by: Boyuan Zhang <Boyuan.Zhang at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12610>

---

 src/gallium/drivers/radeon/radeon_vcn_dec.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/radeon/radeon_vcn_dec.c b/src/gallium/drivers/radeon/radeon_vcn_dec.c
index d8e4d66bddb..66169faadf2 100644
--- a/src/gallium/drivers/radeon/radeon_vcn_dec.c
+++ b/src/gallium/drivers/radeon/radeon_vcn_dec.c
@@ -1358,8 +1358,12 @@ static unsigned rvcn_dec_dynamic_dpb_t2_message(struct radeon_decoder *dec, rvcn
          }
       }
       if (i == dec->ref_codec.ref_size) {
-         list_del(&d->list);
-         list_addtail(&d->list, &dec->dpb_unref_list);
+         if (d->dpb.res->b.b.width0 * d->dpb.res->b.b.height0 != size) {
+            list_del(&d->list);
+            list_addtail(&d->list, &dec->dpb_unref_list);
+         } else {
+            d->index = 0x7f;
+         }
       }
    }
 
@@ -1371,11 +1375,9 @@ static unsigned rvcn_dec_dynamic_dpb_t2_message(struct radeon_decoder *dec, rvcn
    }
 
    if (!dpb) {
-      list_for_each_entry_safe(struct rvcn_dec_dynamic_dpb_t2, d, &dec->dpb_unref_list, list) {
-         if (d->dpb.res->b.b.width0 * d->dpb.res->b.b.height0 == size) {
+      list_for_each_entry_safe(struct rvcn_dec_dynamic_dpb_t2, d, &dec->dpb_ref_list, list) {
+         if (d->index == 0x7f) {
             d->index = dec->ref_codec.index;
-            list_del(&d->list);
-            list_addtail(&d->list, &dec->dpb_ref_list);
             dpb = d;
             break;
          }



More information about the mesa-commit mailing list