drm/gma500: Sanity-check pipe index
Subsystems (8)
PATCH 1/13 drm/gma500: Sanity-check pipe index
From: Thierry Reding <[email protected]>
If the DSI output isn't connected, then mdfld_dsi_encoder_get_pipe() will return -1. The mdfld_dsi_dp_mode_set() function doesn't properly check for this condition and causes the following compiler warnings:
CC drivers/gpu/drm/gma500/mdfld_dsi_dpi.o drivers/gpu/drm/gma500/mdfld_dsi_dpi.c: In function ‘mdfld_dsi_dpi_mode_set’: drivers/gpu/drm/gma500/mdfld_dsi_dpi.c:828:35: warning: array subscript is below array bounds [-Warray-bounds] u32 pipeconf = dev_priv->pipeconf[pipe]; ^ drivers/gpu/drm/gma500/mdfld_dsi_dpi.c:829:33: warning: array subscript is below array bounds [-Warray-bounds] u32 dspcntr = dev_priv->dspcntr[pipe]; ^
Fix this by checking for a valid pipe before indexing the pipeconf and dspcntr arrays.
--- drivers/gpu/drm/gma500/mdfld_dsi_dpi.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/gpu/drm/gma500/mdfld_dsi_dpi.c +7 -3
@@ -821,14 +821,18 @@ void mdfld_dsi_dpi_mode_set(struct drm_encoder *encoder,struct drm_device *dev = dsi_config->dev;struct drm_psb_private *dev_priv = dev->dev_private;int pipe =mdfld_dsi_encoder_get_pipe (dsi_encoder); -u32 pipeconf_reg =PIPEACONF ;u32 dspcntr_reg =DSPACNTR ; +u32 pipeconf, dspcntr; -u32 pipeconf = dev_priv->pipeconf[pipe]; -u32 dspcntr = dev_priv->dspcntr[pipe];u32 mipi =MIPI_PORT_EN |PASS_FROM_SPHY_TO_AFE |SEL_FLOPPED_HSTX ; +if (WARN_ON (pipe <0 )) +return ; + + pipeconf = dev_priv->pipeconf[pipe]; + dspcntr = dev_priv->dspcntr[pipe]; +if (pipe) { pipeconf_reg =PIPECCONF ; dspcntr_reg =DSPCCNTR ;
Signature · 6 lines
2.4.5 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 2/13 drm/irq: Remove negative CRTC index special-case
From: Thierry Reding <[email protected]>
The drm_send_vblank_event() function treats negative CRTC indices as meaning that a driver doesn't have proper VBLANK handling. This is the only place where DRM needs negative CRTC indices, so in order to enable subsequent cleanup, remove this special case and replace it by the more obvious check for whether or not VBLANK support was initialized.
--- drivers/gpu/drm/drm_irq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_irq.c +1 -1
@@ -971,7 +971,7 @@ void drm_send_vblank_event(struct drm_device *dev, int crtc,struct timeval now;unsigned int seq; -if (crtc >=0 ) { +if (dev->num_crtcs >0 ) { seq =drm_vblank_count_and_time (dev, crtc, &now); }else { seq =0 ;
Signature · 6 lines
2.4.5 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Daniel Vetter
AppliedRe: [PATCH 02/13] drm/irq: Remove negative CRTC index special-case
Quoted 9 lines · Thierry Reding
From: Thierry Reding <[email protected]>
The
drm_send_vblank_event()function treats negative CRTC indices as meaning that a driver doesn't have proper VBLANK handling. This is the only place where DRM needs negative CRTC indices, so in order to enable subsequent cleanup, remove this special case and replace it by the more obvious check for whether or not VBLANK support was initialized.Signed-off-by Thierry Reding <[email protected]>
Applied to drm-misc, thansk.
-Daniel
Quoted 20 lines
--- drivers/gpu/drm/drm_irq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/drm_irq.c +1
-1@@ -971,7 +971,7 @@ void drm_send_vblank_event(struct drm_device *dev, int crtc,struct timeval now;unsigned int seq; -if (crtc >=0 ) { +if (dev->num_crtcs >0 ) { seq =drm_vblank_count_and_time (dev, crtc, &now); }else { seq =0 ;Signature · 1 line
2.4.5
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 3/13 drm/bochs: Store correct CRTC index in events
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
Previously a negative pipe caused a special case to be triggered for drivers that didn't have proper VBLANK support. The trigger for this special case is now independent of the pipe, so the correct CRTC index can now be stored in events.
--- drivers/gpu/drm/bochs/bochs_kms.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/bochs/bochs_kms.c +2 -1
@@ -113,13 +113,14 @@ static int bochs_crtc_page_flip(struct drm_crtc *crtc,struct bochs_device *bochs = container_of(crtc, struct bochs_device, crtc);struct drm_framebuffer *old_fb = crtc->primary->fb; +unsigned int pipe =drm_crtc_index (crtc);unsigned long irqflags; crtc->primary->fb = fb;bochs_crtc_mode_set_base (crtc,0 ,0 , old_fb);if (event) {spin_lock_irqsave (&bochs->dev->event_lock, irqflags); -drm_send_vblank_event (bochs->dev,-1 , event); +drm_send_vblank_event (bochs->dev, pipe, event);spin_unlock_irqrestore (&bochs->dev->event_lock, irqflags); }return 0 ;
Signature · 6 lines
2.4.5 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 03/13] drm/bochs: Store correct CRTC index in events
Quoted 20 lines · Thierry Reding
From: Thierry Reding <[email protected]>
Previously a negative pipe caused a special case to be triggered for drivers that didn't have proper VBLANK support. The trigger for this special case is now independent of the pipe, so the correct CRTC index can now be stored in events.
Cc Gerd Hoffmann <[email protected]>Signed-off-by Thierry Reding <[email protected]>--- drivers/gpu/drm/bochs/bochs_kms.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/bochs/bochs_kms.c +0
-0@@ -113,13 +113,14 @@ static int bochs_crtc_page_flip(struct drm_crtc *crtc,struct bochs_device *bochs = container_of(crtc, struct bochs_device, crtc);
drivers/gpu/drm/bochs/bochs_kms.c static int bochs_crtc_page_flip(struct drm_crtc *crtc, · line 123
Quoted 10 lines
drivers/gpu/drm/bochs/bochs_kms.c +2
-1struct drm_framebuffer *old_fb = crtc->primary->fb; +unsigned int pipe =drm_crtc_index (crtc);unsigned long irqflags; crtc->primary->fb = fb;bochs_crtc_mode_set_base (crtc,0 ,0 , old_fb);if (event) {spin_lock_irqsave (&bochs->dev->event_lock, irqflags); -drm_send_vblank_event (bochs->dev,-1 , event); +drm_send_vblank_event (bochs->dev, pipe, event);
I'd vote for a
void drm_crtc_send_vblank_event(struct drm_crtc *crtc,
struct drm_event *event)
{
drm_send_vblank_event(crtc->dev, drm_crtc_index(crtc), event);
}instead and then rolling that out over all drivers. I really like the underlying idea though, it's always good to standardize more what drivers are doing around kms semantics.
-Daniel
Quoted 6 lines
drivers/gpu/drm/bochs/bochs_kms.c +0
-0spin_unlock_irqrestore (&bochs->dev->event_lock, irqflags); }return 0 ;Signature · 1 line
2.4.5
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 4/13 drm/imx: Make pipe number unsigned
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
There's no reason whatsoever why this should ever be negative.
--- drivers/gpu/drm/imx/imx-drm-core.c | 4 ++-- drivers/gpu/drm/imx/imx-drm.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/imx/imx-drm-core.c +2 -2
@@ -45,14 +45,14 @@ struct imx_drm_device {struct imx_drm_crtc {struct drm_crtc *crtc; -int pipe; +unsigned int pipe;struct imx_drm_crtc_helper_funcs imx_drm_helper_funcs; };static int legacyfb_depth =16 ;module_param (legacyfb_depth, int,0444 ); -int imx_drm_crtc_id (struct imx_drm_crtc *crtc) +unsigned int imx_drm_crtc_id (struct imx_drm_crtc *crtc) {return crtc->pipe; }
drivers/gpu/drm/imx/imx-drm.h +1 -1
@@ -12,7 +12,7 @@ struct drm_framebuffer;struct imx_drm_crtc ;struct platform_device ; -int imx_drm_crtc_id (struct imx_drm_crtc *crtc); +unsigned int imx_drm_crtc_id (struct imx_drm_crtc *crtc);struct imx_drm_crtc_helper_funcs {int (*enable_vblank)(struct drm_crtc *crtc);
Signature · 6 lines
2.4.5 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 04/13] drm/imx: Make pipe number unsigned
Quoted 7 lines · Thierry Reding
From: Thierry Reding <[email protected]>
There's no reason whatsoever why this should ever be negative.
Cc Philipp Zabel <[email protected]>Acked-by Philipp Zabel <[email protected]>Signed-off-by Thierry Reding <[email protected]>
Just kill it and replace with drm_crtc_index. Using that for vblank events instead of some driver-specific thing is kinda abi.
-Daniel
Quoted 42 lines
--- drivers/gpu/drm/imx/imx-drm-core.c | 4 ++-- drivers/gpu/drm/imx/imx-drm.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)drivers/gpu/drm/imx/imx-drm-core.c +2
-2@@ -45,14 +45,14 @@ struct imx_drm_device {struct imx_drm_crtc {struct drm_crtc *crtc; -int pipe; +unsigned int pipe;struct imx_drm_crtc_helper_funcs imx_drm_helper_funcs; };static int legacyfb_depth =16 ;module_param (legacyfb_depth, int,0444 ); -int imx_drm_crtc_id (struct imx_drm_crtc *crtc) +unsigned int imx_drm_crtc_id (struct imx_drm_crtc *crtc) {return crtc->pipe; }drivers/gpu/drm/imx/imx-drm.h +1
-1@@ -12,7 +12,7 @@ struct drm_framebuffer;struct imx_drm_crtc ;struct platform_device ; -int imx_drm_crtc_id (struct imx_drm_crtc *crtc); +unsigned int imx_drm_crtc_id (struct imx_drm_crtc *crtc);struct imx_drm_crtc_helper_funcs {int (*enable_vblank)(struct drm_crtc *crtc);Signature · 1 line
2.4.5
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 04/13] drm/imx: Make pipe number unsigned
Quoted 11 lines · Daniel Vetter
Quoted 7 lines · Thierry Reding
From: Thierry Reding <[email protected]>
There's no reason whatsoever why this should ever be negative.
Cc Philipp Zabel <[email protected]>Acked-by Philipp Zabel <[email protected]>Signed-off-by Thierry Reding <[email protected]>Just kill it and replace with
drm_crtc_index. Using that for vblank events instead of some driver-specific thing is kinda abi.
Would you mind if I did that as a follow-up? That way the changes per patch stay more concise.
Thierry
Quoted 34 lines
Quoted 34 lines
--- drivers/gpu/drm/imx/imx-drm-core.c | 4 ++-- drivers/gpu/drm/imx/imx-drm.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)drivers/gpu/drm/imx/imx-drm-core.c +2
-2@@ -45,14 +45,14 @@ struct imx_drm_device {struct imx_drm_crtc {struct drm_crtc *crtc; -int pipe; +unsigned int pipe;struct imx_drm_crtc_helper_funcs imx_drm_helper_funcs; };static int legacyfb_depth =16 ;module_param (legacyfb_depth, int,0444 ); -int imx_drm_crtc_id (struct imx_drm_crtc *crtc) +unsigned int imx_drm_crtc_id (struct imx_drm_crtc *crtc) {return crtc->pipe; }drivers/gpu/drm/imx/imx-drm.h +0
-0@@ -12,7 +12,7 @@ struct drm_framebuffer;struct imx_drm_crtc ;struct platform_device ;
Quoted 13 lines
Quoted 8 lines
drivers/gpu/drm/imx/imx-drm.h +1
-1-int imx_drm_crtc_id (struct imx_drm_crtc *crtc); +unsigned int imx_drm_crtc_id (struct imx_drm_crtc *crtc);struct imx_drm_crtc_helper_funcs {int (*enable_vblank)(struct drm_crtc *crtc);Signature · 1 line
2.4.5Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 5/13 drm/imx: Store correct CRTC index in events
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
A negative pipe causes a special case to be triggered for drivers that don't have proper VBLANK support. i.MX does support VBLANKs, so there is no need for the fallback code.
--- drivers/gpu/drm/imx/ipuv3-crtc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/imx/ipuv3-crtc.c +2 -1
@@ -212,7 +212,8 @@ static void ipu_crtc_handle_pageflip(struct ipu_crtc *ipu_crtc)spin_lock_irqsave (&drm->event_lock, flags);if (ipu_crtc->page_flip_event) -drm_send_vblank_event (drm,-1 , ipu_crtc->page_flip_event); +drm_send_vblank_event (drm,imx_drm_crtc_id (ipu_crtc->imx_crtc), + ipu_crtc->page_flip_event); ipu_crtc->page_flip_event =NULL ;imx_drm_crtc_vblank_put (ipu_crtc->imx_crtc);spin_unlock_irqrestore (&drm->event_lock, flags);
Signature · 6 lines
2.4.5 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 6/13 drm/rockchip: Store correct CRTC index in events
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
A negative pipe causes a special case to be triggered for drivers that don't have proper VBLANK support. Rockchip does support VBLANKs, so there is no need for the fallback code.
--- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +1 -1
@@ -1038,7 +1038,7 @@ static void vop_win_state_complete(struct vop_win *vop_win,if (state->event) {spin_lock_irqsave (&drm->event_lock, flags); -drm_send_vblank_event (drm,-1 , state->event); +drm_send_vblank_event (drm, vop->pipe, state->event);spin_unlock_irqrestore (&drm->event_lock, flags); }
Signature · 6 lines
2.4.5 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 7/13 drm/sti: Store correct CRTC index in events
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
A negative pipe causes a special case to be triggered for drivers that don't have proper VBLANK support. STi does support VBLANKs, so there is no need for the fallback code.
--- drivers/gpu/drm/sti/sti_drm_crtc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/sti/sti_drm_crtc.c +1 -1
@@ -234,7 +234,7 @@ int sti_drm_crtc_vblank_cb(struct notifier_block *nb,spin_lock_irqsave (&drm_dev->event_lock, flags);if (compo->mixer[*crtc]->pending_event) { -drm_send_vblank_event (drm_dev,-1 , +drm_send_vblank_event (drm_dev, *crtc, compo->mixer[*crtc]->pending_event);drm_vblank_put (drm_dev, *crtc); compo->mixer[*crtc]->pending_event =NULL ;
Signature · 6 lines
2.4.5 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 07/13] drm/sti: Store correct CRTC index in events
The fix look good however it enter in conflict with the large rework we have done to support atomic.
The pull request for this has been send.
Would it be ok for you if we include your patch in the your next series of patches ?
Benjamin
2015-08-12 17:00 GMT+02:00 Thierry Reding <[email protected]>:
Quoted 28 lines
From: Thierry Reding <[email protected]>
A negative pipe causes a special case to be triggered for drivers that don't have proper VBLANK support. STi does support VBLANKs, so there is no need for the fallback code.
Cc Benjamin Gaignard <[email protected]>Signed-off-by Thierry Reding <[email protected]>--- drivers/gpu/drm/sti/sti_drm_crtc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/sti/sti_drm_crtc.c +1
-2@@ -234,7 +234,7 @@ int sti_drm_crtc_vblank_cb(struct notifier_block *nb,spin_lock_irqsave (&drm_dev->event_lock, flags);if (compo->mixer[*crtc]->pending_event) { -drm_send_vblank_event (drm_dev,-1 , +drm_send_vblank_event (drm_dev, *crtc, compo->mixer[*crtc]->pending_event);drm_vblank_put (drm_dev, *crtc); compo->mixer[*crtc]->pending_event =NULL ; --2.4.5
Signature · 11 lines
Benjamin Gaignard Graphic Working Group Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 07/13] drm/sti: Store correct CRTC index in events
Quoted 5 lines · Benjamin Gaignard
The fix look good however it enter in conflict with the large rework we have done to support atomic.
The pull request for this has been send.
Would it be ok for you if we include your patch in the your next series of patches ?
Sure, I can keep carrying this and rebase on your changes when they've landed.
Thierry
Quoted 19 lines
2015-08-12 17:00 GMT+02:00 Thierry Reding <[email protected]>:
Quoted 18 lines
From: Thierry Reding <[email protected]>
A negative pipe causes a special case to be triggered for drivers that don't have proper VBLANK support. STi does support VBLANKs, so there is no need for the fallback code.
Cc Benjamin Gaignard <[email protected]>Signed-off-by Thierry Reding <[email protected]>--- drivers/gpu/drm/sti/sti_drm_crtc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/sti/sti_drm_crtc.c +0
-0@@ -234,7 +234,7 @@ int sti_drm_crtc_vblank_cb(struct notifier_block *nb,
Quoted 21 lines
Quoted 10 lines
drivers/gpu/drm/sti/sti_drm_crtc.c +1
-2spin_lock_irqsave (&drm_dev->event_lock, flags);if (compo->mixer[*crtc]->pending_event) { -drm_send_vblank_event (drm_dev,-1 , +drm_send_vblank_event (drm_dev, *crtc, compo->mixer[*crtc]->pending_event);drm_vblank_put (drm_dev, *crtc); compo->mixer[*crtc]->pending_event =NULL ; --2.4.5
Signature · 7 lines
Benjamin Gaignard Graphic Working Group Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 8/13 drm/irq: Check for valid VBLANK before dereference
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
When accessing the array of per-CRTC VBLANK structures we must always check that the index into the array is valid before dereferencing to avoid crashing.
--- drivers/gpu/drm/drm_irq.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_irq.c +8 -2
@@ -1110,10 +1110,10 @@ void drm_vblank_put(struct drm_device *dev, int crtc) {struct drm_vblank_crtc *vblank = &dev->vblank[crtc]; -if (WARN_ON (atomic_read (&vblank->refcount) ==0 )) +if (WARN_ON (crtc >= dev->num_crtcs))return ; -if (WARN_ON (crtc >= dev->num_crtcs)) +if (WARN_ON (atomic_read (&vblank->refcount) ==0 ))return ;/* Last user schedules interrupt disable */
@@ -1158,6 +1158,9 @@ void drm_wait_one_vblank(struct drm_device *dev, int crtc)int ret;u32 last; +if (WARN_ON (crtc >= dev->num_crtcs)) +return ; + ret =drm_vblank_get (dev, crtc);if (WARN (ret,"vblank not available on crtc %i, ret=%i\n" , crtc, ret))return ;
@@ -1428,6 +1431,9 @@ void drm_vblank_post_modeset(struct drm_device *dev, int crtc)if (!dev->num_crtcs)return ; +if (WARN_ON (crtc >= dev->num_crtcs)) +return ; +if (vblank->inmodeset) {spin_lock_irqsave (&dev->vbl_lock, irqflags); dev->vblank_disable_allowed = true;
Signature · 6 lines
2.4.5 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 08/13] drm/irq: Check for valid VBLANK before dereference
Quoted 7 lines · Thierry Reding
From: Thierry Reding <[email protected]>
When accessing the array of per-CRTC VBLANK structures we must always check that the index into the array is valid before dereferencing to avoid crashing.
Signed-off-by Thierry Reding <[email protected]>
This misses vblank_reset (I guess that function is newer than your patches). Can you please do a follow-up? I merged this one meanwhile.
I also squashed in a whitespace fixup in vblank_count I spotted while reviewing this one here.
-Daniel
Quoted 44 lines
--- drivers/gpu/drm/drm_irq.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)drivers/gpu/drm/drm_irq.c +8
-2@@ -1110,10 +1110,10 @@ void drm_vblank_put(struct drm_device *dev, int crtc) {struct drm_vblank_crtc *vblank = &dev->vblank[crtc]; -if (WARN_ON (atomic_read (&vblank->refcount) ==0 )) +if (WARN_ON (crtc >= dev->num_crtcs))return ; -if (WARN_ON (crtc >= dev->num_crtcs)) +if (WARN_ON (atomic_read (&vblank->refcount) ==0 ))return ;/* Last user schedules interrupt disable */ @@ -1158,6 +1158,9 @@ void drm_wait_one_vblank(struct drm_device *dev, int crtc)int ret;u32 last; +if (WARN_ON (crtc >= dev->num_crtcs)) +return ; + ret =drm_vblank_get (dev, crtc);if (WARN (ret,"vblank not available on crtc %i, ret=%i\n" , crtc, ret))return ;@@ -1428,6 +1431,9 @@ void drm_vblank_post_modeset(struct drm_device *dev, int crtc)if (!dev->num_crtcs)return ; +if (WARN_ON (crtc >= dev->num_crtcs)) +return ; +if (vblank->inmodeset) {spin_lock_irqsave (&dev->vbl_lock, irqflags); dev->vblank_disable_allowed = true;Signature · 1 line
2.4.5
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 08/13] drm/irq: Check for valid VBLANK before dereference
Quoted 11 lines · Daniel Vetter
Quoted 7 lines · Thierry Reding
From: Thierry Reding <[email protected]>
When accessing the array of per-CRTC VBLANK structures we must always check that the index into the array is valid before dereferencing to avoid crashing.
Signed-off-by Thierry Reding <[email protected]>This misses
vblank_reset(I guess that function is newer than your patches). Can you please do a follow-up? I merged this one meanwhile.
We only have drm_crtc_vblank_reset(), in which case there's no need to check the index because it's obtained directly from a struct drm_crtc * and hence will be valid.
Thierry
Quoted 35 lines
Quoted 35 lines
--- drivers/gpu/drm/drm_irq.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)drivers/gpu/drm/drm_irq.c +5
-2@@ -1110,10 +1110,10 @@ void drm_vblank_put(struct drm_device *dev, int crtc) {struct drm_vblank_crtc *vblank = &dev->vblank[crtc]; -if (WARN_ON (atomic_read (&vblank->refcount) ==0 )) +if (WARN_ON (crtc >= dev->num_crtcs))return ; -if (WARN_ON (crtc >= dev->num_crtcs)) +if (WARN_ON (atomic_read (&vblank->refcount) ==0 ))return ;/* Last user schedules interrupt disable */ @@ -1158,6 +1158,9 @@ void drm_wait_one_vblank(struct drm_device *dev, int crtc)int ret;u32 last; +if (WARN_ON (crtc >= dev->num_crtcs)) +return ; + ret =drm_vblank_get (dev, crtc);if (WARN (ret,"vblank not available on crtc %i, ret=%i\n" , crtc, ret))return ;@@ -1428,6 +1431,9 @@ void drm_vblank_post_modeset(struct drm_device *dev, int crtc)if (!dev->num_crtcs)return ;
Quoted 14 lines
Quoted 9 lines
drivers/gpu/drm/drm_irq.c +3
-0+if (WARN_ON (crtc >= dev->num_crtcs)) +return ; +if (vblank->inmodeset) {spin_lock_irqsave (&dev->vbl_lock, irqflags); dev->vblank_disable_allowed = true;Signature · 1 line
2.4.5Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 08/13] drm/irq: Check for valid VBLANK before dereference
Quoted 8 lines · Thierry Reding
Quoted 7 lines · Daniel Vetter
Quoted 6 lines · Thierry Reding
From: Thierry Reding <[email protected]>
When accessing the array of per-CRTC VBLANK structures we must always check that the index into the array is valid before dereferencing to avoid crashing.
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Signed-off-by Thierry Reding <[email protected]>This misses
vblank_reset(I guess that function is newer than your patches). Can you please do a follow-up? I merged this one meanwhile.We only have
drm_crtc_vblank_reset(), in which case there's no need to check the index because it's obtained directly from a structdrm_crtc* and hence will be valid.
Right, I overlooked that.
-Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 9/13 drm/irq: Make pipe unsigned and name consistent
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
Name all references to the pipe number (CRTC index) consistently to make it easier to distinguish which is a pipe number and which is a pointer to struct drm_crtc.
While at it also make all references to the pipe number unsigned because there is no longer any reason why it should ever be negative.
--- drivers/gpu/drm/drm_irq.c | 316 +++++++++++++++++++++++----------------------- include/drm/drmP.h | 32 ++--- 2 files changed, 175 insertions(+), 173 deletions(-)
drivers/gpu/drm/drm_irq.c +159 -157
@@ -43,8 +43,8 @@#include <linux/export.h> /* Access macro for slots in vblank timestamp ringbuffer. */ -#define vblanktimestamp (dev, crtc, count) \ - ((dev)->vblank[crtc].time[(count) % DRM_VBLANKTIME_RBSIZE]) +#define vblanktimestamp (dev, pipe, count) \ + ((dev)->vblank[pipe].time[(count) % DRM_VBLANKTIME_RBSIZE])/* Retry timestamp calculation up to 3 times to satisfy * drm_timestamp_precision before giving up.
@@ -57,7 +57,7 @@#define DRM_REDUNDANT_VBLIRQ_THRESH_NS 1000000static bool -drm_get_last_vbltimestamp (struct drm_device *dev,int crtc, +drm_get_last_vbltimestamp (struct drm_device *dev,unsigned int pipe,struct timeval *tvblank,unsigned flags);static unsigned int drm_timestamp_precision =20 ;/* Default to 20 usecs. */
@@ -107,7 +107,7 @@ static void store_vblank(struct drm_device *dev, int crtc,/** * drm_update_vblank_count - update the master vblank counter * @dev: DRM device -* @crtc: counter to update +* @pipe: counter to update * * Call back into the driver to update the appropriate vblank counter * (specified by @crtc). Deal with wraparound, if it occurred, and
@@ -120,9 +120,9 @@ static void store_vblank(struct drm_device *dev, int crtc,* Note: caller must hold dev->vbl_lock since this reads & writes * device vblank fields. */ -static void drm_update_vblank_count (struct drm_device *dev,int crtc) +static void drm_update_vblank_count (struct drm_device *dev,unsigned int pipe) { -struct drm_vblank_crtc *vblank = &dev->vblank[crtc]; +struct drm_vblank_crtc *vblank = &dev->vblank[pipe];u32 cur_vblank, diff;bool rc;struct timeval t_vblank;
@@ -140,21 +140,21 @@ static void drm_update_vblank_count(struct drm_device *dev, int crtc)* corresponding vblank timestamp. */ do { - cur_vblank = dev->driver->get_vblank_counter (dev, crtc); - rc =drm_get_last_vbltimestamp (dev, crtc, &t_vblank,0 ); - }while (cur_vblank != dev->driver->get_vblank_counter (dev, crtc)); + cur_vblank = dev->driver->get_vblank_counter (dev, pipe); + rc =drm_get_last_vbltimestamp (dev, pipe, &t_vblank,0 ); + }while (cur_vblank != dev->driver->get_vblank_counter (dev, pipe));/* Deal with counter wrap */ diff = cur_vblank - vblank->last;if (cur_vblank < vblank->last) { diff += dev->max_vblank_count +1 ; -DRM_DEBUG ("last_vblank[%d]=0x%x, cur_vblank=0x%x => diff=0x%x\n" , - crtc, vblank->last, cur_vblank, diff); +DRM_DEBUG ("last_vblank[%u]=0x%x, cur_vblank=0x%x => diff=0x%x\n" , + pipe, vblank->last, cur_vblank, diff); } -DRM_DEBUG ("updating vblank count on crtc %d, missed %d\n" , - crtc, diff); +DRM_DEBUG ("updating vblank count on crtc %u, missed %d\n" , + pipe, diff);if (diff ==0 )return ;
@@ -167,7 +167,7 @@ static void drm_update_vblank_count(struct drm_device *dev, int crtc)if (!rc) t_vblank = (struct timeval ) {0 ,0 }; -store_vblank (dev, crtc, diff, &t_vblank); +store_vblank (dev, pipe, diff, &t_vblank); }/*
@@ -176,9 +176,9 @@ static void drm_update_vblank_count(struct drm_device *dev, int crtc)* are preserved, even if there are any spurious vblank irq's after * disable. */ -static void vblank_disable_and_save (struct drm_device *dev,int crtc) +static void vblank_disable_and_save (struct drm_device *dev,unsigned int pipe) { -struct drm_vblank_crtc *vblank = &dev->vblank[crtc]; +struct drm_vblank_crtc *vblank = &dev->vblank[pipe];unsigned long irqflags;u32 vblcount;s64 diff_ns;
@@ -206,8 +206,8 @@ static void vblank_disable_and_save(struct drm_device *dev, int crtc)* vblank interrupt is disabled. */ if (!vblank->enabled && -drm_get_last_vbltimestamp (dev, crtc, &tvblank,0 )) { -drm_update_vblank_count (dev, crtc); +drm_get_last_vbltimestamp (dev, pipe, &tvblank,0 )) { +drm_update_vblank_count (dev, pipe);spin_unlock_irqrestore (&dev->vblank_time_lock, irqflags);return ; }
@@ -218,7 +218,7 @@ static void vblank_disable_and_save(struct drm_device *dev, int crtc)* hardware potentially runtime suspended. */ if (vblank->enabled) { - dev->driver->disable_vblank (dev, crtc); + dev->driver->disable_vblank (dev, pipe); vblank->enabled = false; }
@@ -235,9 +235,9 @@ static void vblank_disable_and_save(struct drm_device *dev, int crtc)* delayed gpu counter increment. */ do { - vblank->last = dev->driver->get_vblank_counter (dev, crtc); - vblrc =drm_get_last_vbltimestamp (dev, crtc, &tvblank,0 ); - }while (vblank->last != dev->driver->get_vblank_counter (dev, crtc) && (--count) && vblrc); + vblank->last = dev->driver->get_vblank_counter (dev, pipe); + vblrc =drm_get_last_vbltimestamp (dev, pipe, &tvblank,0 ); + }while (vblank->last != dev->driver->get_vblank_counter (dev, pipe) && (--count) && vblrc);if (!count) vblrc =0 ;
@@ -247,7 +247,7 @@ static void vblank_disable_and_save(struct drm_device *dev, int crtc)*/ vblcount = vblank->count; diff_ns =timeval_to_ns (&tvblank) - -timeval_to_ns (&vblanktimestamp (dev, crtc, vblcount)); +timeval_to_ns (&vblanktimestamp (dev, pipe, vblcount));/* If there is at least 1 msec difference between the last stored * timestamp and tvblank, then we are currently executing our
@@ -262,7 +262,7 @@ static void vblank_disable_and_save(struct drm_device *dev, int crtc)* hope for the best. */ if (vblrc && (abs64 (diff_ns) >1000000 )) -store_vblank (dev, crtc,1 , &tvblank); +store_vblank (dev, pipe,1 , &tvblank);spin_unlock_irqrestore (&dev->vblank_time_lock, irqflags); }
@@ -271,16 +271,16 @@ static void vblank_disable_fn(unsigned long arg) {struct drm_vblank_crtc *vblank = (void *)arg;struct drm_device *dev = vblank->dev; +unsigned int pipe = vblank->pipe;unsigned long irqflags; -int crtc = vblank->crtc;if (!dev->vblank_disable_allowed)return ;spin_lock_irqsave (&dev->vbl_lock, irqflags);if (atomic_read (&vblank->refcount) ==0 && vblank->enabled) { -DRM_DEBUG ("disabling vblank on crtc %d\n" , crtc); -vblank_disable_and_save (dev, crtc); +DRM_DEBUG ("disabling vblank on crtc %u\n" , pipe); +vblank_disable_and_save (dev, pipe); }spin_unlock_irqrestore (&dev->vbl_lock, irqflags); }
@@ -293,14 +293,14 @@ static void vblank_disable_fn(unsigned long arg)*/ void drm_vblank_cleanup (struct drm_device *dev) { -int crtc; +unsigned int pipe;/* Bail if the driver didn't call drm_vblank_init() */ if (dev->num_crtcs ==0 )return ; -for (crtc =0 ; crtc < dev->num_crtcs; crtc++) { -struct drm_vblank_crtc *vblank = &dev->vblank[crtc]; +for (pipe =0 ; pipe < dev->num_crtcs; pipe++) { +struct drm_vblank_crtc *vblank = &dev->vblank[pipe];WARN_ON (vblank->enabled &&drm_core_check_feature (dev,DRIVER_MODESET ));
@@ -316,17 +316,18 @@ EXPORT_SYMBOL(drm_vblank_cleanup);/** * drm_vblank_init - initialize vblank support -* @dev: drm_device -* @num_crtcs: number of crtcs supported by @dev +* @dev: DRM device +* @num_crtcs: number of CRTCs supported by @dev * * This function initializes vblank support for @num_crtcs display pipelines. * * Returns: * Zero on success or a negative error code on failure. */ -int drm_vblank_init (struct drm_device *dev,int num_crtcs) +int drm_vblank_init (struct drm_device *dev,unsigned int num_crtcs) { -int i, ret = -ENOMEM ; +int ret = -ENOMEM ; +unsigned int i;spin_lock_init (&dev->vbl_lock);spin_lock_init (&dev->vblank_time_lock);
@@ -341,7 +342,7 @@ int drm_vblank_init(struct drm_device *dev, int num_crtcs)struct drm_vblank_crtc *vblank = &dev->vblank[i]; vblank->dev = dev; - vblank->crtc = i; + vblank->pipe = i;init_waitqueue_head (&vblank->queue);setup_timer (&vblank->disable_timer, vblank_disable_fn, (unsigned long )vblank);
@@ -624,17 +625,17 @@ void drm_calc_timestamping_constants(struct drm_crtc *crtc,if (mode->flags &DRM_MODE_FLAG_INTERLACE ) framedur_ns /=2 ; }else -DRM_ERROR ("crtc %d: Can't calculate constants, dotclock = 0!\n" , +DRM_ERROR ("crtc %u: Can't calculate constants, dotclock = 0!\n" , crtc->base.id); crtc->pixeldur_ns = pixeldur_ns; crtc->linedur_ns = linedur_ns; crtc->framedur_ns = framedur_ns; -DRM_DEBUG ("crtc %d: hwmode: htotal %d, vtotal %d, vdisplay %d\n" , +DRM_DEBUG ("crtc %u: hwmode: htotal %d, vtotal %d, vdisplay %d\n" , crtc->base.id, mode->crtc_htotal, mode->crtc_vtotal, mode->crtc_vdisplay); -DRM_DEBUG ("crtc %d: clock %d kHz framedur %d linedur %d, pixeldur %d\n" , +DRM_DEBUG ("crtc %u: clock %d kHz framedur %d linedur %d, pixeldur %d\n" , crtc->base.id, dotclock, framedur_ns, linedur_ns, pixeldur_ns); }
@@ -643,7 +644,7 @@ EXPORT_SYMBOL(drm_calc_timestamping_constants);/** * drm_calc_vbltimestamp_from_scanoutpos - precise vblank timestamp helper * @dev: DRM device -* @crtc: Which CRTC's vblank timestamp to retrieve +* @pipe: index of CRTC whose vblank timestamp to retrieve * @max_error: Desired maximum allowable error in timestamps (nanosecs) * On return contains true maximum error of timestamp * @vblank_time: Pointer to struct timeval which should receive the timestamp
@@ -686,7 +687,8 @@ EXPORT_SYMBOL(drm_calc_timestamping_constants);* DRM_VBLANKTIME_INVBL - Timestamp taken while scanout was in vblank interval. * */ -int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, int crtc, +int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, + unsigned int pipe, int *max_error, struct timeval *vblank_time, unsigned flags,
@@ -700,8 +702,8 @@ int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, int crtc,int framedur_ns, linedur_ns, pixeldur_ns, delta_ns, duration_ns;bool invbl; -if (crtc <0 || crtc >= dev->num_crtcs) { -DRM_ERROR ("Invalid crtc %d\n" , crtc); +if (pipe >= dev->num_crtcs) { +DRM_ERROR ("Invalid crtc %u\n" , pipe);return -EINVAL ; }
@@ -720,7 +722,7 @@ int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, int crtc,* Happens during initial modesetting of a crtc. */ if (framedur_ns ==0 ) { -DRM_DEBUG ("crtc %d: Noop due to uninitialized mode.\n" , crtc); +DRM_DEBUG ("crtc %u: Noop due to uninitialized mode.\n" , pipe);return -EAGAIN ; }
@@ -736,13 +738,13 @@ int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, int crtc,* Get vertical and horizontal scanout position vpos, hpos, * and bounding timestamps stime, etime, pre/post query. */ - vbl_status = dev->driver->get_scanout_position (dev, crtc, flags, &vpos, + vbl_status = dev->driver->get_scanout_position (dev, pipe, flags, &vpos, &hpos, &stime, &etime);/* Return as no-op if scanout query unsupported or failed. */ if (!(vbl_status &DRM_SCANOUTPOS_VALID )) { -DRM_DEBUG ("crtc %d : scanoutpos query failed [%d].\n" , - crtc, vbl_status); +DRM_DEBUG ("crtc %u : scanoutpos query failed [%d].\n" , + pipe, vbl_status);return -EIO ; }
@@ -756,8 +758,8 @@ int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, int crtc,/* Noisy system timing? */ if (i ==DRM_TIMESTAMP_MAXRETRIES ) { -DRM_DEBUG ("crtc %d: Noisy timestamp %d us > %d us [%d reps].\n" , - crtc, duration_ns/1000 , *max_error/1000 , i); +DRM_DEBUG ("crtc %u: Noisy timestamp %d us > %d us [%d reps].\n" , + pipe, duration_ns/1000 , *max_error/1000 , i); }/* Return upper bound of timestamp precision error. */
@@ -790,8 +792,8 @@ int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, int crtc, etime =ktime_sub_ns (etime, delta_ns); *vblank_time =ktime_to_timeval (etime); -DRM_DEBUG ("crtc %d : v %d p(%d,%d)@ %ld.%ld -> %ld.%ld [e %d us, %d rep]\n" , - crtc, (int )vbl_status, hpos, vpos, +DRM_DEBUG ("crtc %u : v %d p(%d,%d)@ %ld.%ld -> %ld.%ld [e %d us, %d rep]\n" , + pipe, (int )vbl_status, hpos, vpos, (long )tv_etime.tv_sec, (long )tv_etime.tv_usec, (long )vblank_time->tv_sec, (long )vblank_time->tv_usec, duration_ns/1000 , i);
@@ -816,7 +818,7 @@ static struct timeval get_drm_timestamp(void)* drm_get_last_vbltimestamp - retrieve raw timestamp for the most recent * vblank interval * @dev: DRM device -* @crtc: which CRTC's vblank timestamp to retrieve +* @pipe: index of CRTC whose vblank timestamp to retrieve * @tvblank: Pointer to target struct timeval which should receive the timestamp * @flags: Flags to pass to driver: * 0 = Default,
@@ -833,7 +835,7 @@ static struct timeval get_drm_timestamp(void)* True if timestamp is considered to be very precise, false otherwise. */ static bool -drm_get_last_vbltimestamp (struct drm_device *dev,int crtc, +drm_get_last_vbltimestamp (struct drm_device *dev,unsigned int pipe,struct timeval *tvblank,unsigned flags) {int ret;
@@ -843,7 +845,7 @@ drm_get_last_vbltimestamp(struct drm_device *dev, int crtc,/* Query driver if possible and precision timestamping enabled. */ if (dev->driver->get_vblank_timestamp && (max_error >0 )) { - ret = dev->driver->get_vblank_timestamp (dev, crtc, &max_error, + ret = dev->driver->get_vblank_timestamp (dev, pipe, &max_error, tvblank, flags);if (ret >0 )return true;
@@ -860,7 +862,7 @@ drm_get_last_vbltimestamp(struct drm_device *dev, int crtc,/** * drm_vblank_count - retrieve "cooked" vblank counter value * @dev: DRM device -* @crtc: which counter to retrieve +* @pipe: index of CRTC for which to retrieve the counter * * Fetches the "cooked" vblank count value that represents the number of * vblank events since the system was booted, including lost events due to
@@ -871,11 +873,11 @@ drm_get_last_vbltimestamp(struct drm_device *dev, int crtc,* Returns: * The software vblank counter. */ -u32 drm_vblank_count (struct drm_device *dev,int crtc) +u32 drm_vblank_count (struct drm_device *dev,int pipe) { -struct drm_vblank_crtc *vblank = &dev->vblank[crtc]; +struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; -if (WARN_ON (crtc >= dev->num_crtcs)) +if (WARN_ON (pipe >= dev->num_crtcs))return 0 ;return vblank->count; }
@@ -901,11 +903,10 @@ u32 drm_crtc_vblank_count(struct drm_crtc *crtc)EXPORT_SYMBOL (drm_crtc_vblank_count);/** -* drm_vblank_count_and_time - retrieve "cooked" vblank counter value -* and the system timestamp corresponding to that vblank counter value. -* +* drm_vblank_count_and_time - retrieve "cooked" vblank counter value and the +* system timestamp corresponding to that vblank counter value. * @dev: DRM device -* @crtc: which counter to retrieve +* @pipe: index of CRTC whose counter to retrieve * @vblanktime: Pointer to struct timeval to receive the vblank timestamp. * * Fetches the "cooked" vblank count value that represents the number of
@@ -913,13 +914,13 @@ EXPORT_SYMBOL(drm_crtc_vblank_count);* modesetting activity. Returns corresponding system timestamp of the time * of the vblank interval that corresponds to the current vblank counter value. */ -u32 drm_vblank_count_and_time (struct drm_device *dev,int crtc, +u32 drm_vblank_count_and_time (struct drm_device *dev,unsigned int pipe,struct timeval *vblanktime) { -struct drm_vblank_crtc *vblank = &dev->vblank[crtc]; +struct drm_vblank_crtc *vblank = &dev->vblank[pipe];u32 cur_vblank; -if (WARN_ON (crtc >= dev->num_crtcs)) +if (WARN_ON (pipe >= dev->num_crtcs))return 0 ;/*
@@ -930,7 +931,7 @@ u32 drm_vblank_count_and_time(struct drm_device *dev, int crtc,do { cur_vblank = vblank->count;smp_rmb (); - *vblanktime =vblanktimestamp (dev, crtc, cur_vblank); + *vblanktime =vblanktimestamp (dev, pipe, cur_vblank);smp_rmb (); }while (cur_vblank != vblank->count);
@@ -957,7 +958,7 @@ static void send_vblank_event(struct drm_device *dev,/** * drm_send_vblank_event - helper to send vblank event after pageflip * @dev: DRM device -* @crtc: CRTC in question +* @pipe: CRTC index * @e: the event to send * * Updates sequence # and timestamp on event, and sends it to userspace.
@@ -965,20 +966,20 @@ static void send_vblank_event(struct drm_device *dev,* * This is the legacy version of drm_crtc_send_vblank_event(). */ -void drm_send_vblank_event (struct drm_device *dev,int crtc, -struct drm_pending_vblank_event *e) +void drm_send_vblank_event (struct drm_device *dev,unsigned int pipe, +struct drm_pending_vblank_event *e) {struct timeval now;unsigned int seq;if (dev->num_crtcs >0 ) { - seq =drm_vblank_count_and_time (dev, crtc, &now); + seq =drm_vblank_count_and_time (dev, pipe, &now); }else { seq =0 ; now =get_drm_timestamp (); } - e->pipe = crtc; + e->pipe = pipe;send_vblank_event (dev, e, seq, &now); }EXPORT_SYMBOL (drm_send_vblank_event);
@@ -1003,11 +1004,11 @@ EXPORT_SYMBOL(drm_crtc_send_vblank_event);/** * drm_vblank_enable - enable the vblank interrupt on a CRTC * @dev: DRM device -* @crtc: CRTC in question +* @pipe: CRTC index */ -static int drm_vblank_enable (struct drm_device *dev,int crtc) +static int drm_vblank_enable (struct drm_device *dev,unsigned int pipe) { -struct drm_vblank_crtc *vblank = &dev->vblank[crtc]; +struct drm_vblank_crtc *vblank = &dev->vblank[pipe];int ret =0 ;assert_spin_locked (&dev->vbl_lock);
@@ -1022,13 +1023,13 @@ static int drm_vblank_enable(struct drm_device *dev, int crtc)* timestamps. Filtercode in drm_handle_vblank() will * prevent double-accounting of same vblank interval. */ - ret = dev->driver->enable_vblank (dev, crtc); -DRM_DEBUG ("enabling vblank on crtc %d, ret: %d\n" , crtc, ret); + ret = dev->driver->enable_vblank (dev, pipe); +DRM_DEBUG ("enabling vblank on crtc %u, ret: %d\n" , pipe, ret);if (ret)atomic_dec (&vblank->refcount);else { vblank->enabled = true; -drm_update_vblank_count (dev, crtc); +drm_update_vblank_count (dev, pipe); } }
@@ -1040,7 +1041,7 @@ static int drm_vblank_enable(struct drm_device *dev, int crtc)/** * drm_vblank_get - get a reference count on vblank events * @dev: DRM device -* @crtc: which CRTC to own +* @pipe: index of CRTC to own * * Acquire a reference count on vblank events to avoid having them disabled * while in use.
@@ -1050,22 +1051,22 @@ static int drm_vblank_enable(struct drm_device *dev, int crtc)* Returns: * Zero on success, nonzero on failure. */ -int drm_vblank_get (struct drm_device *dev,int crtc) +int drm_vblank_get (struct drm_device *dev,unsigned int pipe) { -struct drm_vblank_crtc *vblank = &dev->vblank[crtc]; +struct drm_vblank_crtc *vblank = &dev->vblank[pipe];unsigned long irqflags;int ret =0 ;if (!dev->num_crtcs)return -EINVAL ; -if (WARN_ON (crtc >= dev->num_crtcs)) +if (WARN_ON (pipe >= dev->num_crtcs))return -EINVAL ;spin_lock_irqsave (&dev->vbl_lock, irqflags);/* Going from 0->1 means we have to enable interrupts again */ if (atomic_add_return (1 , &vblank->refcount) ==1 ) { - ret =drm_vblank_enable (dev, crtc); + ret =drm_vblank_enable (dev, pipe); }else {if (!vblank->enabled) {atomic_dec (&vblank->refcount);
@@ -1097,20 +1098,20 @@ int drm_crtc_vblank_get(struct drm_crtc *crtc)EXPORT_SYMBOL (drm_crtc_vblank_get);/** -* drm_vblank_put - give up ownership of vblank events +* drm_vblank_put - release ownership of vblank events * @dev: DRM device -* @crtc: which counter to give up +* @pipe: index of CRTC to release * * Release ownership of a given vblank counter, turning off interrupts * if possible. Disable interrupts after drm_vblank_offdelay milliseconds. * * This is the legacy version of drm_crtc_vblank_put(). */ -void drm_vblank_put (struct drm_device *dev,int crtc) +void drm_vblank_put (struct drm_device *dev,unsigned int pipe) { -struct drm_vblank_crtc *vblank = &dev->vblank[crtc]; +struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; -if (WARN_ON (crtc >= dev->num_crtcs)) +if (WARN_ON (pipe >= dev->num_crtcs))return ;if (WARN_ON (atomic_read (&vblank->refcount) ==0 ))
@@ -1147,33 +1148,34 @@ EXPORT_SYMBOL(drm_crtc_vblank_put);/** * drm_wait_one_vblank - wait for one vblank * @dev: DRM device -* @crtc: crtc index +* @pipe: CRTC index * * This waits for one vblank to pass on @crtc, using the irq driver interfaces. * It is a failure to call this when the vblank irq for @crtc is disabled, e.g. * due to lack of driver support or because the crtc is off. */ -void drm_wait_one_vblank (struct drm_device *dev,int crtc) +void drm_wait_one_vblank (struct drm_device *dev,unsigned int pipe) { +struct drm_vblank_crtc *vblank = &dev->vblank[pipe];int ret;u32 last; -if (WARN_ON (crtc >= dev->num_crtcs)) +if (WARN_ON (pipe >= dev->num_crtcs))return ; - ret =drm_vblank_get (dev, crtc); -if (WARN (ret,"vblank not available on crtc %i, ret=%i\n" , crtc, ret)) + ret =drm_vblank_get (dev, pipe); +if (WARN (ret,"vblank not available on crtc %i, ret=%i\n" , pipe, ret))return ; - last =drm_vblank_count (dev, crtc); + last =drm_vblank_count (dev, pipe); - ret =wait_event_timeout (dev->vblank[crtc].queue, - last !=drm_vblank_count (dev, crtc), + ret =wait_event_timeout (vblank->queue, + last !=drm_vblank_count (dev, pipe),msecs_to_jiffies (100 )); -WARN (ret ==0 ,"vblank wait timed out on crtc %i\n" , crtc); +WARN (ret ==0 ,"vblank wait timed out on crtc %i\n" , pipe); -drm_vblank_put (dev, crtc); +drm_vblank_put (dev, pipe); }EXPORT_SYMBOL (drm_wait_one_vblank);
@@ -1194,7 +1196,7 @@ EXPORT_SYMBOL(drm_crtc_wait_one_vblank);/** * drm_vblank_off - disable vblank events on a CRTC * @dev: DRM device -* @crtc: CRTC in question +* @pipe: CRTC index * * Drivers can use this function to shut down the vblank interrupt handling when * disabling a crtc. This function ensures that the latest vblank frame count is
@@ -1205,21 +1207,21 @@ EXPORT_SYMBOL(drm_crtc_wait_one_vblank);* * This is the legacy version of drm_crtc_vblank_off(). */ -void drm_vblank_off (struct drm_device *dev,int crtc) +void drm_vblank_off (struct drm_device *dev,unsigned int pipe) { -struct drm_vblank_crtc *vblank = &dev->vblank[crtc]; +struct drm_vblank_crtc *vblank = &dev->vblank[pipe];struct drm_pending_vblank_event *e, *t;struct timeval now;unsigned long irqflags;unsigned int seq; -if (WARN_ON (crtc >= dev->num_crtcs)) +if (WARN_ON (pipe >= dev->num_crtcs))return ;spin_lock_irqsave (&dev->event_lock, irqflags);spin_lock (&dev->vbl_lock); -vblank_disable_and_save (dev, crtc); +vblank_disable_and_save (dev, pipe);wake_up (&vblank->queue);/*
@@ -1233,16 +1235,16 @@ void drm_vblank_off(struct drm_device *dev, int crtc)spin_unlock (&dev->vbl_lock);/* Send any queued vblank events, lest the natives grow disquiet */ - seq =drm_vblank_count_and_time (dev, crtc, &now); + seq =drm_vblank_count_and_time (dev, pipe, &now);list_for_each_entry_safe (e, t, &dev->vblank_event_list, base.link) { -if (e->pipe != crtc) +if (e->pipe != pipe)continue ;DRM_DEBUG ("Sending premature vblank event on disable: \ wanted %d, current %d\n" , e->event.sequence, seq);list_del (&e->base.link); -drm_vblank_put (dev, e->pipe); +drm_vblank_put (dev, pipe);send_vblank_event (dev, e, seq, &now); }spin_unlock_irqrestore (&dev->event_lock, irqflags);
@@ -1303,7 +1305,7 @@ EXPORT_SYMBOL(drm_crtc_vblank_reset);/** * drm_vblank_on - enable vblank events on a CRTC * @dev: DRM device -* @crtc: CRTC in question +* @pipe: CRTC index * * This functions restores the vblank interrupt state captured with * drm_vblank_off() again. Note that calls to drm_vblank_on() and
@@ -1312,12 +1314,12 @@ EXPORT_SYMBOL(drm_crtc_vblank_reset);* * This is the legacy version of drm_crtc_vblank_on(). */ -void drm_vblank_on (struct drm_device *dev,int crtc) +void drm_vblank_on (struct drm_device *dev,unsigned int pipe) { -struct drm_vblank_crtc *vblank = &dev->vblank[crtc]; +struct drm_vblank_crtc *vblank = &dev->vblank[pipe];unsigned long irqflags; -if (WARN_ON (crtc >= dev->num_crtcs)) +if (WARN_ON (pipe >= dev->num_crtcs))return ;spin_lock_irqsave (&dev->vbl_lock, irqflags);
@@ -1335,7 +1337,7 @@ void drm_vblank_on(struct drm_device *dev, int crtc)* vblank counter value before and after a modeset */ vblank->last = - (dev->driver->get_vblank_counter (dev, crtc) -1 ) & + (dev->driver->get_vblank_counter (dev, pipe) -1 ) & dev->max_vblank_count;/* * re-enable interrupts if there are users left, or the
@@ -1343,7 +1345,7 @@ void drm_vblank_on(struct drm_device *dev, int crtc)*/ if (atomic_read (&vblank->refcount) !=0 || (!dev->vblank_disable_immediate && drm_vblank_offdelay ==0 )) -WARN_ON (drm_vblank_enable (dev, crtc)); +WARN_ON (drm_vblank_enable (dev, pipe));spin_unlock_irqrestore (&dev->vbl_lock, irqflags); }EXPORT_SYMBOL (drm_vblank_on);
@@ -1368,7 +1370,7 @@ EXPORT_SYMBOL(drm_crtc_vblank_on);/** * drm_vblank_pre_modeset - account for vblanks across mode sets * @dev: DRM device -* @crtc: CRTC in question +* @pipe: CRTC index * * Account for vblank events across mode setting events, which will likely * reset the hardware frame counter.
@@ -1388,15 +1390,15 @@ EXPORT_SYMBOL(drm_crtc_vblank_on);* Drivers must call drm_vblank_post_modeset() when re-enabling the same crtc * again. */ -void drm_vblank_pre_modeset (struct drm_device *dev,int crtc) +void drm_vblank_pre_modeset (struct drm_device *dev,unsigned int pipe) { -struct drm_vblank_crtc *vblank = &dev->vblank[crtc]; +struct drm_vblank_crtc *vblank = &dev->vblank[pipe];/* vblank is not initialized (IRQ not installed ?), or has been freed */ if (!dev->num_crtcs)return ; -if (WARN_ON (crtc >= dev->num_crtcs)) +if (WARN_ON (pipe >= dev->num_crtcs))return ;/*
@@ -1408,7 +1410,7 @@ void drm_vblank_pre_modeset(struct drm_device *dev, int crtc)*/ if (!vblank->inmodeset) { vblank->inmodeset =0x1 ; -if (drm_vblank_get (dev, crtc) ==0 ) +if (drm_vblank_get (dev, pipe) ==0 ) vblank->inmodeset |=0x2 ; } }
@@ -1417,21 +1419,21 @@ EXPORT_SYMBOL(drm_vblank_pre_modeset);/** * drm_vblank_post_modeset - undo drm_vblank_pre_modeset changes * @dev: DRM device -* @crtc: CRTC in question +* @pipe: CRTC index * * This function again drops the temporary vblank reference acquired in * drm_vblank_pre_modeset. */ -void drm_vblank_post_modeset (struct drm_device *dev,int crtc) +void drm_vblank_post_modeset (struct drm_device *dev,unsigned int pipe) { -struct drm_vblank_crtc *vblank = &dev->vblank[crtc]; +struct drm_vblank_crtc *vblank = &dev->vblank[pipe];unsigned long irqflags;/* vblank is not initialized (IRQ not installed ?), or has been freed */ if (!dev->num_crtcs)return ; -if (WARN_ON (crtc >= dev->num_crtcs)) +if (WARN_ON (pipe >= dev->num_crtcs))return ;if (vblank->inmodeset) {
@@ -1440,7 +1442,7 @@ void drm_vblank_post_modeset(struct drm_device *dev, int crtc)spin_unlock_irqrestore (&dev->vbl_lock, irqflags);if (vblank->inmodeset &0x2 ) -drm_vblank_put (dev, crtc); +drm_vblank_put (dev, pipe); vblank->inmodeset =0 ; }
@@ -1462,7 +1464,7 @@ int drm_modeset_ctl(struct drm_device *dev, void *data, struct drm_file *file_priv) {struct drm_modeset_ctl *modeset = data; -unsigned int crtc; +unsigned int pipe;/* If drm_vblank_init() hasn't been called yet, just no-op */ if (!dev->num_crtcs)
@@ -1472,16 +1474,16 @@ int drm_modeset_ctl(struct drm_device *dev, void *data,if (drm_core_check_feature (dev,DRIVER_MODESET ))return 0 ; - crtc = modeset->crtc; -if (crtc >= dev->num_crtcs) + pipe = modeset->crtc; +if (pipe >= dev->num_crtcs)return -EINVAL ;switch (modeset->cmd) {case _DRM_PRE_MODESET: -drm_vblank_pre_modeset (dev, crtc); +drm_vblank_pre_modeset (dev, pipe);break ;case _DRM_POST_MODESET: -drm_vblank_post_modeset (dev, crtc); +drm_vblank_post_modeset (dev, pipe);break ;default :return -EINVAL ;
@@ -1490,7 +1492,7 @@ int drm_modeset_ctl(struct drm_device *dev, void *data,return 0 ; } -static int drm_queue_vblank_event (struct drm_device *dev,int pipe, +static int drm_queue_vblank_event (struct drm_device *dev,unsigned int pipe,union drm_wait_vblank *vblwait,struct drm_file *file_priv) {
@@ -1544,7 +1546,7 @@ static int drm_queue_vblank_event(struct drm_device *dev, int pipe, vblwait->reply.sequence = vblwait->request.sequence; } -DRM_DEBUG ("event on vblank count %d, current %d, crtc %d\n" , +DRM_DEBUG ("event on vblank count %d, current %d, crtc %u\n" , vblwait->request.sequence, seq, pipe); trace_drm_vblank_event_queued(current->pid, pipe,
@@ -1593,7 +1595,7 @@ int drm_wait_vblank(struct drm_device *dev, void *data,struct drm_vblank_crtc *vblank;union drm_wait_vblank *vblwait = data;int ret; -unsigned int flags, seq, crtc, high_crtc; +unsigned int flags, seq, pipe, high_pipe;if (!dev->irq_enabled)return -EINVAL ;
@@ -1612,22 +1614,22 @@ int drm_wait_vblank(struct drm_device *dev, void *data, } flags = vblwait->request.type & _DRM_VBLANK_FLAGS_MASK; - high_crtc = (vblwait->request.type & _DRM_VBLANK_HIGH_CRTC_MASK); -if (high_crtc) - crtc = high_crtc >> _DRM_VBLANK_HIGH_CRTC_SHIFT; + high_pipe = (vblwait->request.type & _DRM_VBLANK_HIGH_CRTC_MASK); +if (high_pipe) + pipe = high_pipe >> _DRM_VBLANK_HIGH_CRTC_SHIFT;else - crtc = flags & _DRM_VBLANK_SECONDARY ?1 :0 ; -if (crtc >= dev->num_crtcs) + pipe = flags & _DRM_VBLANK_SECONDARY ?1 :0 ; +if (pipe >= dev->num_crtcs)return -EINVAL ; - vblank = &dev->vblank[crtc]; + vblank = &dev->vblank[pipe]; - ret =drm_vblank_get (dev, crtc); + ret =drm_vblank_get (dev, pipe);if (ret) {DRM_DEBUG ("failed to acquire vblank counter, %d\n" , ret);return ret; } - seq =drm_vblank_count (dev, crtc); + seq =drm_vblank_count (dev, pipe);switch (vblwait->request.type & _DRM_VBLANK_TYPES_MASK) {case _DRM_VBLANK_RELATIVE:
@@ -1644,7 +1646,7 @@ int drm_wait_vblank(struct drm_device *dev, void *data,/* must hold on to the vblank ref until the event fires * drm_vblank_put will be called asynchronously */ -return drm_queue_vblank_event (dev, crtc, vblwait, file_priv); +return drm_queue_vblank_event (dev, pipe, vblwait, file_priv); } if ((flags & _DRM_VBLANK_NEXTONMISS) &&
@@ -1652,11 +1654,11 @@ int drm_wait_vblank(struct drm_device *dev, void *data, vblwait->request.sequence = seq +1 ; } -DRM_DEBUG ("waiting on vblank count %d, crtc %d\n" , - vblwait->request.sequence, crtc); +DRM_DEBUG ("waiting on vblank count %d, crtc %u\n" , + vblwait->request.sequence, pipe); vblank->last_wait = vblwait->request.sequence;DRM_WAIT_ON (ret, vblank->queue,3 *HZ , - (((drm_vblank_count (dev, crtc) - + (((drm_vblank_count (dev, pipe) - vblwait->request.sequence) <= (1 <<23 )) || !vblank->enabled || !dev->irq_enabled));
@@ -1664,7 +1666,7 @@ int drm_wait_vblank(struct drm_device *dev, void *data,if (ret != -EINTR ) {struct timeval now; - vblwait->reply.sequence =drm_vblank_count_and_time (dev, crtc, &now); + vblwait->reply.sequence =drm_vblank_count_and_time (dev, pipe, &now); vblwait->reply.tval_sec = now.tv_sec; vblwait->reply.tval_usec = now.tv_usec;
@@ -1675,11 +1677,11 @@ int drm_wait_vblank(struct drm_device *dev, void *data, } done: -drm_vblank_put (dev, crtc); +drm_vblank_put (dev, pipe);return ret; } -static void drm_handle_vblank_events (struct drm_device *dev,int crtc) +static void drm_handle_vblank_events (struct drm_device *dev,unsigned int pipe) {struct drm_pending_vblank_event *e, *t;struct timeval now;
@@ -1687,10 +1689,10 @@ static void drm_handle_vblank_events(struct drm_device *dev, int crtc)assert_spin_locked (&dev->event_lock); - seq =drm_vblank_count_and_time (dev, crtc, &now); + seq =drm_vblank_count_and_time (dev, pipe, &now);list_for_each_entry_safe (e, t, &dev->vblank_event_list, base.link) { -if (e->pipe != crtc) +if (e->pipe != pipe)continue ;if ((seq - e->event.sequence) > (1 <<23 ))continue ;
@@ -1699,26 +1701,26 @@ static void drm_handle_vblank_events(struct drm_device *dev, int crtc) e->event.sequence, seq);list_del (&e->base.link); -drm_vblank_put (dev, e->pipe); +drm_vblank_put (dev, pipe);send_vblank_event (dev, e, seq, &now); } -trace_drm_vblank_event (crtc, seq); +trace_drm_vblank_event (pipe, seq); }/** * drm_handle_vblank - handle a vblank event * @dev: DRM device -* @crtc: where this event occurred +* @pipe: index of CRTC where this event occurred * * Drivers should call this routine in their vblank interrupt handlers to * update the vblank counter and send any signals that may be pending. * * This is the legacy version of drm_crtc_handle_vblank(). */ -bool drm_handle_vblank (struct drm_device *dev,int crtc) +bool drm_handle_vblank (struct drm_device *dev,unsigned int pipe) { -struct drm_vblank_crtc *vblank = &dev->vblank[crtc]; +struct drm_vblank_crtc *vblank = &dev->vblank[pipe];u32 vblcount;s64 diff_ns;struct timeval tvblank;
@@ -1727,7 +1729,7 @@ bool drm_handle_vblank(struct drm_device *dev, int crtc)if (WARN_ON_ONCE (!dev->num_crtcs))return false; -if (WARN_ON (crtc >= dev->num_crtcs)) +if (WARN_ON (pipe >= dev->num_crtcs))return false;spin_lock_irqsave (&dev->event_lock, irqflags);
@@ -1751,11 +1753,11 @@ bool drm_handle_vblank(struct drm_device *dev, int crtc)/* Get current timestamp and count. */ vblcount = vblank->count; -drm_get_last_vbltimestamp (dev, crtc, &tvblank,DRM_CALLED_FROM_VBLIRQ ); +drm_get_last_vbltimestamp (dev, pipe, &tvblank,DRM_CALLED_FROM_VBLIRQ );/* Compute time difference to timestamp of last vblank */ diff_ns =timeval_to_ns (&tvblank) - -timeval_to_ns (&vblanktimestamp (dev, crtc, vblcount)); +timeval_to_ns (&vblanktimestamp (dev, pipe, vblcount));/* Update vblank timestamp and count if at least * DRM_REDUNDANT_VBLIRQ_THRESH_NS nanoseconds
@@ -1767,15 +1769,15 @@ bool drm_handle_vblank(struct drm_device *dev, int crtc)* ignore those for accounting. */ if (abs64 (diff_ns) >DRM_REDUNDANT_VBLIRQ_THRESH_NS ) -store_vblank (dev, crtc,1 , &tvblank); +store_vblank (dev, pipe,1 , &tvblank);else -DRM_DEBUG ("crtc %d: Redundant vblirq ignored. diff_ns = %d\n" , - crtc, (int ) diff_ns); +DRM_DEBUG ("crtc %u: Redundant vblirq ignored. diff_ns = %d\n" , + pipe, (int ) diff_ns);spin_unlock (&dev->vblank_time_lock);wake_up (&vblank->queue); -drm_handle_vblank_events (dev, crtc); +drm_handle_vblank_events (dev, pipe);spin_unlock_irqrestore (&dev->event_lock, irqflags);
include/drm/drmP.h +16 -16
@@ -681,7 +681,7 @@ struct drm_minor {struct drm_pending_vblank_event {struct drm_pending_event base; -int pipe; +unsigned int pipe;struct drm_event_vblank event; };
@@ -700,7 +700,7 @@ struct drm_vblank_crtc {/* for wraparound handling */ u32 last_wait;/* Last vblank seqno waited per CRTC */ unsigned int inmodeset;/* Display driver is setting mode */ -int crtc;/* crtc index */ +unsigned int pipe;/* crtc index */ bool enabled;/* so we don't call enable more than once per disable */ };
@@ -920,34 +920,34 @@ void drm_clflush_virt_range(void *addr, unsigned long length);extern int drm_irq_install (struct drm_device *dev,int irq);extern int drm_irq_uninstall (struct drm_device *dev); -extern int drm_vblank_init (struct drm_device *dev,int num_crtcs); +extern int drm_vblank_init (struct drm_device *dev,unsigned int num_crtcs);extern int drm_wait_vblank (struct drm_device *dev,void *data,struct drm_file *filp); -extern u32 drm_vblank_count (struct drm_device *dev,int crtc); +extern u32 drm_vblank_count (struct drm_device *dev,int pipe);extern u32 drm_crtc_vblank_count (struct drm_crtc *crtc); -extern u32 drm_vblank_count_and_time (struct drm_device *dev,int crtc, +extern u32 drm_vblank_count_and_time (struct drm_device *dev,unsigned int pipe,struct timeval *vblanktime); -extern void drm_send_vblank_event (struct drm_device *dev,int crtc, -struct drm_pending_vblank_event *e); +extern void drm_send_vblank_event (struct drm_device *dev,unsigned int pipe, +struct drm_pending_vblank_event *e);extern void drm_crtc_send_vblank_event (struct drm_crtc *crtc,struct drm_pending_vblank_event *e); -extern bool drm_handle_vblank (struct drm_device *dev,int crtc); +extern bool drm_handle_vblank (struct drm_device *dev,unsigned int pipe);extern bool drm_crtc_handle_vblank (struct drm_crtc *crtc); -extern int drm_vblank_get (struct drm_device *dev,int crtc); -extern void drm_vblank_put (struct drm_device *dev,int crtc); +extern int drm_vblank_get (struct drm_device *dev,unsigned int pipe); +extern void drm_vblank_put (struct drm_device *dev,unsigned int pipe);extern int drm_crtc_vblank_get (struct drm_crtc *crtc);extern void drm_crtc_vblank_put (struct drm_crtc *crtc); -extern void drm_wait_one_vblank (struct drm_device *dev,int crtc); +extern void drm_wait_one_vblank (struct drm_device *dev,unsigned int pipe);extern void drm_crtc_wait_one_vblank (struct drm_crtc *crtc); -extern void drm_vblank_off (struct drm_device *dev,int crtc); -extern void drm_vblank_on (struct drm_device *dev,int crtc); +extern void drm_vblank_off (struct drm_device *dev,unsigned int pipe); +extern void drm_vblank_on (struct drm_device *dev,unsigned int pipe);extern void drm_crtc_vblank_off (struct drm_crtc *crtc);extern void drm_crtc_vblank_reset (struct drm_crtc *crtc);extern void drm_crtc_vblank_on (struct drm_crtc *crtc);extern void drm_vblank_cleanup (struct drm_device *dev); extern int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, - int crtc, int *max_error, + unsigned int pipe, int *max_error, struct timeval *vblank_time, unsigned flags, const struct drm_crtc *refcrtc,
@@ -968,8 +968,8 @@ static inline wait_queue_head_t *drm_crtc_vblank_waitqueue(struct drm_crtc *crtc }/* Modesetting support */ -extern void drm_vblank_pre_modeset (struct drm_device *dev,int crtc); -extern void drm_vblank_post_modeset (struct drm_device *dev,int crtc); +extern void drm_vblank_pre_modeset (struct drm_device *dev,unsigned int pipe); +extern void drm_vblank_post_modeset (struct drm_device *dev,unsigned int pipe);/* Stub support (drm_stub.h) */ extern struct drm_master *drm_master_get (struct drm_master *master);
Signature · 6 lines
2.4.5 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 09/13] drm/irq: Make pipe unsigned and name consistent
Quoted 10 lines · Thierry Reding
From: Thierry Reding <[email protected]>
Name all references to the pipe number (CRTC index) consistently to make it easier to distinguish which is a pipe number and which is a pointer to struct
drm_crtc.While at it also make all references to the pipe number unsigned because there is no longer any reason why it should ever be negative.
Signed-off-by Thierry Reding <[email protected]>
There's 2 "int crtc" and one "int pipe" (without the unsigned) left after this patch. Can you please do a follow-up? Applied this meanwhile. -Daniel
Quoted 1,061 lines
--- drivers/gpu/drm/drm_irq.c | 316 +++++++++++++++++++++++----------------------- include/drm/drmP.h | 32 ++--- 2 files changed, 175 insertions(+), 173 deletions(-)drivers/gpu/drm/drm_irq.c +159
-157@@ -43,8 +43,8 @@#include <linux/export.h> /* Access macro for slots in vblank timestamp ringbuffer. */ -#define vblanktimestamp (dev, crtc, count) \ - ((dev)->vblank[crtc].time[(count) % DRM_VBLANKTIME_RBSIZE]) +#define vblanktimestamp (dev, pipe, count) \ + ((dev)->vblank[pipe].time[(count) % DRM_VBLANKTIME_RBSIZE])/* Retry timestamp calculation up to 3 times to satisfy * drm_timestamp_precision before giving up. @@ -57,7 +57,7 @@#define DRM_REDUNDANT_VBLIRQ_THRESH_NS 1000000static bool -drm_get_last_vbltimestamp (struct drm_device *dev,int crtc, +drm_get_last_vbltimestamp (struct drm_device *dev,unsigned int pipe,struct timeval *tvblank,unsigned flags);static unsigned int drm_timestamp_precision =20 ;/* Default to 20 usecs. */ @@ -107,7 +107,7 @@ static void store_vblank(struct drm_device *dev, int crtc,/** * drm_update_vblank_count - update the master vblank counter * @dev: DRM device -* @crtc: counter to update +* @pipe: counter to update * * Call back into the driver to update the appropriate vblank counter * (specified by @crtc). Deal with wraparound, if it occurred, and @@ -120,9 +120,9 @@ static void store_vblank(struct drm_device *dev, int crtc,* Note: caller must hold dev->vbl_lock since this reads & writes * device vblank fields. */ -static void drm_update_vblank_count (struct drm_device *dev,int crtc) +static void drm_update_vblank_count (struct drm_device *dev,unsigned int pipe) { -struct drm_vblank_crtc *vblank = &dev->vblank[crtc]; +struct drm_vblank_crtc *vblank = &dev->vblank[pipe];u32 cur_vblank, diff;bool rc;struct timeval t_vblank;@@ -140,21 +140,21 @@ static void drm_update_vblank_count(struct drm_device *dev, int crtc)* corresponding vblank timestamp. */ do { - cur_vblank = dev->driver->get_vblank_counter (dev, crtc); - rc =drm_get_last_vbltimestamp (dev, crtc, &t_vblank,0 ); - }while (cur_vblank != dev->driver->get_vblank_counter (dev, crtc)); + cur_vblank = dev->driver->get_vblank_counter (dev, pipe); + rc =drm_get_last_vbltimestamp (dev, pipe, &t_vblank,0 ); + }while (cur_vblank != dev->driver->get_vblank_counter (dev, pipe));/* Deal with counter wrap */ diff = cur_vblank - vblank->last;if (cur_vblank < vblank->last) { diff += dev->max_vblank_count +1 ; -DRM_DEBUG ("last_vblank[%d]=0x%x, cur_vblank=0x%x => diff=0x%x\n" , - crtc, vblank->last, cur_vblank, diff); +DRM_DEBUG ("last_vblank[%u]=0x%x, cur_vblank=0x%x => diff=0x%x\n" , + pipe, vblank->last, cur_vblank, diff); } -DRM_DEBUG ("updating vblank count on crtc %d, missed %d\n" , - crtc, diff); +DRM_DEBUG ("updating vblank count on crtc %u, missed %d\n" , + pipe, diff);if (diff ==0 )return ;@@ -167,7 +167,7 @@ static void drm_update_vblank_count(struct drm_device *dev, int crtc)if (!rc) t_vblank = (struct timeval ) {0 ,0 }; -store_vblank (dev, crtc, diff, &t_vblank); +store_vblank (dev, pipe, diff, &t_vblank); }/* @@ -176,9 +176,9 @@ static void drm_update_vblank_count(struct drm_device *dev, int crtc)* are preserved, even if there are any spurious vblank irq's after * disable. */ -static void vblank_disable_and_save (struct drm_device *dev,int crtc) +static void vblank_disable_and_save (struct drm_device *dev,unsigned int pipe) { -struct drm_vblank_crtc *vblank = &dev->vblank[crtc]; +struct drm_vblank_crtc *vblank = &dev->vblank[pipe];unsigned long irqflags;u32 vblcount;s64 diff_ns;@@ -206,8 +206,8 @@ static void vblank_disable_and_save(struct drm_device *dev, int crtc)* vblank interrupt is disabled. */ if (!vblank->enabled && -drm_get_last_vbltimestamp (dev, crtc, &tvblank,0 )) { -drm_update_vblank_count (dev, crtc); +drm_get_last_vbltimestamp (dev, pipe, &tvblank,0 )) { +drm_update_vblank_count (dev, pipe);spin_unlock_irqrestore (&dev->vblank_time_lock, irqflags);return ; }@@ -218,7 +218,7 @@ static void vblank_disable_and_save(struct drm_device *dev, int crtc)* hardware potentially runtime suspended. */ if (vblank->enabled) { - dev->driver->disable_vblank (dev, crtc); + dev->driver->disable_vblank (dev, pipe); vblank->enabled = false; }@@ -235,9 +235,9 @@ static void vblank_disable_and_save(struct drm_device *dev, int crtc)* delayed gpu counter increment. */ do { - vblank->last = dev->driver->get_vblank_counter (dev, crtc); - vblrc =drm_get_last_vbltimestamp (dev, crtc, &tvblank,0 ); - }while (vblank->last != dev->driver->get_vblank_counter (dev, crtc) && (--count) && vblrc); + vblank->last = dev->driver->get_vblank_counter (dev, pipe); + vblrc =drm_get_last_vbltimestamp (dev, pipe, &tvblank,0 ); + }while (vblank->last != dev->driver->get_vblank_counter (dev, pipe) && (--count) && vblrc);if (!count) vblrc =0 ;@@ -247,7 +247,7 @@ static void vblank_disable_and_save(struct drm_device *dev, int crtc)*/ vblcount = vblank->count; diff_ns =timeval_to_ns (&tvblank) - -timeval_to_ns (&vblanktimestamp (dev, crtc, vblcount)); +timeval_to_ns (&vblanktimestamp (dev, pipe, vblcount));/* If there is at least 1 msec difference between the last stored * timestamp and tvblank, then we are currently executing our @@ -262,7 +262,7 @@ static void vblank_disable_and_save(struct drm_device *dev, int crtc)* hope for the best. */ if (vblrc && (abs64 (diff_ns) >1000000 )) -store_vblank (dev, crtc,1 , &tvblank); +store_vblank (dev, pipe,1 , &tvblank);spin_unlock_irqrestore (&dev->vblank_time_lock, irqflags); }@@ -271,16 +271,16 @@ static void vblank_disable_fn(unsigned long arg) {struct drm_vblank_crtc *vblank = (void *)arg;struct drm_device *dev = vblank->dev; +unsigned int pipe = vblank->pipe;unsigned long irqflags; -int crtc = vblank->crtc;if (!dev->vblank_disable_allowed)return ;spin_lock_irqsave (&dev->vbl_lock, irqflags);if (atomic_read (&vblank->refcount) ==0 && vblank->enabled) { -DRM_DEBUG ("disabling vblank on crtc %d\n" , crtc); -vblank_disable_and_save (dev, crtc); +DRM_DEBUG ("disabling vblank on crtc %u\n" , pipe); +vblank_disable_and_save (dev, pipe); }spin_unlock_irqrestore (&dev->vbl_lock, irqflags); }@@ -293,14 +293,14 @@ static void vblank_disable_fn(unsigned long arg)*/ void drm_vblank_cleanup (struct drm_device *dev) { -int crtc; +unsigned int pipe;/* Bail if the driver didn't call drm_vblank_init() */ if (dev->num_crtcs ==0 )return ; -for (crtc =0 ; crtc < dev->num_crtcs; crtc++) { -struct drm_vblank_crtc *vblank = &dev->vblank[crtc]; +for (pipe =0 ; pipe < dev->num_crtcs; pipe++) { +struct drm_vblank_crtc *vblank = &dev->vblank[pipe];WARN_ON (vblank->enabled &&drm_core_check_feature (dev,DRIVER_MODESET ));@@ -316,17 +316,18 @@ EXPORT_SYMBOL(drm_vblank_cleanup);/** * drm_vblank_init - initialize vblank support -* @dev: drm_device -* @num_crtcs: number of crtcs supported by @dev +* @dev: DRM device +* @num_crtcs: number of CRTCs supported by @dev * * This function initializes vblank support for @num_crtcs display pipelines. * * Returns: * Zero on success or a negative error code on failure. */ -int drm_vblank_init (struct drm_device *dev,int num_crtcs) +int drm_vblank_init (struct drm_device *dev,unsigned int num_crtcs) { -int i, ret = -ENOMEM ; +int ret = -ENOMEM ; +unsigned int i;spin_lock_init (&dev->vbl_lock);spin_lock_init (&dev->vblank_time_lock);@@ -341,7 +342,7 @@ int drm_vblank_init(struct drm_device *dev, int num_crtcs)struct drm_vblank_crtc *vblank = &dev->vblank[i]; vblank->dev = dev; - vblank->crtc = i; + vblank->pipe = i;init_waitqueue_head (&vblank->queue);setup_timer (&vblank->disable_timer, vblank_disable_fn, (unsigned long )vblank);@@ -624,17 +625,17 @@ void drm_calc_timestamping_constants(struct drm_crtc *crtc,if (mode->flags &DRM_MODE_FLAG_INTERLACE ) framedur_ns /=2 ; }else -DRM_ERROR ("crtc %d: Can't calculate constants, dotclock = 0!\n" , +DRM_ERROR ("crtc %u: Can't calculate constants, dotclock = 0!\n" , crtc->base.id); crtc->pixeldur_ns = pixeldur_ns; crtc->linedur_ns = linedur_ns; crtc->framedur_ns = framedur_ns; -DRM_DEBUG ("crtc %d: hwmode: htotal %d, vtotal %d, vdisplay %d\n" , +DRM_DEBUG ("crtc %u: hwmode: htotal %d, vtotal %d, vdisplay %d\n" , crtc->base.id, mode->crtc_htotal, mode->crtc_vtotal, mode->crtc_vdisplay); -DRM_DEBUG ("crtc %d: clock %d kHz framedur %d linedur %d, pixeldur %d\n" , +DRM_DEBUG ("crtc %u: clock %d kHz framedur %d linedur %d, pixeldur %d\n" , crtc->base.id, dotclock, framedur_ns, linedur_ns, pixeldur_ns); }@@ -643,7 +644,7 @@ EXPORT_SYMBOL(drm_calc_timestamping_constants);/** * drm_calc_vbltimestamp_from_scanoutpos - precise vblank timestamp helper * @dev: DRM device -* @crtc: Which CRTC's vblank timestamp to retrieve +* @pipe: index of CRTC whose vblank timestamp to retrieve * @max_error: Desired maximum allowable error in timestamps (nanosecs) * On return contains true maximum error of timestamp * @vblank_time: Pointer to struct timeval which should receive the timestamp @@ -686,7 +687,8 @@ EXPORT_SYMBOL(drm_calc_timestamping_constants);* DRM_VBLANKTIME_INVBL - Timestamp taken while scanout was in vblank interval. * */ -int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, int crtc, +int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, + unsigned int pipe, int *max_error, struct timeval *vblank_time, unsigned flags,@@ -700,8 +702,8 @@ int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, int crtc,int framedur_ns, linedur_ns, pixeldur_ns, delta_ns, duration_ns;bool invbl; -if (crtc <0 || crtc >= dev->num_crtcs) { -DRM_ERROR ("Invalid crtc %d\n" , crtc); +if (pipe >= dev->num_crtcs) { +DRM_ERROR ("Invalid crtc %u\n" , pipe);return -EINVAL ; }@@ -720,7 +722,7 @@ int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, int crtc,* Happens during initial modesetting of a crtc. */ if (framedur_ns ==0 ) { -DRM_DEBUG ("crtc %d: Noop due to uninitialized mode.\n" , crtc); +DRM_DEBUG ("crtc %u: Noop due to uninitialized mode.\n" , pipe);return -EAGAIN ; }@@ -736,13 +738,13 @@ int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, int crtc,* Get vertical and horizontal scanout position vpos, hpos, * and bounding timestamps stime, etime, pre/post query. */ - vbl_status = dev->driver->get_scanout_position (dev, crtc, flags, &vpos, + vbl_status = dev->driver->get_scanout_position (dev, pipe, flags, &vpos, &hpos, &stime, &etime);/* Return as no-op if scanout query unsupported or failed. */ if (!(vbl_status &DRM_SCANOUTPOS_VALID )) { -DRM_DEBUG ("crtc %d : scanoutpos query failed [%d].\n" , - crtc, vbl_status); +DRM_DEBUG ("crtc %u : scanoutpos query failed [%d].\n" , + pipe, vbl_status);return -EIO ; }@@ -756,8 +758,8 @@ int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, int crtc,/* Noisy system timing? */ if (i ==DRM_TIMESTAMP_MAXRETRIES ) { -DRM_DEBUG ("crtc %d: Noisy timestamp %d us > %d us [%d reps].\n" , - crtc, duration_ns/1000 , *max_error/1000 , i); +DRM_DEBUG ("crtc %u: Noisy timestamp %d us > %d us [%d reps].\n" , + pipe, duration_ns/1000 , *max_error/1000 , i); }/* Return upper bound of timestamp precision error. */ @@ -790,8 +792,8 @@ int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, int crtc, etime =ktime_sub_ns (etime, delta_ns); *vblank_time =ktime_to_timeval (etime); -DRM_DEBUG ("crtc %d : v %d p(%d,%d)@ %ld.%ld -> %ld.%ld [e %d us, %d rep]\n" , - crtc, (int )vbl_status, hpos, vpos, +DRM_DEBUG ("crtc %u : v %d p(%d,%d)@ %ld.%ld -> %ld.%ld [e %d us, %d rep]\n" , + pipe, (int )vbl_status, hpos, vpos, (long )tv_etime.tv_sec, (long )tv_etime.tv_usec, (long )vblank_time->tv_sec, (long )vblank_time->tv_usec, duration_ns/1000 , i);@@ -816,7 +818,7 @@ static struct timeval get_drm_timestamp(void)* drm_get_last_vbltimestamp - retrieve raw timestamp for the most recent * vblank interval * @dev: DRM device -* @crtc: which CRTC's vblank timestamp to retrieve +* @pipe: index of CRTC whose vblank timestamp to retrieve * @tvblank: Pointer to target struct timeval which should receive the timestamp * @flags: Flags to pass to driver: * 0 = Default, @@ -833,7 +835,7 @@ static struct timeval get_drm_timestamp(void)* True if timestamp is considered to be very precise, false otherwise. */ static bool -drm_get_last_vbltimestamp (struct drm_device *dev,int crtc, +drm_get_last_vbltimestamp (struct drm_device *dev,unsigned int pipe,struct timeval *tvblank,unsigned flags) {int ret;@@ -843,7 +845,7 @@ drm_get_last_vbltimestamp(struct drm_device *dev, int crtc,/* Query driver if possible and precision timestamping enabled. */ if (dev->driver->get_vblank_timestamp && (max_error >0 )) { - ret = dev->driver->get_vblank_timestamp (dev, crtc, &max_error, + ret = dev->driver->get_vblank_timestamp (dev, pipe, &max_error, tvblank, flags);if (ret >0 )return true;@@ -860,7 +862,7 @@ drm_get_last_vbltimestamp(struct drm_device *dev, int crtc,/** * drm_vblank_count - retrieve "cooked" vblank counter value * @dev: DRM device -* @crtc: which counter to retrieve +* @pipe: index of CRTC for which to retrieve the counter * * Fetches the "cooked" vblank count value that represents the number of * vblank events since the system was booted, including lost events due to @@ -871,11 +873,11 @@ drm_get_last_vbltimestamp(struct drm_device *dev, int crtc,* Returns: * The software vblank counter. */ -u32 drm_vblank_count (struct drm_device *dev,int crtc) +u32 drm_vblank_count (struct drm_device *dev,int pipe) { -struct drm_vblank_crtc *vblank = &dev->vblank[crtc]; +struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; -if (WARN_ON (crtc >= dev->num_crtcs)) +if (WARN_ON (pipe >= dev->num_crtcs))return 0 ;return vblank->count; }@@ -901,11 +903,10 @@ u32 drm_crtc_vblank_count(struct drm_crtc *crtc)EXPORT_SYMBOL (drm_crtc_vblank_count);/** -* drm_vblank_count_and_time - retrieve "cooked" vblank counter value -* and the system timestamp corresponding to that vblank counter value. -* +* drm_vblank_count_and_time - retrieve "cooked" vblank counter value and the +* system timestamp corresponding to that vblank counter value. * @dev: DRM device -* @crtc: which counter to retrieve +* @pipe: index of CRTC whose counter to retrieve * @vblanktime: Pointer to struct timeval to receive the vblank timestamp. * * Fetches the "cooked" vblank count value that represents the number of @@ -913,13 +914,13 @@ EXPORT_SYMBOL(drm_crtc_vblank_count);* modesetting activity. Returns corresponding system timestamp of the time * of the vblank interval that corresponds to the current vblank counter value. */ -u32 drm_vblank_count_and_time (struct drm_device *dev,int crtc, +u32 drm_vblank_count_and_time (struct drm_device *dev,unsigned int pipe,struct timeval *vblanktime) { -struct drm_vblank_crtc *vblank = &dev->vblank[crtc]; +struct drm_vblank_crtc *vblank = &dev->vblank[pipe];u32 cur_vblank; -if (WARN_ON (crtc >= dev->num_crtcs)) +if (WARN_ON (pipe >= dev->num_crtcs))return 0 ;/* @@ -930,7 +931,7 @@ u32 drm_vblank_count_and_time(struct drm_device *dev, int crtc,do { cur_vblank = vblank->count;smp_rmb (); - *vblanktime =vblanktimestamp (dev, crtc, cur_vblank); + *vblanktime =vblanktimestamp (dev, pipe, cur_vblank);smp_rmb (); }while (cur_vblank != vblank->count);@@ -957,7 +958,7 @@ static void send_vblank_event(struct drm_device *dev,/** * drm_send_vblank_event - helper to send vblank event after pageflip * @dev: DRM device -* @crtc: CRTC in question +* @pipe: CRTC index * @e: the event to send * * Updates sequence # and timestamp on event, and sends it to userspace. @@ -965,20 +966,20 @@ static void send_vblank_event(struct drm_device *dev,* * This is the legacy version of drm_crtc_send_vblank_event(). */ -void drm_send_vblank_event (struct drm_device *dev,int crtc, -struct drm_pending_vblank_event *e) +void drm_send_vblank_event (struct drm_device *dev,unsigned int pipe, +struct drm_pending_vblank_event *e) {struct timeval now;unsigned int seq;if (dev->num_crtcs >0 ) { - seq =drm_vblank_count_and_time (dev, crtc, &now); + seq =drm_vblank_count_and_time (dev, pipe, &now); }else { seq =0 ; now =get_drm_timestamp (); } - e->pipe = crtc; + e->pipe = pipe;send_vblank_event (dev, e, seq, &now); }EXPORT_SYMBOL (drm_send_vblank_event);@@ -1003,11 +1004,11 @@ EXPORT_SYMBOL(drm_crtc_send_vblank_event);/** * drm_vblank_enable - enable the vblank interrupt on a CRTC * @dev: DRM device -* @crtc: CRTC in question +* @pipe: CRTC index */ -static int drm_vblank_enable (struct drm_device *dev,int crtc) +static int drm_vblank_enable (struct drm_device *dev,unsigned int pipe) { -struct drm_vblank_crtc *vblank = &dev->vblank[crtc]; +struct drm_vblank_crtc *vblank = &dev->vblank[pipe];int ret =0 ;assert_spin_locked (&dev->vbl_lock);@@ -1022,13 +1023,13 @@ static int drm_vblank_enable(struct drm_device *dev, int crtc)* timestamps. Filtercode in drm_handle_vblank() will * prevent double-accounting of same vblank interval. */ - ret = dev->driver->enable_vblank (dev, crtc); -DRM_DEBUG ("enabling vblank on crtc %d, ret: %d\n" , crtc, ret); + ret = dev->driver->enable_vblank (dev, pipe); +DRM_DEBUG ("enabling vblank on crtc %u, ret: %d\n" , pipe, ret);if (ret)atomic_dec (&vblank->refcount);else { vblank->enabled = true; -drm_update_vblank_count (dev, crtc); +drm_update_vblank_count (dev, pipe); } }@@ -1040,7 +1041,7 @@ static int drm_vblank_enable(struct drm_device *dev, int crtc)/** * drm_vblank_get - get a reference count on vblank events * @dev: DRM device -* @crtc: which CRTC to own +* @pipe: index of CRTC to own * * Acquire a reference count on vblank events to avoid having them disabled * while in use. @@ -1050,22 +1051,22 @@ static int drm_vblank_enable(struct drm_device *dev, int crtc)* Returns: * Zero on success, nonzero on failure. */ -int drm_vblank_get (struct drm_device *dev,int crtc) +int drm_vblank_get (struct drm_device *dev,unsigned int pipe) { -struct drm_vblank_crtc *vblank = &dev->vblank[crtc]; +struct drm_vblank_crtc *vblank = &dev->vblank[pipe];unsigned long irqflags;int ret =0 ;if (!dev->num_crtcs)return -EINVAL ; -if (WARN_ON (crtc >= dev->num_crtcs)) +if (WARN_ON (pipe >= dev->num_crtcs))return -EINVAL ;spin_lock_irqsave (&dev->vbl_lock, irqflags);/* Going from 0->1 means we have to enable interrupts again */ if (atomic_add_return (1 , &vblank->refcount) ==1 ) { - ret =drm_vblank_enable (dev, crtc); + ret =drm_vblank_enable (dev, pipe); }else {if (!vblank->enabled) {atomic_dec (&vblank->refcount);@@ -1097,20 +1098,20 @@ int drm_crtc_vblank_get(struct drm_crtc *crtc)EXPORT_SYMBOL (drm_crtc_vblank_get);/** -* drm_vblank_put - give up ownership of vblank events +* drm_vblank_put - release ownership of vblank events * @dev: DRM device -* @crtc: which counter to give up +* @pipe: index of CRTC to release * * Release ownership of a given vblank counter, turning off interrupts * if possible. Disable interrupts after drm_vblank_offdelay milliseconds. * * This is the legacy version of drm_crtc_vblank_put(). */ -void drm_vblank_put (struct drm_device *dev,int crtc) +void drm_vblank_put (struct drm_device *dev,unsigned int pipe) { -struct drm_vblank_crtc *vblank = &dev->vblank[crtc]; +struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; -if (WARN_ON (crtc >= dev->num_crtcs)) +if (WARN_ON (pipe >= dev->num_crtcs))return ;if (WARN_ON (atomic_read (&vblank->refcount) ==0 ))@@ -1147,33 +1148,34 @@ EXPORT_SYMBOL(drm_crtc_vblank_put);/** * drm_wait_one_vblank - wait for one vblank * @dev: DRM device -* @crtc: crtc index +* @pipe: CRTC index * * This waits for one vblank to pass on @crtc, using the irq driver interfaces. * It is a failure to call this when the vblank irq for @crtc is disabled, e.g. * due to lack of driver support or because the crtc is off. */ -void drm_wait_one_vblank (struct drm_device *dev,int crtc) +void drm_wait_one_vblank (struct drm_device *dev,unsigned int pipe) { +struct drm_vblank_crtc *vblank = &dev->vblank[pipe];int ret;u32 last; -if (WARN_ON (crtc >= dev->num_crtcs)) +if (WARN_ON (pipe >= dev->num_crtcs))return ; - ret =drm_vblank_get (dev, crtc); -if (WARN (ret,"vblank not available on crtc %i, ret=%i\n" , crtc, ret)) + ret =drm_vblank_get (dev, pipe); +if (WARN (ret,"vblank not available on crtc %i, ret=%i\n" , pipe, ret))return ; - last =drm_vblank_count (dev, crtc); + last =drm_vblank_count (dev, pipe); - ret =wait_event_timeout (dev->vblank[crtc].queue, - last !=drm_vblank_count (dev, crtc), + ret =wait_event_timeout (vblank->queue, + last !=drm_vblank_count (dev, pipe),msecs_to_jiffies (100 )); -WARN (ret ==0 ,"vblank wait timed out on crtc %i\n" , crtc); +WARN (ret ==0 ,"vblank wait timed out on crtc %i\n" , pipe); -drm_vblank_put (dev, crtc); +drm_vblank_put (dev, pipe); }EXPORT_SYMBOL (drm_wait_one_vblank);@@ -1194,7 +1196,7 @@ EXPORT_SYMBOL(drm_crtc_wait_one_vblank);/** * drm_vblank_off - disable vblank events on a CRTC * @dev: DRM device -* @crtc: CRTC in question +* @pipe: CRTC index * * Drivers can use this function to shut down the vblank interrupt handling when * disabling a crtc. This function ensures that the latest vblank frame count is @@ -1205,21 +1207,21 @@ EXPORT_SYMBOL(drm_crtc_wait_one_vblank);* * This is the legacy version of drm_crtc_vblank_off(). */ -void drm_vblank_off (struct drm_device *dev,int crtc) +void drm_vblank_off (struct drm_device *dev,unsigned int pipe) { -struct drm_vblank_crtc *vblank = &dev->vblank[crtc]; +struct drm_vblank_crtc *vblank = &dev->vblank[pipe];struct drm_pending_vblank_event *e, *t;struct timeval now;unsigned long irqflags;unsigned int seq; -if (WARN_ON (crtc >= dev->num_crtcs)) +if (WARN_ON (pipe >= dev->num_crtcs))return ;spin_lock_irqsave (&dev->event_lock, irqflags);spin_lock (&dev->vbl_lock); -vblank_disable_and_save (dev, crtc); +vblank_disable_and_save (dev, pipe);wake_up (&vblank->queue);/* @@ -1233,16 +1235,16 @@ void drm_vblank_off(struct drm_device *dev, int crtc)spin_unlock (&dev->vbl_lock);/* Send any queued vblank events, lest the natives grow disquiet */ - seq =drm_vblank_count_and_time (dev, crtc, &now); + seq =drm_vblank_count_and_time (dev, pipe, &now);list_for_each_entry_safe (e, t, &dev->vblank_event_list, base.link) { -if (e->pipe != crtc) +if (e->pipe != pipe)continue ;DRM_DEBUG ("Sending premature vblank event on disable: \ wanted %d, current %d\n" , e->event.sequence, seq);list_del (&e->base.link); -drm_vblank_put (dev, e->pipe); +drm_vblank_put (dev, pipe);send_vblank_event (dev, e, seq, &now); }spin_unlock_irqrestore (&dev->event_lock, irqflags);@@ -1303,7 +1305,7 @@ EXPORT_SYMBOL(drm_crtc_vblank_reset);/** * drm_vblank_on - enable vblank events on a CRTC * @dev: DRM device -* @crtc: CRTC in question +* @pipe: CRTC index * * This functions restores the vblank interrupt state captured with * drm_vblank_off() again. Note that calls to drm_vblank_on() and @@ -1312,12 +1314,12 @@ EXPORT_SYMBOL(drm_crtc_vblank_reset);* * This is the legacy version of drm_crtc_vblank_on(). */ -void drm_vblank_on (struct drm_device *dev,int crtc) +void drm_vblank_on (struct drm_device *dev,unsigned int pipe) { -struct drm_vblank_crtc *vblank = &dev->vblank[crtc]; +struct drm_vblank_crtc *vblank = &dev->vblank[pipe];unsigned long irqflags; -if (WARN_ON (crtc >= dev->num_crtcs)) +if (WARN_ON (pipe >= dev->num_crtcs))return ;spin_lock_irqsave (&dev->vbl_lock, irqflags);@@ -1335,7 +1337,7 @@ void drm_vblank_on(struct drm_device *dev, int crtc)* vblank counter value before and after a modeset */ vblank->last = - (dev->driver->get_vblank_counter (dev, crtc) -1 ) & + (dev->driver->get_vblank_counter (dev, pipe) -1 ) & dev->max_vblank_count;/* * re-enable interrupts if there are users left, or the @@ -1343,7 +1345,7 @@ void drm_vblank_on(struct drm_device *dev, int crtc)*/ if (atomic_read (&vblank->refcount) !=0 || (!dev->vblank_disable_immediate && drm_vblank_offdelay ==0 )) -WARN_ON (drm_vblank_enable (dev, crtc)); +WARN_ON (drm_vblank_enable (dev, pipe));spin_unlock_irqrestore (&dev->vbl_lock, irqflags); }EXPORT_SYMBOL (drm_vblank_on);@@ -1368,7 +1370,7 @@ EXPORT_SYMBOL(drm_crtc_vblank_on);/** * drm_vblank_pre_modeset - account for vblanks across mode sets * @dev: DRM device -* @crtc: CRTC in question +* @pipe: CRTC index * * Account for vblank events across mode setting events, which will likely * reset the hardware frame counter. @@ -1388,15 +1390,15 @@ EXPORT_SYMBOL(drm_crtc_vblank_on);* Drivers must call drm_vblank_post_modeset() when re-enabling the same crtc * again. */ -void drm_vblank_pre_modeset (struct drm_device *dev,int crtc) +void drm_vblank_pre_modeset (struct drm_device *dev,unsigned int pipe) { -struct drm_vblank_crtc *vblank = &dev->vblank[crtc]; +struct drm_vblank_crtc *vblank = &dev->vblank[pipe];/* vblank is not initialized (IRQ not installed ?), or has been freed */ if (!dev->num_crtcs)return ; -if (WARN_ON (crtc >= dev->num_crtcs)) +if (WARN_ON (pipe >= dev->num_crtcs))return ;/* @@ -1408,7 +1410,7 @@ void drm_vblank_pre_modeset(struct drm_device *dev, int crtc)*/ if (!vblank->inmodeset) { vblank->inmodeset =0x1 ; -if (drm_vblank_get (dev, crtc) ==0 ) +if (drm_vblank_get (dev, pipe) ==0 ) vblank->inmodeset |=0x2 ; } }@@ -1417,21 +1419,21 @@ EXPORT_SYMBOL(drm_vblank_pre_modeset);/** * drm_vblank_post_modeset - undo drm_vblank_pre_modeset changes * @dev: DRM device -* @crtc: CRTC in question +* @pipe: CRTC index * * This function again drops the temporary vblank reference acquired in * drm_vblank_pre_modeset. */ -void drm_vblank_post_modeset (struct drm_device *dev,int crtc) +void drm_vblank_post_modeset (struct drm_device *dev,unsigned int pipe) { -struct drm_vblank_crtc *vblank = &dev->vblank[crtc]; +struct drm_vblank_crtc *vblank = &dev->vblank[pipe];unsigned long irqflags;/* vblank is not initialized (IRQ not installed ?), or has been freed */ if (!dev->num_crtcs)return ; -if (WARN_ON (crtc >= dev->num_crtcs)) +if (WARN_ON (pipe >= dev->num_crtcs))return ;if (vblank->inmodeset) {@@ -1440,7 +1442,7 @@ void drm_vblank_post_modeset(struct drm_device *dev, int crtc)spin_unlock_irqrestore (&dev->vbl_lock, irqflags);if (vblank->inmodeset &0x2 ) -drm_vblank_put (dev, crtc); +drm_vblank_put (dev, pipe); vblank->inmodeset =0 ; }@@ -1462,7 +1464,7 @@ int drm_modeset_ctl(struct drm_device *dev, void *data, struct drm_file *file_priv) {struct drm_modeset_ctl *modeset = data; -unsigned int crtc; +unsigned int pipe;/* If drm_vblank_init() hasn't been called yet, just no-op */ if (!dev->num_crtcs)@@ -1472,16 +1474,16 @@ int drm_modeset_ctl(struct drm_device *dev, void *data,if (drm_core_check_feature (dev,DRIVER_MODESET ))return 0 ; - crtc = modeset->crtc; -if (crtc >= dev->num_crtcs) + pipe = modeset->crtc; +if (pipe >= dev->num_crtcs)return -EINVAL ;switch (modeset->cmd) {case _DRM_PRE_MODESET: -drm_vblank_pre_modeset (dev, crtc); +drm_vblank_pre_modeset (dev, pipe);break ;case _DRM_POST_MODESET: -drm_vblank_post_modeset (dev, crtc); +drm_vblank_post_modeset (dev, pipe);break ;default :return -EINVAL ;@@ -1490,7 +1492,7 @@ int drm_modeset_ctl(struct drm_device *dev, void *data,return 0 ; } -static int drm_queue_vblank_event (struct drm_device *dev,int pipe, +static int drm_queue_vblank_event (struct drm_device *dev,unsigned int pipe,union drm_wait_vblank *vblwait,struct drm_file *file_priv) {@@ -1544,7 +1546,7 @@ static int drm_queue_vblank_event(struct drm_device *dev, int pipe, vblwait->reply.sequence = vblwait->request.sequence; } -DRM_DEBUG ("event on vblank count %d, current %d, crtc %d\n" , +DRM_DEBUG ("event on vblank count %d, current %d, crtc %u\n" , vblwait->request.sequence, seq, pipe); trace_drm_vblank_event_queued(current->pid, pipe,@@ -1593,7 +1595,7 @@ int drm_wait_vblank(struct drm_device *dev, void *data,struct drm_vblank_crtc *vblank;union drm_wait_vblank *vblwait = data;int ret; -unsigned int flags, seq, crtc, high_crtc; +unsigned int flags, seq, pipe, high_pipe;if (!dev->irq_enabled)return -EINVAL ;@@ -1612,22 +1614,22 @@ int drm_wait_vblank(struct drm_device *dev, void *data, } flags = vblwait->request.type & _DRM_VBLANK_FLAGS_MASK; - high_crtc = (vblwait->request.type & _DRM_VBLANK_HIGH_CRTC_MASK); -if (high_crtc) - crtc = high_crtc >> _DRM_VBLANK_HIGH_CRTC_SHIFT; + high_pipe = (vblwait->request.type & _DRM_VBLANK_HIGH_CRTC_MASK); +if (high_pipe) + pipe = high_pipe >> _DRM_VBLANK_HIGH_CRTC_SHIFT;else - crtc = flags & _DRM_VBLANK_SECONDARY ?1 :0 ; -if (crtc >= dev->num_crtcs) + pipe = flags & _DRM_VBLANK_SECONDARY ?1 :0 ; +if (pipe >= dev->num_crtcs)return -EINVAL ; - vblank = &dev->vblank[crtc]; + vblank = &dev->vblank[pipe]; - ret =drm_vblank_get (dev, crtc); + ret =drm_vblank_get (dev, pipe);if (ret) {DRM_DEBUG ("failed to acquire vblank counter, %d\n" , ret);return ret; } - seq =drm_vblank_count (dev, crtc); + seq =drm_vblank_count (dev, pipe);switch (vblwait->request.type & _DRM_VBLANK_TYPES_MASK) {case _DRM_VBLANK_RELATIVE:@@ -1644,7 +1646,7 @@ int drm_wait_vblank(struct drm_device *dev, void *data,/* must hold on to the vblank ref until the event fires * drm_vblank_put will be called asynchronously */ -return drm_queue_vblank_event (dev, crtc, vblwait, file_priv); +return drm_queue_vblank_event (dev, pipe, vblwait, file_priv); } if ((flags & _DRM_VBLANK_NEXTONMISS) &&@@ -1652,11 +1654,11 @@ int drm_wait_vblank(struct drm_device *dev, void *data, vblwait->request.sequence = seq +1 ; } -DRM_DEBUG ("waiting on vblank count %d, crtc %d\n" , - vblwait->request.sequence, crtc); +DRM_DEBUG ("waiting on vblank count %d, crtc %u\n" , + vblwait->request.sequence, pipe); vblank->last_wait = vblwait->request.sequence;DRM_WAIT_ON (ret, vblank->queue,3 *HZ , - (((drm_vblank_count (dev, crtc) - + (((drm_vblank_count (dev, pipe) - vblwait->request.sequence) <= (1 <<23 )) || !vblank->enabled || !dev->irq_enabled));@@ -1664,7 +1666,7 @@ int drm_wait_vblank(struct drm_device *dev, void *data,if (ret != -EINTR ) {struct timeval now; - vblwait->reply.sequence =drm_vblank_count_and_time (dev, crtc, &now); + vblwait->reply.sequence =drm_vblank_count_and_time (dev, pipe, &now); vblwait->reply.tval_sec = now.tv_sec; vblwait->reply.tval_usec = now.tv_usec;@@ -1675,11 +1677,11 @@ int drm_wait_vblank(struct drm_device *dev, void *data, } done: -drm_vblank_put (dev, crtc); +drm_vblank_put (dev, pipe);return ret; } -static void drm_handle_vblank_events (struct drm_device *dev,int crtc) +static void drm_handle_vblank_events (struct drm_device *dev,unsigned int pipe) {struct drm_pending_vblank_event *e, *t;struct timeval now;@@ -1687,10 +1689,10 @@ static void drm_handle_vblank_events(struct drm_device *dev, int crtc)assert_spin_locked (&dev->event_lock); - seq =drm_vblank_count_and_time (dev, crtc, &now); + seq =drm_vblank_count_and_time (dev, pipe, &now);list_for_each_entry_safe (e, t, &dev->vblank_event_list, base.link) { -if (e->pipe != crtc) +if (e->pipe != pipe)continue ;if ((seq - e->event.sequence) > (1 <<23 ))continue ;@@ -1699,26 +1701,26 @@ static void drm_handle_vblank_events(struct drm_device *dev, int crtc) e->event.sequence, seq);list_del (&e->base.link); -drm_vblank_put (dev, e->pipe); +drm_vblank_put (dev, pipe);send_vblank_event (dev, e, seq, &now); } -trace_drm_vblank_event (crtc, seq); +trace_drm_vblank_event (pipe, seq); }/** * drm_handle_vblank - handle a vblank event * @dev: DRM device -* @crtc: where this event occurred +* @pipe: index of CRTC where this event occurred * * Drivers should call this routine in their vblank interrupt handlers to * update the vblank counter and send any signals that may be pending. * * This is the legacy version of drm_crtc_handle_vblank(). */ -bool drm_handle_vblank (struct drm_device *dev,int crtc) +bool drm_handle_vblank (struct drm_device *dev,unsigned int pipe) { -struct drm_vblank_crtc *vblank = &dev->vblank[crtc]; +struct drm_vblank_crtc *vblank = &dev->vblank[pipe];u32 vblcount;s64 diff_ns;struct timeval tvblank;@@ -1727,7 +1729,7 @@ bool drm_handle_vblank(struct drm_device *dev, int crtc)if (WARN_ON_ONCE (!dev->num_crtcs))return false; -if (WARN_ON (crtc >= dev->num_crtcs)) +if (WARN_ON (pipe >= dev->num_crtcs))return false;spin_lock_irqsave (&dev->event_lock, irqflags);@@ -1751,11 +1753,11 @@ bool drm_handle_vblank(struct drm_device *dev, int crtc)/* Get current timestamp and count. */ vblcount = vblank->count; -drm_get_last_vbltimestamp (dev, crtc, &tvblank,DRM_CALLED_FROM_VBLIRQ ); +drm_get_last_vbltimestamp (dev, pipe, &tvblank,DRM_CALLED_FROM_VBLIRQ );/* Compute time difference to timestamp of last vblank */ diff_ns =timeval_to_ns (&tvblank) - -timeval_to_ns (&vblanktimestamp (dev, crtc, vblcount)); +timeval_to_ns (&vblanktimestamp (dev, pipe, vblcount));/* Update vblank timestamp and count if at least * DRM_REDUNDANT_VBLIRQ_THRESH_NS nanoseconds @@ -1767,15 +1769,15 @@ bool drm_handle_vblank(struct drm_device *dev, int crtc)* ignore those for accounting. */ if (abs64 (diff_ns) >DRM_REDUNDANT_VBLIRQ_THRESH_NS ) -store_vblank (dev, crtc,1 , &tvblank); +store_vblank (dev, pipe,1 , &tvblank);else -DRM_DEBUG ("crtc %d: Redundant vblirq ignored. diff_ns = %d\n" , - crtc, (int ) diff_ns); +DRM_DEBUG ("crtc %u: Redundant vblirq ignored. diff_ns = %d\n" , + pipe, (int ) diff_ns);spin_unlock (&dev->vblank_time_lock);wake_up (&vblank->queue); -drm_handle_vblank_events (dev, crtc); +drm_handle_vblank_events (dev, pipe);spin_unlock_irqrestore (&dev->event_lock, irqflags);include/drm/drmP.h +16
-16@@ -681,7 +681,7 @@ struct drm_minor {struct drm_pending_vblank_event {struct drm_pending_event base; -int pipe; +unsigned int pipe;struct drm_event_vblank event; };@@ -700,7 +700,7 @@ struct drm_vblank_crtc {/* for wraparound handling */ u32 last_wait;/* Last vblank seqno waited per CRTC */ unsigned int inmodeset;/* Display driver is setting mode */ -int crtc;/* crtc index */ +unsigned int pipe;/* crtc index */ bool enabled;/* so we don't call enable more than once per disable */ };@@ -920,34 +920,34 @@ void drm_clflush_virt_range(void *addr, unsigned long length);extern int drm_irq_install (struct drm_device *dev,int irq);extern int drm_irq_uninstall (struct drm_device *dev); -extern int drm_vblank_init (struct drm_device *dev,int num_crtcs); +extern int drm_vblank_init (struct drm_device *dev,unsigned int num_crtcs);extern int drm_wait_vblank (struct drm_device *dev,void *data,struct drm_file *filp); -extern u32 drm_vblank_count (struct drm_device *dev,int crtc); +extern u32 drm_vblank_count (struct drm_device *dev,int pipe);extern u32 drm_crtc_vblank_count (struct drm_crtc *crtc); -extern u32 drm_vblank_count_and_time (struct drm_device *dev,int crtc, +extern u32 drm_vblank_count_and_time (struct drm_device *dev,unsigned int pipe,struct timeval *vblanktime); -extern void drm_send_vblank_event (struct drm_device *dev,int crtc, -struct drm_pending_vblank_event *e); +extern void drm_send_vblank_event (struct drm_device *dev,unsigned int pipe, +struct drm_pending_vblank_event *e);extern void drm_crtc_send_vblank_event (struct drm_crtc *crtc,struct drm_pending_vblank_event *e); -extern bool drm_handle_vblank (struct drm_device *dev,int crtc); +extern bool drm_handle_vblank (struct drm_device *dev,unsigned int pipe);extern bool drm_crtc_handle_vblank (struct drm_crtc *crtc); -extern int drm_vblank_get (struct drm_device *dev,int crtc); -extern void drm_vblank_put (struct drm_device *dev,int crtc); +extern int drm_vblank_get (struct drm_device *dev,unsigned int pipe); +extern void drm_vblank_put (struct drm_device *dev,unsigned int pipe);extern int drm_crtc_vblank_get (struct drm_crtc *crtc);extern void drm_crtc_vblank_put (struct drm_crtc *crtc); -extern void drm_wait_one_vblank (struct drm_device *dev,int crtc); +extern void drm_wait_one_vblank (struct drm_device *dev,unsigned int pipe);extern void drm_crtc_wait_one_vblank (struct drm_crtc *crtc); -extern void drm_vblank_off (struct drm_device *dev,int crtc); -extern void drm_vblank_on (struct drm_device *dev,int crtc); +extern void drm_vblank_off (struct drm_device *dev,unsigned int pipe); +extern void drm_vblank_on (struct drm_device *dev,unsigned int pipe);extern void drm_crtc_vblank_off (struct drm_crtc *crtc);extern void drm_crtc_vblank_reset (struct drm_crtc *crtc);extern void drm_crtc_vblank_on (struct drm_crtc *crtc);extern void drm_vblank_cleanup (struct drm_device *dev); extern int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, - int crtc, int *max_error, + unsigned int pipe, int *max_error, struct timeval *vblank_time, unsigned flags, const struct drm_crtc *refcrtc,@@ -968,8 +968,8 @@ static inline wait_queue_head_t *drm_crtc_vblank_waitqueue(struct drm_crtc *crtc }/* Modesetting support */ -extern void drm_vblank_pre_modeset (struct drm_device *dev,int crtc); -extern void drm_vblank_post_modeset (struct drm_device *dev,int crtc); +extern void drm_vblank_pre_modeset (struct drm_device *dev,unsigned int pipe); +extern void drm_vblank_post_modeset (struct drm_device *dev,unsigned int pipe);/* Stub support (drm_stub.h) */ extern struct drm_master *drm_master_get (struct drm_master *master);Signature · 1 line
2.4.5
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 09/13] drm/irq: Make pipe unsigned and name consistent
Quoted 7 lines · Daniel Vetter
Quoted 6 lines · Thierry Reding
From: Thierry Reding <[email protected]>
Name all references to the pipe number (CRTC index) consistently to make it easier to distinguish which is a pipe number and which is a pointer to struct
drm_crtc.
Quoted 7 lines
Quoted 4 lines
While at it also make all references to the pipe number unsigned because there is no longer any reason why it should ever be negative.
Signed-off-by Thierry Reding <[email protected]>There's 2 "int crtc" and one "int pipe" (without the unsigned) left after this patch. Can you please do a follow-up? Applied this meanwhile.
4.3 is about to get released, and the regression for nouveau that this change introduces (https://bugzilla.kernel.org/show_bug.cgi?id=106431)
is still not fixed.
Can you remove the warn for now or explicitly allow ~0U? Don't want to start spewing warns for everyone with a pre-tesla nvidia gpu...
Thanks,
-ilia
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm/irq: More pipe/crtc consistency cleanups
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
Commit cc1ef118fc09 ("drm/irq: Make pipe unsigned and name consistent") missed a few occurrences of int pipe/crtc across various rebases. Clean the remaining ones up now.
--- drivers/gpu/drm/drm_irq.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/gpu/drm/drm_irq.c +8 -8
@@ -74,11 +74,11 @@ module_param_named(vblankoffdelay, drm_vblank_offdelay, int, 0600);module_param_named (timestamp_precision_usec, drm_timestamp_precision, int,0600 );module_param_named (timestamp_monotonic, drm_timestamp_monotonic, int,0600 ); -static void store_vblank (struct drm_device *dev,int crtc, +static void store_vblank (struct drm_device *dev,unsigned int pipe,u32 vblank_count_inc,struct timeval *t_vblank) { -struct drm_vblank_crtc *vblank = &dev->vblank[crtc]; +struct drm_vblank_crtc *vblank = &dev->vblank[pipe];u32 tslot;assert_spin_locked (&dev->vblank_time_lock);
@@ -88,7 +88,7 @@ static void store_vblank(struct drm_device *dev, int crtc,* the latching of vblank->count below. */ tslot = vblank->count + vblank_count_inc; -vblanktimestamp (dev, crtc, tslot) = *t_vblank; +vblanktimestamp (dev, pipe, tslot) = *t_vblank; }/*
@@ -867,7 +867,7 @@ drm_get_last_vbltimestamp(struct drm_device *dev, unsigned int pipe,* Returns: * The software vblank counter. */ -u32 drm_vblank_count (struct drm_device *dev,int pipe) +u32 drm_vblank_count (struct drm_device *dev,unsigned int pipe) {struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
@@ -1292,7 +1292,7 @@ EXPORT_SYMBOL(drm_crtc_vblank_off);/** * drm_crtc_vblank_reset - reset vblank state to off on a CRTC -* @drm_crtc: CRTC in question +* @crtc: CRTC in question * * Drivers can use this function to reset the vblank state to off at load time. * Drivers should use this together with the drm_crtc_vblank_off() and
@@ -1300,12 +1300,12 @@ EXPORT_SYMBOL(drm_crtc_vblank_off);* drm_crtc_vblank_off() is that this function doesn't save the vblank counter * and hence doesn't need to call any driver hooks. */ -void drm_crtc_vblank_reset (struct drm_crtc *drm_crtc) +void drm_crtc_vblank_reset (struct drm_crtc *crtc) {struct drm_device *dev = drm_crtc->dev;unsigned long irqflags; -int crtc =drm_crtc_index (drm_crtc); -struct drm_vblank_crtc *vblank = &dev->vblank[crtc]; +unsigned int pipe =drm_crtc_index (crtc); +struct drm_vblank_crtc *vblank = &dev->vblank[pipe];spin_lock_irqsave (&dev->vbl_lock, irqflags);/*
Signature · 6 lines
2.4.5 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Daniel Vetter
AppliedRe: [PATCH] drm/irq: More pipe/crtc consistency cleanups
Quoted 7 lines · Thierry Reding
From: Thierry Reding <[email protected]>
Commit
cc1ef118fc09("drm/irq: Make pipe unsigned and name consistent") missed a few occurrences of int pipe/crtc across various rebases. Clean the remaining ones up now.Signed-off-by Thierry Reding <[email protected]>
Applied to drm-misc, thanks.
-Daniel
Quoted 68 lines
--- drivers/gpu/drm/drm_irq.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)drivers/gpu/drm/drm_irq.c +8
-8@@ -74,11 +74,11 @@ module_param_named(vblankoffdelay, drm_vblank_offdelay, int, 0600);module_param_named (timestamp_precision_usec, drm_timestamp_precision, int,0600 );module_param_named (timestamp_monotonic, drm_timestamp_monotonic, int,0600 ); -static void store_vblank (struct drm_device *dev,int crtc, +static void store_vblank (struct drm_device *dev,unsigned int pipe,u32 vblank_count_inc,struct timeval *t_vblank) { -struct drm_vblank_crtc *vblank = &dev->vblank[crtc]; +struct drm_vblank_crtc *vblank = &dev->vblank[pipe];u32 tslot;assert_spin_locked (&dev->vblank_time_lock);@@ -88,7 +88,7 @@ static void store_vblank(struct drm_device *dev, int crtc,* the latching of vblank->count below. */ tslot = vblank->count + vblank_count_inc; -vblanktimestamp (dev, crtc, tslot) = *t_vblank; +vblanktimestamp (dev, pipe, tslot) = *t_vblank; }/* @@ -867,7 +867,7 @@ drm_get_last_vbltimestamp(struct drm_device *dev, unsigned int pipe,* Returns: * The software vblank counter. */ -u32 drm_vblank_count (struct drm_device *dev,int pipe) +u32 drm_vblank_count (struct drm_device *dev,unsigned int pipe) {struct drm_vblank_crtc *vblank = &dev->vblank[pipe];@@ -1292,7 +1292,7 @@ EXPORT_SYMBOL(drm_crtc_vblank_off);/** * drm_crtc_vblank_reset - reset vblank state to off on a CRTC -* @drm_crtc: CRTC in question +* @crtc: CRTC in question * * Drivers can use this function to reset the vblank state to off at load time. * Drivers should use this together with the drm_crtc_vblank_off() and @@ -1300,12 +1300,12 @@ EXPORT_SYMBOL(drm_crtc_vblank_off);* drm_crtc_vblank_off() is that this function doesn't save the vblank counter * and hence doesn't need to call any driver hooks. */ -void drm_crtc_vblank_reset (struct drm_crtc *drm_crtc) +void drm_crtc_vblank_reset (struct drm_crtc *crtc) {struct drm_device *dev = drm_crtc->dev;unsigned long irqflags; -int crtc =drm_crtc_index (drm_crtc); -struct drm_vblank_crtc *vblank = &dev->vblank[crtc]; +unsigned int pipe =drm_crtc_index (crtc); +struct drm_vblank_crtc *vblank = &dev->vblank[pipe];spin_lock_irqsave (&dev->vbl_lock, irqflags);/* Signature · 1 line
2.4.5
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 10/13 drm/irq: Add drm_crtc_vblank_count_and_time()
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
This function is the KMS native variant of drm_vblank_count_and_time(). It takes a struct drm_crtc * instead of a struct drm_device * and an index of the CRTC.
Eventually the goal is to access vblank data through the CRTC only so that the per-CRTC data can be moved to struct drm_crtc.
--- drivers/gpu/drm/drm_irq.c | 23 +++++++++++++++++++++++ include/drm/drmP.h | 2 ++ 2 files changed, 25 insertions(+)
drivers/gpu/drm/drm_irq.c +23 -0
@@ -913,6 +913,8 @@ EXPORT_SYMBOL(drm_crtc_vblank_count);* vblank events since the system was booted, including lost events due to * modesetting activity. Returns corresponding system timestamp of the time * of the vblank interval that corresponds to the current vblank counter value. +* +* This is the legacy version of drm_crtc_vblank_count_and_time(). */ u32 drm_vblank_count_and_time (struct drm_device *dev,unsigned int pipe,struct timeval *vblanktime)
@@ -939,6 +941,27 @@ u32 drm_vblank_count_and_time(struct drm_device *dev, unsigned int pipe, }EXPORT_SYMBOL (drm_vblank_count_and_time); +/** +* drm_crtc_vblank_count_and_time - retrieve "cooked" vblank counter value +* and the system timestamp corresponding to that vblank counter value +* @crtc: which counter to retrieve +* @vblanktime: Pointer to struct timeval to receive the vblank timestamp. +* +* Fetches the "cooked" vblank count value that represents the number of +* vblank events since the system was booted, including lost events due to +* modesetting activity. Returns corresponding system timestamp of the time +* of the vblank interval that corresponds to the current vblank counter value. +* +* This is the native KMS version of drm_vblank_count_and_time(). +*/ +u32 drm_crtc_vblank_count_and_time (struct drm_crtc *crtc, +struct timeval *vblanktime) +{ +return drm_vblank_count_and_time (crtc->dev,drm_crtc_index (crtc), + vblanktime); +} +EXPORT_SYMBOL (drm_crtc_vblank_count_and_time); +static void send_vblank_event (struct drm_device *dev,struct drm_pending_vblank_event *e,unsigned long seq,struct timeval *now)
include/drm/drmP.h +2 -0
@@ -927,6 +927,8 @@ extern u32 drm_vblank_count(struct drm_device *dev, int pipe);extern u32 drm_crtc_vblank_count (struct drm_crtc *crtc);extern u32 drm_vblank_count_and_time (struct drm_device *dev,unsigned int pipe,struct timeval *vblanktime); +extern u32 drm_crtc_vblank_count_and_time (struct drm_crtc *crtc, +struct timeval *vblanktime);extern void drm_send_vblank_event (struct drm_device *dev,unsigned int pipe,struct drm_pending_vblank_event *e); extern void drm_crtc_send_vblank_event(struct drm_crtc *crtc,
Signature · 6 lines
2.4.5 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 10/13] drm/irq: Add drm_crtc_vblank_count_and_time()
Quoted 10 lines · Thierry Reding
From: Thierry Reding <[email protected]>
This function is the KMS native variant of
drm_vblank_count_and_time(). It takes a structdrm_crtc* instead of a structdrm_device* and an index of the CRTC.Eventually the goal is to access vblank data through the CRTC only so that the per-CRTC data can be moved to struct
drm_crtc.Signed-off-by Thierry Reding <[email protected]>
We seem to not use this anywhere outside for drm_irq.c, so maybe just drop the kerneldoc and EXPORT_SYMBOL? The actual comment starting with "Fecthes the "cooked" vblank ..." should imo be kept.
-Daniel
Quoted 62 lines
--- drivers/gpu/drm/drm_irq.c | 23 +++++++++++++++++++++++ include/drm/drmP.h | 2 ++ 2 files changed, 25 insertions(+)drivers/gpu/drm/drm_irq.c +23
-0@@ -913,6 +913,8 @@ EXPORT_SYMBOL(drm_crtc_vblank_count);* vblank events since the system was booted, including lost events due to * modesetting activity. Returns corresponding system timestamp of the time * of the vblank interval that corresponds to the current vblank counter value. +* +* This is the legacy version of drm_crtc_vblank_count_and_time(). */ u32 drm_vblank_count_and_time (struct drm_device *dev,unsigned int pipe,struct timeval *vblanktime)@@ -939,6 +941,27 @@ u32 drm_vblank_count_and_time(struct drm_device *dev, unsigned int pipe, }EXPORT_SYMBOL (drm_vblank_count_and_time); +/** +* drm_crtc_vblank_count_and_time - retrieve "cooked" vblank counter value +* and the system timestamp corresponding to that vblank counter value +* @crtc: which counter to retrieve +* @vblanktime: Pointer to struct timeval to receive the vblank timestamp. +* +* Fetches the "cooked" vblank count value that represents the number of +* vblank events since the system was booted, including lost events due to +* modesetting activity. Returns corresponding system timestamp of the time +* of the vblank interval that corresponds to the current vblank counter value. +* +* This is the native KMS version of drm_vblank_count_and_time(). +*/ +u32 drm_crtc_vblank_count_and_time (struct drm_crtc *crtc, +struct timeval *vblanktime) +{ +return drm_vblank_count_and_time (crtc->dev,drm_crtc_index (crtc), + vblanktime); +} +EXPORT_SYMBOL (drm_crtc_vblank_count_and_time); +static void send_vblank_event (struct drm_device *dev,struct drm_pending_vblank_event *e,unsigned long seq,struct timeval *now)include/drm/drmP.h +2
-0@@ -927,6 +927,8 @@ extern u32 drm_vblank_count(struct drm_device *dev, int pipe);extern u32 drm_crtc_vblank_count (struct drm_crtc *crtc);extern u32 drm_vblank_count_and_time (struct drm_device *dev,unsigned int pipe,struct timeval *vblanktime); +extern u32 drm_crtc_vblank_count_and_time (struct drm_crtc *crtc, +struct timeval *vblanktime);extern void drm_send_vblank_event (struct drm_device *dev,unsigned int pipe,struct drm_pending_vblank_event *e); extern void drm_crtc_send_vblank_event(struct drm_crtc *crtc,Signature · 1 line
2.4.5
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 10/13] drm/irq: Add drm_crtc_vblank_count_and_time()
Quoted 7 lines · Daniel Vetter
Quoted 6 lines · Thierry Reding
From: Thierry Reding <[email protected]>
This function is the KMS native variant of
drm_vblank_count_and_time(). It takes a structdrm_crtc* instead of a structdrm_device* and an index of the CRTC.
Quoted 8 lines
Quoted 4 lines
Eventually the goal is to access vblank data through the CRTC only so that the per-CRTC data can be moved to struct
drm_crtc.Signed-off-by Thierry Reding <[email protected]>We seem to not use this anywhere outside for
drm_irq.c, so maybe just drop the kerneldoc andEXPORT_SYMBOL? The actual comment starting with "Fecthes the "cooked" vblank ..." should imo be kept.
There don't seem to be any users of this, so I guess we can ignore this for now.
Thierry
Quoted 54 lines
Quoted 54 lines
--- drivers/gpu/drm/drm_irq.c | 23 +++++++++++++++++++++++ include/drm/drmP.h | 2 ++ 2 files changed, 25 insertions(+)drivers/gpu/drm/drm_irq.c +23
-0@@ -913,6 +913,8 @@ EXPORT_SYMBOL(drm_crtc_vblank_count);* vblank events since the system was booted, including lost events due to * modesetting activity. Returns corresponding system timestamp of the time * of the vblank interval that corresponds to the current vblank counter value. +* +* This is the legacy version of drm_crtc_vblank_count_and_time(). */ u32 drm_vblank_count_and_time (struct drm_device *dev,unsigned int pipe,struct timeval *vblanktime)@@ -939,6 +941,27 @@ u32 drm_vblank_count_and_time(struct drm_device *dev, unsigned int pipe, }EXPORT_SYMBOL (drm_vblank_count_and_time); +/** +* drm_crtc_vblank_count_and_time - retrieve "cooked" vblank counter value +* and the system timestamp corresponding to that vblank counter value +* @crtc: which counter to retrieve +* @vblanktime: Pointer to struct timeval to receive the vblank timestamp. +* +* Fetches the "cooked" vblank count value that represents the number of +* vblank events since the system was booted, including lost events due to +* modesetting activity. Returns corresponding system timestamp of the time +* of the vblank interval that corresponds to the current vblank counter value. +* +* This is the native KMS version of drm_vblank_count_and_time(). +*/ +u32 drm_crtc_vblank_count_and_time (struct drm_crtc *crtc, +struct timeval *vblanktime) +{ +return drm_vblank_count_and_time (crtc->dev,drm_crtc_index (crtc), + vblanktime); +} +EXPORT_SYMBOL (drm_crtc_vblank_count_and_time); +static void send_vblank_event (struct drm_device *dev,struct drm_pending_vblank_event *e,unsigned long seq,struct timeval *now)include/drm/drmP.h +0
-0@@ -927,6 +927,8 @@ extern u32 drm_vblank_count(struct drm_device *dev, int pipe);extern u32 drm_crtc_vblank_count (struct drm_crtc *crtc);extern u32 drm_vblank_count_and_time (struct drm_device *dev,unsigned int pipe,struct timeval *vblanktime);
Quoted 13 lines
Quoted 8 lines
include/drm/drmP.h +2
-0+extern u32 drm_crtc_vblank_count_and_time (struct drm_crtc *crtc, +struct timeval *vblanktime);extern void drm_send_vblank_event (struct drm_device *dev,unsigned int pipe,struct drm_pending_vblank_event *e); extern void drm_crtc_send_vblank_event(struct drm_crtc *crtc,Signature · 1 line
2.4.5Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 10/13] drm/irq: Add drm_crtc_vblank_count_and_time()
Quoted 11 lines · Thierry Reding
Quoted 10 lines · Daniel Vetter
Quoted 9 lines · Thierry Reding
From: Thierry Reding <[email protected]>
This function is the KMS native variant of
drm_vblank_count_and_time(). It takes a structdrm_crtc* instead of a structdrm_device* and an index of the CRTC.Eventually the goal is to access vblank data through the CRTC only so that the per-CRTC data can be moved to struct
drm_crtc.
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Signed-off-by Thierry Reding <[email protected]>We seem to not use this anywhere outside for
drm_irq.c, so maybe just drop the kerneldoc andEXPORT_SYMBOL? The actual comment starting with "Fecthes the "cooked" vblank ..." should imo be kept.There don't seem to be any users of this, so I guess we can ignore this for now.
I mean removing the kerneldoc /** marker plus EXPORT_SYMBOL for the drm_vblank_count_and_time function and marking it static. Instead of this patch here, not changing this patch here.
-Daniel
Quoted 70 lines
Thierry
Quoted 67 lines
Quoted 62 lines
--- drivers/gpu/drm/drm_irq.c | 23 +++++++++++++++++++++++ include/drm/drmP.h | 2 ++ 2 files changed, 25 insertions(+)drivers/gpu/drm/drm_irq.c +23
-0@@ -913,6 +913,8 @@ EXPORT_SYMBOL(drm_crtc_vblank_count);* vblank events since the system was booted, including lost events due to * modesetting activity. Returns corresponding system timestamp of the time * of the vblank interval that corresponds to the current vblank counter value. +* +* This is the legacy version of drm_crtc_vblank_count_and_time(). */ u32 drm_vblank_count_and_time (struct drm_device *dev,unsigned int pipe,struct timeval *vblanktime)@@ -939,6 +941,27 @@ u32 drm_vblank_count_and_time(struct drm_device *dev, unsigned int pipe, }EXPORT_SYMBOL (drm_vblank_count_and_time); +/** +* drm_crtc_vblank_count_and_time - retrieve "cooked" vblank counter value +* and the system timestamp corresponding to that vblank counter value +* @crtc: which counter to retrieve +* @vblanktime: Pointer to struct timeval to receive the vblank timestamp. +* +* Fetches the "cooked" vblank count value that represents the number of +* vblank events since the system was booted, including lost events due to +* modesetting activity. Returns corresponding system timestamp of the time +* of the vblank interval that corresponds to the current vblank counter value. +* +* This is the native KMS version of drm_vblank_count_and_time(). +*/ +u32 drm_crtc_vblank_count_and_time (struct drm_crtc *crtc, +struct timeval *vblanktime) +{ +return drm_vblank_count_and_time (crtc->dev,drm_crtc_index (crtc), + vblanktime); +} +EXPORT_SYMBOL (drm_crtc_vblank_count_and_time); +static void send_vblank_event (struct drm_device *dev,struct drm_pending_vblank_event *e,unsigned long seq,struct timeval *now)include/drm/drmP.h +2
-0@@ -927,6 +927,8 @@ extern u32 drm_vblank_count(struct drm_device *dev, int pipe);extern u32 drm_crtc_vblank_count (struct drm_crtc *crtc);extern u32 drm_vblank_count_and_time (struct drm_device *dev,unsigned int pipe,struct timeval *vblanktime); +extern u32 drm_crtc_vblank_count_and_time (struct drm_crtc *crtc, +struct timeval *vblanktime);extern void drm_send_vblank_event (struct drm_device *dev,unsigned int pipe,struct drm_pending_vblank_event *e); extern void drm_crtc_send_vblank_event(struct drm_crtc *crtc,Signature · 1 line
2.4.5Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 11/13 drm/irq: Document return values more consistently
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
Some of the functions are documented inconsistently. Add Returns:
sections where missing and use consistent style to describe the return value.
--- drivers/gpu/drm/drm_irq.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_irq.c +5 -2
@@ -1028,6 +1028,9 @@ EXPORT_SYMBOL(drm_crtc_send_vblank_event);* drm_vblank_enable - enable the vblank interrupt on a CRTC * @dev: DRM device * @pipe: CRTC index +* +* Returns: +* Zero on success or a negative error code on failure. */ static int drm_vblank_enable (struct drm_device *dev,unsigned int pipe) {
@@ -1072,7 +1075,7 @@ static int drm_vblank_enable(struct drm_device *dev, unsigned int pipe)* This is the legacy version of drm_crtc_vblank_get(). * * Returns: -* Zero on success, nonzero on failure. +* Zero on success or a negative error code on failure. */ int drm_vblank_get (struct drm_device *dev,unsigned int pipe) {
@@ -1112,7 +1115,7 @@ EXPORT_SYMBOL(drm_vblank_get);* This is the native kms version of drm_vblank_get(). * * Returns: -* Zero on success, nonzero on failure. +* Zero on success or a negative error code on failure. */ int drm_crtc_vblank_get (struct drm_crtc *crtc) {
Signature · 6 lines
2.4.5 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 12/13 drm/armada: Use drm_crtc_vblank_*() API
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
Non-legacy drivers should only use this API to allow per-CRTC data to be eventually moved into struct drm_crtc.
--- drivers/gpu/drm/armada/armada_crtc.c | 17 ++++++++--------- drivers/gpu/drm/armada/armada_drv.c | 4 ++-- 2 files changed, 10 insertions(+), 11 deletions(-)
drivers/gpu/drm/armada/armada_crtc.c +8 -9
@@ -180,7 +180,7 @@ static int armada_drm_crtc_queue_frame_work(struct armada_crtc *dcrtc,unsigned long flags;int ret; - ret =drm_vblank_get (dev, dcrtc->num); + ret =drm_crtc_vblank_get (&dcrtc->crtc);if (ret) {DRM_ERROR ("failed to acquire vblank counter\n" );return ret;
@@ -194,14 +194,13 @@ static int armada_drm_crtc_queue_frame_work(struct armada_crtc *dcrtc,spin_unlock_irqrestore (&dev->event_lock, flags);if (ret) -drm_vblank_put (dev, dcrtc->num); +drm_crtc_vblank_put (&dcrtc->crtc);return ret; }static void armada_drm_crtc_complete_frame_work (struct armada_crtc *dcrtc) { -struct drm_device *dev = dcrtc->crtc.dev;struct armada_frame_work *work = dcrtc->frame_work; dcrtc->frame_work =NULL ;
@@ -209,9 +208,9 @@ static void armada_drm_crtc_complete_frame_work(struct armada_crtc *dcrtc)armada_drm_crtc_update_regs (dcrtc, work->regs);if (work->event) -drm_send_vblank_event (dev, dcrtc->num, work->event); +drm_crtc_send_vblank_event (&dcrtc->crtc, work->event); -drm_vblank_put (dev, dcrtc->num); +drm_crtc_vblank_put (&dcrtc->crtc);/* Finally, queue the process-half of the cleanup. */ __armada_drm_queue_unref_work (dcrtc->crtc.dev, work->old_fb);
@@ -365,13 +364,13 @@ static void armada_drm_crtc_irq(struct armada_crtc *dcrtc, u32 stat)DRM_ERROR ("graphics underflow on crtc %u\n" , dcrtc->num);if (stat &VSYNC_IRQ ) -drm_handle_vblank (dcrtc->crtc.dev, dcrtc->num); +drm_crtc_handle_vblank (&dcrtc->crtc);spin_lock (&dcrtc->irq_lock);list_for_each_entry_safe (e, n, &dcrtc->vbl_list, node) {list_del_init (&e->node); -drm_vblank_put (dcrtc->crtc.dev, dcrtc->num); +drm_crtc_vblank_put (&dcrtc->crtc); e->fn (dcrtc, e->data); }
@@ -546,9 +545,9 @@ static int armada_drm_crtc_mode_set(struct drm_crtc *crtc,if (interlaced ^ dcrtc->interlaced) {if (adj->flags &DRM_MODE_FLAG_INTERLACE ) -drm_vblank_get (dcrtc->crtc.dev, dcrtc->num); +drm_crtc_vblank_get (&dcrtc->crtc);else -drm_vblank_put (dcrtc->crtc.dev, dcrtc->num); +drm_crtc_vblank_put (&dcrtc->crtc); dcrtc->interlaced = interlaced; }
drivers/gpu/drm/armada/armada_drv.c +2 -2
@@ -239,7 +239,7 @@ void armada_drm_vbl_event_add(struct armada_crtc *dcrtc,if (list_empty (&evt->node)) {list_add_tail (&evt->node, &dcrtc->vbl_list); -drm_vblank_get (dcrtc->crtc.dev, dcrtc->num); +drm_crtc_vblank_get (&dcrtc->crtc); }spin_unlock_irqrestore (&dcrtc->irq_lock, flags); }
@@ -249,7 +249,7 @@ void armada_drm_vbl_event_remove(struct armada_crtc *dcrtc, {if (!list_empty (&evt->node)) {list_del_init (&evt->node); -drm_vblank_put (dcrtc->crtc.dev, dcrtc->num); +drm_crtc_vblank_put (&dcrtc->crtc); } }
Signature · 6 lines
2.4.5 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 12/13] drm/armada: Use drm_crtc_vblank_*() API
Quoted 7 lines · Thierry Reding
From: Thierry Reding <[email protected]>
Non-legacy drivers should only use this API to allow per-CRTC data to be eventually moved into struct
drm_crtc.Cc Russell King <[email protected]>Signed-off-by Thierry Reding <[email protected]>
What I don't like about the new APIs is that they lookup the CRTC number by searching the crtc list on every call to them. If that's going to be fixed, then I'm happy with this change, but if it's going to remain for a significant time, I'm really not happy.
Signature · 6 lines
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up according to speedtest.net. _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 12/13] drm/armada: Use drm_crtc_vblank_*() API
Quoted 6 lines · Russell King - ARM Linux
Quoted 5 lines · Thierry Reding
From: Thierry Reding <[email protected]>
Non-legacy drivers should only use this API to allow per-CRTC data to be eventually moved into struct
drm_crtc.
Quoted 7 lines
Quoted 2 lines
Cc Russell King <[email protected]>Signed-off-by Thierry Reding <[email protected]>What I don't like about the new APIs is that they lookup the CRTC number by searching the crtc list on every call to them. If that's going to be fixed, then I'm happy with this change, but if it's going to remain for a significant time, I'm really not happy.
This is a temporary measure. The goal is to eventually split off the VBLANK data into a per-CRTC structure, at which point there will be no longer any need for the CRTC index.
Thierry
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 13/13 drm/atomic: Use KMS VBLANK API
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
Instead of using the legacy VBLANK API, use the new KMS API. This is part of an effort to convert all existing users so that the KMS API can be changed to properly use per-CRTC data.
--- drivers/gpu/drm/drm_atomic_helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_atomic_helper.c +2 -2
@@ -966,7 +966,7 @@ drm_atomic_helper_wait_for_vblanks(struct drm_device *dev,continue ; old_crtc_state->enable = true; - old_crtc_state->last_vblank_count =drm_vblank_count (dev, i); + old_crtc_state->last_vblank_count =drm_crtc_vblank_count (crtc); }for_each_crtc_in_state (old_state, crtc, old_crtc_state, i) {
@@ -975,7 +975,7 @@ drm_atomic_helper_wait_for_vblanks(struct drm_device *dev, ret =wait_event_timeout (dev->vblank[i].queue, old_crtc_state->last_vblank_count != -drm_vblank_count (dev, i), +drm_crtc_vblank_count (crtc),msecs_to_jiffies (50 ));drm_crtc_vblank_put (crtc);
Signature · 6 lines
2.4.5 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Daniel Vetter
AppliedRe: [PATCH 13/13] drm/atomic: Use KMS VBLANK API
Quoted 7 lines · Thierry Reding
From: Thierry Reding <[email protected]>
Instead of using the legacy VBLANK API, use the new KMS API. This is part of an effort to convert all existing users so that the KMS API can be changed to properly use per-CRTC data.
Signed-off-by Thierry Reding <[email protected]>
Queued for -next, thanks for the patch.
-Daniel
Quoted 29 lines
--- drivers/gpu/drm/drm_atomic_helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/drm_atomic_helper.c +2
-2@@ -966,7 +966,7 @@ drm_atomic_helper_wait_for_vblanks(struct drm_device *dev,continue ; old_crtc_state->enable = true; - old_crtc_state->last_vblank_count =drm_vblank_count (dev, i); + old_crtc_state->last_vblank_count =drm_crtc_vblank_count (crtc); }for_each_crtc_in_state (old_state, crtc, old_crtc_state, i) {@@ -975,7 +975,7 @@ drm_atomic_helper_wait_for_vblanks(struct drm_device *dev, ret =wait_event_timeout (dev->vblank[i].queue, old_crtc_state->last_vblank_count != -drm_vblank_count (dev, i), +drm_crtc_vblank_count (crtc),msecs_to_jiffies (50 ));drm_crtc_vblank_put (crtc);Signature · 1 line
2.4.5
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Daniel Vetter
AppliedRe: [PATCH 13/13] drm/atomic: Use KMS VBLANK API
In reply to Thierry RedingQuoted 7 lines · Thierry Reding
From: Thierry Reding <[email protected]>
Instead of using the legacy VBLANK API, use the new KMS API. This is part of an effort to convert all existing users so that the KMS API can be changed to properly use per-CRTC data.
Signed-off-by Thierry Reding <[email protected]>
Queued for -next, thanks for the patch.
-Daniel
Quoted 29 lines
--- drivers/gpu/drm/drm_atomic_helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/drm_atomic_helper.c +2
-2@@ -966,7 +966,7 @@ drm_atomic_helper_wait_for_vblanks(struct drm_device *dev,continue ; old_crtc_state->enable = true; - old_crtc_state->last_vblank_count =drm_vblank_count (dev, i); + old_crtc_state->last_vblank_count =drm_crtc_vblank_count (crtc); }for_each_crtc_in_state (old_state, crtc, old_crtc_state, i) {@@ -975,7 +975,7 @@ drm_atomic_helper_wait_for_vblanks(struct drm_device *dev, ret =wait_event_timeout (dev->vblank[i].queue, old_crtc_state->last_vblank_count != -drm_vblank_count (dev, i), +drm_crtc_vblank_count (crtc),msecs_to_jiffies (50 ));drm_crtc_vblank_put (crtc);Signature · 1 line
2.4.5
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 15 lines · Thierry Reding
From: Thierry Reding <[email protected]>
If the DSI output isn't connected, then
mdfld_dsi_encoder_get_pipe()will return -1. Themdfld_dsi_dp_mode_set()function doesn't properly check for this condition and causes the following compiler warnings:CC drivers/gpu/drm/gma500/mdfld_dsi_dpi.o drivers/gpu/drm/gma500/mdfld_dsi_dpi.c: In function ‘mdfld_dsi_dpi_mode_set’: drivers/gpu/drm/gma500/mdfld_dsi_dpi.c:828:35: warning: array subscript is below array bounds [-Warray-bounds] u32 pipeconf = dev_priv->pipeconf[pipe]; ^ drivers/gpu/drm/gma500/mdfld_dsi_dpi.c:829:33: warning: array subscript is below array bounds [-Warray-bounds] u32 dspcntr = dev_priv->dspcntr[pipe]; ^
Quoted 5 lines
Fix this by checking for a valid pipe before indexing the pipeconf and dspcntr arrays.
Cc Patrik Jakobsson <[email protected]>Signed-off-by Thierry Reding <[email protected]>
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel