@ -9937,19 +9937,14 @@ int vrend_renderer_get_poll_fd(void)
return vrend_state . eventfd ;
}
int vrend_renderer_execute ( void * execute_args , uint32_t execute_size )
static int vrend_renderer_export_query ( void * execute_args , uint32_t execute_size )
{
/*
* This function only supports VIRGL_RENDERER_STRUCTURE_TYPE_RESOURCE_QUERY currently .
*/
struct vrend_resource * res ;
struct virgl_renderer_export_query * export_query = execute_args ;
if ( execute_size ! = sizeof ( struct virgl_renderer_export_query ) )
return - EINVAL ;
if ( export_query - > hdr . stype ! = VIRGL_RENDERER_STRUCTURE_TYPE_EXPORT_QUERY | |
export_query - > hdr . stype_version ! = 0 | |
export_query - > hdr . size ! = sizeof ( struct virgl_renderer_export_query ) )
if ( export_query - > hdr . size ! = sizeof ( struct virgl_renderer_export_query ) )
return - EINVAL ;
res = vrend_resource_lookup ( export_query - > in_resource_id , 0 ) ;
@ -9972,3 +9967,39 @@ int vrend_renderer_execute(void *execute_args, uint32_t execute_size)
return 0 ;
}
static int vrend_renderer_supported_structures ( void * execute_args , uint32_t execute_size )
{
struct virgl_renderer_supported_structures * supported_structures = execute_args ;
if ( execute_size ! = sizeof ( struct virgl_renderer_supported_structures ) )
return - EINVAL ;
if ( supported_structures - > hdr . size ! = sizeof ( struct virgl_renderer_supported_structures ) )
return - EINVAL ;
if ( supported_structures - > in_stype_version = = 0 ) {
supported_structures - > out_supported_structures_mask =
VIRGL_RENDERER_STRUCTURE_TYPE_EXPORT_QUERY |
VIRGL_RENDERER_STRUCTURE_TYPE_SUPPORTED_STRUCTURES ;
} else {
supported_structures - > out_supported_structures_mask = 0 ;
}
return 0 ;
}
int vrend_renderer_execute ( void * execute_args , uint32_t execute_size )
{
struct virgl_renderer_hdr * hdr = execute_args ;
if ( hdr - > stype_version ! = 0 )
return - EINVAL ;
switch ( hdr - > stype ) {
case VIRGL_RENDERER_STRUCTURE_TYPE_SUPPORTED_STRUCTURES :
return vrend_renderer_supported_structures ( execute_args , execute_size ) ;
case VIRGL_RENDERER_STRUCTURE_TYPE_EXPORT_QUERY :
return vrend_renderer_export_query ( execute_args , execute_size ) ;
default :
return - EINVAL ;
}
}