All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH xf86-video-amdgpu 01/12] Add explicit AMDGPU_DRM_QUEUE_ERROR define
@ 2016-09-08 10:02 Michel Dänzer
       [not found] ` <20160908100242.19964-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Michel Dänzer @ 2016-09-08 10:02 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

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

Should make the amdgpu_drm_queue_alloc error handling clearer, and gets
rid of a compile warning about it returning NULL.

(Ported from radeon commit a37af701768b12d86868a831a79f1e02ee4968cf)

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
---
 src/amdgpu_dri2.c      | 4 ++--
 src/amdgpu_drm_queue.c | 7 ++++---
 src/amdgpu_drm_queue.h | 2 ++
 src/amdgpu_kms.c       | 4 ++--
 src/amdgpu_present.c   | 2 +-
 src/drmmode_display.c  | 2 +-
 6 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/src/amdgpu_dri2.c b/src/amdgpu_dri2.c
index 1cbf1eb..31ac3f3 100644
--- a/src/amdgpu_dri2.c
+++ b/src/amdgpu_dri2.c
@@ -1035,7 +1035,7 @@ static int amdgpu_dri2_schedule_wait_msc(ClientPtr client, DrawablePtr draw,
 	drm_queue_seq = amdgpu_drm_queue_alloc(crtc, client, AMDGPU_DRM_QUEUE_ID_DEFAULT,
 					       wait_info, amdgpu_dri2_frame_event_handler,
 					       amdgpu_dri2_frame_event_abort);
-	if (!drm_queue_seq) {
+	if (drm_queue_seq == AMDGPU_DRM_QUEUE_ERROR) {
 		xf86DrvMsg(scrn->scrnIndex, X_WARNING,
 			   "Allocating DRM queue event entry failed.\n");
 		goto out_complete;
@@ -1183,7 +1183,7 @@ static int amdgpu_dri2_schedule_swap(ClientPtr client, DrawablePtr draw,
 	drm_queue_seq = amdgpu_drm_queue_alloc(crtc, client, AMDGPU_DRM_QUEUE_ID_DEFAULT,
 					       swap_info, amdgpu_dri2_frame_event_handler,
 					       amdgpu_dri2_frame_event_abort);
-	if (!drm_queue_seq) {
+	if (drm_queue_seq == AMDGPU_DRM_QUEUE_ERROR) {
 		xf86DrvMsg(scrn->scrnIndex, X_WARNING,
 			   "Allocating DRM queue entry failed.\n");
 		goto blit_fallback;
diff --git a/src/amdgpu_drm_queue.c b/src/amdgpu_drm_queue.c
index 562a11a..e8810fd 100644
--- a/src/amdgpu_drm_queue.c
+++ b/src/amdgpu_drm_queue.c
@@ -92,10 +92,11 @@ amdgpu_drm_queue_alloc(xf86CrtcPtr crtc, ClientPtr client,
 
 	e = calloc(1, sizeof(struct amdgpu_drm_queue_entry));
 	if (!e)
-		return NULL;
+		return AMDGPU_DRM_QUEUE_ERROR;
+
+	if (_X_UNLIKELY(amdgpu_drm_queue_seq == AMDGPU_DRM_QUEUE_ERROR))
+		amdgpu_drm_queue_seq++;
 
-	if (!amdgpu_drm_queue_seq)
-		amdgpu_drm_queue_seq = 1;
 	e->seq = amdgpu_drm_queue_seq++;
 	e->client = client;
 	e->crtc = crtc;
diff --git a/src/amdgpu_drm_queue.h b/src/amdgpu_drm_queue.h
index b4d4009..36ee900 100644
--- a/src/amdgpu_drm_queue.h
+++ b/src/amdgpu_drm_queue.h
@@ -31,6 +31,8 @@
 
 #include <xf86Crtc.h>
 
+#define AMDGPU_DRM_QUEUE_ERROR 0
+
 #define AMDGPU_DRM_QUEUE_CLIENT_DEFAULT serverClient
 #define AMDGPU_DRM_QUEUE_ID_DEFAULT ~0ULL
 
diff --git a/src/amdgpu_kms.c b/src/amdgpu_kms.c
index d9f15a4..9f023cf 100644
--- a/src/amdgpu_kms.c
+++ b/src/amdgpu_kms.c
@@ -426,7 +426,7 @@ amdgpu_scanout_update(xf86CrtcPtr xf86_crtc)
 					       drmmode_crtc,
 					       amdgpu_scanout_update_handler,
 					       amdgpu_scanout_update_abort);
-	if (!drm_queue_seq) {
+	if (drm_queue_seq == AMDGPU_DRM_QUEUE_ERROR) {
 		xf86DrvMsg(scrn->scrnIndex, X_WARNING,
 			   "amdgpu_drm_queue_alloc failed for scanout update\n");
 		return;
@@ -480,7 +480,7 @@ amdgpu_scanout_flip(ScreenPtr pScreen, AMDGPUInfoPtr info,
 					       AMDGPU_DRM_QUEUE_ID_DEFAULT,
 					       drmmode_crtc, NULL,
 					       amdgpu_scanout_flip_abort);
-	if (!drm_queue_seq) {
+	if (drm_queue_seq == AMDGPU_DRM_QUEUE_ERROR) {
 		xf86DrvMsg(scrn->scrnIndex, X_WARNING,
 			   "Allocating DRM event queue entry failed.\n");
 		return;
diff --git a/src/amdgpu_present.c b/src/amdgpu_present.c
index edfccb1..192c410 100644
--- a/src/amdgpu_present.c
+++ b/src/amdgpu_present.c
@@ -170,7 +170,7 @@ amdgpu_present_queue_vblank(RRCrtcPtr crtc, uint64_t event_id, uint64_t msc)
 					       event_id, event,
 					       amdgpu_present_vblank_handler,
 					       amdgpu_present_vblank_abort);
-	if (!drm_queue_seq) {
+	if (drm_queue_seq == AMDGPU_DRM_QUEUE_ERROR) {
 		free(event);
 		return BadAlloc;
 	}
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index fdd5922..3063fac 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -2537,7 +2537,7 @@ Bool amdgpu_do_pageflip(ScrnInfoPtr scrn, ClientPtr client,
 						       flipdata,
 						       drmmode_flip_handler,
 						       drmmode_flip_abort);
-		if (!drm_queue_seq) {
+		if (drm_queue_seq == AMDGPU_DRM_QUEUE_ERROR) {
 			xf86DrvMsg(scrn->scrnIndex, X_WARNING,
 				   "Allocating DRM queue event entry failed.\n");
 			goto error;
-- 
2.9.3

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

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

end of thread, other threads:[~2016-09-08 12:53 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-08 10:02 [PATCH xf86-video-amdgpu 01/12] Add explicit AMDGPU_DRM_QUEUE_ERROR define Michel Dänzer
     [not found] ` <20160908100242.19964-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
