1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
From 8f13c69e7658df3a97e388f210dae175639d6d8d Mon Sep 17 00:00:00 2001
From: Chris Wilson <chris@chris-wilson.co.uk>
Date: Fri, 16 Jul 2010 12:24:53 +0100
Subject: [PATCH] intel: Fix invalidate before initialisation
Fixes:
Bug 29091 - 1.9RC5 server crash when starting GLX 1.3 app with mesa 7.8
Intel dri2 driver.
https://bugs.freedesktop.org/show_bug.cgi?id=29091
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
src/mesa/drivers/dri/common/dri_util.c | 2 +-
src/mesa/drivers/dri/intel/intel_screen.c | 19 +++++++++++++++----
2 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c
index 75c9882..9a9bfed 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
+++ b/src/mesa/drivers/dri/common/dri_util.c
@@ -432,7 +432,7 @@ driCreateNewDrawable(__DRIscreen *psp, const __DRIconfig *config,
*/
(void) attrs;
- pdp = malloc(sizeof *pdp);
+ pdp = calloc(1, sizeof *pdp);
if (!pdp) {
return NULL;
}
diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c
index 6e4bb64..083b7bb 100644
--- a/src/mesa/drivers/dri/intel/intel_screen.c
+++ b/src/mesa/drivers/dri/intel/intel_screen.c
@@ -102,10 +102,21 @@ static const __DRItexBufferExtension intelTexBufferExtension = {
intelSetTexBuffer2,
};
+static inline struct intel_context *
+to_intel_context(__DRIdrawable *drawable)
+{
+ if (drawable->driContextPriv == NULL)
+ return NULL;
+
+ return drawable->driContextPriv->driverPrivate;
+}
+
static void
intelDRI2Flush(__DRIdrawable *drawable)
{
- struct intel_context *intel = drawable->driContextPriv->driverPrivate;
+ struct intel_context *intel = to_intel_context(drawable);
+ if (!intel)
+ return;
if (intel->gen < 4)
INTEL_FIREVERTICES(intel);
@@ -117,9 +128,9 @@ intelDRI2Flush(__DRIdrawable *drawable)
static void
intelDRI2Invalidate(__DRIdrawable *drawable)
{
- struct intel_context *intel = drawable->driContextPriv->driverPrivate;
-
- intel->using_dri2_swapbuffers = GL_TRUE;
+ struct intel_context *intel = to_intel_context(drawable);
+ if (intel)
+ intel->using_dri2_swapbuffers = GL_TRUE;
dri2InvalidateDrawable(drawable);
}
--
1.7.1
|