Skip to content

Commit 347520e

Browse files
committed
Add new error code to indicate the reset happended in the driver.
Use VA_STATUS_ERROR_RESET to indeicate media reset/engine reset have happended in the driver, user can use vaQuerySurfaceError() to get the detail info to do some customized work. Signed-off-by: Pengxin, Yuan <[email protected]>
1 parent 4bb5f16 commit 347520e

File tree

3 files changed

+24
-7
lines changed

3 files changed

+24
-7
lines changed

va/va.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -684,6 +684,8 @@ const char *vaErrorStr(VAStatus error_status)
684684
return "an unsupported memory type was supplied";
685685
case VA_STATUS_ERROR_NOT_ENOUGH_BUFFER:
686686
return "allocated memory size is not enough for input or output";
687+
case VA_STATUS_ERROR_RESET:
688+
return "HW reset happended";
687689
case VA_STATUS_ERROR_UNKNOWN:
688690
return "unknown libva error";
689691
}

va/va.h

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,9 @@ typedef int VAStatus; /** Return status type from functions */
305305
#define VA_STATUS_ERROR_NOT_ENOUGH_BUFFER 0x00000025
306306
/** \brief Indicate an operation isn't completed because time-out interval elapsed. */
307307
#define VA_STATUS_ERROR_TIMEDOUT 0x00000026
308-
#define VA_STATUS_ERROR_UNKNOWN 0xFFFFFFFF
308+
/** \brief Indicate HW reset has happended. */
309+
#define VA_STATUS_ERROR_RESET 0x00000027
310+
#define VA_STATUS_ERROR_UNKNOWN 0xFFFFFFFF
309311

310312
/**
311313
* 1. De-interlacing flags for vaPutSurface()
@@ -662,8 +664,8 @@ typedef enum {
662664
* at vaBeginPicture() time refers to the decode output surface. The
663665
* target surface for the output of processing needs to be a different
664666
* surface since the decode process requires the original reconstructed buffer.
665-
* The surface member of VAProcPipelineParameterBuffer should be set to the
666-
* same as render_target set in vaBeginPicture(), but the driver may choose
667+
* The "surface" member of VAProcPipelineParameterBuffer should be set to the
668+
* same as "render_target" set in vaBeginPicture(), but the driver may choose
667669
* to ignore this parameter.
668670
*/
669671
VAConfigAttribDecProcessing = 8,
@@ -4201,11 +4203,17 @@ typedef enum {
42014203
} VADecodeErrorType;
42024204

42034205
/**
4204-
* Client calls vaQuerySurfaceError with VA_STATUS_ERROR_DECODING_ERROR, server side returns
4206+
* Client calls vaQuerySurfaceError() with the VAStatus obtained from vaSyncSurface(), server side returns
42054207
* an array of structure VASurfaceDecodeMBErrors, and the array is terminated by setting status=-1
42064208
*/
42074209
typedef struct _VASurfaceDecodeMBErrors {
4208-
int32_t status; /* 1 if hardware has returned detailed info below, -1 means this record is invalid */
4210+
/**
4211+
* Status reported by server side:
4212+
* 1 if hardware has returned detailed info below;
4213+
* -1 means this record is invalid;
4214+
* VA_STATUS_ERROR_RESET means reset happened in the server side.
4215+
*/
4216+
int32_t status;
42094217
uint32_t start_mb; /* start mb address with errors */
42104218
uint32_t end_mb; /* end mb address with errors */
42114219
VADecodeErrorType decode_error_type;
@@ -4217,8 +4225,14 @@ typedef struct _VASurfaceDecodeMBErrors {
42174225
/**
42184226
* After the application gets VA_STATUS_ERROR_DECODING_ERROR after calling vaSyncSurface(),
42194227
* it can call vaQuerySurfaceError to find out further details on the particular error.
4220-
* VA_STATUS_ERROR_DECODING_ERROR should be passed in as "error_status",
4221-
* upon the return, error_info will point to an array of _VASurfaceDecodeMBErrors structure,
4228+
* VA_STATUS_ERROR_DECODING_ERROR should be passed in as "error_status".
4229+
*
4230+
* After the applications get VA_STATUS_HW_BUSY or VA_STATUS_SUCCESSFULL from vaSyncSurface(),
4231+
* it still can call vaQuerySurfaceError to find out further details to know if has real hw reset
4232+
* happened on this surface since umd and kmd could recover the context from reset with success in sometimes.
4233+
* VA_STATUS_ERROR_RESET should be passed in as "error_status".
4234+
*
4235+
* Upon the return, error_info will point to an array of _VASurfaceDecodeMBErrors structure,
42224236
* which is allocated and filled by libVA with detailed information on the missing or error macroblocks.
42234237
* The array is terminated if "status==-1" is detected.
42244238
*/

va/va_str.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ const char *vaStatusStr(VAStatus status)
243243
TOSTR(VA_STATUS_ERROR_HW_BUSY);
244244
TOSTR(VA_STATUS_ERROR_UNSUPPORTED_MEMORY_TYPE);
245245
TOSTR(VA_STATUS_ERROR_NOT_ENOUGH_BUFFER);
246+
TOSTR(VA_STATUS_ERROR_RESET);
246247
TOSTR(VA_STATUS_ERROR_UNKNOWN);
247248
default:
248249
break;

0 commit comments

Comments
 (0)