2016-09-08 10:02   ` [PATCH xf86-video-amdgpu 02/12] Use EventCallback to avoid flushing every time in the FlushCallback Michel Dänzer
2016-09-08 10:02   ` [PATCH xf86-video-amdgpu 03/12] Keep track of damage event related flushes per-client Michel Dänzer
2016-09-08 10:02   ` [PATCH xf86-video-amdgpu 04/12] Wait for pending flips to complete before turning off an output or CRTC Michel Dänzer
2016-09-08 10:02   ` [PATCH xf86-video-amdgpu 05/12] Use drmmode_crtc_scanout_* helpers for RandR 1.4 scanout pixmaps Michel Dänzer
2016-09-08 10:02   ` [PATCH xf86-video-amdgpu 06/12] Handle RandR 1.4 slave dirty updates via amdgpu_drm_queue Michel Dänzer
2016-09-08 10:02   ` [PATCH xf86-video-amdgpu 07/12] Track damage accurately for RandR 1.4 slave scanout Michel Dänzer
2016-09-08 10:02   ` [PATCH xf86-video-amdgpu 08/12] Only copy from screen pixmap to shared pixmap on demand for " Michel Dänzer
2016-09-08 10:02   ` [PATCH xf86-video-amdgpu 09/12] Factor out transform_region helper Michel Dänzer
2016-09-08 10:03   ` [PATCH xf86-video-amdgpu 10/12] Move up amdgpu_scanout_extents_intersect Michel Dänzer
     [not found]     ` <20160908100310.20051-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
2016-09-08 10:03       ` [PATCH xf86-video-amdgpu 11/12] Synchronize scanout pixmaps for TearFree Michel Dänzer
2016-09-08 10:03       ` [PATCH xf86-video-amdgpu 12/12] Make TearFree effective with PRIME slave scanout Michel Dänzer
     [not found]         ` <20160908100310.20051-3-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
2016-09-08 12:53           ` Deucher, Alexander

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.