All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH xf86-video-ati 1/2] Use drmmode_crtc->scanout_id instead of 0 to check for scanout buffer
@ 2017-07-11  9:17 Michel Dänzer
       [not found] ` <20170711091752.18418-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Michel Dänzer @ 2017-07-11  9:17 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

From: Michel Dänzer <michel.daenzer@amd.com>

Preparation for following change, no functional change intended.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
---
 src/radeon_dri2.c    | 5 +++--
 src/radeon_kms.c     | 4 ++--
 src/radeon_present.c | 2 +-
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/radeon_dri2.c b/src/radeon_dri2.c
index 435bf5397..35fb60d91 100644
--- a/src/radeon_dri2.c
+++ b/src/radeon_dri2.c
@@ -728,7 +728,8 @@ can_exchange(ScrnInfoPtr pScrn, DrawablePtr draw,
 	drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
 
 	if (crtc->enabled &&
-	    (crtc->rotatedData || drmmode_crtc->scanout[0].bo))
+	    (crtc->rotatedData ||
+	     drmmode_crtc->scanout[drmmode_crtc->scanout_id].bo))
 	    return FALSE;
     }
 
@@ -777,7 +778,7 @@ can_flip(ScrnInfoPtr pScrn, DrawablePtr draw,
 	    continue;
 
 	if (!drmmode_crtc || drmmode_crtc->rotate.bo ||
-	    drmmode_crtc->scanout[0].bo)
+	    drmmode_crtc->scanout[drmmode_crtc->scanout_id].bo)
 	    return FALSE;
 
 	if (drmmode_crtc->pending_dpms_mode == DPMSModeOn)
diff --git a/src/radeon_kms.c b/src/radeon_kms.c
index 3f14b4620..955efc621 100644
--- a/src/radeon_kms.c
+++ b/src/radeon_kms.c
@@ -733,7 +733,7 @@ radeon_prime_scanout_update(PixmapDirtyUpdatePtr dirty)
 
     drmmode_crtc = xf86_crtc->driver_private;
     if (drmmode_crtc->scanout_update_pending ||
-	!drmmode_crtc->scanout[0].pixmap ||
+	!drmmode_crtc->scanout[drmmode_crtc->scanout_id].pixmap ||
 	drmmode_crtc->pending_dpms_mode != DPMSModeOn)
 	return;
 
@@ -1027,7 +1027,7 @@ radeon_scanout_update(xf86CrtcPtr xf86_crtc)
 
     if (!xf86_crtc->enabled ||
 	drmmode_crtc->scanout_update_pending ||
-	!drmmode_crtc->scanout[0].pixmap ||
+	!drmmode_crtc->scanout[drmmode_crtc->scanout_id].pixmap ||
 	drmmode_crtc->pending_dpms_mode != DPMSModeOn)
 	return;
 
diff --git a/src/radeon_present.c b/src/radeon_present.c
index e637d7868..e3a8f7e2b 100644
--- a/src/radeon_present.c
+++ b/src/radeon_present.c
@@ -249,7 +249,7 @@ radeon_present_check_unflip(ScrnInfoPtr scrn)
 	    continue;
 
 	if (!drmmode_crtc || drmmode_crtc->rotate.bo ||
-	    drmmode_crtc->scanout[0].bo)
+	    drmmode_crtc->scanout[drmmode_crtc->scanout_id].bo)
 	    return FALSE;
 
 	if (drmmode_crtc->pending_dpms_mode == DPMSModeOn)
-- 
2.13.2

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH xf86-video-ati 2/2] If a TearFree flip fails, fall back to non-TearFree operation
       [not found] ` <20170711091752.18418-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
