mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-02-19 23:20:31 +01:00
glx: Clean up fbconfig attribute handling
Move the macros defining the expected number of attributes into the same file as their consumer, remove a pointless maximum, and allocate more space for attribs on the stack to avoid malloc in the common case. glxext.c knows about 46 config attribs, 46 - 18 = 28, round up to 32 to future proof a bit. Reviewed-by: Eric Engestrom <eric@engestrom.ch> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9992>
This commit is contained in:
parent
a7474f19d4
commit
2f9dd41701
2 changed files with 13 additions and 17 deletions
|
|
@ -101,20 +101,6 @@ struct glx_config {
|
|||
GLint sRGBCapable;
|
||||
};
|
||||
|
||||
#define __GLX_MIN_CONFIG_PROPS 18
|
||||
#define __GLX_MAX_CONFIG_PROPS 500
|
||||
#define __GLX_EXT_CONFIG_PROPS 10
|
||||
|
||||
/*
|
||||
** Since we send all non-core visual properties as token, value pairs,
|
||||
** we require 2 words across the wire. In order to maintain backwards
|
||||
** compatibility, we need to send the total number of words that the
|
||||
** VisualConfigs are sent back in so old libraries can simply "ignore"
|
||||
** the new properties.
|
||||
*/
|
||||
#define __GLX_TOTAL_CONFIG \
|
||||
(__GLX_MIN_CONFIG_PROPS + 2 * __GLX_EXT_CONFIG_PROPS)
|
||||
|
||||
extern GLint _gl_convert_from_x_visual_type(int visualType);
|
||||
|
||||
extern int
|
||||
|
|
|
|||
|
|
@ -58,6 +58,18 @@
|
|||
#include <xcb/xcb.h>
|
||||
#include <xcb/glx.h>
|
||||
|
||||
#define __GLX_MIN_CONFIG_PROPS 18
|
||||
#define __GLX_EXT_CONFIG_PROPS 32
|
||||
|
||||
/*
|
||||
** Since we send all non-core visual properties as token, value pairs,
|
||||
** we require 2 words across the wire. In order to maintain backwards
|
||||
** compatibility, we need to send the total number of words that the
|
||||
** VisualConfigs are sent back in so old libraries can simply "ignore"
|
||||
** the new properties.
|
||||
*/
|
||||
#define __GLX_TOTAL_CONFIG \
|
||||
(__GLX_MIN_CONFIG_PROPS + 2 * __GLX_EXT_CONFIG_PROPS)
|
||||
|
||||
#ifdef DEBUG
|
||||
void __glXDumpDrawBuffer(struct glx_context * ctx);
|
||||
|
|
@ -619,10 +631,8 @@ createConfigsFromProperties(Display * dpy, int nvisuals, int nprops,
|
|||
if (nprops == 0)
|
||||
return NULL;
|
||||
|
||||
/* FIXME: Is the __GLX_MIN_CONFIG_PROPS test correct for FBconfigs? */
|
||||
|
||||
/* Check number of properties */
|
||||
if (nprops < __GLX_MIN_CONFIG_PROPS || nprops > __GLX_MAX_CONFIG_PROPS)
|
||||
if (nprops < __GLX_MIN_CONFIG_PROPS)
|
||||
return NULL;
|
||||
|
||||
/* Allocate memory for our config structure */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue