-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path0054-egl_dri2-set-pbuffer-config-attribs-to-0-for-non-pbu.patch
64 lines (59 loc) · 2.49 KB
/
0054-egl_dri2-set-pbuffer-config-attribs-to-0-for-non-pbu.patch
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
From e844e08fe85a537f522f099f2c5d09b8b874f785 Mon Sep 17 00:00:00 2001
From: Frank Binns <[email protected]>
Date: Wed, 4 Jun 2014 13:43:03 +0100
Subject: [PATCH] egl_dri2: set pbuffer config attribs to 0 for non-pbuffer
configs
If the EGL_PBUFFER_BIT isn't set in the surface type, don't set the
EGL_MAX_PBUFFER_WIDTH, EGL_MAX_PBUFFER_HEIGHT and
EGL_MAX_PBUFFER_PIXELS attributes to non-zero values when adding an
EGL config. If the EGL_PBUFFER_BIT is set, don't override non-zero
values from the DRI config.
---
src/egl/drivers/dri2/egl_dri2.c | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index fce277c..152da09 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -403,6 +403,7 @@ dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config, int id,
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
_EGLConfig base;
unsigned int attrib, value, double_buffer;
+ unsigned int pbuffer_width = 0, pbuffer_height = 0, pbuffer_pixels = 0;
bool srgb = false;
EGLint key, bind_to_texture_rgb, bind_to_texture_rgba;
int dri_shifts[4] = { -1, -1, -1, -1 };
@@ -526,11 +527,17 @@ dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config, int id,
break;
case __DRI_ATTRIB_MAX_PBUFFER_WIDTH:
- base.MaxPbufferWidth = _EGL_MAX_PBUFFER_WIDTH;
+ pbuffer_width = (value != 0) ? value : _EGL_MAX_PBUFFER_WIDTH;
break;
+
case __DRI_ATTRIB_MAX_PBUFFER_HEIGHT:
- base.MaxPbufferHeight = _EGL_MAX_PBUFFER_HEIGHT;
+ pbuffer_height = (value != 0) ? value : _EGL_MAX_PBUFFER_HEIGHT;
+ break;
+
+ case __DRI_ATTRIB_MAX_PBUFFER_PIXELS:
+ pbuffer_pixels = value;
break;
+
case __DRI_ATTRIB_MUTABLE_RENDER_BUFFER:
if (disp->Extensions.KHR_mutable_render_buffer)
surface_type |= EGL_MUTABLE_RENDER_BUFFER_BIT_KHR;
@@ -610,6 +617,15 @@ dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config, int id,
}
}
+ if (surface_type & EGL_PBUFFER_BIT) {
+ if (pbuffer_pixels == 0)
+ pbuffer_pixels = pbuffer_width * pbuffer_height;
+
+ base.MaxPbufferWidth = pbuffer_width;
+ base.MaxPbufferHeight = pbuffer_height;
+ base.MaxPbufferPixels = pbuffer_pixels;
+ }
+
if (attr_list)
for (int i = 0; attr_list[i] != EGL_NONE; i += 2)
_eglSetConfigKey(&base, attr_list[i], attr_list[i+1]);