Re: [PATCH xf86-video-ati 5/5] Remove drmmode_crtc_private_rec::present_vblank_* related code

2018-08-16 Thread Alex Deucher
On Thu, Aug 16, 2018 at 12:20 PM Michel Dänzer  wrote:
>
> From: Michel Dänzer 
>
> Not needed anymore with the more robust mechanisms for preventing nested
> drmHandleEvent calls introduced in the previous changes.
>
> (Ported from amdgpu commit 85cd8eef0cbed7b409b07f58d76dacd34aa3ddea)
>
> Signed-off-by: Michel Dänzer 

Series is:
Acked-by: Alex Deucher 

> ---
>  src/drmmode_display.h |  8 
>  src/radeon_kms.c  |  9 -
>  src/radeon_present.c  | 34 +++---
>  3 files changed, 3 insertions(+), 48 deletions(-)
>
> diff --git a/src/drmmode_display.h b/src/drmmode_display.h
> index a039bf8fb..bc66eda65 100644
> --- a/src/drmmode_display.h
> +++ b/src/drmmode_display.h
> @@ -111,14 +111,6 @@ typedef struct {
>  struct drmmode_fb *flip_pending;
>  /* The FB currently being scanned out by this CRTC, if any */
>  struct drmmode_fb *fb;
> -
> -#ifdef HAVE_PRESENT_H
> -/* Deferred processing of Present vblank event */
> -uint64_t present_vblank_event_id;
> -uint64_t present_vblank_usec;
> -unsigned present_vblank_msc;
> -Bool present_flip_expected;
> -#endif
>  } drmmode_crtc_private_rec, *drmmode_crtc_private_ptr;
>
>  typedef struct {
> diff --git a/src/radeon_kms.c b/src/radeon_kms.c
> index 809d24469..a24776811 100644
> --- a/src/radeon_kms.c
> +++ b/src/radeon_kms.c
> @@ -541,15 +541,6 @@ radeon_scanout_flip_handler(xf86CrtcPtr crtc, uint32_t 
> msc, uint64_t usec,
>  drmmode_fb_reference(pRADEONEnt->fd, _crtc->fb,
>  drmmode_crtc->flip_pending);
>  radeon_scanout_flip_abort(crtc, event_data);
> -
> -#ifdef HAVE_PRESENT_H
> -if (drmmode_crtc->present_vblank_event_id) {
> -   present_event_notify(drmmode_crtc->present_vblank_event_id,
> -drmmode_crtc->present_vblank_usec,
> -drmmode_crtc->present_vblank_msc);
> -   drmmode_crtc->present_vblank_event_id = 0;
> -}
> -#endif
>  }
>
>
> diff --git a/src/radeon_present.c b/src/radeon_present.c
> index ffc14a0e8..d0a0c68ca 100644
> --- a/src/radeon_present.c
> +++ b/src/radeon_present.c
> @@ -52,7 +52,6 @@ static present_screen_info_rec radeon_present_screen_info;
>
>  struct radeon_present_vblank_event {
>  uint64_t event_id;
> -Bool vblank_for_flip;
>  Bool unflip;
>  };
>
> @@ -120,26 +119,9 @@ static void
>  radeon_present_vblank_handler(xf86CrtcPtr crtc, unsigned int msc,
>   uint64_t usec, void *data)
>  {
> -drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
>  struct radeon_present_vblank_event *event = data;
>
> -if (event->vblank_for_flip &&
> -   drmmode_crtc->tear_free &&
> -   drmmode_crtc->scanout_update_pending) {
> -   if (drmmode_crtc->present_vblank_event_id != 0) {
> -   xf86DrvMsg(crtc->scrn->scrnIndex, X_WARNING,
> -  "Need to handle previously deferred vblank event\n");
> -   present_event_notify(drmmode_crtc->present_vblank_event_id,
> -drmmode_crtc->present_vblank_usec,
> -drmmode_crtc->present_vblank_msc);
> -   }
> -
> -   drmmode_crtc->present_vblank_event_id = event->event_id;
> -   drmmode_crtc->present_vblank_msc = msc;
> -   drmmode_crtc->present_vblank_usec = usec;
> -} else
> -   present_event_notify(event->event_id, usec, msc);
> -
> +present_event_notify(event->event_id, usec, msc);
>  free(event);
>  }
>
> @@ -162,7 +144,6 @@ static int
>  radeon_present_queue_vblank(RRCrtcPtr crtc, uint64_t event_id, uint64_t msc)
>  {
>  xf86CrtcPtr xf86_crtc = crtc->devPrivate;
> -drmmode_crtc_private_ptr drmmode_crtc = xf86_crtc->driver_private;
>  ScreenPtr screen = crtc->pScreen;
>  struct radeon_present_vblank_event *event;
>  uintptr_t drm_queue_seq;
> @@ -171,8 +152,6 @@ radeon_present_queue_vblank(RRCrtcPtr crtc, uint64_t 
> event_id, uint64_t msc)
>  if (!event)
> return BadAlloc;
>  event->event_id = event_id;
> -event->vblank_for_flip = drmmode_crtc->present_flip_expected;
> -drmmode_crtc->present_flip_expected = FALSE;
>
>  drm_queue_seq = radeon_drm_queue_alloc(xf86_crtc,
>RADEON_DRM_QUEUE_CLIENT_DEFAULT,
> @@ -272,7 +251,6 @@ radeon_present_check_flip(RRCrtcPtr crtc, WindowPtr 
> window, PixmapPtr pixmap,
>   Bool sync_flip)
>  {
>  xf86CrtcPtr xf86_crtc = crtc->devPrivate;
> -drmmode_crtc_private_ptr drmmode_crtc = xf86_crtc->driver_private;
>  ScreenPtr screen = window->drawable.pScreen;
>  ScrnInfoPtr scrn = xf86_crtc->scrn;
>  xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
> @@ -281,8 +259,6 @@ radeon_present_check_flip(RRCrtcPtr crtc, WindowPtr 
> window, PixmapPtr pixmap,
>  int num_crtcs_on;
>  int i;
>
> -drmmode_crtc->present_flip_expected = FALSE;
> -
>  if (!scrn->vtSema)
> return 

[PATCH xf86-video-ati 5/5] Remove drmmode_crtc_private_rec::present_vblank_* related code

2018-08-16 Thread Michel Dänzer
From: Michel Dänzer 

Not needed anymore with the more robust mechanisms for preventing nested
drmHandleEvent calls introduced in the previous changes.

(Ported from amdgpu commit 85cd8eef0cbed7b409b07f58d76dacd34aa3ddea)

Signed-off-by: Michel Dänzer 
---
 src/drmmode_display.h |  8 
 src/radeon_kms.c  |  9 -
 src/radeon_present.c  | 34 +++---
 3 files changed, 3 insertions(+), 48 deletions(-)

diff --git a/src/drmmode_display.h b/src/drmmode_display.h
index a039bf8fb..bc66eda65 100644
--- a/src/drmmode_display.h
+++ b/src/drmmode_display.h
@@ -111,14 +111,6 @@ typedef struct {
 struct drmmode_fb *flip_pending;
 /* The FB currently being scanned out by this CRTC, if any */
 struct drmmode_fb *fb;
-
-#ifdef HAVE_PRESENT_H
-/* Deferred processing of Present vblank event */
-uint64_t present_vblank_event_id;
-uint64_t present_vblank_usec;
-unsigned present_vblank_msc;
-Bool present_flip_expected;
-#endif
 } drmmode_crtc_private_rec, *drmmode_crtc_private_ptr;
 
 typedef struct {
diff --git a/src/radeon_kms.c b/src/radeon_kms.c
index 809d24469..a24776811 100644
--- a/src/radeon_kms.c
+++ b/src/radeon_kms.c
@@ -541,15 +541,6 @@ radeon_scanout_flip_handler(xf86CrtcPtr crtc, uint32_t 
msc, uint64_t usec,
 drmmode_fb_reference(pRADEONEnt->fd, _crtc->fb,
 drmmode_crtc->flip_pending);
 radeon_scanout_flip_abort(crtc, event_data);
-
-#ifdef HAVE_PRESENT_H
-if (drmmode_crtc->present_vblank_event_id) {
-   present_event_notify(drmmode_crtc->present_vblank_event_id,
-drmmode_crtc->present_vblank_usec,
-drmmode_crtc->present_vblank_msc);
-   drmmode_crtc->present_vblank_event_id = 0;
-}
-#endif
 }
 
 
diff --git a/src/radeon_present.c b/src/radeon_present.c
index ffc14a0e8..d0a0c68ca 100644
--- a/src/radeon_present.c
+++ b/src/radeon_present.c
@@ -52,7 +52,6 @@ static present_screen_info_rec radeon_present_screen_info;
 
 struct radeon_present_vblank_event {
 uint64_t event_id;
-Bool vblank_for_flip;
 Bool unflip;
 };
 
@@ -120,26 +119,9 @@ static void
 radeon_present_vblank_handler(xf86CrtcPtr crtc, unsigned int msc,
  uint64_t usec, void *data)
 {
-drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
 struct radeon_present_vblank_event *event = data;
 
-if (event->vblank_for_flip &&
-   drmmode_crtc->tear_free &&
-   drmmode_crtc->scanout_update_pending) {
-   if (drmmode_crtc->present_vblank_event_id != 0) {
-   xf86DrvMsg(crtc->scrn->scrnIndex, X_WARNING,
-  "Need to handle previously deferred vblank event\n");
-   present_event_notify(drmmode_crtc->present_vblank_event_id,
-drmmode_crtc->present_vblank_usec,
-drmmode_crtc->present_vblank_msc);
-   }
-
-   drmmode_crtc->present_vblank_event_id = event->event_id;
-   drmmode_crtc->present_vblank_msc = msc;
-   drmmode_crtc->present_vblank_usec = usec;
-} else
-   present_event_notify(event->event_id, usec, msc);
-
+present_event_notify(event->event_id, usec, msc);
 free(event);
 }
 
@@ -162,7 +144,6 @@ static int
 radeon_present_queue_vblank(RRCrtcPtr crtc, uint64_t event_id, uint64_t msc)
 {
 xf86CrtcPtr xf86_crtc = crtc->devPrivate;
-drmmode_crtc_private_ptr drmmode_crtc = xf86_crtc->driver_private;
 ScreenPtr screen = crtc->pScreen;
 struct radeon_present_vblank_event *event;
 uintptr_t drm_queue_seq;
@@ -171,8 +152,6 @@ radeon_present_queue_vblank(RRCrtcPtr crtc, uint64_t 
event_id, uint64_t msc)
 if (!event)
return BadAlloc;
 event->event_id = event_id;
-event->vblank_for_flip = drmmode_crtc->present_flip_expected;
-drmmode_crtc->present_flip_expected = FALSE;
 
 drm_queue_seq = radeon_drm_queue_alloc(xf86_crtc,
   RADEON_DRM_QUEUE_CLIENT_DEFAULT,
@@ -272,7 +251,6 @@ radeon_present_check_flip(RRCrtcPtr crtc, WindowPtr window, 
PixmapPtr pixmap,
  Bool sync_flip)
 {
 xf86CrtcPtr xf86_crtc = crtc->devPrivate;
-drmmode_crtc_private_ptr drmmode_crtc = xf86_crtc->driver_private;
 ScreenPtr screen = window->drawable.pScreen;
 ScrnInfoPtr scrn = xf86_crtc->scrn;
 xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
@@ -281,8 +259,6 @@ radeon_present_check_flip(RRCrtcPtr crtc, WindowPtr window, 
PixmapPtr pixmap,
 int num_crtcs_on;
 int i;
 
-drmmode_crtc->present_flip_expected = FALSE;
-
 if (!scrn->vtSema)
return FALSE;
 
@@ -313,7 +289,6 @@ radeon_present_check_flip(RRCrtcPtr crtc, WindowPtr window, 
PixmapPtr pixmap,
 if (num_crtcs_on == 0)
return FALSE;
 
-drmmode_crtc->present_flip_expected = TRUE;
 return TRUE;
 }
 
@@ -354,7 +329,6 @@ radeon_present_flip(RRCrtcPtr crtc, uint64_t event_id, 
uint64_t target_msc,