On Tue, 8 Nov 2011 09:38:52 -0800, Jesse Barnes <jbarnes@xxxxxxxxxxxxxxxx> 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@xxxxxxxxxxxxxxxxxxx> > Reviewed-by: Rob Clark <rob.clark@xxxxxxxxxx> > Reviewed-by: Daniel Vetter <daniel.vetter@xxxxxxxx> > Signed-off-by: Jesse Barnes <jbarnes@xxxxxxxxxxxxxxxx> > --- > 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 _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/dri-devel