drm: omapdrm: Drop manual framebuffer pin handling
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Thu, 5 Mar 2015 16:49:37 +0000 (18:49 +0200)
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Fri, 12 Jun 2015 19:52:48 +0000 (22:52 +0300)
Since the removal of omap_plane_mode_set(), framebuffers are now pinned
exclusively through the plane .prepare_fb() and .cleanup_fb() operations
as the remaining callers of omap_plane_setup() don't modify the
framebuffer. Remove the manual pin/unpin infrastructure.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
drivers/gpu/drm/omapdrm/omap_crtc.c
drivers/gpu/drm/omapdrm/omap_drv.h
drivers/gpu/drm/omapdrm/omap_plane.c

index a87ec26a883badac8f236493f26908d9bb69fa83..646563e4756212d832bb2b10e5988362da9a4ea2 100644 (file)
@@ -52,9 +52,6 @@ struct omap_crtc {
        struct omap_drm_irq vblank_irq;
        struct omap_drm_irq error_irq;
 
-       /* list of framebuffers to unpin */
-       struct list_head pending_unpins;
-
        /* pending event */
        struct drm_pending_vblank_event *event;
        wait_queue_head_t flip_wait;
@@ -64,11 +61,6 @@ struct omap_crtc {
        bool ignore_digit_sync_lost;
 };
 
-struct omap_framebuffer_unpin {
-       struct list_head list;
-       struct drm_framebuffer *fb;
-};
-
 /* -----------------------------------------------------------------------------
  * Helper Functions
  */
@@ -365,7 +357,6 @@ static void omap_crtc_vblank_irq(struct omap_drm_irq *irq, uint32_t irqstatus)
 int omap_crtc_flush(struct drm_crtc *crtc)
 {
        struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
-       struct omap_framebuffer_unpin *fb, *next;
 
        DBG("%s: GO", omap_crtc->name);
 
@@ -385,29 +376,6 @@ int omap_crtc_flush(struct drm_crtc *crtc)
 
        dispc_runtime_put();
 
-       /* Unpin and unreference pending framebuffers. */
-       list_for_each_entry_safe(fb, next, &omap_crtc->pending_unpins, list) {
-               omap_framebuffer_unpin(fb->fb);
-               drm_framebuffer_unreference(fb->fb);
-               list_del(&fb->list);
-               kfree(fb);
-       }
-
-       return 0;
-}
-
-int omap_crtc_queue_unpin(struct drm_crtc *crtc, struct drm_framebuffer *fb)
-{
-       struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
-       struct omap_framebuffer_unpin *unpin;
-
-       unpin = kzalloc(sizeof(*unpin), GFP_KERNEL);
-       if (!unpin)
-               return -ENOMEM;
-
-       unpin->fb = fb;
-       list_add_tail(&unpin->list, &omap_crtc->pending_unpins);
-
        return 0;
 }
 
@@ -643,9 +611,6 @@ struct drm_crtc *omap_crtc_init(struct drm_device *dev,
        crtc = &omap_crtc->base;
 
        init_waitqueue_head(&omap_crtc->flip_wait);
-
-       INIT_LIST_HEAD(&omap_crtc->pending_unpins);
-
        init_completion(&omap_crtc->completion);
 
        omap_crtc->channel = channel;
index 0231f81dfb9be360cfde81204663344ca37097df..580fe10184d72becea35f13dc92c91d837e37060 100644 (file)
@@ -143,7 +143,6 @@ void omap_fbdev_free(struct drm_device *dev);
 const struct omap_video_timings *omap_crtc_timings(struct drm_crtc *crtc);
 enum omap_channel omap_crtc_channel(struct drm_crtc *crtc);
 int omap_crtc_flush(struct drm_crtc *crtc);
-int omap_crtc_queue_unpin(struct drm_crtc *crtc, struct drm_framebuffer *fb);
 void omap_crtc_cancel_page_flip(struct drm_crtc *crtc, struct drm_file *file);
 void omap_crtc_pre_init(void);
 void omap_crtc_pre_uninit(void);
index 117fa37534b68ab8eafe4bc055366dcf59cc05da..7813e48b6896d0863e9b436dce1fd7f907f57140 100644 (file)
@@ -45,49 +45,12 @@ struct omap_plane {
        struct omap_drm_window win;
        bool enabled;
 
-       /* last fb that we pinned: */
-       struct drm_framebuffer *pinned_fb;
-
        uint32_t nformats;
        uint32_t formats[32];
 
        struct omap_drm_irq error_irq;
 };
 
-/* update which fb (if any) is pinned for scanout */
-static int omap_plane_update_pin(struct drm_plane *plane)
-{
-       struct omap_plane *omap_plane = to_omap_plane(plane);
-       struct drm_framebuffer *pinned_fb = omap_plane->pinned_fb;
-       struct drm_framebuffer *fb = omap_plane->enabled ? plane->fb : NULL;
-       int ret = 0;
-
-       if (pinned_fb == fb)
-               return 0;
-
-       DBG("%p -> %p", pinned_fb, fb);
-
-       if (fb) {
-               drm_framebuffer_reference(fb);
-               ret = omap_framebuffer_pin(fb);
-       }
-
-       if (pinned_fb)
-               omap_crtc_queue_unpin(plane->crtc, pinned_fb);
-
-       if (ret) {
-               dev_err(plane->dev->dev, "could not swap %p -> %p\n",
-                               omap_plane->pinned_fb, fb);
-               drm_framebuffer_unreference(fb);
-               omap_plane->pinned_fb = NULL;
-               return ret;
-       }
-
-       omap_plane->pinned_fb = fb;
-
-       return 0;
-}
-
 static int __omap_plane_setup(struct omap_plane *omap_plane,
                              struct drm_crtc *crtc,
                              struct drm_framebuffer *fb)
@@ -133,10 +96,6 @@ static int omap_plane_setup(struct omap_plane *omap_plane)
        struct drm_plane *plane = &omap_plane->base;
        int ret;
 
-       ret = omap_plane_update_pin(plane);
-       if (ret < 0)
-               return ret;
-
        dispc_runtime_get();
        ret = __omap_plane_setup(omap_plane, plane->crtc, plane->fb);
        dispc_runtime_put();