drm: disconnect plane from fb/crtc when disabled
Subsystems (2)
PATCH 1/2 drm: disconnect plane from fb/crtc when disabled
From: Rob Clark <[email protected]>
Since plane->fb and plane->crtc are set in drm_mode_setplane() after update_plane(), They should be cleared after disable().
--- drivers/gpu/drm/drm_crtc.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/gpu/drm/drm_crtc.c +3 -0
@@ -348,6 +348,9 @@ void drm_framebuffer_cleanup(struct drm_framebuffer *fb) ret = plane->funcs->disable_plane (plane);if (ret)DRM_ERROR ("failed to disable plane with busy fb\n" ); +/* disconnect the plane from the fb and crtc: */ + plane->fb =NULL ; + plane->crtc =NULL ; } }
Signature · 1 line
1.7.5.4
PATCH 2/2 drm: add support for private planes
From: Rob Clark <[email protected]>
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.
--- drivers/gpu/drm/drm_crtc.c | 22 +++++++++++++++++----- include/drm/drm_crtc.h | 3 ++- 2 files changed, 19 insertions(+), 6 deletions(-)
drivers/gpu/drm/drm_crtc.c +17 -5
@@ -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);
@@ -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);
@@ -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);
include/drm/drm_crtc.h +2 -1
@@ -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);
Signature · 1 line
1.7.5.4
Re: [PATCH 2/2] drm: add support for private planes
note: looks like I need to rebase this patch after exynos drm driver was pulled to drm-next.. if there are some other consumers that are waiting to be pulled, let me know and I'll just rebase on top of that.
(Either way, it would be a trivial merge conflict.. just add FALSE as
additional arg to drm_plane_init())
BR,
-R
Quoted 78 lines · Rob Clark
From: Rob Clark <[email protected]>
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_planehelper objects used by thedrm_crtcimplementation, rather than duplicate code between the plane and crtc. A private plane is not exposed to userspace.Signed-off-by Rob Clark <[email protected]>---
drivers/gpu/drm/drm_crtc.c | 22 +++++++++++++++++-----include/drm/drm_crtc.h| 3 ++-2 files changed, 19 insertions(+), 6 deletions(-)drivers/gpu/drm/drm_crtc.c +17
-5@@ -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);@@ -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);@@ -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);include/drm/drm_crtc.h +2
-2@@ -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); --1.7.5.4
Re: [PATCH 2/2] drm: add support for private planes
Ok no problem. I think Keith just queued up the i915 bits, but I don't think they've made their way to Dave yet.
Jesse
Quoted 84 lines · On Wed, 4 Jan 2012 22:55:31 -0600 Rob Clark <[email protected]> wrote:
note: looks like I need to rebase this patch after exynos drm driver was pulled to drm-next.. if there are some other consumers that are waiting to be pulled, let me know and I'll just rebase on top of that.
(Either way, it would be a trivial merge conflict.. just add FALSE as
additional arg todrm_plane_init())BR,
-RQuoted 74 lines · Rob Clark
From: Rob Clark <[email protected]>
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_planehelper objects used by thedrm_crtcimplementation, rather than duplicate code between the plane and crtc. A private plane is not exposed to userspace.Signed-off-by Rob Clark <[email protected]>---
drivers/gpu/drm/drm_crtc.c | 22 +++++++++++++++++-----include/drm/drm_crtc.h| 3 ++-2 files changed, 19 insertions(+), 6 deletions(-)drivers/gpu/drm/drm_crtc.c +17
-5@@ -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);@@ -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);@@ -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);include/drm/drm_crtc.h +2
-1@@ -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);
Quoted 5 lines
Quoted 4 lines
include/drm/drm_crtc.h +0
-1extern void drm_encoder_cleanup(struct drm_encoder *encoder); --1.7.5.4
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel