|
XenevaOS
|
#include <drm_atomic.h>

Public Attributes | |
| struct drm_device * | dev |
| struct list_head | head |
| struct drm_modeset_lock | lock |
| struct drm_private_state * | state |
| const struct drm_private_state_funcs * | funcs |
struct drm_private_obj - base struct for driver private atomic object
A driver private object is initialized by calling drm_atomic_private_obj_init() and cleaned up by calling drm_atomic_private_obj_fini().
Currently only tracks the state update functions and the opaque driver private state itself, but in the future might also track which &drm_modeset_lock is required to duplicate and update this object's state.
All private objects must be initialized before the DRM device they are attached to is registered to the DRM subsystem (call to drm_dev_register()) and should stay around until this DRM device is unregistered (call to drm_dev_unregister()). In other words, private objects lifetime is tied to the DRM device lifetime. This implies that:
1/ all calls to drm_atomic_private_obj_init() must be done before calling drm_dev_register() 2/ all calls to drm_atomic_private_obj_fini() must be done after calling drm_dev_unregister()
If that private object is used to store a state shared by multiple CRTCs, proper care must be taken to ensure that non-blocking commits are properly ordered to avoid a use-after-free issue.
Indeed, assuming a sequence of two non-blocking &drm_atomic_commit on two different &drm_crtc using different &drm_plane and &drm_connector, so with no resources shared, there's no guarantee on which commit is going to happen first. However, the second &drm_atomic_commit will consider the first &drm_private_obj its old state, and will be in charge of freeing it whenever the second &drm_atomic_commit is done.
If the first &drm_atomic_commit happens after it, it will consider its &drm_private_obj the new state and will be likely to access it, resulting in an access to a freed memory region. Drivers should store (and get a reference to) the &drm_crtc_commit structure in our private state in &drm_mode_config_helper_funcs.atomic_commit_setup, and then wait for that commit to complete as the first step of &drm_mode_config_helper_funcs.atomic_commit_tail, similar to drm_atomic_helper_wait_for_dependencies().
| struct drm_device* drm_private_obj::dev |
@dev: parent DRM device
| const struct drm_private_state_funcs* drm_private_obj::funcs |
@funcs:
Functions to manipulate the state of this driver private object, see &drm_private_state_funcs.
| struct list_head drm_private_obj::head |
@head: List entry used to attach a private object to a &drm_device (queued to &drm_mode_config.privobj_list).
| struct drm_modeset_lock drm_private_obj::lock |
@lock: Modeset lock to protect the state object.
| struct drm_private_state* drm_private_obj::state |
@state: Current atomic state for this driver private object.