@ 2017-07-11  9:17   ` Michel Dänzer
       [not found]     ` <20170711091752.18418-2-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
  2017-07-11 15:40   ` [PATCH xf86-video-ati 1/2] Use drmmode_crtc->scanout_id instead of 0 to check for scanout buffer Alex Deucher
  1 sibling, 1 reply; 4+ messages in thread
From: Michel Dänzer @ 2017-07-11  9:17 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

From: Michel Dänzer <michel.daenzer@amd.com>

In order to avoid possible freeze / log file spam in that case.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99769
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
---
 src/drmmode_display.c | 12 +++++++-----
 src/drmmode_display.h |  2 ++
 src/radeon_kms.c      | 21 +++++++++++++--------
 3 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 4b964b7b9..840071fe7 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -496,7 +496,7 @@ void drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
 	return;
 }
 
-static void
+void
 drmmode_crtc_scanout_destroy(drmmode_ptr drmmode,
 			     struct drmmode_scanout *scanout)
 {
@@ -770,15 +770,17 @@ drmmode_crtc_scanout_update(xf86CrtcPtr crtc, DisplayModePtr mode,
 	ScreenPtr screen = scrn->pScreen;
 	drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
 
-	drmmode_crtc_scanout_create(crtc, &drmmode_crtc->scanout[0],
+	drmmode_crtc_scanout_create(crtc, &drmmode_crtc->scanout[scanout_id],
 				    mode->HDisplay, mode->VDisplay);
 	if (drmmode_crtc->tear_free) {
-		drmmode_crtc_scanout_create(crtc, &drmmode_crtc->scanout[1],
+		drmmode_crtc_scanout_create(crtc,
+					    &drmmode_crtc->scanout[scanout_id ^ 1],
 					    mode->HDisplay, mode->VDisplay);
 	}
 
-	if (drmmode_crtc->scanout[0].pixmap &&
-	    (!drmmode_crtc->tear_free || drmmode_crtc->scanout[1].pixmap)) {
+	if (drmmode_crtc->scanout[scanout_id].pixmap &&
+	    (!drmmode_crtc->tear_free ||
+	     drmmode_crtc->scanout[scanout_id ^ 1].pixmap)) {
 		RegionPtr region;
 		BoxPtr box;
 
diff --git a/src/drmmode_display.h b/src/drmmode_display.h
index ba1a7bc89..b9bc8fd8c 100644
--- a/src/drmmode_display.h
+++ b/src/drmmode_display.h
@@ -192,6 +192,8 @@ extern Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode,
 extern void drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode);
 extern Bool drmmode_setup_colormap(ScreenPtr pScreen, ScrnInfoPtr pScrn);
 
+extern void drmmode_crtc_scanout_destroy(drmmode_ptr drmmode,
+					 struct drmmode_scanout *scanout);
 extern void drmmode_scanout_free(ScrnInfoPtr scrn);
 
 extern void drmmode_uevent_init(ScrnInfoPtr scrn, drmmode_ptr drmmode);
diff --git a/src/radeon_kms.c b/src/radeon_kms.c
index 955efc621..b22c98406 100644
--- a/src/radeon_kms.c
+++ b/src/radeon_kms.c
@@ -1008,7 +1008,9 @@ static void
 radeon_scanout_update_handler(xf86CrtcPtr crtc, uint32_t frame, uint64_t usec,
 			      void *event_data)
 {
-    radeon_scanout_do_update(crtc, 0);
+    drmmode_crtc_private_ptr drmmode_crtc = event_data;
+
+    radeon_scanout_do_update(crtc, drmmode_crtc->scanout_id);
 
     radeon_scanout_update_abort(crtc, event_data);
 }
@@ -1027,7 +1029,6 @@ radeon_scanout_update(xf86CrtcPtr xf86_crtc)
 
     if (!xf86_crtc->enabled ||
 	drmmode_crtc->scanout_update_pending ||
-	!drmmode_crtc->scanout[drmmode_crtc->scanout_id].pixmap ||
 	drmmode_crtc->pending_dpms_mode != DPMSModeOn)
 	return;
 
@@ -1128,9 +1129,17 @@ radeon_scanout_flip(ScreenPtr pScreen, RADEONInfoPtr info,
     if (drmmode_page_flip_target_relative(pRADEONEnt, drmmode_crtc,
 					  drmmode_crtc->flip_pending->handle,
 					  0, drm_queue_seq, 0) != 0) {
-	xf86DrvMsg(scrn->scrnIndex, X_WARNING, "flip queue failed in %s: %s\n",
+	xf86DrvMsg(scrn->scrnIndex, X_WARNING, "flip queue failed in %s: %s, "
+		   "TearFree inactive until next modeset\n",
 		   __func__, strerror(errno));
 	radeon_drm_abort_entry(drm_queue_seq);
+	RegionCopy(DamageRegion(drmmode_crtc->scanout_damage),
+		   &drmmode_crtc->scanout_last_region);
+	RegionEmpty(&drmmode_crtc->scanout_last_region);
+	radeon_scanout_update(xf86_crtc);
+	drmmode_crtc_scanout_destroy(drmmode_crtc->drmmode,
+				     &drmmode_crtc->scanout[scanout_id]);
+	drmmode_crtc->tear_free = FALSE;
 	return;
     }
 
@@ -1172,11 +1181,7 @@ static void RADEONBlockHandler_KMS(BLOCKHANDLER_ARGS_DECL)
 
 	    if (drmmode_crtc->tear_free)
 		radeon_scanout_flip(pScreen, info, crtc);
-	    else if (info->shadow_primary
-#if XF86_CRTC_VERSION >= 4
-		     || crtc->driverIsPerformingTransform
-#endif
-		)
+	    else if (drmmode_crtc->scanout[drmmode_crtc->scanout_id].pixmap)
 		radeon_scanout_update(crtc);
 	}
     }
-- 
2.13.2

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH xf86-video-ati 1/2] Use drmmode_crtc->scanout_id instead of 0 to check for scanout buffer
       [not found] ` <20170711091752.18418-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
  2017-07-11  9:17   ` [PATCH xf86-video-ati 2/2] If a TearFree flip fails, fall back to non-TearFree operation Michel Dänzer
@ 2017-07-11 15:40   ` Alex Deucher
  1 sibling, 0 replies; 4+ messages in thread
