hardware/intel/common/libva
Revisão | 382acf177ce18c069e0293408afa34c5875296ff (tree) |
---|---|
Hora | 2018-12-26 17:13:22 |
Autor | Linjie Fu <linjie.fu@inte...> |
Commiter | Xiang, Haihao |
va/va_trace: add va_TraceSurface support for VA_FOURCC_P010
Add va_TraceSurface support for VA_FOURCC_P010.
Currently, va_TraceSurface could only support nv12.
Add pixel_byte to indicate the bytes per pixel according to FOURCC.
Signed-off-by: Linjie Fu <linjie.fu@intel.com>
@@ -955,6 +955,7 @@ static void va_TraceSurface(VADisplay dpy, VAContextID context) | ||
955 | 955 | unsigned int buffer_name; |
956 | 956 | void *buffer = NULL; |
957 | 957 | unsigned char *Y_data, *UV_data, *tmp; |
958 | + unsigned int pixel_byte; | |
958 | 959 | VAStatus va_status; |
959 | 960 | DPY2TRACECTX(dpy, context, VA_INVALID_ID); |
960 | 961 |
@@ -1001,20 +1002,27 @@ static void va_TraceSurface(VADisplay dpy, VAContextID context) | ||
1001 | 1002 | Y_data = (unsigned char*)buffer; |
1002 | 1003 | UV_data = (unsigned char*)buffer + chroma_u_offset; |
1003 | 1004 | |
1005 | + if (fourcc == VA_FOURCC_P010) | |
1006 | + pixel_byte = 2; | |
1007 | + else | |
1008 | + pixel_byte = 1; | |
1009 | + | |
1004 | 1010 | tmp = Y_data + luma_stride * trace_ctx->trace_surface_yoff; |
1011 | + | |
1005 | 1012 | for (i=0; i<trace_ctx->trace_surface_height; i++) { |
1006 | 1013 | fwrite(tmp + trace_ctx->trace_surface_xoff, |
1007 | 1014 | trace_ctx->trace_surface_width, |
1008 | - 1, trace_ctx->trace_fp_surface); | |
1015 | + pixel_byte, trace_ctx->trace_fp_surface); | |
1009 | 1016 | |
1010 | 1017 | tmp += luma_stride; |
1011 | 1018 | } |
1019 | + | |
1012 | 1020 | tmp = UV_data + chroma_u_stride * trace_ctx->trace_surface_yoff / 2; |
1013 | - if (fourcc == VA_FOURCC_NV12) { | |
1021 | + if (fourcc == VA_FOURCC_NV12 || fourcc == VA_FOURCC_P010) { | |
1014 | 1022 | for (i=0; i<trace_ctx->trace_surface_height/2; i++) { |
1015 | 1023 | fwrite(tmp + trace_ctx->trace_surface_xoff, |
1016 | 1024 | trace_ctx->trace_surface_width, |
1017 | - 1, trace_ctx->trace_fp_surface); | |
1025 | + pixel_byte, trace_ctx->trace_fp_surface); | |
1018 | 1026 | |
1019 | 1027 | tmp += chroma_u_stride; |
1020 | 1028 | } |