All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH xf86-video-ati 00/21] Port outstanding changes frm
@ 2018-07-11 17:27 Michel Dänzer
       [not found] ` <20180711172806.22849-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
  0 siblings, 1 reply; 23+ messages in thread
From: Michel Dänzer @ 2018-07-11 17:27 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

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

These are ports of the outstanding applicable changes from the amdgpu
driver.

Emil Velikov (1):
  Do not export the DriverRec RADEON

Jim Qu (1):
  Wait for pending scanout update before calling
    drmmode_crtc_scanout_free

Keith Packard (3):
  modesetting: Record non-desktop kernel property at PreInit time
  modesetting: Create CONNECTOR_ID properties for outputs [v2]
  Add RandR leases support

Michel Dänzer (16):
  Ignore RADEON_DRM_QUEUE_ERROR (0) in radeon_drm_abort_entry
  Track DRM event queue sequence number in scanout_update_pending
  Abort scanout_update_pending event when possible
  Update RandR CRTC state if set_mode_major fails in set_desired_modes
  Simplify drmmode_crtc_scanout_update
  Don't call scanout_flip/update with a legacy RandR scanout buffer
  Simplify drmmode_handle_transform
  Set drmmode_crtc->scanout_id = 0 when TearFree is disabled
  Refactor drmmode_output_set_tear_free helper
  Wait for pending flips in drmmode_output_set_tear_free
  Replace 'foo == NULL' with '!foo'
  Call drmmode_do_crtc_dpms from drmmode_crtc_dpms as well
  Use drmmode_crtc_dpms in drmmode_set_desired_modes
  Check dimensions passed to drmmode_xf86crtc_resize
  Remove #if 0'd code
  Call drmmode_crtc_gamma_do_set from drmmode_setup_colormap

 configure.ac                 |   4 +-
 src/ati.c                    |   4 +-
 src/drmmode_display.c        | 344 ++++++++++++++++++++++++++++-------
 src/drmmode_display.h        |   8 +-
 src/evergreen_exa.c          |  10 +-
 src/r600_exa.c               |  10 +-
 src/radeon.h                 |   2 +-
 src/radeon_dri2.c            |  12 +-
 src/radeon_drm_queue.c       |   3 +
 src/radeon_exa.c             |   2 +-
 src/radeon_exa_funcs.c       |   8 +-
 src/radeon_exa_render.c      |   6 +-
 src/radeon_glamor.c          |   2 +-
 src/radeon_glamor_wrappers.c |   4 +-
 src/radeon_kms.c             |  45 ++---
 src/radeon_probe.c           |   2 +-
 src/radeon_textured_video.c  |  10 +-
 src/radeon_video.c           |   6 +-
 18 files changed, 352 insertions(+), 130 deletions(-)

-- 
2.18.0

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

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

* [PATCH xf86-video-ati 01/21] Wait for pending scanout update before calling drmmode_crtc_scanout_free
       [not found] ` <20180711172806.22849-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
@ 2018-07-11 17:27   ` Michel Dänzer
  2018-07-11 17:27   ` [PATCH xf86-video-ati 02/21] Do not export the DriverRec RADEON Michel Dänzer
                     ` (20 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: Michel Dänzer @ 2018-07-11 17:27 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

From: Jim Qu <Jim.Qu@amd.com>

There is a case that when set screen from reverse to normal, the old
scanout damage is freed in modesetting before scanout update handler,
so it causes segment fault issue.

Signed-off-by: Jim Qu <Jim.Qu@amd.com>

[ Michel Dänzer: Only call drmmode_crtc_wait_pending_event before
  drmmode_crtc_scanout_free is actually called, slightly tweak commit
  message ]
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
(Ported from amdgpu commit 9f6a8905611b5b1d8fcd31bebbc9af7ca1355cc3)

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

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 2773ce672..b3e5cc991 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -985,9 +985,11 @@ done:
 
 		if (drmmode_crtc->scanout[scanout_id].pixmap &&
 		    fb != radeon_pixmap_get_fb(drmmode_crtc->
-					       scanout[scanout_id].pixmap))
+					       scanout[scanout_id].pixmap)) {
+			drmmode_crtc_wait_pending_event(drmmode_crtc, pRADEONEnt->fd,
+							drmmode_crtc->scanout_update_pending);
 			drmmode_crtc_scanout_free(drmmode_crtc);
-		else if (!drmmode_crtc->tear_free) {
+		} else if (!drmmode_crtc->tear_free) {
 			drmmode_crtc_scanout_destroy(drmmode,
 						     &drmmode_crtc->scanout[1]);
 		}
-- 
2.18.0

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

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

* [PATCH xf86-video-ati 02/21] Do not export the DriverRec RADEON
       [not found] ` <20180711172806.22849-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
  2018-07-11 17:27   ` [PATCH xf86-video-ati 01/21] Wait for pending scanout update before calling drmmode_crtc_scanout_free Michel Dänzer
@ 2018-07-11 17:27   ` Michel Dänzer
  2018-07-11 17:27   ` [PATCH xf86-video-ati 03/21] Ignore RADEON_DRM_QUEUE_ERROR (0) in radeon_drm_abort_entry Michel Dänzer
                     ` (19 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: Michel Dänzer @ 2018-07-11 17:27 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

From: Emil Velikov <emil.velikov@collabora.com>

Unused externally and should not be exported.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
(Ported from amdgpu commit 7fb8b49895e225b3908c8bd186539de23afe91d1)
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
---
 src/radeon_probe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/radeon_probe.c b/src/radeon_probe.c
index 19295f00c..04f9e5590 100644
--- a/src/radeon_probe.c
+++ b/src/radeon_probe.c
@@ -278,7 +278,7 @@ radeon_platform_probe(DriverPtr pDriver,
 }
 #endif
 
-_X_EXPORT DriverRec RADEON =
+DriverRec RADEON =
 {
     RADEON_VERSION_CURRENT,
     RADEON_DRIVER_NAME,
-- 
2.18.0

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

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

* [PATCH xf86-video-ati 03/21] Ignore RADEON_DRM_QUEUE_ERROR (0) in radeon_drm_abort_entry
       [not found] ` <20180711172806.22849-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
  2018-07-11 17:27   ` [PATCH xf86-video-ati 01/21] Wait for pending scanout update before calling drmmode_crtc_scanout_free Michel Dänzer
  2018-07-11 17:27   ` [PATCH xf86-video-ati 02/21] Do not export the DriverRec RADEON Michel Dänzer
@ 2018-07-11 17:27   ` Michel Dänzer
  2018-07-11 17:27   ` [PATCH xf86-video-ati 04/21] Track DRM event queue sequence number in scanout_update_pending Michel Dänzer
                     ` (18 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: Michel Dänzer @ 2018-07-11 17:27 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

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

This allows a following change to be slightly simpler.
(Ported from amdgpu commit 8fcc3a9b43d3907052a83a96e5a2423afab5ad3f)

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

diff --git a/src/radeon_drm_queue.c b/src/radeon_drm_queue.c
index 869f95c32..ac775f86a 100644
--- a/src/radeon_drm_queue.c
+++ b/src/radeon_drm_queue.c
@@ -150,6 +150,9 @@ radeon_drm_abort_entry(uintptr_t seq)
 {
     struct radeon_drm_queue_entry *e, *tmp;
 
+    if (seq == RADEON_DRM_QUEUE_ERROR)
+	return;
+
     xorg_list_for_each_entry_safe(e, tmp, &radeon_drm_queue, list) {
 	if (e->seq == seq) {
 	    radeon_drm_abort_one(e);
-- 
2.18.0

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

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

* [PATCH xf86-video-ati 04/21] Track DRM event queue sequence number in scanout_update_pending
       [not found] ` <20180711172806.22849-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
                     ` (2 preceding siblings ...)
  2018-07-11 17:27   ` [PATCH xf86-video-ati 03/21] Ignore RADEON_DRM_QUEUE_ERROR (0) in radeon_drm_abort_entry Michel Dänzer
@ 2018-07-11 17:27   ` Michel Dänzer
  2018-07-11 17:27   ` [PATCH xf86-video-ati 05/21] Abort scanout_update_pending event when possible Michel Dänzer
                     ` (17 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: Michel Dänzer @ 2018-07-11 17:27 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

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

Preparation for next change, no behaviour change intended.
(Ported from amdgpu commit 04a5c5f7cfacad8d9ccffe81e388cc3da2036cb5)

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
---
 src/drmmode_display.h |  2 +-
 src/radeon_kms.c      | 16 ++++++++--------
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/drmmode_display.h b/src/drmmode_display.h
index 23460fdc0..27c23c1a4 100644
--- a/src/drmmode_display.h
+++ b/src/drmmode_display.h
@@ -88,7 +88,7 @@ typedef struct {
     Bool ignore_damage;
     RegionRec scanout_last_region;
     unsigned scanout_id;
-    Bool scanout_update_pending;
+    uintptr_t scanout_update_pending;
     Bool tear_free;
 
     PixmapPtr prime_scanout_pixmap;
diff --git a/src/radeon_kms.c b/src/radeon_kms.c
index 72e60831e..cdda8962e 100644
--- a/src/radeon_kms.c
+++ b/src/radeon_kms.c
@@ -526,7 +526,7 @@ radeon_scanout_flip_abort(xf86CrtcPtr crtc, void *event_data)
     RADEONEntPtr pRADEONEnt = RADEONEntPriv(crtc->scrn);
     drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
 
-    drmmode_crtc->scanout_update_pending = FALSE;
+    drmmode_crtc->scanout_update_pending = 0;
     drmmode_fb_reference(pRADEONEnt->fd, &drmmode_crtc->flip_pending,
 			 NULL);
 }
@@ -611,7 +611,7 @@ radeon_prime_scanout_update_abort(xf86CrtcPtr crtc, void *event_data)
 {
     drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
 
-    drmmode_crtc->scanout_update_pending = FALSE;
+    drmmode_crtc->scanout_update_pending = 0;
 }
 
 void
@@ -752,7 +752,7 @@ radeon_prime_scanout_update_handler(xf86CrtcPtr crtc, uint32_t frame, uint64_t u
     drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
 
     radeon_prime_scanout_do_update(crtc, 0);
-    drmmode_crtc->scanout_update_pending = FALSE;
+    drmmode_crtc->scanout_update_pending = 0;
 }
 
 static void
@@ -793,7 +793,7 @@ radeon_prime_scanout_update(PixmapDirtyUpdatePtr dirty)
 	return;
     }
 
-    drmmode_crtc->scanout_update_pending = TRUE;
+    drmmode_crtc->scanout_update_pending = drm_queue_seq;
 }
 
 static void
@@ -851,7 +851,7 @@ radeon_prime_scanout_flip(PixmapDirtyUpdatePtr ent)
     }
 
     drmmode_crtc->scanout_id = scanout_id;
-    drmmode_crtc->scanout_update_pending = TRUE;
+    drmmode_crtc->scanout_update_pending = drm_queue_seq;
 }
 
 static void
@@ -1000,7 +1000,7 @@ radeon_scanout_update_abort(xf86CrtcPtr crtc, void *event_data)
 {
     drmmode_crtc_private_ptr drmmode_crtc = event_data;
 
-    drmmode_crtc->scanout_update_pending = FALSE;
+    drmmode_crtc->scanout_update_pending = 0;
 }
 
 static void
@@ -1077,7 +1077,7 @@ radeon_scanout_update(xf86CrtcPtr xf86_crtc)
 	return;
     }
 
-    drmmode_crtc->scanout_update_pending = TRUE;
+    drmmode_crtc->scanout_update_pending = drm_queue_seq;
 }
 
 static void
@@ -1144,7 +1144,7 @@ radeon_scanout_flip(ScreenPtr pScreen, RADEONInfoPtr info,
     }
 
     drmmode_crtc->scanout_id = scanout_id;
-    drmmode_crtc->scanout_update_pending = TRUE;
+    drmmode_crtc->scanout_update_pending = drm_queue_seq;
 }
 
 static void RADEONBlockHandler_KMS(BLOCKHANDLER_ARGS_DECL)
