• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

hardware/intel/common/libva


Commit MetaInfo

修订版69d3a3c349b0b8c4aad4f8bb6454b3a8033c25de (tree)
时间2009-06-20 03:20:52
作者Austin Yuan <shengquan.yuan@inte...>
CommiterAustin Yuan

Log Message

Proposed new vaCreateSurfaceFromV4L2Buffer to replace origin vaCreateSurfaceFromMrstV4L2 buffer to make it more generic

Signed-off-by: Austin Yuan <shengquan.yuan@intel.com>

更改概述

差异

--- a/dummy_drv_video/dummy_drv_video.c
+++ b/dummy_drv_video/dummy_drv_video.c
@@ -1154,11 +1154,17 @@ VAStatus dummy_SetDisplayAttributes (
11541154 }
11551155
11561156
1157-VAStatus dummy_DbgCopySurfaceToBuffer(
1157+VAStatus dummy_CopySurfaceToBuffer(
11581158 VADriverContextP ctx,
11591159 VASurfaceID surface,
1160- void **buffer, /* out */
1161- unsigned int *stride /* out */
1160+ unsigned int *fourcc, /* following are output argument */
1161+ unsigned int *luma_stride,
1162+ unsigned int *chroma_u_stride,
1163+ unsigned int *chroma_v_stride,
1164+ unsigned int *luma_offset,
1165+ unsigned int *chroma_u_offset,
1166+ unsigned int *chroma_v_offset,
1167+ void **buffer
11621168 )
11631169 {
11641170 /* TODO */
@@ -1266,7 +1272,7 @@ VAStatus __vaDriverInit_0_29( VADriverContextP ctx )
12661272 ctx->vtable.vaGetDisplayAttributes = dummy_GetDisplayAttributes;
12671273 ctx->vtable.vaSetDisplayAttributes = dummy_SetDisplayAttributes;
12681274
1269- ctx->vtable.vaDbgCopySurfaceToBuffer = dummy_DbgCopySurfaceToBuffer;
1275+ ctx->vtable.vaCopySurfaceToBuffer = dummy_CopySurfaceToBuffer;
12701276
12711277 driver_data = (struct dummy_driver_data *) malloc( sizeof(*driver_data) );
12721278 ctx->pDriverData = (void *) driver_data;
--- a/src/va.c
+++ b/src/va.c
@@ -34,6 +34,8 @@
3434 #include <dlfcn.h>
3535 #include <unistd.h>
3636
37+#include <linux/videodev2.h>
38+
3739 #define VA_STR_VERSION VA_BUILD_DATE VA_BUILD_GIT
3840
3941 #define VA_MAJOR_VERSION 0
@@ -1222,7 +1224,14 @@ VAStatus vaSetDisplayAttributes (
12221224 return ctx->vtable.vaSetDisplayAttributes ( ctx, attr_list, num_attributes );
12231225 }
12241226
1225-
1227+/* Wrap a CI (camera imaging) frame as a VA surface to share captured video between camear
1228+ * and VA encode. With frame_id, VA driver need to call CI interfaces to get the information
1229+ * of the frame, and to determine if the frame can be wrapped as a VA surface
1230+ *
1231+ * Application should make sure the frame is idle before the frame is passed into VA stack
1232+ * and also a vaSyncSurface should be called before application tries to access the frame
1233+ * from CI stack
1234+ */
12261235 VAStatus vaCreateSurfaceFromCIFrame (
12271236 VADisplay dpy,
12281237 unsigned long frame_id,
@@ -1242,33 +1251,42 @@ VAStatus vaCreateSurfaceFromCIFrame (
12421251 }
12431252
12441253
1245-VAStatus vaCreateSurfaceFromMrstV4L2Buf(
1254+/* Wrap a V4L2 buffer as a VA surface, so that V4L2 camera, VA encode
1255+ * can share the data without copy
1256+ * The VA driver should query the camera device from v4l2_fd to see
1257+ * if camera device memory/buffer can be wrapped into a VA surface
1258+ * Buffer information is passed in by v4l2_fmt and v4l2_buf structure,
1259+ * VA driver also needs do further check if the buffer can meet encode
1260+ * hardware requirement, such as dimension, fourcc, stride, etc
1261+ *
1262+ * Application should make sure the buffer is idle before the frame into VA stack
1263+ * and also a vaSyncSurface should be called before application tries to access the frame
1264+ * from V4L2 stack
1265+ */
1266+VAStatus vaCreateSurfaceFromV4L2Buf(
12461267 VADisplay dpy,
1247- unsigned int width,
1248- unsigned int height,
1249- unsigned int size,
1250- unsigned int fourcc,
1251- unsigned int luma_stride,
1252- unsigned int chroma_u_stride,
1253- unsigned int chroma_v_stride,
1254- unsigned int luma_offset,
1255- unsigned int chroma_u_offset,
1256- unsigned int chroma_v_offset,
1257- VASurfaceID *surface /* out */
1268+ int v4l2_fd, /* file descriptor of V4L2 device */
1269+ struct v4l2_format *v4l2_fmt, /* format of V4L2 */
1270+ struct v4l2_buffer *v4l2_buf, /* V4L2 buffer */
1271+ VASurfaceID *surface /* out */
12581272 )
12591273 {
12601274 VADriverContextP ctx;
12611275 CHECK_DISPLAY(dpy);
12621276 ctx = CTX(dpy);
12631277
1264- TRACE(vtable.vaCreateSurfaceFromMrstV4L2Buf);
1278+ TRACE(vtable.vaCreateSurfaceFromV4L2Buf);
12651279
1266- if (ctx->vtable.vaCreateSurfaceFromMrstV4L2Buf)
1267- return ctx->vtable.vaCreateSurfaceFromMrstV4L2Buf( ctx, width, height, size, fourcc, luma_stride, chroma_u_stride, chroma_v_stride, luma_offset, chroma_u_offset, chroma_v_offset, surface );
1280+ if (ctx->vtable.vaCreateSurfaceFromV4L2Buf)
1281+ return ctx->vtable.vaCreateSurfaceFromV4L2Buf( ctx, v4l2_fd, v4l2_fmt, v4l2_buf, surface );
12681282 else
12691283 return VA_STATUS_ERROR_UNKNOWN;
12701284 }
12711285
1286+/* It is a debug interface, and isn't exported in core VAAPI
1287+ * It is used to dump surface data into system memory
1288+ * Application should explicitly call free to release the buffer memory
1289+ */
12721290
12731291 VAStatus vaCopySurfaceToBuffer(VADisplay dpy,
12741292 VASurfaceID surface,
--- a/src/va_backend.h
+++ b/src/va_backend.h
@@ -38,6 +38,7 @@
3838 #endif
3939
4040 #include <stdlib.h>
41+#include <linux/videodev2.h>
4142
4243
4344 typedef struct VADriverContext *VADriverContextP;
@@ -382,19 +383,12 @@ struct VADriverVTable
382383 );
383384
384385
385- VAStatus (*vaCreateSurfaceFromMrstV4L2Buf) (
386- VADriverContextP ctx,
387- unsigned int width,
388- unsigned int height,
389- unsigned int size,
390- unsigned int fourcc,
391- unsigned int luma_stride,
392- unsigned int chroma_u_stride,
393- unsigned int chroma_v_stride,
394- unsigned int luma_offset,
395- unsigned int chroma_u_offset,
396- unsigned int chroma_v_offset,
397- VASurfaceID *surface /* out */
386+ VAStatus (*vaCreateSurfaceFromV4L2Buf) (
387+ VADriverContextP ctx,
388+ int v4l2_fd, /* file descriptor of V4L2 device */
389+ struct v4l2_format *v4l2_fmt, /* format of V4L2 */
390+ struct v4l2_buffer *v4l2_buf, /* V4L2 buffer */
391+ VASurfaceID *surface /* out */
398392 );
399393
400394 VAStatus (*vaCopySurfaceToBuffer) (