[Mesa-dev] [PATCH 10/14] st/va: make internal func vlVaHandleSurfaceAllocate() call simpler

Leo Liu leo.liu at amd.com
Tue Sep 19 19:05:01 UTC 2017


---
 src/gallium/state_trackers/va/picture.c    | 2 +-
 src/gallium/state_trackers/va/surface.c    | 7 ++-----
 src/gallium/state_trackers/va/va_private.h | 2 +-
 3 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/src/gallium/state_trackers/va/picture.c b/src/gallium/state_trackers/va/picture.c
index 81bd196..5e79465 100644
--- a/src/gallium/state_trackers/va/picture.c
+++ b/src/gallium/state_trackers/va/picture.c
@@ -662,7 +662,7 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID context_id)
    if (realloc) {
       struct pipe_video_buffer *old_buf = surf->buffer;
 
-      if (vlVaHandleSurfaceAllocate(ctx, surf, &surf->templat) != VA_STATUS_SUCCESS) {
+      if (vlVaHandleSurfaceAllocate(drv, surf, &surf->templat) != VA_STATUS_SUCCESS) {
          mtx_unlock(&drv->mutex);
          return VA_STATUS_ERROR_ALLOCATION_FAILED;
       }
diff --git a/src/gallium/state_trackers/va/surface.c b/src/gallium/state_trackers/va/surface.c
index 67773cf..643cdcd 100644
--- a/src/gallium/state_trackers/va/surface.c
+++ b/src/gallium/state_trackers/va/surface.c
@@ -557,15 +557,12 @@ suface_from_external_memory(VADriverContextP ctx, vlVaSurface *surface,
 }
 
 VAStatus
-vlVaHandleSurfaceAllocate(VADriverContextP ctx, vlVaSurface *surface,
+vlVaHandleSurfaceAllocate(vlVaDriver *drv, vlVaSurface *surface,
                           struct pipe_video_buffer *templat)
 {
-   vlVaDriver *drv;
    struct pipe_surface **surfaces;
    unsigned i;
 
-   drv = VL_VA_DRIVER(ctx);
-
    surface->buffer = drv->pipe->create_video_buffer(drv->pipe, templat);
    if (!surface->buffer)
       return VA_STATUS_ERROR_ALLOCATION_FAILED;
@@ -730,7 +727,7 @@ vlVaCreateSurfaces2(VADriverContextP ctx, unsigned int format,
              !(memory_attibute->flags & VA_SURFACE_EXTBUF_DESC_ENABLE_TILING))
             templat.bind = PIPE_BIND_LINEAR | PIPE_BIND_SHARED;
 
-	 vaStatus = vlVaHandleSurfaceAllocate(ctx, surf, &templat);
+	 vaStatus = vlVaHandleSurfaceAllocate(drv, surf, &templat);
          if (vaStatus != VA_STATUS_SUCCESS)
             goto free_surf;
          break;
diff --git a/src/gallium/state_trackers/va/va_private.h b/src/gallium/state_trackers/va/va_private.h
index 5b1b832..61712ce 100644
--- a/src/gallium/state_trackers/va/va_private.h
+++ b/src/gallium/state_trackers/va/va_private.h
@@ -404,7 +404,7 @@ VAStatus vlVaQueryVideoProcPipelineCaps(VADriverContextP ctx, VAContextID contex
 
 // internal functions
 VAStatus vlVaHandleVAProcPipelineParameterBufferType(vlVaDriver *drv, vlVaContext *context, vlVaBuffer *buf);
-VAStatus vlVaHandleSurfaceAllocate(VADriverContextP ctx, vlVaSurface *surface, struct pipe_video_buffer *templat);
+VAStatus vlVaHandleSurfaceAllocate(vlVaDriver *drv, vlVaSurface *surface, struct pipe_video_buffer *templat);
 void vlVaGetReferenceFrame(vlVaDriver *drv, VASurfaceID surface_id, struct pipe_video_buffer **ref_frame);
 void vlVaHandlePictureParameterBufferMPEG12(vlVaDriver *drv, vlVaContext *context, vlVaBuffer *buf);
 void vlVaHandleIQMatrixBufferMPEG12(vlVaContext *context, vlVaBuffer *buf);
-- 
2.7.4



More information about the mesa-dev mailing list