XenevaOS
Loading...
Searching...
No Matches
Public Attributes | List of all members
drm_driver Struct Reference

#include <drm_drv.h>

Collaboration diagram for drm_driver:
Collaboration graph
[legend]

Public Attributes

int(* load )(struct drm_device *, unsigned long flags)
 
int(* open )(struct drm_device *, struct drm_file *)
 
void(* postclose )(struct drm_device *, struct drm_file *)
 
void(* unload )(struct drm_device *)
 
void(* release )(struct drm_device *)
 
void(* master_set )(struct drm_device *dev, struct drm_file *file_priv, bool from_open)
 
void(* master_drop )(struct drm_device *dev, struct drm_file *file_priv)
 
void(* debugfs_init )(struct drm_minor *minor)
 
struct drm_gem_object *(* gem_create_object )(struct drm_device *dev, size_t size)
 
int(* prime_handle_to_fd )(struct drm_device *dev, struct drm_file *file_priv, uint32_t handle, uint32_t flags, int *prime_fd)
 
int(* prime_fd_to_handle )(struct drm_device *dev, struct drm_file *file_priv, int prime_fd, uint32_t *handle)
 
struct drm_gem_object *(* gem_prime_import )(struct drm_device *dev, struct dma_buf *dma_buf)
 
struct drm_gem_object *(* gem_prime_import_sg_table )(struct drm_device *dev, struct dma_buf_attachment *attach, struct sg_table *sgt)
 
int(* dumb_create )(struct drm_file *file_priv, struct drm_device *dev, struct drm_mode_create_dumb *args)
 
int(* dumb_map_offset )(struct drm_file *file_priv, struct drm_device *dev, uint32_t handle, uint64_t *offset)
 
int(* fbdev_probe )(struct drm_fb_helper *fbdev_helper, struct drm_fb_helper_surface_size *sizes)
 
void(* show_fdinfo )(struct drm_printer *p, struct drm_file *f)
 
int major
 
int minor
 
int patchlevel
 
: driver name
char * name
 
char * desc
 
u32 driver_features
 
const struct drm_ioctl_desc * ioctls
 
int num_ioctls
 
const struct file_operations * fops
 

Detailed Description

struct drm_driver - DRM driver structure

This structure represent the common code for a family of cards. There will be one &struct drm_device for each card present in this family. It contains lots of vfunc entries, and a pile of those probably should be moved to more appropriate places like &drm_mode_config_funcs or into a new operations structure for GEM drivers.

Member Data Documentation

◆ debugfs_init

void(* drm_driver::debugfs_init) (struct drm_minor *minor)

@debugfs_init:

Allows drivers to create driver-specific debugfs files.

◆ desc

char* drm_driver::desc

@desc: driver description

◆ driver_features

u32 drm_driver::driver_features

@driver_features: Driver features, see &enum drm_driver_feature. Drivers can disable some features on a per-instance basis using &drm_device.driver_features.

◆ dumb_create

int(* drm_driver::dumb_create) (struct drm_file *file_priv, struct drm_device *dev, struct drm_mode_create_dumb *args)

@dumb_create:

This creates a new dumb buffer in the driver's backing storage manager (GEM, TTM or something else entirely) and returns the resulting buffer handle. This handle can then be wrapped up into a framebuffer modeset object.

Note that userspace is not allowed to use such objects for render acceleration - drivers must create their own private ioctls for such a use case.

Width, height and depth are specified in the &drm_mode_create_dumb argument. The callback needs to fill the handle, pitch and size for the created buffer.

Called by the user via ioctl.

Returns:

Zero on success, negative errno on failure.

◆ dumb_map_offset

int(* drm_driver::dumb_map_offset) (struct drm_file *file_priv, struct drm_device *dev, uint32_t handle, uint64_t *offset)

@dumb_map_offset:

Allocate an offset in the drm device node's address space to be able to memory map a dumb buffer.

The default implementation is drm_gem_create_mmap_offset(). GEM based drivers must not overwrite this.

Called by the user via ioctl.

Returns:

Zero on success, negative errno on failure.

◆ fbdev_probe

int(* drm_driver::fbdev_probe) (struct drm_fb_helper *fbdev_helper, struct drm_fb_helper_surface_size *sizes)

@fbdev_probe:

Allocates and initialize the fb_info structure for fbdev emulation. Furthermore it also needs to allocate the DRM framebuffer used to back the fbdev.

This callback is mandatory for fbdev support.

Returns:

0 on success ot a negative error code otherwise.

◆ fops

const struct file_operations* drm_driver::fops

@fops:

File operations for the DRM device node. See the discussion in :ref:file operations<drm_driver_fops> for in-depth coverage and some examples.

◆ gem_create_object

struct drm_gem_object *(* drm_driver::gem_create_object) (struct drm_device *dev, size_t size)

@gem_create_object: constructor for gem objects

