hardware/intel/common/libva
Revision | df192cfea5b634bf259020e9b88adf975c209746 (tree) |
---|---|
Zeit | 2017-11-22 09:01:31 |
Autor | Artem Shaporenko <artem.shaporenko@inte...> |
Commiter | Xiang, Haihao |
New VAAPI definition for multi-frame processing applicable for Encode, FEI Encode/ENC/Pre-ENC, and VPP in future.
Signed-off-by: Artem Shaporenko artem.shaporenko@intel.com
@@ -1151,6 +1151,96 @@ VAStatus vaDestroyContext ( | ||
1151 | 1151 | return vaStatus; |
1152 | 1152 | } |
1153 | 1153 | |
1154 | +VAStatus vaCreateMFContext ( | |
1155 | + VADisplay dpy, | |
1156 | + VAMFContextID *mf_context /* out */ | |
1157 | +) | |
1158 | +{ | |
1159 | + VADriverContextP ctx; | |
1160 | + VAStatus vaStatus; | |
1161 | + | |
1162 | + CHECK_DISPLAY(dpy); | |
1163 | + ctx = CTX(dpy); | |
1164 | + if(ctx->vtable->vaCreateMFContext == NULL) | |
1165 | + vaStatus = VA_STATUS_ERROR_UNIMPLEMENTED; | |
1166 | + else | |
1167 | + { | |
1168 | + vaStatus = ctx->vtable->vaCreateMFContext( ctx, mf_context); | |
1169 | + VA_TRACE_ALL(va_TraceCreateMFContext, dpy, mf_context); | |
1170 | + } | |
1171 | + | |
1172 | + return vaStatus; | |
1173 | +} | |
1174 | + | |
1175 | +VAStatus vaMFAddContext ( | |
1176 | + VADisplay dpy, | |
1177 | + VAMFContextID mf_context, | |
1178 | + VAContextID context | |
1179 | +) | |
1180 | +{ | |
1181 | + VADriverContextP ctx; | |
1182 | + VAStatus vaStatus; | |
1183 | + | |
1184 | + CHECK_DISPLAY(dpy); | |
1185 | + ctx = CTX(dpy); | |
1186 | + | |
1187 | + if(ctx->vtable->vaMFAddContext == NULL) | |
1188 | + vaStatus = VA_STATUS_ERROR_UNIMPLEMENTED; | |
1189 | + else | |
1190 | + { | |
1191 | + vaStatus = ctx->vtable->vaMFAddContext( ctx, context, mf_context); | |
1192 | + VA_TRACE_ALL(va_TraceMFAddContext, dpy, context, mf_context); | |
1193 | + } | |
1194 | + | |
1195 | + return vaStatus; | |
1196 | +} | |
1197 | + | |
1198 | +VAStatus vaMFReleaseContext ( | |
1199 | + VADisplay dpy, | |
1200 | + VAMFContextID mf_context, | |
1201 | + VAContextID context | |
1202 | +) | |
1203 | +{ | |
1204 | + VADriverContextP ctx; | |
1205 | + VAStatus vaStatus; | |
1206 | + | |
1207 | + CHECK_DISPLAY(dpy); | |
1208 | + ctx = CTX(dpy); | |
1209 | + if(ctx->vtable->vaMFReleaseContext == NULL) | |
1210 | + vaStatus = VA_STATUS_ERROR_UNIMPLEMENTED; | |
1211 | + else | |
1212 | + { | |
1213 | + vaStatus = ctx->vtable->vaMFReleaseContext( ctx, context, mf_context); | |
1214 | + VA_TRACE_ALL(va_TraceMFReleaseContext, dpy, context, mf_context); | |
1215 | + } | |
1216 | + | |
1217 | + return vaStatus; | |
1218 | +} | |
1219 | + | |
1220 | +VAStatus vaMFSubmit ( | |
1221 | + VADisplay dpy, | |
1222 | + VAMFContextID mf_context, | |
1223 | + VAContextID *contexts, | |
1224 | + int num_contexts | |
1225 | +) | |
1226 | +{ | |
1227 | + VADriverContextP ctx; | |
1228 | + VAStatus vaStatus; | |
1229 | + | |
1230 | + CHECK_DISPLAY(dpy); | |
1231 | + ctx = CTX(dpy); | |
1232 | + CHECK_VTABLE(vaStatus, ctx, MFSubmit); | |
1233 | + if(ctx->vtable->vaMFSubmit == NULL) | |
1234 | + vaStatus = VA_STATUS_ERROR_UNIMPLEMENTED; | |
1235 | + else | |
1236 | + { | |
1237 | + vaStatus = ctx->vtable->vaMFSubmit( ctx, mf_context, contexts, num_contexts); | |
1238 | + VA_TRACE_ALL(va_TraceMFSubmit, dpy, mf_context, contexts, num_contexts); | |
1239 | + } | |
1240 | + | |
1241 | + return vaStatus; | |
1242 | +} | |
1243 | + | |
1154 | 1244 | VAStatus vaCreateBuffer ( |
1155 | 1245 | VADisplay dpy, |
1156 | 1246 | VAContextID context, /* in */ |
@@ -1177,6 +1177,86 @@ VAStatus vaDestroyContext ( | ||
1177 | 1177 | VAContextID context |
1178 | 1178 | ); |
1179 | 1179 | |
1180 | +//Multi-frame context | |
1181 | +typedef VAGenericID VAMFContextID; | |
1182 | +/** | |
1183 | + * vaCreateMFContext - Create a multi-frame context | |
1184 | + * interface encapsulating common for all streams memory objects and structures | |
1185 | + * required for single GPU task submission from several VAContextID's. | |
1186 | + * Allocation: This call only creates an instance, doesn't allocate any additional memory. | |
1187 | + * Support identification: Application can identify multi-frame feature support by ability | |
1188 | + * to create multi-frame context. If driver supports multi-frame - call successful, | |
1189 | + * mf_context != NULL and VAStatus = VA_STATUS_SUCCESS, otherwise if multi-frame processing | |
1190 | + * not supported driver returns VA_STATUS_ERROR_UNIMPLEMENTED and mf_context = NULL. | |
1191 | + * return values: | |
1192 | + * VA_STATUS_SUCCESS - operation successful. | |
1193 | + * VA_STATUS_ERROR_UNIMPLEMENTED - no support for multi-frame. | |
1194 | + * dpy: display adapter. | |
1195 | + * mf_context: Multi-Frame context encapsulating all associated context | |
1196 | + * for multi-frame submission. | |
1197 | + */ | |
1198 | +VAStatus vaCreateMFContext ( | |
1199 | + VADisplay dpy, | |
1200 | + VAMFContextID *mf_context /* out */ | |
1201 | +); | |
1202 | + | |
1203 | +/** | |
1204 | + * vaMFAddContext - Provide ability to associate each context used for | |
1205 | + * Multi-Frame submission and common Multi-Frame context. | |
1206 | + * Try to add context to understand if it is supported. | |
1207 | + * Allocation: this call allocates and/or reallocates all memory objects | |
1208 | + * common for all contexts associated with particular Multi-Frame context. | |
1209 | + * All memory required for each context(pixel buffers, internal driver | |
1210 | + * buffers required for processing) allocated during standard vaCreateContext call for each context. | |
1211 | + * Runtime dependency - if current implementation doesn't allow to run different entry points/profile, | |
1212 | + * first context added will set entry point/profile for whole Multi-Frame context, | |
1213 | + * all other entry points and profiles can be rejected to be added. | |
1214 | + * Return values: | |
1215 | + * VA_STATUS_SUCCESS - operation successful, context was added. | |
1216 | + * VA_STATUS_ERROR_OPERATION_FAILED - something unexpected happened - application have to close | |
1217 | + * current mf_context and associated contexts and start working with new ones. | |
1218 | + * VA_STATUS_ERROR_INVALID_CONTEXT - ContextID is invalid, means: | |
1219 | + * 1 - mf_context is not valid context or | |
1220 | + * 2 - driver can't suport different VAEntrypoint or VAProfile simultaneosly | |
1221 | + * and current context contradicts with previously added, application can continue with current mf_context | |
1222 | + * and other contexts passed this call, rejected context can continue work in stand-alone | |
1223 | + * mode or other mf_context. | |
1224 | + * VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT - particular context being added was created with with | |
1225 | + * unsupported VAEntrypoint. Application can continue with current mf_context | |
1226 | + * and other contexts passed this call, rejected context can continue work in stand-alone | |
1227 | + * mode. | |
1228 | + * VA_STATUS_ERROR_UNSUPPORTED_PROFILE - Current context with Particular VAEntrypoint is supported | |
1229 | + * but VAProfile is not supported. Application can continue with current mf_context | |
1230 | + * and other contexts passed this call, rejected context can continue work in stand-alone | |
1231 | + * mode. | |
1232 | + * dpy: display adapter. | |
1233 | + * context: context being associated with Multi-Frame context. | |
1234 | + * mf_context: - multi-frame context used to associate contexts for multi-frame submission. | |
1235 | + */ | |
1236 | +VAStatus vaMFAddContext ( | |
1237 | + VADisplay dpy, | |
1238 | + VAMFContextID mf_context, | |
1239 | + VAContextID context | |
1240 | +); | |
1241 | + | |
1242 | +/** | |
1243 | + * vaMFReleaseContext - Removes context from multi-frame and | |
1244 | + * association with multi-frame context. | |
1245 | + * After association removed vaEndPicture will submit tasks, but not vaMFSubmit. | |
1246 | + * Return values: | |
1247 | + * VA_STATUS_SUCCESS - operation successful, context was removed. | |
1248 | + * VA_STATUS_ERROR_OPERATION_FAILED - something unexpected happened. | |
1249 | + * application need to destroy this VAMFContextID and all assotiated VAContextID | |
1250 | + * dpy: display | |
1251 | + * mf_context: VAMFContextID where context is added | |
1252 | + * context: VAContextID to be added | |
1253 | + */ | |
1254 | +VAStatus vaMFReleaseContext ( | |
1255 | + VADisplay dpy, | |
1256 | + VAMFContextID mf_context, | |
1257 | + VAContextID context | |
1258 | +); | |
1259 | + | |
1180 | 1260 | /** |
1181 | 1261 | * Buffers |
1182 | 1262 | * Buffers are used to pass various types of data from the |
@@ -2658,12 +2738,40 @@ VAStatus vaRenderPicture ( | ||
2658 | 2738 | * The server should start processing all pending operations for this |
2659 | 2739 | * surface. This call is non-blocking. The client can start another |
2660 | 2740 | * Begin/Render/End sequence on a different render target. |
2741 | + * if VAContextID used in this function previously successfully passed | |
2742 | + * vaMFAddContext call, real processing will be started during vaMFSubmit | |
2661 | 2743 | */ |
2662 | 2744 | VAStatus vaEndPicture ( |
2663 | 2745 | VADisplay dpy, |
2664 | 2746 | VAContextID context |
2665 | 2747 | ); |
2666 | 2748 | |
2749 | +/** | |
2750 | + * Make the end of rendering for a pictures in contexts passed with submission. | |
2751 | + * The server should start processing all pending operations for contexts. | |
2752 | + * All contexts passed should be associated through vaMFAddContext | |
2753 | + * and call sequence Begin/Render/End performed. | |
2754 | + * This call is non-blocking. The client can start another | |
2755 | + * Begin/Render/End/vaMFSubmit sequence on a different render targets. | |
2756 | + * Return values: | |
2757 | + * VA_STATUS_SUCCESS - operation successful, context was removed. | |
2758 | + * VA_STATUS_ERROR_INVALID_CONTEXT - mf_context or one of contexts are invalid | |
2759 | + * due to mf_context not created or one of contexts not assotiated with mf_context | |
2760 | + * through vaAddContext. | |
2761 | + * VA_STATUS_ERROR_INVALID_PARAMETER - one of context has not submitted it's frame | |
2762 | + * through vaBeginPicture vaRenderPicture vaEndPicture call sequence. | |
2763 | + * dpy: display | |
2764 | + * mf_context: Multi-Frame context | |
2765 | + * contexts: list of contexts submitting their tasks for multi-frame operation. | |
2766 | + * num_contexts: number of passed contexts. | |
2767 | + */ | |
2768 | +VAStatus vaMFSubmit ( | |
2769 | + VADisplay dpy, | |
2770 | + VAMFContextID mf_context, | |
2771 | + VAContextID * contexts, | |
2772 | + int num_contexts | |
2773 | +); | |
2774 | + | |
2667 | 2775 | /* |
2668 | 2776 | |
2669 | 2777 | Synchronization |
@@ -436,8 +436,31 @@ struct VADriverVTable | ||
436 | 436 | VABufferID buf_id /* in */ |
437 | 437 | ); |
438 | 438 | |
439 | + VAStatus (*vaCreateMFContext) ( | |
440 | + VADriverContextP ctx, | |
441 | + VAMFContextID *mfe_context /* out */ | |
442 | + ); | |
443 | + | |
444 | + VAStatus (*vaMFAddContext) ( | |
445 | + VADriverContextP ctx, | |
446 | + VAMFContextID mf_context, | |
447 | + VAContextID context | |
448 | + ); | |
449 | + | |
450 | + VAStatus (*vaMFReleaseContext) ( | |
451 | + VADriverContextP ctx, | |
452 | + VAMFContextID mf_context, | |
453 | + VAContextID context | |
454 | + ); | |
455 | + | |
456 | + VAStatus (*vaMFSubmit) ( | |
457 | + VADriverContextP ctx, | |
458 | + VAMFContextID mf_context, | |
459 | + VAContextID *contexts, | |
460 | + int num_contexts | |
461 | + ); | |
439 | 462 | /** \brief Reserved bytes for future use, must be zero */ |
440 | - unsigned long reserved[64]; | |
463 | + unsigned long reserved[60]; | |
441 | 464 | }; |
442 | 465 | |
443 | 466 | struct VADriverContext |
@@ -1438,6 +1438,65 @@ void va_TraceDestroyContext ( | ||
1438 | 1438 | UNLOCK_CONTEXT(pva_trace); |
1439 | 1439 | } |
1440 | 1440 | |
1441 | +void va_TraceCreateMFContext ( | |
1442 | + VADisplay dpy, | |
1443 | + VAMFContextID *mf_context /* out */ | |
1444 | +) | |
1445 | +{ | |
1446 | + DPY2TRACECTX(dpy, VA_INVALID_ID, VA_INVALID_ID); | |
1447 | + TRACE_FUNCNAME(idx); | |
1448 | + if (mf_context) { | |
1449 | + va_TraceMsg(trace_ctx, "\tmf_context = 0x%08x\n", *mf_context); | |
1450 | + trace_ctx->trace_context = *mf_context; | |
1451 | + } else | |
1452 | + trace_ctx->trace_context = VA_INVALID_ID; | |
1453 | +} | |
1454 | + | |
1455 | +void va_TraceMFAddContext ( | |
1456 | + VADisplay dpy, | |
1457 | + VAMFContextID mf_context, | |
1458 | + VAContextID context | |
1459 | +) | |
1460 | +{ | |
1461 | + DPY2TRACECTX(dpy, mf_context, VA_INVALID_ID); | |
1462 | + | |
1463 | + TRACE_FUNCNAME(idx); | |
1464 | + va_TraceMsg(trace_ctx, "\tmf_context = 0x%08x\n", mf_context); | |
1465 | + va_TraceMsg(trace_ctx, "\tcontext = 0x%08x\n", context); | |
1466 | +} | |
1467 | + | |
1468 | +void va_TraceMFReleaseContext ( | |
1469 | + VADisplay dpy, | |
1470 | + VAMFContextID mf_context, | |
1471 | + VAContextID context | |
1472 | +) | |
1473 | +{ | |
1474 | + DPY2TRACECTX(dpy, mf_context, VA_INVALID_ID); | |
1475 | + | |
1476 | + TRACE_FUNCNAME(idx); | |
1477 | + va_TraceMsg(trace_ctx, "\tmf_context = 0x%08x\n", mf_context); | |
1478 | + va_TraceMsg(trace_ctx, "\tcontext = 0x%08x\n", context); | |
1479 | +} | |
1480 | + | |
1481 | +void va_TraceMFSubmit ( | |
1482 | + VADisplay dpy, | |
1483 | + VAMFContextID mf_context, | |
1484 | + VAContextID *contexts, | |
1485 | + int num_contexts | |
1486 | +) | |
1487 | +{ | |
1488 | + int i; | |
1489 | + | |
1490 | + DPY2TRACECTX(dpy, mf_context, VA_INVALID_ID); | |
1491 | + | |
1492 | + TRACE_FUNCNAME(idx); | |
1493 | + va_TraceMsg(trace_ctx, "\tmf_context = 0x%08x\n", mf_context); | |
1494 | + | |
1495 | + for(i = 0; i < num_contexts; i++){ | |
1496 | + va_TraceMsg(trace_ctx, "\t\tcontext[%d] = 0x%08x\n", i, contexts[i]); | |
1497 | + } | |
1498 | +} | |
1499 | + | |
1441 | 1500 | void va_TraceCreateBuffer ( |
1442 | 1501 | VADisplay dpy, |
1443 | 1502 | VAContextID context, /* in */ |
@@ -121,6 +121,34 @@ void va_TraceDestroyContext ( | ||
121 | 121 | ); |
122 | 122 | |
123 | 123 | DLL_HIDDEN |
124 | +void va_TraceCreateMFContext ( | |
125 | + VADisplay dpy, | |
126 | + VAContextID *mf_context /* out */ | |
127 | +); | |
128 | + | |
129 | +DLL_HIDDEN | |
130 | +void va_TraceMFAddContext ( | |
131 | + VADisplay dpy, | |
132 | + VAMFContextID mf_context, | |
133 | + VAContextID context | |
134 | +); | |
135 | + | |
136 | +DLL_HIDDEN | |
137 | +void va_TraceMFReleaseContext ( | |
138 | + VADisplay dpy, | |
139 | + VAMFContextID mf_context, | |
140 | + VAContextID context | |
141 | +); | |
142 | + | |
143 | +DLL_HIDDEN | |
144 | +void va_TraceMFSubmit ( | |
145 | + VADisplay dpy, | |
146 | + VAMFContextID mf_context, | |
147 | + VAContextID *contexts, | |
148 | + int num_contexts | |
149 | +); | |
150 | + | |
151 | +DLL_HIDDEN | |
124 | 152 | void va_TraceCreateBuffer ( |
125 | 153 | VADisplay dpy, |
126 | 154 | VAContextID context, /* in */ |