提交 38c8c22c 编写于 作者: D Daniel Vetter 提交者: Liviu Dudau

drm/hdlcd: Fix up crtc_state->event handling

event_list just reimplemented what drm_crtc_arm_vblank_event does. And
we also need to send out drm events when shutting down a pipe.

With this it's possible to use the new nonblocking commit support in
the helpers.
Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
Acked-by: NLiviu Dudau <Liviu.Dudau@arm.com>
上级 a95acec1
...@@ -189,19 +189,17 @@ static void hdlcd_crtc_atomic_begin(struct drm_crtc *crtc, ...@@ -189,19 +189,17 @@ static void hdlcd_crtc_atomic_begin(struct drm_crtc *crtc,
struct drm_crtc_state *state) struct drm_crtc_state *state)
{ {
struct hdlcd_drm_private *hdlcd = crtc_to_hdlcd_priv(crtc); struct hdlcd_drm_private *hdlcd = crtc_to_hdlcd_priv(crtc);
unsigned long flags; struct drm_pending_vblank_event *event = crtc->state->event;
if (crtc->state->event) {
struct drm_pending_vblank_event *event = crtc->state->event;
if (event) {
crtc->state->event = NULL; crtc->state->event = NULL;
event->pipe = drm_crtc_index(crtc);
WARN_ON(drm_crtc_vblank_get(crtc) != 0);
spin_lock_irqsave(&crtc->dev->event_lock, flags); spin_lock_irq(&crtc->dev->event_lock);
list_add_tail(&event->base.link, &hdlcd->event_list); if (drm_crtc_vblank_get(crtc) == 0)
spin_unlock_irqrestore(&crtc->dev->event_lock, flags); drm_crtc_arm_vblank_event(crtc, event);
else
drm_crtc_send_vblank_event(crtc, event);
spin_unlock_irq(&crtc->dev->event_lock);
} }
} }
......
...@@ -49,8 +49,6 @@ static int hdlcd_load(struct drm_device *drm, unsigned long flags) ...@@ -49,8 +49,6 @@ static int hdlcd_load(struct drm_device *drm, unsigned long flags)
atomic_set(&hdlcd->dma_end_count, 0); atomic_set(&hdlcd->dma_end_count, 0);
#endif #endif
INIT_LIST_HEAD(&hdlcd->event_list);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
hdlcd->mmio = devm_ioremap_resource(drm->dev, res); hdlcd->mmio = devm_ioremap_resource(drm->dev, res);
if (IS_ERR(hdlcd->mmio)) { if (IS_ERR(hdlcd->mmio)) {
...@@ -160,24 +158,9 @@ static irqreturn_t hdlcd_irq(int irq, void *arg) ...@@ -160,24 +158,9 @@ static irqreturn_t hdlcd_irq(int irq, void *arg)
atomic_inc(&hdlcd->vsync_count); atomic_inc(&hdlcd->vsync_count);
#endif #endif
if (irq_status & HDLCD_INTERRUPT_VSYNC) { if (irq_status & HDLCD_INTERRUPT_VSYNC)
bool events_sent = false;
unsigned long flags;
struct drm_pending_vblank_event *e, *t;
drm_crtc_handle_vblank(&hdlcd->crtc); drm_crtc_handle_vblank(&hdlcd->crtc);
spin_lock_irqsave(&drm->event_lock, flags);
list_for_each_entry_safe(e, t, &hdlcd->event_list, base.link) {
list_del(&e->base.link);
drm_crtc_send_vblank_event(&hdlcd->crtc, e);
events_sent = true;
}
if (events_sent)
drm_crtc_vblank_put(&hdlcd->crtc);
spin_unlock_irqrestore(&drm->event_lock, flags);
}
/* acknowledge interrupt(s) */ /* acknowledge interrupt(s) */
hdlcd_write(hdlcd, HDLCD_REG_INT_CLEAR, irq_status); hdlcd_write(hdlcd, HDLCD_REG_INT_CLEAR, irq_status);
......
...@@ -10,7 +10,6 @@ struct hdlcd_drm_private { ...@@ -10,7 +10,6 @@ struct hdlcd_drm_private {
struct clk *clk; struct clk *clk;
struct drm_fbdev_cma *fbdev; struct drm_fbdev_cma *fbdev;
struct drm_framebuffer *fb; struct drm_framebuffer *fb;
struct list_head event_list;
struct drm_crtc crtc; struct drm_crtc crtc;
struct drm_plane *plane; struct drm_plane *plane;
struct drm_atomic_state *state; struct drm_atomic_state *state;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册