Skip to content

Commit

Permalink
drm: add support for private planes
Browse files Browse the repository at this point in the history
In cases where the scanout hw is sufficiently similar between "overlay"
and traditional crtc layers, it might be convenient to allow the driver
to create internal drm_plane helper objects used by the drm_crtc
implementation, rather than duplicate code between the plane and crtc.
A private plane is not exposed to userspace.

Signed-off-by: Rob Clark <rob@ti.com>
  • Loading branch information
Rob Clark committed Dec 16, 2011
1 parent e970be6 commit 41df687
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
22 changes: 17 additions & 5 deletions drivers/gpu/drm/drm_crtc.c
Expand Up @@ -557,7 +557,8 @@ EXPORT_SYMBOL(drm_encoder_cleanup);
int drm_plane_init(struct drm_device *dev, struct drm_plane *plane,
unsigned long possible_crtcs,
const struct drm_plane_funcs *funcs,
uint32_t *formats, uint32_t format_count)
const uint32_t *formats, uint32_t format_count,
bool priv)
{
mutex_lock(&dev->mode_config.mutex);

Expand All @@ -576,8 +577,16 @@ int drm_plane_init(struct drm_device *dev, struct drm_plane *plane,
plane->format_count = format_count;
plane->possible_crtcs = possible_crtcs;

list_add_tail(&plane->head, &dev->mode_config.plane_list);
dev->mode_config.num_plane++;
/* private planes are not exposed to userspace, but depending on
* display hardware, might be convenient to allow sharing programming
* for the scanout engine with the crtc implementation.
*/
if (!priv) {
list_add_tail(&plane->head, &dev->mode_config.plane_list);
dev->mode_config.num_plane++;
} else {
INIT_LIST_HEAD(&plane->head);
}

mutex_unlock(&dev->mode_config.mutex);

Expand All @@ -592,8 +601,11 @@ void drm_plane_cleanup(struct drm_plane *plane)
mutex_lock(&dev->mode_config.mutex);
kfree(plane->format_types);
drm_mode_object_put(dev, &plane->base);
list_del(&plane->head);
dev->mode_config.num_plane--;
/* if not added to a list, it must be a private plane */
if (!list_empty(&plane->head)) {
list_del(&plane->head);
dev->mode_config.num_plane--;
}
mutex_unlock(&dev->mode_config.mutex);
}
EXPORT_SYMBOL(drm_plane_cleanup);
Expand Down
3 changes: 2 additions & 1 deletion include/drm/drm_crtc.h
Expand Up @@ -828,7 +828,8 @@ extern int drm_plane_init(struct drm_device *dev,
struct drm_plane *plane,
unsigned long possible_crtcs,
const struct drm_plane_funcs *funcs,
uint32_t *formats, uint32_t format_count);
const uint32_t *formats, uint32_t format_count,
bool private);
extern void drm_plane_cleanup(struct drm_plane *plane);

extern void drm_encoder_cleanup(struct drm_encoder *encoder);
Expand Down

0 comments on commit 41df687

Please sign in to comment.