KGSL_IOCTL_FUNC ( IOCTL_KGSL_GPU_COMMAND, kgsl_ioctl_gpu_command) ,
1. kgsl_ioctl_gpu_command
long kgsl_ioctl_gpu_command ( struct kgsl_device_private * dev_priv,
unsigned int cmd, void * data)
{
struct kgsl_gpu_command * param = data;
struct kgsl_device * device = dev_priv-> device;
struct kgsl_context * context;
struct kgsl_drawobj * drawobj[ 2 ] ;
unsigned int type;
long result;
unsigned int i = 0 ;
type = _process_command_input ( device, param-> flags, param-> numcmds,
param-> numobjs, param-> numsyncs) ;
if ( ! type)
return - EINVAL;
context = kgsl_context_get_owner ( dev_priv, param-> context_id) ;
if ( context == NULL )
return - EINVAL;
if ( type & SYNCOBJ_TYPE) {
struct kgsl_drawobj_sync * syncobj =
kgsl_drawobj_sync_create ( device, context) ;
if ( IS_ERR ( syncobj) ) {
result = PTR_ERR ( syncobj) ;
goto done;
}
drawobj[ i++ ] = DRAWOBJ ( syncobj) ;
result = kgsl_drawobj_sync_add_synclist ( device, syncobj,
u64_to_user_ptr ( param-> synclist) ,
param-> syncsize, param-> numsyncs) ;
if ( result)
goto done;
}
if ( type & ( CMDOBJ_TYPE | MARKEROBJ_TYPE) ) {
struct kgsl_drawobj_cmd * cmdobj =
kgsl_drawobj_cmd_create ( device,
context, param-> flags, type) ;
if ( IS_ERR ( cmdobj) ) {
result = PTR_ERR ( cmdobj) ;
goto done;
}
drawobj[ i++ ] = DRAWOBJ ( cmdobj) ;
result = kgsl_drawobj_cmd_add_cmdlist ( device, cmdobj,
u64_to_user_ptr ( param-> cmdlist) ,
param-> cmdsize, param-> numcmds) ;
if ( result)
goto done;
result = kgsl_drawobj_cmd_add_memlist ( device, cmdobj,
u64_to_user_ptr ( param-> objlist) ,
param-> objsize, param-> numobjs) ;
if ( result)
goto done;
if ( cmdobj-> profiling_buf_entry == NULL )
DRAWOBJ ( cmdobj) -> flags &=
~ ( unsigned long ) KGSL_DRAWOBJ_PROFILING;
}
result = device-> ftbl-> queue_cmds ( dev_priv, context, drawobj,
i, & param-> timestamp) ;
done:
if ( result && result != - EPROTO)
while ( i-- )
kgsl_drawobj_destroy ( drawobj[ i] ) ;
kgsl_context_put ( context) ;
return result;
}
1.1 kgsl_gpu_command
struct kgsl_gpu_command {
__u64 flags;
__u64 __user cmdlist;
unsigned int cmdsize;
unsigned int numcmds;
__u64 __user objlist;
unsigned int objsize;
unsigned int numobjs;
__u64 __user synclist;
unsigned int syncsize;
unsigned int numsyncs;
unsigned int context_id;
unsigned int timestamp;
} ;
1.2 kgsl_drawobj
struct kgsl_drawobj {
struct kgsl_device * device;
struct kgsl_context * context;
uint32_t