From: Alex Deucher @ 2017-07-11 15:40 UTC (permalink / raw)
  To: Michel Dänzer; +Cc: amd-gfx list

On Tue, Jul 11, 2017 at 5:17 AM, Michel Dänzer <michel@daenzer.net> wrote:
> From: Michel Dänzer <michel.daenzer@amd.com>
>
> Preparation for following change, no functional change intended.
>
> Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>


> ---
>  src/radeon_dri2.c    | 5 +++--
>  src/radeon_kms.c     | 4 ++--
>  src/radeon_present.c | 2 +-
>  3 files changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/src/radeon_dri2.c b/src/radeon_dri2.c
> index 435bf5397..35fb60d91 100644
> --- a/src/radeon_dri2.c
> +++ b/src/radeon_dri2.c
> @@ -728,7 +728,8 @@ can_exchange(ScrnInfoPtr pScrn, DrawablePtr draw,
>         drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
>
>         if (crtc->enabled &&
> -           (crtc->rotatedData || drmmode_crtc->scanout[0].bo))
> +           (crtc->rotatedData ||
> +            drmmode_crtc->scanout[drmmode_crtc->scanout_id].bo))
>             return FALSE;
>      }
>
> @@ -777,7 +778,7 @@ can_flip(ScrnInfoPtr pScrn, DrawablePtr draw,
>             continue;
>
>         if (!drmmode_crtc || drmmode_crtc->rotate.bo ||
> -           drmmode_crtc->scanout[0].bo)
> +           drmmode_crtc->scanout[drmmode_crtc->scanout_id].bo)
>             return FALSE;
>
>         if (drmmode_crtc->pending_dpms_mode == DPMSModeOn)
> diff --git a/src/radeon_kms.c b/src/radeon_kms.c
> index 3f14b4620..955efc621 100644
> --- a/src/radeon_kms.c
> +++ b/src/radeon_kms.c
> @@ -733,7 +733,7 @@ radeon_prime_scanout_update(PixmapDirtyUpdatePtr dirty)
>
>      drmmode_crtc = xf86_crtc->driver_private;
>      if (drmmode_crtc->scanout_update_pending ||
> -       !drmmode_crtc->scanout[0].pixmap ||
> +       !drmmode_crtc->scanout[drmmode_crtc->scanout_id].pixmap ||
>         drmmode_crtc->pending_dpms_mode != DPMSModeOn)
>         return;
>
> @@ -1027,7 +1027,7 @@ radeon_scanout_update(xf86CrtcPtr xf86_crtc)
>
>      if (!xf86_crtc->enabled ||
>         drmmode_crtc->scanout_update_pending ||
> -       !drmmode_crtc->scanout[0].pixmap ||
> +       !drmmode_crtc->scanout[drmmode_crtc->scanout_id].pixmap ||
>         drmmode_crtc->pending_dpms_mode != DPMSModeOn)
>         return;
>
> diff --git a/src/radeon_present.c b/src/radeon_present.c
> index e637d7868..e3a8f7e2b 100644
> --- a/src/radeon_present.c
> +++ b/src/radeon_present.c
> @@ -249,7 +249,7 @@ radeon_present_check_unflip(ScrnInfoPtr scrn)
>             continue;
>
>         if (!drmmode_crtc || drmmode_crtc->rotate.bo ||
> -           drmmode_crtc->scanout[0].bo)
> +           drmmode_crtc->scanout[drmmode_crtc->scanout_id].bo)
>             return FALSE;
>
>         if (drmmode_crtc->pending_dpms_mode == DPMSModeOn)
> --
> 2.13.2
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH xf86-video-ati 2/2] If a TearFree flip fails, fall back to non-TearFree operation
       [not found]     ` <20170711091752.18418-2-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
@ 2017-07-11 15:52       ` Alex Deucher
  0 siblings, 0 replies; 4+ messages in thread
