Commit 0a7eb243 authored by Rob Clark's avatar Rob Clark Committed by Dave Airlie

drm: add support for private planes

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: default avatarRob Clark <rob@ti.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent a9971157
...@@ -557,7 +557,8 @@ EXPORT_SYMBOL(drm_encoder_cleanup); ...@@ -557,7 +557,8 @@ EXPORT_SYMBOL(drm_encoder_cleanup);
int drm_plane_init(struct drm_device *dev, struct drm_plane *plane, int drm_plane_init(struct drm_device *dev, struct drm_plane *plane,
unsigned long possible_crtcs, unsigned long possible_crtcs,
const struct drm_plane_funcs *funcs, const struct drm_plane_funcs *funcs,
const uint32_t *formats, uint32_t format_count) const uint32_t *formats, uint32_t format_count,
bool priv)
{ {
mutex_lock(&dev->mode_config.mutex); mutex_lock(&dev->mode_config.mutex);
...@@ -577,8 +578,16 @@ int drm_plane_init(struct drm_device *dev, struct drm_plane *plane, ...@@ -577,8 +578,16 @@ int drm_plane_init(struct drm_device *dev, struct drm_plane *plane,
plane->format_count = format_count; plane->format_count = format_count;
plane->possible_crtcs = possible_crtcs; plane->possible_crtcs = possible_crtcs;
/* 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); list_add_tail(&plane->head, &dev->mode_config.plane_list);
dev->mode_config.num_plane++; dev->mode_config.num_plane++;
} else {
INIT_LIST_HEAD(&plane->head);
}
mutex_unlock(&dev->mode_config.mutex); mutex_unlock(&dev->mode_config.mutex);
...@@ -593,8 +602,11 @@ void drm_plane_cleanup(struct drm_plane *plane) ...@@ -593,8 +602,11 @@ void drm_plane_cleanup(struct drm_plane *plane)
mutex_lock(&dev->mode_config.mutex); mutex_lock(&dev->mode_config.mutex);
kfree(plane->format_types); kfree(plane->format_types);
drm_mode_object_put(dev, &plane->base); drm_mode_object_put(dev, &plane->base);
/* if not added to a list, it must be a private plane */
if (!list_empty(&plane->head)) {
list_del(&plane->head); list_del(&plane->head);
dev->mode_config.num_plane--; dev->mode_config.num_plane--;
}
mutex_unlock(&dev->mode_config.mutex); mutex_unlock(&dev->mode_config.mutex);
} }
EXPORT_SYMBOL(drm_plane_cleanup); EXPORT_SYMBOL(drm_plane_cleanup);
......
...@@ -117,7 +117,7 @@ int exynos_plane_init(struct drm_device *dev, unsigned int nr) ...@@ -117,7 +117,7 @@ int exynos_plane_init(struct drm_device *dev, unsigned int nr)
/* TODO: format */ /* TODO: format */
return drm_plane_init(dev, &exynos_plane->base, possible_crtcs, return drm_plane_init(dev, &exynos_plane->base, possible_crtcs,
&exynos_plane_funcs, NULL, 0); &exynos_plane_funcs, NULL, 0, false);
} }
int exynos_plane_set_zpos_ioctl(struct drm_device *dev, void *data, int exynos_plane_set_zpos_ioctl(struct drm_device *dev, void *data,
......
...@@ -659,7 +659,7 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe) ...@@ -659,7 +659,7 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe)
possible_crtcs = (1 << pipe); possible_crtcs = (1 << pipe);
ret = drm_plane_init(dev, &intel_plane->base, possible_crtcs, ret = drm_plane_init(dev, &intel_plane->base, possible_crtcs,
&intel_plane_funcs, snb_plane_formats, &intel_plane_funcs, snb_plane_formats,
ARRAY_SIZE(snb_plane_formats)); ARRAY_SIZE(snb_plane_formats), false);
if (ret) if (ret)
kfree(intel_plane); kfree(intel_plane);
......
...@@ -829,7 +829,8 @@ extern int drm_plane_init(struct drm_device *dev, ...@@ -829,7 +829,8 @@ extern int drm_plane_init(struct drm_device *dev,
struct drm_plane *plane, struct drm_plane *plane,
unsigned long possible_crtcs, unsigned long possible_crtcs,
const struct drm_plane_funcs *funcs, const struct drm_plane_funcs *funcs,
const uint32_t *formats, uint32_t format_count); const uint32_t *formats, uint32_t format_count,
bool priv);
extern void drm_plane_cleanup(struct drm_plane *plane); extern void drm_plane_cleanup(struct drm_plane *plane);
extern void drm_encoder_cleanup(struct drm_encoder *encoder); extern void drm_encoder_cleanup(struct drm_encoder *encoder);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment