[CP] Enable protected content driver implementation
Enable protected content driver implementation with latest libva 2.11.0.pre1
diff --git a/media_driver/linux/common/codec/ddi/media_libva_decoder.cpp b/media_driver/linux/common/codec/ddi/media_libva_decoder.cpp
index 2b299e1..45f5178 100644
--- a/media_driver/linux/common/codec/ddi/media_libva_decoder.cpp
+++ b/media_driver/linux/common/codec/ddi/media_libva_decoder.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2009-2020, Intel Corporation
+* Copyright (c) 2009-2021, Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -159,6 +159,13 @@
if (decCtx->pCpDdiInterface)
{
DDI_CHK_RET(decCtx->pCpDdiInterface->IsAttachedSessionAlive(), "Session not alive!");
+
+ if (decCtx->pCpDdiInterface->IsCencProcessing())
+ {
+ VAStatus va = decCtx->pCpDdiInterface->EndPicture(ctx, context);
+ DDI_FUNCTION_EXIT(va);
+ return va;
+ }
}
if (decCtx->m_ddiDecode)
diff --git a/media_driver/linux/common/ddi/media_libva.cpp b/media_driver/linux/common/ddi/media_libva.cpp
index 54d1eb5..59d2776 100755
--- a/media_driver/linux/common/ddi/media_libva.cpp
+++ b/media_driver/linux/common/ddi/media_libva.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2009-2020, Intel Corporation
+* Copyright (c) 2009-2021, Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -3060,6 +3060,9 @@
case DDI_MEDIA_CONTEXT_TYPE_VP:
va = DdiVp_CreateBuffer(ctx, ctxPtr, type, size, num_elements, data, bufId);
break;
+ case DDI_MEDIA_CONTEXT_TYPE_PROTECTED:
+ va = DdiMediaProtected::DdiMedia_ProtectedSessionCreateBuffer(ctx, context, type, size, num_elements, data, bufId);
+ break;
default:
va = VA_STATUS_ERROR_INVALID_CONTEXT;
}
@@ -3164,6 +3167,7 @@
switch (ctxType)
{
case DDI_MEDIA_CONTEXT_TYPE_VP:
+ case DDI_MEDIA_CONTEXT_TYPE_PROTECTED:
break;
case DDI_MEDIA_CONTEXT_TYPE_DECODER:
ctxPtr = DdiMedia_GetCtxFromVABufferID(mediaCtx, buf_id);
@@ -3452,6 +3456,7 @@
switch (ctxType)
{
case DDI_MEDIA_CONTEXT_TYPE_VP:
+ case DDI_MEDIA_CONTEXT_TYPE_PROTECTED:
break;
case DDI_MEDIA_CONTEXT_TYPE_DECODER:
ctxPtr = DdiMedia_GetCtxFromVABufferID(mediaCtx, buf_id);
@@ -3565,6 +3570,8 @@
break;
case DDI_MEDIA_CONTEXT_TYPE_MEDIA:
break;
+ case DDI_MEDIA_CONTEXT_TYPE_PROTECTED:
+ break;
default:
return VA_STATUS_ERROR_INVALID_BUFFER;
}
@@ -7281,6 +7288,11 @@
struct VADriverVTableVPP *pVTableVpp = DDI_CODEC_GET_VTABLE_VPP(ctx);
DDI_CHK_NULL(pVTableVpp, "nullptr pVTableVpp", VA_STATUS_ERROR_INVALID_CONTEXT);
+#if VA_CHECK_VERSION(1,11,0)
+ struct VADriverVTableProt *pVTableProt = DDI_CODEC_GET_VTABLE_PROT(ctx);
+ DDI_CHK_NULL(pVTableProt, "nullptr pVTableProt", VA_STATUS_ERROR_INVALID_CONTEXT);
+#endif
+
ctx->pDriverData = nullptr;
ctx->version_major = VA_MAJOR_VERSION;
ctx->version_minor = VA_MINOR_VERSION;
@@ -7356,6 +7368,14 @@
pVTableVpp->vaQueryVideoProcFilterCaps = DdiMedia_QueryVideoProcFilterCaps;
pVTableVpp->vaQueryVideoProcPipelineCaps = DdiMedia_QueryVideoProcPipelineCaps;
+#if VA_CHECK_VERSION(1,11,0)
+ pVTableProt->vaCreateProtectedSession = DdiMediaProtected::DdiMedia_CreateProtectedSession;
+ pVTableProt->vaDestroyProtectedSession = DdiMediaProtected::DdiMedia_DestroyProtectedSession;
+ pVTableProt->vaAttachProtectedSession = DdiMediaProtected::DdiMedia_AttachProtectedSession;
+ pVTableProt->vaDetachProtectedSession = DdiMediaProtected::DdiMedia_DetachProtectedSession;
+ pVTableProt->vaProtectedSessionExecute = DdiMediaProtected::DdiMedia_ProtectedSessionExecute;
+#endif
+
//pVTable->vaSetSurfaceAttributes = DdiMedia_SetSurfaceAttributes;
pVTable->vaGetSurfaceAttributes = DdiMedia_GetSurfaceAttributes;
//Export PRIMEFD/FLINK to application for buffer sharing with OpenCL/GL
diff --git a/media_driver/linux/common/ddi/media_libva.h b/media_driver/linux/common/ddi/media_libva.h
index 7ae5c08..42cf322 100755
--- a/media_driver/linux/common/ddi/media_libva.h
+++ b/media_driver/linux/common/ddi/media_libva.h
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2009-2020, Intel Corporation
+* Copyright (c) 2009-2021, Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -39,6 +39,9 @@
#include <va/va_enc_hevc.h>
#include <va/va_vpp.h>
#include <va/va_backend_vpp.h>
+#if VA_CHECK_VERSION(1,11,0)
+#include <va/va_backend_prot.h>
+#endif
#ifdef ANDROID
#if VA_MAJOR_VERSION < 1
#include "va_internal_android.h"
@@ -67,6 +70,9 @@
#define DDI_CODEC_GET_VTABLE(ctx) (ctx->vtable)
#define DDI_CODEC_GET_VTABLE_VPP(ctx) (ctx->vtable_vpp)
+#if VA_CHECK_VERSION(1,11,0)
+#define DDI_CODEC_GET_VTABLE_PROT(ctx) (ctx->vtable_prot)
+#endif
#define DDI_CODEC_GET_VTABLE_TPI(ctx) (ctx->vtable_tpi)
#define DDI_CODEC_BATCH_BUFFER_SIZE 0x80000
diff --git a/media_driver/linux/common/ddi/media_libva_caps.cpp b/media_driver/linux/common/ddi/media_libva_caps.cpp
index 166c1a6..b0cfa0c 100755
--- a/media_driver/linux/common/ddi/media_libva_caps.cpp
+++ b/media_driver/linux/common/ddi/media_libva_caps.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2017-2020, Intel Corporation
+* Copyright (c) 2017-2021, Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -33,6 +33,7 @@
#include "media_libva_caps_cp_interface.h"
#include "media_ddi_decode_const.h"
#include "media_ddi_encode_const.h"
+#include "media_ddi_prot.h"
#include "media_libva_caps_factory.h"
typedef MediaLibvaCapsFactory<MediaLibvaCaps, DDI_MEDIA_CONTEXT> CapsFactory;
@@ -155,6 +156,16 @@
return false;
}
break;
+ case videoProtect:
+ {
+ DdiMediaProtected *prot = DdiMediaProtected::GetInstance(DDI_PROTECTED_CONTENT);
+ if (prot && prot->CheckEntrypointSupported(entrypoint))
+ {
+ return true;
+ }
+ return false;
+ }
+ break;
default:
DDI_ASSERTMESSAGE("DDI: Unsupported codecType");
return false;
@@ -206,6 +217,11 @@
configOffset = configId - DDI_VP_GEN_CONFIG_ATTRIBUTES_BASE;
codecType = videoProcess;
}
+ else if( m_CapsCp->IsCpConfigId(configId) )
+ {
+ configOffset = configId - DDI_CP_GEN_CONFIG_ATTRIBUTES_BASE;
+ codecType = videoProtect;
+ }
else
{
return VA_STATUS_ERROR_INVALID_CONFIG;
@@ -435,6 +451,15 @@
{
return VA_STATUS_ERROR_INVALID_VALUE;
}
+
+ DdiMediaProtected *prot = DdiMediaProtected::GetInstance(DDI_PROTECTED_CONTENT);
+ if (prot &&
+ prot->CheckEntrypointSupported(entrypoint) &&
+ prot->CheckAttribList(profile, entrypoint, attrib, numAttribs))
+ {
+ return VA_STATUS_SUCCESS;
+ }
+
for(int32_t j = 0; j < numAttribs; j ++)
{
bool isValidAttrib = false;
@@ -2275,6 +2300,10 @@
{
return CreateEncConfig(i,entrypoint,attribList, numAttribs, configId);
}
+ else if(CheckEntrypointCodecType(entrypoint, videoProtect))
+ {
+ return m_CapsCp->CreateCpConfig(i, entrypoint, attribList, numAttribs, configId);
+ }
else
{
DDI_ASSERTMESSAGE("DDI: Unsupported EntryPoint");
@@ -3355,7 +3384,8 @@
VAStatus MediaLibvaCaps::DestroyConfig(VAConfigID configId)
{
- if( IsDecConfigId(configId) || IsEncConfigId(configId) || IsVpConfigId(configId))
+ if ( IsDecConfigId(configId) || IsEncConfigId(configId) || IsVpConfigId(configId) ||
+ (m_CapsCp && m_CapsCp->IsCpConfigId(configId)) )
{
return VA_STATUS_SUCCESS;
}
diff --git a/media_driver/linux/common/ddi/media_libva_caps.h b/media_driver/linux/common/ddi/media_libva_caps.h
index 5ad4bad..0d63f3b 100755
--- a/media_driver/linux/common/ddi/media_libva_caps.h
+++ b/media_driver/linux/common/ddi/media_libva_caps.h
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2017-2020, Intel Corporation
+* Copyright (c) 2017-2021, Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -746,7 +746,8 @@
{
videoEncode, //!< Video encode
videoDecode, //!< Video decode
- videoProcess //!< Video processing
+ videoProcess,//!< Video processing
+ videoProtect //!< Video protection
};
enum EncodeFormat
diff --git a/media_driver/linux/common/ddi/media_libva_common.cpp b/media_driver/linux/common/ddi/media_libva_common.cpp
index 9405445..4757601 100644
--- a/media_driver/linux/common/ddi/media_libva_common.cpp
+++ b/media_driver/linux/common/ddi/media_libva_common.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2015-2020, Intel Corporation
+* Copyright (c) 2015-2021, Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -25,6 +25,7 @@
#include "media_libva.h"
#include "media_libva_util.h"
+#include "media_ddi_prot.h"
#include "mos_solo_generic.h"
#include "mos_interface.h"
#include "media_libva_caps.h"
@@ -87,7 +88,14 @@
if (index >= DDI_MEDIA_MAX_INSTANCE_NUMBER)
return nullptr;
- if ((vaCtxID&DDI_MEDIA_MASK_VACONTEXT_TYPE) == DDI_MEDIA_VACONTEXTID_OFFSET_DECODER)
+ if ((vaCtxID&DDI_MEDIA_MASK_VACONTEXT_TYPE) == DDI_MEDIA_VACONTEXTID_OFFSET_PROT)
+ {
+ DDI_VERBOSEMESSAGE("Protected session detected: 0x%x", vaCtxID);
+ *ctxType = DDI_MEDIA_CONTEXT_TYPE_PROTECTED;
+ index = index & DDI_MEDIA_MASK_VAPROTECTEDSESSION_ID;
+ return DdiMedia_GetVaContextFromHeap(mediaCtx->pProtCtxHeap, index, &mediaCtx->ProtMutex);
+ }
+ else if ((vaCtxID&DDI_MEDIA_MASK_VACONTEXT_TYPE) == DDI_MEDIA_VACONTEXTID_OFFSET_DECODER)
{
DDI_VERBOSEMESSAGE("Decode context detected: 0x%x", vaCtxID);
*ctxType = DDI_MEDIA_CONTEXT_TYPE_DECODER;
diff --git a/media_driver/linux/gen10/ddi/media_libva_caps_g10.cpp b/media_driver/linux/gen10/ddi/media_libva_caps_g10.cpp
index ecf80ab..eb31545 100755
--- a/media_driver/linux/gen10/ddi/media_libva_caps_g10.cpp
+++ b/media_driver/linux/gen10/ddi/media_libva_caps_g10.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2017-2020, Intel Corporation
+* Copyright (c) 2017-2021, Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -27,6 +27,7 @@
#include "codec_def_encode_hevc_g10.h"
#include "media_libva_util.h"
#include "media_libva.h"
+#include "media_libva_caps_cp_interface.h"
#include "media_libva_caps_g10.h"
#include "media_libva_caps_factory.h"
@@ -360,6 +361,8 @@
status = LoadNoneProfileEntrypoints();
DDI_CHK_RET(status, "Failed to initialize Caps!");
#endif
+ status = m_CapsCp->LoadCpProfileEntrypoints();
+ DDI_CHK_RET(status, "Failed to initialize CP Caps!");
return status;
}
VAStatus MediaLibvaCapsG10::CheckEncodeResolution(
diff --git a/media_driver/linux/gen11/ddi/media_libva_caps_g11.cpp b/media_driver/linux/gen11/ddi/media_libva_caps_g11.cpp
index da6c047..9da733e 100755
--- a/media_driver/linux/gen11/ddi/media_libva_caps_g11.cpp
+++ b/media_driver/linux/gen11/ddi/media_libva_caps_g11.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2017-2020, Intel Corporation
+* Copyright (c) 2017-2021, Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -27,6 +27,7 @@
#include "codec_def_encode_hevc_g11.h"
#include "media_libva_util.h"
#include "media_libva.h"
+#include "media_libva_caps_cp_interface.h"
#include "media_libva_caps_g11.h"
#include "media_libva_caps_factory.h"
#include "media_ddi_decode_const.h"
@@ -643,6 +644,8 @@
status = LoadNoneProfileEntrypoints();
DDI_CHK_RET(status, "Failed to initialize Caps!");
#endif
+ status = m_CapsCp->LoadCpProfileEntrypoints();
+ DDI_CHK_RET(status, "Failed to initialize CP Caps!");
return status;
}
diff --git a/media_driver/linux/gen12/ddi/media_libva_caps_g12.cpp b/media_driver/linux/gen12/ddi/media_libva_caps_g12.cpp
index 0f83634..dce3e94 100644
--- a/media_driver/linux/gen12/ddi/media_libva_caps_g12.cpp
+++ b/media_driver/linux/gen12/ddi/media_libva_caps_g12.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2018-2020, Intel Corporation
+* Copyright (c) 2018-2021, Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -807,6 +807,8 @@
DDI_CHK_RET(status, "Failed to initialize Caps!");
status = LoadNoneProfileEntrypoints();
DDI_CHK_RET(status, "Failed to initialize Caps!");
+ status = m_CapsCp->LoadCpProfileEntrypoints();
+ DDI_CHK_RET(status, "Failed to initialize CP Caps!");
return status;
}
diff --git a/media_driver/linux/gen9/ddi/media_libva_caps_g9.cpp b/media_driver/linux/gen9/ddi/media_libva_caps_g9.cpp
index f66a380..dd8449d 100755
--- a/media_driver/linux/gen9/ddi/media_libva_caps_g9.cpp
+++ b/media_driver/linux/gen9/ddi/media_libva_caps_g9.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2017, Intel Corporation
+* Copyright (c) 2017-2021, Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -27,6 +27,7 @@
#include "codec_def_encode_hevc.h"
#include "media_libva_util.h"
#include "media_libva.h"
+#include "media_libva_caps_cp_interface.h"
#include "media_libva_caps_g9.h"
#include "media_libva_caps_factory.h"
@@ -303,6 +304,8 @@
status = LoadNoneProfileEntrypoints();
DDI_CHK_RET(status, "Failed to initialize Caps!");
#endif
+ status = m_CapsCp->LoadCpProfileEntrypoints();
+ DDI_CHK_RET(status, "Failed to initialize CP Caps!");
return status;
}
diff --git a/media_driver/linux/ult/ult_app/RefCapsTable_BXT.h b/media_driver/linux/ult/ult_app/RefCapsTable_BXT.h
index 26c4c98..f5c33ab 100644
--- a/media_driver/linux/ult/ult_app/RefCapsTable_BXT.h
+++ b/media_driver/linux/ult/ult_app/RefCapsTable_BXT.h
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2018, Intel Corporation
+* Copyright (c) 2018-2021, Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -52,6 +52,10 @@
{ VAProfileVP9Profile0 , VAEntrypointVLD },
{ VAProfileNone , VAEntrypointVideoProc },
{ VAProfileNone , VAEntrypointStats },
+#if defined(_CP_INCLUDED) && VA_CHECK_VERSION(1,11,0)
+ { VAProfileProtected , VAEntrypointProtectedTEEComm },
+ { VAProfileProtected , VAEntrypointProtectedContent },
+#endif
};
#endif // __REF_CAPS_TABLE_BXT_H__
diff --git a/media_driver/linux/ult/ult_app/RefCapsTable_SKL.h b/media_driver/linux/ult/ult_app/RefCapsTable_SKL.h
index 72c1382..d763edc 100644
--- a/media_driver/linux/ult/ult_app/RefCapsTable_SKL.h
+++ b/media_driver/linux/ult/ult_app/RefCapsTable_SKL.h
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2018, Intel Corporation
+* Copyright (c) 2018-2021, Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -52,6 +52,10 @@
{ VAProfileHEVCMain , VAEntrypointFEI },
{ VAProfileNone , VAEntrypointVideoProc },
{ VAProfileNone , VAEntrypointStats },
+#if defined(_CP_INCLUDED) && VA_CHECK_VERSION(1,11,0)
+ { VAProfileProtected , VAEntrypointProtectedTEEComm },
+ { VAProfileProtected , VAEntrypointProtectedContent },
+#endif
};
#endif // __REF_CAPS_TABLE_SKL_H__
diff --git a/media_driver/linux/ult/ult_app/driver_loader.cpp b/media_driver/linux/ult/ult_app/driver_loader.cpp
index 00b153f..0c779da 100644
--- a/media_driver/linux/ult/ult_app/driver_loader.cpp
+++ b/media_driver/linux/ult/ult_app/driver_loader.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2018, Intel Corporation
+* Copyright (c) 2018-2021, Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -119,6 +119,9 @@
m_drmstate.auth_type = 3;
m_ctx.vtable = &m_vtable;
m_ctx.vtable_vpp = &m_vtable_vpp;
+#if VA_CHECK_VERSION(1,11,0)
+ m_ctx.vtable_prot = &m_vtable_prot;
+#endif
m_ctx.drm_state = &m_drmstate;
m_currentPlatform = platform_id;
m_ctx.vtable_tpi = nullptr;
diff --git a/media_driver/linux/ult/ult_app/driver_loader.h b/media_driver/linux/ult/ult_app/driver_loader.h
index 205c8f9..179ed80 100644
--- a/media_driver/linux/ult/ult_app/driver_loader.h
+++ b/media_driver/linux/ult/ult_app/driver_loader.h
@@ -29,6 +29,9 @@
#include "va/va_drmcommon.h"
#include "va/va_backend.h"
#include "va/va_backend_vpp.h"
+#if VA_CHECK_VERSION(1,11,0)
+#include <va/va_backend_prot.h>
+#endif
struct FeatureID
{
@@ -127,6 +130,9 @@
VADriverContext m_ctx = {};
VADriverVTable m_vtable = {};
VADriverVTableVPP m_vtable_vpp = {};
+#if VA_CHECK_VERSION(1,11,0)
+ VADriverVTableProt m_vtable_prot = {};
+#endif
private: