diff mbox

[03/13] drm/bochs: Store correct CRTC index in events

Message ID 1439391635-29166-3-git-send-email-thierry.reding@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Thierry Reding Aug. 12, 2015, 3 p.m. UTC
From: Thierry Reding <treding@nvidia.com>

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 <kraxel@redhat.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 drivers/gpu/drm/bochs/bochs_kms.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Daniel Vetter Aug. 12, 2015, 3:26 p.m. UTC | #1
On Wed, Aug 12, 2015 at 05:00:25PM +0200, Thierry Reding wrote:
> From: Thierry Reding <treding@nvidia.com>
> 
> 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 <kraxel@redhat.com>
> Signed-off-by: Thierry Reding <treding@nvidia.com>
> ---
>  drivers/gpu/drm/bochs/bochs_kms.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/bochs/bochs_kms.c b/drivers/gpu/drm/bochs/bochs_kms.c
> index 26bcd03a8cb6..c219c1de3722 100644
> --- a/drivers/gpu/drm/bochs/bochs_kms.c
> +++ b/drivers/gpu/drm/bochs/bochs_kms.c
> @@ -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);

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

>  		spin_unlock_irqrestore(&bochs->dev->event_lock, irqflags);
>  	}
>  	return 0;
> -- 
> 2.4.5
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/bochs/bochs_kms.c b/drivers/gpu/drm/bochs/bochs_kms.c
index 26bcd03a8cb6..c219c1de3722 100644
--- a/drivers/gpu/drm/bochs/bochs_kms.c
+++ b/drivers/gpu/drm/bochs/bochs_kms.c
@@ -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;