-- 
2.18.0

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

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

* [PATCH xf86-video-ati 05/21] Abort scanout_update_pending event when possible
       [not found] ` <20180711172806.22849-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
                     ` (3 preceding siblings ...)
  2018-07-11 17:27   ` [PATCH xf86-video-ati 04/21] Track DRM event queue sequence number in scanout_update_pending Michel Dänzer
@ 2018-07-11 17:27   ` Michel Dänzer
  2018-07-11 17:27   ` [PATCH xf86-video-ati 06/21] Update RandR CRTC state if set_mode_major fails in set_desired_modes Michel Dänzer
                     ` (16 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: Michel Dänzer @ 2018-07-11 17:27 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

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

We don't need to wait for a non-TearFree scanout update before scanning
out from the screen pixmap or before flipping, as the scanout update
won't be visible anyway. Instead, just abort it.

(Ported from amdgpu commit 36d01989cd842588f12fdae5b2cba5fdcf9c91dd)

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

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index b3e5cc991..64dab316f 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -986,8 +986,8 @@ done:
 		if (drmmode_crtc->scanout[scanout_id].pixmap &&
 		    fb != radeon_pixmap_get_fb(drmmode_crtc->
 					       scanout[scanout_id].pixmap)) {
-			drmmode_crtc_wait_pending_event(drmmode_crtc, pRADEONEnt->fd,
-							drmmode_crtc->scanout_update_pending);
+			radeon_drm_abort_entry(drmmode_crtc->scanout_update_pending);
+			drmmode_crtc->scanout_update_pending = 0;
 			drmmode_crtc_scanout_free(drmmode_crtc);
 		} else if (!drmmode_crtc->tear_free) {
 			drmmode_crtc_scanout_destroy(drmmode,
@@ -3190,8 +3190,12 @@ Bool radeon_do_pageflip(ScrnInfoPtr scrn, ClientPtr client,
 						 extents);
 			radeon_cs_flush_indirect(crtc->scrn);
 
-			drmmode_crtc_wait_pending_event(drmmode_crtc, pRADEONEnt->fd,
-							drmmode_crtc->scanout_update_pending);
+			if (drmmode_crtc->scanout_update_pending) {
+				drmmode_crtc_wait_pending_event(drmmode_crtc, pRADEONEnt->fd,
+								drmmode_crtc->flip_pending);
+				radeon_drm_abort_entry(drmmode_crtc->scanout_update_pending);
+				drmmode_crtc->scanout_update_pending = 0;
+			}
 		}
 
 		if (crtc == ref_crtc) {
-- 
2.18.0

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

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

* [PATCH xf86-video-ati 06/21] Update RandR CRTC state if set_mode_major fails in set_desired_modes
       [not found] ` <20180711172806.22849-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
                     ` (4 preceding siblings ...)
  2018-07-11 17:27   ` [PATCH xf86-video-ati 05/21] Abort scanout_update_pending event when possible Michel Dänzer
@ 2018-07-11 17:27   ` Michel Dänzer
  2018-07-11 17:27   ` [PATCH xf86-video-ati 07/21] Simplify drmmode_crtc_scanout_update Michel Dänzer
                     ` (15 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: Michel Dänzer @ 2018-07-11 17:27 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

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

Without this, RandR would report the CRTC and its outputs as enabled,
even though they were actually off due to the failure.

(Cherry picked from amdgpu commit 4dcda0b48d62944c841cd9540f4ad4c7ac8dee47)

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

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 64dab316f..fa05cda48 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -2833,6 +2833,8 @@ Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode,
 			} else {
 				xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
 					   "Failed to set mode on CRTC %d\n", c);
+				RRCrtcSet(crtc->randr_crtc, NULL, crtc->x, crtc->y,
+					  crtc->rotation, 0, NULL);
 			}
 		} else {
 			crtc->mode = crtc->desiredMode;
-- 
2.18.0

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

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

* [PATCH xf86-video-ati 07/21] Simplify drmmode_crtc_scanout_update
       [not found] ` <20180711172806.22849-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
                     ` (5 preceding siblings ...)
  2018-07-11 17:27   ` [PATCH xf86-video-ati 06/21] Update RandR CRTC state if set_mode_major fails in set_desired_modes Michel Dänzer
@ 2018-07-11 17:27   ` Michel Dänzer
  2018-07-11 17:27   ` [PATCH xf86-video-ati 08/21] Don't call scanout_flip/update with a legacy RandR scanout buffer Michel Dänzer
                     ` (14 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: Michel Dänzer @ 2018-07-11 17:27 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

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

Use our own BoxRec for the extents, and RegionEmpty for clearing the
scanout damage region.

(Ported from amdgpu commit 72c3e9c7308fbcdf85708b72f9be14a5f2f8e7b5)

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

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index fa05cda48..b3b37f56d 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -765,8 +765,8 @@ drmmode_crtc_scanout_update(xf86CrtcPtr crtc, DisplayModePtr mode,
 	if (drmmode_crtc->scanout[scanout_id].pixmap &&
 	    (!drmmode_crtc->tear_free ||
 	     drmmode_crtc->scanout[scanout_id ^ 1].pixmap)) {
-		RegionPtr region;
-		BoxPtr box;
+		BoxRec extents = { .x1 = 0, .y1 = 0,
+				   .x2 = scrn->virtualX, .y2 = scrn->virtualY };
 
 		if (!drmmode_crtc->scanout_damage) {
 			drmmode_crtc->scanout_damage =
@@ -778,21 +778,13 @@ drmmode_crtc_scanout_update(xf86CrtcPtr crtc, DisplayModePtr mode,
 				       drmmode_crtc->scanout_damage);
 		}
 
-		region = DamageRegion(drmmode_crtc->scanout_damage);
-		RegionUninit(region);
-		region->data = NULL;
-		box = RegionExtents(region);
-		box->x1 = 0;
-		box->y1 = 0;
-		box->x2 = max(box->x2, scrn->virtualX);
-		box->y2 = max(box->y2, scrn->virtualY);
-
 		*fb = radeon_pixmap_get_fb(drmmode_crtc->scanout[scanout_id].pixmap);
 		*x = *y = 0;
 
 		radeon_scanout_do_update(crtc, scanout_id,
 					 screen->GetWindowPixmap(screen->root),
-					 *box);
+					 extents);
+		RegionEmpty(DamageRegion(drmmode_crtc->scanout_damage));
 		radeon_finish(scrn, drmmode_crtc->scanout[scanout_id].bo);
 	}
 }
-- 
2.18.0

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

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

* [PATCH xf86-video-ati 08/21] Don't call scanout_flip/update with a legacy RandR scanout buffer
       [not found] ` <20180711172806.22849-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
                     ` (6 preceding siblings ...)
  2018-07-11 17:27   ` [PATCH xf86-video-ati 07/21] Simplify drmmode_crtc_scanout_update Michel Dänzer
@ 2018-07-11 17:27   ` Michel Dänzer
  2018-07-11 17:27   ` [PATCH xf86-video-ati 09/21] Simplify drmmode_handle_transform Michel Dänzer
                     ` (13 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: Michel Dänzer @ 2018-07-11 17:27 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

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

It means we are not using our own scanout buffers.

Fixes crash when TearFree is supposed to be enabled, but
drmmode_handle_transform doesn't set crtc->driverIsPerformingTransform.

Bugzilla: https://bugs.freedesktop.org/105736
(Ported from commit 463477661c88cab3a87746499e5838c5b9f9a13b)

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

diff --git a/src/radeon_kms.c b/src/radeon_kms.c
index cdda8962e..15dca0de4 100644
--- a/src/radeon_kms.c
+++ b/src/radeon_kms.c
@@ -1167,6 +1167,9 @@ static void RADEONBlockHandler_KMS(BLOCKHANDLER_ARGS_DECL)
 	    xf86CrtcPtr crtc = xf86_config->crtc[c];
 	    drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
 
+	    if (drmmode_crtc->rotate.pixmap)
+		continue;
+
 	    if (drmmode_crtc->tear_free)
 		radeon_scanout_flip(pScreen, info, crtc);
 	    else if (drmmode_crtc->scanout[drmmode_crtc->scanout_id].pixmap)
-- 
2.18.0

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

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

* [PATCH xf86-video-ati 09/21] Simplify drmmode_handle_transform
       [not found] ` <20180711172806.22849-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
                     ` (7 preceding siblings ...)
  2018-07-11 17:27   ` [PATCH xf86-video-ati 08/21] Don't call scanout_flip/update with a legacy RandR scanout buffer Michel Dänzer
@ 2018-07-11 17:27   ` Michel Dänzer
  2018-07-11 17:27   ` [PATCH xf86-video-ati 10/21] Set drmmode_crtc->scanout_id = 0 when TearFree is disabled Michel Dänzer
                     ` (12 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: Michel Dänzer @ 2018-07-11 17:27 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

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

Set crtc->driverIsPerformingTransform for any case we can handle before
calling xf86CrtcRotate. We already clear it afterwards when the latter
clears crtc->transform_in_use.

This should allow our separate scanout buffer mechanism to be used in
more cases.

(Cherry picked from amdgpu commit 8e544b4a0de6717feb4abf00052d57c5b726b5ce)

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
---
 src/drmmode_display.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index b3b37f56d..fce8723e8 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -669,13 +669,9 @@ drmmode_handle_transform(xf86CrtcPtr crtc)
 	Bool ret;
 
 #if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,15,99,903,0)
-	if (crtc->transformPresent || crtc->rotation != RR_Rotate_0)
-	    crtc->driverIsPerformingTransform = XF86DriverTransformOutput;
-	else
-	    crtc->driverIsPerformingTransform = XF86DriverTransformNone;
+	crtc->driverIsPerformingTransform = XF86DriverTransformOutput;
 #else
 	crtc->driverIsPerformingTransform = !crtc->transformPresent &&
-		crtc->rotation != RR_Rotate_0 &&
 		(crtc->rotation & 0xf) == RR_Rotate_0;
 #endif
 
-- 
2.18.0

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

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

* [PATCH xf86-video-ati 10/21] Set drmmode_crtc->scanout_id = 0 when TearFree is disabled
       [not found] ` <20180711172806.22849-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
                     ` (8 preceding siblings ...)
  2018-07-11 17:27   ` [PATCH xf86-video-ati 09/21] Simplify drmmode_handle_transform Michel Dänzer
@ 2018-07-11 17:27   ` Michel Dänzer
  2018-07-11 17:27   ` [PATCH xf86-video-ati 11/21] Refactor drmmode_output_set_tear_free helper Michel Dänzer
                     ` (11 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: Michel Dänzer @ 2018-07-11 17:27 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

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

When disabling TearFree, drmmode_crtc->scanout_id could remain as 1,
but drmmode_set_mode_major would destroy drmmode_crtc->scanout[1], so
scanout_do_update() would keep bailing, and the scanout buffer would
stop being updated.

Fixes freeze after disabling TearFree on a CRTC with active RandR
rotation or other transform.

(Ported from amdgpu commit 7db0c8e9d7586cff4312d4b93684d35de3e6376f)

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

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index fce8723e8..df8ef3202 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -885,6 +885,8 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
 		drmmode_crtc_update_tear_free(crtc);
 		if (drmmode_crtc->tear_free)
 			scanout_id = drmmode_crtc->scanout_id;
+		else
+			drmmode_crtc->scanout_id = 0;
 
 		drmmode_crtc_gamma_do_set(crtc, crtc->gamma_red, crtc->gamma_green,
 					  crtc->gamma_blue, crtc->gamma_size);
-- 
2.18.0

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

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

* [PATCH xf86-video-ati 11/21] Refactor drmmode_output_set_tear_free helper
       [not found] ` <20180711172806.22849-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
                     ` (9 preceding siblings ...)
  2018-07-11 17:27   ` [PATCH xf86-video-ati 10/21] Set drmmode_crtc->scanout_id = 0 when TearFree is disabled Michel Dänzer
@ 2018-07-11 17:27   ` Michel Dänzer
  2018-07-11 17:27   ` [PATCH xf86-video-ati 12/21] Wait for pending flips in drmmode_output_set_tear_free Michel Dänzer
                     ` (10 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: Michel Dänzer @ 2018-07-11 17:27 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

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

Preparation for the following fix, no functional change intended.

(Ported from amdgpu commit fa30f4601de7a44edfb4a95873bd648946fd4292)

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

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index df8ef3202..ae605edaf 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -1743,6 +1743,22 @@ drmmode_output_create_resources(xf86OutputPtr output)
     }
 }
 
+static void
+drmmode_output_set_tear_free(RADEONEntPtr pRADEONEnt,
+			     drmmode_output_private_ptr drmmode_output,
+			     xf86CrtcPtr crtc, int tear_free)
+{
+	if (drmmode_output->tear_free == tear_free)
+		return;
+
+	drmmode_output->tear_free = tear_free;
+
+	if (crtc) {
+		drmmode_set_mode_major(crtc, &crtc->mode, crtc->rotation,
+				       crtc->x, crtc->y);
+	}
+}
+
 static Bool
 drmmode_output_set_property(xf86OutputPtr output, Atom property,
 		RRPropertyValuePtr value)
@@ -1783,16 +1799,8 @@ drmmode_output_set_property(xf86OutputPtr output, Atom property,
 	    for (j = 0; j < p->mode_prop->count_enums; j++) {
 		if (!strcmp(p->mode_prop->enums[j].name, name)) {
 		    if (i == (drmmode_output->num_props - 1)) {
-			if (drmmode_output->tear_free != j) {
-			    xf86CrtcPtr crtc = output->crtc;
-
-			    drmmode_output->tear_free = j;
-			    if (crtc) {
-				drmmode_set_mode_major(crtc, &crtc->mode,
-						       crtc->rotation,
-						       crtc->x, crtc->y);
-			    }
-			}
+			drmmode_output_set_tear_free(pRADEONEnt, drmmode_output,
+						     output->crtc, j);
 		    } else {
 			drmModeConnectorSetProperty(pRADEONEnt->fd,
 						    drmmode_output->output_id,
-- 
2.18.0

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

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

* [PATCH xf86-video-ati 12/21] Wait for pending flips in drmmode_output_set_tear_free
       [not found] ` <20180711172806.22849-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
                     ` (10 preceding siblings ...)
  2018-07-11 17:27   ` [PATCH xf86-video-ati 11/21] Refactor drmmode_output_set_tear_free helper Michel Dänzer
@ 2018-07-11 17:27   ` Michel Dänzer
  2018-07-11 17:27   ` [PATCH xf86-video-ati 13/21] Replace 'foo == NULL' with '!foo' Michel Dänzer
                     ` (9 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: Michel Dänzer @ 2018-07-11 17:27 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

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

This prevents a nested call to drmHandleEvent, which would hang.

Fixes hangs when disabling TearFree on a CRTC while a DRI3 client is
page flipping.

(Ported from amdgpu commit 04947b83cce3a7782e59dece2c7797cc396c1e05)

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

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index ae605edaf..003fe51ef 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -1754,6 +1754,14 @@ drmmode_output_set_tear_free(RADEONEntPtr pRADEONEnt,
 	drmmode_output->tear_free = tear_free;
 
 	if (crtc) {
+		drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+
+		/* Wait for pending flips before drmmode_set_mode_major calls
+		 * drmmode_crtc_update_tear_free, to prevent a nested
+		 * drmHandleEvent call, which would hang
+		 */
+		drmmode_crtc_wait_pending_event(drmmode_crtc, pRADEONEnt->fd,
+						drmmode_crtc->flip_pending);
 		drmmode_set_mode_major(crtc, &crtc->mode, crtc->rotation,
 				       crtc->x, crtc->y);
 	}
-- 
2.18.0

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

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

* [PATCH xf86-video-ati 13/21] Replace 'foo == NULL' with '!foo'
       [not found] ` <20180711172806.22849-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
                     ` (11 preceding siblings ...)
  2018-07-11 17:27   ` [PATCH xf86-video-ati 12/21] Wait for pending flips in drmmode_output_set_tear_free Michel Dänzer
@ 2018-07-11 17:27   ` Michel Dänzer
  2018-07-11 17:27   ` [PATCH xf86-video-ati 14/21] Call drmmode_do_crtc_dpms from drmmode_crtc_dpms as well Michel Dänzer
                     ` (8 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: Michel Dänzer @ 2018-07-11 17:27 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

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

Shorter and sweeter. :)

(Ported from amdgpu commit e8e688f3852fb06b0c34ed5bce47c9493bcd1613)

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
---
 src/ati.c                    |  4 ++--
 src/drmmode_display.c        |  8 ++++----
 src/evergreen_exa.c          | 10 +++++-----
 src/r600_exa.c               | 10 +++++-----
 src/radeon.h                 |  2 +-
 src/radeon_dri2.c            | 12 ++++++------
 src/radeon_exa.c             |  2 +-
 src/radeon_exa_funcs.c       |  8 ++++----
 src/radeon_exa_render.c      |  6 +++---
 src/radeon_glamor.c          |  2 +-
 src/radeon_glamor_wrappers.c |  4 ++--
 src/radeon_kms.c             | 25 ++++++++++++-------------
 src/radeon_textured_video.c  | 10 +++++-----
 src/radeon_video.c           |  6 +++---
 14 files changed, 54 insertions(+), 55 deletions(-)

diff --git a/src/ati.c b/src/ati.c
index 6fd215679..837b00942 100644
--- a/src/ati.c
+++ b/src/ati.c
@@ -109,7 +109,7 @@ ati_device_get_primary(void)
 
     device_iter = pci_slot_match_iterator_create(NULL);
 
-    while ((device = pci_device_next(device_iter)) != NULL) {
+    while ((device = pci_device_next(device_iter))) {
         if (xf86IsPrimaryPci(device))
             break;
     }
@@ -128,7 +128,7 @@ ati_device_get_indexed(int index)
 
     device_iter = pci_slot_match_iterator_create(NULL);
 
-    while ((device = pci_device_next(device_iter)) != NULL) {
+    while ((device = pci_device_next(device_iter))) {
         if (device->vendor_id == PCI_VENDOR_ATI) {
             if (count == index)
                 return device;
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 003fe51ef..3117b8f18 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -386,7 +386,7 @@ create_pixmap_for_fbcon(drmmode_ptr drmmode,
 	    return pixmap;
 
 	fbcon = drmModeGetFB(pRADEONEnt->fd, fbcon_id);
-	if (fbcon == NULL)
+	if (!fbcon)
 		return NULL;
 
 	if (fbcon->depth != pScrn->depth ||
@@ -410,7 +410,7 @@ create_pixmap_for_fbcon(drmmode_ptr drmmode,
 	bo->ref_count = 1;
 
 	bo->bo.radeon = radeon_bo_open(drmmode->bufmgr, flink.name, 0, 0, 0, 0);
-	if (bo == NULL) {
+	if (!bo) {
 		xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
 			   "Couldn't open BO for fbcon handle\n");
 		goto out_free_fb;
@@ -1365,7 +1365,7 @@ drmmode_crtc_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, drmModeResPtr mode_res
 	RADEONInfoPtr info = RADEONPTR(pScrn);
 
 	crtc = xf86CrtcCreate(pScrn, &info->drmmode_crtc_funcs);
-	if (crtc == NULL)
+	if (!crtc)
 		return 0;
 
 	drmmode_crtc = xnfcalloc(sizeof(drmmode_crtc_private_rec), 1);
@@ -2317,7 +2317,7 @@ drmmode_xf86crtc_resize (ScrnInfoPtr scrn, int width, int height)
 		if (radeon_bo_map(info->front_buffer->bo.radeon, 1))
 			goto fail;
 		fb_shadow = calloc(1, pitch * scrn->virtualY);
-		if (fb_shadow == NULL)
+		if (!fb_shadow)
 			goto fail;
 		free(info->fb_shadow);
 		info->fb_shadow = fb_shadow;
diff --git a/src/evergreen_exa.c b/src/evergreen_exa.c
index dae8b6a15..447ed217c 100644
--- a/src/evergreen_exa.c
+++ b/src/evergreen_exa.c
@@ -511,7 +511,7 @@ EVERGREENPrepareCopy(PixmapPtr pSrc,   PixmapPtr pDst,
 	accel_state->copy_area_bo = radeon_bo_open(info->bufmgr, 0, size, 0,
 						   RADEON_GEM_DOMAIN_VRAM,
 						   0);
-	if (accel_state->copy_area_bo == NULL)
+	if (!accel_state->copy_area_bo)
 	    RADEON_FALLBACK(("temp copy surface alloc failed\n"));
 
 	radeon_cs_space_add_persistent_bo(info->cs, accel_state->copy_area_bo,
@@ -1693,7 +1693,7 @@ EVERGREENUploadToScreen(PixmapPtr pDst, int x, int y, int w, int h,
     base_align = drmmode_get_base_align(pScrn, (bpp / 8), 0);
     size = scratch_pitch * height * (bpp / 8);
     scratch = radeon_bo_open(info->bufmgr, 0, size, base_align, RADEON_GEM_DOMAIN_GTT, 0);
-    if (scratch == NULL) {
+    if (!scratch) {
 	goto copy;
     }
 
@@ -1821,7 +1821,7 @@ EVERGREENDownloadFromScreen(PixmapPtr pSrc, int x, int y, int w,
     base_align = drmmode_get_base_align(pScrn, (bpp / 8), 0);
     size = scratch_pitch * height * (bpp / 8);
     scratch = radeon_bo_open(info->bufmgr, 0, size, base_align, RADEON_GEM_DOMAIN_GTT, 0);
-    if (scratch == NULL) {
+    if (!scratch) {
 	goto copy;
     }
     radeon_cs_space_reset_bos(info->cs);
@@ -1927,7 +1927,7 @@ EVERGREENAllocShaders(ScrnInfoPtr pScrn, ScreenPtr pScreen)
 
     accel_state->shaders_bo = radeon_bo_open(info->bufmgr, 0, size, 0,
 					     RADEON_GEM_DOMAIN_VRAM, 0);
-    if (accel_state->shaders_bo == NULL) {
+    if (!accel_state->shaders_bo) {
 	ErrorF("Allocating shader failed\n");
 	return FALSE;
     }
@@ -2046,7 +2046,7 @@ EVERGREENDrawInit(ScreenPtr pScreen)
     ScrnInfoPtr pScrn =  xf86ScreenToScrn(pScreen);
     RADEONInfoPtr info   = RADEONPTR(pScrn);
 
-    if (info->accel_state->exa == NULL) {
+    if (!info->accel_state->exa) {
 	xf86DrvMsg(pScreen->myNum, X_ERROR, "Memory map not set up\n");
 	return FALSE;
     }
diff --git a/src/r600_exa.c b/src/r600_exa.c
index bd824c877..99db0c40b 100644
--- a/src/r600_exa.c
+++ b/src/r600_exa.c
@@ -575,7 +575,7 @@ R600PrepareCopy(PixmapPtr pSrc,   PixmapPtr pDst,
 	accel_state->copy_area_bo = radeon_bo_open(info->bufmgr, 0, size, align,
 						   RADEON_GEM_DOMAIN_VRAM,
 						   0);
-	if (accel_state->copy_area_bo == NULL)
+	if (!accel_state->copy_area_bo)
 	    RADEON_FALLBACK(("temp copy surface alloc failed\n"));
 	
 	radeon_cs_space_add_persistent_bo(info->cs, accel_state->copy_area_bo,
@@ -1723,7 +1723,7 @@ R600UploadToScreenCS(PixmapPtr pDst, int x, int y, int w, int h,
     base_align = drmmode_get_base_align(pScrn, (bpp / 8), 0);
     size = scratch_pitch * height * (bpp / 8);
     scratch = radeon_bo_open(info->bufmgr, 0, size, base_align, RADEON_GEM_DOMAIN_GTT, 0);
-    if (scratch == NULL) {
+    if (!scratch) {
 	goto copy;
     }
 
@@ -1847,7 +1847,7 @@ R600DownloadFromScreenCS(PixmapPtr pSrc, int x, int y, int w,
     base_align = drmmode_get_base_align(pScrn, (bpp / 8), 0);
     size = scratch_pitch * height * (bpp / 8);
     scratch = radeon_bo_open(info->bufmgr, 0, size, base_align, RADEON_GEM_DOMAIN_GTT, 0);
-    if (scratch == NULL) {
+    if (!scratch) {
 	goto copy;
     }
     radeon_cs_space_reset_bos(info->cs);
@@ -1960,7 +1960,7 @@ R600AllocShaders(ScrnInfoPtr pScrn, ScreenPtr pScreen)
 
     accel_state->shaders_bo = radeon_bo_open(info->bufmgr, 0, size, 0,
 					     RADEON_GEM_DOMAIN_VRAM, 0);
-    if (accel_state->shaders_bo == NULL) {
+    if (!accel_state->shaders_bo) {
         ErrorF("Allocating shader failed\n");
 	return FALSE;
     }
@@ -2025,7 +2025,7 @@ R600DrawInit(ScreenPtr pScreen)
     ScrnInfoPtr pScrn =  xf86ScreenToScrn(pScreen);
     RADEONInfoPtr info   = RADEONPTR(pScrn);
 
-    if (info->accel_state->exa == NULL) {
+    if (!info->accel_state->exa) {
 	xf86DrvMsg(pScreen->myNum, X_ERROR, "Memory map not set up\n");
 	return FALSE;
     }
diff --git a/src/radeon.h b/src/radeon.h
index 2bcfa41b1..450c69aa8 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -726,7 +726,7 @@ static inline Bool radeon_set_pixmap_bo(PixmapPtr pPix, struct radeon_buffer *bo
 	struct radeon_pixmap *priv;
 
 	priv = radeon_get_pixmap_private(pPix);
-	if (priv == NULL && bo == NULL)
+	if (!priv && !bo)
 	    return TRUE;
 
 	if (priv) {
diff --git a/src/radeon_dri2.c b/src/radeon_dri2.c
index 70ad1d92a..c36e06f22 100644
--- a/src/radeon_dri2.c
+++ b/src/radeon_dri2.c
@@ -238,14 +238,14 @@ radeon_dri2_create_buffer2(ScreenPtr pScreen,
 	return NULL;
 
     buffers = calloc(1, sizeof *buffers);
-    if (buffers == NULL)
+    if (!buffers)
         goto error;
 
     if (!info->use_glamor) {
 	info->exa_force_create = TRUE;
 	exaMoveInPixmap(pixmap);
 	info->exa_force_create = FALSE;
-	if (exaGetPixmapDriverPrivate(pixmap) == NULL) {
+	if (!exaGetPixmapDriverPrivate(pixmap)) {
 	    /* this happen if pixmap is non accelerable */
 	    goto error;
 	}
@@ -258,7 +258,7 @@ radeon_dri2_create_buffer2(ScreenPtr pScreen,
 	goto error;
 
     privates = calloc(1, sizeof(struct dri2_buffer_priv));
-    if (privates == NULL)
+    if (!privates)
         goto error;
 
     buffers->attachment = attachment;
@@ -923,7 +923,7 @@ static int radeon_dri2_get_msc(DrawablePtr draw, CARD64 *ust, CARD64 *msc)
     xf86CrtcPtr crtc = radeon_dri2_drawable_crtc(draw, TRUE);
 
     /* Drawable not displayed, make up a value */
-    if (crtc == NULL) {
+    if (!crtc) {
         *ust = 0;
         *msc = 0;
         return TRUE;
@@ -1034,7 +1034,7 @@ static int radeon_dri2_schedule_wait_msc(ClientPtr client, DrawablePtr draw,
     remainder &= 0xffffffff;
 
     /* Drawable not visible, return immediately */
-    if (crtc == NULL)
+    if (!crtc)
         goto out_complete;
 
     msc_delta = radeon_get_msc_delta(draw, crtc);
@@ -1193,7 +1193,7 @@ static int radeon_dri2_schedule_swap(ClientPtr client, DrawablePtr draw,
     radeon_dri2_ref_buffer(back);
 
     /* either off-screen or CRTC not usable... just complete the swap */
-    if (crtc == NULL)
+    if (!crtc)
         goto blit_fallback;
 
     msc_delta = radeon_get_msc_delta(draw, crtc);
diff --git a/src/radeon_exa.c b/src/radeon_exa.c
index 90d92d7b8..93c2f056c 100644
--- a/src/radeon_exa.c
+++ b/src/radeon_exa.c
@@ -150,7 +150,7 @@ Bool RADEONGetPixmapOffsetPitch(PixmapPtr pPix, uint32_t *pitch_offset)
  */
 Bool radeon_transform_is_affine_or_scaled(PictTransformPtr t)
 {
-	if (t == NULL)
+	if (!t)
 		return TRUE;
 	/* the shaders don't handle scaling either */
 	return t->matrix[2][0] == 0 && t->matrix[2][1] == 0 && t->matrix[2][2] == IntToxFixed(1);
diff --git a/src/radeon_exa_funcs.c b/src/radeon_exa_funcs.c
index 819b42580..b3200cc97 100644
--- a/src/radeon_exa_funcs.c
+++ b/src/radeon_exa_funcs.c
@@ -331,7 +331,7 @@ RADEONBlitChunk(ScrnInfoPtr pScrn, struct radeon_bo *src_bo,
 
     if (src_bo && dst_bo) {
         BEGIN_ACCEL_RELOC(6, 2);
-    } else if (src_bo && dst_bo == NULL) {
+    } else if (src_bo && !dst_bo) {
         BEGIN_ACCEL_RELOC(6, 1);
     } else {
         BEGIN_RING(2*6);
@@ -423,7 +423,7 @@ RADEONUploadToScreenCS(PixmapPtr pDst, int x, int y, int w, int h,
 
     size = scratch_pitch * h;
     scratch = radeon_bo_open(info->bufmgr, 0, size, 0, RADEON_GEM_DOMAIN_GTT, 0);
-    if (scratch == NULL) {
+    if (!scratch) {
 	goto copy;
     }
     radeon_cs_space_reset_bos(info->cs);
@@ -531,7 +531,7 @@ RADEONDownloadFromScreenCS(PixmapPtr pSrc, int x, int y, int w,
     }
     size = scratch_pitch * h;
     scratch = radeon_bo_open(info->bufmgr, 0, size, 0, RADEON_GEM_DOMAIN_GTT, 0);
-    if (scratch == NULL) {
+    if (!scratch) {
 	goto copy;
     }
     radeon_cs_space_reset_bos(info->cs);
@@ -584,7 +584,7 @@ Bool RADEONDrawInit(ScreenPtr pScreen)
 {
     RINFO_FROM_SCREEN(pScreen);
 
-    if (info->accel_state->exa == NULL) {
+    if (!info->accel_state->exa) {
 	xf86DrvMsg(pScreen->myNum, X_ERROR, "Memory map not set up\n");
 	return FALSE;
     }
diff --git a/src/radeon_exa_render.c b/src/radeon_exa_render.c
index 9510f7f41..c61d83f4b 100644
--- a/src/radeon_exa_render.c
+++ b/src/radeon_exa_render.c
@@ -630,7 +630,7 @@ static Bool R100PrepareComposite(int op,
 	return FALSE;
     pp_cntl = RADEON_TEX_0_ENABLE | RADEON_TEX_BLEND_0_ENABLE;
 
-    if (pMask != NULL) {
+    if (pMask) {
 	if (!R100TextureSetup(pMaskPicture, pMask, 1))
 	    return FALSE;
 	pp_cntl |= RADEON_TEX_1_ENABLE;
@@ -992,7 +992,7 @@ static Bool R200PrepareComposite(int op, PicturePtr pSrcPicture,
 	return FALSE;
     pp_cntl = RADEON_TEX_0_ENABLE | RADEON_TEX_BLEND_0_ENABLE;
 
-    if (pMask != NULL) {
+    if (pMask) {
 	if (!R200TextureSetup(pMaskPicture, pMask, 1))
 	    return FALSE;
 	pp_cntl |= RADEON_TEX_1_ENABLE;
@@ -1484,7 +1484,7 @@ static Bool R300PrepareComposite(int op, PicturePtr pSrcPicture,
 	return FALSE;
     txenable = R300_TEX_0_ENABLE;
 
-    if (pMask != NULL) {
+    if (pMask) {
 	if (!R300TextureSetup(pMaskPicture, pMask, 1))
 	    return FALSE;
 	txenable |= R300_TEX_1_ENABLE;
diff --git a/src/radeon_glamor.c b/src/radeon_glamor.c
index fa6349472..b649bd18d 100644
--- a/src/radeon_glamor.c
+++ b/src/radeon_glamor.c
@@ -261,7 +261,7 @@ radeon_glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
 		int stride;
 
 		priv = calloc(1, sizeof (struct radeon_pixmap));
-		if (priv == NULL)
+		if (!priv)
 			goto fallback_pixmap;
 
 		priv->bo = radeon_alloc_pixmap_bo(scrn, w, h, depth, usage,
diff --git a/src/radeon_glamor_wrappers.c b/src/radeon_glamor_wrappers.c
index 79d98cc77..edffd9adb 100644
--- a/src/radeon_glamor_wrappers.c
+++ b/src/radeon_glamor_wrappers.c
@@ -132,7 +132,7 @@ radeon_glamor_finish_access_cpu(PixmapPtr pixmap)
 static Bool
 radeon_glamor_prepare_access_gpu(struct radeon_pixmap *priv)
 {
-	return priv != NULL;
+	return !!priv;
 }
 
 static void
@@ -201,7 +201,7 @@ radeon_glamor_picture_prepare_access_cpu_ro(ScrnInfoPtr scrn,
 	PixmapPtr pixmap;
 	struct radeon_pixmap *priv;
 
-	if (picture->pDrawable == NULL)
+	if (!picture->pDrawable)
 		return TRUE;
 
 	pixmap = get_drawable_pixmap(picture->pDrawable);
diff --git a/src/radeon_kms.c b/src/radeon_kms.c
index 15dca0de4..36840ad36 100644
--- a/src/radeon_kms.c
+++ b/src/radeon_kms.c
@@ -639,7 +639,7 @@ master_has_sync_shared_pixmap(ScrnInfoPtr scrn, PixmapDirtyUpdatePtr dirty)
 {
     ScreenPtr master_screen = radeon_dirty_master(dirty);
 
-    return master_screen->SyncSharedPixmap != NULL;
+    return !!master_screen->SyncSharedPixmap;
 }
 
 static Bool
@@ -647,7 +647,7 @@ slave_has_sync_shared_pixmap(ScrnInfoPtr scrn, PixmapDirtyUpdatePtr dirty)
 {
     ScreenPtr slave_screen = dirty->slave_dst->drawable.pScreen;
 
-    return slave_screen->SyncSharedPixmap != NULL;
+    return !!slave_screen->SyncSharedPixmap;
 }
 
 static void
@@ -1769,7 +1769,7 @@ Bool RADEONPreInit_KMS(ScrnInfoPtr pScrn, int flags)
     info->dri2.available = FALSE;
     info->dri2.enabled = FALSE;
     info->dri2.pKernelDRMVersion = drmGetVersion(pRADEONEnt->fd);
-    if (info->dri2.pKernelDRMVersion == NULL) {
+    if (!info->dri2.pKernelDRMVersion) {
 	xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
 		   "RADEONDRIGetVersion failed to get the DRM version\n");
 	return FALSE;
@@ -1924,7 +1924,7 @@ Bool RADEONPreInit_KMS(ScrnInfoPtr pScrn, int flags)
 	    xf86OutputPtr output = xf86_config->output[i];
 
 	    /* XXX: double check crtc mode */
-	    if ((output->probed_modes != NULL) && (output->crtc == NULL))
+	    if (output->probed_modes && !output->crtc)
 		output->crtc = xf86_config->crtc[0];
 	}
     }
@@ -1987,7 +1987,7 @@ Bool RADEONPreInit_KMS(ScrnInfoPtr pScrn, int flags)
 	if (!xf86LoadSubModule(pScrn, "ramdac")) return FALSE;
     }
 
-    if (pScrn->modes == NULL
+    if (!pScrn->modes
 #ifdef XSERVER_PLATFORM_BUS
         && !pScrn->is_gpu
 #endif
@@ -2098,7 +2098,7 @@ static Bool RADEONSaveScreen_KMS(ScreenPtr pScreen, int mode)
     unblank = xf86IsUnblank(mode);
     if (unblank) SetTimeSinceLastInputEvent();
 
-    if ((pScrn != NULL) && pScrn->vtSema) {
+    if (pScrn && pScrn->vtSema) {
 	if (unblank)
 	    RADEONUnblank(pScrn);
 	else
@@ -2287,7 +2287,7 @@ Bool RADEONScreenInit_KMS(ScreenPtr pScreen, int argc, char **argv)
 	info->fb_shadow = calloc(1,
 				 pScrn->displayWidth * pScrn->virtualY *
 				 ((pScrn->bitsPerPixel + 7) >> 3));
-	if (info->fb_shadow == NULL) {
+	if (!info->fb_shadow) {
 	    xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
                        "Failed to allocate shadow framebuffer\n");
 	    return FALSE;
@@ -2689,13 +2689,13 @@ static Bool radeon_setup_kernel_mem(ScreenPtr pScreen)
     int pitch;
     uint32_t tiling_flags = 0;
 
-    if (info->accel_state->exa != NULL) {
+    if (info->accel_state->exa) {
 	xf86DrvMsg(pScreen->myNum, X_ERROR, "Memory map already initialized\n");
 	return FALSE;
     }
     if (!info->use_glamor && info->r600_shadow_fb == FALSE) {
         info->accel_state->exa = exaDriverAlloc();
-        if (info->accel_state->exa == NULL) {
+        if (!info->accel_state->exa) {
 	    xf86DrvMsg(pScreen->myNum, X_ERROR, "exaDriverAlloc failed\n");
 	    return FALSE;
 	}
@@ -2709,7 +2709,7 @@ static Bool radeon_setup_kernel_mem(ScreenPtr pScreen)
 	cursor_size = RADEON_ALIGN(cursor_size, RADEON_GPU_PAGE_SIZE);
 	for (c = 0; c < xf86_config->num_crtc; c++) {
 	    /* cursor objects */
-            if (info->cursor_bo[c] == NULL) {
+            if (!info->cursor_bo[c]) {
                 info->cursor_bo[c] = radeon_bo_open(info->bufmgr, 0,
                                                     cursor_size, 0,
                                                     RADEON_GEM_DOMAIN_VRAM, 0);
@@ -2727,7 +2727,7 @@ static Bool radeon_setup_kernel_mem(ScreenPtr pScreen)
         }
     }
 
-    if (info->front_buffer == NULL) {
+    if (!info->front_buffer) {
 	int usage = CREATE_PIXMAP_USAGE_BACKING_PIXMAP;
 
 	if (info->allowColorTiling && !info->shadow_primary) {
@@ -2787,9 +2787,8 @@ void radeon_kms_update_vram_limit(ScrnInfoPtr pScrn, uint32_t new_fb_size)
     int c;
 
     for (c = 0; c < xf86_config->num_crtc; c++) {
-	if (info->cursor_bo[c] != NULL) {
+	if (info->cursor_bo[c])
 	    new_fb_size += (64 * 4 * 64);
-	}
     }
 
     remain_size_bytes = info->vram_size - new_fb_size;
diff --git a/src/radeon_textured_video.c b/src/radeon_textured_video.c
index 23bdfd1dc..be71e4086 100644
--- a/src/radeon_textured_video.c
+++ b/src/radeon_textured_video.c
@@ -153,7 +153,7 @@ radeon_allocate_video_bo(ScrnInfoPtr pScrn,
 static void
 RADEONFreeVideoMemory(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv)
 {
-    if (pPriv->video_memory != NULL) {
+    if (pPriv->video_memory) {
 	radeon_bo_unref(pPriv->video_memory);
 	pPriv->video_memory = NULL;
 
@@ -312,7 +312,7 @@ RADEONPutImageTextured(ScrnInfoPtr pScrn,
 	RADEONFreeVideoMemory(pScrn, pPriv);
     }
 
-    if (pPriv->video_memory == NULL) {
+    if (!pPriv->video_memory) {
       Bool ret;
       ret = radeon_allocate_video_bo(pScrn,
 				     &pPriv->video_memory,
@@ -329,7 +329,7 @@ RADEONPutImageTextured(ScrnInfoPtr pScrn,
 
     /* Bicubic filter loading */
     if (pPriv->bicubic_enabled) {
-	if (info->bicubic_bo == NULL)
+	if (!info->bicubic_bo)
 	    pPriv->bicubic_enabled = FALSE;
     }
 
@@ -725,7 +725,7 @@ static void radeon_unload_bicubic_texture(ScrnInfoPtr pScrn)
 {
     RADEONInfoPtr    info = RADEONPTR(pScrn);
 
-    if (info->bicubic_memory != NULL) {
+    if (info->bicubic_memory) {
 	radeon_bo_unref(info->bicubic_memory);
 	info->bicubic_memory = NULL;
     }
@@ -827,7 +827,7 @@ RADEONSetupImageTexturedVideo(ScreenPtr pScreen)
 
     adapt = calloc(1, sizeof(XF86VideoAdaptorRec) + num_texture_ports *
 		   (sizeof(RADEONPortPrivRec) + sizeof(DevUnion)));
-    if (adapt == NULL)
+    if (!adapt)
 	return NULL;
 
     xvBicubic         = MAKE_ATOM("XV_BICUBIC");
diff --git a/src/radeon_video.c b/src/radeon_video.c
index e08d8e005..fc3211842 100644
--- a/src/radeon_video.c
+++ b/src/radeon_video.c
@@ -144,7 +144,7 @@ void RADEONInitVideo(ScreenPtr pScreen)
 
     num_adaptors = xf86XVListGenericAdaptors(pScrn, &adaptors);
     newAdaptors = malloc((num_adaptors + 2) * sizeof(*newAdaptors));
-    if (newAdaptors == NULL)
+    if (!newAdaptors)
 	return;
 
     memcpy(newAdaptors, adaptors, num_adaptors * sizeof(XF86VideoAdaptorPtr));
@@ -152,7 +152,7 @@ void RADEONInitVideo(ScreenPtr pScreen)
 
     if (info->use_glamor) {
         texturedAdaptor = radeon_glamor_xv_init(pScreen, 16);
-	if (texturedAdaptor != NULL) {
+	if (texturedAdaptor) {
 	    adaptors[num_adaptors++] = texturedAdaptor;
 	    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Set up textured video (glamor)\n");
 	} else
@@ -161,7 +161,7 @@ void RADEONInitVideo(ScreenPtr pScreen)
 	|| (info->directRenderingEnabled)
 	) {
 	texturedAdaptor = RADEONSetupImageTexturedVideo(pScreen);
-	if (texturedAdaptor != NULL) {
+	if (texturedAdaptor) {
 	    adaptors[num_adaptors++] = texturedAdaptor;
 	    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Set up textured video\n");
 	} else
-- 
2.18.0

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

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

* [PATCH xf86-video-ati 14/21] Call drmmode_do_crtc_dpms from drmmode_crtc_dpms as well
       [not found] ` <20180711172806.22849-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
                     ` (12 preceding siblings ...)
  2018-07-11 17:27   ` [PATCH xf86-video-ati 13/21] Replace 'foo == NULL' with '!foo' Michel Dänzer
@ 2018-07-11 17:27   ` Michel Dänzer
  2018-07-11 17:28   ` [PATCH xf86-video-ati 15/21] Use drmmode_crtc_dpms in drmmode_set_desired_modes Michel Dänzer
                     ` (7 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: Michel Dänzer @ 2018-07-11 17:27 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

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

Leo pointed out that drmmode_do_crtc_dpms wasn't getting called when
turning off an output with

 xrandr --output <output> --off

This meant that the vblank sequence number and timestamp wouldn't be
saved before turning off the CRTC in this case.

Reported-by: Leo (Sunpeng) Li <sunpeng.li@amd.com>
(Ported from amdgpu commit ceeacb455cd058492a493aac954deab8455804b5)

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

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 3117b8f18..cf1f6e809 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -361,8 +361,7 @@ drmmode_crtc_dpms(xf86CrtcPtr crtc, int mode)
 
 	/* Disable unused CRTCs */
 	if (!crtc->enabled || mode != DPMSModeOn) {
-		drmmode_crtc_wait_pending_event(drmmode_crtc, pRADEONEnt->fd,
-						drmmode_crtc->flip_pending);
+		drmmode_do_crtc_dpms(crtc, DPMSModeOff);
 		drmModeSetCrtc(pRADEONEnt->fd, drmmode_crtc->mode_crtc->crtc_id,
 			       0, 0, 0, NULL, 0, NULL);
 		drmmode_fb_reference(pRADEONEnt->fd, &drmmode_crtc->fb, NULL);
-- 
2.18.0

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

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

* [PATCH xf86-video-ati 15/21] Use drmmode_crtc_dpms in drmmode_set_desired_modes
       [not found] ` <20180711172806.22849-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
                     ` (13 preceding siblings ...)
  2018-07-11 17:27   ` [PATCH xf86-video-ati 14/21] Call drmmode_do_crtc_dpms from drmmode_crtc_dpms as well Michel Dänzer
@ 2018-07-11 17:28   ` Michel Dänzer
  2018-07-11 17:28   ` [PATCH xf86-video-ati 16/21] Check dimensions passed to drmmode_xf86crtc_resize Michel Dänzer
                     ` (6 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: Michel Dänzer @ 2018-07-11 17:28 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

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

Simplifies the latter slightly.

(Ported from amdgpu commit 74124f2c17dbb4b752707bb7eee398ae099e8a2c)

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
---
 src/drmmode_display.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index cf1f6e809..25fcabfa1 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -2763,7 +2763,6 @@ Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode,
 			       Bool set_hw)
 {
 	xf86CrtcConfigPtr   config = XF86_CRTC_CONFIG_PTR(pScrn);
-	RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn);
 	unsigned num_desired = 0, num_on = 0;
 	int c;
 
@@ -2771,18 +2770,12 @@ Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode,
 	if (set_hw) {
 		for (c = 0; c < config->num_crtc; c++) {
 			xf86CrtcPtr crtc = config->crtc[c];
-			drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
 
 			/* Skip disabled CRTCs */
 			if (crtc->enabled)
 				continue;
 
-			drmmode_do_crtc_dpms(crtc, DPMSModeOff);
-			drmModeSetCrtc(pRADEONEnt->fd,
-				       drmmode_crtc->mode_crtc->crtc_id,
-				       0, 0, 0, NULL, 0, NULL);
-			drmmode_fb_reference(pRADEONEnt->fd,
-					     &drmmode_crtc->fb, NULL);
+			drmmode_crtc_dpms(crtc, DPMSModeOff);
 		}
 	}
 
-- 
2.18.0

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

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

* [PATCH xf86-video-ati 16/21] Check dimensions passed to drmmode_xf86crtc_resize
       [not found] ` <20180711172806.22849-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
                     ` (14 preceding siblings ...)
  2018-07-11 17:28   ` [PATCH xf86-video-ati 15/21] Use drmmode_crtc_dpms in drmmode_set_desired_modes Michel Dänzer
@ 2018-07-11 17:28   ` Michel Dänzer
  2018-07-11 17:28   ` [PATCH xf86-video-ati 17/21] Remove #if 0'd code Michel Dänzer
                     ` (5 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: Michel Dänzer @ 2018-07-11 17:28 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

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

When enabling a secondary GPU output, Xorg can try resizing the screen
beyond the limit advertised by the driver, leading to drmModeAddFB
failing and primary GPU outputs turning off. Check for this and bail
instead.

(Ported from amdgpu commit 940c8b39f79789d4d5ddb8ab8d25a8ae05932756)

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

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 25fcabfa1..4b5f9f456 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -2260,6 +2260,14 @@ drmmode_xf86crtc_resize (ScrnInfoPtr scrn, int width, int height)
 	if (scrn->virtualX == width && scrn->virtualY == height)
 		return TRUE;
 
+	if (width > xf86_config->maxWidth || height > xf86_config->maxHeight) {
+		xf86DrvMsg(scrn->scrnIndex, X_WARNING,
+			   "Xorg tried resizing screen to %dx%d, but maximum "
+			   "supported is %dx%d\n", width, height,
+			   xf86_config->maxWidth, xf86_config->maxHeight);
+		return FALSE;
+	}
+
 	if (info->allowColorTiling && !info->shadow_primary) {
 		if (info->ChipFamily < CHIP_FAMILY_R600 || info->allowColorTiling2D)
 			usage |= RADEON_CREATE_PIXMAP_TILING_MACRO;
-- 
2.18.0

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

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

* [PATCH xf86-video-ati 17/21] Remove #if 0'd code
       [not found] ` <20180711172806.22849-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
                     ` (15 preceding siblings ...)
  2018-07-11 17:28   ` [PATCH xf86-video-ati 16/21] Check dimensions passed to drmmode_xf86crtc_resize Michel Dänzer
@ 2018-07-11 17:28   ` Michel Dänzer
  2018-07-11 17:28   ` [PATCH xf86-video-ati 18/21] Call drmmode_crtc_gamma_do_set from drmmode_setup_colormap Michel Dänzer
                     ` (4 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: Michel Dänzer @ 2018-07-11 17:28 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

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

This has always been disabled, no need to keep it.

(Ported from amdgpu commit 19a40758be04e1d451a030f452efb49e8aaad541)

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

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 4b5f9f456..e301c0e6b 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -1835,15 +1835,6 @@ static const xf86OutputFuncsRec drmmode_output_funcs = {
     .create_resources = drmmode_output_create_resources,
     .set_property = drmmode_output_set_property,
     .get_property = drmmode_output_get_property,
-#if 0
-
-    .save = drmmode_crt_save,
-    .restore = drmmode_crt_restore,
-    .mode_fixup = drmmode_crt_mode_fixup,
-    .prepare = drmmode_output_prepare,
-    .mode_set = drmmode_crt_mode_set,
-    .commit = drmmode_output_commit,
-#endif
     .detect = drmmode_output_detect,
     .mode_valid = drmmode_output_mode_valid,
 
@@ -2875,9 +2866,6 @@ Bool drmmode_setup_colormap(ScreenPtr pScreen, ScrnInfoPtr pScrn)
 	    !xf86HandleColormaps(pScreen, 256, 10,
 				 NULL, NULL,
 				 CMAP_PALETTED_TRUECOLOR
-#if 0 /* This option messes up text mode! (eich@suse.de) */
-				 | CMAP_LOAD_EVEN_IF_OFFSCREEN
-#endif
 				 | CMAP_RELOAD_ON_MODE_SWITCH))
 	    return FALSE;
     }
-- 
2.18.0

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

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

* [PATCH xf86-video-ati 18/21] Call drmmode_crtc_gamma_do_set from drmmode_setup_colormap
       [not found] ` <20180711172806.22849-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
                     ` (16 preceding siblings ...)
  2018-07-11 17:28   ` [PATCH xf86-video-ati 17/21] Remove #if 0'd code Michel Dänzer
@ 2018-07-11 17:28   ` Michel Dänzer
  2018-07-11 17:28   ` [PATCH xf86-video-ati 19/21] modesetting: Record non-desktop kernel property at PreInit time Michel Dänzer
                     ` (3 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: Michel Dänzer @ 2018-07-11 17:28 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

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

Instead of from drmmode_set_mode_major. There's no need to re-set the
gamma LUT on every modeset, the kernel should preserve it.

(Ported from amdgpu commit baea4fa492f635cdfe746a84be2e337d9aeae8a9)

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

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index e301c0e6b..03c850f8a 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -887,9 +887,6 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
 		else
 			drmmode_crtc->scanout_id = 0;
 
-		drmmode_crtc_gamma_do_set(crtc, crtc->gamma_red, crtc->gamma_green,
-					  crtc->gamma_blue, crtc->gamma_size);
-
 		if (drmmode_crtc->prime_scanout_pixmap) {
 			drmmode_crtc_prime_scanout_update(crtc, mode, scanout_id,
 							  &fb, &x, &y);
@@ -2854,6 +2851,7 @@ Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode,
 Bool drmmode_setup_colormap(ScreenPtr pScreen, ScrnInfoPtr pScrn)
 {
     xf86CrtcConfigPtr   xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+    int i;
 
     if (xf86_config->num_crtc) {
 	xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG,
@@ -2862,13 +2860,23 @@ Bool drmmode_setup_colormap(ScreenPtr pScreen, ScrnInfoPtr pScrn)
 	    return FALSE;
 
 	/* All radeons support 10 bit CLUTs. They get bypassed at depth 30. */
-	if (pScrn->depth != 30 &&
-	    !xf86HandleColormaps(pScreen, 256, 10,
-				 NULL, NULL,
-				 CMAP_PALETTED_TRUECOLOR
-				 | CMAP_RELOAD_ON_MODE_SWITCH))
-	    return FALSE;
+	if (pScrn->depth != 30) {
+	    if (!xf86HandleColormaps(pScreen, 256, 10, NULL, NULL,
+				     CMAP_PALETTED_TRUECOLOR
+				     | CMAP_RELOAD_ON_MODE_SWITCH))
+		return FALSE;
+
+	    for (i = 0; i < xf86_config->num_crtc; i++) {
+		xf86CrtcPtr crtc = xf86_config->crtc[i];
+
+		drmmode_crtc_gamma_do_set(crtc, crtc->gamma_red,
+					  crtc->gamma_green,
+					  crtc->gamma_blue,
+					  crtc->gamma_size);
+	    }
+	}
     }
+
     return TRUE;
 }
 
-- 
2.18.0

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

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

* [PATCH xf86-video-ati 19/21] modesetting: Record non-desktop kernel property at PreInit time
       [not found] ` <20180711172806.22849-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
                     ` (17 preceding siblings ...)
  2018-07-11 17:28   ` [PATCH xf86-video-ati 18/21] Call drmmode_crtc_gamma_do_set from drmmode_setup_colormap Michel Dänzer
@ 2018-07-11 17:28   ` Michel Dänzer
  2018-07-11 17:28   ` [PATCH xf86-video-ati 20/21] modesetting: Create CONNECTOR_ID properties for outputs [v2] Michel Dänzer
                     ` (2 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: Michel Dänzer @ 2018-07-11 17:28 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

From: Keith Packard <keithp@keithp.com>

Save any value of the kernel non-desktop property in the xf86Output
structure to avoid non-desktop outputs in the default configuration.

[Also bump randrproto requirement to a version that defines
RR_PROPERTY_NON_DESKTOP - ajax]

Signed-off-by: Keith Packard <keithp@keithp.com>
(Ported from xserver commit b91c787c4cd2d20685db69426c539938c556128a)
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
(Ported from amdgpu commit 14db71a606128c4a207f43298809af279b77e2a8)
---
 configure.ac          |  2 +-
 src/drmmode_display.c | 16 ++++++++++++++++
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index f5614749f..65206e7fc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -64,7 +64,7 @@ AC_ARG_WITH(xorg-module-dir,
             [moduledir="$libdir/xorg/modules"])
 
 # Store the list of server defined optional extensions in REQUIRED_MODULES
-XORG_DRIVER_CHECK_EXT(RANDR, randrproto)
+XORG_DRIVER_CHECK_EXT(RANDR, [randrproto >= 1.6.0])
 XORG_DRIVER_CHECK_EXT(RENDER, renderproto)
 XORG_DRIVER_CHECK_EXT(XV, videoproto)
 XORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto)
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 03c850f8a..27aa5a6c8 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -1975,6 +1975,9 @@ drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, drmModeResPtr mode_r
 	drmModeEncoderPtr *kencoders = NULL;
 	drmmode_output_private_ptr drmmode_output;
 	drmModePropertyBlobPtr path_blob = NULL;
+#if XF86_CRTC_VERSION >= 8
+	Bool nonDesktop = FALSE;
+#endif
 	char name[32];
 	int i;
 	const char *s;
@@ -1985,6 +1988,13 @@ drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, drmModeResPtr mode_r
 
 	path_blob = koutput_get_prop_blob(pRADEONEnt->fd, koutput, "PATH");
 
+#if XF86_CRTC_VERSION >= 8
+	i = koutput_get_prop_idx(pRADEONEnt->fd, koutput, DRM_MODE_PROP_RANGE,
+				 RR_PROPERTY_NON_DESKTOP);
+	if (i >= 0)
+		nonDesktop = koutput->prop_values[i] != 0;
+#endif
+
 	kencoders = calloc(sizeof(drmModeEncoderPtr), koutput->count_encoders);
 	if (!kencoders) {
 		goto out_free_encoders;
@@ -2014,6 +2024,9 @@ drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, drmModeResPtr mode_r
 			drmmode_output = output->driver_private;
 			drmmode_output->output_id = mode_res->connectors[num];
 			drmmode_output->mode_output = koutput;
+#if XF86_CRTC_VERSION >= 8
+			output->non_desktop = nonDesktop;
+#endif
 			for (i = 0; i < koutput->count_encoders; i++)
 				drmModeFreeEncoder(kencoders[i]);
 			free(kencoders);
@@ -2055,6 +2068,9 @@ drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, drmModeResPtr mode_r
 	output->interlaceAllowed = TRUE;
 	output->doubleScanAllowed = TRUE;
 	output->driver_private = drmmode_output;
+#if XF86_CRTC_VERSION >= 8
+	output->non_desktop = nonDesktop;
+#endif
 	
 	output->possible_crtcs = 0xffffffff;
 	for (i = 0; i < koutput->count_encoders; i++) {
-- 
2.18.0

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

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

* [PATCH xf86-video-ati 20/21] modesetting: Create CONNECTOR_ID properties for outputs [v2]
       [not found] ` <20180711172806.22849-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
                     ` (18 preceding siblings ...)
  2018-07-11 17:28   ` [PATCH xf86-video-ati 19/21] modesetting: Record non-desktop kernel property at PreInit time Michel Dänzer
@ 2018-07-11 17:28   ` Michel Dänzer
  2018-07-11 17:28   ` [PATCH xf86-video-ati 21/21] Add RandR leases support Michel Dänzer
  2018-07-12  4:48   ` [PATCH xf86-video-ati 00/21] Port outstanding changes frm Alex Deucher
  21 siblings, 0 replies; 23+ messages in thread
From: Michel Dänzer @ 2018-07-11 17:28 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

From: Keith Packard <keithp@keithp.com>

This lets a DRM client map between X outputs and kernel connectors.

v2:
	Change CONNECTOR_ID to enum -- Adam Jackson <ajax@nwnk.net>

Signed-off-by: Keith Packard <keithp@keithp.com>
(Ported from xserver commit 023d4aba8d45e9e3630b944ecfb650c081799b96)
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
(Ported from amdgpu commit ab7e39c5a03e24c3ce3ee2f22ada7572bc2d9aa7)
---
 src/drmmode_display.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 27aa5a6c8..d4bd76e12 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -1643,6 +1643,33 @@ drmmode_output_create_resources(xf86OutputPtr output)
     RADEONEntPtr pRADEONEnt = RADEONEntPriv(output->scrn);
     drmModePropertyPtr drmmode_prop, tearfree_prop;
     int i, j, err;
+    Atom name;
+
+    /* Create CONNECTOR_ID property */
+    name = MakeAtom("CONNECTOR_ID", 12, TRUE);
+    if (name != BAD_RESOURCE) {
+	INT32 value = mode_output->connector_id;
+
+	err = RRConfigureOutputProperty(output->randr_output, name,
+					FALSE, FALSE, TRUE, 1, &value);
+	if (err != Success) {
+	    xf86DrvMsg(output->scrn->scrnIndex, X_ERROR,
+		       "RRConfigureOutputProperty error, %d\n", err);
+	}
+
+	err = RRChangeOutputProperty(output->randr_output, name,
+				     XA_INTEGER, 32, PropModeReplace, 1,
+				     &value, FALSE, FALSE);
+	if (err != Success) {
+	    xf86DrvMsg(output->scrn->scrnIndex, X_ERROR,
+		       "RRChangeOutputProperty error, %d\n", err);
+	}
+    }
+
+    drmmode_output->props =
+	calloc(mode_output->count_props + 1, sizeof(drmmode_prop_rec));
+    if (!drmmode_output->props)
+	return;
 
     drmmode_output->props = calloc(mode_output->count_props + 1, sizeof(drmmode_prop_rec));
     if (!drmmode_output->props)
-- 
2.18.0

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

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

* [PATCH xf86-video-ati 21/21] Add RandR leases support
       [not found] ` <20180711172806.22849-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
                     ` (19 preceding siblings ...)
  2018-07-11 17:28   ` [PATCH xf86-video-ati 20/21] modesetting: Create CONNECTOR_ID properties for outputs [v2] Michel Dänzer
@ 2018-07-11 17:28   ` Michel Dänzer
  2018-07-12  4:48   ` [PATCH xf86-video-ati 00/21] Port outstanding changes frm Alex Deucher
  21 siblings, 0 replies; 23+ messages in thread
From: Michel Dänzer @ 2018-07-11 17:28 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

From: Keith Packard <keithp@keithp.com>

Signed-off-by: Keith Packard <keithp@keithp.com>
(Ported from xserver commit e4e3447603b5fd3a38a92c3f972396d1f81168ad)
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
(Ported from amdgpu commit 61040bdfa360975614fb47aa7ea1b3a1abac3427)
---
 configure.ac          |   2 +-
 src/drmmode_display.c | 159 +++++++++++++++++++++++++++++++++++++++++-
 src/drmmode_display.h |   6 ++
 src/radeon_kms.c      |   1 +
 4 files changed, 166 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 65206e7fc..15c7b2128 100644
--- a/configure.ac
+++ b/configure.ac
@@ -70,7 +70,7 @@ XORG_DRIVER_CHECK_EXT(XV, videoproto)
 XORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto)
 
 # Checks for libraries.
-PKG_CHECK_MODULES(LIBDRM, [libdrm >= 2.4.78])
+PKG_CHECK_MODULES(LIBDRM, [libdrm >= 2.4.89])
 PKG_CHECK_MODULES(LIBDRM_RADEON, [libdrm_radeon])
 
 # Obtain compiler/linker options for the driver dependencies
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index d4bd76e12..2af64e3f3 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -2400,8 +2400,159 @@ drmmode_xf86crtc_resize (ScrnInfoPtr scrn, int width, int height)
 	return FALSE;
 }
 
+static void
+drmmode_validate_leases(ScrnInfoPtr scrn)
+{
+#ifdef XF86_LEASE_VERSION
+	ScreenPtr screen = scrn->pScreen;
+	rrScrPrivPtr scr_priv = rrGetScrPriv(screen);
+	RADEONEntPtr pRADEONEnt = RADEONEntPriv(scrn);
+	drmModeLesseeListPtr lessees;
+	RRLeasePtr lease, next;
+	int l;
+
+	/* We can't talk to the kernel about leases when VT switched */
+	if (!scrn->vtSema)
+		return;
+
+	lessees = drmModeListLessees(pRADEONEnt->fd);
+	if (!lessees)
+		return;
+
+	xorg_list_for_each_entry_safe(lease, next, &scr_priv->leases, list) {
+		drmmode_lease_private_ptr lease_private = lease->devPrivate;
+
+		for (l = 0; l < lessees->count; l++) {
+			if (lessees->lessees[l] == lease_private->lessee_id)
+				break;
+		}
+
+		/* check to see if the lease has gone away */
+		if (l == lessees->count) {
+			free(lease_private);
+			lease->devPrivate = NULL;
+			xf86CrtcLeaseTerminated(lease);
+		}
+	}
+
+	free(lessees);
+#endif
+}
+
+#ifdef XF86_LEASE_VERSION
+
+static int
+drmmode_create_lease(RRLeasePtr lease, int *fd)
+{
+	ScreenPtr screen = lease->screen;
+	ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
+	RADEONEntPtr pRADEONEnt = RADEONEntPriv(scrn);
+	drmmode_lease_private_ptr lease_private;
+	int noutput = lease->numOutputs;
+	int ncrtc = lease->numCrtcs;
+	uint32_t *objects;
+	size_t nobjects;
+	int lease_fd;
+	int c, o;
+	int i;
+
+	nobjects = ncrtc + noutput;
+	if (nobjects == 0 || nobjects > (SIZE_MAX / 4) ||
+	    ncrtc > (SIZE_MAX - noutput))
+		return BadValue;
+
+	lease_private = calloc(1, sizeof (drmmode_lease_private_rec));
+	if (!lease_private)
+		return BadAlloc;
+
+	objects = malloc(nobjects * 4);
+	if (!objects) {
+		free(lease_private);
+		return BadAlloc;
+	}
+
+	i = 0;
+
+	/* Add CRTC ids */
+	for (c = 0; c < ncrtc; c++) {
+		xf86CrtcPtr crtc = lease->crtcs[c]->devPrivate;
+		drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+
+		objects[i++] = drmmode_crtc->mode_crtc->crtc_id;
+	}
+
+	/* Add connector ids */
+	for (o = 0; o < noutput; o++) {
+		xf86OutputPtr   output = lease->outputs[o]->devPrivate;
+		drmmode_output_private_ptr drmmode_output = output->driver_private;
+
+		objects[i++] = drmmode_output->mode_output->connector_id;
+	}
+
+	/* call kernel to create lease */
+	assert (i == nobjects);
+
+	lease_fd = drmModeCreateLease(pRADEONEnt->fd, objects, nobjects, 0,
+				      &lease_private->lessee_id);
+
+	free(objects);
+
+	if (lease_fd < 0) {
+		free(lease_private);
+		return BadMatch;
+	}
+
+	lease->devPrivate = lease_private;
+
+	xf86CrtcLeaseStarted(lease);
+
+	*fd = lease_fd;
+	return Success;
+}
+
+static void
+drmmode_terminate_lease(RRLeasePtr lease)
+{
+	drmmode_lease_private_ptr lease_private = lease->devPrivate;
+	ScreenPtr screen = lease->screen;
+	ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
+	RADEONEntPtr pRADEONEnt = RADEONEntPriv(scrn);
+
+	if (drmModeRevokeLease(pRADEONEnt->fd, lease_private->lessee_id) == 0) {
+		free(lease_private);
+		lease->devPrivate = NULL;
+		xf86CrtcLeaseTerminated(lease);
+	}
+}
+
+#endif // XF86_LEASE_VERSION
+
+void
+drmmode_terminate_leases(ScrnInfoPtr pScrn)
+{
+#ifdef XF86_LEASE_VERSION
+	ScreenPtr screen = xf86ScrnToScreen(pScrn);
+	RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn);
+	rrScrPrivPtr scr_priv = rrGetScrPriv(screen);
+	RRLeasePtr lease, next;
+
+	xorg_list_for_each_entry_safe(lease, next, &scr_priv->leases, list) {
+		drmmode_lease_private_ptr lease_private = lease->devPrivate;
+		drmModeRevokeLease(pRADEONEnt->fd, lease_private->lessee_id);
+		free(lease_private);
+		lease->devPrivate = NULL;
+		RRLeaseTerminated(lease);
+		RRLeaseFree(lease);
+	}
+#endif
+}
+
 static const xf86CrtcConfigFuncsRec drmmode_xf86crtc_config_funcs = {
-	drmmode_xf86crtc_resize
+	.resize = drmmode_xf86crtc_resize,
+#ifdef XF86_LEASE_VERSION
+	.create_lease = drmmode_create_lease,
+	.terminate_lease = drmmode_terminate_lease
+#endif
 };
 
 static void
@@ -2888,6 +3039,9 @@ Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode,
 		return FALSE;
 	}
 
+	/* Validate leases on VT re-entry */
+	drmmode_validate_leases(pScrn);
+
 	return TRUE;
 }
 
@@ -3055,6 +3209,9 @@ restart_destroy:
 			changed = TRUE;
 	}
 
+	/* Check to see if a lessee has disappeared */
+	drmmode_validate_leases(scrn);
+
 	if (changed && dixPrivateKeyRegistered(rrPrivKey)) {
 #if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,14,99,2,0)
 		RRSetChanged(xf86ScrnToScreen(scrn));
diff --git a/src/drmmode_display.h b/src/drmmode_display.h
index 27c23c1a4..4551e0c77 100644
--- a/src/drmmode_display.h
+++ b/src/drmmode_display.h
@@ -139,6 +139,10 @@ typedef struct {
     int tear_free;
 } drmmode_output_private_rec, *drmmode_output_private_ptr;
 
+typedef struct {
+    uint32_t lessee_id;
+} drmmode_lease_private_rec, *drmmode_lease_private_ptr;
+
 
 enum drmmode_flip_sync {
     FLIP_VSYNC,
@@ -223,6 +227,8 @@ PixmapPtr drmmode_crtc_scanout_create(xf86CrtcPtr crtc,
 extern void drmmode_uevent_init(ScrnInfoPtr scrn, drmmode_ptr drmmode);
 extern void drmmode_uevent_fini(ScrnInfoPtr scrn, drmmode_ptr drmmode);
 
+extern void drmmode_terminate_leases(ScrnInfoPtr scrn);
+
 Bool drmmode_set_mode(xf86CrtcPtr crtc, struct drmmode_fb *fb,
 		      DisplayModePtr mode, int x, int y);
 
diff --git a/src/radeon_kms.c b/src/radeon_kms.c
index 36840ad36..c8a5726ad 100644
--- a/src/radeon_kms.c
+++ b/src/radeon_kms.c
@@ -2154,6 +2154,7 @@ static Bool RADEONCloseScreen_KMS(ScreenPtr pScreen)
     /* Clear mask of assigned crtc's in this generation */
     pRADEONEnt->assigned_crtcs = 0;
 
+    drmmode_terminate_leases(pScrn);
     drmmode_uevent_fini(pScrn, &info->drmmode);
     radeon_drm_queue_close(pScrn);
     radeon_cs_flush_indirect(pScrn);
-- 
2.18.0

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

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

* Re: [PATCH xf86-video-ati 00/21] Port outstanding changes frm
       [not found] ` <20180711172806.22849-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
                     ` (20 preceding siblings ...)
  2018-07-11 17:28   ` [PATCH xf86-video-ati 21/21] Add RandR leases support Michel Dänzer
@ 2018-07-12  4:48   ` Alex Deucher
  21 siblings, 0 replies; 23+ messages in thread
From: Alex Deucher @ 2018-07-12  4:48 UTC (permalink / raw)
  To: Michel Dänzer; +Cc: amd-gfx list

On Wed, Jul 11, 2018 at 1:27 PM, Michel Dänzer <michel@daenzer.net> wrote:
> From: Michel Dänzer <michel.daenzer@amd.com>
>
> These are ports of the outstanding applicable changes from the amdgpu
> driver.

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

>
> Emil Velikov (1):
>   Do not export the DriverRec RADEON
>
> Jim Qu (1):
>   Wait for pending scanout update before calling
>     drmmode_crtc_scanout_free
>
> Keith Packard (3):
>   modesetting: Record non-desktop kernel property at PreInit time
>   modesetting: Create CONNECTOR_ID properties for outputs [v2]
>   Add RandR leases support
>
> Michel Dänzer (16):
>   Ignore RADEON_DRM_QUEUE_ERROR (0) in radeon_drm_abort_entry
>   Track DRM event queue sequence number in scanout_update_pending
>   Abort scanout_update_pending event when possible
>   Update RandR CRTC state if set_mode_major fails in set_desired_modes
>   Simplify drmmode_crtc_scanout_update
>   Don't call scanout_flip/update with a legacy RandR scanout buffer
>   Simplify drmmode_handle_transform
>   Set drmmode_crtc->scanout_id = 0 when TearFree is disabled
>   Refactor drmmode_output_set_tear_free helper
>   Wait for pending flips in drmmode_output_set_tear_free
>   Replace 'foo == NULL' with '!foo'
>   Call drmmode_do_crtc_dpms from drmmode_crtc_dpms as well
>   Use drmmode_crtc_dpms in drmmode_set_desired_modes
>   Check dimensions passed to drmmode_xf86crtc_resize
>   Remove #if 0'd code
>   Call drmmode_crtc_gamma_do_set from drmmode_setup_colormap
>
>  configure.ac                 |   4 +-
>  src/ati.c                    |   4 +-
>  src/drmmode_display.c        | 344 ++++++++++++++++++++++++++++-------
>  src/drmmode_display.h        |   8 +-
>  src/evergreen_exa.c          |  10 +-
>  src/r600_exa.c               |  10 +-
>  src/radeon.h                 |   2 +-
>  src/radeon_dri2.c            |  12 +-
>  src/radeon_drm_queue.c       |   3 +
>  src/radeon_exa.c             |   2 +-
>  src/radeon_exa_funcs.c       |   8 +-
>  src/radeon_exa_render.c      |   6 +-
>  src/radeon_glamor.c          |   2 +-
>  src/radeon_glamor_wrappers.c |   4 +-
>  src/radeon_kms.c             |  45 ++---
>  src/radeon_probe.c           |   2 +-
>  src/radeon_textured_video.c  |  10 +-
>  src/radeon_video.c           |   6 +-
>  18 files changed, 352 insertions(+), 130 deletions(-)
>
> --
> 2.18.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] 23+ messages in thread

end of thread, other threads:[~2018-07-12  4:48 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-11 17:27 [PATCH xf86-video-ati 00/21] Port outstanding changes frm Michel Dänzer
     [not found] ` <20180711172806.22849-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
2018-07-11 17:27   ` [PATCH xf86-video-ati 01/21] Wait for pending scanout update before calling drmmode_crtc_scanout_free Michel Dänzer
2018-07-11 17:27   ` [PATCH xf86-video-ati 02/21] Do not export the DriverRec RADEON Michel Dänzer
2018-07-11 17:27   ` [PATCH xf86-video-ati 03/21] Ignore RADEON_DRM_QUEUE_ERROR (0) in radeon_drm_abort_entry Michel Dänzer
2018-07-11 17:27   ` [PATCH xf86-video-ati 04/21] Track DRM event queue sequence number in scanout_update_pending Michel Dänzer
2018-07-11 17:27   ` [PATCH xf86-video-ati 05/21] Abort scanout_update_pending event when possible Michel Dänzer
2018-07-11 17:27   ` [PATCH xf86-video-ati 06/21] Update RandR CRTC state if set_mode_major fails in set_desired_modes Michel Dänzer
2018-07-11 17:27   ` [PATCH xf86-video-ati 07/21] Simplify drmmode_crtc_scanout_update Michel Dänzer
2018-07-11 17:27   ` [PATCH xf86-video-ati 08/21] Don't call scanout_flip/update with a legacy RandR scanout buffer Michel Dänzer
2018-07-11 17:27   ` [PATCH xf86-video-ati 09/21] Simplify drmmode_handle_transform Michel Dänzer
2018-07-11 17:27   ` [PATCH xf86-video-ati 10/21] Set drmmode_crtc->scanout_id = 0 when TearFree is disabled Michel Dänzer
2018-07-11 17:27   ` [PATCH xf86-video-ati 11/21] Refactor drmmode_output_set_tear_free helper Michel Dänzer
2018-07-11 17:27   ` [PATCH xf86-video-ati 12/21] Wait for pending flips in drmmode_output_set_tear_free Michel Dänzer
2018-07-11 17:27   ` [PATCH xf86-video-ati 13/21] Replace 'foo == NULL' with '!foo' Michel Dänzer
2018-07-11 17:27   ` [PATCH xf86-video-ati 14/21] Call drmmode_do_crtc_dpms from drmmode_crtc_dpms as well Michel Dänzer
2018-07-11 17:28   ` [PATCH xf86-video-ati 15/21] Use drmmode_crtc_dpms in drmmode_set_desired_modes Michel Dänzer
2018-07-11 17:28   ` [PATCH xf86-video-ati 16/21] Check dimensions passed to drmmode_xf86crtc_resize Michel Dänzer
2018-07-11 17:28   ` [PATCH xf86-video-ati 17/21] Remove #if 0'd code Michel Dänzer
2018-07-11 17:28   ` [PATCH xf86-video-ati 18/21] Call drmmode_crtc_gamma_do_set from drmmode_setup_colormap Michel Dänzer
2018-07-11 17:28   ` [PATCH xf86-video-ati 19/21] modesetting: Record non-desktop kernel property at PreInit time Michel Dänzer
2018-07-11 17:28   ` [PATCH xf86-video-ati 20/21] modesetting: Create CONNECTOR_ID properties for outputs [v2] Michel Dänzer
2018-07-11 17:28   ` [PATCH xf86-video-ati 21/21] Add RandR leases support Michel Dänzer
2018-07-12  4:48   ` [PATCH xf86-video-ati 00/21] Port outstanding changes frm 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.