xf86-video-ati/U_08-Add-explicit-RADEON_DRM_QUEUE_ERROR-define.patch
Max Staudt 84a4590c79 Accepting request 438260 from home:mstaudt:branches:X11:XOrg
- U_01-* ... U_20-* :
  Include patches that haven't made it into the 7.7.1 release.

  This means almost all commits between xf86-video-ati-7.7.0
  and 12d30eeb9711bd2b1609d6bbb74c4a1760596f72.

  Fixes (bsc#990066).

OBS-URL: https://build.opensuse.org/request/show/438260
OBS-URL: https://build.opensuse.org/package/show/X11:XOrg/xf86-video-ati?expand=0&rev=51
2016-11-02 10:39:34 +00:00

125 lines
4.6 KiB
Diff

From: Michel Dänzer <michel.daenzer@amd.com>
Date: Wed Jul 6 12:46:01 2016 +0900
Subject: [PATCH 8/20]Add explicit RADEON_DRM_QUEUE_ERROR define
Patch-mainline: Upstream
Git-repo: git://anongit.freedesktop.org/xorg/driver/xf86-video-ati
Git-commit: a37af701768b12d86868a831a79f1e02ee4968cf
References: bsc#990066
Signed-off-by: Max Staudt <mstaudt@suse.de>
Should make the radeon_drm_queue_alloc error handling clearer, and gets
rid of a compile warning about it returning NULL.
Reviewed-by: Alexandre Demers <alexandre.f.demers@gmail.com>
---
src/drmmode_display.c | 2 +-
src/radeon_dri2.c | 4 ++--
src/radeon_drm_queue.c | 7 ++++---
src/radeon_drm_queue.h | 2 ++
src/radeon_kms.c | 4 ++--
src/radeon_present.c | 2 +-
6 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index e32791d..b9c8097 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -2829,7 +2829,7 @@ Bool radeon_do_pageflip(ScrnInfoPtr scrn, ClientPtr client,
flipdata,
drmmode_flip_handler,
drmmode_flip_abort);
- if (!drm_queue_seq) {
+ if (drm_queue_seq == RADEON_DRM_QUEUE_ERROR) {
xf86DrvMsg(scrn->scrnIndex, X_WARNING,
"Allocating DRM queue event entry failed.\n");
goto error;
diff --git a/src/radeon_dri2.c b/src/radeon_dri2.c
index 5ebc9b7..69fd0ea 100644
--- a/src/radeon_dri2.c
+++ b/src/radeon_dri2.c
@@ -1143,7 +1143,7 @@ static int radeon_dri2_schedule_wait_msc(ClientPtr client, DrawablePtr draw,
drm_queue_seq = radeon_drm_queue_alloc(crtc, client, RADEON_DRM_QUEUE_ID_DEFAULT,
wait_info, radeon_dri2_frame_event_handler,
radeon_dri2_frame_event_abort);
- if (!drm_queue_seq) {
+ if (drm_queue_seq == RADEON_DRM_QUEUE_ERROR) {
xf86DrvMsg(scrn->scrnIndex, X_WARNING,
"Allocating DRM queue event entry failed.\n");
goto out_complete;
@@ -1290,7 +1290,7 @@ static int radeon_dri2_schedule_swap(ClientPtr client, DrawablePtr draw,
drm_queue_seq = radeon_drm_queue_alloc(crtc, client, RADEON_DRM_QUEUE_ID_DEFAULT,
swap_info, radeon_dri2_frame_event_handler,
radeon_dri2_frame_event_abort);
- if (!drm_queue_seq) {
+ if (drm_queue_seq == RADEON_DRM_QUEUE_ERROR) {
xf86DrvMsg(scrn->scrnIndex, X_WARNING,
"Allocating DRM queue entry failed.\n");
goto blit_fallback;
diff --git a/src/radeon_drm_queue.c b/src/radeon_drm_queue.c
index 0d999dd..31f2435 100644
--- a/src/radeon_drm_queue.c
+++ b/src/radeon_drm_queue.c
@@ -92,10 +92,11 @@ radeon_drm_queue_alloc(xf86CrtcPtr crtc, ClientPtr client,
e = calloc(1, sizeof(struct radeon_drm_queue_entry));
if (!e)
- return NULL;
+ return RADEON_DRM_QUEUE_ERROR;
+
+ if (_X_UNLIKELY(radeon_drm_queue_seq == RADEON_DRM_QUEUE_ERROR))
+ radeon_drm_queue_seq++;
- if (!radeon_drm_queue_seq)
- radeon_drm_queue_seq = 1;
e->seq = radeon_drm_queue_seq++;
e->client = client;
e->crtc = crtc;
diff --git a/src/radeon_drm_queue.h b/src/radeon_drm_queue.h
index 0d9d278..c3e2076 100644
--- a/src/radeon_drm_queue.h
+++ b/src/radeon_drm_queue.h
@@ -29,6 +29,8 @@
#ifndef _RADEON_DRM_QUEUE_H_
#define _RADEON_DRM_QUEUE_H_
+#define RADEON_DRM_QUEUE_ERROR 0
+
#define RADEON_DRM_QUEUE_CLIENT_DEFAULT serverClient
#define RADEON_DRM_QUEUE_ID_DEFAULT ~0ULL
diff --git a/src/radeon_kms.c b/src/radeon_kms.c
index 0ced370..3ba9945 100644
--- a/src/radeon_kms.c
+++ b/src/radeon_kms.c
@@ -529,7 +529,7 @@ radeon_scanout_update(xf86CrtcPtr xf86_crtc)
drmmode_crtc,
radeon_scanout_update_handler,
radeon_scanout_update_abort);
- if (!drm_queue_seq) {
+ if (drm_queue_seq == RADEON_DRM_QUEUE_ERROR) {
xf86DrvMsg(scrn->scrnIndex, X_WARNING,
"radeon_drm_queue_alloc failed for scanout update\n");
return;
@@ -581,7 +581,7 @@ radeon_scanout_flip(ScreenPtr pScreen, RADEONInfoPtr info,
RADEON_DRM_QUEUE_ID_DEFAULT,
drmmode_crtc, NULL,
radeon_scanout_flip_abort);
- if (!drm_queue_seq) {
+ if (drm_queue_seq == RADEON_DRM_QUEUE_ERROR) {
xf86DrvMsg(scrn->scrnIndex, X_WARNING,
"Allocating DRM event queue entry failed.\n");
return;
diff --git a/src/radeon_present.c b/src/radeon_present.c
index 69a0532..93c18a8 100644
--- a/src/radeon_present.c
+++ b/src/radeon_present.c
@@ -169,7 +169,7 @@ radeon_present_queue_vblank(RRCrtcPtr crtc, uint64_t event_id, uint64_t msc)
event_id, event,
radeon_present_vblank_handler,
radeon_present_vblank_abort);
- if (!drm_queue_seq) {
+ if (drm_queue_seq == RADEON_DRM_QUEUE_ERROR) {
free(event);
return BadAlloc;
}