From: Alex Deucher @ 2017-07-11 15:52 UTC (permalink / raw)
  To: Michel Dänzer; +Cc: amd-gfx list

On Tue, Jul 11, 2017 at 5:17 AM, Michel Dänzer <michel@daenzer.net> wrote:
> From: Michel Dänzer <michel.daenzer@amd.com>
>
> In order to avoid possible freeze / log file spam in that case.
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99769
> Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

Alex

> ---
>  src/drmmode_display.c | 12 +++++++-----
>  src/drmmode_display.h |  2 ++
>  src/radeon_kms.c      | 21 +++++++++++++--------
>  3 files changed, 22 insertions(+), 13 deletions(-)
>
> diff --git a/src/drmmode_display.c b/src/drmmode_display.c
> index 4b964b7b9..840071fe7 100644
> --- a/src/drmmode_display.c
> +++ b/src/drmmode_display.c
> @@ -496,7 +496,7 @@ void drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
>         return;
>  }
>
> -static void
> +void
>  drmmode_crtc_scanout_destroy(drmmode_ptr drmmode,
>                              struct drmmode_scanout *scanout)
>  {
> @@ -770,15 +770,17 @@ drmmode_crtc_scanout_update(xf86CrtcPtr crtc, DisplayModePtr mode,
>         ScreenPtr screen = scrn->pScreen;
>         drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
>
> -       drmmode_crtc_scanout_create(crtc, &drmmode_crtc->scanout[0],
> +       drmmode_crtc_scanout_create(crtc, &drmmode_crtc->scanout[scanout_id],
>                                     mode->HDisplay, mode->VDisplay);
>         if (drmmode_crtc->tear_free) {
> -               drmmode_crtc_scanout_create(crtc, &drmmode_crtc->scanout[1],
> +               drmmode_crtc_scanout_create(crtc,
> +                                           &drmmode_crtc->scanout[scanout_id ^ 1],
>                                             mode->HDisplay, mode->VDisplay);
>         }
>
> -       if (drmmode_crtc->scanout[0].pixmap &&
> -           (!drmmode_crtc->tear_free || drmmode_crtc->scanout[1].pixmap)) {
> +       if (drmmode_crtc->scanout[scanout_id].pixmap &&
> +           (!drmmode_crtc->tear_free ||
> +            drmmode_crtc->scanout[scanout_id ^ 1].pixmap)) {
>                 RegionPtr region;
>                 BoxPtr box;
>
> diff --git a/src/drmmode_display.h b/src/drmmode_display.h
> index ba1a7bc89..b9bc8fd8c 100644
> --- a/src/drmmode_display.h
> +++ b/src/drmmode_display.h
> @@ -192,6 +192,8 @@ extern Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode,
>  extern void drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode);
>  extern Bool drmmode_setup_colormap(ScreenPtr pScreen, ScrnInfoPtr pScrn);
>
> +extern void drmmode_crtc_scanout_destroy(drmmode_ptr drmmode,
> +                                        struct drmmode_scanout *scanout);
>  extern void drmmode_scanout_free(ScrnInfoPtr scrn);
>
>  extern void drmmode_uevent_init(ScrnInfoPtr scrn, drmmode_ptr drmmode);
> diff --git a/src/radeon_kms.c b/src/radeon_kms.c
> index 955efc621..b22c98406 100644
> --- a/src/radeon_kms.c
> +++ b/src/radeon_kms.c
> @@ -1008,7 +1008,9 @@ static void
>  radeon_scanout_update_handler(xf86CrtcPtr crtc, uint32_t frame, uint64_t usec,
>                               void *event_data)
>  {
> -    radeon_scanout_do_update(crtc, 0);
> +    drmmode_crtc_private_ptr drmmode_crtc = event_data;
> +
> +    radeon_scanout_do_update(crtc, drmmode_crtc->scanout_id);
>
>      radeon_scanout_update_abort(crtc, event_data);
>  }
> @@ -1027,7 +1029,6 @@ radeon_scanout_update(xf86CrtcPtr xf86_crtc)
>
>      if (!xf86_crtc->enabled ||
>         drmmode_crtc->scanout_update_pending ||
> -       !drmmode_crtc->scanout[drmmode_crtc->scanout_id].pixmap ||
>         drmmode_crtc->pending_dpms_mode != DPMSModeOn)
>         return;
>
> @@ -1128,9 +1129,17 @@ radeon_scanout_flip(ScreenPtr pScreen, RADEONInfoPtr info,
>      if (drmmode_page_flip_target_relative(pRADEONEnt, drmmode_crtc,
>                                           drmmode_crtc->flip_pending->handle,
>                                           0, drm_queue_seq, 0) != 0) {
> -       xf86DrvMsg(scrn->scrnIndex, X_WARNING, "flip queue failed in %s: %s\n",
> +       xf86DrvMsg(scrn->scrnIndex, X_WARNING, "flip queue failed in %s: %s, "
> +                  "TearFree inactive until next modeset\n",
>                    __func__, strerror(errno));
>         radeon_drm_abort_entry(drm_queue_seq);
> +       RegionCopy(DamageRegion(drmmode_crtc->scanout_damage),
> +                  &drmmode_crtc->scanout_last_region);
> +       RegionEmpty(&drmmode_crtc->scanout_last_region);
> +       radeon_scanout_update(xf86_crtc);
> +       drmmode_crtc_scanout_destroy(drmmode_crtc->drmmode,
> +                                    &drmmode_crtc->scanout[scanout_id]);
> +       drmmode_crtc->tear_free = FALSE;
>         return;
>      }
>
> @@ -1172,11 +1181,7 @@ static void RADEONBlockHandler_KMS(BLOCKHANDLER_ARGS_DECL)
>
>             if (drmmode_crtc->tear_free)
>                 radeon_scanout_flip(pScreen, info, crtc);
> -           else if (info->shadow_primary
> -#if XF86_CRTC_VERSION >= 4
> -                    || crtc->driverIsPerformingTransform
> -#endif
> -               )
> +           else if (drmmode_crtc->scanout[drmmode_crtc->scanout_id].pixmap)
>                 radeon_scanout_update(crtc);
>         }
>      }
> --
> 2.13.2
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-07-11 15:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-11  9:17 [PATCH xf86-video-ati 1/2] Use drmmode_crtc->scanout_id instead of 0 to check for scanout buffer Michel Dänzer
     [not found] ` <20170711091752.18418-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
2017-07-11  9:17   ` [PATCH xf86-video-ati 2/2] If a TearFree flip fails, fall back to non-TearFree operation Michel Dänzer
     [not found]     ` <20170711091752.18418-2-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
2017-07-11 15:52       ` Alex Deucher
2017-07-11 15:40   ` [PATCH xf86-video-ati 1/2] Use drmmode_crtc->scanout_id instead of 0 to check for scanout buffer Alex Deucher

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.