From: Chris Wilson <chris@chris-wilson.co.uk>
To: Jesse Barnes <jbarnes@virtuousgeek.org>, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 1/2] drm: add plane support
Date: Tue, 08 Nov 2011 17:46:35 +0000 [thread overview]
Message-ID: <f80fcd$2ellrf@fmsmga001.fm.intel.com> (raw)
In-Reply-To: <1320773933-23158-1-git-send-email-jbarnes@virtuousgeek.org>
On Tue, 8 Nov 2011 09:38:52 -0800, Jesse Barnes <jbarnes@virtuousgeek.org> wrote:
> Planes are a bit like half-CRTCs. They have a location and fb, but
> don't drive outputs directly. Add support for handling them to the core
> KMS code.
>
> Acked-by: Alan Cox <alan@lxorguk.ukuu.org.uk>
> Reviewed-by: Rob Clark <rob.clark@linaro.org>
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
> ---
> drivers/gpu/drm/drm_crtc.c | 251 +++++++++++++++++++++++++++++++++++++++++++-
> drivers/gpu/drm/drm_drv.c | 3 +
> include/drm/drm.h | 3 +
> include/drm/drm_crtc.h | 75 +++++++++++++-
> include/drm/drm_mode.h | 33 ++++++
> 5 files changed, 362 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index fe738f0..fac8043 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -321,6 +321,7 @@ void drm_framebuffer_cleanup(struct drm_framebuffer *fb)
> {
> struct drm_device *dev = fb->dev;
> struct drm_crtc *crtc;
> + struct drm_plane *plane;
> struct drm_mode_set set;
> int ret;
>
> @@ -337,6 +338,15 @@ void drm_framebuffer_cleanup(struct drm_framebuffer *fb)
> }
> }
>
> + list_for_each_entry(plane, &dev->mode_config.plane_list, head) {
> + if (plane->fb == fb) {
> + /* should turn off the crtc */
> + ret = plane->funcs->disable_plane(plane);
> + if (ret)
> + DRM_ERROR("failed to disable plane with busy fb\n");
> + }
> + }
> +
> drm_mode_object_put(dev, &fb->base);
> list_del(&fb->head);
> dev->mode_config.num_fb--;
> @@ -535,6 +545,48 @@ void drm_encoder_cleanup(struct drm_encoder *encoder)
> }
> EXPORT_SYMBOL(drm_encoder_cleanup);
>
> +void 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)
> +{
> + mutex_lock(&dev->mode_config.mutex);
> +
> + plane->dev = dev;
> + drm_mode_object_get(dev, &plane->base, DRM_MODE_OBJECT_PLANE);
> + plane->funcs = funcs;
> + plane->format_types = kmalloc(sizeof(uint32_t) * format_count,
> + GFP_KERNEL);
> + if (!plane->format_types) {
> + DRM_DEBUG_KMS("out of memory when allocating plane\n");
> + drm_mode_object_put(dev, &plane->base);
> + return;
This can fail, report it back to the caller so that he can tear down his
allocations and propagate onwards. Kthxbye.
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
next prev parent reply other threads:[~2011-11-08 17:46 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-08 17:38 [PATCH 1/2] drm: add plane support Jesse Barnes
2011-11-08 17:38 ` [PATCH 2/2] drm: add an fb creation ioctl that takes a pixel format Jesse Barnes
2011-11-08 17:46 ` Chris Wilson [this message]
2011-11-08 17:50 ` [PATCH 1/2] drm: add plane support Chris Wilson
2011-11-08 21:17 ` Jesse Barnes
-- strict thread matches above, loose matches on Subject: below --
2011-11-08 21:18 Jesse Barnes
2011-11-08 21:26 ` Chris Wilson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='f80fcd$2ellrf@fmsmga001.fm.intel.com' \
--to=chris@chris-wilson.co.uk \
--cc=dri-devel@lists.freedesktop.org \
--cc=jbarnes@virtuousgeek.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox