All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH xf86-video-ati 1/2] Call drmmode_set_desired_modes from a WindowExposures hook
@ 2017-03-01 10:02 Michel Dänzer
       [not found] ` <20170301100242.19172-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Michel Dänzer @ 2017-03-01 10:02 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

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

This is the earliest opportunity where the root window contents are
guaranteed to be initialized, and prevents drmmode_set_mode_major from
getting called before drmmode_set_desired_modes via RADEONUnblank ->
drmmode_crtc_dpms. Also, in contrast to the BlockHandler hook, this is
called when running Xorg with -pogo.

Fixes intermittently showing garbage on server startup or after server
reset.

As a bonus, this avoids trouble due to higher layers (e.g. the tigervnc
Xorg module) calling RADEONBlockHandler_oneshot repeatedly even after
we set pScreen->BlockHandler = RADEONBlockHandler_KMS.

Bugzilla: https://bugs.freedesktop.org/99457
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
---
 src/radeon.h     |  1 +
 src/radeon_kms.c | 40 ++++++++++++++++++++++++++++------------
 2 files changed, 29 insertions(+), 12 deletions(-)

diff --git a/src/radeon.h b/src/radeon.h
index bfff232c4..815c12a1d 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -523,6 +523,7 @@ typedef struct {
 
     CreateScreenResourcesProcPtr CreateScreenResources;
     CreateWindowProcPtr CreateWindow;
+    WindowExposuresProcPtr WindowExposures;
 
     Bool              IsSecondary;
 
diff --git a/src/radeon_kms.c b/src/radeon_kms.c
index 331f3f1c9..a0961199c 100644
--- a/src/radeon_kms.c
+++ b/src/radeon_kms.c
@@ -1137,17 +1137,6 @@ static void RADEONBlockHandler_KMS(BLOCKHANDLER_ARGS_DECL)
 #endif
 }
 
-static void RADEONBlockHandler_oneshot(BLOCKHANDLER_ARGS_DECL)
-{
-    SCREEN_PTR(arg);
-    ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
-    RADEONInfoPtr info = RADEONPTR(pScrn);
-
-    RADEONBlockHandler_KMS(BLOCKHANDLER_ARGS);
-
-    drmmode_set_desired_modes(pScrn, &info->drmmode, TRUE);
-}
-
 static Bool RADEONIsFastFBWorking(ScrnInfoPtr pScrn)
 {
     RADEONInfoPtr info = RADEONPTR(pScrn);
@@ -1636,6 +1625,31 @@ static Bool RADEONCreateWindow_oneshot(WindowPtr pWin)
     return ret;
 }
 
+/* When the root window is mapped, set the initial modes */
+static void RADEONWindowExposures_oneshot(WindowPtr pWin, RegionPtr pRegion
+#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1, 16, 99, 901, 0)
+					  , RegionPtr pBSRegion
+#endif
+    )
+{
+    ScreenPtr pScreen = pWin->drawable.pScreen;
+    ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
+    RADEONInfoPtr info = RADEONPTR(pScrn);
+
+    if (pWin != pScreen->root)
+	ErrorF("%s called for non-root window %p\n", __func__, pWin);
+
+    pScreen->WindowExposures = info->WindowExposures;
+#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1, 16, 99, 901, 0)
+    pScreen->WindowExposures(pWin, pRegion, RegionPtr pBSRegion);
+#else
+    pScreen->WindowExposures(pWin, pRegion);
+#endif
+
+    radeon_cs_flush_indirect(pScrn);
+    drmmode_set_desired_modes(pScrn, &info->drmmode, TRUE);
+}
+
 Bool RADEONPreInit_KMS(ScrnInfoPtr pScrn, int flags)
 {
     RADEONInfoPtr     info;
@@ -2330,6 +2344,8 @@ Bool RADEONScreenInit_KMS(SCREEN_INIT_ARGS_DECL)
 	info->CreateWindow = pScreen->CreateWindow;
 	pScreen->CreateWindow = RADEONCreateWindow_oneshot;
     }
+    info->WindowExposures = pScreen->WindowExposures;
+    pScreen->WindowExposures = RADEONWindowExposures_oneshot;
 
     /* Provide SaveScreen & wrap BlockHandler and CloseScreen */
     /* Wrap CloseScreen */
@@ -2337,7 +2353,7 @@ Bool RADEONScreenInit_KMS(SCREEN_INIT_ARGS_DECL)
     pScreen->CloseScreen = RADEONCloseScreen_KMS;
     pScreen->SaveScreen  = RADEONSaveScreen_KMS;
     info->BlockHandler = pScreen->BlockHandler;
-    pScreen->BlockHandler = RADEONBlockHandler_oneshot;
+    pScreen->BlockHandler = RADEONBlockHandler_KMS;
 
     info->CreateScreenResources = pScreen->CreateScreenResources;
     pScreen->CreateScreenResources = RADEONCreateScreenResources_KMS;
-- 
2.11.0

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

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

* [PATCH xf86-video-ati 2/2] Move DPMS check from radeon_scanout_do_update to radeon_scanout_flip
       [not found] ` <20170301100242.19172-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
@ 2017-03-01 10:02   ` Michel Dänzer
  2017-03-01 14:36   ` [PATCH xf86-video-ati 1/2] Call drmmode_set_desired_modes from a WindowExposures hook Alex Deucher
  1 sibling, 0 replies; 3+ messages in thread
From: Michel Dänzer @ 2017-03-01 10:02 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

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

When radeon_scanout_do_update is called from
drmmode_crtc_scanout_update, drmmode_crtc->pending_dpms_mode may still
be != DPMSModeOn, e.g. during server startup.

Fixes intermittently showing garbage with TearFree enabled.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
---
 src/radeon_kms.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/radeon_kms.c b/src/radeon_kms.c
index a0961199c..a9fc0676c 100644
--- a/src/radeon_kms.c
+++ b/src/radeon_kms.c
@@ -882,7 +882,6 @@ radeon_scanout_do_update(xf86CrtcPtr xf86_crtc, int scanout_id)
     Bool force;
 
     if (!xf86_crtc->enabled ||
-	drmmode_crtc->pending_dpms_mode != DPMSModeOn ||
 	!drmmode_crtc->scanout[scanout_id].pixmap)
 	return FALSE;
 
@@ -1069,7 +1068,8 @@ radeon_scanout_flip(ScreenPtr pScreen, RADEONInfoPtr info,
     uintptr_t drm_queue_seq;
     unsigned scanout_id;
 
-    if (drmmode_crtc->scanout_update_pending)
+    if (drmmode_crtc->scanout_update_pending ||
+	drmmode_crtc->pending_dpms_mode != DPMSModeOn)
 	return;
 
     scanout_id = drmmode_crtc->scanout_id ^ 1;
-- 
2.11.0

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

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

* Re: [PATCH xf86-video-ati 1/2] Call drmmode_set_desired_modes from a WindowExposures hook
       [not found] ` <20170301100242.19172-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
  2017-03-01 10:02   ` [PATCH xf86-video-ati 2/2] Move DPMS check from radeon_scanout_do_update to radeon_scanout_flip Michel Dänzer
@ 2017-03-01 14:36   ` Alex Deucher
  1 sibling, 0 replies; 3+ messages in thread
From: Alex Deucher @ 2017-03-01 14:36 UTC (permalink / raw)
  To: Michel Dänzer; +Cc: amd-gfx list

On Wed, Mar 1, 2017 at 5:02 AM, Michel Dänzer <michel@daenzer.net> wrote:
> From: Michel Dänzer <michel.daenzer@amd.com>
>
> This is the earliest opportunity where the root window contents are
> guaranteed to be initialized, and prevents drmmode_set_mode_major from
> getting called before drmmode_set_desired_modes via RADEONUnblank ->
> drmmode_crtc_dpms. Also, in contrast to the BlockHandler hook, this is
> called when running Xorg with -pogo.
>
> Fixes intermittently showing garbage on server startup or after server
> reset.
>
> As a bonus, this avoids trouble due to higher layers (e.g. the tigervnc
> Xorg module) calling RADEONBlockHandler_oneshot repeatedly even after
> we set pScreen->BlockHandler = RADEONBlockHandler_KMS.
>
> Bugzilla: https://bugs.freedesktop.org/99457
> Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>

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

> ---
>  src/radeon.h     |  1 +
>  src/radeon_kms.c | 40 ++++++++++++++++++++++++++++------------
>  2 files changed, 29 insertions(+), 12 deletions(-)
>
> diff --git a/src/radeon.h b/src/radeon.h
> index bfff232c4..815c12a1d 100644
> --- a/src/radeon.h
> +++ b/src/radeon.h
> @@ -523,6 +523,7 @@ typedef struct {
>
>      CreateScreenResourcesProcPtr CreateScreenResources;
>      CreateWindowProcPtr CreateWindow;
> +    WindowExposuresProcPtr WindowExposures;
>
>      Bool              IsSecondary;
>
> diff --git a/src/radeon_kms.c b/src/radeon_kms.c
> index 331f3f1c9..a0961199c 100644
> --- a/src/radeon_kms.c
> +++ b/src/radeon_kms.c
> @@ -1137,17 +1137,6 @@ static void RADEONBlockHandler_KMS(BLOCKHANDLER_ARGS_DECL)
>  #endif
>  }
>
> -static void RADEONBlockHandler_oneshot(BLOCKHANDLER_ARGS_DECL)
> -{
> -    SCREEN_PTR(arg);
> -    ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
> -    RADEONInfoPtr info = RADEONPTR(pScrn);
> -
> -    RADEONBlockHandler_KMS(BLOCKHANDLER_ARGS);
> -
> -    drmmode_set_desired_modes(pScrn, &info->drmmode, TRUE);
> -}
> -
>  static Bool RADEONIsFastFBWorking(ScrnInfoPtr pScrn)
>  {
>      RADEONInfoPtr info = RADEONPTR(pScrn);
> @@ -1636,6 +1625,31 @@ static Bool RADEONCreateWindow_oneshot(WindowPtr pWin)
>      return ret;
>  }
>
> +/* When the root window is mapped, set the initial modes */
> +static void RADEONWindowExposures_oneshot(WindowPtr pWin, RegionPtr pRegion
> +#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1, 16, 99, 901, 0)
> +                                         , RegionPtr pBSRegion
> +#endif
> +    )
> +{
> +    ScreenPtr pScreen = pWin->drawable.pScreen;
> +    ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
> +    RADEONInfoPtr info = RADEONPTR(pScrn);
> +
> +    if (pWin != pScreen->root)
> +       ErrorF("%s called for non-root window %p\n", __func__, pWin);
> +
> +    pScreen->WindowExposures = info->WindowExposures;
> +#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1, 16, 99, 901, 0)
> +    pScreen->WindowExposures(pWin, pRegion, RegionPtr pBSRegion);
> +#else
> +    pScreen->WindowExposures(pWin, pRegion);
> +#endif
> +
> +    radeon_cs_flush_indirect(pScrn);
> +    drmmode_set_desired_modes(pScrn, &info->drmmode, TRUE);
> +}
> +
>  Bool RADEONPreInit_KMS(ScrnInfoPtr pScrn, int flags)
>  {
>      RADEONInfoPtr     info;
> @@ -2330,6 +2344,8 @@ Bool RADEONScreenInit_KMS(SCREEN_INIT_ARGS_DECL)
>         info->CreateWindow = pScreen->CreateWindow;
>         pScreen->CreateWindow = RADEONCreateWindow_oneshot;
>      }
> +    info->WindowExposures = pScreen->WindowExposures;
> +    pScreen->WindowExposures = RADEONWindowExposures_oneshot;
>
>      /* Provide SaveScreen & wrap BlockHandler and CloseScreen */
>      /* Wrap CloseScreen */
> @@ -2337,7 +2353,7 @@ Bool RADEONScreenInit_KMS(SCREEN_INIT_ARGS_DECL)
>      pScreen->CloseScreen = RADEONCloseScreen_KMS;
>      pScreen->SaveScreen  = RADEONSaveScreen_KMS;
>      info->BlockHandler = pScreen->BlockHandler;
> -    pScreen->BlockHandler = RADEONBlockHandler_oneshot;
> +    pScreen->BlockHandler = RADEONBlockHandler_KMS;
>
>      info->CreateScreenResources = pScreen->CreateScreenResources;
>      pScreen->CreateScreenResources = RADEONCreateScreenResources_KMS;
> --
> 2.11.0
>
> _______________________________________________
> 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] 3+ messages in thread

end of thread, other threads:[~2017-03-01 14:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-01 10:02 [PATCH xf86-video-ati 1/2] Call drmmode_set_desired_modes from a WindowExposures hook Michel Dänzer
     [not found] ` <20170301100242.19172-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
2017-03-01 10:02   ` [PATCH xf86-video-ati 2/2] Move DPMS check from radeon_scanout_do_update to radeon_scanout_flip Michel Dänzer
2017-03-01 14:36   ` [PATCH xf86-video-ati 1/2] Call drmmode_set_desired_modes from a WindowExposures hook 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.