Kernel clients
This library provides support for clients running in the kernel like fbdev and bootsplash.
GEM drivers which provide a GEM based dumb buffer with a virtual address are supported.
struct drm_client_funcs #
DRM client callbacks
Definition
;
Members
-
owner: The module owner -
free: Called when the client gets unregistered. Implementations should release all client-specific data and free the memory.This callback is optional.
-
unregister: Called whendrm_deviceis unregistered. The client should respond by releasing its resources usingdrm_client_release().This callback is optional.
-
restore: Called ondrm_lastclose(). The first client instance in the list that returns zero gets the privilege to restore and no more clients are called. This callback is not called after unregister has been called.Note that the core does not guarantee exclusion against concurrent
drm_open(). Clients need to ensure this themselves, for example by usingdrm_master_internal_acquire()anddrm_master_internal_release().If the caller passes force, the client should ignore any present DRM master and restore the display anyway.
This callback is optional.
-
hotplug: Called ondrm_kms_helper_hotplug_event(). This callback is not called after unregister has been called.This callback is optional.
-
suspend: Called when suspending the device.This callback is optional.
-
resume: Called when resuming the device from suspend.This callback is optional.
struct drm_client_dev #
DRM client instance
Definition
;
Members
dev: DRM devicename: Name of the client.list: List of all clients of a DRM device, linked intodrm_device.clientlist. Protected bydrm_device.clientlist_mutex.funcs: DRM client functions (optional)file: DRM filemodeset_mutex: Protects modesets.modesets: CRTC configurationssuspended: The client has been suspended.hotplug_pending: A hotplug event has been received while the client was suspended. Try again on resume.hotplug_failed: Set by client hotplug helpers if the hotplugging failed before. It is usually not tried again.
struct drm_client_buffer #
DRM client buffer
Definition
;
Members
-
client: DRM client -
gem: GEM object backing this bufferFIXME: The DRM framebuffer holds a reference on its GEM buffer objects. Do not use this field in new code and update existing users.
-
map: Virtual address for the buffer -
fb: DRM framebuffer
drm_client_for_each_modeset() #
Iterate over client modesets
Parameters
modeset:drm_mode_setloop cursorclient: DRM client
drm_client_for_each_connector_iter() #
connector_list iterator macro
Parameters
connector:struct drm_connectorpointer used as cursoriter:struct drm_connector_list_iter
Description
This iterates the connectors that are useable for internal clients (excludes writeback connectors).
For more info see drm_for_each_connector_iter().
drm_client_init() #
int Initialise a DRM client
Parameters
struct drm_device *dev: DRM devicestruct drm_client_dev *client: DRM clientconst char *name: Client nameconst struct drm_client_funcs *funcs: DRM client functions (optional)
Description
This initialises the client and opens a drm_file.
Use drm_client_register() to complete the process.
The caller needs to hold a reference on dev before calling this function.
The client is freed when the drm_device is unregistered. See drm_client_release().
Return
Zero on success or negative error code on failure.
drm_client_register() #
void Register client
Parameters
struct drm_client_dev *client: DRM client
Description
Add the client to the drm_device client list to activate its callbacks.
client must be initialized by a call to drm_client_init(). After
drm_client_register() it is no longer permissible to call drm_client_release()
directly (outside the unregister callback), instead cleanup will happen
automatically on driver unload.
Registering a client generates a hotplug event that allows the client to set up its display from pre-existing outputs. The client must have initialized its state to able to handle the hotplug event successfully.
drm_client_release() #
void Release DRM client resources
Parameters
struct drm_client_dev *client: DRM client
Description
Releases resources by closing the drm_file that was opened by drm_client_init().
It is called automatically if the drm_client_funcs.unregister callback is not set.
This function should only be called from the unregister callback. An exception is fbdev which cannot free the buffer if userspace has open file descriptors.
Note
Clients cannot initiate a release by themselves. This is done to keep the code simple. The driver has to be unloaded before the client can be unloaded.
drm_client_buffer_delete() #
void Delete a client buffer
Parameters
struct drm_client_buffer *buffer: DRM client buffer
drm_client_buffer_vmap_local() #
int Map DRM client buffer into address space
Parameters
struct drm_client_buffer *buffer: DRM client bufferstruct iosys_map *map_copy: Returns the mapped memory's address
Description
This function maps a client buffer into kernel address space. If the buffer is already mapped, it returns the existing mapping's address.
Client buffer mappings are not ref'counted. Each call to
drm_client_buffer_vmap_local() should be closely followed by a call to
drm_client_buffer_vunmap_local(). See drm_client_buffer_vmap() for
long-term mappings.
The returned address is a copy of the internal value. In contrast to other vmap interfaces, you don't need it for the client's vunmap function. So you can modify it at will during blit and draw operations.
Return
0 on success, or a negative errno code otherwise.
drm_client_buffer_vunmap_local() #
void Unmap DRM client buffer
Parameters
struct drm_client_buffer *buffer: DRM client buffer
Description
This function removes a client buffer's memory mapping established
with drm_client_buffer_vunmap_local(). Calling this function is only
required by clients that manage their buffer mappings by themselves.
drm_client_buffer_vmap() #
int Map DRM client buffer into address space
Parameters
struct drm_client_buffer *buffer: DRM client bufferstruct iosys_map *map_copy: Returns the mapped memory's address
Description
This function maps a client buffer into kernel address space. If the buffer is already mapped, it returns the existing mapping's address.
Client buffer mappings are not ref'counted. Each call to
drm_client_buffer_vmap() should be followed by a call to
drm_client_buffer_vunmap(); or the client buffer should be mapped
throughout its lifetime.
The returned address is a copy of the internal value. In contrast to other vmap interfaces, you don't need it for the client's vunmap function. So you can modify it at will during blit and draw operations.
Return
0 on success, or a negative errno code otherwise.
drm_client_buffer_vunmap() #
void Unmap DRM client buffer
Parameters
struct drm_client_buffer *buffer: DRM client buffer
Description
This function removes a client buffer's memory mapping. Calling this function is only required by clients that manage their buffer mappings by themselves.
drm_client_buffer_create_dumb() #
struct drm_client_buffer * Create a client buffer backed by a dumb buffer
Parameters
struct drm_client_dev *client: DRM clientu32 width: Framebuffer widthu32 height: Framebuffer heightu32 format: Buffer format
Description
This function creates a drm_client_buffer which consists of a
drm_framebuffer backed by a dumb buffer.
Call drm_client_buffer_delete() to free the buffer.
Return
Pointer to a client buffer or an error pointer on failure.
drm_client_buffer_flush() #
int Manually flush client buffer
Parameters
struct drm_client_buffer *buffer: DRM client bufferstruct drm_rect *rect: Damage rectangle (if NULL flushes all)
Description
This calls drm_framebuffer_funcs->dirty (if present) to flush buffer changes
for drivers that need it.
Return
Zero on success or negative error code on failure.
drm_client_modeset_probe() #
int Probe for displays
Parameters
struct drm_client_dev *client: DRM clientunsigned int width: Maximum display mode width (optional)unsigned int height: Maximum display mode height (optional)
Description
This function sets up display pipelines for enabled connectors and stores the config in the client's modeset array.
Return
Zero on success or negative error code on failure.
drm_client_rotation() #
bool Check the initial rotation value
Parameters
struct drm_mode_set *modeset: DRM modesetunsigned int *rotation: Returned rotation value
Description
This function checks if the primary plane in modeset can hw rotate to match the rotation needed on its connector.
Note
Currently only 0 and 180 degrees are supported.
Return
True if the plane can do the rotation, false otherwise.
drm_client_modeset_check() #
int Check modeset configuration
Parameters
struct drm_client_dev *client: DRM client
Description
Check modeset configuration.
Return
Zero on success or negative error code on failure.
drm_client_modeset_commit_locked() #
int Force commit CRTC configuration
Parameters
struct drm_client_dev *client: DRM client
Description
Commit modeset configuration to crtcs without checking if there is a DRM
master. The assumption is that the caller already holds an internal DRM
master reference acquired with drm_master_internal_acquire().
Return
Zero on success or negative error code on failure.
drm_client_modeset_commit() #
int Commit CRTC configuration
Parameters
struct drm_client_dev *client: DRM client
Description
Commit modeset configuration to crtcs.
Return
Zero on success or negative error code on failure.
drm_client_modeset_dpms() #
int Set DPMS mode
Parameters
struct drm_client_dev *client: DRM clientint mode: DPMS mode
Note
For atomic drivers mode is reduced to on/off.
Return
Zero on success or negative error code on failure.
drm_client_modeset_wait_for_vblank() #
int Wait for the next VBLANK to occur
Parameters
struct drm_client_dev *client: DRM clientunsigned int crtc_index: The ndex of the CRTC to wait on
Description
Block the caller until the given CRTC has seen a VBLANK. Do nothing if the CRTC is disabled. If there's another DRM master present, fail with -EBUSY.
Return
0 on success, or negative error code otherwise.
drm_client_dev_unregister() #
void Unregister clients
Parameters
struct drm_device *dev: DRM device
Description
This function releases all clients by calling each client's
drm_client_funcs.unregister callback. The callback function
is responsibe for releaseing all resources including the client
itself.
The helper drm_dev_unregister() calls this function. Drivers
that use it don't need to call this function themselves.
drm_client_dev_hotplug() #
void Send hotplug event to clients
Parameters
struct drm_device *dev: DRM device
Description
This function calls the drm_client_funcs.hotplug callback on the attached clients.
drm_kms_helper_hotplug_event() calls this function, so drivers that use it
don't need to call this function themselves.