@@ -4612,6 +4612,85 @@ static void va_TraceVAEncPackedHeaderParameterBufferType(
46124612 return ;
46134613}
46144614
4615+ static void va_TraceVAEncryptionParameters (
4616+ VADisplay dpy ,
4617+ VAContextID context ,
4618+ VABufferID buffer ,
4619+ VABufferType type ,
4620+ unsigned int size ,
4621+ unsigned int num_elements ,
4622+ void * data
4623+ )
4624+ {
4625+ VAEncryptionParameters * p = (VAEncryptionParameters * )data ;
4626+ unsigned int i ;
4627+
4628+ DPY2TRACECTX (dpy , context , VA_INVALID_ID );
4629+
4630+ va_TraceMsg (trace_ctx , "--VAEncryptionParameters\n" );
4631+ va_TraceMsg (trace_ctx , "\tencryption_type = 0x%08x\n" , p -> encryption_type );
4632+
4633+ if (p -> encryption_type & VA_ENCRYPTION_TYPE_FULLSAMPLE_CTR )
4634+ va_TraceMsg (trace_ctx , "\t\tVA_ENCRYPTION_TYPE_FULLSAMPLE_CTR\n" );
4635+ if (p -> encryption_type & VA_ENCRYPTION_TYPE_FULLSAMPLE_CBC )
4636+ va_TraceMsg (trace_ctx , "\t\tVA_ENCRYPTION_TYPE_FULLSAMPLE_CBC\n" );
4637+ if (p -> encryption_type & VA_ENCRYPTION_TYPE_SUBSAMPLE_CTR )
4638+ va_TraceMsg (trace_ctx , "\t\tVA_ENCRYPTION_TYPE_SUBSAMPLE_CTR\n" );
4639+ if (p -> encryption_type & VA_ENCRYPTION_TYPE_SUBSAMPLE_CBC )
4640+ va_TraceMsg (trace_ctx , "\t\tVA_ENCRYPTION_TYPE_SUBSAMPLE_CBC\n" );
4641+
4642+ va_TraceMsg (trace_ctx , "\tnum_segments = %u\n" , p -> num_segments );
4643+ va_TraceMsg (trace_ctx , "\tsegment_info = %p\n" , p -> segment_info );
4644+
4645+ if (p -> segment_info && p -> num_segments > 0 ) {
4646+ for (i = 0 ; i < p -> num_segments && i < 16 ; i ++ ) {
4647+ va_TraceMsg (trace_ctx , "\t\tsegment[%u]:\n" , i );
4648+ va_TraceMsg (trace_ctx , "\t\t\tsegment_start_offset = %u\n" ,
4649+ p -> segment_info [i ].segment_start_offset );
4650+ va_TraceMsg (trace_ctx , "\t\t\tsegment_length = %u\n" ,
4651+ p -> segment_info [i ].segment_length );
4652+ va_TraceMsg (trace_ctx , "\t\t\tpartial_aes_block_size = %u\n" ,
4653+ p -> segment_info [i ].partial_aes_block_size );
4654+ va_TraceMsg (trace_ctx , "\t\t\tinit_byte_length = %u\n" ,
4655+ p -> segment_info [i ].init_byte_length );
4656+
4657+ /* Print first 16 bytes of IV/CTR */
4658+ va_TraceMsg (trace_ctx , "\t\t\taes_cbc_iv_or_ctr = " );
4659+ for (unsigned int j = 0 ; j < 16 && j < 64 ; j ++ ) {
4660+ va_TracePrint (trace_ctx , "%02x " , p -> segment_info [i ].aes_cbc_iv_or_ctr [j ]);
4661+ }
4662+ va_TracePrint (trace_ctx , "\n" );
4663+ }
4664+ if (p -> num_segments > 16 ) {
4665+ va_TraceMsg (trace_ctx , "\t\t... (%u more segments not shown)\n" ,
4666+ p -> num_segments - 16 );
4667+ }
4668+ }
4669+
4670+ va_TraceMsg (trace_ctx , "\tstatus_report_index = %u\n" , p -> status_report_index );
4671+ va_TraceMsg (trace_ctx , "\tsize_of_length = %u\n" , p -> size_of_length );
4672+ va_TraceMsg (trace_ctx , "\tkey_blob_size = %u\n" , p -> key_blob_size );
4673+ va_TraceMsg (trace_ctx , "\tblocks_stripe_encrypted = %u\n" , p -> blocks_stripe_encrypted );
4674+ va_TraceMsg (trace_ctx , "\tblocks_stripe_clear = %u\n" , p -> blocks_stripe_clear );
4675+
4676+ /* Print wrapped decrypt blob (first 16 bytes) */
4677+ va_TraceMsg (trace_ctx , "\twrapped_decrypt_blob = " );
4678+ for (i = 0 ; i < 16 && i < 64 ; i ++ ) {
4679+ va_TracePrint (trace_ctx , "%02x " , p -> wrapped_decrypt_blob [i ]);
4680+ }
4681+ va_TracePrint (trace_ctx , "...\n" );
4682+
4683+ /* Print wrapped encrypt blob (first 16 bytes) */
4684+ va_TraceMsg (trace_ctx , "\twrapped_encrypt_blob = " );
4685+ for (i = 0 ; i < 16 && i < 64 ; i ++ ) {
4686+ va_TracePrint (trace_ctx , "%02x " , p -> wrapped_encrypt_blob [i ]);
4687+ }
4688+ va_TracePrint (trace_ctx , "...\n" );
4689+
4690+ va_TraceMsg (trace_ctx , NULL );
4691+ }
4692+
4693+
46154694static void va_TraceVAEncMiscParameterBuffer (
46164695 VADisplay dpy ,
46174696 VAContextID context ,
@@ -6400,6 +6479,10 @@ static void va_TraceHEVCBuf(
64006479 case VAEncMiscParameterBufferType :
64016480 va_TraceVAEncMiscParameterBuffer (dpy , context , buffer , type , size , num_elements , pbuf );
64026481 break ;
6482+ case VAEncryptionParameterBufferType :
6483+ va_TraceVAEncryptionParameters (dpy , context , buffer , type , size , num_elements , pbuf );
6484+ break ;
6485+
64036486 default :
64046487 va_TraceVABuffers (dpy , context , buffer , type , size , num_elements , pbuf );
64056488 break ;
@@ -6468,10 +6551,14 @@ static void va_TraceH264Buf(
64686551 case VAEncPackedHeaderParameterBufferType :
64696552 va_TraceVAEncPackedHeaderParameterBufferType (dpy , context , buffer , type , size , num_elements , pbuf );
64706553 break ;
6471-
64726554 case VAEncMiscParameterBufferType :
64736555 va_TraceVAEncMiscParameterBuffer (dpy , context , buffer , type , size , num_elements , pbuf );
64746556 break ;
6557+ case VAEncryptionParameterBufferType :
6558+ va_TraceVAEncryptionParameters (dpy , context , buffer , type , size , num_elements , pbuf );
6559+ break ;
6560+
6561+
64756562 default :
64766563 va_TraceVABuffers (dpy , context , buffer , type , size , num_elements , pbuf );
64776564 break ;
@@ -6570,6 +6657,10 @@ static void va_TraceVP9Buf(
65706657 case VAEncMiscParameterBufferType :
65716658 va_TraceVAEncMiscParameterBuffer (dpy , context , buffer , type , size , num_elements , pbuf );
65726659 break ;
6660+ case VAEncryptionParameterBufferType :
6661+ va_TraceVAEncryptionParameters (dpy , context , buffer , type , size , num_elements , pbuf );
6662+ break ;
6663+
65736664 default :
65746665 va_TraceVABuffers (dpy , context , buffer , type , size , num_elements , pbuf );
65756666 break ;
@@ -6610,6 +6701,10 @@ static void va_TraceAV1Buf(
66106701 case VAEncPackedHeaderParameterBufferType :
66116702 va_TraceVAEncPackedHeaderParameterBufferType (dpy , context , buffer , type , size , num_elements , pbuf );
66126703 break ;
6704+ case VAEncryptionParameterBufferType :
6705+ va_TraceVAEncryptionParameters (dpy , context , buffer , type , size , num_elements , pbuf );
6706+ break ;
6707+
66136708 default :
66146709 va_TraceVABuffers (dpy , context , buffer , type , size , num_elements , pbuf );
66156710 break ;
@@ -7368,6 +7463,135 @@ void va_TraceSetDisplayAttributes(
73687463}
73697464
73707465
7466+ void va_TraceCreateProtectedSession (
7467+ VADisplay dpy ,
7468+ VAConfigID config_id ,
7469+ VAProtectedSessionID * protected_session
7470+ )
7471+ {
7472+ DPY2TRACE_VIRCTX (dpy );
7473+
7474+ TRACE_FUNCNAME (idx );
7475+
7476+ va_TraceMsg (trace_ctx , "\tconfig_id = 0x%08x\n" , config_id );
7477+ if (protected_session )
7478+ va_TraceMsg (trace_ctx , "\tprotected_session = 0x%08x\n" , * protected_session );
7479+ else
7480+ va_TraceMsg (trace_ctx , "\tprotected_session = (NULL)\n" );
7481+
7482+ va_TraceMsg (trace_ctx , NULL );
7483+
7484+ DPY2TRACE_VIRCTX_EXIT (pva_trace );
7485+ }
7486+
7487+ void va_TraceDestroyProtectedSession (
7488+ VADisplay dpy ,
7489+ VAProtectedSessionID protected_session
7490+ )
7491+ {
7492+ DPY2TRACE_VIRCTX (dpy );
7493+
7494+ TRACE_FUNCNAME (idx );
7495+
7496+ va_TraceMsg (trace_ctx , "\tprotected_session = 0x%08x\n" , protected_session );
7497+
7498+ va_TraceMsg (trace_ctx , NULL );
7499+
7500+ DPY2TRACE_VIRCTX_EXIT (pva_trace );
7501+ }
7502+
7503+ void va_TraceAttachProtectedSession (
7504+ VADisplay dpy ,
7505+ VAContextID context ,
7506+ VAProtectedSessionID protected_session
7507+ )
7508+ {
7509+ DPY2TRACE_VIRCTX (dpy );
7510+
7511+ TRACE_FUNCNAME (idx );
7512+
7513+ va_TraceMsg (trace_ctx , "\tcontext = 0x%08x\n" , context );
7514+ va_TraceMsg (trace_ctx , "\tprotected_session = 0x%08x\n" , protected_session );
7515+
7516+ va_TraceMsg (trace_ctx , NULL );
7517+
7518+ DPY2TRACE_VIRCTX_EXIT (pva_trace );
7519+ }
7520+
7521+ void va_TraceDetachProtectedSession (
7522+ VADisplay dpy ,
7523+ VAContextID context
7524+ )
7525+ {
7526+ DPY2TRACE_VIRCTX (dpy );
7527+
7528+ TRACE_FUNCNAME (idx );
7529+
7530+ va_TraceMsg (trace_ctx , "\tcontext = 0x%08x\n" , context );
7531+
7532+ va_TraceMsg (trace_ctx , NULL );
7533+
7534+ DPY2TRACE_VIRCTX_EXIT (pva_trace );
7535+ }
7536+
7537+ void va_TraceProtectedSessionExecute (
7538+ VADisplay dpy ,
7539+ VAProtectedSessionID protected_session ,
7540+ VABufferID buf_id
7541+ )
7542+ {
7543+ VABufferType type ;
7544+ unsigned int size ;
7545+ unsigned int num_elements ;
7546+ bool buf_valid = false;
7547+ VAProtectedSessionExecuteBuffer * execute_buf = NULL ;
7548+
7549+ /* Try to get buffer info and map the buffer*/
7550+ if (vaBufferInfo (dpy , VA_INVALID_ID , buf_id , & type , & size , & num_elements ) == VA_STATUS_SUCCESS )
7551+ {
7552+ if (type == VAProtectedSessionExecuteBufferType )
7553+ {
7554+ if (vaMapBuffer (dpy , buf_id , (void * * )& execute_buf ) == VA_STATUS_SUCCESS && execute_buf )
7555+ {
7556+ buf_valid = true;
7557+ }
7558+ }
7559+ }
7560+
7561+ DPY2TRACE_VIRCTX (dpy );
7562+
7563+ TRACE_FUNCNAME (idx );
7564+
7565+ va_TraceMsg (trace_ctx , "\tprotected_session = 0x%08x\n" , protected_session );
7566+ va_TraceMsg (trace_ctx , "\tbuf_id = 0x%08x\n" , buf_id );
7567+
7568+ if (buf_valid )
7569+ {
7570+ va_TraceMsg (trace_ctx , "\tbuffer type = %s\n" , vaBufferTypeStr (type ));
7571+ va_TraceMsg (trace_ctx , "\tbuffer size = %u\n" , size );
7572+ va_TraceMsg (trace_ctx , "\tnum_elements = %u\n" , num_elements );
7573+ va_TraceMsg (trace_ctx , "\tVAProtectedSessionExecuteBuffer:\n" );
7574+ va_TraceMsg (trace_ctx , "\t\tfunction_id = 0x%08x\n" , execute_buf -> function_id );
7575+ va_TraceMsg (trace_ctx , "\t\tinput.data = 0x%p\n" , execute_buf -> input .data );
7576+ va_TraceMsg (trace_ctx , "\t\tinput.data_size = %u\n" , execute_buf -> input .data_size );
7577+ va_TraceMsg (trace_ctx , "\t\tinput.max_data_size = %u\n" , execute_buf -> input .max_data_size );
7578+ va_TraceMsg (trace_ctx , "\t\toutput.data = 0x%p\n" , execute_buf -> output .data );
7579+ va_TraceMsg (trace_ctx , "\t\toutput.data_size = %u\n" , execute_buf -> output .data_size );
7580+ va_TraceMsg (trace_ctx , "\t\toutput.max_data_size = %u\n" , execute_buf -> output .max_data_size );
7581+ va_TraceMsg (trace_ctx , "\t\tstatus = 0x%08x\n" , execute_buf -> status );
7582+ }
7583+ else
7584+ {
7585+ va_TraceMsg (trace_ctx , "\tbuffer is not valid\n" );
7586+ }
7587+ va_TraceMsg (trace_ctx , NULL );
7588+
7589+ DPY2TRACE_VIRCTX_EXIT (pva_trace );
7590+
7591+ vaUnmapBuffer (dpy , buf_id );
7592+ }
7593+
7594+
73717595void va_TracePutSurface (
73727596 VADisplay dpy ,
73737597 VASurfaceID surface ,
0 commit comments