PebbleOS v4.47.0-1362-gd278268fe
Loading...
Searching...
No Matches
GPU drivers

Interface for GPU drivers. More...

Data Structures

struct  pbl_gpu_ops
 GPU driver operations. More...
 
struct  pbl_gpu
 A GPU. More...
 

Macros

#define PBL_GPU_STATE_DEFINE(sym)
 Define the class state of GPU sym, for the PBL_*_DEFINE() macro of a driver.
 
#define PBL_GPU_INIT(sym, _name, _parent, _ops, ...)
 Initializer for the struct pbl_gpu of GPU sym.
 

Functions

int pbl_gpu_dev_init (const struct pbl_device *dev)
 Device init of every GPU: calls the driver's init.
 
void pbl_gpu_complete (const struct pbl_gpu *gpu, int status)
 End the job running, for drivers.
 

Detailed Description

Interface for GPU drivers.

A driver embeds a struct pbl_gpu in its instance, sets it up with PBL_GPU_STATE_DEFINE() and PBL_GPU_INIT(), implements the struct pbl_gpu_ops the class calls and ends each job with pbl_gpu_complete().


Data Structure Documentation

◆ pbl_gpu

struct pbl_gpu

A GPU.

Data Fields
struct pbl_gpu_caps caps Capabilities.
struct pbl_device dev Device.
const struct pbl_gpu_ops * ops Driver operations.
struct pbl_gpu_state * state Runtime state.

Macro Definition Documentation

◆ PBL_GPU_INIT

#define PBL_GPU_INIT (   sym,
  _name,
  _parent,
  _ops,
  ... 
)
Value:
{ \
.dev = PBL_DEVICE_INIT_CLASS(sym, _name, pbl_gpu_dev_init, _parent, &pbl_gpu_class), \
.ops = (_ops), .state = &sym##_gpu_state, .caps = {__VA_ARGS__} \
}
#define PBL_DEVICE_INIT_CLASS(sym, _name, _init, _parent, _cls)
Initializer for the struct pbl_device of device instance sym, in class _cls.
Definition device.h:153
int pbl_gpu_dev_init(const struct pbl_device *dev)
Device init of every GPU: calls the driver's init.

Initializer for the struct pbl_gpu of GPU sym.

Parameters
symSymbol of the GPU instance, with its state defined by PBL_GPU_STATE_DEFINE().
_nameName.
_parentParent device, or NULL.
_opsDriver operations.
...Capabilities, designated initializers of struct pbl_gpu_caps.

◆ PBL_GPU_STATE_DEFINE

#define PBL_GPU_STATE_DEFINE (   sym)
Value:
static struct pbl_gpu_state sym##_gpu_state = {.free = PBL_SEM_INITIALIZER(1, 1)}
#define PBL_DEVICE_STATE_DEFINE(sym)
Define the runtime state of device instance sym.
Definition device.h:132
#define PBL_SEM_INITIALIZER(init, lim)
Static initializer for a semaphore.
Definition sem.h:56

Define the class state of GPU sym, for the PBL_*_DEFINE() macro of a driver.

Parameters
symSymbol of the GPU instance.

Function Documentation

◆ pbl_gpu_complete()

void pbl_gpu_complete ( const struct pbl_gpu *  gpu,
int  status 
)

End the job running, for drivers.

Callable from an interrupt.

Parameters
gpuGPU.
status0 or a negative errno.

◆ pbl_gpu_dev_init()

int pbl_gpu_dev_init ( const struct pbl_device *  dev)

Device init of every GPU: calls the driver's init.

Parameters
devGPU device.
Returns
0 or a negative errno.