diff options
author | Michel Dänzer <michel.daenzer@amd.com> | 2016-09-07 18:03:05 +0900 |
---|---|---|
committer | Michel Dänzer <michel.daenzer@amd.com> | 2016-09-07 18:03:05 +0900 |
commit | d166d04f6951f6a48d7d5ce5d31bba857fe0cb06 (patch) | |
tree | caf8674276d914a3466c95b07e08ac4d04f774d1 | |
parent | 6a1ba044c2b71081e6060d0c096917d6238f2145 (diff) |
Add explicit AMDGPU_DRM_QUEUE_ERROR define
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)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | src/amdgpu_dri2.c | 4 | ||||
-rw-r--r-- | src/amdgpu_drm_queue.c | 7 | ||||
-rw-r--r-- | src/amdgpu_drm_queue.h | 2 | ||||
-rw-r--r-- | src/amdgpu_kms.c | 4 | ||||
-rw-r--r-- | src/amdgpu_present.c | 2 | ||||
-rw-r--r-- | 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; |