[Libva] [PATCH V3: 1/4] HEVC10bit ENC: add private surface for p010 conversion to nv12

Qu, Pengfei pengfei.qu at intel.com
Wed Sep 7 05:13:04 UTC 2016



-----Original Message-----
From: Xiang, Haihao 
Sent: Tuesday, September 6, 2016 10:00 PM
To: Qu, Pengfei <pengfei.qu at intel.com>; libva at lists.freedesktop.org
Subject: RE: [Libva] [PATCH V3: 1/4] HEVC10bit ENC: add private surface for p010 conversion to nv12



>-----Original Message-----
>From: Libva [mailto:libva-bounces at lists.freedesktop.org] On Behalf Of 
>Pengfei Qu
>Sent: Tuesday, September 6, 2016 8:09 AM
>To: libva at lists.freedesktop.org
>Subject: [Libva] [PATCH V3: 1/4] HEVC10bit ENC: add private surface for 
>p010 conversion to nv12
>
>Signed-off-by: Pengfei Qu <Pengfei.Qu at intel.com>
>---
> src/intel_media.h        |  5 +++++
> src/intel_media_common.c | 10 ++++++++++
> 2 files changed, 15 insertions(+)
>
>diff --git a/src/intel_media.h b/src/intel_media.h index 
>87d315f..4a55a93
>100644
>--- a/src/intel_media.h
>+++ b/src/intel_media.h
>@@ -57,6 +57,11 @@ struct gen_hevc_surface  {
>     GenCodecSurface base;
>     dri_bo *motion_vector_temporal_bo;
>+    //Encoding HEVC10:internal surface keep for P010->NV12 , this is 
>+ only for
>hevc10 to save the P010->NV12
>+    struct object_surface *nv12_surface_obj;
>+    VASurfaceID nv12_surface_id;
>+    VADriverContextP ctx;
>+    int has_p010_to_nv12_done;
> };
>
> typedef struct gen_vp9_surface GenVP9Surface; diff --git 
>a/src/intel_media_common.c b/src/intel_media_common.c index
>8821bc4..01828b0 100644
>--- a/src/intel_media_common.c
>+++ b/src/intel_media_common.c
>@@ -29,6 +29,7 @@
>
> #include "intel_driver.h"
> #include "intel_media.h"
>+#include "i965_drv_video.h"
>
> static pthread_mutex_t free_avc_surface_lock = 
>PTHREAD_MUTEX_INITIALIZER;
>
>@@ -92,6 +93,9 @@ gen_free_hevc_surface(void **data)
>
>     pthread_mutex_lock(&free_hevc_surface_lock);
>
>+    if (!data || !*data)
>+        return;


Please unlock the mutex first before returning.  Actually the above check is unnecessary because data is non-NULL when  gen_free_hevc_surface() is called, and *data is checked beblow.
[Pengfei]agree

>+
>     hevc_surface = *data;
>
>     if (!hevc_surface) {
>@@ -102,6 +106,12 @@ gen_free_hevc_surface(void **data)
>     dri_bo_unreference(hevc_surface->motion_vector_temporal_bo);
>     hevc_surface->motion_vector_temporal_bo = NULL;
>
>+    if (hevc_surface->nv12_surface_obj) {
>+        i965_DestroySurfaces(hevc_surface->ctx, &hevc_surface-
>>nv12_surface_id, 1);
>+        hevc_surface->nv12_surface_id = VA_INVALID_SURFACE;
>+        hevc_surface->nv12_surface_obj = NULL;
>+    }
>+
>     free(hevc_surface);
>     *data = NULL;
>
>--
>2.7.4
>
>_______________________________________________
>Libva mailing list
>Libva at lists.freedesktop.org
>https://lists.freedesktop.org/mailman/listinfo/libva


More information about the Libva mailing list