diff options
author | Philipp Zabel <p.zabel@pengutronix.de> | 2020-12-10 16:38:31 +0100 |
---|---|---|
committer | Philipp Zabel <p.zabel@pengutronix.de> | 2021-01-04 12:59:33 +0100 |
commit | 9dbb70fd663770418daab07590f4f534eb7a4931 (patch) | |
tree | 5d1e7067e2a846b5019b33df647062d87b70a2df /include/drm | |
parent | 0a1b813f06f1009d1d44d48888e92e3a59ea0be3 (diff) | |
download | linux-stable-9dbb70fd663770418daab07590f4f534eb7a4931.tar.gz linux-stable-9dbb70fd663770418daab07590f4f534eb7a4931.tar.bz2 linux-stable-9dbb70fd663770418daab07590f4f534eb7a4931.zip |
drm/crtc: add drmm_crtc_alloc_with_planes()
Add an alternative to drm_crtc_init_with_planes() that allocates
and initializes a crtc and registers drm_crtc_cleanup() with
drmm_add_action_or_reset().
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'include/drm')
-rw-r--r-- | include/drm/drm_crtc.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index 5f43d64d2a07..540e2e43ec93 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h @@ -1223,6 +1223,39 @@ int drm_crtc_init_with_planes(struct drm_device *dev, const char *name, ...); void drm_crtc_cleanup(struct drm_crtc *crtc); +__printf(7, 8) +void *__drmm_crtc_alloc_with_planes(struct drm_device *dev, + size_t size, size_t offset, + struct drm_plane *primary, + struct drm_plane *cursor, + const struct drm_crtc_funcs *funcs, + const char *name, ...); + +/** + * drm_crtc_alloc_with_planes - Allocate and initialize a new CRTC object with + * specified primary and cursor planes. + * @dev: DRM device + * @type: the type of the struct which contains struct &drm_crtc + * @member: the name of the &drm_crtc within @type. + * @primary: Primary plane for CRTC + * @cursor: Cursor plane for CRTC + * @funcs: callbacks for the new CRTC + * @name: printf style format string for the CRTC name, or NULL for default name + * + * Allocates and initializes a new crtc object. Cleanup is automatically + * handled through registering drmm_crtc_cleanup() with drmm_add_action(). + * + * The @drm_crtc_funcs.destroy hook must be NULL. + * + * Returns: + * Pointer to new crtc, or ERR_PTR on failure. + */ +#define drmm_crtc_alloc_with_planes(dev, type, member, primary, cursor, funcs, name, ...) \ + ((type *)__drmm_crtc_alloc_with_planes(dev, sizeof(type), \ + offsetof(type, member), \ + primary, cursor, funcs, \ + name, ##__VA_ARGS__)) + /** * drm_crtc_index - find the index of a registered CRTC * @crtc: CRTC to find index for |