Skip to contentSkip to conversation

Add radeon_is_gpu_screen helper

PATCH In review Michel Dänzer 2 participants 4 messages Nov 28, 2016 2 messages not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add radeon_is_gpu_screen helper

From: Michel Dänzer <[email protected]>

This will hopefully decrease the chance of accidentally breaking the build against xserver < 1.13 in the future.

(Ported from radeon commit f130b10e63f7526360b41aa0918b4940f63f662a)

---
 src/amdgpu_drv.h      |  3 +++
 src/amdgpu_kms.c      | 14 +++-----------
 src/drmmode_display.c |  6 ++----
 3 files changed, 8 insertions(+), 15 deletions(-)
src/amdgpu_drv.h +3 -0
index ebfca8c..4eb4cf4 100644
@@ -149,6 +149,9 @@ typedef enum {
 
 #if XF86_CRTC_VERSION >= 5
 #define AMDGPU_PIXMAP_SHARING 1
+#define amdgpu_is_gpu_screen(screen) (screen)->isGPU
+#else
+#define amdgpu_is_gpu_screen(screen) 0
 #endif
 
 #define AMDGPU_VSYNC_TIMEOUT	20000	/* Maximum wait for VSYNC (in usecs) */
src/amdgpu_kms.c +3 -11
index 18d2abb..bc48ca6 100644
@@ -237,10 +237,7 @@ static Bool AMDGPUCreateScreenResources_KMS(ScreenPtr pScreen)
 	if (dixPrivateKeyRegistered(rrPrivKey)) {
 		rrScrPrivPtr rrScrPriv = rrGetScrPriv(pScreen);
 
-		if (
-#ifdef AMDGPU_PIXMAP_SHARING
-		    !pScreen->isGPU &&
-#endif
+		if (!amdgpu_is_gpu_screen(pScreen) &&
 		    !rrScrPriv->primaryOutput)
 		{
 			xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
@@ -277,10 +274,7 @@ static Bool AMDGPUCreateScreenResources_KMS(ScreenPtr pScreen)
 		amdgpu_glamor_create_screen_resources(pScreen);
 
 	info->callback_event_type = -1;
-	if (
-#ifdef AMDGPU_PIXMAP_SHARING
-		!pScreen->isGPU &&
-#endif
+	if (!amdgpu_is_gpu_screen(pScreen) &&
 		(damage_ext = CheckExtension("DAMAGE"))) {
 		info->callback_event_type = damage_ext->eventBase + XDamageNotify;
 
@@ -1001,9 +995,7 @@ static void AMDGPUBlockHandler_KMS(BLOCKHANDLER_ARGS_DECL)
 	(*pScreen->BlockHandler) (BLOCKHANDLER_ARGS);
 	pScreen->BlockHandler = AMDGPUBlockHandler_KMS;
 
-#ifdef AMDGPU_PIXMAP_SHARING
-	if (!pScreen->isGPU)
-#endif
+	if (!amdgpu_is_gpu_screen(pScreen))
 	{
 		for (c = 0; c < xf86_config->num_crtc; c++) {
 			if (info->tear_free)
src/drmmode_display.c +2 -4
index 8cedc5f..30a0f54 100644
@@ -721,10 +721,8 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
 		if (drmmode_crtc->rotate.fb_id) {
 			fb_id = drmmode_crtc->rotate.fb_id;
 			x = y = 0;
-		} else if (
-#ifdef AMDGPU_PIXMAP_SHARING
-			   !pScreen->isGPU &&
-#endif
+
+		} else if (!amdgpu_is_gpu_screen(pScreen) &&
 			   (info->tear_free ||
 #if XF86_CRTC_VERSION >= 4
 			    crtc->driverIsPerformingTransform ||
Signature · 6 lines
2.10.2

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 20161128085139.30426-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org

#2 lore raw

PATCH v2 1/1 Add amdgpu_is_gpu_screen helper

From: Michel Dänzer <[email protected]>

This will hopefully decrease the chance of accidentally breaking the build against xserver < 1.13 in the future.

(Ported from radeon commit f130b10e63f7526360b41aa0918b4940f63f662a)

---

v2: radeon_is_gpu_screen -> amdgpu_is_gpu_screen in shortlog

 src/amdgpu_drv.h      |  3 +++
 src/amdgpu_kms.c      | 14 +++-----------
 src/drmmode_display.c |  6 ++----
 3 files changed, 8 insertions(+), 15 deletions(-)
src/amdgpu_drv.h +3 -0
index ebfca8c..4eb4cf4 100644
@@ -149,6 +149,9 @@ typedef enum {
 
 #if XF86_CRTC_VERSION >= 5
 #define AMDGPU_PIXMAP_SHARING 1
+#define amdgpu_is_gpu_screen(screen) (screen)->isGPU
+#else
+#define amdgpu_is_gpu_screen(screen) 0
 #endif
 
 #define AMDGPU_VSYNC_TIMEOUT	20000	/* Maximum wait for VSYNC (in usecs) */
src/amdgpu_kms.c +3 -11
index 18d2abb..bc48ca6 100644
@@ -237,10 +237,7 @@ static Bool AMDGPUCreateScreenResources_KMS(ScreenPtr pScreen)
 	if (dixPrivateKeyRegistered(rrPrivKey)) {
 		rrScrPrivPtr rrScrPriv = rrGetScrPriv(pScreen);
 
-		if (
-#ifdef AMDGPU_PIXMAP_SHARING
-		    !pScreen->isGPU &&
-#endif
+		if (!amdgpu_is_gpu_screen(pScreen) &&
 		    !rrScrPriv->primaryOutput)
 		{
 			xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
@@ -277,10 +274,7 @@ static Bool AMDGPUCreateScreenResources_KMS(ScreenPtr pScreen)
 		amdgpu_glamor_create_screen_resources(pScreen);
 
 	info->callback_event_type = -1;
-	if (
-#ifdef AMDGPU_PIXMAP_SHARING
-		!pScreen->isGPU &&
-#endif
+	if (!amdgpu_is_gpu_screen(pScreen) &&
 		(damage_ext = CheckExtension("DAMAGE"))) {
 		info->callback_event_type = damage_ext->eventBase + XDamageNotify;
 
@@ -1001,9 +995,7 @@ static void AMDGPUBlockHandler_KMS(BLOCKHANDLER_ARGS_DECL)
 	(*pScreen->BlockHandler) (BLOCKHANDLER_ARGS);
 	pScreen->BlockHandler = AMDGPUBlockHandler_KMS;
 
-#ifdef AMDGPU_PIXMAP_SHARING
-	if (!pScreen->isGPU)
-#endif
+	if (!amdgpu_is_gpu_screen(pScreen))
 	{
 		for (c = 0; c < xf86_config->num_crtc; c++) {
 			if (info->tear_free)
src/drmmode_display.c +2 -4
index 8cedc5f..30a0f54 100644
@@ -721,10 +721,8 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
 		if (drmmode_crtc->rotate.fb_id) {
 			fb_id = drmmode_crtc->rotate.fb_id;
 			x = y = 0;
-		} else if (
-#ifdef AMDGPU_PIXMAP_SHARING
-			   !pScreen->isGPU &&
-#endif
+
+		} else if (!amdgpu_is_gpu_screen(pScreen) &&
 			   (info->tear_free ||
 #if XF86_CRTC_VERSION >= 4
 			    crtc->driverIsPerformingTransform ||
Signature · 6 lines
2.10.2

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 20161128085642.30554-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org

Reviewed-by Alex Deucher
#4 lore raw

RE: [PATCH xf86-video-amdgpu v2] Add amdgpu_is_gpu_screen helper

Quoted 12 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Michel Dänzer
Sent: Monday, November 28, 2016 3:57 AM
To: [email protected]
Subject: [PATCH xf86-video-amdgpu v2] Add amdgpu_is_gpu_screen helper

From: Michel Dänzer <[email protected]>

This will hopefully decrease the chance of accidentally breaking the build against xserver < 1.13 in the future.

Quoted 6 lines

(Ported from radeon commit f130b10e63f7526360b41aa0918b4940f63f662a)

---

v2: radeon_is_gpu_screen -> amdgpu_is_gpu_screen in shortlog

Quoted 86 lines
 src/amdgpu_drv.h      |  3 +++
 src/amdgpu_kms.c      | 14 +++-----------
 src/drmmode_display.c |  6 ++----
 3 files changed, 8 insertions(+), 15 deletions(-)
src/amdgpu_drv.h +3 -0
index ebfca8c..4eb4cf4 100644
@@ -149,6 +149,9 @@ typedef enum {
 
 #if XF86_CRTC_VERSION >= 5
 #define AMDGPU_PIXMAP_SHARING 1
+#define amdgpu_is_gpu_screen(screen) (screen)->isGPU
+#else
+#define amdgpu_is_gpu_screen(screen) 0
 #endif
 
 #define AMDGPU_VSYNC_TIMEOUT	20000	/* Maximum wait for VSYNC

(in usecs) */

src/amdgpu_kms.c +1 -4
index 18d2abb..bc48ca6 100644
@@ -237,10 +237,7 @@ static Bool
 AMDGPUCreateScreenResources_KMS(ScreenPtr pScreen)
 	if (dixPrivateKeyRegistered(rrPrivKey)) {
 		rrScrPrivPtr rrScrPriv = rrGetScrPriv(pScreen);
 
-		if (
-#ifdef AMDGPU_PIXMAP_SHARING
-		    !pScreen->isGPU &&
-#endif
+		if (!amdgpu_is_gpu_screen(pScreen) &&
 		    !rrScrPriv->primaryOutput)
 		{

xf86CrtcConfigPtr xf86_config =
XF86_CRTC_CONFIG_PTR(pScrn);

src/amdgpu_kms.c +1 -4
@@ -277,10 +274,7 @@ static Bool
 AMDGPUCreateScreenResources_KMS(ScreenPtr pScreen)
 		amdgpu_glamor_create_screen_resources(pScreen);
 
 	info->callback_event_type = -1;
-	if (
-#ifdef AMDGPU_PIXMAP_SHARING
-		!pScreen->isGPU &&
-#endif
+	if (!amdgpu_is_gpu_screen(pScreen) &&
 		(damage_ext = CheckExtension("DAMAGE"))) {
 		info->callback_event_type = damage_ext->eventBase +

XDamageNotify;

src/amdgpu_kms.c +1 -3
@@ -1001,9 +995,7 @@ static void
 AMDGPUBlockHandler_KMS(BLOCKHANDLER_ARGS_DECL)
 	(*pScreen->BlockHandler) (BLOCKHANDLER_ARGS);
 	pScreen->BlockHandler = AMDGPUBlockHandler_KMS;
 
-#ifdef AMDGPU_PIXMAP_SHARING
-	if (!pScreen->isGPU)
-#endif
+	if (!amdgpu_is_gpu_screen(pScreen))
 	{
 		for (c = 0; c < xf86_config->num_crtc; c++) {
src/amdgpu_kms.c +0 -0
 			if (info->tear_free)
src/drmmode_display.c +2 -4
index 8cedc5f..30a0f54 100644
@@ -721,10 +721,8 @@ drmmode_set_mode_major(xf86CrtcPtr crtc,
 DisplayModePtr mode,
 		if (drmmode_crtc->rotate.fb_id) {
 			fb_id = drmmode_crtc->rotate.fb_id;
 			x = y = 0;
-		} else if (
-#ifdef AMDGPU_PIXMAP_SHARING
-			   !pScreen->isGPU &&
-#endif
+
+		} else if (!amdgpu_is_gpu_screen(pScreen) &&
 			   (info->tear_free ||
 #if XF86_CRTC_VERSION >= 4

crtc->driverIsPerformingTransform ||
--
2.10.2

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reviewed-by Alex Deucher
#5 lore raw
In reply to a message not in the archive
Quoted 7 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Michel Dänzer
Sent: Monday, November 28, 2016 3:52 AM
To: [email protected]
Subject: [PATCH xf86-video-amdgpu] Add radeon_is_gpu_screen helper

Quoted 8 lines

From: Michel Dänzer <[email protected]>

This will hopefully decrease the chance of accidentally breaking the build against xserver < 1.13 in the future.

(Ported from radeon commit f130b10e63f7526360b41aa0918b4940f63f662a)

Quoted 86 lines
---
 src/amdgpu_drv.h      |  3 +++
 src/amdgpu_kms.c      | 14 +++-----------
 src/drmmode_display.c |  6 ++----
 3 files changed, 8 insertions(+), 15 deletions(-)
src/amdgpu_drv.h +3 -0
index ebfca8c..4eb4cf4 100644
@@ -149,6 +149,9 @@ typedef enum {
 
 #if XF86_CRTC_VERSION >= 5
 #define AMDGPU_PIXMAP_SHARING 1
+#define amdgpu_is_gpu_screen(screen) (screen)->isGPU
+#else
+#define amdgpu_is_gpu_screen(screen) 0
 #endif
 
 #define AMDGPU_VSYNC_TIMEOUT	20000	/* Maximum wait for VSYNC

(in usecs) */

src/amdgpu_kms.c +1 -4
index 18d2abb..bc48ca6 100644
@@ -237,10 +237,7 @@ static Bool
 AMDGPUCreateScreenResources_KMS(ScreenPtr pScreen)
 	if (dixPrivateKeyRegistered(rrPrivKey)) {
 		rrScrPrivPtr rrScrPriv = rrGetScrPriv(pScreen);
 
-		if (
-#ifdef AMDGPU_PIXMAP_SHARING
-		    !pScreen->isGPU &&
-#endif
+		if (!amdgpu_is_gpu_screen(pScreen) &&
 		    !rrScrPriv->primaryOutput)
 		{

xf86CrtcConfigPtr xf86_config =
XF86_CRTC_CONFIG_PTR(pScrn);

src/amdgpu_kms.c +1 -4
@@ -277,10 +274,7 @@ static Bool
 AMDGPUCreateScreenResources_KMS(ScreenPtr pScreen)
 		amdgpu_glamor_create_screen_resources(pScreen);
 
 	info->callback_event_type = -1;
-	if (
-#ifdef AMDGPU_PIXMAP_SHARING
-		!pScreen->isGPU &&
-#endif
+	if (!amdgpu_is_gpu_screen(pScreen) &&
 		(damage_ext = CheckExtension("DAMAGE"))) {
 		info->callback_event_type = damage_ext->eventBase +

XDamageNotify;

src/amdgpu_kms.c +1 -3
@@ -1001,9 +995,7 @@ static void
 AMDGPUBlockHandler_KMS(BLOCKHANDLER_ARGS_DECL)
 	(*pScreen->BlockHandler) (BLOCKHANDLER_ARGS);
 	pScreen->BlockHandler = AMDGPUBlockHandler_KMS;
 
-#ifdef AMDGPU_PIXMAP_SHARING
-	if (!pScreen->isGPU)
-#endif
+	if (!amdgpu_is_gpu_screen(pScreen))
 	{
 		for (c = 0; c < xf86_config->num_crtc; c++) {
src/amdgpu_kms.c +0 -0
 			if (info->tear_free)
src/drmmode_display.c +2 -4
index 8cedc5f..30a0f54 100644
@@ -721,10 +721,8 @@ drmmode_set_mode_major(xf86CrtcPtr crtc,
 DisplayModePtr mode,
 		if (drmmode_crtc->rotate.fb_id) {
 			fb_id = drmmode_crtc->rotate.fb_id;
 			x = y = 0;
-		} else if (
-#ifdef AMDGPU_PIXMAP_SHARING
-			   !pScreen->isGPU &&
-#endif
+
+		} else if (!amdgpu_is_gpu_screen(pScreen) &&
 			   (info->tear_free ||
 #if XF86_CRTC_VERSION >= 4

crtc->driverIsPerformingTransform ||
--
2.10.2

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx