1From a78e31b5fffadd73b00483f21e54bd144f1b439a Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Michel=20D=C3=A4nzer?= <mdaenzer@redhat.com>
3Date: Fri, 26 Mar 2021 17:42:10 +0100
4Subject: [PATCH] Guard local variable priv only used with glamor
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9Fixes compile errors with glamor disabled:
10
11../../src/radeon_present.c: In function ‘radeon_present_check_flip’:
12../../src/radeon_present.c:281:21: error: invalid use of undefined type ‘struct radeon_pixmap’
13  281 |     if (priv && priv->fb_failed)
14      |                     ^~
15../../src/radeon_present.c:288:19: error: invalid use of undefined type ‘struct radeon_pixmap’
16  288 |  if (priv && !priv->fb_failed) {
17      |                   ^~
18../../src/radeon_present.c:292:10: error: invalid use of undefined type ‘struct radeon_pixmap’
19  292 |      priv->fb_failed = TRUE;
20      |          ^~
21
22(cherry picked from commit 3c7c84ed49564907a148ae99b03200e0be350060)
23Signed-off-by: Romain Naour <romain.naour@gmail.com>
24---
25 src/radeon_present.c | 6 ++++++
26 1 file changed, 6 insertions(+)
27
28diff --git a/src/radeon_present.c b/src/radeon_present.c
29index 494655c9..d010aa19 100644
30--- a/src/radeon_present.c
31+++ b/src/radeon_present.c
32@@ -254,7 +254,9 @@ radeon_present_check_flip(RRCrtcPtr crtc, WindowPtr window, PixmapPtr pixmap,
33     xf86CrtcPtr xf86_crtc = crtc->devPrivate;
34     ScreenPtr screen = window->drawable.pScreen;
35     ScrnInfoPtr scrn = xf86_crtc->scrn;
36+#ifdef USE_GLAMOR
37     struct radeon_pixmap *priv = radeon_get_pixmap_private(pixmap);
38+#endif
39     xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
40     RADEONInfoPtr info = RADEONPTR(scrn);
41     PixmapPtr screen_pixmap = screen->GetScreenPixmap(screen);
42@@ -278,10 +280,13 @@ radeon_present_check_flip(RRCrtcPtr crtc, WindowPtr window, PixmapPtr pixmap,
43 	return FALSE;
44 #endif
45
46+#ifdef USE_GLAMOR
47     if (priv && priv->fb_failed)
48 	return FALSE;
49+#endif
50
51     if (!radeon_pixmap_get_fb(pixmap)) {
52+#ifdef USE_GLAMOR
53 	if (!priv)
54 	    priv = radeon_get_pixmap_private(pixmap);
55
56@@ -291,6 +296,7 @@ radeon_present_check_flip(RRCrtcPtr crtc, WindowPtr window, PixmapPtr pixmap,
57 		       "normal if using PRIME render offloading)\n");
58 	    priv->fb_failed = TRUE;
59 	}
60+#endif
61
62 	return FALSE;
63     }
64--
652.31.1
66
67