Skip to content

Commit

Permalink
Add new error code to indicate the reset happended in the driver.
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
pengxin99 committed Jun 5, 2023
1 parent 4bb5f16 commit 347520e
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 7 deletions.
2 changes: 2 additions & 0 deletions va/va.c
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,8 @@ const char *vaErrorStr(VAStatus error_status)
return "an unsupported memory type was supplied";
case VA_STATUS_ERROR_NOT_ENOUGH_BUFFER:
return "allocated memory size is not enough for input or output";
case VA_STATUS_ERROR_RESET:
return "HW reset happended";
case VA_STATUS_ERROR_UNKNOWN:
return "unknown libva error";
}
Expand Down
28 changes: 21 additions & 7 deletions va/va.h
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,9 @@ typedef int VAStatus; /** Return status type from functions */
#define VA_STATUS_ERROR_NOT_ENOUGH_BUFFER 0x00000025
/** \brief Indicate an operation isn't completed because time-out interval elapsed. */
#define VA_STATUS_ERROR_TIMEDOUT 0x00000026
#define VA_STATUS_ERROR_UNKNOWN 0xFFFFFFFF
/** \brief Indicate HW reset has happended. */
#define VA_STATUS_ERROR_RESET 0x00000027
#define VA_STATUS_ERROR_UNKNOWN 0xFFFFFFFF

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

/**
* Client calls vaQuerySurfaceError with VA_STATUS_ERROR_DECODING_ERROR, server side returns
* Client calls vaQuerySurfaceError() with the VAStatus obtained from vaSyncSurface(), server side returns
* an array of structure VASurfaceDecodeMBErrors, and the array is terminated by setting status=-1
*/
typedef struct _VASurfaceDecodeMBErrors {
int32_t status; /* 1 if hardware has returned detailed info below, -1 means this record is invalid */
/**
* Status reported by server side:
* 1 if hardware has returned detailed info below;
* -1 means this record is invalid;
* VA_STATUS_ERROR_RESET means reset happened in the server side.
*/
int32_t status;
uint32_t start_mb; /* start mb address with errors */
uint32_t end_mb; /* end mb address with errors */
VADecodeErrorType decode_error_type;
Expand All @@ -4217,8 +4225,14 @@ typedef struct _VASurfaceDecodeMBErrors {
/**
* After the application gets VA_STATUS_ERROR_DECODING_ERROR after calling vaSyncSurface(),
* it can call vaQuerySurfaceError to find out further details on the particular error.
* VA_STATUS_ERROR_DECODING_ERROR should be passed in as "error_status",
* upon the return, error_info will point to an array of _VASurfaceDecodeMBErrors structure,
* VA_STATUS_ERROR_DECODING_ERROR should be passed in as "error_status".
*
* After the applications get VA_STATUS_HW_BUSY or VA_STATUS_SUCCESSFULL from vaSyncSurface(),
* it still can call vaQuerySurfaceError to find out further details to know if has real hw reset
* happened on this surface since umd and kmd could recover the context from reset with success in sometimes.
* VA_STATUS_ERROR_RESET should be passed in as "error_status".
*
* Upon the return, error_info will point to an array of _VASurfaceDecodeMBErrors structure,
* which is allocated and filled by libVA with detailed information on the missing or error macroblocks.
* The array is terminated if "status==-1" is detected.
*/
Expand Down
1 change: 1 addition & 0 deletions va/va_str.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ const char *vaStatusStr(VAStatus status)
TOSTR(VA_STATUS_ERROR_HW_BUSY);
TOSTR(VA_STATUS_ERROR_UNSUPPORTED_MEMORY_TYPE);
TOSTR(VA_STATUS_ERROR_NOT_ENOUGH_BUFFER);
TOSTR(VA_STATUS_ERROR_RESET);
TOSTR(VA_STATUS_ERROR_UNKNOWN);
default:
break;
Expand Down

0 comments on commit 347520e

Please sign in to comment.