summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Clark <rob@ti.com>2011-12-13 20:19:36 -0600
committerDave Airlie <airlied@redhat.com>2012-01-05 10:00:16 +0000
commit0a7eb243db7864640134f8c57e6856f8eb3ed7c6 (patch)
tree93580b87b27d341801f9724d0daba75e933d9412
parenta9971157b6c550644fe19551c21f4b05f7e9475a (diff)
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: Rob Clark <rob@ti.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r--drivers/gpu/drm/drm_crtc.c22
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_plane.c2
-rw-r--r--drivers/gpu/drm/i915/intel_sprite.c2
-rw-r--r--include/drm/drm_crtc.h3
4 files changed, 21 insertions, 8 deletions
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 7710bcb4bd8d..5e818a808ace 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -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,
- const uint32_t *formats, uint32_t format_count)
+ const uint32_t *formats, uint32_t format_count,
+ bool priv)
{
mutex_lock(&dev->mode_config.mutex);
@@ -577,8 +578,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);
@@ -593,8 +602,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);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c b/drivers/gpu/drm/exynos/exynos_drm_plane.c
index c785e34ccff9..bdcf770aa22e 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_plane.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c
@@ -117,7 +117,7 @@ int exynos_plane_init(struct drm_device *dev, unsigned int nr)
/* TODO: format */
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,
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index b26e7c46a752..d13989fda501 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -659,7 +659,7 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe)
possible_crtcs = (1 << pipe);
ret = drm_plane_init(dev, &intel_plane->base, possible_crtcs,
&intel_plane_funcs, snb_plane_formats,
- ARRAY_SIZE(snb_plane_formats));
+ ARRAY_SIZE(snb_plane_formats), false);
if (ret)
kfree(intel_plane);
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 2deb6f99f950..63e4fce67288 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -829,7 +829,8 @@ extern int drm_plane_init(struct drm_device *dev,
struct drm_plane *plane,
unsigned long possible_crtcs,
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_encoder_cleanup(struct drm_encoder *encoder);