Skip to content

Commit 6ddf66e

Browse files
committed
glx: Rename __GLcontextModes to struct glx_config
With this rename, we use 'config' consitently to refer to GLX configurations instead of the modes/configs/visual mess before.
1 parent 4f9f066 commit 6ddf66e

17 files changed

+258
-289
lines changed

src/glx/apple/apple_glx_drawable.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ bool apple_glx_pbuffer_get_event_mask(GLXDrawable d, unsigned long *mask);
211211

212212
/* Pixmaps */
213213

214-
/* mode is a __GLcontextModes * */
214+
/* mode is a struct glx_config * */
215215
/* Returns true if an error occurred. */
216216
bool apple_glx_pixmap_create(Display * dpy, int screen, Pixmap pixmap,
217217
const void *mode);

src/glx/apple/apple_glx_pbuffer.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ apple_glx_pbuffer_create(Display * dpy, GLXFBConfig config,
128128
Window root;
129129
int screen;
130130
Pixmap xid;
131-
__GLcontextModes *modes = (__GLcontextModes *) config;
131+
struct glx_config *modes = (__GLcontextModes *) config;
132132

133133
root = DefaultRootWindow(dpy);
134134
screen = DefaultScreen(dpy);

src/glx/apple/apple_glx_pixmap.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ apple_glx_pixmap_create(Display * dpy, int screen, Pixmap pixmap,
125125
bool double_buffered;
126126
bool uses_stereo;
127127
CGLError error;
128-
const __GLcontextModes *cmodes = mode;
128+
const struct glx_config *cmodes = mode;
129129

130130
if (apple_glx_drawable_create(dpy, screen, pixmap, &d, &callbacks))
131131
return true;

src/glx/apple/apple_visual.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ apple_visual_create_pfobj(CGLPixelFormatObj * pfobj, const void *mode,
6161
bool offscreen)
6262
{
6363
CGLPixelFormatAttribute attr[MAX_ATTR];
64-
const __GLcontextModes *c = mode;
64+
const struct glx_config *c = mode;
6565
int numattr = 0;
6666
GLint vsref = 0;
6767
CGLError error = 0;

src/glx/apple/apple_visual.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
#include <stdbool.h>
3434
#include <OpenGL/CGLTypes.h>
3535

36-
/* mode is expected to be of type __GLcontextModes. */
36+
/* mode is expected to be of type struct glx_config. */
3737
void apple_visual_create_pfobj(CGLPixelFormatObj * pfobj, const void *mode,
3838
bool * double_buffered, bool * uses_stereo,
3939
bool offscreen);

src/glx/dri2_glx.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -156,12 +156,12 @@ dri2UnbindContext(__GLXcontext *context)
156156

157157
static __GLXcontext *
158158
dri2_create_context(__GLXscreenConfigs *base,
159-
const __GLcontextModes * mode,
159+
struct glx_config *config_base,
160160
GLXContext shareList, int renderType)
161161
{
162162
struct dri2_context *pcp, *pcp_shared;
163163
struct dri2_screen *psc = (struct dri2_screen *) base;
164-
__GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) mode;
164+
__GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) config_base;
165165
__DRIcontext *shared = NULL;
166166

167167
if (shareList) {
@@ -174,7 +174,7 @@ dri2_create_context(__GLXscreenConfigs *base,
174174
return NULL;
175175

176176
memset(pcp, 0, sizeof *pcp);
177-
if (!glx_context_init(&pcp->base, &psc->base, mode)) {
177+
if (!glx_context_init(&pcp->base, &psc->base, &config->base)) {
178178
Xfree(pcp);
179179
return NULL;
180180
}
@@ -212,11 +212,11 @@ dri2DestroyDrawable(__GLXDRIdrawable *base)
212212

213213
static __GLXDRIdrawable *
214214
dri2CreateDrawable(__GLXscreenConfigs *base, XID xDrawable,
215-
GLXDrawable drawable, const __GLcontextModes * modes)
215+
GLXDrawable drawable, struct glx_config *config_base)
216216
{
217217
struct dri2_drawable *pdraw;
218218
struct dri2_screen *psc = (struct dri2_screen *) base;
219-
__GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) modes;
219+
__GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) config_base;
220220
__GLXdisplayPrivate *dpyPriv;
221221
struct dri2_display *pdp;
222222
GLint vblank_mode = DRI_CONF_VBLANK_DEF_INTERVAL_1;

src/glx/dri_common.c

+24-26
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ _X_HIDDEN const __DRIsystemTimeExtension systemTimeExtension = {
176176
};
177177

178178
#define __ATTRIB(attrib, field) \
179-
{ attrib, offsetof(__GLcontextModes, field) }
179+
{ attrib, offsetof(struct glx_config, field) }
180180

181181
static const struct
182182
{
@@ -225,10 +225,8 @@ __ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_RGB, bindToTextureRgb),
225225
bindToMipmapTexture),
226226
__ATTRIB(__DRI_ATTRIB_YINVERTED, yInverted),};
227227

228-
#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
229-
230228
static int
231-
scalarEqual(__GLcontextModes * mode, unsigned int attrib, unsigned int value)
229+
scalarEqual(struct glx_config *mode, unsigned int attrib, unsigned int value)
232230
{
233231
unsigned int glxValue;
234232
int i;
@@ -243,8 +241,8 @@ scalarEqual(__GLcontextModes * mode, unsigned int attrib, unsigned int value)
243241
}
244242

245243
static int
246-
driConfigEqual(const __DRIcoreExtension * core,
247-
__GLcontextModes * modes, const __DRIconfig * driConfig)
244+
driConfigEqual(const __DRIcoreExtension *core,
245+
struct glx_config *config, const __DRIconfig *driConfig)
248246
{
249247
unsigned int attrib, value, glxValue;
250248
int i;
@@ -260,7 +258,7 @@ driConfigEqual(const __DRIcoreExtension * core,
260258
else if (value & __DRI_ATTRIB_COLOR_INDEX_BIT) {
261259
glxValue |= GLX_COLOR_INDEX_BIT;
262260
}
263-
if (glxValue != modes->renderType)
261+
if (glxValue != config->renderType)
264262
return GL_FALSE;
265263
break;
266264

@@ -271,7 +269,7 @@ driConfigEqual(const __DRIcoreExtension * core,
271269
glxValue = GLX_SLOW_CONFIG;
272270
else
273271
glxValue = GLX_NONE;
274-
if (glxValue != modes->visualRating)
272+
if (glxValue != config->visualRating)
275273
return GL_FALSE;
276274
break;
277275

@@ -283,55 +281,55 @@ driConfigEqual(const __DRIcoreExtension * core,
283281
glxValue |= GLX_TEXTURE_2D_BIT_EXT;
284282
if (value & __DRI_ATTRIB_TEXTURE_RECTANGLE_BIT)
285283
glxValue |= GLX_TEXTURE_RECTANGLE_BIT_EXT;
286-
if (modes->bindToTextureTargets != GLX_DONT_CARE &&
287-
glxValue != modes->bindToTextureTargets)
284+
if (config->bindToTextureTargets != GLX_DONT_CARE &&
285+
glxValue != config->bindToTextureTargets)
288286
return GL_FALSE;
289287
break;
290288

291289
default:
292-
if (!scalarEqual(modes, attrib, value))
290+
if (!scalarEqual(config, attrib, value))
293291
return GL_FALSE;
294292
}
295293
}
296294

297295
return GL_TRUE;
298296
}
299297

300-
static __GLcontextModes *
298+
static struct glx_config *
301299
createDriMode(const __DRIcoreExtension * core,
302-
__GLcontextModes * modes, const __DRIconfig ** driConfigs)
300+
struct glx_config *config, const __DRIconfig **driConfigs)
303301
{
304-
__GLXDRIconfigPrivate *config;
302+
__GLXDRIconfigPrivate *driConfig;
305303
int i;
306304

307305
for (i = 0; driConfigs[i]; i++) {
308-
if (driConfigEqual(core, modes, driConfigs[i]))
306+
if (driConfigEqual(core, config, driConfigs[i]))
309307
break;
310308
}
311309

312310
if (driConfigs[i] == NULL)
313311
return NULL;
314312

315-
config = Xmalloc(sizeof *config);
316-
if (config == NULL)
313+
driConfig = Xmalloc(sizeof *driConfig);
314+
if (driConfig == NULL)
317315
return NULL;
318316

319-
config->modes = *modes;
320-
config->driConfig = driConfigs[i];
317+
driConfig->base = *config;
318+
driConfig->driConfig = driConfigs[i];
321319

322-
return &config->modes;
320+
return &driConfig->base;
323321
}
324322

325-
_X_HIDDEN __GLcontextModes *
323+
_X_HIDDEN struct glx_config *
326324
driConvertConfigs(const __DRIcoreExtension * core,
327-
__GLcontextModes * modes, const __DRIconfig ** configs)
325+
struct glx_config *configs, const __DRIconfig **driConfigs)
328326
{
329-
__GLcontextModes head, *tail, *m;
327+
struct glx_config head, *tail, *m;
330328

331329
tail = &head;
332330
head.next = NULL;
333-
for (m = modes; m; m = m->next) {
334-
tail->next = createDriMode(core, m, configs);
331+
for (m = configs; m; m = m->next) {
332+
tail->next = createDriMode(core, m, driConfigs);
335333
if (tail->next == NULL) {
336334
/* no matching dri config for m */
337335
continue;
@@ -341,7 +339,7 @@ driConvertConfigs(const __DRIcoreExtension * core,
341339
tail = tail->next;
342340
}
343341

344-
_gl_context_modes_destroy(modes);
342+
glx_config_destroy_list(configs);
345343

346344
return head.next;
347345
}

src/glx/dri_common.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ typedef struct __GLXDRIconfigPrivateRec __GLXDRIconfigPrivate;
4242

4343
struct __GLXDRIconfigPrivateRec
4444
{
45-
__GLcontextModes modes;
45+
struct glx_config base;
4646
const __DRIconfig *driConfig;
4747
};
4848

49-
extern __GLcontextModes *driConvertConfigs(const __DRIcoreExtension * core,
50-
__GLcontextModes * modes,
49+
extern struct glx_config *driConvertConfigs(const __DRIcoreExtension * core,
50+
struct glx_config * modes,
5151
const __DRIconfig ** configs);
5252

5353
extern void driDestroyConfigs(const __DRIconfig **configs);

src/glx/dri_glx.c

+7-7
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ CallCreateNewScreen(Display *dpy, int scrn, struct dri_screen *psc,
337337
drm_handle_t hFB;
338338
int junk;
339339
const __DRIconfig **driver_configs;
340-
__GLcontextModes *visual;
340+
struct glx_config *visual;
341341

342342
/* DRI protocol version. */
343343
dri_version.major = driDpy->driMajor;
@@ -551,14 +551,14 @@ static const struct glx_context_vtable dri_context_vtable = {
551551

552552
static __GLXcontext *
553553
dri_create_context(__GLXscreenConfigs *base,
554-
const __GLcontextModes *mode,
554+
struct glx_config *config_base,
555555
GLXContext shareList, int renderType)
556556
{
557557
struct dri_context *pcp, *pcp_shared;
558558
struct dri_screen *psc = (struct dri_screen *) base;
559559
drm_context_t hwContext;
560560
__DRIcontext *shared = NULL;
561-
__GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) mode;
561+
__GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) config_base;
562562

563563
if (!psc->base.driScreen)
564564
return NULL;
@@ -573,13 +573,13 @@ dri_create_context(__GLXscreenConfigs *base,
573573
return NULL;
574574

575575
memset(pcp, 0, sizeof *pcp);
576-
if (!glx_context_init(&pcp->base, &psc->base, mode)) {
576+
if (!glx_context_init(&pcp->base, &psc->base, &config->base)) {
577577
Xfree(pcp);
578578
return NULL;
579579
}
580580

581581
if (!XF86DRICreateContextWithConfig(psc->base.dpy, psc->base.scr,
582-
mode->visualID,
582+
config->base.visualID,
583583
&pcp->hwContextID, &hwContext)) {
584584
Xfree(pcp);
585585
return NULL;
@@ -617,11 +617,11 @@ driDestroyDrawable(__GLXDRIdrawable * pdraw)
617617
static __GLXDRIdrawable *
618618
driCreateDrawable(__GLXscreenConfigs *base,
619619
XID xDrawable,
620-
GLXDrawable drawable, const __GLcontextModes * modes)
620+
GLXDrawable drawable, struct glx_config *config_base)
621621
{
622622
drm_drawable_t hwDrawable;
623623
void *empty_attribute_list = NULL;
624-
__GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) modes;
624+
__GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) config_base;
625625
struct dri_screen *psc = (struct dri_screen *) base;
626626
struct dri_drawable *pdp;
627627

src/glx/drisw_glx.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -291,11 +291,11 @@ static const struct glx_context_vtable drisw_context_vtable = {
291291

292292
static __GLXcontext *
293293
drisw_create_context(__GLXscreenConfigs *base,
294-
const __GLcontextModes *mode,
294+
struct glx_config *config_base,
295295
GLXContext shareList, int renderType)
296296
{
297297
struct drisw_context *pcp, *pcp_shared;
298-
__GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) mode;
298+
__GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) config_base;
299299
struct drisw_screen *psc = (struct drisw_screen *) base;
300300
__DRIcontext *shared = NULL;
301301

@@ -312,7 +312,7 @@ drisw_create_context(__GLXscreenConfigs *base,
312312
return NULL;
313313

314314
memset(pcp, 0, sizeof *pcp);
315-
if (!glx_context_init(&pcp->base, &psc->base, mode)) {
315+
if (!glx_context_init(&pcp->base, &psc->base, &config->base)) {
316316
Xfree(pcp);
317317
return NULL;
318318
}
@@ -347,7 +347,7 @@ driDestroyDrawable(__GLXDRIdrawable * pdraw)
347347

348348
static __GLXDRIdrawable *
349349
driCreateDrawable(__GLXscreenConfigs *base, XID xDrawable,
350-
GLXDrawable drawable, const __GLcontextModes * modes)
350+
GLXDrawable drawable, struct glx_config *modes)
351351
{
352352
struct drisw_drawable *pdp;
353353
__GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) modes;

0 commit comments

Comments
 (0)