Hook for allocating the GEM object struct, for use by the CMA and SHMEM GEM helpers. Returns a GEM object on success, or an ERR_PTR()-encoded error code otherwise.

◆ gem_prime_import

struct drm_gem_object *(* drm_driver::gem_prime_import) (struct drm_device *dev, struct dma_buf *dma_buf)

@gem_prime_import:

Import hook for GEM drivers.

This defaults to drm_gem_prime_import() if not set.

◆ gem_prime_import_sg_table

struct drm_gem_object *(* drm_driver::gem_prime_import_sg_table) (struct drm_device *dev, struct dma_buf_attachment *attach, struct sg_table *sgt)

@gem_prime_import_sg_table:

Optional hook used by the PRIME helper functions drm_gem_prime_import() respectively drm_gem_prime_import_dev().

◆ ioctls

const struct drm_ioctl_desc* drm_driver::ioctls

@ioctls:

Array of driver-private IOCTL description entries. See the chapter on :ref:IOCTL support in the userland interfaces chapter<drm_driver_ioctl> for the full details.

◆ load

int(* drm_driver::load) (struct drm_device *, unsigned long flags)

@load:

Backward-compatible driver callback to complete initialization steps after the driver is registered. For this reason, may suffer from race conditions and its use is deprecated for new drivers. It is therefore only supported for existing drivers not yet converted to the new scheme. See devm_drm_dev_alloc() and drm_dev_register() for proper and race-free way to set up a &struct drm_device.

This is deprecated, do not use!

Returns:

Zero on success, non-zero value on failure.

◆ major

int drm_driver::major

@major: driver major number

◆ master_drop

void(* drm_driver::master_drop) (struct drm_device *dev, struct drm_file *file_priv)

@master_drop:

Called whenever the minor master is dropped. Only used by vmwgfx.

◆ master_set

void(* drm_driver::master_set) (struct drm_device *dev, struct drm_file *file_priv, bool from_open)

@master_set:

Called whenever the minor master is set. Only used by vmwgfx.

◆ minor

int drm_driver::minor

@minor: driver minor number

◆ name

char* drm_driver::name

◆ num_ioctls

int drm_driver::num_ioctls

@num_ioctls: Number of entries in @ioctls.

◆ open

int(* drm_driver::open) (struct drm_device *, struct drm_file *)

@open:

Driver callback when a new &struct drm_file is opened. Useful for setting up driver-private data structures like buffer allocators, execution contexts or similar things. Such driver-private resources must be released again in @postclose.

Since the display/modeset side of DRM can only be owned by exactly one &struct drm_file (see &drm_file.is_master and &drm_device.master) there should never be a need to set up any modeset related resources in this callback. Doing so would be a driver design bug.

Returns:

0 on success, a negative error code on failure, which will be promoted to userspace as the result of the open() system call.

◆ patchlevel

int drm_driver::patchlevel

@patchlevel: driver patch level

◆ postclose

void(* drm_driver::postclose) (struct drm_device *, struct drm_file *)

@postclose:

One of the driver callbacks when a new &struct drm_file is closed. Useful for tearing down driver-private data structures allocated in @open like buffer allocators, execution contexts or similar things.

Since the display/modeset side of DRM can only be owned by exactly one &struct drm_file (see &drm_file.is_master and &drm_device.master) there should never be a need to tear down any modeset related resources in this callback. Doing so would be a driver design bug.

◆ prime_fd_to_handle

int(* drm_driver::prime_fd_to_handle) (struct drm_device *dev, struct drm_file *file_priv, int prime_fd, uint32_t *handle)

@prime_fd_to_handle:

PRIME import function. Only used by vmwgfx.

◆ prime_handle_to_fd

int(* drm_driver::prime_handle_to_fd) (struct drm_device *dev, struct drm_file *file_priv, uint32_t handle, uint32_t flags, int *prime_fd)

@prime_handle_to_fd:

PRIME export function. Only used by vmwgfx.

◆ release

void(* drm_driver::release) (struct drm_device *)

@release:

Optional callback for destroying device data after the final reference is released, i.e. the device is being destroyed.

This is deprecated, clean up all memory allocations associated with a &drm_device using drmm_add_action(), drmm_kmalloc() and related managed resources functions.

◆ show_fdinfo

void(* drm_driver::show_fdinfo) (struct drm_printer *p, struct drm_file *f)

@show_fdinfo:

Print device specific fdinfo. See Documentation/gpu/drm-usage-stats.rst.

◆ unload

void(* drm_driver::unload) (struct drm_device *)

@unload:

Reverse the effects of the driver load callback. Ideally, the clean up performed by the driver should happen in the reverse order of the initialization. Similarly to the load hook, this handler is deprecated and its usage should be dropped in favor of an open-coded teardown function at the driver layer. See drm_dev_unregister() and drm_dev_put() for the proper way to remove a &struct drm_device.

The unload() hook is called right after unregistering the device.


The documentation for this struct was generated from the following file: