|
XenevaOS
|
#include <drm_mode_config.h>

Public Attributes | |
| struct drm_framebuffer *(* | fb_create )(struct drm_device *dev, struct drm_file *file_priv, const struct drm_format_info *info, const struct drm_mode_fb_cmd2 *mode_cmd) |
| const struct drm_format_info *(* | get_format_info )(u32 pixel_format, u64 modifier) |
| enum drm_mode_status(* | mode_valid )(struct drm_device *dev, const struct drm_display_mode *mode) |
| int(* | atomic_check )(struct drm_device *dev, struct drm_atomic_commit *state) |
| int(* | atomic_commit )(struct drm_device *dev, struct drm_atomic_commit *state, bool nonblock) |
| struct drm_atomic_commit *(* | atomic_state_alloc )(struct drm_device *dev) |
| void(* | atomic_state_clear )(struct drm_atomic_commit *state) |
| void(* | atomic_state_free )(struct drm_atomic_commit *state) |
struct drm_mode_config_funcs - basic driver provided mode setting functions
Some global (i.e. not per-CRTC, connector, etc) mode setting functions that involve drivers.
| int(* drm_mode_config_funcs::atomic_check) (struct drm_device *dev, struct drm_atomic_commit *state) |
@atomic_check:
This is the only hook to validate an atomic modeset update. This function must reject any modeset and state changes which the hardware or driver doesn't support. This includes but is of course not limited to:
See the documentation of @atomic_commit for an exhaustive list of error conditions which don't have to be checked at the in this callback.
See the documentation for &struct drm_atomic_commit for how exactly an atomic modeset update is described.
Drivers using the atomic helpers can implement this hook using drm_atomic_helper_check(), or one of the exported sub-functions of it.
RETURNS:
0 on success or one of the below negative error codes:
| int(* drm_mode_config_funcs::atomic_commit) (struct drm_device *dev, struct drm_atomic_commit *state, bool nonblock) |
@atomic_commit:
This is the only hook to commit an atomic modeset update. The core guarantees that @atomic_check has been called successfully before calling this function, and that nothing has been changed in the interim.
See the documentation for &struct drm_atomic_commit for how exactly an atomic modeset update is described.
Drivers using the atomic helpers can implement this hook using drm_atomic_helper_commit(), or one of the exported sub-functions of it.
Nonblocking commits (as indicated with the nonblock parameter) must do any preparatory work which might result in an unsuccessful commit in the context of this callback. The only exceptions are hardware errors resulting in -EIO. But even in that case the driver must ensure that the display pipe is at least running, to avoid compositors crashing when pageflips don't work. Anything else, specifically committing the update to the hardware, should be done without blocking the caller. For updates which do not require a modeset this must be guaranteed.
The driver must wait for any pending rendering to the new framebuffers to complete before executing the flip. It should also wait for any pending rendering from other drivers if the underlying buffer is a shared dma-buf. Nonblocking commits must not wait for rendering in the context of this callback.
An application can request to be notified when the atomic commit has completed. These events are per-CRTC and can be distinguished by the CRTC index supplied in &drm_event to userspace.
The drm core will supply a &struct drm_event in each CRTC's &drm_crtc_state.event. See the documentation for &drm_crtc_state.event for more details about the precise semantics of this event.
NOTE:
Drivers are not allowed to shut down any display pipe successfully enabled through an atomic commit on their own. Doing so can result in compositors crashing if a page flip is suddenly rejected because the pipe is off.
RETURNS:
0 on success or one of the below negative error codes:
This list is exhaustive. Specifically this hook is not allowed to return -EINVAL (any invalid requests should be caught in @atomic_check) or -EDEADLK (this function must not acquire additional modeset locks).
| struct drm_atomic_commit *(* drm_mode_config_funcs::atomic_state_alloc) (struct drm_device *dev) |
@atomic_state_alloc:
This optional hook can be used by drivers that want to subclass struct &drm_atomic_commit to be able to track their own driver-private global state easily. If this hook is implemented, drivers must also implement @atomic_state_clear and @atomic_state_free.
Subclassing of &drm_atomic_commit is deprecated in favour of using &drm_private_state and &drm_private_obj.
RETURNS:
A new &drm_atomic_commit on success or NULL on failure.
| void(* drm_mode_config_funcs::atomic_state_clear) (struct drm_atomic_commit *state) |
@atomic_state_clear:
This hook must clear any driver private state duplicated into the passed-in &drm_atomic_commit. This hook is called when the caller encountered a &drm_modeset_lock deadlock and needs to drop all already acquired locks as part of the deadlock avoidance dance implemented in drm_modeset_backoff().
Any duplicated state must be invalidated since a concurrent atomic update might change it, and the drm atomic interfaces always apply updates as relative changes to the current state.
Drivers that implement this must call drm_atomic_commit_default_clear() to clear common state.
Subclassing of &drm_atomic_commit is deprecated in favour of using &drm_private_state and &drm_private_obj.
| void(* drm_mode_config_funcs::atomic_state_free) (struct drm_atomic_commit *state) |
@atomic_state_free:
This hook needs driver private resources and the &drm_atomic_commit itself. Note that the core first calls drm_atomic_commit_clear() to avoid code duplicate between the clear and free hooks.
Drivers that implement this must call drm_atomic_commit_default_release() to release common resources.
Subclassing of &drm_atomic_commit is deprecated in favour of using &drm_private_state and &drm_private_obj.
| struct drm_framebuffer *(* drm_mode_config_funcs::fb_create) (struct drm_device *dev, struct drm_file *file_priv, const struct drm_format_info *info, const struct drm_mode_fb_cmd2 *mode_cmd) |
@fb_create:
Create a new framebuffer object. The core does basic checks on the requested metadata, but most of that is left to the driver. See &struct drm_mode_fb_cmd2 for details.
To validate the pixel format and modifier drivers can use drm_any_plane_has_format() to make sure at least one plane supports the requested values. Note that the driver must first determine the actual modifier used if the request doesn't have it specified, ie. when (@mode_cmd->flags & DRM_MODE_FB_MODIFIERS) == 0.
IMPORTANT: These implied modifiers for legacy userspace must be stored in struct &drm_framebuffer, including all relevant metadata like &drm_framebuffer.pitches and &drm_framebuffer.offsets if the modifier enables additional planes beyond the fourcc pixel format code. This is required by the GETFB2 ioctl.
If the parameters are deemed valid and the backing storage objects in the underlying memory manager all exist, then the driver allocates a new &drm_framebuffer structure, subclassed to contain driver-specific information (like the internal native buffer object references). It also needs to fill out all relevant metadata, which should be done by calling drm_helper_mode_fill_fb_struct().
The initialization is finalized by calling drm_framebuffer_init(), which registers the framebuffer and makes it accessible to other threads.
RETURNS:
A new framebuffer with an initial reference count of 1 or a negative error code encoded with ERR_PTR().
| const struct drm_format_info *(* drm_mode_config_funcs::get_format_info) (u32 pixel_format, u64 modifier) |
@get_format_info:
Allows a driver to return custom format information for special fb layouts (eg. ones with auxiliary compression control planes).
RETURNS:
The format information specific to the given fb metadata, or NULL if none is found.
| enum drm_mode_status(* drm_mode_config_funcs::mode_valid) (struct drm_device *dev, const struct drm_display_mode *mode) |
@mode_valid:
Device specific validation of display modes. Can be used to reject modes that can never be supported. Only device wide constraints can be checked here. crtc/encoder/bridge/connector specific constraints should be checked in the .mode_valid() hook for each specific object.