Skip to content

Commit 084e0d6

Browse files
committed
Added profile & entrypoint checks before QuerySupportedAttrib
Add a check for any invalid parameters or entrypoints. Allows graceful return for vp9 & mepg2 invalid entrypoints error. Ticket: IGMDPT-836 Signed-off-by: Hazim Razak <[email protected]>
1 parent b6e613f commit 084e0d6

File tree

3 files changed

+50
-0
lines changed

3 files changed

+50
-0
lines changed

media_softlet/linux/common/ddi/media_capstable_specific.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,19 @@ VAStatus MediaCapsTableSpecific::CreateConfig(
246246
return ret;
247247
}
248248

249+
bool MediaCapsTableSpecific::IsProfileSupported(
250+
VAProfile profile)
251+
{
252+
return !(m_profileMap->find(profile) == m_profileMap->end());
253+
}
254+
255+
bool MediaCapsTableSpecific::IsEntrypointSupported(
256+
VAProfile profile,
257+
VAEntrypoint entrypoint)
258+
{
259+
return !(m_profileMap->at(profile)->find(entrypoint) == m_profileMap->at(profile)->end());
260+
}
261+
249262
bool MediaCapsTableSpecific::IsDecConfigId(VAConfigID configId)
250263
{
251264
VAConfigID curConfigId = REMOVE_CONFIG_ID_OFFSET(configId);

media_softlet/linux/common/ddi/media_capstable_specific.h

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,34 @@ class MediaCapsTableSpecific : public MediaCapsTable<CapsData>
205205
//!
206206
//! \return True if the configID is a valid decode config, otherwise false
207207
//!
208+
bool IsProfileSupported(
209+
VAProfile profile);
210+
211+
//!
212+
//! \brief Check if profile is supported
213+
//!
214+
//! \param [in] profile
215+
//! VA profile
216+
//!
217+
//! \return bool
218+
//! true if supported
219+
//!
220+
bool IsEntrypointSupported(
221+
VAProfile profile,
222+
VAEntrypoint entrypoint);
223+
224+
//!
225+
//! \brief Check if entrypoint is supported
226+
//!
227+
//! \param [in] profile
228+
//! VA profile
229+
//!
230+
//! \param [in] entrypoint
231+
//! VA entrypoint
232+
//!
233+
//! \return bool
234+
//! true if supported
235+
//!
208236
bool IsDecConfigId(VAConfigID configId);
209237

210238
//!

media_softlet/linux/common/ddi/media_libva_caps_next.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,15 @@ VAStatus MediaLibvaCapsNext::GetConfigAttributes(
355355
DDI_CHK_NULL(m_capsTable, "Caps table is null", VA_STATUS_ERROR_INVALID_PARAMETER);
356356
DDI_CHK_NULL(attribList, "Null pointer", VA_STATUS_ERROR_INVALID_PARAMETER);
357357

358+
if (!(m_capsTable->IsProfileSupported(profile)))
359+
{
360+
return VA_STATUS_ERROR_UNSUPPORTED_PROFILE;
361+
}
362+
else if (!(m_capsTable->IsEntrypointSupported(profile, entrypoint)))
363+
{
364+
return VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
365+
}
366+
358367
AttribList *supportedAttribList = nullptr;
359368
supportedAttribList = m_capsTable->QuerySupportedAttrib(profile, entrypoint);
360369
DDI_CHK_NULL(supportedAttribList, "AttribList in null, not supported attribute", VA_STATUS_ERROR_INVALID_PARAMETER);

0 commit comments

Comments
 (0)