From a62fb50814ffe6f9df09f27bfb0bf23dcd26547c Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Tue, 25 Mar 2025 19:25:32 +0100 Subject: [PATCH] (1880) dix: reserve fixed extension opcodes for known extensions Assign fixed opcodes for known (in-tree) extensions and add defines for them. Other places (eg. security extensions) that need to know those opcodes now can directly use those defines not having to look them up at runtime. Signed-off-by: Enrico Weigelt, metux IT consult --- dix/extension.c | 47 ++++++++++++++++++++++++++++++++++++++++++++ dix/extension_priv.h | 40 ++++++++++++++++++++++++++++++++++++- 2 files changed, 86 insertions(+), 1 deletion(-) diff --git a/dix/extension.c b/dix/extension.c index 594fe01566..8edfd723cc 100644 --- a/dix/extension.c +++ b/dix/extension.c @@ -69,8 +69,55 @@ int lastEvent = EXTENSION_EVENT_BASE; static int lastError = FirstExtensionError; static unsigned int NumExtensions = RESERVED_EXTENSIONS; +static struct { const char *name; int id; } reservedExt[] = { + { "BIG-REQUESTS", EXTENSION_MAJOR_BIG_REQUESTS }, + { "Apple-WM", EXTENSION_MAJOR_APPLE_WM }, + { "Apple-DRI", EXTENSION_MAJOR_APPLE_DRI }, + { "Composite", EXTENSION_MAJOR_COMPOSITE }, + { "DAMAGE", EXTENSION_MAJOR_DAMAGE }, + { "DOUBLE-BUFFER", EXTENSION_MAJOR_DOUBLE_BUFFER }, + { "DPMS", EXTENSION_MAJOR_DPMS }, + { "DRI2", EXTENSION_MAJOR_DRI2 }, + { "DRI3", EXTENSION_MAJOR_DRI3 }, + { "Generic Event Extension", EXTENSION_MAJOR_GENERIC_EVENT }, + { "GLX", EXTENSION_MAJOR_GLX }, + { "MIT-SCREEN-SAVER", EXTENSION_MAJOR_MIT_SCREEN_SAVER }, + { "NAMESPACE", EXTENSION_MAJOR_NAMESPACE }, + { "Present", EXTENSION_MAJOR_PRESENT }, + { "RANDR", EXTENSION_MAJOR_RANDR }, + { "RECORD", EXTENSION_MAJOR_RECORD }, + { "RENDER", EXTENSION_MAJOR_RENDER }, + { "SECURITY", EXTENSION_MAJOR_SECURITY }, + { "SELinux", EXTENSION_MAJOR_SELINUX }, + { "SHAPE", EXTENSION_MAJOR_SHAPE }, + { "MIT-SHM", EXTENSION_MAJOR_SHM }, + { "SYNC", EXTENSION_MAJOR_SYNC }, + { "Windows-DRI", EXTENSION_MAJOR_WINDOWS_DRI }, + { "XFIXES", EXTENSION_MAJOR_XFIXES }, + { "XFree86-Bigfont", EXTENSION_MAJOR_XF86_BIGFONT }, + { "XFree86-DGA", EXTENSION_MAJOR_XF86_DGA }, + { "XFree86-DRI", EXTENSION_MAJOR_XF86_DRI }, + { "XFree86-VidModeExtension", EXTENSION_MAJOR_XF86_VIDMODE }, + { "XC-MISC", EXTENSION_MAJOR_XC_MISC }, + { "XInputExtension", EXTENSION_MAJOR_XINPUT }, + { "XINERAMA", EXTENSION_MAJOR_XINERAMA }, + { "XKEYBOARD", EXTENSION_MAJOR_XKEYBOARD }, + { "X-Resource", EXTENSION_MAJOR_XRESOURCE }, + { "XTEST", EXTENSION_MAJOR_XTEST }, + { "XVideo", EXTENSION_MAJOR_XVIDEO }, + { "XVideo-MotionCompensation", EXTENSION_MAJOR_XVMC }, + { "XWAYLAND", EXTENSION_MAJOR_XWAYLAND }, +}; + static int checkReserved(const char* name) { + for (int i=0; i