[Media Interface] utilities refator
Utilities update & refactor
diff --git a/media_driver/agnostic/common/os/mos_util_debug.h b/media_driver/agnostic/common/os/mos_util_debug.h
index 5971146..f0bd32c 100644
--- a/media_driver/agnostic/common/os/mos_util_debug.h
+++ b/media_driver/agnostic/common/os/mos_util_debug.h
@@ -498,6 +498,20 @@
}
//!
+//! \def MOS_CHK_STATUS_NO_STATUS_RETURN(_compID, _subCompID, _stmt)
+//! Check MOS_STATUS \a _stmt, return void
+//!
+#define MOS_CHK_STATUS_NO_STATUS_RETURN(_compID, _subCompID, _stmt) \
+{ \
+ eStatus = (MOS_STATUS)(_stmt); \
+ if (eStatus != MOS_STATUS_SUCCESS) \
+ { \
+ MOS_ASSERTMESSAGE(_compID, _subCompID, "MOS returned error, eStatus = 0x%x", eStatus);\
+ return; \
+ } \
+}
+
+//!
//! \def MOS_CHK_STATUS_SAFE(_stmt)
//! Check MOS_STATUS \a _stmt, return for failure
//!
@@ -516,9 +530,9 @@
//!
#define MOS_CHK_NULL(_compID, _subCompID, _ptr) \
{ \
- if ((_ptr) == nullptr) \
+ if ((_ptr) == nullptr) \
{ \
- MOS_ASSERTMESSAGE(_compID, _subCompID, "Invalid (nullptr) Pointer."); \
+ MOS_ASSERTMESSAGE(_compID, _subCompID, "Invalid (nullptr) Pointer."); \
eStatus = MOS_STATUS_NULL_POINTER; \
goto finish; \
} \
@@ -530,9 +544,9 @@
//!
#define MOS_CHK_NULL_NO_STATUS(_compID, _subCompID, _ptr) \
{ \
- if ((_ptr) == nullptr) \
+ if ((_ptr) == nullptr) \
{ \
- MOS_ASSERTMESSAGE(_compID, _subCompID, "Invalid (nullptr) Pointer."); \
+ MOS_ASSERTMESSAGE(_compID, _subCompID, "Invalid (nullptr) Pointer."); \
goto finish; \
} \
}
@@ -543,9 +557,9 @@
//!
#define MOS_CHK_NULL_NO_STATUS_RETURN(_compID, _subCompID, _ptr) \
{ \
- if ((_ptr) == nullptr) \
+ if ((_ptr) == nullptr) \
{ \
- MOS_ASSERTMESSAGE(_compID, _subCompID, "Invalid (nullptr) Pointer."); \
+ MOS_ASSERTMESSAGE(_compID, _subCompID, "Invalid (nullptr) Pointer."); \
return; \
} \
}
@@ -602,7 +616,7 @@
#define MOS_CHK_HR(_compID, _subCompID, _stmt) \
{ \
hr = (_stmt); \
- if (hr != MOS_STATUS_SUCCESS) \
+ if (hr != MOS_STATUS_SUCCESS) \
{ \
MOS_ASSERTMESSAGE(_compID, _subCompID, "hr check failed."); \
goto finish; \
@@ -610,13 +624,27 @@
}
//!
+//! \def MOS_CHK_HR_RETURN(_compID, _subCompID, _stmt)
+//! Check _stmt, assert and return an error for failure
+//!
+#define MOS_CHK_HR_RETURN(_compID, _subCompID, _stmt) \
+{ \
+ hr = (_stmt); \
+ if (hr != MOS_STATUS_SUCCESS) \
+ { \
+ MOS_ASSERTMESSAGE(_compID, _subCompID, "MOS returned error, hr = 0x%x", hr); \
+ return hr; \
+ } \
+}
+
+//!
//! \def MOS_CHK_STATUS_MESSAGE(_compID, _subCompID, _stmt, _message, ...)
//! Check MOS_STATUS \a _stmt, assert and return an error for failure, and print message
//!
#define MOS_CHK_HR_MESSAGE(_compID, _subCompID, _stmt, _message, ...) \
{ \
hr = (_stmt); \
- if (hr != MOS_STATUS_SUCCESS) \
+ if (hr != MOS_STATUS_SUCCESS) \
{ \
MOS_ASSERTMESSAGE(_compID, _subCompID, _message, ##__VA_ARGS__); \
goto finish; \