OSDN Git Service

va_tpi: vaCreateSurfaceFromKBuf for streaming the video playback to remote monitor
authorjiguoliang <jiguoliang@localhost.ccr.corp.intel.com>
Thu, 25 Aug 2011 15:39:53 +0000 (11:39 -0400)
committerAustin Yuan <shengquan.yuan@gmail.com>
Thu, 22 Sep 2011 03:22:36 +0000 (23:22 -0400)
For such use case, the pipeline is: decode->encode->send to network.
The local decode/playback and the encode process are seperated, thus it
needs the buffer sharing b/w the decode and encode in seperate process.
This API creates/wraps the decoded surface into an encode surface. Its
input parameter is the kernel buffer handle of decoded surface which is
only understandable by driver implementation.

Change-Id: I7953ecf3b7333c1cdb6af5a0f45b054c8840f8e2
Signed-off-by: jiguoliang <guoliangx.ji@intel.com>
Signed-off-by: Austin Yuan <shengquan.yuan@gmail.com>
va/va_backend_tpi.h
va/va_tpi.c
va/va_tpi.h

index f67b30f..ecf5ac9 100644 (file)
@@ -66,26 +66,42 @@ struct VADriverVTableTPI
                 unsigned int luma_offset, /* could be 0 */
                 unsigned int chroma_u_offset, /* UV offset from the beginning of the memory */
                 unsigned int chroma_v_offset
-        );
+                );
 
+        VAStatus (*vaCreateSurfaceFromKBuf)(
+                VADisplay dpy,
+                int width,
+                int height,
+                int format,
+                VASurfaceID *surface,       /* out */
+                unsigned int kbuf_handle, /* kernel buffer handle*/
+                unsigned size, /* kernel buffer size */
+                unsigned int kBuf_fourcc, /* expected fourcc */
+                unsigned int luma_stride, /* luma stride, could be width aligned with a special value */
+                unsigned int chroma_u_stride, /* chroma stride */
+                unsigned int chroma_v_stride,
+                unsigned int luma_offset, /* could be 0 */
+                unsigned int chroma_u_offset, /* UV offset from the beginning of the memory */
+                unsigned int chroma_v_offset
+                );
 
-       VAStatus (*vaPutSurfaceBuf) (
-               VADriverContextP ctx,
-               VASurfaceID surface,
-               unsigned char* data,
-               int* data_len,
-               short srcx,
-               short srcy,
-               unsigned short srcw,
-               unsigned short srch,
-               short destx,
-               short desty,
-               unsigned short destw,
-               unsigned short desth,
-               VARectangle *cliprects, /* client supplied clip list */
-               unsigned int number_cliprects, /* number of clip rects in the clip list */
-               unsigned int flags /* de-interlacing flags */
-       );
+        VAStatus (*vaPutSurfaceBuf) (
+                VADriverContextP ctx,
+                VASurfaceID surface,
+                unsigned char* data,
+                int* data_len,
+                short srcx,
+                short srcy,
+                unsigned short srcw,
+                unsigned short srch,
+                short destx,
+                short desty,
+                unsigned short destw,
+                unsigned short desth,
+                VARectangle *cliprects, /* client supplied clip list */
+                unsigned int number_cliprects, /* number of clip rects in the clip list */
+                unsigned int flags /* de-interlacing flags */
+                );
 };
 
 
index 86385b0..e9169fc 100644 (file)
@@ -137,7 +137,39 @@ VAStatus vaCreateSurfacesForUserPtr(
       return VA_STATUS_ERROR_UNIMPLEMENTED;
 }
 
+/*
+ * Create surface from the Kernel buffer
+ */
+VAStatus vaCreateSurfaceFromKBuf(
+    VADisplay dpy,
+    int width,
+    int height,
+    int format,
+    VASurfaceID *surface,       /* out */
+    unsigned int kbuf_handle, /* kernel buffer handle*/
+    unsigned size, /* kernel buffer size */
+    unsigned int kBuf_fourcc, /* expected fourcc */
+    unsigned int luma_stride, /* luma stride, could be width aligned with a special value */
+    unsigned int chroma_u_stride, /* chroma stride */
+    unsigned int chroma_v_stride,
+    unsigned int luma_offset, /* could be 0 */
+    unsigned int chroma_u_offset, /* UV offset from the beginning of the memory */
+    unsigned int chroma_v_offset
+)
+{
+  VADriverContextP ctx;
+  struct VADriverVTableTPI *tpi;
+  CHECK_DISPLAY(dpy);
+  ctx = CTX(dpy);
 
+  tpi = (struct VADriverVTableTPI *)ctx->vtable_tpi;
+  if (tpi && tpi->vaCreateSurfaceFromKBuf) {
+      return tpi->vaCreateSurfaceFromKBuf( ctx, width, height, format, surface, kbuf_handle,
+                                              size, kBuf_fourcc, luma_stride, chroma_u_stride,
+                                              chroma_v_stride, luma_offset, chroma_u_offset, chroma_v_offset );
+  } else
+      return VA_STATUS_ERROR_UNIMPLEMENTED;
+}
 
 
 VAStatus vaPutSurfaceBuf (
index eb0b1d4..320a358 100644 (file)
@@ -93,6 +93,27 @@ VAStatus vaCreateSurfacesForUserPtr(
     unsigned int chroma_v_offset
 );
 
+/*
+ * Create surface from the Kernel buffer
+ */
+VAStatus vaCreateSurfaceFromKbuf(
+    VADisplay dpy,
+    int width,
+    int height,
+    int format,
+    VASurfaceID *surface,       /* out */
+    unsigned int kbuf_handle, /* kernel buffer handle*/
+    unsigned size, /* kernel buffer size */
+    unsigned int kBuf_fourcc, /* expected fourcc */
+    unsigned int luma_stride, /* luma stride, could be width aligned with a special value */
+    unsigned int chroma_u_stride, /* chroma stride */
+    unsigned int chroma_v_stride,
+    unsigned int luma_offset, /* could be 0 */
+    unsigned int chroma_u_offset, /* UV offset from the beginning of the memory */
+    unsigned int chroma_v_offset
+);
+
+
 #ifdef __cplusplus
 }
 #endif