diff options
author | marha <marha@users.sourceforge.net> | 2014-03-04 08:57:07 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2014-03-04 08:57:07 +0100 |
commit | 321c01267ae1c446f1bd22b642567fcafa016c02 (patch) | |
tree | 69f6e12bdfd1ccda5d054398321bc1876dd3fc89 /xorg-server | |
parent | 982ac918afe6a1c02d5cf735d7b6c56443a048cc (diff) | |
download | vcxsrv-321c01267ae1c446f1bd22b642567fcafa016c02.tar.gz vcxsrv-321c01267ae1c446f1bd22b642567fcafa016c02.tar.bz2 vcxsrv-321c01267ae1c446f1bd22b642567fcafa016c02.zip |
libX11 libxcb mesa xserver xcb-proto xkeyboard-config git update 4 Mar 2014
xserver commit b634e909895f6001e7d9543e1350b20c82c8c01c
libxcb commit 4ffa6f83b92763eb901c7ddb7c20775e24d507ca
libxcb/xcb-proto commit 4270141a7cb3c68f50251be19a5a628aa18553e6
xkeyboard-config commit d9e3d0ec1a48a5f61ea6dd6d20b8682eeecf3a39
libX11 commit d6bd988bc00494914b38b95ee5df77ac4f32f19f
libXdmcp commit 089081dca4ba3598c6f9bf401c029378943b5854
libXext commit d5447c0156f556114dbf97d6064c0c7b0fcd5f70
libfontenc commit 0037a42107b952c9d903719615747e760e4e7247
libXinerama commit edd95182b26eb5d576d4878c559e0f17dddaa909
libXau commit 1e4635be11154dd8262f37b379511bd627defa2a
xkbcomp commit 31b90ee4ffc774e0da540277907fc5540c0b012c
pixman commit 82d094654a46bd97d47f1f132a01ae0a74b986f3
xextproto commit 66afec3f49e8eb0d4c2e9af7088fc3116d4bafd7
randrproto commit a4a6694c059d74247c16527eef4a0ec9f56bbef6
glproto commit f84853d97d5749308992412a215fa518b6536eb3
mkfontscale commit eac564e0fc9052a39981ea47b271f7f3d2821944
xwininfo commit ba0d1b0da21d2dbdd81098ed5778f3792b472e13
libXft commit 4acfdaf95adb0a05c2a25550bdde036c865902f4
libXmu commit 22d9c590901e121936f50dee97dc60c4f7defb63
libxtrans commit 3f0de269abe59353acbd7a5587d68ce0da91db67
fontconfig commit e310d2fac2d874d5aa76c609df70cc7b871c0b6d
mesa commit 1a568e0f2b65e4e1e1d19a6dece3a792a33da825
Diffstat (limited to 'xorg-server')
104 files changed, 2948 insertions, 3625 deletions
diff --git a/xorg-server/Makefile.am b/xorg-server/Makefile.am index 7c93d8d20..f0fa2d839 100644 --- a/xorg-server/Makefile.am +++ b/xorg-server/Makefile.am @@ -111,7 +111,7 @@ DIST_SUBDIRS = \ composite \ glx \ exa \ - $(GLAMOR_DIR) \ + glamor \ config \ dri3 \ present \ diff --git a/xorg-server/Xext/sync.c b/xorg-server/Xext/sync.c index 97c9d5183..755ed94a1 100644 --- a/xorg-server/Xext/sync.c +++ b/xorg-server/Xext/sync.c @@ -2731,27 +2731,24 @@ IdleTimeBlockHandler(void *pCounter, struct timeval **wt, void *LastSelectMask) * If we've been idle more than it, and someone wants to know about * that level-triggered, schedule an immediate wakeup. */ - unsigned long timeout = -1; if (XSyncValueLessThan(idle, *greater)) { XSyncValue value; Bool overflow; XSyncValueSubtract(&value, *greater, idle, &overflow); - timeout = min(timeout, XSyncValueLow32(value)); + AdjustWaitForDelay(wt, XSyncValueLow32(value)); } else { for (list = counter->sync.pTriglist; list; list = list->next) { trig = list->pTrigger; if (trig->CheckTrigger(trig, old_idle)) { - timeout = min(timeout, 0); + AdjustWaitForDelay(wt, 0); break; } } } - - AdjustWaitForDelay(wt, timeout); } counter->value = old_idle; /* pop */ diff --git a/xorg-server/Xi/exevents.c b/xorg-server/Xi/exevents.c index 4ed58eec4..e9f670ec5 100644 --- a/xorg-server/Xi/exevents.c +++ b/xorg-server/Xi/exevents.c @@ -2183,7 +2183,8 @@ CheckGrabValues(ClientPtr client, GrabParameters *param) return BadValue; } - if (param->grabtype != XI2 && (param->modifiers != AnyModifier) && + if (param->modifiers != AnyModifier && + param->modifiers != XIAnyModifier && (param->modifiers & ~AllModifiersMask)) { client->errorValue = param->modifiers; return BadValue; diff --git a/xorg-server/Xi/extinit.c b/xorg-server/Xi/extinit.c index 9ebd733ab..26c628cbd 100644 --- a/xorg-server/Xi/extinit.c +++ b/xorg-server/Xi/extinit.c @@ -1169,8 +1169,8 @@ IResetProc(ExtensionEntry * unused) EventSwapVector[DevicePropertyNotify] = NotImplemented; RestoreExtensionEvents(); - free((void *) xi_all_devices.name); - free((void *) xi_all_master_devices.name); + free(xi_all_devices.name); + free(xi_all_master_devices.name); XIBarrierReset(); } diff --git a/xorg-server/Xi/listdev.c b/xorg-server/Xi/listdev.c index 470fb52ee..6a10091d0 100644 --- a/xorg-server/Xi/listdev.c +++ b/xorg-server/Xi/listdev.c @@ -121,7 +121,7 @@ SizeDeviceInfo(DeviceIntPtr d, int *namesize, int *size) static void CopyDeviceName(char **namebuf, const char *name) { - char *nameptr = (char *) *namebuf; + char *nameptr = *namebuf; if (name) { *nameptr++ = strlen(name); diff --git a/xorg-server/Xi/xipassivegrab.c b/xorg-server/Xi/xipassivegrab.c index 8aba97781..700622d38 100644 --- a/xorg-server/Xi/xipassivegrab.c +++ b/xorg-server/Xi/xipassivegrab.c @@ -189,6 +189,10 @@ ProcXIPassiveGrabDevice(ClientPtr client) uint8_t status = Success; param.modifiers = *modifiers; + ret = CheckGrabValues(client, ¶m); + if (ret != Success) + goto out; + switch (stuff->grab_type) { case XIGrabtypeButton: status = GrabButton(client, dev, mod_dev, stuff->detail, diff --git a/xorg-server/config/Makefile.am b/xorg-server/config/Makefile.am index e0f0a8ddf..0e20e8b3d 100644 --- a/xorg-server/config/Makefile.am +++ b/xorg-server/config/Makefile.am @@ -38,4 +38,4 @@ endif # !CONFIG_HAL endif # !CONFIG_UDEV -EXTRA_DIST = xorg-server.conf x11-input.fdi 10-evdev.conf non-seat0.conf.multi-seat fdi2iclass.py 10-quirks.conf +EXTRA_DIST = x11-input.fdi 10-evdev.conf fdi2iclass.py 10-quirks.conf diff --git a/xorg-server/config/non-seat0.conf.multi-seat b/xorg-server/config/non-seat0.conf.multi-seat deleted file mode 100644 index 34008ce50..000000000 --- a/xorg-server/config/non-seat0.conf.multi-seat +++ /dev/null @@ -1,18 +0,0 @@ -# This is the default configuration for servers on seat-1 and above. -# -# Start the server with -config non-seat0.conf.multi-seat, or alternatively -# rename the file to end in .conf and put it in the standard config -# directory (though it will apply to _all_ seats!). -# -# * Disable VT switching with Ctrl-Alt-F1 -# * Force a grab on all input devices to detach them from the VT subsystem -# to avoid event leakage. - -Section "ServerFlags" - Option "DontVTSwitch" "on" -EndSection - -Section "InputClass" - Identifier "Force input devices to seat" - Option "GrabDevice" "on" -EndSection diff --git a/xorg-server/config/udev.c b/xorg-server/config/udev.c index 436b8f038..68ed34843 100644 --- a/xorg-server/config/udev.c +++ b/xorg-server/config/udev.c @@ -242,16 +242,16 @@ device_added(struct udev_device *udev_device) free(config_info); input_option_free_list(&input_options); - free((void *) attrs.usb_id); - free((void *) attrs.pnp_id); - free((void *) attrs.product); - free((void *) attrs.device); - free((void *) attrs.vendor); + free(attrs.usb_id); + free(attrs.pnp_id); + free(attrs.product); + free(attrs.device); + free(attrs.vendor); if (attrs.tags) { - const char **tag = attrs.tags; + char **tag = attrs.tags; while (*tag) { - free((void *) *tag); + free(*tag); tag++; } free(attrs.tags); diff --git a/xorg-server/configure.ac b/xorg-server/configure.ac index c6764f5a8..0fb2fc375 100644 --- a/xorg-server/configure.ac +++ b/xorg-server/configure.ac @@ -26,9 +26,9 @@ dnl dnl Process this file with autoconf to create configure. AC_PREREQ(2.60) -AC_INIT([xorg-server], 1.15.99.900, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server) -RELEASE_DATE="2014-01-09" -RELEASE_NAME="Golden Gaytime" +AC_INIT([xorg-server], 1.15.99.901, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server) +RELEASE_DATE="2014-02-24" +RELEASE_NAME="Szechuan Hot Pot" AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_MACRO_DIR([m4]) AM_INIT_AUTOMAKE([foreign dist-bzip2]) @@ -841,7 +841,7 @@ if test "x$WITH_SYSTEMD_DAEMON" = xauto; then WITH_SYSTEMD_DAEMON="$HAVE_SYSTEMD_DAEMON" fi if test "x$WITH_SYSTEMD_DAEMON" = xyes; then - if "x$HAVE_SYSTEMD_DAEMON" = xno; then + if test "x$HAVE_SYSTEMD_DAEMON" = xno; then AC_MSG_ERROR([systemd support requested but no library has been found]) fi AC_DEFINE(HAVE_SYSTEMD_DAEMON, 1, [Define to 1 if libsystemd-daemon is available]) @@ -1853,7 +1853,7 @@ if test "x$XORG" = xyes; then if test "x$PCI" = xyes; then PKG_CHECK_MODULES([PCIACCESS], $LIBPCIACCESS) SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $LIBPCIACCESS" - XORG_SYS_LIBS="$XORG_SYS_LIBS $PCIACCESS_LIBS $GLX_SYS_LIBS $LIBDRM_LIBS" + XORG_SYS_LIBS="$XORG_SYS_LIBS $PCIACCESS_LIBS $LIBDRM_LIBS" XORG_CFLAGS="$XORG_CFLAGS $PCIACCESS_CFLAGS $LIBDRM_CFLAGS" AC_DEFINE(XSERVER_LIBPCIACCESS, 1, [Use libpciaccess for all pci manipulation]) @@ -2069,7 +2069,7 @@ dnl glamor AM_CONDITIONAL([GLAMOR], [test "x$GLAMOR" = xyes]) if test "x$GLAMOR" = xyes; then AC_DEFINE(GLAMOR, 1, [Build glamor]) - PKG_CHECK_MODULES([GLAMOR], [egl gl]) + PKG_CHECK_MODULES([GLAMOR], [epoxy]) fi dnl XWin DDX diff --git a/xorg-server/dix/devices.c b/xorg-server/dix/devices.c index 45de713ce..1c86d5242 100644 --- a/xorg-server/dix/devices.c +++ b/xorg-server/dix/devices.c @@ -955,7 +955,7 @@ CloseDevice(DeviceIntPtr dev) while (dev->xkb_interest) XkbRemoveResourceClient((DevicePtr) dev, dev->xkb_interest->resource); - free((void *) dev->name); + free(dev->name); classes = (ClassesPtr) &dev->key; FreeAllDeviceClasses(classes); @@ -1279,6 +1279,7 @@ InitButtonClassDeviceStruct(DeviceIntPtr dev, int numButtons, Atom *labels, BUG_RETURN_VAL(dev == NULL, FALSE); BUG_RETURN_VAL(dev->button != NULL, FALSE); + BUG_RETURN_VAL(numButtons >= MAX_BUTTONS, FALSE); butc = calloc(1, sizeof(ButtonClassRec)); if (!butc) diff --git a/xorg-server/dix/dispatch.c b/xorg-server/dix/dispatch.c index 9a5658db0..4f830f7f4 100644 --- a/xorg-server/dix/dispatch.c +++ b/xorg-server/dix/dispatch.c @@ -478,9 +478,9 @@ SetVendorRelease(int release) } void -SetVendorString(const char *string) +SetVendorString(const char *vendor) { - VendorString = string; + VendorString = vendor; } Bool diff --git a/xorg-server/dix/getevents.c b/xorg-server/dix/getevents.c index 646c723ea..ffa89fad2 100644 --- a/xorg-server/dix/getevents.c +++ b/xorg-server/dix/getevents.c @@ -1655,6 +1655,8 @@ GetPointerEvents(InternalEvent *events, DeviceIntPtr pDev, int type, } #endif + BUG_RETURN_VAL(buttons >= MAX_BUTTONS, 0); + /* refuse events from disabled devices */ if (!pDev->enabled) return 0; diff --git a/xorg-server/dix/inpututils.c b/xorg-server/dix/inpututils.c index 3e1d75fec..e5bcc31f7 100644 --- a/xorg-server/dix/inpututils.c +++ b/xorg-server/dix/inpututils.c @@ -60,7 +60,8 @@ check_butmap_change(DeviceIntPtr dev, CARD8 *map, int len, CARD32 *errval_out, } for (i = 0; i < len; i++) { - if (dev->button->map[i + 1] != map[i] && dev->button->down[i + 1]) + if (dev->button->map[i + 1] != map[i] && + button_is_down(dev, i + 1, BUTTON_PROCESSED)) return MappingBusy; } @@ -351,7 +352,7 @@ DuplicateInputAttributes(InputAttributes * attrs) { InputAttributes *new_attr; int ntags = 0; - const char **tags, **new_tags; + char **tags, **new_tags; if (!attrs) return NULL; @@ -403,20 +404,20 @@ DuplicateInputAttributes(InputAttributes * attrs) void FreeInputAttributes(InputAttributes * attrs) { - const char **tags; + char **tags; if (!attrs) return; - free((void *) attrs->product); - free((void *) attrs->vendor); - free((void *) attrs->device); - free((void *) attrs->pnp_id); - free((void *) attrs->usb_id); + free(attrs->product); + free(attrs->vendor); + free(attrs->device); + free(attrs->pnp_id); + free(attrs->usb_id); if ((tags = attrs->tags)) while (*tags) - free((void *) *tags++); + free(*tags++); free(attrs->tags); free(attrs); diff --git a/xorg-server/glamor/Makefile.am b/xorg-server/glamor/Makefile.am index 3fe25304d..12a57c441 100644 --- a/xorg-server/glamor/Makefile.am +++ b/xorg-server/glamor/Makefile.am @@ -6,15 +6,15 @@ AM_CFLAGS = $(CWARNFLAGS) $(DIX_CFLAGS) $(GLAMOR_CFLAGS) libglamor_la_SOURCES = \ glamor.c \ + glamor_context.h \ glamor_copyarea.c \ glamor_copywindow.c \ glamor_core.c \ glamor_debug.h \ - glamor_gl_dispatch.h \ glamor_fill.c \ glamor_fillspans.c \ glamor_getspans.c \ - glamor_glext.h \ + glamor_glx.c \ glamor_glyphs.c \ glamor_polyfillrect.c \ glamor_polylines.c \ @@ -35,7 +35,6 @@ libglamor_la_SOURCES = \ glamor_largepixmap.c\ glamor_picture.c\ glamor_window.c\ - glamor_gl_dispatch.c\ glamor_fbo.c\ glamor_compositerects.c\ glamor_xv.c\ diff --git a/xorg-server/glamor/glamor.c b/xorg-server/glamor/glamor.c index feb110a66..7d8228cdd 100644 --- a/xorg-server/glamor/glamor.c +++ b/xorg-server/glamor/glamor.c @@ -95,7 +95,7 @@ glamor_set_pixmap_texture(PixmapPtr pixmap, unsigned int tex) glamor_destroy_fbo(fbo); } - gl_iformat_for_depth(pixmap->drawable.depth, &format); + format = gl_iformat_for_pixmap(pixmap); fbo = glamor_create_fbo_from_tex(glamor_priv, pixmap->drawable.width, pixmap->drawable.height, format, tex, 0); @@ -162,7 +162,7 @@ glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth, pixmap_priv->base.pixmap = pixmap; pixmap_priv->base.glamor_priv = glamor_priv; - gl_iformat_for_depth(depth, &format); + format = gl_iformat_for_pixmap(pixmap); pitch = (((w * pixmap->drawable.bitsPerPixel + 7) / 8) + 3) & ~3; screen->ModifyPixmapHeader(pixmap, w, h, 0, 0, pitch, NULL); @@ -218,13 +218,12 @@ void glamor_block_handler(ScreenPtr screen) { glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); - glamor_gl_dispatch *dispatch; - dispatch = glamor_get_dispatch(glamor_priv); + glamor_get_context(glamor_priv); glamor_priv->tick++; - dispatch->glFlush(); + glFlush(); glamor_fbo_expire(glamor_priv); - glamor_put_dispatch(glamor_priv); + glamor_put_context(glamor_priv); if (glamor_priv->state == RENDER_STATE && glamor_priv->render_idle_cnt++ > RENDER_IDEL_MAX) { glamor_priv->state = IDLE_STATE; @@ -236,10 +235,10 @@ static void _glamor_block_handler(void *data, OSTimePtr timeout, void *last_select_mask) { glamor_screen_private *glamor_priv = data; - glamor_gl_dispatch *dispatch = glamor_get_dispatch(glamor_priv); - dispatch->glFlush(); - glamor_put_dispatch(glamor_priv); + glamor_get_context(glamor_priv); + glFlush(); + glamor_put_context(glamor_priv); } static void @@ -281,10 +280,10 @@ glamor_init(ScreenPtr screen, unsigned int flags) return FALSE; if (flags & GLAMOR_INVERTED_Y_AXIS) { - glamor_priv->yInverted = 1; + glamor_priv->yInverted = TRUE; } else - glamor_priv->yInverted = 0; + glamor_priv->yInverted = FALSE; if (!dixRegisterPrivateKey(glamor_screen_private_key, PRIVATE_SCREEN, 0)) { LogMessage(X_WARNING, @@ -302,50 +301,49 @@ glamor_init(ScreenPtr screen, unsigned int flags) goto fail;; } - gl_version = glamor_gl_get_version(); + if (epoxy_is_desktop_gl()) + glamor_priv->gl_flavor = GLAMOR_GL_DESKTOP; + else + glamor_priv->gl_flavor = GLAMOR_GL_ES2; -#ifndef GLAMOR_GLES2 - if (gl_version < GLAMOR_GL_VERSION_ENCODE(1, 3)) { - ErrorF("Require OpenGL version 1.3 or latter.\n"); - goto fail; - } -#else - if (gl_version < GLAMOR_GL_VERSION_ENCODE(2, 0)) { - ErrorF("Require Open GLES2.0 or latter.\n"); - goto fail; - } -#endif + gl_version = glamor_gl_get_version(); - glamor_gl_dispatch_init(screen, &glamor_priv->_dispatch, gl_version); + if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) { + if (gl_version < GLAMOR_GL_VERSION_ENCODE(1, 3)) { + ErrorF("Require OpenGL version 1.3 or later.\n"); + goto fail; + } + } else { + if (gl_version < GLAMOR_GL_VERSION_ENCODE(2, 0)) { + ErrorF("Require Open GLES2.0 or later.\n"); + goto fail; + } -#ifdef GLAMOR_GLES2 - if (!glamor_gl_has_extension("GL_EXT_texture_format_BGRA8888")) { - ErrorF("GL_EXT_texture_format_BGRA8888 required\n"); - goto fail; + if (!glamor_gl_has_extension("GL_EXT_texture_format_BGRA8888")) { + ErrorF("GL_EXT_texture_format_BGRA8888 required\n"); + goto fail; + } } -#endif glamor_priv->has_pack_invert = glamor_gl_has_extension("GL_MESA_pack_invert"); glamor_priv->has_fbo_blit = glamor_gl_has_extension("GL_EXT_framebuffer_blit"); - glamor_priv->_dispatch.glGetIntegerv(GL_MAX_RENDERBUFFER_SIZE, - &glamor_priv->max_fbo_size); + glGetIntegerv(GL_MAX_RENDERBUFFER_SIZE, &glamor_priv->max_fbo_size); #ifdef MAX_FBO_SIZE glamor_priv->max_fbo_size = MAX_FBO_SIZE; #endif glamor_set_debug_level(&glamor_debug_level); -#ifdef GLAMOR_GLES2 - glamor_priv->gl_flavor = GLAMOR_GL_ES2; -#else - glamor_priv->gl_flavor = GLAMOR_GL_DESKTOP; -#endif /* If we are using egl screen, call egl screen init to * register correct close screen function. */ - if (flags & GLAMOR_USE_EGL_SCREEN) - glamor_egl_screen_init(screen); + if (flags & GLAMOR_USE_EGL_SCREEN) { + glamor_egl_screen_init(screen, &glamor_priv->ctx); + } else { + if (!glamor_glx_screen_init(&glamor_priv->ctx)) + goto fail; + } glamor_priv->saved_procs.close_screen = screen->CloseScreen; screen->CloseScreen = glamor_close_screen; diff --git a/xorg-server/glamor/glamor.h b/xorg-server/glamor/glamor.h index 05f565b12..eec687256 100644 --- a/xorg-server/glamor/glamor.h +++ b/xorg-server/glamor/glamor.h @@ -36,6 +36,8 @@ #include <fb.h> #include <fbpict.h> +struct glamor_context; + /* * glamor_pixmap_type : glamor pixmap's type. * @MEMORY: pixmap is in memory. @@ -142,11 +144,6 @@ extern _X_EXPORT void glamor_block_handler(ScreenPtr screen); extern _X_EXPORT PixmapPtr glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth, unsigned int usage); -extern _X_EXPORT void glamor_egl_screen_init(ScreenPtr screen); - -extern _X_EXPORT void glamor_egl_make_current(ScreenPtr screen); -extern _X_EXPORT void glamor_egl_restore_context(ScreenPtr screen); - /* @glamor_egl_exchange_buffers: Exchange the underlying buffers(KHR image,fbo). * * @front: front pixmap. diff --git a/xorg-server/glamor/glamor_context.h b/xorg-server/glamor/glamor_context.h new file mode 100644 index 000000000..8781afc48 --- /dev/null +++ b/xorg-server/glamor/glamor_context.h @@ -0,0 +1,56 @@ +/* + * Copyright © 2013 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +/** + * @file glamor_context.h + * + * This is the struct of state required for context switching in + * glamor. It has to use types that don't require including either + * server headers or Xlib headers, since it will be included by both + * the server and the GLX (xlib) code. + */ + +struct glamor_context { + /** Either an EGLDisplay or an Xlib Display */ + void *display; + + /** Either a GLXContext or an EGLContext. */ + void *ctx; + + /** The EGLSurface we should MakeCurrent to */ + void *drawable; + + /** The GLXDrawable we should MakeCurrent to */ + uint32_t drawable_xid; + + /** + * Count of how deep in glamor_get_context() we are, to reduce + * MakeCurrent calls. + */ + int get_count; + + void (*get_context)(struct glamor_context *glamor_ctx); + void (*put_context)(struct glamor_context *glamor_ctx); +}; + +Bool glamor_glx_screen_init(struct glamor_context *glamor_ctx); diff --git a/xorg-server/glamor/glamor_copyarea.c b/xorg-server/glamor/glamor_copyarea.c index 2735ba0bc..d6bcacd36 100644 --- a/xorg-server/glamor/glamor_copyarea.c +++ b/xorg-server/glamor/glamor_copyarea.c @@ -31,7 +31,6 @@ * * GC CopyArea implementation */ -#ifndef GLAMOR_GLES2 static Bool glamor_copy_n_to_n_fbo_blit(DrawablePtr src, DrawablePtr dst, @@ -42,7 +41,6 @@ glamor_copy_n_to_n_fbo_blit(DrawablePtr src, PixmapPtr src_pixmap = glamor_get_drawable_pixmap(src); glamor_pixmap_private *src_pixmap_priv, *dst_pixmap_priv; glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); - glamor_gl_dispatch *dispatch; int dst_x_off, dst_y_off, src_x_off, src_y_off, i; int fbo_x_off, fbo_y_off; int src_fbo_x_off, src_fbo_y_off; @@ -72,9 +70,8 @@ glamor_copy_n_to_n_fbo_blit(DrawablePtr src, pixmap_priv_get_fbo_off(dst_pixmap_priv, &fbo_x_off, &fbo_y_off); pixmap_priv_get_fbo_off(src_pixmap_priv, &src_fbo_x_off, &src_fbo_y_off); - dispatch = glamor_get_dispatch(glamor_priv); - dispatch->glBindFramebuffer(GL_READ_FRAMEBUFFER_EXT, - src_pixmap_priv->base.fbo->fb); + glamor_get_context(glamor_priv); + glBindFramebuffer(GL_READ_FRAMEBUFFER_EXT, src_pixmap_priv->base.fbo->fb); glamor_get_drawable_deltas(dst, dst_pixmap, &dst_x_off, &dst_y_off); glamor_get_drawable_deltas(src, src_pixmap, &src_x_off, &src_y_off); dst_x_off += fbo_x_off; @@ -84,23 +81,15 @@ glamor_copy_n_to_n_fbo_blit(DrawablePtr src, for (i = 0; i < nbox; i++) { if (glamor_priv->yInverted) { - dispatch->glBlitFramebuffer((box[i].x1 + dx + - src_x_off), - (box[i].y1 + - src_y_off), - (box[i].x2 + dx + - src_x_off), - (box[i].y2 + - src_y_off), - (box[i].x1 + - dst_x_off), - (box[i].y1 + - dst_y_off), - (box[i].x2 + - dst_x_off), - (box[i].y2 + - dst_y_off), - GL_COLOR_BUFFER_BIT, GL_NEAREST); + glBlitFramebuffer(box[i].x1 + dx + src_x_off, + box[i].y1 + src_y_off, + box[i].x2 + dx + src_x_off, + box[i].y2 + src_y_off, + box[i].x1 + dst_x_off, + box[i].y1 + dst_y_off, + box[i].x2 + dst_x_off, + box[i].y2 + dst_y_off, + GL_COLOR_BUFFER_BIT, GL_NEAREST); } else { int flip_dst_y1 = @@ -112,26 +101,21 @@ glamor_copy_n_to_n_fbo_blit(DrawablePtr src, int flip_src_y2 = src_pixmap->drawable.height - (box[i].y1 + src_y_off); - dispatch->glBlitFramebuffer(box[i].x1 + dx + - src_x_off, - flip_src_y1, - box[i].x2 + dx + - src_x_off, - flip_src_y2, - box[i].x1 + - dst_x_off, - flip_dst_y1, - box[i].x2 + - dst_x_off, - flip_dst_y2, - GL_COLOR_BUFFER_BIT, GL_NEAREST); + glBlitFramebuffer(box[i].x1 + dx + src_x_off, + flip_src_y1, + box[i].x2 + dx + src_x_off, + flip_src_y2, + box[i].x1 + dst_x_off, + flip_dst_y1, + box[i].x2 + dst_x_off, + flip_dst_y2, + GL_COLOR_BUFFER_BIT, GL_NEAREST); } } - glamor_put_dispatch(glamor_priv); + glamor_put_context(glamor_priv); glamor_priv->state = BLIT_STATE; return TRUE; } -#endif static Bool glamor_copy_n_to_n_textured(DrawablePtr src, @@ -140,7 +124,6 @@ glamor_copy_n_to_n_textured(DrawablePtr src, { glamor_screen_private *glamor_priv = glamor_get_screen_private(dst->pScreen); - glamor_gl_dispatch *dispatch; PixmapPtr src_pixmap = glamor_get_drawable_pixmap(src); PixmapPtr dst_pixmap = glamor_get_drawable_pixmap(dst); int i; @@ -172,37 +155,32 @@ glamor_copy_n_to_n_textured(DrawablePtr src, glamor_get_drawable_deltas(dst, dst_pixmap, &dst_x_off, &dst_y_off); - dispatch = glamor_get_dispatch(glamor_priv); + glamor_get_context(glamor_priv); glamor_set_destination_pixmap_priv_nc(dst_pixmap_priv); - dispatch->glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT, - GL_FALSE, 2 * sizeof(float), vertices); - dispatch->glEnableVertexAttribArray(GLAMOR_VERTEX_POS); + glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT, + GL_FALSE, 2 * sizeof(float), vertices); + glEnableVertexAttribArray(GLAMOR_VERTEX_POS); glamor_get_drawable_deltas(src, src_pixmap, &src_x_off, &src_y_off); dx += src_x_off; dy += src_y_off; - dispatch->glActiveTexture(GL_TEXTURE0); - dispatch->glBindTexture(GL_TEXTURE_2D, src_pixmap_priv->base.fbo->tex); -#ifndef GLAMOR_GLES2 - dispatch->glEnable(GL_TEXTURE_2D); - dispatch->glTexParameteri(GL_TEXTURE_2D, - GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER); - dispatch->glTexParameteri(GL_TEXTURE_2D, - GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER); -#endif - dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - - dispatch->glVertexAttribPointer(GLAMOR_VERTEX_SOURCE, 2, - GL_FLOAT, GL_FALSE, - 2 * sizeof(float), texcoords); - dispatch->glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE); - dispatch->glUseProgram(glamor_priv->finish_access_prog[0]); - dispatch->glUniform1i(glamor_priv->finish_access_revert[0], REVERT_NONE); - dispatch->glUniform1i(glamor_priv->finish_access_swap_rb[0], - SWAP_NONE_UPLOADING); + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D, src_pixmap_priv->base.fbo->tex); + if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) { + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER); + } + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + + glVertexAttribPointer(GLAMOR_VERTEX_SOURCE, 2, GL_FLOAT, GL_FALSE, + 2 * sizeof(float), texcoords); + glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE); + glUseProgram(glamor_priv->finish_access_prog[0]); + glUniform1i(glamor_priv->finish_access_revert[0], REVERT_NONE); + glUniform1i(glamor_priv->finish_access_swap_rb[0], SWAP_NONE_UPLOADING); for (i = 0; i < nbox; i++) { @@ -222,17 +200,14 @@ glamor_copy_n_to_n_textured(DrawablePtr src, box[i].x2 + dx, box[i].y2 + dy, glamor_priv->yInverted, texcoords); - dispatch->glDrawArrays(GL_TRIANGLE_FAN, 0, 4); + glDrawArrays(GL_TRIANGLE_FAN, 0, 4); } - dispatch->glDisableVertexAttribArray(GLAMOR_VERTEX_POS); - dispatch->glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE); -#ifndef GLAMOR_GLES2 - dispatch->glDisable(GL_TEXTURE_2D); -#endif - dispatch->glUseProgram(0); + glDisableVertexAttribArray(GLAMOR_VERTEX_POS); + glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE); + glUseProgram(0); /* The source texture is bound to a fbo, we have to flush it here. */ - glamor_put_dispatch(glamor_priv); + glamor_put_context(glamor_priv); glamor_priv->state = RENDER_STATE; glamor_priv->render_idle_cnt = 0; return TRUE; @@ -289,15 +264,14 @@ __glamor_copy_n_to_n(DrawablePtr src, box[0].x1, box[0].y1, box[0].x2 - box[0].x1, box[0].y2 - box[0].y1, dx, dy, src_pixmap, dst_pixmap); -#ifndef GLAMOR_GLES2 - if (!overlaped && + if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP && + !overlaped && (glamor_priv->state != RENDER_STATE || !src_pixmap_priv->base.gl_tex || !dst_pixmap_priv->base.gl_tex) && glamor_copy_n_to_n_fbo_blit(src, dst, gc, box, nbox, dx, dy)) { ret = TRUE; goto done; } -#endif glamor_calculate_boxes_bound(&bound, box, nbox); /* Overlaped indicate the src and dst are the same pixmap. */ @@ -364,10 +338,10 @@ _glamor_copy_n_to_n(DrawablePtr src, Bool upsidedown, Pixel bitplane, void *closure, Bool fallback) { + ScreenPtr screen = dst->pScreen; PixmapPtr dst_pixmap, src_pixmap; glamor_pixmap_private *dst_pixmap_priv, *src_pixmap_priv; glamor_screen_private *glamor_priv; - glamor_gl_dispatch *dispatch; BoxPtr extent; RegionRec region; int src_x_off, src_y_off, dst_x_off, dst_y_off; @@ -381,7 +355,7 @@ _glamor_copy_n_to_n(DrawablePtr src, src_pixmap = glamor_get_drawable_pixmap(src); src_pixmap_priv = glamor_get_pixmap_private(src_pixmap); - glamor_priv = glamor_get_screen_private(dst->pScreen); + glamor_priv = glamor_get_screen_private(screen); DEBUGF("Copy %d %d %dx%d dx %d dy %d from %p to %p \n", box[0].x1, box[0].y1, @@ -394,12 +368,12 @@ _glamor_copy_n_to_n(DrawablePtr src, if (gc) { if (!glamor_set_planemask(dst_pixmap, gc->planemask)) goto fall_back; - dispatch = glamor_get_dispatch(glamor_priv); - if (!glamor_set_alu(dispatch, gc->alu)) { - glamor_put_dispatch(glamor_priv); + glamor_get_context(glamor_priv); + if (!glamor_set_alu(screen, gc->alu)) { + glamor_put_context(glamor_priv); goto fail; } - glamor_put_dispatch(glamor_priv); + glamor_put_context(glamor_priv); } if (!src_pixmap_priv) { @@ -572,9 +546,9 @@ _glamor_copy_n_to_n(DrawablePtr src, } fail: - dispatch = glamor_get_dispatch(glamor_priv); - glamor_set_alu(dispatch, GXcopy); - glamor_put_dispatch(glamor_priv); + glamor_get_context(glamor_priv); + glamor_set_alu(screen, GXcopy); + glamor_put_context(glamor_priv); if (ok) return TRUE; diff --git a/xorg-server/glamor/glamor_core.c b/xorg-server/glamor/glamor_core.c index 4eac85603..58838095b 100644 --- a/xorg-server/glamor/glamor_core.c +++ b/xorg-server/glamor/glamor_core.c @@ -51,24 +51,23 @@ glamor_get_drawable_location(const DrawablePtr drawable) } GLint -glamor_compile_glsl_prog(glamor_gl_dispatch * dispatch, GLenum type, - const char *source) +glamor_compile_glsl_prog(GLenum type, const char *source) { GLint ok; GLint prog; - prog = dispatch->glCreateShader(type); - dispatch->glShaderSource(prog, 1, (const GLchar **) &source, NULL); - dispatch->glCompileShader(prog); - dispatch->glGetShaderiv(prog, GL_COMPILE_STATUS, &ok); + prog = glCreateShader(type); + glShaderSource(prog, 1, (const GLchar **) &source, NULL); + glCompileShader(prog); + glGetShaderiv(prog, GL_COMPILE_STATUS, &ok); if (!ok) { GLchar *info; GLint size; - dispatch->glGetShaderiv(prog, GL_INFO_LOG_LENGTH, &size); + glGetShaderiv(prog, GL_INFO_LOG_LENGTH, &size); info = malloc(size); if (info) { - dispatch->glGetShaderInfoLog(prog, size, NULL, info); + glGetShaderInfoLog(prog, size, NULL, info); ErrorF("Failed to compile %s: %s\n", type == GL_FRAGMENT_SHADER ? "FS" : "VS", info); ErrorF("Program source:\n%s", source); @@ -83,20 +82,20 @@ glamor_compile_glsl_prog(glamor_gl_dispatch * dispatch, GLenum type, } void -glamor_link_glsl_prog(glamor_gl_dispatch * dispatch, GLint prog) +glamor_link_glsl_prog(GLint prog) { GLint ok; - dispatch->glLinkProgram(prog); - dispatch->glGetProgramiv(prog, GL_LINK_STATUS, &ok); + glLinkProgram(prog); + glGetProgramiv(prog, GL_LINK_STATUS, &ok); if (!ok) { GLchar *info; GLint size; - dispatch->glGetProgramiv(prog, GL_INFO_LOG_LENGTH, &size); + glGetProgramiv(prog, GL_INFO_LOG_LENGTH, &size); info = malloc(size); - dispatch->glGetProgramInfoLog(prog, size, NULL, info); + glGetProgramInfoLog(prog, size, NULL, info); ErrorF("Failed to link: %s\n", info); FatalError("GLSL link failure\n"); } @@ -143,7 +142,6 @@ void glamor_init_finish_access_shaders(ScreenPtr screen) { glamor_screen_private *glamor_priv; - glamor_gl_dispatch *dispatch; const char *vs_source = "attribute vec4 v_position;\n" "attribute vec4 v_texcoord0;\n" @@ -217,86 +215,78 @@ glamor_init_finish_access_shaders(ScreenPtr screen) char *source; glamor_priv = glamor_get_screen_private(screen); - dispatch = glamor_get_dispatch(glamor_priv); - glamor_priv->finish_access_prog[0] = dispatch->glCreateProgram(); - glamor_priv->finish_access_prog[1] = dispatch->glCreateProgram(); + glamor_get_context(glamor_priv); + glamor_priv->finish_access_prog[0] = glCreateProgram(); + glamor_priv->finish_access_prog[1] = glCreateProgram(); - vs_prog = glamor_compile_glsl_prog(dispatch, GL_VERTEX_SHADER, vs_source); + vs_prog = glamor_compile_glsl_prog(GL_VERTEX_SHADER, vs_source); XNFasprintf(&source, "%s%s", common_source, fs_source); - fs_prog = glamor_compile_glsl_prog(dispatch, GL_FRAGMENT_SHADER, source); + fs_prog = glamor_compile_glsl_prog(GL_FRAGMENT_SHADER, source); free(source); - dispatch->glAttachShader(glamor_priv->finish_access_prog[0], vs_prog); - dispatch->glAttachShader(glamor_priv->finish_access_prog[0], fs_prog); + glAttachShader(glamor_priv->finish_access_prog[0], vs_prog); + glAttachShader(glamor_priv->finish_access_prog[0], fs_prog); - avs_prog = glamor_compile_glsl_prog(dispatch, GL_VERTEX_SHADER, vs_source); + avs_prog = glamor_compile_glsl_prog(GL_VERTEX_SHADER, vs_source); XNFasprintf(&source, "%s%s", common_source, set_alpha_source); - set_alpha_prog = glamor_compile_glsl_prog(dispatch, GL_FRAGMENT_SHADER, + set_alpha_prog = glamor_compile_glsl_prog(GL_FRAGMENT_SHADER, source); free(source); - dispatch->glAttachShader(glamor_priv->finish_access_prog[1], avs_prog); - dispatch->glAttachShader(glamor_priv->finish_access_prog[1], - set_alpha_prog); + glAttachShader(glamor_priv->finish_access_prog[1], avs_prog); + glAttachShader(glamor_priv->finish_access_prog[1], set_alpha_prog); - dispatch->glBindAttribLocation(glamor_priv->finish_access_prog[0], - GLAMOR_VERTEX_POS, "v_position"); - dispatch->glBindAttribLocation(glamor_priv->finish_access_prog[0], - GLAMOR_VERTEX_SOURCE, "v_texcoord0"); - glamor_link_glsl_prog(dispatch, glamor_priv->finish_access_prog[0]); + glBindAttribLocation(glamor_priv->finish_access_prog[0], + GLAMOR_VERTEX_POS, "v_position"); + glBindAttribLocation(glamor_priv->finish_access_prog[0], + GLAMOR_VERTEX_SOURCE, "v_texcoord0"); + glamor_link_glsl_prog(glamor_priv->finish_access_prog[0]); - dispatch->glBindAttribLocation(glamor_priv->finish_access_prog[1], - GLAMOR_VERTEX_POS, "v_position"); - dispatch->glBindAttribLocation(glamor_priv->finish_access_prog[1], - GLAMOR_VERTEX_SOURCE, "v_texcoord0"); - glamor_link_glsl_prog(dispatch, glamor_priv->finish_access_prog[1]); + glBindAttribLocation(glamor_priv->finish_access_prog[1], + GLAMOR_VERTEX_POS, "v_position"); + glBindAttribLocation(glamor_priv->finish_access_prog[1], + GLAMOR_VERTEX_SOURCE, "v_texcoord0"); + glamor_link_glsl_prog(glamor_priv->finish_access_prog[1]); glamor_priv->finish_access_revert[0] = - dispatch->glGetUniformLocation(glamor_priv->finish_access_prog[0], - "revert"); + glGetUniformLocation(glamor_priv->finish_access_prog[0], "revert"); glamor_priv->finish_access_swap_rb[0] = - dispatch->glGetUniformLocation(glamor_priv->finish_access_prog[0], - "swap_rb"); + glGetUniformLocation(glamor_priv->finish_access_prog[0], "swap_rb"); sampler_uniform_location = - dispatch->glGetUniformLocation(glamor_priv->finish_access_prog[0], - "sampler"); - dispatch->glUseProgram(glamor_priv->finish_access_prog[0]); - dispatch->glUniform1i(sampler_uniform_location, 0); - dispatch->glUniform1i(glamor_priv->finish_access_revert[0], 0); - dispatch->glUniform1i(glamor_priv->finish_access_swap_rb[0], 0); - dispatch->glUseProgram(0); + glGetUniformLocation(glamor_priv->finish_access_prog[0], "sampler"); + glUseProgram(glamor_priv->finish_access_prog[0]); + glUniform1i(sampler_uniform_location, 0); + glUniform1i(glamor_priv->finish_access_revert[0], 0); + glUniform1i(glamor_priv->finish_access_swap_rb[0], 0); + glUseProgram(0); glamor_priv->finish_access_revert[1] = - dispatch->glGetUniformLocation(glamor_priv->finish_access_prog[1], - "revert"); + glGetUniformLocation(glamor_priv->finish_access_prog[1], "revert"); glamor_priv->finish_access_swap_rb[1] = - dispatch->glGetUniformLocation(glamor_priv->finish_access_prog[1], - "swap_rb"); + glGetUniformLocation(glamor_priv->finish_access_prog[1], "swap_rb"); sampler_uniform_location = - dispatch->glGetUniformLocation(glamor_priv->finish_access_prog[1], - "sampler"); - dispatch->glUseProgram(glamor_priv->finish_access_prog[1]); - dispatch->glUniform1i(glamor_priv->finish_access_revert[1], 0); - dispatch->glUniform1i(sampler_uniform_location, 0); - dispatch->glUniform1i(glamor_priv->finish_access_swap_rb[1], 0); - dispatch->glUseProgram(0); - glamor_put_dispatch(glamor_priv); + glGetUniformLocation(glamor_priv->finish_access_prog[1], "sampler"); + glUseProgram(glamor_priv->finish_access_prog[1]); + glUniform1i(glamor_priv->finish_access_revert[1], 0); + glUniform1i(sampler_uniform_location, 0); + glUniform1i(glamor_priv->finish_access_swap_rb[1], 0); + glUseProgram(0); + glamor_put_context(glamor_priv); } void glamor_fini_finish_access_shaders(ScreenPtr screen) { glamor_screen_private *glamor_priv; - glamor_gl_dispatch *dispatch; glamor_priv = glamor_get_screen_private(screen); - dispatch = glamor_get_dispatch(glamor_priv); - dispatch->glDeleteProgram(glamor_priv->finish_access_prog[0]); - dispatch->glDeleteProgram(glamor_priv->finish_access_prog[1]); - glamor_put_dispatch(glamor_priv); + glamor_get_context(glamor_priv); + glDeleteProgram(glamor_priv->finish_access_prog[0]); + glDeleteProgram(glamor_priv->finish_access_prog[1]); + glamor_put_context(glamor_priv); } void @@ -315,15 +305,13 @@ glamor_finish_access(DrawablePtr drawable, glamor_access_t access_mode) } if (pixmap_priv->base.fbo->pbo != 0 && pixmap_priv->base.fbo->pbo_valid) { - glamor_gl_dispatch *dispatch; - assert(glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP); - dispatch = glamor_get_dispatch(glamor_priv); - dispatch->glBindBuffer(GL_PIXEL_PACK_BUFFER, 0); - dispatch->glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0); - dispatch->glDeleteBuffers(1, &pixmap_priv->base.fbo->pbo); - glamor_put_dispatch(glamor_priv); + glamor_get_context(glamor_priv); + glBindBuffer(GL_PIXEL_PACK_BUFFER, 0); + glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0); + glDeleteBuffers(1, &pixmap_priv->base.fbo->pbo); + glamor_put_context(glamor_priv); pixmap_priv->base.fbo->pbo_valid = FALSE; pixmap_priv->base.fbo->pbo = 0; diff --git a/xorg-server/glamor/glamor_egl.c b/xorg-server/glamor/glamor_egl.c index 2f97a839b..9dcba71ce 100644 --- a/xorg-server/glamor/glamor_egl.c +++ b/xorg-server/glamor/glamor_egl.c @@ -37,8 +37,6 @@ #include <errno.h> #include <xf86.h> #include <xf86drm.h> -#define GL_GLEXT_PROTOTYPES -#define EGL_EGLEXT_PROTOTYPES #define EGL_DISPLAY_NO_X_MESA #ifdef GLAMOR_HAS_GBM @@ -46,19 +44,12 @@ #include <drm_fourcc.h> #endif -#if GLAMOR_GLES2 -#include <GLES2/gl2.h> -#include <GLES2/gl2ext.h> -#else -#include <GL/gl.h> -#endif - #define MESA_EGL_NO_X11_HEADERS -#include <EGL/egl.h> -#include <EGL/eglext.h> +#include <epoxy/gl.h> +#include <epoxy/egl.h> #include "glamor.h" -#include "glamor_gl_dispatch.h" +#include "glamor_priv.h" static const char glamor_name[] = "glamor"; @@ -91,16 +82,13 @@ struct glamor_egl_screen_private { int gl_context_depth; int dri3_capable; - PFNEGLCREATEIMAGEKHRPROC egl_create_image_khr; - PFNEGLDESTROYIMAGEKHRPROC egl_destroy_image_khr; - PFNGLEGLIMAGETARGETTEXTURE2DOESPROC egl_image_target_texture2d_oes; - struct glamor_gl_dispatch *dispatch; CloseScreenProcPtr saved_close_screen; xf86FreeScreenProc *saved_free_screen; }; int xf86GlamorEGLPrivateIndex = -1; + static struct glamor_egl_screen_private * glamor_egl_get_screen_private(ScrnInfoPtr scrn) { @@ -108,38 +96,30 @@ glamor_egl_get_screen_private(ScrnInfoPtr scrn) scrn->privates[xf86GlamorEGLPrivateIndex].ptr; } -_X_EXPORT void -glamor_egl_make_current(ScreenPtr screen) +static void +glamor_egl_get_context(struct glamor_context *glamor_ctx) { - ScrnInfoPtr scrn = xf86ScreenToScrn(screen); - struct glamor_egl_screen_private *glamor_egl = - glamor_egl_get_screen_private(scrn); - - if (glamor_egl->gl_context_depth++) + if (glamor_ctx->get_count++) return; - if (glamor_egl->context != eglGetCurrentContext()) { - eglMakeCurrent(glamor_egl->display, EGL_NO_SURFACE, + if (glamor_ctx->ctx != eglGetCurrentContext()) { + eglMakeCurrent(glamor_ctx->display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); - if (!eglMakeCurrent(glamor_egl->display, + if (!eglMakeCurrent(glamor_ctx->display, EGL_NO_SURFACE, EGL_NO_SURFACE, - glamor_egl->context)) { + glamor_ctx->ctx)) { FatalError("Failed to make EGL context current\n"); } } } -_X_EXPORT void -glamor_egl_restore_context(ScreenPtr screen) +static void +glamor_egl_put_context(struct glamor_context *glamor_ctx) { - ScrnInfoPtr scrn = xf86ScreenToScrn(screen); - struct glamor_egl_screen_private *glamor_egl = - glamor_egl_get_screen_private(scrn); - - if (--glamor_egl->gl_context_depth) + if (--glamor_ctx->get_count) return; - eglMakeCurrent(glamor_egl->display, EGL_NO_SURFACE, + eglMakeCurrent(glamor_ctx->display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); } @@ -164,11 +144,11 @@ _glamor_egl_create_image(struct glamor_egl_screen_private *glamor_egl, attribs[5] = stride; if (depth != 32 && depth != 24) return EGL_NO_IMAGE_KHR; - image = glamor_egl->egl_create_image_khr(glamor_egl->display, - glamor_egl->context, - EGL_DRM_BUFFER_MESA, - (void *) (uintptr_t) name, - attribs); + image = eglCreateImageKHR(glamor_egl->display, + glamor_egl->context, + EGL_DRM_BUFFER_MESA, + (void *) (uintptr_t) name, + attribs); if (image == EGL_NO_IMAGE_KHR) return EGL_NO_IMAGE_KHR; @@ -192,15 +172,13 @@ glamor_create_texture_from_image(struct glamor_egl_screen_private *glamor_egl, EGLImageKHR image, GLuint * texture) { - glamor_egl->dispatch->glGenTextures(1, texture); - glamor_egl->dispatch->glBindTexture(GL_TEXTURE_2D, *texture); - glamor_egl->dispatch->glTexParameteri(GL_TEXTURE_2D, - GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glamor_egl->dispatch->glTexParameteri(GL_TEXTURE_2D, - GL_TEXTURE_MAG_FILTER, GL_NEAREST); - - (glamor_egl->egl_image_target_texture2d_oes) (GL_TEXTURE_2D, image); - glamor_egl->dispatch->glBindTexture(GL_TEXTURE_2D, 0); + glGenTextures(1, texture); + glBindTexture(GL_TEXTURE_2D, *texture); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + + glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, image); + glBindTexture(GL_TEXTURE_2D, 0); return TRUE; } @@ -212,7 +190,7 @@ glamor_egl_create_argb8888_based_texture(ScreenPtr screen, int w, int h) EGLImageKHR image; GLuint texture; -#ifdef GLAMOR_HAS_DRI3_SUPPORT +#ifdef GLAMOR_HAS_GBM struct gbm_bo *bo; EGLNativePixmapType native_pixmap; @@ -228,15 +206,15 @@ glamor_egl_create_argb8888_based_texture(ScreenPtr screen, int w, int h) * compile with dri3 support enabled */ native_pixmap = bo; - image = glamor_egl->egl_create_image_khr(glamor_egl->display, - EGL_NO_CONTEXT, - EGL_NATIVE_PIXMAP_KHR, - native_pixmap, NULL); + image = eglCreateImageKHR(glamor_egl->display, + EGL_NO_CONTEXT, + EGL_NATIVE_PIXMAP_KHR, + native_pixmap, NULL); gbm_bo_destroy(bo); if (image == EGL_NO_IMAGE_KHR) return 0; glamor_create_texture_from_image(glamor_egl, image, &texture); - glamor_egl->egl_destroy_image_khr(glamor_egl->display, image); + eglDestroyImageKHR(glamor_egl->display, image); return texture; #else @@ -300,6 +278,8 @@ glamor_egl_create_textured_pixmap(PixmapPtr pixmap, int handle, int stride) { ScreenPtr screen = pixmap->drawable.pScreen; ScrnInfoPtr scrn = xf86ScreenToScrn(screen); + struct glamor_screen_private *glamor_priv = + glamor_get_screen_private(screen); struct glamor_egl_screen_private *glamor_egl; EGLImageKHR image; GLuint texture; @@ -308,7 +288,7 @@ glamor_egl_create_textured_pixmap(PixmapPtr pixmap, int handle, int stride) glamor_egl = glamor_egl_get_screen_private(scrn); - glamor_egl_make_current(screen); + glamor_get_context(glamor_priv); if (glamor_egl->has_gem) { if (!glamor_get_flink_name(glamor_egl->fd, handle, &name)) { xf86DrvMsg(scrn->scrnIndex, X_ERROR, @@ -338,7 +318,7 @@ glamor_egl_create_textured_pixmap(PixmapPtr pixmap, int handle, int stride) ret = TRUE; done: - glamor_egl_restore_context(screen); + glamor_put_context(glamor_priv); return ret; } @@ -347,6 +327,8 @@ glamor_egl_create_textured_pixmap_from_gbm_bo(PixmapPtr pixmap, void *bo) { ScreenPtr screen = pixmap->drawable.pScreen; ScrnInfoPtr scrn = xf86ScreenToScrn(screen); + struct glamor_screen_private *glamor_priv = + glamor_get_screen_private(screen); struct glamor_egl_screen_private *glamor_egl; EGLImageKHR image; GLuint texture; @@ -354,11 +336,11 @@ glamor_egl_create_textured_pixmap_from_gbm_bo(PixmapPtr pixmap, void *bo) glamor_egl = glamor_egl_get_screen_private(scrn); - glamor_egl_make_current(screen); + glamor_get_context(glamor_priv); - image = glamor_egl->egl_create_image_khr(glamor_egl->display, - glamor_egl->context, - EGL_NATIVE_PIXMAP_KHR, bo, NULL); + image = eglCreateImageKHR(glamor_egl->display, + glamor_egl->context, + EGL_NATIVE_PIXMAP_KHR, bo, NULL); if (image == EGL_NO_IMAGE_KHR) { glamor_set_pixmap_type(pixmap, GLAMOR_DRM_ONLY); goto done; @@ -370,11 +352,11 @@ glamor_egl_create_textured_pixmap_from_gbm_bo(PixmapPtr pixmap, void *bo) ret = TRUE; done: - glamor_egl_restore_context(screen); + glamor_put_context(glamor_priv); return ret; } -#ifdef GLAMOR_HAS_DRI3_SUPPORT +#ifdef GLAMOR_HAS_GBM int glamor_get_fd_from_bo(int gbm_fd, struct gbm_bo *bo, int *fd); void glamor_get_name_from_bo(int gbm_fd, struct gbm_bo *bo, int *name); int @@ -409,8 +391,10 @@ glamor_egl_dri3_fd_name_from_tex(ScreenPtr screen, unsigned int tex, Bool want_name, CARD16 *stride, CARD32 *size) { -#ifdef GLAMOR_HAS_DRI3_SUPPORT +#ifdef GLAMOR_HAS_GBM ScrnInfoPtr scrn = xf86ScreenToScrn(screen); + struct glamor_screen_private *glamor_priv = + glamor_get_screen_private(screen); struct glamor_egl_screen_private *glamor_egl; EGLImageKHR image; struct gbm_bo *bo; @@ -424,17 +408,17 @@ glamor_egl_dri3_fd_name_from_tex(ScreenPtr screen, glamor_egl = glamor_egl_get_screen_private(scrn); - glamor_egl_make_current(screen); + glamor_get_context(glamor_priv); image = dixLookupPrivate(&pixmap->devPrivates, glamor_egl_pixmap_private_key); if (image == EGL_NO_IMAGE_KHR || image == NULL) { - image = glamor_egl->egl_create_image_khr(glamor_egl->display, - glamor_egl->context, - EGL_GL_TEXTURE_2D_KHR, - (EGLClientBuffer) (uintptr_t) - tex, attribs); + image = eglCreateImageKHR(glamor_egl->display, + glamor_egl->context, + EGL_GL_TEXTURE_2D_KHR, + (EGLClientBuffer) (uintptr_t) + tex, attribs); if (image == EGL_NO_IMAGE_KHR) goto failure; @@ -462,7 +446,7 @@ glamor_egl_dri3_fd_name_from_tex(ScreenPtr screen, gbm_bo_destroy(bo); failure: - glamor_egl_restore_context(screen); + glamor_put_context(glamor_priv); return fd; #else return -1; @@ -476,7 +460,7 @@ glamor_egl_dri3_pixmap_from_fd(ScreenPtr screen, CARD16 height, CARD16 stride, CARD8 depth, CARD8 bpp) { -#ifdef GLAMOR_HAS_DRI3_SUPPORT +#ifdef GLAMOR_HAS_GBM ScrnInfoPtr scrn = xf86ScreenToScrn(screen); struct glamor_egl_screen_private *glamor_egl; struct gbm_bo *bo; @@ -506,10 +490,10 @@ glamor_egl_dri3_pixmap_from_fd(ScreenPtr screen, attribs[3] = height; attribs[7] = fd; attribs[11] = stride; - image = glamor_egl->egl_create_image_khr(glamor_egl->display, - EGL_NO_CONTEXT, - EGL_LINUX_DMA_BUF_EXT, - NULL, attribs); + image = eglCreateImageKHR(glamor_egl->display, + EGL_NO_CONTEXT, + EGL_LINUX_DMA_BUF_EXT, + NULL, attribs); if (image == EGL_NO_IMAGE_KHR) return NULL; @@ -518,7 +502,7 @@ glamor_egl_dri3_pixmap_from_fd(ScreenPtr screen, * usage of the image. Use gbm_bo to bypass the limitations. */ bo = gbm_bo_import(glamor_egl->gbm, GBM_BO_IMPORT_EGL_IMAGE, image, 0); - glamor_egl->egl_destroy_image_khr(glamor_egl->display, image); + eglDestroyImageKHR(glamor_egl->display, image); if (!bo) return NULL; @@ -555,7 +539,7 @@ _glamor_egl_destroy_pixmap_image(PixmapPtr pixmap) * a texture. we must call glFlush to make sure the * operation on that texture has been done.*/ glamor_block_handler(pixmap->drawable.pScreen); - glamor_egl->egl_destroy_image_khr(glamor_egl->display, image); + eglDestroyImageKHR(glamor_egl->display, image); dixSetPrivate(&pixmap->devPrivates, glamor_egl_pixmap_private_key, NULL); } @@ -605,8 +589,7 @@ glamor_egl_close_screen(ScreenPtr screen) glamor_egl = glamor_egl_get_screen_private(scrn); screen_pixmap = screen->GetScreenPixmap(screen); - glamor_egl->egl_destroy_image_khr(glamor_egl->display, - glamor_egl->front_image); + eglDestroyImageKHR(glamor_egl->display,glamor_egl->front_image); dixSetPrivate(&screen_pixmap->devPrivates, glamor_egl_pixmap_private_key, NULL); glamor_egl->front_image = NULL; @@ -614,7 +597,7 @@ glamor_egl_close_screen(ScreenPtr screen) back_image = dixLookupPrivate(&(*glamor_egl->back_pixmap)->devPrivates, glamor_egl_pixmap_private_key); if (back_image != NULL && back_image != EGL_NO_IMAGE_KHR) { - glamor_egl->egl_destroy_image_khr(glamor_egl->display, back_image); + eglDestroyImageKHR(glamor_egl->display, back_image); dixSetPrivate(&(*glamor_egl->back_pixmap)->devPrivates, glamor_egl_pixmap_private_key, NULL); } @@ -645,7 +628,7 @@ glamor_egl_has_extension(struct glamor_egl_screen_private *glamor_egl, } void -glamor_egl_screen_init(ScreenPtr screen) +glamor_egl_screen_init(ScreenPtr screen, struct glamor_context *glamor_ctx) { ScrnInfoPtr scrn = xf86ScreenToScrn(screen); struct glamor_egl_screen_private *glamor_egl = @@ -653,6 +636,12 @@ glamor_egl_screen_init(ScreenPtr screen) glamor_egl->saved_close_screen = screen->CloseScreen; screen->CloseScreen = glamor_egl_close_screen; + + glamor_ctx->ctx = glamor_egl->context; + glamor_ctx->display = glamor_egl->display; + + glamor_ctx->get_context = glamor_egl_get_context; + glamor_ctx->put_context = glamor_egl_put_context; } static void @@ -746,26 +735,11 @@ glamor_egl_init(ScrnInfoPtr scrn, int fd) KHR_surfaceless_opengl); #endif -#ifdef GLAMOR_HAS_DRI3_SUPPORT +#ifdef GLAMOR_HAS_GBM if (glamor_egl_has_extension(glamor_egl, "EGL_KHR_gl_texture_2D_image") && glamor_egl_has_extension(glamor_egl, "EGL_EXT_image_dma_buf_import")) glamor_egl->dri3_capable = TRUE; #endif - glamor_egl->egl_create_image_khr = (PFNEGLCREATEIMAGEKHRPROC) - eglGetProcAddress("eglCreateImageKHR"); - - glamor_egl->egl_destroy_image_khr = (PFNEGLDESTROYIMAGEKHRPROC) - eglGetProcAddress("eglDestroyImageKHR"); - - glamor_egl->egl_image_target_texture2d_oes = - (PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) - eglGetProcAddress("glEGLImageTargetTexture2DOES"); - - if (!glamor_egl->egl_create_image_khr - || !glamor_egl->egl_image_target_texture2d_oes) { - xf86DrvMsg(scrn->scrnIndex, X_ERROR, "eglGetProcAddress() failed\n"); - return FALSE; - } glamor_egl->context = eglCreateContext(glamor_egl->display, NULL, EGL_NO_CONTEXT, @@ -809,17 +783,3 @@ glamor_egl_init_textured_pixmap(ScreenPtr screen) glamor_enable_dri3(screen); return TRUE; } - -Bool -glamor_gl_dispatch_init(ScreenPtr screen, - struct glamor_gl_dispatch *dispatch, int gl_version) -{ - ScrnInfoPtr scrn = xf86ScreenToScrn(screen); - struct glamor_egl_screen_private *glamor_egl = - glamor_egl_get_screen_private(scrn); - if (!glamor_gl_dispatch_init_impl - (dispatch, gl_version, (get_proc_address_t) eglGetProcAddress)) - return FALSE; - glamor_egl->dispatch = dispatch; - return TRUE; -} diff --git a/xorg-server/glamor/glamor_egl_stubs.c b/xorg-server/glamor/glamor_egl_stubs.c index 1449d0874..4fd9e8016 100644 --- a/xorg-server/glamor/glamor_egl_stubs.c +++ b/xorg-server/glamor/glamor_egl_stubs.c @@ -29,7 +29,7 @@ #include "glamor_priv.h" void -glamor_egl_screen_init(ScreenPtr screen) +glamor_egl_screen_init(ScreenPtr screen, struct glamor_context *glamor_ctx) { } @@ -38,16 +38,6 @@ glamor_egl_destroy_textured_pixmap(PixmapPtr pixmap) { } -void -glamor_egl_make_current(ScreenPtr screen) -{ -} - -void -glamor_egl_restore_context(ScreenPtr screen) -{ -} - int glamor_egl_dri3_fd_name_from_tex(ScreenPtr screen, PixmapPtr pixmap, diff --git a/xorg-server/glamor/glamor_fbo.c b/xorg-server/glamor/glamor_fbo.c index d94e53071..281cf830e 100644 --- a/xorg-server/glamor/glamor_fbo.c +++ b/xorg-server/glamor/glamor_fbo.c @@ -129,15 +129,15 @@ glamor_pixmap_fbo_cache_get(glamor_screen_private *glamor_priv, void glamor_purge_fbo(glamor_pixmap_fbo *fbo) { - glamor_gl_dispatch *dispatch = glamor_get_dispatch(fbo->glamor_priv); + glamor_get_context(fbo->glamor_priv); if (fbo->fb) - dispatch->glDeleteFramebuffers(1, &fbo->fb); + glDeleteFramebuffers(1, &fbo->fb); if (fbo->tex) - dispatch->glDeleteTextures(1, &fbo->tex); + glDeleteTextures(1, &fbo->tex); if (fbo->pbo) - dispatch->glDeleteBuffers(1, &fbo->pbo); - glamor_put_dispatch(fbo->glamor_priv); + glDeleteBuffers(1, &fbo->pbo); + glamor_put_context(fbo->glamor_priv); free(fbo); } @@ -178,19 +178,17 @@ glamor_pixmap_fbo_cache_put(glamor_pixmap_fbo *fbo) static void glamor_pixmap_ensure_fb(glamor_pixmap_fbo *fbo) { - glamor_gl_dispatch *dispatch; int status; - dispatch = glamor_get_dispatch(fbo->glamor_priv); + glamor_get_context(fbo->glamor_priv); if (fbo->fb == 0) - dispatch->glGenFramebuffers(1, &fbo->fb); + glGenFramebuffers(1, &fbo->fb); assert(fbo->tex != 0); - dispatch->glBindFramebuffer(GL_FRAMEBUFFER, fbo->fb); - dispatch->glFramebufferTexture2D(GL_FRAMEBUFFER, - GL_COLOR_ATTACHMENT0, - GL_TEXTURE_2D, fbo->tex, 0); - status = dispatch->glCheckFramebufferStatus(GL_FRAMEBUFFER); + glBindFramebuffer(GL_FRAMEBUFFER, fbo->fb); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, + GL_TEXTURE_2D, fbo->tex, 0); + status = glCheckFramebufferStatus(GL_FRAMEBUFFER); if (status != GL_FRAMEBUFFER_COMPLETE) { const char *str; @@ -221,7 +219,7 @@ glamor_pixmap_ensure_fb(glamor_pixmap_fbo *fbo) FatalError("destination is framebuffer incomplete: %s [%x]\n", str, status); } - glamor_put_dispatch(fbo->glamor_priv); + glamor_put_context(fbo->glamor_priv); } glamor_pixmap_fbo * @@ -243,11 +241,9 @@ glamor_create_fbo_from_tex(glamor_screen_private *glamor_priv, fbo->glamor_priv = glamor_priv; if (flag == GLAMOR_CREATE_PIXMAP_MAP) { - glamor_gl_dispatch *dispatch; - - dispatch = glamor_get_dispatch(glamor_priv); - dispatch->glGenBuffers(1, &fbo->pbo); - glamor_put_dispatch(glamor_priv); + glamor_get_context(glamor_priv); + glGenBuffers(1, &fbo->pbo); + glamor_put_context(glamor_priv); goto done; } @@ -334,7 +330,6 @@ static int _glamor_create_tex(glamor_screen_private *glamor_priv, int w, int h, GLenum format) { - glamor_gl_dispatch *dispatch; unsigned int tex = 0; /* With dri3, we want to allocate ARGB8888 pixmaps only. @@ -346,16 +341,14 @@ _glamor_create_tex(glamor_screen_private *glamor_priv, w, h); } if (!tex) { - dispatch = glamor_get_dispatch(glamor_priv); - dispatch->glGenTextures(1, &tex); - dispatch->glBindTexture(GL_TEXTURE_2D, tex); - dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, - GL_NEAREST); - dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, - GL_NEAREST); - dispatch->glTexImage2D(GL_TEXTURE_2D, 0, format, w, h, 0, - format, GL_UNSIGNED_BYTE, NULL); - glamor_put_dispatch(glamor_priv); + glamor_get_context(glamor_priv); + glGenTextures(1, &tex); + glBindTexture(GL_TEXTURE_2D, tex); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexImage2D(GL_TEXTURE_2D, 0, format, w, h, 0, + format, GL_UNSIGNED_BYTE, NULL); + glamor_put_context(glamor_priv); } return tex; } diff --git a/xorg-server/glamor/glamor_fill.c b/xorg-server/glamor/glamor_fill.c index d59e6204f..dda55eace 100644 --- a/xorg-server/glamor/glamor_fill.c +++ b/xorg-server/glamor/glamor_fill.c @@ -137,7 +137,6 @@ void glamor_init_solid_shader(ScreenPtr screen) { glamor_screen_private *glamor_priv; - glamor_gl_dispatch *dispatch; const char *solid_vs = "attribute vec4 v_position;" "void main()\n" @@ -154,32 +153,31 @@ glamor_init_solid_shader(ScreenPtr screen) GLint fs_prog, vs_prog; glamor_priv = glamor_get_screen_private(screen); - dispatch = glamor_get_dispatch(glamor_priv); - glamor_priv->solid_prog = dispatch->glCreateProgram(); - vs_prog = glamor_compile_glsl_prog(dispatch, GL_VERTEX_SHADER, solid_vs); - fs_prog = glamor_compile_glsl_prog(dispatch, GL_FRAGMENT_SHADER, solid_fs); - dispatch->glAttachShader(glamor_priv->solid_prog, vs_prog); - dispatch->glAttachShader(glamor_priv->solid_prog, fs_prog); + glamor_get_context(glamor_priv); + glamor_priv->solid_prog = glCreateProgram(); + vs_prog = glamor_compile_glsl_prog(GL_VERTEX_SHADER, solid_vs); + fs_prog = glamor_compile_glsl_prog(GL_FRAGMENT_SHADER, solid_fs); + glAttachShader(glamor_priv->solid_prog, vs_prog); + glAttachShader(glamor_priv->solid_prog, fs_prog); - dispatch->glBindAttribLocation(glamor_priv->solid_prog, - GLAMOR_VERTEX_POS, "v_position"); - glamor_link_glsl_prog(dispatch, glamor_priv->solid_prog); + glBindAttribLocation(glamor_priv->solid_prog, + GLAMOR_VERTEX_POS, "v_position"); + glamor_link_glsl_prog(glamor_priv->solid_prog); glamor_priv->solid_color_uniform_location = - dispatch->glGetUniformLocation(glamor_priv->solid_prog, "color"); - glamor_put_dispatch(glamor_priv); + glGetUniformLocation(glamor_priv->solid_prog, "color"); + glamor_put_context(glamor_priv); } void glamor_fini_solid_shader(ScreenPtr screen) { glamor_screen_private *glamor_priv; - glamor_gl_dispatch *dispatch; glamor_priv = glamor_get_screen_private(screen); - dispatch = glamor_get_dispatch(glamor_priv); - dispatch->glDeleteProgram(glamor_priv->solid_prog); - glamor_put_dispatch(glamor_priv); + glamor_get_context(glamor_priv); + glDeleteProgram(glamor_priv->solid_prog); + glamor_put_context(glamor_priv); } static void @@ -188,7 +186,6 @@ _glamor_solid_boxes(PixmapPtr pixmap, BoxPtr box, int nbox, float *color) ScreenPtr screen = pixmap->drawable.pScreen; glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap); - glamor_gl_dispatch *dispatch; GLfloat xscale, yscale; float vertices[32]; float *pvertices = vertices; @@ -196,10 +193,10 @@ _glamor_solid_boxes(PixmapPtr pixmap, BoxPtr box, int nbox, float *color) glamor_set_destination_pixmap_priv_nc(pixmap_priv); - dispatch = glamor_get_dispatch(glamor_priv); - dispatch->glUseProgram(glamor_priv->solid_prog); + glamor_get_context(glamor_priv); + glUseProgram(glamor_priv->solid_prog); - dispatch->glUniform4fv(glamor_priv->solid_color_uniform_location, 1, color); + glUniform4fv(glamor_priv->solid_color_uniform_location, 1, color); pixmap_priv_get_dest_scale(pixmap_priv, &xscale, &yscale); @@ -221,11 +218,11 @@ _glamor_solid_boxes(PixmapPtr pixmap, BoxPtr box, int nbox, float *color) } if (_X_UNLIKELY(nbox > 1)) - dispatch->glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, glamor_priv->ebo); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, glamor_priv->ebo); - dispatch->glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT, - GL_FALSE, 2 * sizeof(float), pvertices); - dispatch->glEnableVertexAttribArray(GLAMOR_VERTEX_POS); + glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT, + GL_FALSE, 2 * sizeof(float), pvertices); + glEnableVertexAttribArray(GLAMOR_VERTEX_POS); while (nbox) { int box_cnt, i; @@ -242,17 +239,16 @@ _glamor_solid_boxes(PixmapPtr pixmap, BoxPtr box, int nbox, float *color) valid_vertices += 4 * 2; } if (box_cnt == 1) - dispatch->glDrawArrays(GL_TRIANGLE_FAN, 0, box_cnt * 4); - else -#ifndef GLAMOR_GLES2 - dispatch->glDrawRangeElements(GL_TRIANGLES, - 0, - box_cnt * 4, - box_cnt * 6, GL_UNSIGNED_SHORT, NULL); -#else - dispatch->glDrawElements(GL_TRIANGLES, - box_cnt * 6, GL_UNSIGNED_SHORT, NULL); -#endif + glDrawArrays(GL_TRIANGLE_FAN, 0, box_cnt * 4); + else { + if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) { + glDrawRangeElements(GL_TRIANGLES, 0, box_cnt * 4, box_cnt * 6, + GL_UNSIGNED_SHORT, NULL); + } else { + glDrawElements(GL_TRIANGLES, box_cnt * 6, GL_UNSIGNED_SHORT, + NULL); + } + } nbox -= box_cnt; box += box_cnt; } @@ -260,9 +256,9 @@ _glamor_solid_boxes(PixmapPtr pixmap, BoxPtr box, int nbox, float *color) if (pvertices != vertices) free(pvertices); - dispatch->glDisableVertexAttribArray(GLAMOR_VERTEX_POS); - dispatch->glUseProgram(0); - glamor_put_dispatch(glamor_priv); + glDisableVertexAttribArray(GLAMOR_VERTEX_POS); + glUseProgram(0); + glamor_put_context(glamor_priv); glamor_priv->state = RENDER_STATE; glamor_priv->render_idle_cnt = 0; } @@ -321,7 +317,6 @@ glamor_solid(PixmapPtr pixmap, int x, int y, int width, int height, ScreenPtr screen = pixmap->drawable.pScreen; glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); glamor_pixmap_private *pixmap_priv; - glamor_gl_dispatch *dispatch; BoxRec box; pixmap_priv = glamor_get_pixmap_private(pixmap); @@ -334,13 +329,13 @@ glamor_solid(PixmapPtr pixmap, int x, int y, int width, int height, return FALSE; } - dispatch = glamor_get_dispatch(glamor_priv); - if (!glamor_set_alu(dispatch, alu)) { + glamor_get_context(glamor_priv); + if (!glamor_set_alu(screen, alu)) { if (alu == GXclear) fg_pixel = 0; else { glamor_fallback("unsupported alu %x\n", alu); - glamor_put_dispatch(glamor_priv); + glamor_put_context(glamor_priv); return FALSE; } } @@ -350,8 +345,8 @@ glamor_solid(PixmapPtr pixmap, int x, int y, int width, int height, box.y2 = y + height; glamor_solid_boxes(pixmap, &box, 1, fg_pixel); - glamor_set_alu(dispatch, GXcopy); - glamor_put_dispatch(glamor_priv); + glamor_set_alu(screen, GXcopy); + glamor_put_context(glamor_priv); return TRUE; } diff --git a/xorg-server/glamor/glamor_gl_dispatch.c b/xorg-server/glamor/glamor_gl_dispatch.c deleted file mode 100644 index 0bdda9c34..000000000 --- a/xorg-server/glamor/glamor_gl_dispatch.c +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright © 2009 Intel Corporation - * Copyright © 1998 Keith Packard - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - * - * Authors: - * Zhigang Gong <zhigang.gong@gmail.com> - * - */ - -#include "glamor_priv.h" -#include <dlfcn.h> - -#define INIT_FUNC(dst,func_name,get) \ - dst->func_name = get(#func_name); \ - if (dst->func_name == NULL) { \ - dst->func_name = (void *)dlsym(NULL, #func_name); \ - if (dst->func_name == NULL) { \ - ErrorF("Failed to get function %s\n", #func_name);\ - goto fail; \ - } \ - } \ - -_X_EXPORT Bool -glamor_gl_dispatch_init_impl(struct glamor_gl_dispatch *dispatch, - int gl_version, - void *(*get_proc_address) (const char *)) -{ -#ifndef GLAMOR_GLES2 - INIT_FUNC(dispatch, glMatrixMode, get_proc_address); - INIT_FUNC(dispatch, glLoadIdentity, get_proc_address); - INIT_FUNC(dispatch, glRasterPos2i, get_proc_address); - INIT_FUNC(dispatch, glDrawPixels, get_proc_address); - INIT_FUNC(dispatch, glLogicOp, get_proc_address); - INIT_FUNC(dispatch, glMapBuffer, get_proc_address); - INIT_FUNC(dispatch, glMapBufferRange, get_proc_address); - INIT_FUNC(dispatch, glUnmapBuffer, get_proc_address); - INIT_FUNC(dispatch, glBlitFramebuffer, get_proc_address); - INIT_FUNC(dispatch, glDrawRangeElements, get_proc_address); -#endif - INIT_FUNC(dispatch, glViewport, get_proc_address); - INIT_FUNC(dispatch, glDrawArrays, get_proc_address); - INIT_FUNC(dispatch, glDrawElements, get_proc_address); - INIT_FUNC(dispatch, glReadPixels, get_proc_address); - INIT_FUNC(dispatch, glPixelStorei, get_proc_address); - INIT_FUNC(dispatch, glTexParameteri, get_proc_address); - INIT_FUNC(dispatch, glTexImage2D, get_proc_address); - INIT_FUNC(dispatch, glGenTextures, get_proc_address); - INIT_FUNC(dispatch, glDeleteTextures, get_proc_address); - INIT_FUNC(dispatch, glBindTexture, get_proc_address); - INIT_FUNC(dispatch, glTexSubImage2D, get_proc_address); - INIT_FUNC(dispatch, glFlush, get_proc_address); - INIT_FUNC(dispatch, glFinish, get_proc_address); - INIT_FUNC(dispatch, glGetIntegerv, get_proc_address); - INIT_FUNC(dispatch, glGetString, get_proc_address); - INIT_FUNC(dispatch, glScissor, get_proc_address); - INIT_FUNC(dispatch, glEnable, get_proc_address); - INIT_FUNC(dispatch, glDisable, get_proc_address); - INIT_FUNC(dispatch, glBlendFunc, get_proc_address); - INIT_FUNC(dispatch, glActiveTexture, get_proc_address); - INIT_FUNC(dispatch, glGenBuffers, get_proc_address); - INIT_FUNC(dispatch, glBufferData, get_proc_address); - INIT_FUNC(dispatch, glBindBuffer, get_proc_address); - INIT_FUNC(dispatch, glDeleteBuffers, get_proc_address); - INIT_FUNC(dispatch, glFramebufferTexture2D, get_proc_address); - INIT_FUNC(dispatch, glBindFramebuffer, get_proc_address); - INIT_FUNC(dispatch, glDeleteFramebuffers, get_proc_address); - INIT_FUNC(dispatch, glGenFramebuffers, get_proc_address); - INIT_FUNC(dispatch, glCheckFramebufferStatus, get_proc_address); - INIT_FUNC(dispatch, glVertexAttribPointer, get_proc_address); - INIT_FUNC(dispatch, glDisableVertexAttribArray, get_proc_address); - INIT_FUNC(dispatch, glEnableVertexAttribArray, get_proc_address); - INIT_FUNC(dispatch, glBindAttribLocation, get_proc_address); - INIT_FUNC(dispatch, glLinkProgram, get_proc_address); - INIT_FUNC(dispatch, glShaderSource, get_proc_address); - - INIT_FUNC(dispatch, glUseProgram, get_proc_address); - INIT_FUNC(dispatch, glUniform1i, get_proc_address); - INIT_FUNC(dispatch, glUniform1f, get_proc_address); - INIT_FUNC(dispatch, glUniform4f, get_proc_address); - INIT_FUNC(dispatch, glUniform4fv, get_proc_address); - INIT_FUNC(dispatch, glUniform1fv, get_proc_address); - INIT_FUNC(dispatch, glUniform2fv, get_proc_address); - INIT_FUNC(dispatch, glUniformMatrix3fv, get_proc_address); - INIT_FUNC(dispatch, glCreateProgram, get_proc_address); - INIT_FUNC(dispatch, glDeleteProgram, get_proc_address); - INIT_FUNC(dispatch, glCreateShader, get_proc_address); - INIT_FUNC(dispatch, glCompileShader, get_proc_address); - INIT_FUNC(dispatch, glAttachShader, get_proc_address); - INIT_FUNC(dispatch, glDeleteShader, get_proc_address); - INIT_FUNC(dispatch, glGetShaderiv, get_proc_address); - INIT_FUNC(dispatch, glGetShaderInfoLog, get_proc_address); - INIT_FUNC(dispatch, glGetProgramiv, get_proc_address); - INIT_FUNC(dispatch, glGetProgramInfoLog, get_proc_address); - INIT_FUNC(dispatch, glGetUniformLocation, get_proc_address); - - return TRUE; - fail: - return FALSE; -} diff --git a/xorg-server/glamor/glamor_gl_dispatch.h b/xorg-server/glamor/glamor_gl_dispatch.h deleted file mode 100644 index 63790b41f..000000000 --- a/xorg-server/glamor/glamor_gl_dispatch.h +++ /dev/null @@ -1,128 +0,0 @@ -typedef struct glamor_gl_dispatch { - /* Transformation functions */ - void (*glMatrixMode) (GLenum mode); - void (*glLoadIdentity) (void); - void (*glViewport) (GLint x, GLint y, GLsizei width, GLsizei height); - /* Drawing functions */ - void (*glRasterPos2i) (GLint x, GLint y); - - /* Vertex Array */ - void (*glDrawArrays) (GLenum mode, GLint first, GLsizei count); - - /* Elements Array */ - void (*glDrawElements) (GLenum mode, GLsizei count, GLenum type, - const GLvoid * indices); - void (*glDrawRangeElements) (GLenum mode, GLuint start, GLuint end, - GLsizei count, GLenum type, - const GLvoid * indices); - - /* Raster functions */ - void (*glReadPixels) (GLint x, GLint y, - GLsizei width, GLsizei height, - GLenum format, GLenum type, GLvoid * pixels); - - void (*glDrawPixels) (GLsizei width, GLsizei height, - GLenum format, GLenum type, const GLvoid * pixels); - void (*glPixelStorei) (GLenum pname, GLint param); - /* Texture Mapping */ - - void (*glTexParameteri) (GLenum target, GLenum pname, GLint param); - void (*glTexImage2D) (GLenum target, GLint level, - GLint internalFormat, - GLsizei width, GLsizei height, - GLint border, GLenum format, GLenum type, - const GLvoid * pixels); - /* 1.1 */ - void (*glGenTextures) (GLsizei n, GLuint * textures); - void (*glDeleteTextures) (GLsizei n, const GLuint * textures); - void (*glBindTexture) (GLenum target, GLuint texture); - void (*glTexSubImage2D) (GLenum target, GLint level, - GLint xoffset, GLint yoffset, - GLsizei width, GLsizei height, - GLenum format, GLenum type, const GLvoid * pixels); - /* MISC */ - void (*glFlush) (void); - void (*glFinish) (void); - void (*glGetIntegerv) (GLenum pname, GLint * params); - const GLubyte *(*glGetString) (GLenum name); - void (*glScissor) (GLint x, GLint y, GLsizei width, GLsizei height); - void (*glEnable) (GLenum cap); - void (*glDisable) (GLenum cap); - void (*glBlendFunc) (GLenum sfactor, GLenum dfactor); - void (*glLogicOp) (GLenum opcode); - - /* 1.3 */ - void (*glActiveTexture) (GLenum texture); - - /* GL Extentions */ - void (*glGenBuffers) (GLsizei n, GLuint * buffers); - void (*glBufferData) (GLenum target, GLsizeiptr size, - const GLvoid * data, GLenum usage); - GLvoid *(*glMapBuffer) (GLenum target, GLenum access); - GLvoid *(*glMapBufferRange) (GLenum target, GLintptr offset, - GLsizeiptr length, GLbitfield access); - GLboolean(*glUnmapBuffer) (GLenum target); - void (*glBindBuffer) (GLenum target, GLuint buffer); - void (*glDeleteBuffers) (GLsizei n, const GLuint * buffers); - - void (*glFramebufferTexture2D) (GLenum target, GLenum attachment, - GLenum textarget, GLuint texture, - GLint level); - void (*glBindFramebuffer) (GLenum target, GLuint framebuffer); - void (*glDeleteFramebuffers) (GLsizei n, const GLuint * framebuffers); - void (*glGenFramebuffers) (GLsizei n, GLuint * framebuffers); - GLenum(*glCheckFramebufferStatus) (GLenum target); - void (*glBlitFramebuffer) (GLint srcX0, GLint srcY0, GLint srcX1, - GLint srcY1, GLint dstX0, GLint dstY0, - GLint dstX1, GLint dstY1, - GLbitfield mask, GLenum filter); - - void (*glVertexAttribPointer) (GLuint index, GLint size, - GLenum type, GLboolean normalized, - GLsizei stride, const GLvoid * pointer); - void (*glDisableVertexAttribArray) (GLuint index); - void (*glEnableVertexAttribArray) (GLuint index); - void (*glBindAttribLocation) (GLuint program, GLuint index, - const GLchar * name); - - void (*glLinkProgram) (GLuint program); - void (*glShaderSource) (GLuint shader, GLsizei count, - const GLchar * *string, const GLint * length); - void (*glUseProgram) (GLuint program); - void (*glUniform1i) (GLint location, GLint v0); - void (*glUniform1f) (GLint location, GLfloat v0); - void (*glUniform4f) (GLint location, GLfloat v0, GLfloat v1, - GLfloat v2, GLfloat v3); - void (*glUniform1fv) (GLint location, GLsizei count, const GLfloat * value); - void (*glUniform2fv) (GLint location, GLsizei count, const GLfloat * value); - void (*glUniform4fv) (GLint location, GLsizei count, const GLfloat * value); - void (*glUniformMatrix3fv) (GLint location, GLsizei count, - GLboolean transpose, const GLfloat * value); - GLuint(*glCreateProgram) (void); - GLuint(*glDeleteProgram) (GLuint); - GLuint(*glCreateShader) (GLenum type); - void (*glCompileShader) (GLuint shader); - void (*glAttachShader) (GLuint program, GLuint shader); - void (*glDeleteShader) (GLuint shader); - void (*glGetShaderiv) (GLuint shader, GLenum pname, GLint * params); - void (*glGetShaderInfoLog) (GLuint shader, GLsizei bufSize, - GLsizei * length, GLchar * infoLog); - void (*glGetProgramiv) (GLuint program, GLenum pname, GLint * params); - void (*glGetProgramInfoLog) (GLuint program, GLsizei bufSize, - GLsizei * length, GLchar * infoLog); - GLint(*glGetUniformLocation) (GLuint program, const GLchar * name); - -} glamor_gl_dispatch; - -typedef void *(*get_proc_address_t) (const char *); - -_X_EXPORT Bool - -glamor_gl_dispatch_init_impl(struct glamor_gl_dispatch *dispatch, - int gl_version, - get_proc_address_t get_proc_address); - -_X_EXPORT Bool - -glamor_gl_dispatch_init(ScreenPtr screen, - struct glamor_gl_dispatch *dispatch, int gl_version); diff --git a/xorg-server/glamor/glamor_glext.h b/xorg-server/glamor/glamor_glext.h deleted file mode 100644 index 2a220c32f..000000000 --- a/xorg-server/glamor/glamor_glext.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright © 2001 Keith Packard - * Copyright © 2008 Intel Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - * - * Authors: - * Zhigang Gong <zhigang.gong@linux.intel.com> - * - */ - -#ifdef GLAMOR_GLES2 - -#define GL_BGRA GL_BGRA_EXT -#define GL_COLOR_INDEX 0x1900 -#define GL_BITMAP 0x1A00 -#define GL_UNSIGNED_INT_8_8_8_8 0x8035 -#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367 -#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368 -#define GL_UNSIGNED_INT_10_10_10_2 0x8036 -#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364 -#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366 -#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365 - -#define GL_PIXEL_PACK_BUFFER 0x88EB -#define GL_PIXEL_UNPACK_BUFFER 0x88EC -#define GL_CLAMP_TO_BORDER 0x812D - -#define GL_READ_WRITE 0x88BA -#define GL_READ_ONLY 0x88B8 -#define GL_WRITE_ONLY 0x88B9 -#define GL_STREAM_DRAW 0x88E0 -#define GL_STREAM_READ 0x88E1 -#define GL_PACK_ROW_LENGTH 0x0D02 -#define GL_UNPACK_ROW_LENGTH 0x0CF2 - -#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER 0x8CDB -#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER 0x8CDC -#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56 - -#define GL_PACK_INVERT_MESA 0x8758 -#define GL_MAP_UNSYNCHRONIZED_BIT 0x0020 -#define GL_MAP_READ_BIT 0x0001 -#define GL_MAP_WRITE_BIT 0x0002 - -#endif diff --git a/xorg-server/glamor/glamor_glx.c b/xorg-server/glamor/glamor_glx.c new file mode 100644 index 000000000..311bf758d --- /dev/null +++ b/xorg-server/glamor/glamor_glx.c @@ -0,0 +1,82 @@ +/* + * Copyright © 2013 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include <epoxy/glx.h> +#include "glamor_context.h" + +/** + * @file glamor_glx.c + * + * GLX context management for glamor. + * + * This has to be kept separate from the server sources because of + * Xlib's conflicting definition of CARD32 and similar typedefs. + */ + +static void +glamor_glx_get_context(struct glamor_context *glamor_ctx) +{ + GLXContext old_ctx; + + if (glamor_ctx->get_count++) + return; + + old_ctx = glXGetCurrentContext(); + if (old_ctx == glamor_ctx->ctx) + return; + + glXMakeCurrent(glamor_ctx->display, glamor_ctx->drawable_xid, + glamor_ctx->ctx); +} + + +static void +glamor_glx_put_context(struct glamor_context *glamor_ctx) +{ + if (--glamor_ctx->get_count) + return; + + /* We actually reset the context, so that indirect GLX's EGL usage + * won't get confused by ours. + */ + glXMakeCurrent(glamor_ctx->display, None, NULL); +} + +Bool +glamor_glx_screen_init(struct glamor_context *glamor_ctx) +{ + glamor_ctx->ctx = glXGetCurrentContext(); + if (!glamor_ctx->ctx) + return False; + + glamor_ctx->display = glXGetCurrentDisplay(); + if (!glamor_ctx->display) + return False; + + glamor_ctx->drawable_xid = glXGetCurrentDrawable(); + + glamor_ctx->get_context = glamor_glx_get_context; + glamor_ctx->put_context = glamor_glx_put_context; + + return True; +} diff --git a/xorg-server/glamor/glamor_glyphs.c b/xorg-server/glamor/glamor_glyphs.c index 3586b33da..caafa4348 100644 --- a/xorg-server/glamor/glamor_glyphs.c +++ b/xorg-server/glamor/glamor_glyphs.c @@ -1274,15 +1274,13 @@ glamor_buffer_glyph(glamor_screen_private *glamor_priv, if (buffer->source == NULL) buffer->source = source; if (glyphs_dst_mode == GLYPHS_DST_MODE_VIA_MASK_CACHE) { - glamor_gl_dispatch *dispatch; - /* mode 1 means we are using global mask cache, * thus we have to composite from the cache picture * to the cache picture, we need a flush here to make * sure latter we get the corret glyphs data.*/ - dispatch = glamor_get_dispatch(glamor_priv); - dispatch->glFlush(); - glamor_put_dispatch(glamor_priv); + glamor_get_context(glamor_priv); + glFlush(); + glamor_put_context(glamor_priv); } } else { diff --git a/xorg-server/glamor/glamor_gradient.c b/xorg-server/glamor/glamor_gradient.c index df2ccb8a0..9f6f1b1cf 100644 --- a/xorg-server/glamor/glamor_gradient.c +++ b/xorg-server/glamor/glamor_gradient.c @@ -42,15 +42,13 @@ #ifdef GLAMOR_GRADIENT_SHADER -static GLint -_glamor_create_getcolor_fs_program(ScreenPtr screen, int stops_count, - int use_array) +static const char * +_glamor_create_getcolor_fs_source(ScreenPtr screen, int stops_count, + int use_array) { glamor_screen_private *glamor_priv; - glamor_gl_dispatch *dispatch; char *gradient_fs = NULL; - GLint fs_getcolor_prog; #define gradient_fs_getcolor\ GLAMOR_DEFAULT_PRECISION\ @@ -177,22 +175,16 @@ _glamor_create_getcolor_fs_program(ScreenPtr screen, int stops_count, "}\n"; glamor_priv = glamor_get_screen_private(screen); - dispatch = glamor_get_dispatch(glamor_priv); + glamor_get_context(glamor_priv); if (use_array) { XNFasprintf(&gradient_fs, gradient_fs_getcolor, stops_count, stops_count); - fs_getcolor_prog = - glamor_compile_glsl_prog(dispatch, GL_FRAGMENT_SHADER, gradient_fs); - free(gradient_fs); + return gradient_fs; } else { - fs_getcolor_prog = - glamor_compile_glsl_prog(dispatch, GL_FRAGMENT_SHADER, - gradient_fs_getcolor_no_array); + return XNFstrdup(gradient_fs_getcolor_no_array); } - - return fs_getcolor_prog; } static void @@ -200,12 +192,11 @@ _glamor_create_radial_gradient_program(ScreenPtr screen, int stops_count, int dyn_gen) { glamor_screen_private *glamor_priv; - glamor_gl_dispatch *dispatch; int index; GLint gradient_prog = 0; char *gradient_fs = NULL; - GLint fs_main_prog, fs_getcolor_prog, vs_prog; + GLint fs_prog, vs_prog; const char *gradient_vs = GLAMOR_DEFAULT_PRECISION @@ -346,7 +337,10 @@ _glamor_create_radial_gradient_program(ScreenPtr screen, int stops_count, " } else {\n"\ " gl_FragColor = get_color(stop_len);\n"\ " }\n"\ - "}\n" + "}\n"\ + "\n"\ + "%s\n" /* fs_getcolor_source */ + const char *fs_getcolor_source; glamor_priv = glamor_get_screen_private(screen); @@ -355,61 +349,42 @@ _glamor_create_radial_gradient_program(ScreenPtr screen, int stops_count, return; } - dispatch = glamor_get_dispatch(glamor_priv); + glamor_get_context(glamor_priv); if (dyn_gen && glamor_priv->gradient_prog[SHADER_GRADIENT_RADIAL][2]) { - dispatch->glDeleteShader(glamor_priv-> - radial_gradient_shaders - [SHADER_GRADIENT_VS_PROG][2]); - glamor_priv->radial_gradient_shaders[SHADER_GRADIENT_VS_PROG][2] = 0; - - dispatch->glDeleteShader(glamor_priv-> - radial_gradient_shaders - [SHADER_GRADIENT_FS_MAIN_PROG][2]); - glamor_priv->radial_gradient_shaders[SHADER_GRADIENT_FS_MAIN_PROG][2] = - 0; - - dispatch->glDeleteShader(glamor_priv-> - radial_gradient_shaders - [SHADER_GRADIENT_FS_GETCOLOR_PROG][2]); - glamor_priv-> - radial_gradient_shaders[SHADER_GRADIENT_FS_GETCOLOR_PROG][2] = 0; - - dispatch->glDeleteProgram(glamor_priv-> - gradient_prog[SHADER_GRADIENT_RADIAL][2]); + glDeleteProgram(glamor_priv->gradient_prog[SHADER_GRADIENT_RADIAL][2]); glamor_priv->gradient_prog[SHADER_GRADIENT_RADIAL][2] = 0; } - gradient_prog = dispatch->glCreateProgram(); + gradient_prog = glCreateProgram(); + + vs_prog = glamor_compile_glsl_prog(GL_VERTEX_SHADER, gradient_vs); - vs_prog = glamor_compile_glsl_prog(dispatch, GL_VERTEX_SHADER, gradient_vs); + fs_getcolor_source = + _glamor_create_getcolor_fs_source(screen, stops_count, + (stops_count > 0)); XNFasprintf(&gradient_fs, gradient_radial_fs_template, PIXMAN_REPEAT_NONE, PIXMAN_REPEAT_NORMAL, - PIXMAN_REPEAT_REFLECT); + PIXMAN_REPEAT_REFLECT, + fs_getcolor_source); - fs_main_prog = glamor_compile_glsl_prog(dispatch, - GL_FRAGMENT_SHADER, gradient_fs); + fs_prog = glamor_compile_glsl_prog(GL_FRAGMENT_SHADER, gradient_fs); free(gradient_fs); - fs_getcolor_prog = - _glamor_create_getcolor_fs_program(screen, stops_count, - (stops_count > 0)); + glAttachShader(gradient_prog, vs_prog); + glAttachShader(gradient_prog, fs_prog); + glDeleteShader(vs_prog); + glDeleteShader(fs_prog); - dispatch->glAttachShader(gradient_prog, vs_prog); - dispatch->glAttachShader(gradient_prog, fs_getcolor_prog); - dispatch->glAttachShader(gradient_prog, fs_main_prog); + glBindAttribLocation(gradient_prog, GLAMOR_VERTEX_POS, "v_position"); + glBindAttribLocation(gradient_prog, GLAMOR_VERTEX_SOURCE, "v_texcoord"); - dispatch->glBindAttribLocation(gradient_prog, GLAMOR_VERTEX_POS, - "v_positionsition"); - dispatch->glBindAttribLocation(gradient_prog, GLAMOR_VERTEX_SOURCE, - "v_texcoord"); + glamor_link_glsl_prog(gradient_prog); - glamor_link_glsl_prog(dispatch, gradient_prog); - - dispatch->glUseProgram(0); + glUseProgram(0); if (dyn_gen) { index = 2; @@ -423,15 +398,8 @@ _glamor_create_radial_gradient_program(ScreenPtr screen, int stops_count, } glamor_priv->gradient_prog[SHADER_GRADIENT_RADIAL][index] = gradient_prog; - glamor_priv->radial_gradient_shaders[SHADER_GRADIENT_VS_PROG][index] = - vs_prog; - glamor_priv->radial_gradient_shaders[SHADER_GRADIENT_FS_MAIN_PROG][index] = - fs_main_prog; - glamor_priv-> - radial_gradient_shaders[SHADER_GRADIENT_FS_GETCOLOR_PROG][index] = - fs_getcolor_prog; - - glamor_put_dispatch(glamor_priv); + + glamor_put_context(glamor_priv); } static void @@ -439,12 +407,11 @@ _glamor_create_linear_gradient_program(ScreenPtr screen, int stops_count, int dyn_gen) { glamor_screen_private *glamor_priv; - glamor_gl_dispatch *dispatch; int index = 0; GLint gradient_prog = 0; char *gradient_fs = NULL; - GLint fs_main_prog, fs_getcolor_prog, vs_prog; + GLint fs_prog, vs_prog; const char *gradient_vs = GLAMOR_DEFAULT_PRECISION @@ -587,7 +554,10 @@ _glamor_create_linear_gradient_program(ScreenPtr screen, int stops_count, "{\n"\ " float stop_len = get_stop_len();\n"\ " gl_FragColor = get_color(stop_len);\n"\ - "}\n" + "}\n"\ + "\n"\ + "%s" /* fs_getcolor_source */ + const char *fs_getcolor_source; glamor_priv = glamor_get_screen_private(screen); @@ -596,58 +566,38 @@ _glamor_create_linear_gradient_program(ScreenPtr screen, int stops_count, return; } - dispatch = glamor_get_dispatch(glamor_priv); + glamor_get_context(glamor_priv); if (dyn_gen && glamor_priv->gradient_prog[SHADER_GRADIENT_LINEAR][2]) { - dispatch->glDeleteShader(glamor_priv-> - linear_gradient_shaders - [SHADER_GRADIENT_VS_PROG][2]); - glamor_priv->linear_gradient_shaders[SHADER_GRADIENT_VS_PROG][2] = 0; - - dispatch->glDeleteShader(glamor_priv-> - linear_gradient_shaders - [SHADER_GRADIENT_FS_MAIN_PROG][2]); - glamor_priv->linear_gradient_shaders[SHADER_GRADIENT_FS_MAIN_PROG][2] = - 0; - - dispatch->glDeleteShader(glamor_priv-> - linear_gradient_shaders - [SHADER_GRADIENT_FS_GETCOLOR_PROG][2]); - glamor_priv-> - linear_gradient_shaders[SHADER_GRADIENT_FS_GETCOLOR_PROG][2] = 0; - - dispatch->glDeleteProgram(glamor_priv-> - gradient_prog[SHADER_GRADIENT_LINEAR][2]); + glDeleteProgram(glamor_priv->gradient_prog[SHADER_GRADIENT_LINEAR][2]); glamor_priv->gradient_prog[SHADER_GRADIENT_LINEAR][2] = 0; } - gradient_prog = dispatch->glCreateProgram(); + gradient_prog = glCreateProgram(); - vs_prog = glamor_compile_glsl_prog(dispatch, GL_VERTEX_SHADER, gradient_vs); + vs_prog = glamor_compile_glsl_prog(GL_VERTEX_SHADER, gradient_vs); + + fs_getcolor_source = + _glamor_create_getcolor_fs_source(screen, stops_count, stops_count > 0); XNFasprintf(&gradient_fs, gradient_fs_template, - PIXMAN_REPEAT_NORMAL, PIXMAN_REPEAT_REFLECT); + PIXMAN_REPEAT_NORMAL, PIXMAN_REPEAT_REFLECT, + fs_getcolor_source); - fs_main_prog = glamor_compile_glsl_prog(dispatch, - GL_FRAGMENT_SHADER, gradient_fs); + fs_prog = glamor_compile_glsl_prog(GL_FRAGMENT_SHADER, gradient_fs); free(gradient_fs); - fs_getcolor_prog = - _glamor_create_getcolor_fs_program(screen, stops_count, - (stops_count > 0)); - - dispatch->glAttachShader(gradient_prog, vs_prog); - dispatch->glAttachShader(gradient_prog, fs_getcolor_prog); - dispatch->glAttachShader(gradient_prog, fs_main_prog); + glAttachShader(gradient_prog, vs_prog); + glAttachShader(gradient_prog, fs_prog); + glDeleteShader(vs_prog); + glDeleteShader(fs_prog); - dispatch->glBindAttribLocation(gradient_prog, GLAMOR_VERTEX_POS, - "v_position"); - dispatch->glBindAttribLocation(gradient_prog, GLAMOR_VERTEX_SOURCE, - "v_texcoord"); + glBindAttribLocation(gradient_prog, GLAMOR_VERTEX_POS, "v_position"); + glBindAttribLocation(gradient_prog, GLAMOR_VERTEX_SOURCE, "v_texcoord"); - glamor_link_glsl_prog(dispatch, gradient_prog); + glamor_link_glsl_prog(gradient_prog); - dispatch->glUseProgram(0); + glUseProgram(0); if (dyn_gen) { index = 2; @@ -661,15 +611,8 @@ _glamor_create_linear_gradient_program(ScreenPtr screen, int stops_count, } glamor_priv->gradient_prog[SHADER_GRADIENT_LINEAR][index] = gradient_prog; - glamor_priv->linear_gradient_shaders[SHADER_GRADIENT_VS_PROG][index] = - vs_prog; - glamor_priv->linear_gradient_shaders[SHADER_GRADIENT_FS_MAIN_PROG][index] = - fs_main_prog; - glamor_priv-> - linear_gradient_shaders[SHADER_GRADIENT_FS_GETCOLOR_PROG][index] = - fs_getcolor_prog; - - glamor_put_dispatch(glamor_priv); + + glamor_put_context(glamor_priv); } void @@ -682,18 +625,7 @@ glamor_init_gradient_shader(ScreenPtr screen) for (i = 0; i < 3; i++) { glamor_priv->gradient_prog[SHADER_GRADIENT_LINEAR][i] = 0; - glamor_priv->linear_gradient_shaders[SHADER_GRADIENT_VS_PROG][i] = 0; - glamor_priv->linear_gradient_shaders[SHADER_GRADIENT_FS_MAIN_PROG][i] = - 0; - glamor_priv-> - linear_gradient_shaders[SHADER_GRADIENT_FS_GETCOLOR_PROG][i] = 0; - glamor_priv->gradient_prog[SHADER_GRADIENT_RADIAL][i] = 0; - glamor_priv->radial_gradient_shaders[SHADER_GRADIENT_VS_PROG][i] = 0; - glamor_priv->radial_gradient_shaders[SHADER_GRADIENT_FS_MAIN_PROG][i] = - 0; - glamor_priv-> - radial_gradient_shaders[SHADER_GRADIENT_FS_GETCOLOR_PROG][i] = 0; } glamor_priv->linear_max_nstops = 0; glamor_priv->radial_max_nstops = 0; @@ -709,59 +641,23 @@ void glamor_fini_gradient_shader(ScreenPtr screen) { glamor_screen_private *glamor_priv; - glamor_gl_dispatch *dispatch; int i = 0; glamor_priv = glamor_get_screen_private(screen); - dispatch = glamor_get_dispatch(glamor_priv); + glamor_get_context(glamor_priv); for (i = 0; i < 3; i++) { /* Linear Gradient */ - if (glamor_priv->linear_gradient_shaders[SHADER_GRADIENT_VS_PROG][i]) - dispatch->glDeleteShader(glamor_priv-> - linear_gradient_shaders - [SHADER_GRADIENT_VS_PROG][i]); - - if (glamor_priv-> - linear_gradient_shaders[SHADER_GRADIENT_FS_MAIN_PROG][i]) - dispatch->glDeleteShader(glamor_priv-> - linear_gradient_shaders - [SHADER_GRADIENT_FS_MAIN_PROG][i]); - - if (glamor_priv-> - linear_gradient_shaders[SHADER_GRADIENT_FS_GETCOLOR_PROG][i]) - dispatch->glDeleteShader(glamor_priv-> - linear_gradient_shaders - [SHADER_GRADIENT_FS_GETCOLOR_PROG][i]); - if (glamor_priv->gradient_prog[SHADER_GRADIENT_LINEAR][i]) - dispatch->glDeleteProgram(glamor_priv-> - gradient_prog[SHADER_GRADIENT_LINEAR][i]); - - /* Radial Gradient */ - if (glamor_priv->radial_gradient_shaders[SHADER_GRADIENT_VS_PROG][i]) - dispatch->glDeleteShader(glamor_priv-> - radial_gradient_shaders - [SHADER_GRADIENT_VS_PROG][i]); - - if (glamor_priv-> - radial_gradient_shaders[SHADER_GRADIENT_FS_MAIN_PROG][i]) - dispatch->glDeleteShader(glamor_priv-> - radial_gradient_shaders - [SHADER_GRADIENT_FS_MAIN_PROG][i]); - - if (glamor_priv-> - radial_gradient_shaders[SHADER_GRADIENT_FS_GETCOLOR_PROG][i]) - dispatch->glDeleteShader(glamor_priv-> - radial_gradient_shaders - [SHADER_GRADIENT_FS_GETCOLOR_PROG][i]); + glDeleteProgram(glamor_priv->gradient_prog + [SHADER_GRADIENT_LINEAR][i]); if (glamor_priv->gradient_prog[SHADER_GRADIENT_RADIAL][i]) - dispatch->glDeleteProgram(glamor_priv-> - gradient_prog[SHADER_GRADIENT_RADIAL][i]); + glDeleteProgram(glamor_priv->gradient_prog + [SHADER_GRADIENT_RADIAL][i]); } - glamor_put_dispatch(glamor_priv); + glamor_put_context(glamor_priv); } static void @@ -835,7 +731,6 @@ _glamor_gradient_set_pixmap_destination(ScreenPtr screen, { glamor_pixmap_private *pixmap_priv; PixmapPtr pixmap = NULL; - glamor_gl_dispatch *dispatch = NULL; pixmap = glamor_get_drawable_pixmap(dst_picture->pDrawable); pixmap_priv = glamor_get_pixmap_private(pixmap); @@ -893,17 +788,17 @@ _glamor_gradient_set_pixmap_destination(ScreenPtr screen, tex_vertices[0], tex_vertices[1], tex_vertices[2], tex_vertices[3], tex_vertices[4], tex_vertices[5], tex_vertices[6], tex_vertices[7]); - dispatch = glamor_get_dispatch(glamor_priv); + glamor_get_context(glamor_priv); - dispatch->glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT, - GL_FALSE, 0, vertices); - dispatch->glVertexAttribPointer(GLAMOR_VERTEX_SOURCE, 2, GL_FLOAT, - GL_FALSE, 0, tex_vertices); + glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT, + GL_FALSE, 0, vertices); + glVertexAttribPointer(GLAMOR_VERTEX_SOURCE, 2, GL_FLOAT, + GL_FALSE, 0, tex_vertices); - dispatch->glEnableVertexAttribArray(GLAMOR_VERTEX_POS); - dispatch->glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE); + glEnableVertexAttribArray(GLAMOR_VERTEX_POS); + glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE); - glamor_put_dispatch(glamor_priv); + glamor_put_context(glamor_priv); return 1; } @@ -996,7 +891,6 @@ glamor_generate_radial_gradient_picture(ScreenPtr screen, PictFormatShort format) { glamor_screen_private *glamor_priv; - glamor_gl_dispatch *dispatch; PicturePtr dst_picture = NULL; PixmapPtr pixmap = NULL; GLint gradient_prog = 0; @@ -1047,7 +941,7 @@ glamor_generate_radial_gradient_picture(ScreenPtr screen, GLint r2_uniform_location = 0; glamor_priv = glamor_get_screen_private(screen); - dispatch = glamor_get_dispatch(glamor_priv); + glamor_get_context(glamor_priv); /* Create a pixmap with VBO. */ pixmap = glamor_create_pixmap(screen, @@ -1088,77 +982,74 @@ glamor_generate_radial_gradient_picture(ScreenPtr screen, } /* Bind all the uniform vars . */ - transform_mat_uniform_location = - dispatch->glGetUniformLocation(gradient_prog, "transform_mat"); - repeat_type_uniform_location = - dispatch->glGetUniformLocation(gradient_prog, "repeat_type"); - n_stop_uniform_location = - dispatch->glGetUniformLocation(gradient_prog, "n_stop"); - A_value_uniform_location = - dispatch->glGetUniformLocation(gradient_prog, "A_value"); - repeat_type_uniform_location = - dispatch->glGetUniformLocation(gradient_prog, "repeat_type"); - c1_uniform_location = dispatch->glGetUniformLocation(gradient_prog, "c1"); - r1_uniform_location = dispatch->glGetUniformLocation(gradient_prog, "r1"); - c2_uniform_location = dispatch->glGetUniformLocation(gradient_prog, "c2"); - r2_uniform_location = dispatch->glGetUniformLocation(gradient_prog, "r2"); + transform_mat_uniform_location = glGetUniformLocation(gradient_prog, + "transform_mat"); + repeat_type_uniform_location = glGetUniformLocation(gradient_prog, + "repeat_type"); + n_stop_uniform_location = glGetUniformLocation(gradient_prog, "n_stop"); + A_value_uniform_location = glGetUniformLocation(gradient_prog, "A_value"); + repeat_type_uniform_location =glGetUniformLocation(gradient_prog, + "repeat_type"); + c1_uniform_location = glGetUniformLocation(gradient_prog, "c1"); + r1_uniform_location = glGetUniformLocation(gradient_prog, "r1"); + c2_uniform_location = glGetUniformLocation(gradient_prog, "c2"); + r2_uniform_location = glGetUniformLocation(gradient_prog, "r2"); if (src_picture->pSourcePict->radial.nstops + 2 <= RADIAL_SMALL_STOPS) { stop0_uniform_location = - dispatch->glGetUniformLocation(gradient_prog, "stop0"); + glGetUniformLocation(gradient_prog, "stop0"); stop1_uniform_location = - dispatch->glGetUniformLocation(gradient_prog, "stop1"); + glGetUniformLocation(gradient_prog, "stop1"); stop2_uniform_location = - dispatch->glGetUniformLocation(gradient_prog, "stop2"); + glGetUniformLocation(gradient_prog, "stop2"); stop3_uniform_location = - dispatch->glGetUniformLocation(gradient_prog, "stop3"); + glGetUniformLocation(gradient_prog, "stop3"); stop4_uniform_location = - dispatch->glGetUniformLocation(gradient_prog, "stop4"); + glGetUniformLocation(gradient_prog, "stop4"); stop5_uniform_location = - dispatch->glGetUniformLocation(gradient_prog, "stop5"); + glGetUniformLocation(gradient_prog, "stop5"); stop6_uniform_location = - dispatch->glGetUniformLocation(gradient_prog, "stop6"); + glGetUniformLocation(gradient_prog, "stop6"); stop7_uniform_location = - dispatch->glGetUniformLocation(gradient_prog, "stop7"); + glGetUniformLocation(gradient_prog, "stop7"); stop_color0_uniform_location = - dispatch->glGetUniformLocation(gradient_prog, "stop_color0"); + glGetUniformLocation(gradient_prog, "stop_color0"); stop_color1_uniform_location = - dispatch->glGetUniformLocation(gradient_prog, "stop_color1"); + glGetUniformLocation(gradient_prog, "stop_color1"); stop_color2_uniform_location = - dispatch->glGetUniformLocation(gradient_prog, "stop_color2"); + glGetUniformLocation(gradient_prog, "stop_color2"); stop_color3_uniform_location = - dispatch->glGetUniformLocation(gradient_prog, "stop_color3"); + glGetUniformLocation(gradient_prog, "stop_color3"); stop_color4_uniform_location = - dispatch->glGetUniformLocation(gradient_prog, "stop_color4"); + glGetUniformLocation(gradient_prog, "stop_color4"); stop_color5_uniform_location = - dispatch->glGetUniformLocation(gradient_prog, "stop_color5"); + glGetUniformLocation(gradient_prog, "stop_color5"); stop_color6_uniform_location = - dispatch->glGetUniformLocation(gradient_prog, "stop_color6"); + glGetUniformLocation(gradient_prog, "stop_color6"); stop_color7_uniform_location = - dispatch->glGetUniformLocation(gradient_prog, "stop_color7"); + glGetUniformLocation(gradient_prog, "stop_color7"); } else { stops_uniform_location = - dispatch->glGetUniformLocation(gradient_prog, "stops"); + glGetUniformLocation(gradient_prog, "stops"); stop_colors_uniform_location = - dispatch->glGetUniformLocation(gradient_prog, "stop_colors"); + glGetUniformLocation(gradient_prog, "stop_colors"); } - dispatch->glUseProgram(gradient_prog); + glUseProgram(gradient_prog); - dispatch->glUniform1i(repeat_type_uniform_location, - src_picture->repeatType); + glUniform1i(repeat_type_uniform_location, src_picture->repeatType); if (src_picture->transform) { _glamor_gradient_convert_trans_matrix(src_picture->transform, transform_mat, width, height, 0); - dispatch->glUniformMatrix3fv(transform_mat_uniform_location, - 1, 1, &transform_mat[0][0]); + glUniformMatrix3fv(transform_mat_uniform_location, + 1, 1, &transform_mat[0][0]); } else { - dispatch->glUniformMatrix3fv(transform_mat_uniform_location, - 1, 1, &identity_mat[0][0]); + glUniformMatrix3fv(transform_mat_uniform_location, + 1, 1, &identity_mat[0][0]); } if (!_glamor_gradient_set_pixmap_destination @@ -1193,54 +1084,53 @@ glamor_generate_radial_gradient_picture(ScreenPtr screen, if (src_picture->pSourcePict->linear.nstops + 2 <= RADIAL_SMALL_STOPS) { int j = 0; - dispatch->glUniform4f(stop_color0_uniform_location, - stop_colors[4 * j + 0], stop_colors[4 * j + 1], - stop_colors[4 * j + 2], stop_colors[4 * j + 3]); + glUniform4f(stop_color0_uniform_location, + stop_colors[4 * j + 0], stop_colors[4 * j + 1], + stop_colors[4 * j + 2], stop_colors[4 * j + 3]); j++; - dispatch->glUniform4f(stop_color1_uniform_location, - stop_colors[4 * j + 0], stop_colors[4 * j + 1], - stop_colors[4 * j + 2], stop_colors[4 * j + 3]); + glUniform4f(stop_color1_uniform_location, + stop_colors[4 * j + 0], stop_colors[4 * j + 1], + stop_colors[4 * j + 2], stop_colors[4 * j + 3]); j++; - dispatch->glUniform4f(stop_color2_uniform_location, - stop_colors[4 * j + 0], stop_colors[4 * j + 1], - stop_colors[4 * j + 2], stop_colors[4 * j + 3]); + glUniform4f(stop_color2_uniform_location, + stop_colors[4 * j + 0], stop_colors[4 * j + 1], + stop_colors[4 * j + 2], stop_colors[4 * j + 3]); j++; - dispatch->glUniform4f(stop_color3_uniform_location, - stop_colors[4 * j + 0], stop_colors[4 * j + 1], - stop_colors[4 * j + 2], stop_colors[4 * j + 3]); + glUniform4f(stop_color3_uniform_location, + stop_colors[4 * j + 0], stop_colors[4 * j + 1], + stop_colors[4 * j + 2], stop_colors[4 * j + 3]); j++; - dispatch->glUniform4f(stop_color4_uniform_location, - stop_colors[4 * j + 0], stop_colors[4 * j + 1], - stop_colors[4 * j + 2], stop_colors[4 * j + 3]); + glUniform4f(stop_color4_uniform_location, + stop_colors[4 * j + 0], stop_colors[4 * j + 1], + stop_colors[4 * j + 2], stop_colors[4 * j + 3]); j++; - dispatch->glUniform4f(stop_color5_uniform_location, - stop_colors[4 * j + 0], stop_colors[4 * j + 1], - stop_colors[4 * j + 2], stop_colors[4 * j + 3]); + glUniform4f(stop_color5_uniform_location, + stop_colors[4 * j + 0], stop_colors[4 * j + 1], + stop_colors[4 * j + 2], stop_colors[4 * j + 3]); j++; - dispatch->glUniform4f(stop_color6_uniform_location, - stop_colors[4 * j + 0], stop_colors[4 * j + 1], - stop_colors[4 * j + 2], stop_colors[4 * j + 3]); + glUniform4f(stop_color6_uniform_location, + stop_colors[4 * j + 0], stop_colors[4 * j + 1], + stop_colors[4 * j + 2], stop_colors[4 * j + 3]); j++; - dispatch->glUniform4f(stop_color7_uniform_location, - stop_colors[4 * j + 0], stop_colors[4 * j + 1], - stop_colors[4 * j + 2], stop_colors[4 * j + 3]); + glUniform4f(stop_color7_uniform_location, + stop_colors[4 * j + 0], stop_colors[4 * j + 1], + stop_colors[4 * j + 2], stop_colors[4 * j + 3]); j = 0; - dispatch->glUniform1f(stop0_uniform_location, n_stops[j++]); - dispatch->glUniform1f(stop1_uniform_location, n_stops[j++]); - dispatch->glUniform1f(stop2_uniform_location, n_stops[j++]); - dispatch->glUniform1f(stop3_uniform_location, n_stops[j++]); - dispatch->glUniform1f(stop4_uniform_location, n_stops[j++]); - dispatch->glUniform1f(stop5_uniform_location, n_stops[j++]); - dispatch->glUniform1f(stop6_uniform_location, n_stops[j++]); - dispatch->glUniform1f(stop7_uniform_location, n_stops[j++]); - dispatch->glUniform1i(n_stop_uniform_location, count); + glUniform1f(stop0_uniform_location, n_stops[j++]); + glUniform1f(stop1_uniform_location, n_stops[j++]); + glUniform1f(stop2_uniform_location, n_stops[j++]); + glUniform1f(stop3_uniform_location, n_stops[j++]); + glUniform1f(stop4_uniform_location, n_stops[j++]); + glUniform1f(stop5_uniform_location, n_stops[j++]); + glUniform1f(stop6_uniform_location, n_stops[j++]); + glUniform1f(stop7_uniform_location, n_stops[j++]); + glUniform1i(n_stop_uniform_location, count); } else { - dispatch->glUniform4fv(stop_colors_uniform_location, count, - stop_colors); - dispatch->glUniform1fv(stops_uniform_location, count, n_stops); - dispatch->glUniform1i(n_stop_uniform_location, count); + glUniform4fv(stop_colors_uniform_location, count, stop_colors); + glUniform1fv(stops_uniform_location, count, n_stops); + glUniform1i(n_stop_uniform_location, count); } c1x = (float) pixman_fixed_to_double(src_picture->pSourcePict->radial.c1.x); @@ -1255,25 +1145,25 @@ glamor_generate_radial_gradient_picture(ScreenPtr screen, glamor_set_circle_centre(width, height, c1x, c1y, glamor_priv->yInverted, cxy); - dispatch->glUniform2fv(c1_uniform_location, 1, cxy); - dispatch->glUniform1f(r1_uniform_location, r1); + glUniform2fv(c1_uniform_location, 1, cxy); + glUniform1f(r1_uniform_location, r1); glamor_set_circle_centre(width, height, c2x, c2y, glamor_priv->yInverted, cxy); - dispatch->glUniform2fv(c2_uniform_location, 1, cxy); - dispatch->glUniform1f(r2_uniform_location, r2); + glUniform2fv(c2_uniform_location, 1, cxy); + glUniform1f(r2_uniform_location, r2); A_value = (c2x - c1x) * (c2x - c1x) + (c2y - c1y) * (c2y - c1y) - (r2 - r1) * (r2 - r1); - dispatch->glUniform1f(A_value_uniform_location, A_value); + glUniform1f(A_value_uniform_location, A_value); DEBUGF("C1:(%f, %f) R1:%f\nC2:(%f, %f) R2:%f\nA = %f\n", c1x, c1y, r1, c2x, c2y, r2, A_value); /* Now rendering. */ - dispatch->glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); + glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); /* Do the clear logic. */ if (stops_count > RADIAL_SMALL_STOPS) { @@ -1281,14 +1171,14 @@ glamor_generate_radial_gradient_picture(ScreenPtr screen, free(stop_colors); } - dispatch->glBindBuffer(GL_ARRAY_BUFFER, 0); - dispatch->glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); + glBindBuffer(GL_ARRAY_BUFFER, 0); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); - dispatch->glDisableVertexAttribArray(GLAMOR_VERTEX_POS); - dispatch->glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE); - dispatch->glUseProgram(0); + glDisableVertexAttribArray(GLAMOR_VERTEX_POS); + glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE); + glUseProgram(0); - glamor_put_dispatch(glamor_priv); + glamor_put_context(glamor_priv); return dst_picture; GRADIENT_FAIL: @@ -1303,13 +1193,13 @@ glamor_generate_radial_gradient_picture(ScreenPtr screen, free(stop_colors); } - dispatch->glBindBuffer(GL_ARRAY_BUFFER, 0); - dispatch->glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); + glBindBuffer(GL_ARRAY_BUFFER, 0); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); - dispatch->glDisableVertexAttribArray(GLAMOR_VERTEX_POS); - dispatch->glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE); - dispatch->glUseProgram(0); - glamor_put_dispatch(glamor_priv); + glDisableVertexAttribArray(GLAMOR_VERTEX_POS); + glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE); + glUseProgram(0); + glamor_put_context(glamor_priv); return NULL; } @@ -1321,7 +1211,6 @@ glamor_generate_linear_gradient_picture(ScreenPtr screen, PictFormatShort format) { glamor_screen_private *glamor_priv; - glamor_gl_dispatch *dispatch; PicturePtr dst_picture = NULL; PixmapPtr pixmap = NULL; GLint gradient_prog = 0; @@ -1374,7 +1263,7 @@ glamor_generate_linear_gradient_picture(ScreenPtr screen, GLint pt_distance_uniform_location = 0; glamor_priv = glamor_get_screen_private(screen); - dispatch = glamor_get_dispatch(glamor_priv); + glamor_get_context(glamor_priv); /* Create a pixmap with VBO. */ pixmap = glamor_create_pixmap(screen, @@ -1417,79 +1306,78 @@ glamor_generate_linear_gradient_picture(ScreenPtr screen, /* Bind all the uniform vars . */ n_stop_uniform_location = - dispatch->glGetUniformLocation(gradient_prog, "n_stop"); + glGetUniformLocation(gradient_prog, "n_stop"); pt_slope_uniform_location = - dispatch->glGetUniformLocation(gradient_prog, "pt_slope"); + glGetUniformLocation(gradient_prog, "pt_slope"); repeat_type_uniform_location = - dispatch->glGetUniformLocation(gradient_prog, "repeat_type"); + glGetUniformLocation(gradient_prog, "repeat_type"); hor_ver_uniform_location = - dispatch->glGetUniformLocation(gradient_prog, "hor_ver"); + glGetUniformLocation(gradient_prog, "hor_ver"); transform_mat_uniform_location = - dispatch->glGetUniformLocation(gradient_prog, "transform_mat"); + glGetUniformLocation(gradient_prog, "transform_mat"); cos_val_uniform_location = - dispatch->glGetUniformLocation(gradient_prog, "cos_val"); + glGetUniformLocation(gradient_prog, "cos_val"); p1_distance_uniform_location = - dispatch->glGetUniformLocation(gradient_prog, "p1_distance"); + glGetUniformLocation(gradient_prog, "p1_distance"); pt_distance_uniform_location = - dispatch->glGetUniformLocation(gradient_prog, "pt_distance"); + glGetUniformLocation(gradient_prog, "pt_distance"); if (src_picture->pSourcePict->linear.nstops + 2 <= LINEAR_SMALL_STOPS) { stop0_uniform_location = - dispatch->glGetUniformLocation(gradient_prog, "stop0"); + glGetUniformLocation(gradient_prog, "stop0"); stop1_uniform_location = - dispatch->glGetUniformLocation(gradient_prog, "stop1"); + glGetUniformLocation(gradient_prog, "stop1"); stop2_uniform_location = - dispatch->glGetUniformLocation(gradient_prog, "stop2"); + glGetUniformLocation(gradient_prog, "stop2"); stop3_uniform_location = - dispatch->glGetUniformLocation(gradient_prog, "stop3"); + glGetUniformLocation(gradient_prog, "stop3"); stop4_uniform_location = - dispatch->glGetUniformLocation(gradient_prog, "stop4"); + glGetUniformLocation(gradient_prog, "stop4"); stop5_uniform_location = - dispatch->glGetUniformLocation(gradient_prog, "stop5"); + glGetUniformLocation(gradient_prog, "stop5"); stop6_uniform_location = - dispatch->glGetUniformLocation(gradient_prog, "stop6"); + glGetUniformLocation(gradient_prog, "stop6"); stop7_uniform_location = - dispatch->glGetUniformLocation(gradient_prog, "stop7"); + glGetUniformLocation(gradient_prog, "stop7"); stop_color0_uniform_location = - dispatch->glGetUniformLocation(gradient_prog, "stop_color0"); + glGetUniformLocation(gradient_prog, "stop_color0"); stop_color1_uniform_location = - dispatch->glGetUniformLocation(gradient_prog, "stop_color1"); + glGetUniformLocation(gradient_prog, "stop_color1"); stop_color2_uniform_location = - dispatch->glGetUniformLocation(gradient_prog, "stop_color2"); + glGetUniformLocation(gradient_prog, "stop_color2"); stop_color3_uniform_location = - dispatch->glGetUniformLocation(gradient_prog, "stop_color3"); + glGetUniformLocation(gradient_prog, "stop_color3"); stop_color4_uniform_location = - dispatch->glGetUniformLocation(gradient_prog, "stop_color4"); + glGetUniformLocation(gradient_prog, "stop_color4"); stop_color5_uniform_location = - dispatch->glGetUniformLocation(gradient_prog, "stop_color5"); + glGetUniformLocation(gradient_prog, "stop_color5"); stop_color6_uniform_location = - dispatch->glGetUniformLocation(gradient_prog, "stop_color6"); + glGetUniformLocation(gradient_prog, "stop_color6"); stop_color7_uniform_location = - dispatch->glGetUniformLocation(gradient_prog, "stop_color7"); + glGetUniformLocation(gradient_prog, "stop_color7"); } else { stops_uniform_location = - dispatch->glGetUniformLocation(gradient_prog, "stops"); + glGetUniformLocation(gradient_prog, "stops"); stop_colors_uniform_location = - dispatch->glGetUniformLocation(gradient_prog, "stop_colors"); + glGetUniformLocation(gradient_prog, "stop_colors"); } - dispatch->glUseProgram(gradient_prog); + glUseProgram(gradient_prog); - dispatch->glUniform1i(repeat_type_uniform_location, - src_picture->repeatType); + glUniform1i(repeat_type_uniform_location, src_picture->repeatType); /* set the transform matrix. */ if (src_picture->transform) { _glamor_gradient_convert_trans_matrix(src_picture->transform, transform_mat, width, height, 1); - dispatch->glUniformMatrix3fv(transform_mat_uniform_location, - 1, 1, &transform_mat[0][0]); + glUniformMatrix3fv(transform_mat_uniform_location, + 1, 1, &transform_mat[0][0]); } else { - dispatch->glUniformMatrix3fv(transform_mat_uniform_location, - 1, 1, &identity_mat[0][0]); + glUniformMatrix3fv(transform_mat_uniform_location, + 1, 1, &identity_mat[0][0]); } if (!_glamor_gradient_set_pixmap_destination @@ -1547,66 +1435,65 @@ glamor_generate_linear_gradient_picture(ScreenPtr screen, if (src_picture->pSourcePict->linear.nstops + 2 <= LINEAR_SMALL_STOPS) { int j = 0; - dispatch->glUniform4f(stop_color0_uniform_location, - stop_colors[4 * j + 0], stop_colors[4 * j + 1], - stop_colors[4 * j + 2], stop_colors[4 * j + 3]); + glUniform4f(stop_color0_uniform_location, + stop_colors[4 * j + 0], stop_colors[4 * j + 1], + stop_colors[4 * j + 2], stop_colors[4 * j + 3]); j++; - dispatch->glUniform4f(stop_color1_uniform_location, - stop_colors[4 * j + 0], stop_colors[4 * j + 1], - stop_colors[4 * j + 2], stop_colors[4 * j + 3]); + glUniform4f(stop_color1_uniform_location, + stop_colors[4 * j + 0], stop_colors[4 * j + 1], + stop_colors[4 * j + 2], stop_colors[4 * j + 3]); j++; - dispatch->glUniform4f(stop_color2_uniform_location, - stop_colors[4 * j + 0], stop_colors[4 * j + 1], - stop_colors[4 * j + 2], stop_colors[4 * j + 3]); + glUniform4f(stop_color2_uniform_location, + stop_colors[4 * j + 0], stop_colors[4 * j + 1], + stop_colors[4 * j + 2], stop_colors[4 * j + 3]); j++; - dispatch->glUniform4f(stop_color3_uniform_location, - stop_colors[4 * j + 0], stop_colors[4 * j + 1], - stop_colors[4 * j + 2], stop_colors[4 * j + 3]); + glUniform4f(stop_color3_uniform_location, + stop_colors[4 * j + 0], stop_colors[4 * j + 1], + stop_colors[4 * j + 2], stop_colors[4 * j + 3]); j++; - dispatch->glUniform4f(stop_color4_uniform_location, - stop_colors[4 * j + 0], stop_colors[4 * j + 1], - stop_colors[4 * j + 2], stop_colors[4 * j + 3]); + glUniform4f(stop_color4_uniform_location, + stop_colors[4 * j + 0], stop_colors[4 * j + 1], + stop_colors[4 * j + 2], stop_colors[4 * j + 3]); j++; - dispatch->glUniform4f(stop_color5_uniform_location, - stop_colors[4 * j + 0], stop_colors[4 * j + 1], - stop_colors[4 * j + 2], stop_colors[4 * j + 3]); + glUniform4f(stop_color5_uniform_location, + stop_colors[4 * j + 0], stop_colors[4 * j + 1], + stop_colors[4 * j + 2], stop_colors[4 * j + 3]); j++; - dispatch->glUniform4f(stop_color6_uniform_location, - stop_colors[4 * j + 0], stop_colors[4 * j + 1], - stop_colors[4 * j + 2], stop_colors[4 * j + 3]); + glUniform4f(stop_color6_uniform_location, + stop_colors[4 * j + 0], stop_colors[4 * j + 1], + stop_colors[4 * j + 2], stop_colors[4 * j + 3]); j++; - dispatch->glUniform4f(stop_color7_uniform_location, - stop_colors[4 * j + 0], stop_colors[4 * j + 1], - stop_colors[4 * j + 2], stop_colors[4 * j + 3]); + glUniform4f(stop_color7_uniform_location, + stop_colors[4 * j + 0], stop_colors[4 * j + 1], + stop_colors[4 * j + 2], stop_colors[4 * j + 3]); j = 0; - dispatch->glUniform1f(stop0_uniform_location, n_stops[j++]); - dispatch->glUniform1f(stop1_uniform_location, n_stops[j++]); - dispatch->glUniform1f(stop2_uniform_location, n_stops[j++]); - dispatch->glUniform1f(stop3_uniform_location, n_stops[j++]); - dispatch->glUniform1f(stop4_uniform_location, n_stops[j++]); - dispatch->glUniform1f(stop5_uniform_location, n_stops[j++]); - dispatch->glUniform1f(stop6_uniform_location, n_stops[j++]); - dispatch->glUniform1f(stop7_uniform_location, n_stops[j++]); - - dispatch->glUniform1i(n_stop_uniform_location, count); + glUniform1f(stop0_uniform_location, n_stops[j++]); + glUniform1f(stop1_uniform_location, n_stops[j++]); + glUniform1f(stop2_uniform_location, n_stops[j++]); + glUniform1f(stop3_uniform_location, n_stops[j++]); + glUniform1f(stop4_uniform_location, n_stops[j++]); + glUniform1f(stop5_uniform_location, n_stops[j++]); + glUniform1f(stop6_uniform_location, n_stops[j++]); + glUniform1f(stop7_uniform_location, n_stops[j++]); + + glUniform1i(n_stop_uniform_location, count); } else { - dispatch->glUniform4fv(stop_colors_uniform_location, count, - stop_colors); - dispatch->glUniform1fv(stops_uniform_location, count, n_stops); - dispatch->glUniform1i(n_stop_uniform_location, count); + glUniform4fv(stop_colors_uniform_location, count, stop_colors); + glUniform1fv(stops_uniform_location, count, n_stops); + glUniform1i(n_stop_uniform_location, count); } if (src_picture->pSourcePict->linear.p2.y == src_picture->pSourcePict->linear.p1.y) { // The horizontal case. - dispatch->glUniform1i(hor_ver_uniform_location, 1); + glUniform1i(hor_ver_uniform_location, 1); DEBUGF("p1.y: %f, p2.y: %f, enter the horizontal case\n", pt1[1], pt2[1]); p1_distance = pt1[0]; pt_distance = (pt2[0] - p1_distance); - dispatch->glUniform1f(p1_distance_uniform_location, p1_distance); - dispatch->glUniform1f(pt_distance_uniform_location, pt_distance); + glUniform1f(p1_distance_uniform_location, p1_distance); + glUniform1f(pt_distance_uniform_location, pt_distance); } else { /* The slope need to compute here. In shader, the viewport set will change @@ -1616,20 +1503,20 @@ glamor_generate_linear_gradient_picture(ScreenPtr screen, (float) (src_picture->pSourcePict->linear.p2.y - src_picture->pSourcePict->linear.p1.y); slope = slope * yscale / xscale; - dispatch->glUniform1f(pt_slope_uniform_location, slope); - dispatch->glUniform1i(hor_ver_uniform_location, 0); + glUniform1f(pt_slope_uniform_location, slope); + glUniform1i(hor_ver_uniform_location, 0); cos_val = sqrt(1.0 / (slope * slope + 1.0)); - dispatch->glUniform1f(cos_val_uniform_location, cos_val); + glUniform1f(cos_val_uniform_location, cos_val); p1_distance = (pt1[1] - pt1[0] * slope) * cos_val; pt_distance = (pt2[1] - pt2[0] * slope) * cos_val - p1_distance; - dispatch->glUniform1f(p1_distance_uniform_location, p1_distance); - dispatch->glUniform1f(pt_distance_uniform_location, pt_distance); + glUniform1f(p1_distance_uniform_location, p1_distance); + glUniform1f(pt_distance_uniform_location, pt_distance); } /* Now rendering. */ - dispatch->glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); + glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); /* Do the clear logic. */ if (stops_count > LINEAR_SMALL_STOPS) { @@ -1637,14 +1524,14 @@ glamor_generate_linear_gradient_picture(ScreenPtr screen, free(stop_colors); } - dispatch->glBindBuffer(GL_ARRAY_BUFFER, 0); - dispatch->glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); + glBindBuffer(GL_ARRAY_BUFFER, 0); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); - dispatch->glDisableVertexAttribArray(GLAMOR_VERTEX_POS); - dispatch->glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE); - dispatch->glUseProgram(0); + glDisableVertexAttribArray(GLAMOR_VERTEX_POS); + glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE); + glUseProgram(0); - glamor_put_dispatch(glamor_priv); + glamor_put_context(glamor_priv); return dst_picture; GRADIENT_FAIL: @@ -1659,13 +1546,13 @@ glamor_generate_linear_gradient_picture(ScreenPtr screen, free(stop_colors); } - dispatch->glBindBuffer(GL_ARRAY_BUFFER, 0); - dispatch->glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); + glBindBuffer(GL_ARRAY_BUFFER, 0); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); - dispatch->glDisableVertexAttribArray(GLAMOR_VERTEX_POS); - dispatch->glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE); - dispatch->glUseProgram(0); - glamor_put_dispatch(glamor_priv); + glDisableVertexAttribArray(GLAMOR_VERTEX_POS); + glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE); + glUseProgram(0); + glamor_put_context(glamor_priv); return NULL; } diff --git a/xorg-server/glamor/glamor_picture.c b/xorg-server/glamor/glamor_picture.c index f51a7e459..8bbe2e98b 100644 --- a/xorg-server/glamor/glamor_picture.c +++ b/xorg-server/glamor/glamor_picture.c @@ -93,8 +93,7 @@ glamor_create_picture(PicturePtr picture) * we have to mark this pixmap as a separated texture, and don't * fallback to DDX layer. */ if (pixmap_priv->type == GLAMOR_TEXTURE_DRM - && !glamor_pict_format_is_compatible(picture->format, - pixmap->drawable.depth)) + && !glamor_pict_format_is_compatible(picture)) glamor_set_pixmap_type(pixmap, GLAMOR_SEPARATE_TEXTURE); } } diff --git a/xorg-server/glamor/glamor_pixmap.c b/xorg-server/glamor/glamor_pixmap.c index f7de59c39..77197b5d1 100644 --- a/xorg-server/glamor/glamor_pixmap.c +++ b/xorg-server/glamor/glamor_pixmap.c @@ -66,18 +66,12 @@ void glamor_set_destination_pixmap_fbo(glamor_pixmap_fbo *fbo, int x0, int y0, int width, int height) { - glamor_gl_dispatch *dispatch = glamor_get_dispatch(fbo->glamor_priv); - - dispatch->glBindFramebuffer(GL_FRAMEBUFFER, fbo->fb); -#ifndef GLAMOR_GLES2 - dispatch->glMatrixMode(GL_PROJECTION); - dispatch->glLoadIdentity(); - dispatch->glMatrixMode(GL_MODELVIEW); - dispatch->glLoadIdentity(); -#endif - dispatch->glViewport(x0, y0, width, height); + glamor_get_context(fbo->glamor_priv); + + glBindFramebuffer(GL_FRAMEBUFFER, fbo->fb); + glViewport(x0, y0, width, height); - glamor_put_dispatch(fbo->glamor_priv); + glamor_put_context(fbo->glamor_priv); } void @@ -121,71 +115,387 @@ glamor_set_planemask(PixmapPtr pixmap, unsigned long planemask) } Bool -glamor_set_alu(struct glamor_gl_dispatch *dispatch, unsigned char alu) +glamor_set_alu(ScreenPtr screen, unsigned char alu) { -#ifndef GLAMOR_GLES2 + glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); + + if (glamor_priv->gl_flavor == GLAMOR_GL_ES2) { + if (alu != GXcopy) + return FALSE; + else + return TRUE; + } + if (alu == GXcopy) { - dispatch->glDisable(GL_COLOR_LOGIC_OP); + glDisable(GL_COLOR_LOGIC_OP); return TRUE; } - dispatch->glEnable(GL_COLOR_LOGIC_OP); + glEnable(GL_COLOR_LOGIC_OP); switch (alu) { case GXclear: - dispatch->glLogicOp(GL_CLEAR); + glLogicOp(GL_CLEAR); break; case GXand: - dispatch->glLogicOp(GL_AND); + glLogicOp(GL_AND); break; case GXandReverse: - dispatch->glLogicOp(GL_AND_REVERSE); + glLogicOp(GL_AND_REVERSE); break; case GXandInverted: - dispatch->glLogicOp(GL_AND_INVERTED); + glLogicOp(GL_AND_INVERTED); break; case GXnoop: - dispatch->glLogicOp(GL_NOOP); + glLogicOp(GL_NOOP); break; case GXxor: - dispatch->glLogicOp(GL_XOR); + glLogicOp(GL_XOR); break; case GXor: - dispatch->glLogicOp(GL_OR); + glLogicOp(GL_OR); break; case GXnor: - dispatch->glLogicOp(GL_NOR); + glLogicOp(GL_NOR); break; case GXequiv: - dispatch->glLogicOp(GL_EQUIV); + glLogicOp(GL_EQUIV); break; case GXinvert: - dispatch->glLogicOp(GL_INVERT); + glLogicOp(GL_INVERT); break; case GXorReverse: - dispatch->glLogicOp(GL_OR_REVERSE); + glLogicOp(GL_OR_REVERSE); break; case GXcopyInverted: - dispatch->glLogicOp(GL_COPY_INVERTED); + glLogicOp(GL_COPY_INVERTED); break; case GXorInverted: - dispatch->glLogicOp(GL_OR_INVERTED); + glLogicOp(GL_OR_INVERTED); break; case GXnand: - dispatch->glLogicOp(GL_NAND); + glLogicOp(GL_NAND); break; case GXset: - dispatch->glLogicOp(GL_SET); + glLogicOp(GL_SET); break; default: glamor_fallback("unsupported alu %x\n", alu); return FALSE; } -#else - if (alu != GXcopy) - return FALSE; -#endif + return TRUE; } +/* + * Map picture's format to the correct gl texture format and type. + * no_alpha is used to indicate whehter we need to wire alpha to 1. + * + * Although opengl support A1/GL_BITMAP, we still don't use it + * here, it seems that mesa has bugs when uploading a A1 bitmap. + * + * Return 0 if find a matched texture type. Otherwise return -1. + **/ +static int +glamor_get_tex_format_type_from_pictformat_gl(PictFormatShort format, + GLenum *tex_format, + GLenum *tex_type, + int *no_alpha, + int *revert, + int *swap_rb, int is_upload) +{ + *no_alpha = 0; + *revert = REVERT_NONE; + *swap_rb = is_upload ? SWAP_NONE_UPLOADING : SWAP_NONE_DOWNLOADING; + switch (format) { + case PICT_a1: + *tex_format = GL_ALPHA; + *tex_type = GL_UNSIGNED_BYTE; + *revert = is_upload ? REVERT_UPLOADING_A1 : REVERT_DOWNLOADING_A1; + break; + case PICT_b8g8r8x8: + *no_alpha = 1; + case PICT_b8g8r8a8: + *tex_format = GL_BGRA; + *tex_type = GL_UNSIGNED_INT_8_8_8_8; + break; + + case PICT_x8r8g8b8: + *no_alpha = 1; + case PICT_a8r8g8b8: + *tex_format = GL_BGRA; + *tex_type = GL_UNSIGNED_INT_8_8_8_8_REV; + break; + case PICT_x8b8g8r8: + *no_alpha = 1; + case PICT_a8b8g8r8: + *tex_format = GL_RGBA; + *tex_type = GL_UNSIGNED_INT_8_8_8_8_REV; + break; + case PICT_x2r10g10b10: + *no_alpha = 1; + case PICT_a2r10g10b10: + *tex_format = GL_BGRA; + *tex_type = GL_UNSIGNED_INT_2_10_10_10_REV; + break; + case PICT_x2b10g10r10: + *no_alpha = 1; + case PICT_a2b10g10r10: + *tex_format = GL_RGBA; + *tex_type = GL_UNSIGNED_INT_2_10_10_10_REV; + break; + + case PICT_r5g6b5: + *tex_format = GL_RGB; + *tex_type = GL_UNSIGNED_SHORT_5_6_5; + break; + case PICT_b5g6r5: + *tex_format = GL_RGB; + *tex_type = GL_UNSIGNED_SHORT_5_6_5_REV; + break; + case PICT_x1b5g5r5: + *no_alpha = 1; + case PICT_a1b5g5r5: + *tex_format = GL_RGBA; + *tex_type = GL_UNSIGNED_SHORT_1_5_5_5_REV; + break; + + case PICT_x1r5g5b5: + *no_alpha = 1; + case PICT_a1r5g5b5: + *tex_format = GL_BGRA; + *tex_type = GL_UNSIGNED_SHORT_1_5_5_5_REV; + break; + case PICT_a8: + *tex_format = GL_ALPHA; + *tex_type = GL_UNSIGNED_BYTE; + break; + case PICT_x4r4g4b4: + *no_alpha = 1; + case PICT_a4r4g4b4: + *tex_format = GL_BGRA; + *tex_type = GL_UNSIGNED_SHORT_4_4_4_4_REV; + break; + + case PICT_x4b4g4r4: + *no_alpha = 1; + case PICT_a4b4g4r4: + *tex_format = GL_RGBA; + *tex_type = GL_UNSIGNED_SHORT_4_4_4_4_REV; + break; + + default: + LogMessageVerb(X_INFO, 0, + "fail to get matched format for %x \n", format); + return -1; + } + return 0; +} + +#define IS_LITTLE_ENDIAN (IMAGE_BYTE_ORDER == LSBFirst) + +static int +glamor_get_tex_format_type_from_pictformat_gles2(PictFormatShort format, + GLenum *tex_format, + GLenum *tex_type, + int *no_alpha, + int *revert, + int *swap_rb, int is_upload) +{ + int need_swap_rb = 0; + + *no_alpha = 0; + *revert = IS_LITTLE_ENDIAN ? REVERT_NONE : REVERT_NORMAL; + + switch (format) { + case PICT_b8g8r8x8: + *no_alpha = 1; + case PICT_b8g8r8a8: + *tex_format = GL_RGBA; + *tex_type = GL_UNSIGNED_BYTE; + need_swap_rb = 1; + *revert = IS_LITTLE_ENDIAN ? REVERT_NORMAL : REVERT_NONE; + break; + + case PICT_x8r8g8b8: + *no_alpha = 1; + case PICT_a8r8g8b8: + *tex_format = GL_RGBA; + *tex_type = GL_UNSIGNED_BYTE; + need_swap_rb = 1; + break; + + case PICT_x8b8g8r8: + *no_alpha = 1; + case PICT_a8b8g8r8: + *tex_format = GL_RGBA; + *tex_type = GL_UNSIGNED_BYTE; + break; + + case PICT_x2r10g10b10: + *no_alpha = 1; + case PICT_a2r10g10b10: + *tex_format = GL_RGBA; + /* glReadPixmap doesn't support GL_UNSIGNED_INT_10_10_10_2. + * we have to use GL_UNSIGNED_BYTE and do the conversion in + * shader latter.*/ + *tex_type = GL_UNSIGNED_BYTE; + if (is_upload == 1) { + if (!IS_LITTLE_ENDIAN) + *revert = REVERT_UPLOADING_10_10_10_2; + else + *revert = REVERT_UPLOADING_2_10_10_10; + } + else { + if (!IS_LITTLE_ENDIAN) { + *revert = REVERT_DOWNLOADING_10_10_10_2; + } + else { + *revert = REVERT_DOWNLOADING_2_10_10_10; + } + } + need_swap_rb = 1; + + break; + + case PICT_x2b10g10r10: + *no_alpha = 1; + case PICT_a2b10g10r10: + *tex_format = GL_RGBA; + *tex_type = GL_UNSIGNED_BYTE; + if (is_upload == 1) { + if (!IS_LITTLE_ENDIAN) + *revert = REVERT_UPLOADING_10_10_10_2; + else + *revert = REVERT_UPLOADING_2_10_10_10; + } + else { + if (!IS_LITTLE_ENDIAN) { + *revert = REVERT_DOWNLOADING_10_10_10_2; + } + else { + *revert = REVERT_DOWNLOADING_2_10_10_10; + } + } + break; + + case PICT_r5g6b5: + *tex_format = GL_RGB; + *tex_type = GL_UNSIGNED_SHORT_5_6_5; + *revert = IS_LITTLE_ENDIAN ? REVERT_NONE : REVERT_NORMAL; + + break; + + case PICT_b5g6r5: + *tex_format = GL_RGB; + *tex_type = GL_UNSIGNED_SHORT_5_6_5; + need_swap_rb = IS_LITTLE_ENDIAN ? 1 : 0;; + break; + + case PICT_x1b5g5r5: + *no_alpha = 1; + case PICT_a1b5g5r5: + *tex_format = GL_RGBA; + *tex_type = GL_UNSIGNED_SHORT_5_5_5_1; + if (IS_LITTLE_ENDIAN) { + *revert = + is_upload ? REVERT_UPLOADING_1_5_5_5 : + REVERT_DOWNLOADING_1_5_5_5; + } + else + *revert = REVERT_NONE; + break; + + case PICT_x1r5g5b5: + *no_alpha = 1; + case PICT_a1r5g5b5: + *tex_format = GL_RGBA; + *tex_type = GL_UNSIGNED_SHORT_5_5_5_1; + if (IS_LITTLE_ENDIAN) { + *revert = + is_upload ? REVERT_UPLOADING_1_5_5_5 : + REVERT_DOWNLOADING_1_5_5_5; + } + else + *revert = REVERT_NONE; + need_swap_rb = 1; + break; + + case PICT_a1: + *tex_format = GL_ALPHA; + *tex_type = GL_UNSIGNED_BYTE; + *revert = is_upload ? REVERT_UPLOADING_A1 : REVERT_DOWNLOADING_A1; + break; + + case PICT_a8: + *tex_format = GL_ALPHA; + *tex_type = GL_UNSIGNED_BYTE; + *revert = REVERT_NONE; + break; + + case PICT_x4r4g4b4: + *no_alpha = 1; + case PICT_a4r4g4b4: + *tex_format = GL_RGBA; + *tex_type = GL_UNSIGNED_SHORT_4_4_4_4; + *revert = IS_LITTLE_ENDIAN ? REVERT_NORMAL : REVERT_NONE; + need_swap_rb = 1; + break; + + case PICT_x4b4g4r4: + *no_alpha = 1; + case PICT_a4b4g4r4: + *tex_format = GL_RGBA; + *tex_type = GL_UNSIGNED_SHORT_4_4_4_4; + *revert = IS_LITTLE_ENDIAN ? REVERT_NORMAL : REVERT_NONE; + break; + + default: + LogMessageVerb(X_INFO, 0, + "fail to get matched format for %x \n", format); + return -1; + } + + if (need_swap_rb) + *swap_rb = is_upload ? SWAP_UPLOADING : SWAP_DOWNLOADING; + else + *swap_rb = is_upload ? SWAP_NONE_UPLOADING : SWAP_NONE_DOWNLOADING; + return 0; +} + +static int +glamor_get_tex_format_type_from_pixmap(PixmapPtr pixmap, + GLenum *format, + GLenum *type, + int *no_alpha, + int *revert, int *swap_rb, int is_upload) +{ + glamor_pixmap_private *pixmap_priv; + PictFormatShort pict_format; + glamor_screen_private *glamor_priv = + glamor_get_screen_private(pixmap->drawable.pScreen); + + pixmap_priv = glamor_get_pixmap_private(pixmap); + if (GLAMOR_PIXMAP_PRIV_IS_PICTURE(pixmap_priv)) + pict_format = pixmap_priv->base.picture->format; + else + pict_format = format_for_depth(pixmap->drawable.depth); + + if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) { + return glamor_get_tex_format_type_from_pictformat_gl(pict_format, + format, type, + no_alpha, + revert, + swap_rb, + is_upload); + } else { + return glamor_get_tex_format_type_from_pictformat_gles2(pict_format, + format, type, + no_alpha, + revert, + swap_rb, + is_upload); + } +} + static void * _glamor_color_convert_a1_a8(void *src_bits, void *dst_bits, int w, int h, int stride, int revert) @@ -397,38 +707,35 @@ __glamor_upload_pixmap_to_texture(PixmapPtr pixmap, unsigned int *tex, { glamor_screen_private *glamor_priv = glamor_get_screen_private(pixmap->drawable.pScreen); - glamor_gl_dispatch *dispatch; int non_sub = 0; unsigned int iformat = 0; - dispatch = glamor_get_dispatch(glamor_priv); + glamor_get_context(glamor_priv); if (*tex == 0) { - dispatch->glGenTextures(1, tex); + glGenTextures(1, tex); if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) - gl_iformat_for_depth(pixmap->drawable.depth, &iformat); + iformat = gl_iformat_for_pixmap(pixmap); else iformat = format; non_sub = 1; assert(x == 0 && y == 0); } - dispatch->glBindTexture(GL_TEXTURE_2D, *tex); - dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - dispatch->glPixelStorei(GL_UNPACK_ALIGNMENT, 4); + glBindTexture(GL_TEXTURE_2D, *tex); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glPixelStorei(GL_UNPACK_ALIGNMENT, 4); if (bits == NULL) - dispatch->glBindBuffer(GL_PIXEL_UNPACK_BUFFER, pbo); + glBindBuffer(GL_PIXEL_UNPACK_BUFFER, pbo); if (non_sub) - dispatch->glTexImage2D(GL_TEXTURE_2D, - 0, iformat, w, h, 0, format, type, bits); + glTexImage2D(GL_TEXTURE_2D, 0, iformat, w, h, 0, format, type, bits); else - dispatch->glTexSubImage2D(GL_TEXTURE_2D, - 0, x, y, w, h, format, type, bits); + glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, w, h, format, type, bits); if (bits == NULL) - dispatch->glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0); - glamor_put_dispatch(glamor_priv); + glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0); + glamor_put_context(glamor_priv); } static Bool @@ -440,7 +747,6 @@ _glamor_upload_bits_to_pixmap_texture(PixmapPtr pixmap, GLenum format, glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap); glamor_screen_private *glamor_priv = glamor_get_screen_private(pixmap->drawable.pScreen); - glamor_gl_dispatch *dispatch; static float vertices[8]; static float texcoords[8] = { 0, 1, @@ -526,42 +832,35 @@ _glamor_upload_bits_to_pixmap_texture(PixmapPtr pixmap, GLenum format, x + w, y + h, glamor_priv->yInverted, vertices); /* Slow path, we need to flip y or wire alpha to 1. */ - dispatch = glamor_get_dispatch(glamor_priv); - dispatch->glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT, - GL_FALSE, 2 * sizeof(float), vertices); - dispatch->glEnableVertexAttribArray(GLAMOR_VERTEX_POS); - dispatch->glVertexAttribPointer(GLAMOR_VERTEX_SOURCE, 2, GL_FLOAT, - GL_FALSE, 2 * sizeof(float), ptexcoords); - dispatch->glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE); + glamor_get_context(glamor_priv); + glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT, + GL_FALSE, 2 * sizeof(float), vertices); + glEnableVertexAttribArray(GLAMOR_VERTEX_POS); + glVertexAttribPointer(GLAMOR_VERTEX_SOURCE, 2, GL_FLOAT, + GL_FALSE, 2 * sizeof(float), ptexcoords); + glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE); glamor_set_destination_pixmap_priv_nc(pixmap_priv); __glamor_upload_pixmap_to_texture(pixmap, &tex, format, type, 0, 0, w, h, bits, pbo); - dispatch->glActiveTexture(GL_TEXTURE0); - dispatch->glBindTexture(GL_TEXTURE_2D, tex); + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D, tex); - dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); -#ifndef GLAMOR_GLES2 - dispatch->glEnable(GL_TEXTURE_2D); -#endif - dispatch->glUseProgram(glamor_priv->finish_access_prog[no_alpha]); - dispatch->glUniform1i(glamor_priv->finish_access_revert[no_alpha], revert); - dispatch->glUniform1i(glamor_priv->finish_access_swap_rb[no_alpha], - swap_rb); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glUseProgram(glamor_priv->finish_access_prog[no_alpha]); + glUniform1i(glamor_priv->finish_access_revert[no_alpha], revert); + glUniform1i(glamor_priv->finish_access_swap_rb[no_alpha], swap_rb); - dispatch->glDrawArrays(GL_TRIANGLE_FAN, 0, 4); + glDrawArrays(GL_TRIANGLE_FAN, 0, 4); -#ifndef GLAMOR_GLES2 - dispatch->glDisable(GL_TEXTURE_2D); -#endif - dispatch->glUseProgram(0); - dispatch->glDisableVertexAttribArray(GLAMOR_VERTEX_POS); - dispatch->glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE); - dispatch->glDeleteTextures(1, &tex); - dispatch->glBindFramebuffer(GL_FRAMEBUFFER, 0); + glUseProgram(0); + glDisableVertexAttribArray(GLAMOR_VERTEX_POS); + glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE); + glDeleteTextures(1, &tex); + glBindFramebuffer(GL_FRAMEBUFFER, 0); - glamor_put_dispatch(glamor_priv); + glamor_put_context(glamor_priv); if (need_free_bits) free(bits); @@ -615,7 +914,7 @@ glamor_pixmap_upload_prepare(PixmapPtr pixmap, GLenum format, int no_alpha, return 0; if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) - gl_iformat_for_depth(pixmap->drawable.depth, &iformat); + iformat = gl_iformat_for_pixmap(pixmap); else iformat = format; @@ -831,7 +1130,6 @@ glamor_es2_pixmap_read_prepare(PixmapPtr source, int x, int y, int w, int h, glamor_screen_private *glamor_priv; ScreenPtr screen; glamor_pixmap_fbo *temp_fbo; - glamor_gl_dispatch *dispatch; float temp_xscale, temp_yscale, source_xscale, source_yscale; static float vertices[8]; static float texcoords[8]; @@ -844,7 +1142,7 @@ glamor_es2_pixmap_read_prepare(PixmapPtr source, int x, int y, int w, int h, if (temp_fbo == NULL) return NULL; - dispatch = glamor_get_dispatch(glamor_priv); + glamor_get_context(glamor_priv); temp_xscale = 1.0 / w; temp_yscale = 1.0 / h; @@ -852,9 +1150,9 @@ glamor_es2_pixmap_read_prepare(PixmapPtr source, int x, int y, int w, int h, temp_xscale, temp_yscale, 0, 0, w, h, glamor_priv->yInverted, vertices); - dispatch->glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT, - GL_FALSE, 2 * sizeof(float), vertices); - dispatch->glEnableVertexAttribArray(GLAMOR_VERTEX_POS); + glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT, GL_FALSE, + 2 * sizeof(float), vertices); + glEnableVertexAttribArray(GLAMOR_VERTEX_POS); pixmap_priv_get_scale(source_priv, &source_xscale, &source_yscale); glamor_set_normalize_tcoords(source_priv, source_xscale, @@ -863,27 +1161,26 @@ glamor_es2_pixmap_read_prepare(PixmapPtr source, int x, int y, int w, int h, x + w, y + h, glamor_priv->yInverted, texcoords); - dispatch->glVertexAttribPointer(GLAMOR_VERTEX_SOURCE, 2, GL_FLOAT, - GL_FALSE, 2 * sizeof(float), texcoords); - dispatch->glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE); + glVertexAttribPointer(GLAMOR_VERTEX_SOURCE, 2, GL_FLOAT, GL_FALSE, + 2 * sizeof(float), texcoords); + glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE); - dispatch->glActiveTexture(GL_TEXTURE0); - dispatch->glBindTexture(GL_TEXTURE_2D, source_priv->base.fbo->tex); - dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D, source_priv->base.fbo->tex); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glamor_set_destination_pixmap_fbo(temp_fbo, 0, 0, w, h); - dispatch->glUseProgram(glamor_priv->finish_access_prog[no_alpha]); - dispatch->glUniform1i(glamor_priv->finish_access_revert[no_alpha], revert); - dispatch->glUniform1i(glamor_priv->finish_access_swap_rb[no_alpha], - swap_rb); + glUseProgram(glamor_priv->finish_access_prog[no_alpha]); + glUniform1i(glamor_priv->finish_access_revert[no_alpha], revert); + glUniform1i(glamor_priv->finish_access_swap_rb[no_alpha], swap_rb); - dispatch->glDrawArrays(GL_TRIANGLE_FAN, 0, 4); + glDrawArrays(GL_TRIANGLE_FAN, 0, 4); - dispatch->glDisableVertexAttribArray(GLAMOR_VERTEX_POS); - dispatch->glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE); - dispatch->glUseProgram(0); - glamor_put_dispatch(glamor_priv); + glDisableVertexAttribArray(GLAMOR_VERTEX_POS); + glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE); + glUseProgram(0); + glamor_put_context(glamor_priv); return temp_fbo; } @@ -905,7 +1202,6 @@ _glamor_download_sub_pixmap_to_cpu(PixmapPtr pixmap, GLenum format, void *data, *read; glamor_screen_private *glamor_priv = glamor_get_screen_private(pixmap->drawable.pScreen); - glamor_gl_dispatch *dispatch; glamor_pixmap_fbo *temp_fbo = NULL; int need_post_conversion = 0; int need_free_data = 0; @@ -964,57 +1260,53 @@ _glamor_download_sub_pixmap_to_cpu(PixmapPtr pixmap, GLenum format, fbo_y_off = 0; } - dispatch = glamor_get_dispatch(glamor_priv); - dispatch->glPixelStorei(GL_PACK_ALIGNMENT, 4); + glamor_get_context(glamor_priv); + glPixelStorei(GL_PACK_ALIGNMENT, 4); if (glamor_priv->has_pack_invert || glamor_priv->yInverted) { if (!glamor_priv->yInverted) { assert(glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP); - dispatch->glPixelStorei(GL_PACK_INVERT_MESA, 1); + glPixelStorei(GL_PACK_INVERT_MESA, 1); } if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP && data == NULL) { assert(pbo > 0); - dispatch->glBindBuffer(GL_PIXEL_PACK_BUFFER, pbo); - dispatch->glBufferData(GL_PIXEL_PACK_BUFFER, - stride * h, NULL, gl_usage); + glBindBuffer(GL_PIXEL_PACK_BUFFER, pbo); + glBufferData(GL_PIXEL_PACK_BUFFER, stride * h, NULL, gl_usage); } - dispatch->glReadPixels(x + fbo_x_off, y + fbo_y_off, w, h, format, type, - data); + glReadPixels(x + fbo_x_off, y + fbo_y_off, w, h, format, type, data); if (!glamor_priv->yInverted) { assert(glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP); - dispatch->glPixelStorei(GL_PACK_INVERT_MESA, 0); + glPixelStorei(GL_PACK_INVERT_MESA, 0); } if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP && bits == NULL) { - bits = dispatch->glMapBuffer(GL_PIXEL_PACK_BUFFER, gl_access); - dispatch->glBindBuffer(GL_PIXEL_PACK_BUFFER, 0); + bits = glMapBuffer(GL_PIXEL_PACK_BUFFER, gl_access); + glBindBuffer(GL_PIXEL_PACK_BUFFER, 0); } } else { unsigned int temp_pbo; int yy; - dispatch = glamor_get_dispatch(glamor_priv); - dispatch->glGenBuffers(1, &temp_pbo); - dispatch->glBindBuffer(GL_PIXEL_PACK_BUFFER, temp_pbo); - dispatch->glBufferData(GL_PIXEL_PACK_BUFFER, - stride * h, NULL, GL_STREAM_READ); - dispatch->glReadPixels(x + fbo_x_off, y + fbo_y_off, w, h, - format, type, 0); - read = dispatch->glMapBuffer(GL_PIXEL_PACK_BUFFER, GL_READ_ONLY); + glamor_get_context(glamor_priv); + glGenBuffers(1, &temp_pbo); + glBindBuffer(GL_PIXEL_PACK_BUFFER, temp_pbo); + glBufferData(GL_PIXEL_PACK_BUFFER, stride * h, NULL, GL_STREAM_READ); + glReadPixels(x + fbo_x_off, y + fbo_y_off, w, h, format, type, 0); + read = glMapBuffer(GL_PIXEL_PACK_BUFFER, GL_READ_ONLY); for (yy = 0; yy < pixmap->drawable.height; yy++) memcpy((char *) data + yy * stride, (char *) read + (h - yy - 1) * stride, stride); - dispatch->glUnmapBuffer(GL_PIXEL_PACK_BUFFER); - dispatch->glBindBuffer(GL_PIXEL_PACK_BUFFER, 0); - dispatch->glDeleteBuffers(1, &temp_pbo); + glUnmapBuffer(GL_PIXEL_PACK_BUFFER); + glBindBuffer(GL_PIXEL_PACK_BUFFER, 0); + glDeleteBuffers(1, &temp_pbo); } - dispatch->glBindFramebuffer(GL_FRAMEBUFFER, 0); - glamor_put_dispatch(glamor_priv); + glBindFramebuffer(GL_FRAMEBUFFER, 0); + glamor_put_context(glamor_priv); if (need_post_conversion) { /* As OpenGL desktop version never enters here. @@ -1168,7 +1460,6 @@ glamor_download_pixmap_to_cpu(PixmapPtr pixmap, glamor_access_t access) void *data = NULL, *dst; glamor_screen_private *glamor_priv = glamor_get_screen_private(pixmap->drawable.pScreen); - glamor_gl_dispatch *dispatch; int pbo = 0; if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) @@ -1189,10 +1480,10 @@ glamor_download_pixmap_to_cpu(PixmapPtr pixmap, glamor_access_t access) data = malloc(stride * pixmap->drawable.height); } else { - dispatch = glamor_get_dispatch(glamor_priv); + glamor_get_context(glamor_priv); if (pixmap_priv->base.fbo->pbo == 0) - dispatch->glGenBuffers(1, &pixmap_priv->base.fbo->pbo); - glamor_put_dispatch(glamor_priv); + glGenBuffers(1, &pixmap_priv->base.fbo->pbo); + glamor_put_context(glamor_priv); pbo = pixmap_priv->base.fbo->pbo; } diff --git a/xorg-server/glamor/glamor_priv.h b/xorg-server/glamor/glamor_priv.h index dc3873013..fe4b42332 100644 --- a/xorg-server/glamor/glamor_priv.h +++ b/xorg-server/glamor/glamor_priv.h @@ -35,23 +35,19 @@ #endif #include "glamor.h" -#ifdef GLAMOR_GLES2 -#include <GLES2/gl2.h> -#include <GLES2/gl2ext.h> - -#define GLAMOR_DEFAULT_PRECISION "precision mediump float;\n" -#include "glamor_glext.h" -#else -#include <GL/gl.h> -#include <GL/glext.h> -#define GLAMOR_DEFAULT_PRECISION -#endif +#include <epoxy/gl.h> + +#define GLAMOR_DEFAULT_PRECISION \ + "#ifdef GL_ES\n" \ + "precision mediump float;\n" \ + "#endif\n" #ifdef RENDER #include "glyphstr.h" #endif #include "glamor_debug.h" +#include "glamor_context.h" #include <list.h> @@ -145,13 +141,6 @@ enum gradient_shader { SHADER_GRADIENT_COUNT, }; -enum gradient_shader_prog { - SHADER_GRADIENT_VS_PROG, - SHADER_GRADIENT_FS_MAIN_PROG, - SHADER_GRADIENT_FS_GETCOLOR_PROG, - SHADER_GRADIENT_PROG_COUNT, -}; - struct glamor_screen_private; struct glamor_pixmap_private; @@ -178,8 +167,6 @@ typedef struct { uint16_t evict; } glamor_glyph_cache_t; -#include "glamor_gl_dispatch.h" - struct glamor_saved_procs { CloseScreenProcPtr close_screen; CreateGCProcPtr create_gc; @@ -202,11 +189,7 @@ struct glamor_saved_procs { SetWindowPixmapProcPtr set_window_pixmap; }; -#ifdef GLAMOR_GLES2 #define CACHE_FORMAT_COUNT 3 -#else -#define CACHE_FORMAT_COUNT 2 -#endif #define CACHE_BUCKET_WCOUNT 4 #define CACHE_BUCKET_HCOUNT 4 @@ -220,8 +203,7 @@ struct glamor_saved_procs { #define RENDER_IDEL_MAX 32 typedef struct glamor_screen_private { - struct glamor_gl_dispatch _dispatch; - int yInverted; + Bool yInverted; unsigned int tick; enum glamor_gl_flavor gl_flavor; int has_pack_invert; @@ -262,9 +244,7 @@ typedef struct glamor_screen_private { /* glamor gradient, 0 for small nstops, 1 for large nstops and 2 for dynamic generate. */ GLint gradient_prog[SHADER_GRADIENT_COUNT][3]; - GLint linear_gradient_shaders[SHADER_GRADIENT_PROG_COUNT][3]; int linear_max_nstops; - GLint radial_gradient_shaders[SHADER_GRADIENT_PROG_COUNT][3]; int radial_max_nstops; /* glamor trapezoid shader. */ @@ -288,6 +268,8 @@ typedef struct glamor_screen_private { /* xv */ GLint xv_prog; + + struct glamor_context ctx; } glamor_screen_private; typedef enum glamor_access { @@ -583,9 +565,8 @@ Bool glamor_stipple(PixmapPtr pixmap, PixmapPtr stipple, unsigned char alu, unsigned long planemask, unsigned long fg_pixel, unsigned long bg_pixel, int stipple_x, int stipple_y); -GLint glamor_compile_glsl_prog(glamor_gl_dispatch *dispatch, GLenum type, - const char *source); -void glamor_link_glsl_prog(glamor_gl_dispatch *dispatch, GLint prog); +GLint glamor_compile_glsl_prog(GLenum type, const char *source); +void glamor_link_glsl_prog(GLint prog); void glamor_get_color_4f_from_pixel(PixmapPtr pixmap, unsigned long fg_pixel, GLfloat *color); @@ -604,7 +585,7 @@ glamor_pixmap_fbo *glamor_es2_pixmap_read_prepare(PixmapPtr source, int x, int no_alpha, int revert, int swap_rb); -Bool glamor_set_alu(struct glamor_gl_dispatch *dispatch, unsigned char alu); +Bool glamor_set_alu(ScreenPtr screen, unsigned char alu); Bool glamor_set_planemask(PixmapPtr pixmap, unsigned long planemask); Bool glamor_change_window_attributes(WindowPtr pWin, unsigned long mask); RegionPtr glamor_bitmap_to_region(PixmapPtr pixmap); @@ -935,6 +916,9 @@ void glamor_composite_rectangles(CARD8 op, xRenderColor *color, int num_rects, xRectangle *rects); +extern _X_EXPORT void glamor_egl_screen_init(ScreenPtr screen, + struct glamor_context *glamor_ctx); + /* glamor_xv */ typedef struct { uint32_t transform_index; diff --git a/xorg-server/glamor/glamor_putimage.c b/xorg-server/glamor/glamor_putimage.c index 6b25bec84..702e89f14 100644 --- a/xorg-server/glamor/glamor_putimage.c +++ b/xorg-server/glamor/glamor_putimage.c @@ -67,27 +67,26 @@ glamor_init_putimage_shaders(ScreenPtr screen) if (!GLEW_ARB_fragment_shader) return; - prog = dispatch->glCreateProgram(); + prog = glCreateProgram(); vs_prog = glamor_compile_glsl_prog(GL_VERTEX_SHADER, xybitmap_vs); fs_prog = glamor_compile_glsl_prog(GL_FRAGMENT_SHADER, xybitmap_fs); - dispatch->glAttachShader(prog, vs_prog); - dispatch->glAttachShader(prog, fs_prog); + glAttachShader(prog, vs_prog); + glAttachShader(prog, fs_prog); glamor_link_glsl_prog(prog); - dispatch->glUseProgram(prog); - sampler_uniform_location = - dispatch->glGetUniformLocation(prog, "bitmap_sampler"); - dispatch->glUniform1i(sampler_uniform_location, 0); + glUseProgram(prog); + sampler_uniform_location = glGetUniformLocation(prog, "bitmap_sampler"); + glUniform1i(sampler_uniform_location, 0); glamor_priv->put_image_xybitmap_fg_uniform_location = - dispatch->glGetUniformLocation(prog, "fg"); + glGetUniformLocation(prog, "fg"); glamor_priv->put_image_xybitmap_bg_uniform_location = - dispatch->glGetUniformLocation(prog, "bg"); + glGetUniformLocation(prog, "bg"); glamor_get_transform_uniform_locations(prog, &glamor_priv-> put_image_xybitmap_transform); glamor_priv->put_image_xybitmap_prog = prog; - dispatch->glUseProgram(0); + glUseProgram(0); #endif } @@ -162,40 +161,37 @@ glamor_put_image_xybitmap(DrawablePtr drawable, GCPtr gc, if (!glamor_set_planemask(pixmap, gc->planemask)) goto fail; - dispatch->glUseProgram(glamor_priv->put_image_xybitmap_prog); + glUseProgram(glamor_priv->put_image_xybitmap_prog); glamor_get_color_4f_from_pixel(pixmap, gc->fgPixel, fg); - dispatch->glUniform4fv - (glamor_priv->put_image_xybitmap_fg_uniform_location, 1, fg); + glUniform4fv(glamor_priv->put_image_xybitmap_fg_uniform_location, 1, fg); glamor_get_color_4f_from_pixel(pixmap, gc->bgPixel, bg); - dispatch->glUniform4fv - (glamor_priv->put_image_xybitmap_bg_uniform_location, 1, bg); - - dispatch->glGenTextures(1, &tex); - dispatch->glActiveTexture(GL_TEXTURE0); - dispatch->glEnable(GL_TEXTURE_2D); - dispatch->glBindTexture(GL_TEXTURE_2D, tex); - dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - dispatch->glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - dispatch->glPixelStorei(GL_UNPACK_ROW_LENGTH, stride * 8); - dispatch->glPixelStorei(GL_UNPACK_SKIP_PIXELS, left_pad); - dispatch->glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, - w, h, 0, GL_COLOR_INDEX, GL_BITMAP, bits); - dispatch->glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); - dispatch->glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0); + glUniform4fv(glamor_priv->put_image_xybitmap_bg_uniform_location, 1, bg); + + glGenTextures(1, &tex); + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D, tex); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + glPixelStorei(GL_UNPACK_ROW_LENGTH, stride * 8); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, left_pad); + glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, + w, h, 0, GL_COLOR_INDEX, GL_BITMAP, bits); + glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0); /* Now that we've set up our bitmap texture and the shader, shove * the destination rectangle through the cliprects and run the * shader on the resulting fragments. */ - dispatch->glVertexPointer(2, GL_FLOAT, 0, dest_coords); - dispatch->glEnableClientState(GL_VERTEX_ARRAY); - dispatch->glClientActiveTexture(GL_TEXTURE0); - dispatch->glTexCoordPointer(2, GL_FLOAT, 0, bitmap_coords); - dispatch->glEnableClientState(GL_TEXTURE_COORD_ARRAY); + glVertexPointer(2, GL_FLOAT, 0, dest_coords); + glEnableClientState(GL_VERTEX_ARRAY); + glClientActiveTexture(GL_TEXTURE0); + glTexCoordPointer(2, GL_FLOAT, 0, bitmap_coords); + glEnableClientState(GL_TEXTURE_COORD_ARRAY); - dispatch->glEnable(GL_SCISSOR_TEST); + glEnable(GL_SCISSOR_TEST); clip = fbGetCompositeClip(gc); for (nbox = REGION_NUM_RECTS(clip), box = REGION_RECTS(clip); nbox--; box++) { int x1 = x; @@ -214,19 +210,17 @@ glamor_put_image_xybitmap(DrawablePtr drawable, GCPtr gc, if (x1 >= x2 || y1 >= y2) continue; - dispatch->glScissor(box->x1, - y_flip(pixmap, box->y1), - box->x2 - box->x1, box->y2 - box->y1); - dispatch->glDrawArrays(GL_QUADS, 0, 4); + glScissor(box->x1, y_flip(pixmap, box->y1), + box->x2 - box->x1, box->y2 - box->y1); + glDrawArrays(GL_QUADS, 0, 4); } - dispatch->glDisable(GL_SCISSOR_TEST); + glDisable(GL_SCISSOR_TEST); glamor_set_alu(GXcopy); glamor_set_planemask(pixmap, ~0); - dispatch->glDeleteTextures(1, &tex); - dispatch->glDisable(GL_TEXTURE_2D); - dispatch->glDisableClientState(GL_VERTEX_ARRAY); - dispatch->glDisableClientState(GL_TEXTURE_COORD_ARRAY); + glDeleteTextures(1, &tex); + glDisableClientState(GL_VERTEX_ARRAY); + glDisableClientState(GL_TEXTURE_COORD_ARRAY); return; glamor_set_alu(GXcopy); glamor_set_planemask(pixmap, ~0); diff --git a/xorg-server/glamor/glamor_render.c b/xorg-server/glamor/glamor_render.c index 4a3a97ccd..093a2151d 100644 --- a/xorg-server/glamor/glamor_render.c +++ b/xorg-server/glamor/glamor_render.c @@ -62,8 +62,7 @@ static struct blendinfo composite_op_info[] = { #define RepeatFix 10 static GLuint -glamor_create_composite_fs(glamor_gl_dispatch *dispatch, - struct shader_key *key) +glamor_create_composite_fs(struct shader_key *key) { const char *repeat_define = "#define RepeatNone 0\n" @@ -266,15 +265,14 @@ glamor_create_composite_fs(glamor_gl_dispatch *dispatch, XNFasprintf(&source, "%s%s%s%s%s%s", repeat_define, relocate_texture, rel_sampler, source_fetch, mask_fetch, in); - prog = glamor_compile_glsl_prog(dispatch, GL_FRAGMENT_SHADER, source); + prog = glamor_compile_glsl_prog(GL_FRAGMENT_SHADER, source); free(source); return prog; } static GLuint -glamor_create_composite_vs(glamor_gl_dispatch *dispatch, - struct shader_key *key) +glamor_create_composite_vs(struct shader_key *key) { const char *main_opening = "attribute vec4 v_position;\n" @@ -304,7 +302,7 @@ glamor_create_composite_vs(glamor_gl_dispatch *dispatch, main_opening, source_coords_setup, mask_coords_setup, main_closing); - prog = glamor_compile_glsl_prog(dispatch, GL_VERTEX_SHADER, source); + prog = glamor_compile_glsl_prog(GL_VERTEX_SHADER, source); free(source); return prog; @@ -317,60 +315,57 @@ glamor_create_composite_shader(ScreenPtr screen, struct shader_key *key, GLuint vs, fs, prog; GLint source_sampler_uniform_location, mask_sampler_uniform_location; glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); - glamor_gl_dispatch *dispatch; - dispatch = glamor_get_dispatch(glamor_priv); - vs = glamor_create_composite_vs(dispatch, key); + glamor_get_context(glamor_priv); + vs = glamor_create_composite_vs(key); if (vs == 0) goto out; - fs = glamor_create_composite_fs(dispatch, key); + fs = glamor_create_composite_fs(key); if (fs == 0) goto out; - prog = dispatch->glCreateProgram(); - dispatch->glAttachShader(prog, vs); - dispatch->glAttachShader(prog, fs); + prog = glCreateProgram(); + glAttachShader(prog, vs); + glAttachShader(prog, fs); - dispatch->glBindAttribLocation(prog, GLAMOR_VERTEX_POS, "v_position"); - dispatch->glBindAttribLocation(prog, GLAMOR_VERTEX_SOURCE, "v_texcoord0"); - dispatch->glBindAttribLocation(prog, GLAMOR_VERTEX_MASK, "v_texcoord1"); + glBindAttribLocation(prog, GLAMOR_VERTEX_POS, "v_position"); + glBindAttribLocation(prog, GLAMOR_VERTEX_SOURCE, "v_texcoord0"); + glBindAttribLocation(prog, GLAMOR_VERTEX_MASK, "v_texcoord1"); - glamor_link_glsl_prog(dispatch, prog); + glamor_link_glsl_prog(prog); shader->prog = prog; - dispatch->glUseProgram(prog); + glUseProgram(prog); if (key->source == SHADER_SOURCE_SOLID) { - shader->source_uniform_location = - dispatch->glGetUniformLocation(prog, "source"); + shader->source_uniform_location = glGetUniformLocation(prog, "source"); } else { source_sampler_uniform_location = - dispatch->glGetUniformLocation(prog, "source_sampler"); - dispatch->glUniform1i(source_sampler_uniform_location, 0); - shader->source_wh = dispatch->glGetUniformLocation(prog, "source_wh"); + glGetUniformLocation(prog, "source_sampler"); + glUniform1i(source_sampler_uniform_location, 0); + shader->source_wh = glGetUniformLocation(prog, "source_wh"); shader->source_repeat_mode = - dispatch->glGetUniformLocation(prog, "source_repeat_mode"); + glGetUniformLocation(prog, "source_repeat_mode"); } if (key->mask != SHADER_MASK_NONE) { if (key->mask == SHADER_MASK_SOLID) { - shader->mask_uniform_location = - dispatch->glGetUniformLocation(prog, "mask"); + shader->mask_uniform_location = glGetUniformLocation(prog, "mask"); } else { mask_sampler_uniform_location = - dispatch->glGetUniformLocation(prog, "mask_sampler"); - dispatch->glUniform1i(mask_sampler_uniform_location, 1); - shader->mask_wh = dispatch->glGetUniformLocation(prog, "mask_wh"); + glGetUniformLocation(prog, "mask_sampler"); + glUniform1i(mask_sampler_uniform_location, 1); + shader->mask_wh = glGetUniformLocation(prog, "mask_wh"); shader->mask_repeat_mode = - dispatch->glGetUniformLocation(prog, "mask_repeat_mode"); + glGetUniformLocation(prog, "mask_repeat_mode"); } } out: - glamor_put_dispatch(glamor_priv); + glamor_put_context(glamor_priv); } static glamor_composite_shader * @@ -407,23 +402,21 @@ void glamor_init_composite_shaders(ScreenPtr screen) { glamor_screen_private *glamor_priv; - glamor_gl_dispatch *dispatch; unsigned short *eb; float *vb = NULL; int eb_size; glamor_priv = glamor_get_screen_private(screen); - dispatch = glamor_get_dispatch(glamor_priv); - dispatch->glGenBuffers(1, &glamor_priv->vbo); - dispatch->glGenBuffers(1, &glamor_priv->ebo); - dispatch->glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, glamor_priv->ebo); + glamor_get_context(glamor_priv); + glGenBuffers(1, &glamor_priv->vbo); + glGenBuffers(1, &glamor_priv->ebo); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, glamor_priv->ebo); eb_size = GLAMOR_COMPOSITE_VBO_VERT_CNT * sizeof(short) * 2; if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) { - dispatch->glBufferData(GL_ELEMENT_ARRAY_BUFFER, - eb_size, NULL, GL_STATIC_DRAW); - eb = dispatch->glMapBuffer(GL_ELEMENT_ARRAY_BUFFER, GL_WRITE_ONLY); + glBufferData(GL_ELEMENT_ARRAY_BUFFER, eb_size, NULL, GL_STATIC_DRAW); + eb = glMapBuffer(GL_ELEMENT_ARRAY_BUFFER, GL_WRITE_ONLY); } else { vb = malloc(GLAMOR_COMPOSITE_VBO_VERT_CNT * sizeof(float) * 2); @@ -438,51 +431,49 @@ glamor_init_composite_shaders(ScreenPtr screen) glamor_init_eb(eb, GLAMOR_COMPOSITE_VBO_VERT_CNT); if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) { - dispatch->glUnmapBuffer(GL_ELEMENT_ARRAY_BUFFER); - dispatch->glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); + glUnmapBuffer(GL_ELEMENT_ARRAY_BUFFER); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); } else { - dispatch->glBufferData(GL_ELEMENT_ARRAY_BUFFER, - eb_size, eb, GL_STATIC_DRAW); - dispatch->glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); + glBufferData(GL_ELEMENT_ARRAY_BUFFER, eb_size, eb, GL_STATIC_DRAW); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); - dispatch->glBindBuffer(GL_ARRAY_BUFFER, glamor_priv->vbo); - dispatch->glBufferData(GL_ARRAY_BUFFER, - GLAMOR_COMPOSITE_VBO_VERT_CNT * sizeof(float) * - 2, NULL, GL_DYNAMIC_DRAW); - dispatch->glBindBuffer(GL_ARRAY_BUFFER, 0); + glBindBuffer(GL_ARRAY_BUFFER, glamor_priv->vbo); + glBufferData(GL_ARRAY_BUFFER, + GLAMOR_COMPOSITE_VBO_VERT_CNT * sizeof(float) * + 2, NULL, GL_DYNAMIC_DRAW); + glBindBuffer(GL_ARRAY_BUFFER, 0); free(eb); glamor_priv->vb = (char *) vb; } - glamor_put_dispatch(glamor_priv); + glamor_put_context(glamor_priv); } void glamor_fini_composite_shaders(ScreenPtr screen) { glamor_screen_private *glamor_priv; - glamor_gl_dispatch *dispatch; glamor_composite_shader *shader; int i, j, k; glamor_priv = glamor_get_screen_private(screen); - dispatch = glamor_get_dispatch(glamor_priv); - dispatch->glDeleteBuffers(1, &glamor_priv->vbo); - dispatch->glDeleteBuffers(1, &glamor_priv->ebo); + glamor_get_context(glamor_priv); + glDeleteBuffers(1, &glamor_priv->vbo); + glDeleteBuffers(1, &glamor_priv->ebo); for (i = 0; i < SHADER_SOURCE_COUNT; i++) for (j = 0; j < SHADER_MASK_COUNT; j++) for (k = 0; k < SHADER_IN_COUNT; k++) { shader = &glamor_priv->composite_shader[i][j][k]; if (shader->prog) - dispatch->glDeleteProgram(shader->prog); + glDeleteProgram(shader->prog); } if (glamor_priv->gl_flavor != GLAMOR_GL_DESKTOP && glamor_priv->vb) free(glamor_priv->vb); - glamor_put_dispatch(glamor_priv); + glamor_put_context(glamor_priv); } static Bool @@ -535,44 +526,37 @@ glamor_set_composite_texture(glamor_screen_private *glamor_priv, int unit, glamor_pixmap_private *pixmap_priv, GLuint wh_location, GLuint repeat_location) { - glamor_gl_dispatch *dispatch; float wh[4]; int repeat_type; - dispatch = glamor_get_dispatch(glamor_priv); - dispatch->glActiveTexture(GL_TEXTURE0 + unit); - dispatch->glBindTexture(GL_TEXTURE_2D, pixmap_priv->base.fbo->tex); + glamor_get_context(glamor_priv); + glActiveTexture(GL_TEXTURE0 + unit); + glBindTexture(GL_TEXTURE_2D, pixmap_priv->base.fbo->tex); repeat_type = picture->repeatType; switch (picture->repeatType) { case RepeatNone: -#ifndef GLAMOR_GLES2 - /* XXX GLES2 doesn't support GL_CLAMP_TO_BORDER. */ - dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, - GL_CLAMP_TO_BORDER); - dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, - GL_CLAMP_TO_BORDER); -#else - dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, - GL_CLAMP_TO_EDGE); - dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, - GL_CLAMP_TO_EDGE); -#endif + if (glamor_priv->gl_flavor != GLAMOR_GL_ES2) { + /* XXX GLES2 doesn't support GL_CLAMP_TO_BORDER. */ + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, + GL_CLAMP_TO_BORDER); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, + GL_CLAMP_TO_BORDER); + } else { + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + } break; case RepeatNormal: - dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); - dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); break; case RepeatPad: - dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, - GL_CLAMP_TO_EDGE); - dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, - GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); break; case RepeatReflect: - dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, - GL_MIRRORED_REPEAT); - dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, - GL_MIRRORED_REPEAT); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_MIRRORED_REPEAT); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_MIRRORED_REPEAT); break; } @@ -580,23 +564,16 @@ glamor_set_composite_texture(glamor_screen_private *glamor_priv, int unit, default: case PictFilterFast: case PictFilterNearest: - dispatch->glTexParameteri(GL_TEXTURE_2D, - GL_TEXTURE_MIN_FILTER, GL_NEAREST); - dispatch->glTexParameteri(GL_TEXTURE_2D, - GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); break; case PictFilterGood: case PictFilterBest: case PictFilterBilinear: - dispatch->glTexParameteri(GL_TEXTURE_2D, - GL_TEXTURE_MIN_FILTER, GL_LINEAR); - dispatch->glTexParameteri(GL_TEXTURE_2D, - GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); break; } -#ifndef GLAMOR_GLES2 - dispatch->glEnable(GL_TEXTURE_2D); -#endif /* * GLES2 doesn't support RepeatNone. We need to fix it anyway. @@ -615,19 +592,18 @@ glamor_set_composite_texture(glamor_screen_private *glamor_priv, int unit, if ((wh[0] != 1.0 || wh[1] != 1.0) || (glamor_priv->gl_flavor == GLAMOR_GL_ES2 && repeat_type == RepeatFix)) - dispatch->glUniform4fv(wh_location, 1, wh); + glUniform4fv(wh_location, 1, wh); else repeat_type -= RepeatFix; } - dispatch->glUniform1i(repeat_location, repeat_type); - glamor_put_dispatch(glamor_priv); + glUniform1i(repeat_location, repeat_type); + glamor_put_context(glamor_priv); } static void -glamor_set_composite_solid(glamor_gl_dispatch *dispatch, float *color, - GLint uniform_location) +glamor_set_composite_solid(float *color, GLint uniform_location) { - dispatch->glUniform4fv(uniform_location, 1, color); + glUniform4fv(uniform_location, 1, color); } static int @@ -729,7 +705,6 @@ void glamor_setup_composite_vbo(ScreenPtr screen, int n_verts) { glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); - glamor_gl_dispatch *dispatch; int vert_size; glamor_priv->render_nr_verts = 0; @@ -741,65 +716,54 @@ glamor_setup_composite_vbo(ScreenPtr screen, int n_verts) vert_size = n_verts * glamor_priv->vb_stride; - dispatch = glamor_get_dispatch(glamor_priv); - dispatch->glBindBuffer(GL_ARRAY_BUFFER, glamor_priv->vbo); + glamor_get_context(glamor_priv); + glBindBuffer(GL_ARRAY_BUFFER, glamor_priv->vbo); if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) { if (glamor_priv->vbo_size < (glamor_priv->vbo_offset + vert_size)) { glamor_priv->vbo_size = GLAMOR_COMPOSITE_VBO_VERT_CNT * glamor_priv->vb_stride; glamor_priv->vbo_offset = 0; - dispatch->glBufferData(GL_ARRAY_BUFFER, - glamor_priv->vbo_size, NULL, GL_STREAM_DRAW); + glBufferData(GL_ARRAY_BUFFER, + glamor_priv->vbo_size, NULL, GL_STREAM_DRAW); } - glamor_priv->vb = dispatch->glMapBufferRange(GL_ARRAY_BUFFER, - glamor_priv->vbo_offset, - vert_size, - GL_MAP_WRITE_BIT | - GL_MAP_UNSYNCHRONIZED_BIT); + glamor_priv->vb = glMapBufferRange(GL_ARRAY_BUFFER, + glamor_priv->vbo_offset, + vert_size, + GL_MAP_WRITE_BIT | + GL_MAP_UNSYNCHRONIZED_BIT); assert(glamor_priv->vb != NULL); glamor_priv->vb -= glamor_priv->vbo_offset; } else glamor_priv->vbo_offset = 0; - dispatch->glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, glamor_priv->ebo); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, glamor_priv->ebo); - dispatch->glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT, - GL_FALSE, glamor_priv->vb_stride, - (void *) ((long) - glamor_priv->vbo_offset)); - dispatch->glEnableVertexAttribArray(GLAMOR_VERTEX_POS); + glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT, GL_FALSE, + glamor_priv->vb_stride, + (void *) ((long) + glamor_priv->vbo_offset)); + glEnableVertexAttribArray(GLAMOR_VERTEX_POS); if (glamor_priv->has_source_coords) { - dispatch->glVertexAttribPointer(GLAMOR_VERTEX_SOURCE, 2, - GL_FLOAT, GL_FALSE, - glamor_priv->vb_stride, (void *) ((long) - glamor_priv-> - vbo_offset - + - 2 * - sizeof - (float))); - dispatch->glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE); + glVertexAttribPointer(GLAMOR_VERTEX_SOURCE, 2, + GL_FLOAT, GL_FALSE, + glamor_priv->vb_stride, + (void *) ((long) glamor_priv->vbo_offset + + 2 * sizeof(float))); + glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE); } if (glamor_priv->has_mask_coords) { - dispatch->glVertexAttribPointer(GLAMOR_VERTEX_MASK, 2, - GL_FLOAT, GL_FALSE, - glamor_priv->vb_stride, (void *) ((long) - glamor_priv-> - vbo_offset - + - (glamor_priv-> - has_source_coords - ? 4 : - 2) * - sizeof - (float))); - dispatch->glEnableVertexAttribArray(GLAMOR_VERTEX_MASK); - } - glamor_put_dispatch(glamor_priv); + glVertexAttribPointer(GLAMOR_VERTEX_MASK, 2, GL_FLOAT, GL_FALSE, + glamor_priv->vb_stride, + (void *) ((long) glamor_priv->vbo_offset + + (glamor_priv->has_source_coords ? + 4 : 2) * sizeof(float))); + glEnableVertexAttribArray(GLAMOR_VERTEX_MASK); + } + glamor_put_context(glamor_priv); } void @@ -831,32 +795,29 @@ static void glamor_flush_composite_rects(ScreenPtr screen) { glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); - glamor_gl_dispatch *dispatch; - dispatch = glamor_get_dispatch(glamor_priv); + glamor_get_context(glamor_priv); if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) - dispatch->glUnmapBuffer(GL_ARRAY_BUFFER); + glUnmapBuffer(GL_ARRAY_BUFFER); else { - dispatch->glBindBuffer(GL_ARRAY_BUFFER, glamor_priv->vbo); - dispatch->glBufferData(GL_ARRAY_BUFFER, - glamor_priv->vbo_offset, - glamor_priv->vb, GL_DYNAMIC_DRAW); + glBindBuffer(GL_ARRAY_BUFFER, glamor_priv->vbo); + glBufferData(GL_ARRAY_BUFFER, glamor_priv->vbo_offset, + glamor_priv->vb, GL_DYNAMIC_DRAW); } if (!glamor_priv->render_nr_verts) return; -#ifndef GLAMOR_GLES2 - dispatch->glDrawRangeElements(GL_TRIANGLES, 0, glamor_priv->render_nr_verts, - (glamor_priv->render_nr_verts * 3) / 2, - GL_UNSIGNED_SHORT, NULL); -#else - dispatch->glDrawElements(GL_TRIANGLES, - (glamor_priv->render_nr_verts * 3) / 2, - GL_UNSIGNED_SHORT, NULL); -#endif - glamor_put_dispatch(glamor_priv); + if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) { + glDrawRangeElements(GL_TRIANGLES, 0, glamor_priv->render_nr_verts, + (glamor_priv->render_nr_verts * 3) / 2, + GL_UNSIGNED_SHORT, NULL); + } else { + glDrawElements(GL_TRIANGLES, (glamor_priv->render_nr_verts * 3) / 2, + GL_UNSIGNED_SHORT, NULL); + } + glamor_put_context(glamor_priv); } int pict_format_combine_tab[][3] = { @@ -1228,17 +1189,15 @@ glamor_composite_set_shader_blend(glamor_pixmap_private *dest_priv, glamor_composite_shader *shader, struct blendinfo *op_info) { - glamor_gl_dispatch *dispatch; glamor_screen_private *glamor_priv; glamor_priv = dest_priv->base.glamor_priv; - dispatch = glamor_get_dispatch(glamor_priv); - dispatch->glUseProgram(shader->prog); + glamor_get_context(glamor_priv); + glUseProgram(shader->prog); if (key->source == SHADER_SOURCE_SOLID) { - glamor_set_composite_solid(dispatch, - shader->source_solid_color, + glamor_set_composite_solid(shader->source_solid_color, shader->source_uniform_location); } else { @@ -1250,8 +1209,7 @@ glamor_composite_set_shader_blend(glamor_pixmap_private *dest_priv, if (key->mask != SHADER_MASK_NONE) { if (key->mask == SHADER_MASK_SOLID) { - glamor_set_composite_solid(dispatch, - shader->mask_solid_color, + glamor_set_composite_solid(shader->mask_solid_color, shader->mask_uniform_location); } else { @@ -1263,14 +1221,14 @@ glamor_composite_set_shader_blend(glamor_pixmap_private *dest_priv, } if (op_info->source_blend == GL_ONE && op_info->dest_blend == GL_ZERO) { - dispatch->glDisable(GL_BLEND); + glDisable(GL_BLEND); } else { - dispatch->glEnable(GL_BLEND); - dispatch->glBlendFunc(op_info->source_blend, op_info->dest_blend); + glEnable(GL_BLEND); + glBlendFunc(op_info->source_blend, op_info->dest_blend); } - glamor_put_dispatch(glamor_priv); + glamor_put_context(glamor_priv); } static Bool @@ -1289,7 +1247,6 @@ glamor_composite_with_shader(CARD8 op, PixmapPtr dest_pixmap = dest_pixmap_priv->base.pixmap; PixmapPtr source_pixmap = NULL; PixmapPtr mask_pixmap = NULL; - glamor_gl_dispatch *dispatch = NULL; GLfloat dst_xscale, dst_yscale; GLfloat mask_xscale = 1, mask_yscale = 1, src_xscale = 1, src_yscale = 1; struct shader_key key, key_ca; @@ -1328,7 +1285,7 @@ glamor_composite_with_shader(CARD8 op, glamor_set_destination_pixmap_priv_nc(dest_pixmap_priv); glamor_composite_set_shader_blend(dest_pixmap_priv, &key, shader, &op_info); - dispatch = glamor_get_dispatch(glamor_priv); + glamor_get_context(glamor_priv); glamor_priv->has_source_coords = key.source != SHADER_SOURCE_SOLID; glamor_priv->has_mask_coords = (key.mask != SHADER_MASK_NONE && @@ -1445,25 +1402,19 @@ glamor_composite_with_shader(CARD8 op, } } - dispatch->glBindBuffer(GL_ARRAY_BUFFER, 0); - dispatch->glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); - dispatch->glDisableVertexAttribArray(GLAMOR_VERTEX_POS); - dispatch->glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE); - dispatch->glDisableVertexAttribArray(GLAMOR_VERTEX_MASK); - dispatch->glDisable(GL_BLEND); -#ifndef GLAMOR_GLES2 - dispatch->glActiveTexture(GL_TEXTURE0); - dispatch->glDisable(GL_TEXTURE_2D); - dispatch->glActiveTexture(GL_TEXTURE1); - dispatch->glDisable(GL_TEXTURE_2D); -#endif + glBindBuffer(GL_ARRAY_BUFFER, 0); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); + glDisableVertexAttribArray(GLAMOR_VERTEX_POS); + glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE); + glDisableVertexAttribArray(GLAMOR_VERTEX_MASK); + glDisable(GL_BLEND); DEBUGF("finish rendering.\n"); - dispatch->glUseProgram(0); + glUseProgram(0); glamor_priv->state = RENDER_STATE; glamor_priv->render_idle_cnt = 0; if (saved_source_format) source->format = saved_source_format; - glamor_put_dispatch(glamor_priv); + glamor_put_context(glamor_priv); ret = TRUE; return ret; diff --git a/xorg-server/glamor/glamor_tile.c b/xorg-server/glamor/glamor_tile.c index 9c8e521b9..7288af30e 100644 --- a/xorg-server/glamor/glamor_tile.c +++ b/xorg-server/glamor/glamor_tile.c @@ -37,7 +37,6 @@ void glamor_init_tile_shader(ScreenPtr screen) { glamor_screen_private *glamor_priv; - glamor_gl_dispatch *dispatch; const char *tile_vs = "attribute vec4 v_position;\n" "attribute vec4 v_texcoord0;\n" @@ -63,40 +62,39 @@ glamor_init_tile_shader(ScreenPtr screen) GLint sampler_uniform_location; glamor_priv = glamor_get_screen_private(screen); - dispatch = glamor_get_dispatch(glamor_priv); - glamor_priv->tile_prog = dispatch->glCreateProgram(); - vs_prog = glamor_compile_glsl_prog(dispatch, GL_VERTEX_SHADER, tile_vs); - fs_prog = glamor_compile_glsl_prog(dispatch, GL_FRAGMENT_SHADER, tile_fs); - dispatch->glAttachShader(glamor_priv->tile_prog, vs_prog); - dispatch->glAttachShader(glamor_priv->tile_prog, fs_prog); - - dispatch->glBindAttribLocation(glamor_priv->tile_prog, - GLAMOR_VERTEX_POS, "v_position"); - dispatch->glBindAttribLocation(glamor_priv->tile_prog, - GLAMOR_VERTEX_SOURCE, "v_texcoord0"); - glamor_link_glsl_prog(dispatch, glamor_priv->tile_prog); + glamor_get_context(glamor_priv); + glamor_priv->tile_prog = glCreateProgram(); + vs_prog = glamor_compile_glsl_prog(GL_VERTEX_SHADER, tile_vs); + fs_prog = glamor_compile_glsl_prog(GL_FRAGMENT_SHADER, tile_fs); + glAttachShader(glamor_priv->tile_prog, vs_prog); + glAttachShader(glamor_priv->tile_prog, fs_prog); + + glBindAttribLocation(glamor_priv->tile_prog, + GLAMOR_VERTEX_POS, "v_position"); + glBindAttribLocation(glamor_priv->tile_prog, + GLAMOR_VERTEX_SOURCE, "v_texcoord0"); + glamor_link_glsl_prog(glamor_priv->tile_prog); sampler_uniform_location = - dispatch->glGetUniformLocation(glamor_priv->tile_prog, "sampler"); - dispatch->glUseProgram(glamor_priv->tile_prog); - dispatch->glUniform1i(sampler_uniform_location, 0); + glGetUniformLocation(glamor_priv->tile_prog, "sampler"); + glUseProgram(glamor_priv->tile_prog); + glUniform1i(sampler_uniform_location, 0); glamor_priv->tile_wh = - dispatch->glGetUniformLocation(glamor_priv->tile_prog, "wh"); - dispatch->glUseProgram(0); - glamor_put_dispatch(glamor_priv); + glGetUniformLocation(glamor_priv->tile_prog, "wh"); + glUseProgram(0); + glamor_put_context(glamor_priv); } void glamor_fini_tile_shader(ScreenPtr screen) { glamor_screen_private *glamor_priv; - glamor_gl_dispatch *dispatch; glamor_priv = glamor_get_screen_private(screen); - dispatch = glamor_get_dispatch(glamor_priv); - dispatch->glDeleteProgram(glamor_priv->tile_prog); - glamor_put_dispatch(glamor_priv); + glamor_get_context(glamor_priv); + glDeleteProgram(glamor_priv->tile_prog); + glamor_put_context(glamor_priv); } static void @@ -105,7 +103,6 @@ _glamor_tile(PixmapPtr pixmap, PixmapPtr tile, { ScreenPtr screen = pixmap->drawable.pScreen; glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); - glamor_gl_dispatch *dispatch; int x1 = x; int x2 = x + width; int y1 = y; @@ -127,47 +124,40 @@ _glamor_tile(PixmapPtr pixmap, PixmapPtr tile, glamor_set_destination_pixmap_priv_nc(dst_pixmap_priv); pixmap_priv_get_dest_scale(dst_pixmap_priv, &dst_xscale, &dst_yscale); pixmap_priv_get_scale(src_pixmap_priv, &src_xscale, &src_yscale); - dispatch = glamor_get_dispatch(glamor_priv); - dispatch->glUseProgram(glamor_priv->tile_prog); + glamor_get_context(glamor_priv); + glUseProgram(glamor_priv->tile_prog); glamor_pixmap_fbo_fix_wh_ratio(wh, src_pixmap_priv); - dispatch->glUniform2fv(glamor_priv->tile_wh, 1, wh); - dispatch->glActiveTexture(GL_TEXTURE0); - dispatch->glBindTexture(GL_TEXTURE_2D, src_pixmap_priv->base.fbo->tex); - dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); - dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); -#ifndef GLAMOR_GLES2 - dispatch->glEnable(GL_TEXTURE_2D); -#endif + glUniform2fv(glamor_priv->tile_wh, 1, wh); + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D, src_pixmap_priv->base.fbo->tex); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glamor_set_repeat_normalize_tcoords (src_pixmap_priv, RepeatNormal, src_xscale, src_yscale, tile_x1, tile_y1, tile_x2, tile_y2, glamor_priv->yInverted, source_texcoords); - dispatch->glVertexAttribPointer(GLAMOR_VERTEX_SOURCE, 2, - GL_FLOAT, GL_FALSE, - 2 * sizeof(float), source_texcoords); - dispatch->glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE); + glVertexAttribPointer(GLAMOR_VERTEX_SOURCE, 2, GL_FLOAT, GL_FALSE, + 2 * sizeof(float), source_texcoords); + glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE); glamor_set_normalize_vcoords(dst_pixmap_priv, dst_xscale, dst_yscale, x1, y1, x2, y2, glamor_priv->yInverted, vertices); - dispatch->glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT, - GL_FALSE, 2 * sizeof(float), vertices); - dispatch->glEnableVertexAttribArray(GLAMOR_VERTEX_POS); - dispatch->glDrawArrays(GL_TRIANGLE_FAN, 0, 4); + glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT, GL_FALSE, + 2 * sizeof(float), vertices); + glEnableVertexAttribArray(GLAMOR_VERTEX_POS); + glDrawArrays(GL_TRIANGLE_FAN, 0, 4); - dispatch->glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE); -#ifndef GLAMOR_GLES2 - dispatch->glDisable(GL_TEXTURE_2D); -#endif - dispatch->glDisableVertexAttribArray(GLAMOR_VERTEX_POS); - dispatch->glUseProgram(0); - glamor_put_dispatch(glamor_priv); + glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE); + glDisableVertexAttribArray(GLAMOR_VERTEX_POS); + glUseProgram(0); + glamor_put_context(glamor_priv); glamor_priv->state = RENDER_STATE; glamor_priv->render_idle_cnt = 0; @@ -182,7 +172,6 @@ glamor_tile(PixmapPtr pixmap, PixmapPtr tile, glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); glamor_pixmap_private *dst_pixmap_priv; glamor_pixmap_private *src_pixmap_priv; - glamor_gl_dispatch *dispatch; dst_pixmap_priv = glamor_get_pixmap_private(pixmap); src_pixmap_priv = glamor_get_pixmap_private(tile); @@ -206,10 +195,10 @@ glamor_tile(PixmapPtr pixmap, PixmapPtr tile, goto fail; } - dispatch = glamor_get_dispatch(glamor_priv); - if (!glamor_set_alu(dispatch, alu)) { + glamor_get_context(glamor_priv); + if (!glamor_set_alu(screen, alu)) { glamor_fallback("unsupported alu %x\n", alu); - glamor_put_dispatch(glamor_priv); + glamor_put_context(glamor_priv); goto fail; } @@ -302,8 +291,8 @@ glamor_tile(PixmapPtr pixmap, PixmapPtr tile, else _glamor_tile(pixmap, tile, x, y, width, height, tile_x, tile_y); - glamor_set_alu(dispatch, GXcopy); - glamor_put_dispatch(glamor_priv); + glamor_set_alu(screen, GXcopy); + glamor_put_context(glamor_priv); return TRUE; fail: return FALSE; diff --git a/xorg-server/glamor/glamor_trapezoid.c b/xorg-server/glamor/glamor_trapezoid.c index cd99a4782..7bc925a25 100644 --- a/xorg-server/glamor/glamor_trapezoid.c +++ b/xorg-server/glamor/glamor_trapezoid.c @@ -204,24 +204,22 @@ static void glamor_flush_composite_triangles(ScreenPtr screen) { glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); - glamor_gl_dispatch *dispatch; - dispatch = glamor_get_dispatch(glamor_priv); + glamor_get_context(glamor_priv); if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) - dispatch->glUnmapBuffer(GL_ARRAY_BUFFER); + glUnmapBuffer(GL_ARRAY_BUFFER); else { - dispatch->glBindBuffer(GL_ARRAY_BUFFER, glamor_priv->vbo); - dispatch->glBufferData(GL_ARRAY_BUFFER, - glamor_priv->vbo_offset, - glamor_priv->vb, GL_DYNAMIC_DRAW); + glBindBuffer(GL_ARRAY_BUFFER, glamor_priv->vbo); + glBufferData(GL_ARRAY_BUFFER, glamor_priv->vbo_offset, + glamor_priv->vb, GL_DYNAMIC_DRAW); } if (!glamor_priv->render_nr_verts) return; - dispatch->glDrawArrays(GL_TRIANGLES, 0, glamor_priv->render_nr_verts); - glamor_put_dispatch(glamor_priv); + glDrawArrays(GL_TRIANGLES, 0, glamor_priv->render_nr_verts); + glamor_put_context(glamor_priv); } static Bool @@ -582,7 +580,6 @@ static void glamor_setup_composite_vbo_for_trapezoid(ScreenPtr screen, int n_verts) { glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); - glamor_gl_dispatch *dispatch; int stride; int vert_size; @@ -605,25 +602,25 @@ glamor_setup_composite_vbo_for_trapezoid(ScreenPtr screen, int n_verts) vert_size = n_verts * glamor_priv->vb_stride; - dispatch = glamor_get_dispatch(glamor_priv); + glamor_get_context(glamor_priv); - dispatch->glDisableVertexAttribArray(GLAMOR_VERTEX_POS); - dispatch->glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE); - dispatch->glDisableVertexAttribArray(GLAMOR_VERTEX_TOP_BOTTOM); - dispatch->glDisableVertexAttribArray(GLAMOR_VERTEX_LEFT_PARAM); - dispatch->glDisableVertexAttribArray(GLAMOR_VERTEX_RIGHT_PARAM); + glDisableVertexAttribArray(GLAMOR_VERTEX_POS); + glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE); + glDisableVertexAttribArray(GLAMOR_VERTEX_TOP_BOTTOM); + glDisableVertexAttribArray(GLAMOR_VERTEX_LEFT_PARAM); + glDisableVertexAttribArray(GLAMOR_VERTEX_RIGHT_PARAM); - dispatch->glBindBuffer(GL_ARRAY_BUFFER, glamor_priv->vbo); + glBindBuffer(GL_ARRAY_BUFFER, glamor_priv->vbo); if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) { if (glamor_priv->vbo_size < (glamor_priv->vbo_offset + vert_size)) { glamor_priv->vbo_size = GLAMOR_COMPOSITE_VBO_VERT_CNT * glamor_priv->vb_stride; glamor_priv->vbo_offset = 0; - dispatch->glBufferData(GL_ARRAY_BUFFER, - glamor_priv->vbo_size, NULL, GL_STREAM_DRAW); + glBufferData(GL_ARRAY_BUFFER, + glamor_priv->vbo_size, NULL, GL_STREAM_DRAW); } - glamor_priv->vb = dispatch->glMapBufferRange(GL_ARRAY_BUFFER, + glamor_priv->vb = glMapBufferRange(GL_ARRAY_BUFFER, glamor_priv->vbo_offset, vert_size, GL_MAP_WRITE_BIT | @@ -636,43 +633,43 @@ glamor_setup_composite_vbo_for_trapezoid(ScreenPtr screen, int n_verts) glamor_priv->vbo_offset = 0; } - dispatch->glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, glamor_priv->ebo); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, glamor_priv->ebo); /* Set the vertex pointer. */ - dispatch->glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT, - GL_FALSE, glamor_priv->vb_stride, - (void *) ((long) glamor_priv->vbo_offset)); - dispatch->glEnableVertexAttribArray(GLAMOR_VERTEX_POS); + glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT, + GL_FALSE, glamor_priv->vb_stride, + (void *) ((long) glamor_priv->vbo_offset)); + glEnableVertexAttribArray(GLAMOR_VERTEX_POS); stride = 2; - dispatch->glVertexAttribPointer(GLAMOR_VERTEX_SOURCE, 2, GL_FLOAT, - GL_FALSE, glamor_priv->vb_stride, - (void *) ((long) glamor_priv->vbo_offset + - stride * sizeof(float))); - dispatch->glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE); + glVertexAttribPointer(GLAMOR_VERTEX_SOURCE, 2, GL_FLOAT, + GL_FALSE, glamor_priv->vb_stride, + (void *) ((long) glamor_priv->vbo_offset + + stride * sizeof(float))); + glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE); stride += 2; - dispatch->glVertexAttribPointer(GLAMOR_VERTEX_TOP_BOTTOM, 2, GL_FLOAT, + glVertexAttribPointer(GLAMOR_VERTEX_TOP_BOTTOM, 2, GL_FLOAT, GL_FALSE, glamor_priv->vb_stride, (void *) ((long) glamor_priv->vbo_offset + stride * sizeof(float))); - dispatch->glEnableVertexAttribArray(GLAMOR_VERTEX_TOP_BOTTOM); + glEnableVertexAttribArray(GLAMOR_VERTEX_TOP_BOTTOM); stride += 2; - dispatch->glVertexAttribPointer(GLAMOR_VERTEX_LEFT_PARAM, 4, GL_FLOAT, + glVertexAttribPointer(GLAMOR_VERTEX_LEFT_PARAM, 4, GL_FLOAT, GL_FALSE, glamor_priv->vb_stride, (void *) ((long) glamor_priv->vbo_offset + stride * sizeof(float))); - dispatch->glEnableVertexAttribArray(GLAMOR_VERTEX_LEFT_PARAM); + glEnableVertexAttribArray(GLAMOR_VERTEX_LEFT_PARAM); stride += 4; - dispatch->glVertexAttribPointer(GLAMOR_VERTEX_RIGHT_PARAM, 4, GL_FLOAT, + glVertexAttribPointer(GLAMOR_VERTEX_RIGHT_PARAM, 4, GL_FLOAT, GL_FALSE, glamor_priv->vb_stride, (void *) ((long) glamor_priv->vbo_offset + stride * sizeof(float))); - dispatch->glEnableVertexAttribArray(GLAMOR_VERTEX_RIGHT_PARAM); + glEnableVertexAttribArray(GLAMOR_VERTEX_RIGHT_PARAM); - glamor_put_dispatch(glamor_priv); + glamor_put_context(glamor_priv); } static Bool @@ -701,7 +698,6 @@ _glamor_trapezoids_with_shader(CARD8 op, GLfloat dst_xscale, dst_yscale; BoxRec bounds; PicturePtr temp_src = src; - glamor_gl_dispatch *dispatch = NULL; int vert_stride = 3; int ntriangle_per_loop; int nclip_rect; @@ -815,6 +811,8 @@ _glamor_trapezoids_with_shader(CARD8 op, goto TRAPEZOID_OUT; } + glamor_get_context(glamor_priv); + box = REGION_RECTS(®ion); nbox = REGION_NUM_RECTS(®ion); pbox = box; @@ -833,8 +831,6 @@ _glamor_trapezoids_with_shader(CARD8 op, glamor_priv->has_mask_coords = (key.mask != SHADER_MASK_NONE && key.mask != SHADER_MASK_SOLID); - dispatch = glamor_get_dispatch(glamor_priv); - glamor_get_drawable_deltas(dst->pDrawable, dest_pixmap, &dest_x_off, &dest_y_off); @@ -974,19 +970,14 @@ _glamor_trapezoids_with_shader(CARD8 op, ret = TRUE; TRAPEZOID_RESET_GL: - dispatch->glBindBuffer(GL_ARRAY_BUFFER, 0); - dispatch->glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); - dispatch->glDisableVertexAttribArray(GLAMOR_VERTEX_POS); - dispatch->glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE); - dispatch->glDisableVertexAttribArray(GLAMOR_VERTEX_MASK); - dispatch->glDisable(GL_BLEND); -#ifndef GLAMOR_GLES2 - dispatch->glActiveTexture(GL_TEXTURE0); - dispatch->glDisable(GL_TEXTURE_2D); - dispatch->glActiveTexture(GL_TEXTURE1); - dispatch->glDisable(GL_TEXTURE_2D); -#endif - dispatch->glUseProgram(0); + glBindBuffer(GL_ARRAY_BUFFER, 0); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); + glDisableVertexAttribArray(GLAMOR_VERTEX_POS); + glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE); + glDisableVertexAttribArray(GLAMOR_VERTEX_MASK); + glDisable(GL_BLEND); + glUseProgram(0); + glamor_put_context(glamor_priv); TRAPEZOID_OUT: if (box) { @@ -1002,10 +993,6 @@ _glamor_trapezoids_with_shader(CARD8 op, } } - if (dispatch) { - glamor_put_dispatch(glamor_priv); - } - return ret; } @@ -1013,7 +1000,6 @@ void glamor_init_trapezoid_shader(ScreenPtr screen) { glamor_screen_private *glamor_priv; - glamor_gl_dispatch *dispatch; GLint fs_prog, vs_prog; const char *trapezoid_vs = @@ -1344,46 +1330,43 @@ glamor_init_trapezoid_shader(ScreenPtr screen) "}\n"; glamor_priv = glamor_get_screen_private(screen); - dispatch = glamor_get_dispatch(glamor_priv); + glamor_get_context(glamor_priv); - glamor_priv->trapezoid_prog = dispatch->glCreateProgram(); + glamor_priv->trapezoid_prog = glCreateProgram(); - vs_prog = glamor_compile_glsl_prog(dispatch, - GL_VERTEX_SHADER, trapezoid_vs); - fs_prog = glamor_compile_glsl_prog(dispatch, - GL_FRAGMENT_SHADER, trapezoid_fs); + vs_prog = glamor_compile_glsl_prog(GL_VERTEX_SHADER, trapezoid_vs); + fs_prog = glamor_compile_glsl_prog(GL_FRAGMENT_SHADER, trapezoid_fs); - dispatch->glAttachShader(glamor_priv->trapezoid_prog, vs_prog); - dispatch->glAttachShader(glamor_priv->trapezoid_prog, fs_prog); + glAttachShader(glamor_priv->trapezoid_prog, vs_prog); + glAttachShader(glamor_priv->trapezoid_prog, fs_prog); - dispatch->glBindAttribLocation(glamor_priv->trapezoid_prog, - GLAMOR_VERTEX_POS, "v_positionsition"); - dispatch->glBindAttribLocation(glamor_priv->trapezoid_prog, - GLAMOR_VERTEX_SOURCE, "v_texcoord"); - dispatch->glBindAttribLocation(glamor_priv->trapezoid_prog, - GLAMOR_VERTEX_TOP_BOTTOM, "v_top_bottom"); - dispatch->glBindAttribLocation(glamor_priv->trapezoid_prog, - GLAMOR_VERTEX_LEFT_PARAM, "v_left_param"); - dispatch->glBindAttribLocation(glamor_priv->trapezoid_prog, - GLAMOR_VERTEX_RIGHT_PARAM, "v_right_param"); + glBindAttribLocation(glamor_priv->trapezoid_prog, + GLAMOR_VERTEX_POS, "v_positionsition"); + glBindAttribLocation(glamor_priv->trapezoid_prog, + GLAMOR_VERTEX_SOURCE, "v_texcoord"); + glBindAttribLocation(glamor_priv->trapezoid_prog, + GLAMOR_VERTEX_TOP_BOTTOM, "v_top_bottom"); + glBindAttribLocation(glamor_priv->trapezoid_prog, + GLAMOR_VERTEX_LEFT_PARAM, "v_left_param"); + glBindAttribLocation(glamor_priv->trapezoid_prog, + GLAMOR_VERTEX_RIGHT_PARAM, "v_right_param"); - glamor_link_glsl_prog(dispatch, glamor_priv->trapezoid_prog); + glamor_link_glsl_prog(glamor_priv->trapezoid_prog); - dispatch->glUseProgram(0); + glUseProgram(0); - glamor_put_dispatch(glamor_priv); + glamor_put_context(glamor_priv); } void glamor_fini_trapezoid_shader(ScreenPtr screen) { glamor_screen_private *glamor_priv; - glamor_gl_dispatch *dispatch; glamor_priv = glamor_get_screen_private(screen); - dispatch = glamor_get_dispatch(glamor_priv); - dispatch->glDeleteProgram(glamor_priv->trapezoid_prog); - glamor_put_dispatch(glamor_priv); + glamor_get_context(glamor_priv); + glDeleteProgram(glamor_priv->trapezoid_prog); + glamor_put_context(glamor_priv); } static Bool @@ -1392,7 +1375,6 @@ _glamor_generate_trapezoid_with_shader(ScreenPtr screen, PicturePtr picture, BoxRec *bounds) { glamor_screen_private *glamor_priv; - glamor_gl_dispatch *dispatch; glamor_pixmap_private *pixmap_priv; PixmapPtr pixmap = NULL; GLint trapezoid_prog; @@ -1425,20 +1407,20 @@ _glamor_generate_trapezoid_with_shader(ScreenPtr screen, PicturePtr picture, return FALSE; } - dispatch = glamor_get_dispatch(glamor_priv); + glamor_get_context(glamor_priv); glamor_set_destination_pixmap_priv_nc(pixmap_priv); pixmap_priv_get_dest_scale(pixmap_priv, (&xscale), (&yscale)); - dispatch->glBindBuffer(GL_ARRAY_BUFFER, 0); - dispatch->glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); + glBindBuffer(GL_ARRAY_BUFFER, 0); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); /* Now draw the Trapezoid mask. */ - dispatch->glUseProgram(trapezoid_prog); + glUseProgram(trapezoid_prog); - dispatch->glEnable(GL_BLEND); - dispatch->glBlendFunc(GL_ONE, GL_ONE); + glEnable(GL_BLEND); + glBlendFunc(GL_ONE, GL_ONE); nrect_max = GLAMOR_COMPOSITE_VBO_VERT_CNT / (4 * GLAMOR_VERTEX_RIGHT_PARAM); @@ -1565,37 +1547,36 @@ _glamor_generate_trapezoid_with_shader(ScreenPtr screen, PicturePtr picture, continue; if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) - dispatch->glUnmapBuffer(GL_ARRAY_BUFFER); + glUnmapBuffer(GL_ARRAY_BUFFER); else { - dispatch->glBindBuffer(GL_ARRAY_BUFFER, glamor_priv->vbo); - dispatch->glBufferData(GL_ARRAY_BUFFER, - glamor_priv->vbo_offset, - glamor_priv->vb, GL_DYNAMIC_DRAW); + glBindBuffer(GL_ARRAY_BUFFER, glamor_priv->vbo); + glBufferData(GL_ARRAY_BUFFER, glamor_priv->vbo_offset, + glamor_priv->vb, GL_DYNAMIC_DRAW); } -#ifndef GLAMOR_GLES2 - dispatch->glDrawRangeElements(GL_TRIANGLES, 0, - glamor_priv->render_nr_verts, - (glamor_priv->render_nr_verts * 3) / 2, - GL_UNSIGNED_SHORT, NULL); -#else - dispatch->glDrawElements(GL_TRIANGLES, - (glamor_priv->render_nr_verts * 3) / 2, - GL_UNSIGNED_SHORT, NULL); -#endif + if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) { + glDrawRangeElements(GL_TRIANGLES, 0, + glamor_priv->render_nr_verts, + (glamor_priv->render_nr_verts * 3) / 2, + GL_UNSIGNED_SHORT, NULL); + } else { + glDrawElements(GL_TRIANGLES, + (glamor_priv->render_nr_verts * 3) / 2, + GL_UNSIGNED_SHORT, NULL); + } } - dispatch->glBindBuffer(GL_ARRAY_BUFFER, 0); - dispatch->glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); - dispatch->glBlendFunc(GL_ONE, GL_ZERO); - dispatch->glDisable(GL_BLEND); - dispatch->glDisableVertexAttribArray(GLAMOR_VERTEX_POS); - dispatch->glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE); - dispatch->glDisableVertexAttribArray(GLAMOR_VERTEX_TOP_BOTTOM); - dispatch->glDisableVertexAttribArray(GLAMOR_VERTEX_LEFT_PARAM); - dispatch->glDisableVertexAttribArray(GLAMOR_VERTEX_RIGHT_PARAM); - dispatch->glUseProgram(0); - glamor_put_dispatch(glamor_priv); + glBindBuffer(GL_ARRAY_BUFFER, 0); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); + glBlendFunc(GL_ONE, GL_ZERO); + glDisable(GL_BLEND); + glDisableVertexAttribArray(GLAMOR_VERTEX_POS); + glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE); + glDisableVertexAttribArray(GLAMOR_VERTEX_TOP_BOTTOM); + glDisableVertexAttribArray(GLAMOR_VERTEX_LEFT_PARAM); + glDisableVertexAttribArray(GLAMOR_VERTEX_RIGHT_PARAM); + glUseProgram(0); + glamor_put_context(glamor_priv); return TRUE; } diff --git a/xorg-server/glamor/glamor_utils.h b/xorg-server/glamor/glamor_utils.h index ea827df3b..9374c9d4d 100644 --- a/xorg-server/glamor/glamor_utils.h +++ b/xorg-server/glamor/glamor_utils.h @@ -869,19 +869,17 @@ format_for_depth(int depth) } } -static inline void -gl_iformat_for_depth(int depth, GLenum * format) +static inline GLenum +gl_iformat_for_pixmap(PixmapPtr pixmap) { - switch (depth) { -#ifndef GLAMOR_GLES2 - case 1: - case 8: - *format = GL_ALPHA; - break; -#endif - default: - *format = GL_RGBA; - break; + glamor_screen_private *glamor_priv = + glamor_get_screen_private(pixmap->drawable.pScreen); + + if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP && + (pixmap->drawable.depth == 1 || pixmap->drawable.depth == 8)) { + return GL_ALPHA; + } else { + return GL_RGBA; } } @@ -916,298 +914,6 @@ format_for_pixmap(PixmapPtr pixmap) #define SWAP_UPLOADING 2 #define SWAP_NONE_UPLOADING 3 -/* - * Map picture's format to the correct gl texture format and type. - * no_alpha is used to indicate whehter we need to wire alpha to 1. - * - * Although opengl support A1/GL_BITMAP, we still don't use it - * here, it seems that mesa has bugs when uploading a A1 bitmap. - * - * Return 0 if find a matched texture type. Otherwise return -1. - **/ -#ifndef GLAMOR_GLES2 -static inline int -glamor_get_tex_format_type_from_pictformat(PictFormatShort format, - GLenum * tex_format, - GLenum * tex_type, - int *no_alpha, - int *revert, - int *swap_rb, int is_upload) -{ - *no_alpha = 0; - *revert = REVERT_NONE; - *swap_rb = is_upload ? SWAP_NONE_UPLOADING : SWAP_NONE_DOWNLOADING; - switch (format) { - case PICT_a1: - *tex_format = GL_ALPHA; - *tex_type = GL_UNSIGNED_BYTE; - *revert = is_upload ? REVERT_UPLOADING_A1 : REVERT_DOWNLOADING_A1; - break; - case PICT_b8g8r8x8: - *no_alpha = 1; - case PICT_b8g8r8a8: - *tex_format = GL_BGRA; - *tex_type = GL_UNSIGNED_INT_8_8_8_8; - break; - - case PICT_x8r8g8b8: - *no_alpha = 1; - case PICT_a8r8g8b8: - *tex_format = GL_BGRA; - *tex_type = GL_UNSIGNED_INT_8_8_8_8_REV; - break; - case PICT_x8b8g8r8: - *no_alpha = 1; - case PICT_a8b8g8r8: - *tex_format = GL_RGBA; - *tex_type = GL_UNSIGNED_INT_8_8_8_8_REV; - break; - case PICT_x2r10g10b10: - *no_alpha = 1; - case PICT_a2r10g10b10: - *tex_format = GL_BGRA; - *tex_type = GL_UNSIGNED_INT_2_10_10_10_REV; - break; - case PICT_x2b10g10r10: - *no_alpha = 1; - case PICT_a2b10g10r10: - *tex_format = GL_RGBA; - *tex_type = GL_UNSIGNED_INT_2_10_10_10_REV; - break; - - case PICT_r5g6b5: - *tex_format = GL_RGB; - *tex_type = GL_UNSIGNED_SHORT_5_6_5; - break; - case PICT_b5g6r5: - *tex_format = GL_RGB; - *tex_type = GL_UNSIGNED_SHORT_5_6_5_REV; - break; - case PICT_x1b5g5r5: - *no_alpha = 1; - case PICT_a1b5g5r5: - *tex_format = GL_RGBA; - *tex_type = GL_UNSIGNED_SHORT_1_5_5_5_REV; - break; - - case PICT_x1r5g5b5: - *no_alpha = 1; - case PICT_a1r5g5b5: - *tex_format = GL_BGRA; - *tex_type = GL_UNSIGNED_SHORT_1_5_5_5_REV; - break; - case PICT_a8: - *tex_format = GL_ALPHA; - *tex_type = GL_UNSIGNED_BYTE; - break; - case PICT_x4r4g4b4: - *no_alpha = 1; - case PICT_a4r4g4b4: - *tex_format = GL_BGRA; - *tex_type = GL_UNSIGNED_SHORT_4_4_4_4_REV; - break; - - case PICT_x4b4g4r4: - *no_alpha = 1; - case PICT_a4b4g4r4: - *tex_format = GL_RGBA; - *tex_type = GL_UNSIGNED_SHORT_4_4_4_4_REV; - break; - - default: - LogMessageVerb(X_INFO, 0, - "fail to get matched format for %x \n", format); - return -1; - } - return 0; -} - -/* Currently, we use RGBA to represent all formats. */ -inline static int -cache_format(GLenum format) -{ - switch (format) { - case GL_ALPHA: - return 1; - case GL_RGBA: - return 0; - default: - return -1; - } -} - -#else -#define IS_LITTLE_ENDIAN (IMAGE_BYTE_ORDER == LSBFirst) - -static inline int -glamor_get_tex_format_type_from_pictformat(PictFormatShort format, - GLenum * tex_format, - GLenum * tex_type, - int *no_alpha, - int *revert, - int *swap_rb, int is_upload) -{ - int need_swap_rb = 0; - - *no_alpha = 0; - *revert = IS_LITTLE_ENDIAN ? REVERT_NONE : REVERT_NORMAL; - - switch (format) { - case PICT_b8g8r8x8: - *no_alpha = 1; - case PICT_b8g8r8a8: - *tex_format = GL_RGBA; - *tex_type = GL_UNSIGNED_BYTE; - need_swap_rb = 1; - *revert = IS_LITTLE_ENDIAN ? REVERT_NORMAL : REVERT_NONE; - break; - - case PICT_x8r8g8b8: - *no_alpha = 1; - case PICT_a8r8g8b8: - *tex_format = GL_RGBA; - *tex_type = GL_UNSIGNED_BYTE; - need_swap_rb = 1; - break; - - case PICT_x8b8g8r8: - *no_alpha = 1; - case PICT_a8b8g8r8: - *tex_format = GL_RGBA; - *tex_type = GL_UNSIGNED_BYTE; - break; - - case PICT_x2r10g10b10: - *no_alpha = 1; - case PICT_a2r10g10b10: - *tex_format = GL_RGBA; - /* glReadPixmap doesn't support GL_UNSIGNED_INT_10_10_10_2. - * we have to use GL_UNSIGNED_BYTE and do the conversion in - * shader latter.*/ - *tex_type = GL_UNSIGNED_BYTE; - if (is_upload == 1) { - if (!IS_LITTLE_ENDIAN) - *revert = REVERT_UPLOADING_10_10_10_2; - else - *revert = REVERT_UPLOADING_2_10_10_10; - } - else { - if (!IS_LITTLE_ENDIAN) { - *revert = REVERT_DOWNLOADING_10_10_10_2; - } - else { - *revert = REVERT_DOWNLOADING_2_10_10_10; - } - } - need_swap_rb = 1; - - break; - - case PICT_x2b10g10r10: - *no_alpha = 1; - case PICT_a2b10g10r10: - *tex_format = GL_RGBA; - *tex_type = GL_UNSIGNED_BYTE; - if (is_upload == 1) { - if (!IS_LITTLE_ENDIAN) - *revert = REVERT_UPLOADING_10_10_10_2; - else - *revert = REVERT_UPLOADING_2_10_10_10; - } - else { - if (!IS_LITTLE_ENDIAN) { - *revert = REVERT_DOWNLOADING_10_10_10_2; - } - else { - *revert = REVERT_DOWNLOADING_2_10_10_10; - } - } - break; - - case PICT_r5g6b5: - *tex_format = GL_RGB; - *tex_type = GL_UNSIGNED_SHORT_5_6_5; - *revert = IS_LITTLE_ENDIAN ? REVERT_NONE : REVERT_NORMAL; - - break; - - case PICT_b5g6r5: - *tex_format = GL_RGB; - *tex_type = GL_UNSIGNED_SHORT_5_6_5; - need_swap_rb = IS_LITTLE_ENDIAN ? 1 : 0;; - break; - - case PICT_x1b5g5r5: - *no_alpha = 1; - case PICT_a1b5g5r5: - *tex_format = GL_RGBA; - *tex_type = GL_UNSIGNED_SHORT_5_5_5_1; - if (IS_LITTLE_ENDIAN) { - *revert = - is_upload ? REVERT_UPLOADING_1_5_5_5 : - REVERT_DOWNLOADING_1_5_5_5; - } - else - *revert = REVERT_NONE; - break; - - case PICT_x1r5g5b5: - *no_alpha = 1; - case PICT_a1r5g5b5: - *tex_format = GL_RGBA; - *tex_type = GL_UNSIGNED_SHORT_5_5_5_1; - if (IS_LITTLE_ENDIAN) { - *revert = - is_upload ? REVERT_UPLOADING_1_5_5_5 : - REVERT_DOWNLOADING_1_5_5_5; - } - else - *revert = REVERT_NONE; - need_swap_rb = 1; - break; - - case PICT_a1: - *tex_format = GL_ALPHA; - *tex_type = GL_UNSIGNED_BYTE; - *revert = is_upload ? REVERT_UPLOADING_A1 : REVERT_DOWNLOADING_A1; - break; - - case PICT_a8: - *tex_format = GL_ALPHA; - *tex_type = GL_UNSIGNED_BYTE; - *revert = REVERT_NONE; - break; - - case PICT_x4r4g4b4: - *no_alpha = 1; - case PICT_a4r4g4b4: - *tex_format = GL_RGBA; - *tex_type = GL_UNSIGNED_SHORT_4_4_4_4; - *revert = IS_LITTLE_ENDIAN ? REVERT_NORMAL : REVERT_NONE; - need_swap_rb = 1; - break; - - case PICT_x4b4g4r4: - *no_alpha = 1; - case PICT_a4b4g4r4: - *tex_format = GL_RGBA; - *tex_type = GL_UNSIGNED_SHORT_4_4_4_4; - *revert = IS_LITTLE_ENDIAN ? REVERT_NORMAL : REVERT_NONE; - break; - - default: - LogMessageVerb(X_INFO, 0, - "fail to get matched format for %x \n", format); - return -1; - } - - if (need_swap_rb) - *swap_rb = is_upload ? SWAP_UPLOADING : SWAP_DOWNLOADING; - else - *swap_rb = is_upload ? SWAP_NONE_UPLOADING : SWAP_NONE_DOWNLOADING; - return 0; -} - inline static int cache_format(GLenum format) { @@ -1223,31 +929,6 @@ cache_format(GLenum format) } } -#endif - -static inline int -glamor_get_tex_format_type_from_pixmap(PixmapPtr pixmap, - GLenum * format, - GLenum * type, - int *no_alpha, - int *revert, int *swap_rb, int is_upload) -{ - glamor_pixmap_private *pixmap_priv; - PictFormatShort pict_format; - - pixmap_priv = glamor_get_pixmap_private(pixmap); - if (GLAMOR_PIXMAP_PRIV_IS_PICTURE(pixmap_priv)) - pict_format = pixmap_priv->base.picture->format; - else - pict_format = format_for_depth(pixmap->drawable.depth); - - return glamor_get_tex_format_type_from_pictformat(pict_format, - format, type, - no_alpha, - revert, - swap_rb, is_upload); -} - /* borrowed from uxa */ static inline Bool glamor_get_rgba_from_pixel(CARD32 pixel, @@ -1319,16 +1000,18 @@ glamor_get_rgba_from_pixel(CARD32 pixel, } inline static Bool -glamor_pict_format_is_compatible(PictFormatShort pict_format, int depth) +glamor_pict_format_is_compatible(PicturePtr picture) { GLenum iformat; + PixmapPtr pixmap = glamor_get_drawable_pixmap(picture->pDrawable); - gl_iformat_for_depth(depth, &iformat); + iformat = gl_iformat_for_pixmap(pixmap); switch (iformat) { case GL_RGBA: - return (pict_format == PICT_a8r8g8b8 || pict_format == PICT_x8r8g8b8); + return (picture->format == PICT_a8r8g8b8 || + picture->format == PICT_x8r8g8b8); case GL_ALPHA: - return (pict_format == PICT_a8); + return (picture->format == PICT_a8); default: return FALSE; } @@ -1817,31 +1500,15 @@ __fls(unsigned long x) #endif static inline void -glamor_make_current(ScreenPtr screen) +glamor_get_context(glamor_screen_private * glamor_priv) { - glamor_egl_make_current(screen); -} - -static inline void -glamor_restore_current(ScreenPtr screen) -{ - glamor_egl_restore_context(screen); -} - -static inline glamor_gl_dispatch * -glamor_get_dispatch(glamor_screen_private * glamor_priv) -{ - if (glamor_priv->flags & GLAMOR_USE_EGL_SCREEN) - glamor_make_current(glamor_priv->screen); - - return &glamor_priv->_dispatch; + glamor_priv->ctx.get_context(&glamor_priv->ctx); } static inline void -glamor_put_dispatch(glamor_screen_private * glamor_priv) +glamor_put_context(glamor_screen_private * glamor_priv) { - if (glamor_priv->flags & GLAMOR_USE_EGL_SCREEN) - glamor_restore_current(glamor_priv->screen); + glamor_priv->ctx.put_context(&glamor_priv->ctx); } #endif diff --git a/xorg-server/glamor/glamor_xv.c b/xorg-server/glamor/glamor_xv.c index cbe07c8b1..dc39476b5 100644 --- a/xorg-server/glamor/glamor_xv.c +++ b/xorg-server/glamor/glamor_xv.c @@ -90,38 +90,36 @@ void glamor_init_xv_shader(ScreenPtr screen) { glamor_screen_private *glamor_priv; - glamor_gl_dispatch *dispatch; GLint fs_prog, vs_prog; glamor_priv = glamor_get_screen_private(screen); - dispatch = glamor_get_dispatch(glamor_priv); - glamor_priv->xv_prog = dispatch->glCreateProgram(); + glamor_get_context(glamor_priv); + glamor_priv->xv_prog = glCreateProgram(); - vs_prog = glamor_compile_glsl_prog(dispatch, GL_VERTEX_SHADER, xv_vs); - fs_prog = glamor_compile_glsl_prog(dispatch, GL_FRAGMENT_SHADER, xv_ps); - dispatch->glAttachShader(glamor_priv->xv_prog, vs_prog); - dispatch->glAttachShader(glamor_priv->xv_prog, fs_prog); + vs_prog = glamor_compile_glsl_prog(GL_VERTEX_SHADER, xv_vs); + fs_prog = glamor_compile_glsl_prog(GL_FRAGMENT_SHADER, xv_ps); + glAttachShader(glamor_priv->xv_prog, vs_prog); + glAttachShader(glamor_priv->xv_prog, fs_prog); - dispatch->glBindAttribLocation(glamor_priv->xv_prog, - GLAMOR_VERTEX_POS, "v_position"); - dispatch->glBindAttribLocation(glamor_priv->xv_prog, - GLAMOR_VERTEX_SOURCE, "v_texcoord0"); - glamor_link_glsl_prog(dispatch, glamor_priv->xv_prog); + glBindAttribLocation(glamor_priv->xv_prog, + GLAMOR_VERTEX_POS, "v_position"); + glBindAttribLocation(glamor_priv->xv_prog, + GLAMOR_VERTEX_SOURCE, "v_texcoord0"); + glamor_link_glsl_prog(glamor_priv->xv_prog); - glamor_put_dispatch(glamor_priv); + glamor_put_context(glamor_priv); } void glamor_fini_xv_shader(ScreenPtr screen) { glamor_screen_private *glamor_priv; - glamor_gl_dispatch *dispatch; glamor_priv = glamor_get_screen_private(screen); - dispatch = glamor_get_dispatch(glamor_priv); + glamor_get_context(glamor_priv); - dispatch->glDeleteProgram(glamor_priv->xv_prog); - glamor_put_dispatch(glamor_priv); + glDeleteProgram(glamor_priv->xv_prog); + glamor_put_context(glamor_priv); } #define ClipValue(v,min,max) ((v) < (min) ? (min) : (v) > (max) ? (max) : (v)) @@ -278,7 +276,6 @@ glamor_display_textured_video(glamor_port_private *port_priv) glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(port_priv->pPixmap); glamor_pixmap_private *src_pixmap_priv[3]; - glamor_gl_dispatch *dispatch; float vertices[32], texcoords[8]; BoxPtr box = REGION_RECTS(&port_priv->clip); int nBox = REGION_NUM_RECTS(&port_priv->clip); @@ -327,62 +324,53 @@ glamor_display_textured_video(glamor_port_private *port_priv) &src_yscale[i]); } } - dispatch = glamor_get_dispatch(glamor_priv); - dispatch->glUseProgram(glamor_priv->xv_prog); - - uloc = dispatch->glGetUniformLocation(glamor_priv->xv_prog, "offsetyco"); - dispatch->glUniform4f(uloc, off[0], off[1], off[2], yco); - uloc = dispatch->glGetUniformLocation(glamor_priv->xv_prog, "ucogamma"); - dispatch->glUniform4f(uloc, uco[0], uco[1], uco[2], gamma); - uloc = dispatch->glGetUniformLocation(glamor_priv->xv_prog, "vco"); - dispatch->glUniform4f(uloc, vco[0], vco[1], vco[2], 0); - - dispatch->glActiveTexture(GL_TEXTURE0); - dispatch->glBindTexture(GL_TEXTURE_2D, src_pixmap_priv[0]->base.fbo->tex); - dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - dispatch->glTexParameteri(GL_TEXTURE_2D, - GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - dispatch->glTexParameteri(GL_TEXTURE_2D, - GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - - dispatch->glActiveTexture(GL_TEXTURE1); - dispatch->glBindTexture(GL_TEXTURE_2D, src_pixmap_priv[1]->base.fbo->tex); - dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - dispatch->glTexParameteri(GL_TEXTURE_2D, - GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - dispatch->glTexParameteri(GL_TEXTURE_2D, - GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - - dispatch->glActiveTexture(GL_TEXTURE2); - dispatch->glBindTexture(GL_TEXTURE_2D, src_pixmap_priv[2]->base.fbo->tex); - dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - dispatch->glTexParameteri(GL_TEXTURE_2D, - GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - dispatch->glTexParameteri(GL_TEXTURE_2D, - GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - - sampler_loc = - dispatch->glGetUniformLocation(glamor_priv->xv_prog, "y_sampler"); - dispatch->glUniform1i(sampler_loc, 0); - sampler_loc = - dispatch->glGetUniformLocation(glamor_priv->xv_prog, "u_sampler"); - dispatch->glUniform1i(sampler_loc, 1); - sampler_loc = - dispatch->glGetUniformLocation(glamor_priv->xv_prog, "v_sampler"); - dispatch->glUniform1i(sampler_loc, 2); - - dispatch->glVertexAttribPointer(GLAMOR_VERTEX_SOURCE, 2, - GL_FLOAT, GL_FALSE, - 2 * sizeof(float), texcoords); - dispatch->glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE); - - dispatch->glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT, - GL_FALSE, 2 * sizeof(float), vertices); - - dispatch->glEnableVertexAttribArray(GLAMOR_VERTEX_POS); + glamor_get_context(glamor_priv); + glUseProgram(glamor_priv->xv_prog); + + uloc = glGetUniformLocation(glamor_priv->xv_prog, "offsetyco"); + glUniform4f(uloc, off[0], off[1], off[2], yco); + uloc = glGetUniformLocation(glamor_priv->xv_prog, "ucogamma"); + glUniform4f(uloc, uco[0], uco[1], uco[2], gamma); + uloc = glGetUniformLocation(glamor_priv->xv_prog, "vco"); + glUniform4f(uloc, vco[0], vco[1], vco[2], 0); + + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D, src_pixmap_priv[0]->base.fbo->tex); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + + glActiveTexture(GL_TEXTURE1); + glBindTexture(GL_TEXTURE_2D, src_pixmap_priv[1]->base.fbo->tex); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + + glActiveTexture(GL_TEXTURE2); + glBindTexture(GL_TEXTURE_2D, src_pixmap_priv[2]->base.fbo->tex); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + + sampler_loc = glGetUniformLocation(glamor_priv->xv_prog, "y_sampler"); + glUniform1i(sampler_loc, 0); + sampler_loc = glGetUniformLocation(glamor_priv->xv_prog, "u_sampler"); + glUniform1i(sampler_loc, 1); + sampler_loc = glGetUniformLocation(glamor_priv->xv_prog, "v_sampler"); + glUniform1i(sampler_loc, 2); + + glVertexAttribPointer(GLAMOR_VERTEX_SOURCE, 2, + GL_FLOAT, GL_FALSE, + 2 * sizeof(float), texcoords); + glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE); + + glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT, + GL_FALSE, 2 * sizeof(float), vertices); + + glEnableVertexAttribArray(GLAMOR_VERTEX_POS); for (i = 0; i < nBox; i++) { float off_x = box[i].x1 - port_priv->drw_x; float off_y = box[i].y1 - port_priv->drw_y; @@ -418,14 +406,14 @@ glamor_display_textured_video(glamor_port_private *port_priv) srcy + srch, glamor_priv->yInverted, texcoords); - dispatch->glDrawArrays(GL_TRIANGLE_FAN, 0, 4); + glDrawArrays(GL_TRIANGLE_FAN, 0, 4); } - dispatch->glDisableVertexAttribArray(GLAMOR_VERTEX_POS); - dispatch->glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE); + glDisableVertexAttribArray(GLAMOR_VERTEX_POS); + glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE); - dispatch->glUseProgram(0); - glamor_put_dispatch(glamor_priv); + glUseProgram(0); + glamor_put_context(glamor_priv); DamageDamageRegion(port_priv->pDraw, &port_priv->clip); } diff --git a/xorg-server/glx/glthread.c b/xorg-server/glx/glthread.c deleted file mode 100644 index fd4c6cc09..000000000 --- a/xorg-server/glx/glthread.c +++ /dev/null @@ -1,204 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5.1 - * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -/* - * XXX There's probably some work to do in order to make this file - * truly reusable outside of Mesa. - */ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#include <X11/Xfuncproto.h> -#endif - -#include <stdlib.h> -#include <stdio.h> -#include "glthread.h" - -/* - * This file should still compile even when THREADS is not defined. - * This is to make things easier to deal with on the makefile scene.. - */ -#ifdef THREADS -#include <errno.h> - -/* - * Error messages - */ -#define INIT_TSD_ERROR "_glthread_: failed to allocate key for thread specific data" -#define GET_TSD_ERROR "_glthread_: failed to get thread specific data" -#define SET_TSD_ERROR "_glthread_: thread failed to set thread specific data" - -/* - * Magic number to determine if a TSD object has been initialized. - * Kind of a hack but there doesn't appear to be a better cross-platform - * solution. - */ -#define INIT_MAGIC 0xff8adc98 - -/* - * POSIX Threads -- The best way to go if your platform supports them. - * Solaris >= 2.5 have POSIX threads, IRIX >= 6.4 reportedly - * has them, and many of the free Unixes now have them. - * Be sure to use appropriate -mt or -D_REENTRANT type - * compile flags when building. - */ -#ifdef PTHREADS - -_X_EXPORT unsigned long -_glthread_GetID(void) -{ - return (unsigned long) pthread_self(); -} - -void -_glthread_InitTSD(_glthread_TSD * tsd) -{ - if (pthread_key_create(&tsd->key, NULL /*free */ ) != 0) { - perror(INIT_TSD_ERROR); - exit(-1); - } - tsd->initMagic = INIT_MAGIC; -} - -void * -_glthread_GetTSD(_glthread_TSD * tsd) -{ - if (tsd->initMagic != (int) INIT_MAGIC) { - _glthread_InitTSD(tsd); - } - return pthread_getspecific(tsd->key); -} - -void -_glthread_SetTSD(_glthread_TSD * tsd, void *ptr) -{ - if (tsd->initMagic != (int) INIT_MAGIC) { - _glthread_InitTSD(tsd); - } - if (pthread_setspecific(tsd->key, ptr) != 0) { - perror(SET_TSD_ERROR); - exit(-1); - } -} - -#endif /* PTHREADS */ - -/* - * Win32 Threads. The only available option for Windows 95/NT. - * Be sure that you compile using the Multithreaded runtime, otherwise - * bad things will happen. - */ -#ifdef WIN32_THREADS - -void -FreeTSD(_glthread_TSD * p) -{ - if (p->initMagic == INIT_MAGIC) { - TlsFree(p->key); - p->initMagic = 0; - } -} - -void -InsteadOf_exit(int nCode) -{ - DWORD dwErr = GetLastError(); -} - -unsigned long -_glthread_GetID(void) -{ - return GetCurrentThreadId(); -} - -void -_glthread_InitTSD(_glthread_TSD * tsd) -{ - tsd->key = TlsAlloc(); - if (tsd->key == TLS_OUT_OF_INDEXES) { - perror("Mesa:_glthread_InitTSD"); - InsteadOf_exit(-1); - } - tsd->initMagic = INIT_MAGIC; -} - -void * -_glthread_GetTSD(_glthread_TSD * tsd) -{ - if (tsd->initMagic != INIT_MAGIC) { - _glthread_InitTSD(tsd); - } - return TlsGetValue(tsd->key); -} - -void -_glthread_SetTSD(_glthread_TSD * tsd, void *ptr) -{ - /* the following code assumes that the _glthread_TSD has been initialized - to zero at creation */ - if (tsd->initMagic != INIT_MAGIC) { - _glthread_InitTSD(tsd); - } - if (TlsSetValue(tsd->key, ptr) == 0) { - perror("Mesa:_glthread_SetTSD"); - InsteadOf_exit(-1); - } -} - -#endif /* WIN32_THREADS */ - -#else /* THREADS */ - -/* - * no-op functions - */ - -_X_EXPORT unsigned long -_glthread_GetID(void) -{ - return 0; -} - -void -_glthread_InitTSD(_glthread_TSD * tsd) -{ - (void) tsd; -} - -void * -_glthread_GetTSD(_glthread_TSD * tsd) -{ - (void) tsd; - return NULL; -} - -void -_glthread_SetTSD(_glthread_TSD * tsd, void *ptr) -{ - (void) tsd; - (void) ptr; -} - -#endif /* THREADS */ diff --git a/xorg-server/glx/glxext.c b/xorg-server/glx/glxext.c index 6a34ac299..c9b8cc5b3 100644 --- a/xorg-server/glx/glxext.c +++ b/xorg-server/glx/glxext.c @@ -554,9 +554,9 @@ __glXsetGetProcAddress(glx_gpa_proc get_proc_address) void *__glGetProcAddress(const char *proc) { - void *ret = _get_proc_address(proc); + void *ret = (void *) _get_proc_address(proc); - return ret ? ret : NoopDDA; + return ret ? ret : (void *) NoopDDA; } /* diff --git a/xorg-server/glx/glxserver.h b/xorg-server/glx/glxserver.h index 7f36e5f5e..3f2ae3593 100644 --- a/xorg-server/glx/glxserver.h +++ b/xorg-server/glx/glxserver.h @@ -46,7 +46,6 @@ #include <resource.h> #include <scrnintstr.h> -#define GL_GLEXT_PROTOTYPES /* we want prototypes */ #include <GL/gl.h> #include <GL/glext.h> #include <GL/glxproto.h> diff --git a/xorg-server/glx/indirect_program.c b/xorg-server/glx/indirect_program.c index fa4a2408b..d503262c2 100644 --- a/xorg-server/glx/indirect_program.c +++ b/xorg-server/glx/indirect_program.c @@ -122,25 +122,3 @@ __glXDispSwap_GetProgramStringARB(struct __GLXclientStateRec *cl, GLbyte * pc) return DoGetProgramString(cl, pc, get_program, get_program_string, True); } - -int -__glXDisp_GetProgramStringNV(struct __GLXclientStateRec *cl, GLbyte * pc) -{ - PFNGLGETPROGRAMIVARBPROC get_program = - __glGetProcAddress("glGetProgramivARB"); - PFNGLGETPROGRAMSTRINGARBPROC get_program_string = - __glGetProcAddress("glGetProgramStringARB"); - - return DoGetProgramString(cl, pc, get_program, get_program_string, False); -} - -int -__glXDispSwap_GetProgramStringNV(struct __GLXclientStateRec *cl, GLbyte * pc) -{ - PFNGLGETPROGRAMIVARBPROC get_program = - __glGetProcAddress("glGetProgramivARB"); - PFNGLGETPROGRAMSTRINGARBPROC get_program_string = - __glGetProcAddress("glGetProgramStringARB"); - - return DoGetProgramString(cl, pc, get_program, get_program_string, True); -} diff --git a/xorg-server/glx/indirect_texture_compression.c b/xorg-server/glx/indirect_texture_compression.c index 94de47dd6..2018de6ae 100644 --- a/xorg-server/glx/indirect_texture_compression.c +++ b/xorg-server/glx/indirect_texture_compression.c @@ -54,9 +54,11 @@ __glXDisp_GetCompressedTexImage(struct __GLXclientStateRec *cl, GLbyte * pc) &compsize); if (compsize != 0) { + PFNGLGETCOMPRESSEDTEXIMAGEARBPROC GetCompressedTexImageARB = + __glGetProcAddress("glGetCompressedTexImageARB"); __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1); __glXClearErrorOccured(); - glGetCompressedTexImageARB(target, level, answer); + GetCompressedTexImageARB(target, level, answer); } if (__glXErrorOccured()) { @@ -96,9 +98,11 @@ __glXDispSwap_GetCompressedTexImage(struct __GLXclientStateRec *cl, GLbyte * pc) &compsize); if (compsize != 0) { + PFNGLGETCOMPRESSEDTEXIMAGEARBPROC GetCompressedTexImageARB = + __glGetProcAddress("glGetCompressedTexImageARB"); __GLX_GET_ANSWER_BUFFER(answer, cl, compsize, 1); __glXClearErrorOccured(); - glGetCompressedTexImageARB(target, level, answer); + GetCompressedTexImageARB(target, level, answer); } if (__glXErrorOccured()) { diff --git a/xorg-server/hw/kdrive/ephyr/ephyr.c b/xorg-server/hw/kdrive/ephyr/ephyr.c index da80c9577..968127308 100644 --- a/xorg-server/hw/kdrive/ephyr/ephyr.c +++ b/xorg-server/hw/kdrive/ephyr/ephyr.c @@ -1232,6 +1232,9 @@ ephyrGetColors(ScreenPtr pScreen, int n, xColorItem * pdefs) void ephyrPutColors(ScreenPtr pScreen, int n, xColorItem * pdefs) { + KdScreenPriv(pScreen); + KdScreenInfo *screen = pScreenPriv->screen; + EphyrScrPriv *scrpriv = screen->driver; int min, max, p; /* XXX Not sure if this is right */ @@ -1251,6 +1254,18 @@ ephyrPutColors(ScreenPtr pScreen, int n, xColorItem * pdefs) pdefs->green >> 8, pdefs->blue >> 8); pdefs++; } + if (scrpriv->pDamage) { + BoxRec box; + RegionRec region; + + box.x1 = 0; + box.y1 = 0; + box.x2 = pScreen->width; + box.y2 = pScreen->height; + RegionInit(®ion, &box, 1); + DamageReportDamage(scrpriv->pDamage, ®ion); + RegionUninit(®ion); + } } /* Mouse calls */ diff --git a/xorg-server/hw/xfree86/common/xf86Config.c b/xorg-server/hw/xfree86/common/xf86Config.c index 258b22bfe..542d5abf6 100644 --- a/xorg-server/hw/xfree86/common/xf86Config.c +++ b/xorg-server/hw/xfree86/common/xf86Config.c @@ -777,13 +777,7 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts) MessageType from; const char *s; XkbRMLVOSet set; - - /* Default options. */ - set.rules = "base"; - set.model = "pc105"; - set.layout = "us"; - set.variant = NULL; - set.options = NULL; + const char *rules; /* * Merge the ServerLayout and ServerFlags options. The former have @@ -963,9 +957,15 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts) * evdev rules set. */ #if defined(linux) if (!xf86Info.forceInputDevices) - set.rules = "evdev"; + rules = "evdev"; + else #endif + rules = "base"; + + /* Xkb default options. */ + XkbInitRules(&set, rules, "pc105", "us", NULL, NULL); XkbSetRulesDflts(&set); + XkbFreeRMLVOSet(&set, FALSE); xf86Info.useDefaultFontPath = TRUE; xf86Info.useDefaultFontPathFrom = X_DEFAULT; diff --git a/xorg-server/hw/xfree86/common/xf86Configure.c b/xorg-server/hw/xfree86/common/xf86Configure.c index 30dc5505c..967bfbc93 100644 --- a/xorg-server/hw/xfree86/common/xf86Configure.c +++ b/xorg-server/hw/xfree86/common/xf86Configure.c @@ -159,8 +159,8 @@ configureInputSection(void) parsePrologue(XF86ConfInputPtr, XF86ConfInputRec) - ptr->inp_identifier = "Keyboard0"; - ptr->inp_driver = "kbd"; + ptr->inp_identifier = xnfstrdup("Keyboard0"); + ptr->inp_driver = xnfstrdup("kbd"); ptr->list.next = NULL; /* Crude mechanism to auto-detect mouse (os dependent) */ @@ -175,17 +175,17 @@ configureInputSection(void) } mouse = calloc(1, sizeof(XF86ConfInputRec)); - mouse->inp_identifier = "Mouse0"; - mouse->inp_driver = "mouse"; + mouse->inp_identifier = xnfstrdup("Mouse0"); + mouse->inp_driver = xnfstrdup("mouse"); mouse->inp_option_lst = - xf86addNewOption(mouse->inp_option_lst, strdup("Protocol"), - strdup(DFLT_MOUSE_PROTO)); + xf86addNewOption(mouse->inp_option_lst, xnfstrdup("Protocol"), + xnfstrdup(DFLT_MOUSE_PROTO)); mouse->inp_option_lst = - xf86addNewOption(mouse->inp_option_lst, strdup("Device"), - strdup(DFLT_MOUSE_DEV)); + xf86addNewOption(mouse->inp_option_lst, xnfstrdup("Device"), + xnfstrdup(DFLT_MOUSE_DEV)); mouse->inp_option_lst = - xf86addNewOption(mouse->inp_option_lst, strdup("ZAxisMapping"), - strdup("4 5 6 7")); + xf86addNewOption(mouse->inp_option_lst, xnfstrdup("ZAxisMapping"), + xnfstrdup("4 5 6 7")); ptr = (XF86ConfInputPtr) xf86addListItem((glp) ptr, (glp) mouse); return ptr; } @@ -290,7 +290,7 @@ configureDeviceSection(int screennum) " ### <string>: \"String\", <freq>: \"<f> Hz/kHz/MHz\",\n" " ### <percent>: \"<f>%\"\n" " ### [arg]: arg optional\n"; - ptr->dev_comment = strdup(descrip); + ptr->dev_comment = xnfstrdup(descrip); if (ptr->dev_comment) { for (p = DevToConfig[screennum].GDev.options; p->name != NULL; p++) { char *p_e; @@ -337,9 +337,9 @@ configureLayoutSection(void) iptr = malloc(sizeof(XF86ConfInputrefRec)); iptr->list.next = NULL; iptr->iref_option_lst = NULL; - iptr->iref_inputdev_str = "Mouse0"; + iptr->iref_inputdev_str = xnfstrdup("Mouse0"); iptr->iref_option_lst = - xf86addNewOption(iptr->iref_option_lst, strdup("CorePointer"), + xf86addNewOption(iptr->iref_option_lst, xnfstrdup("CorePointer"), NULL); ptr->lay_input_lst = (XF86ConfInputrefPtr) xf86addListItem((glp) ptr->lay_input_lst, (glp) iptr); @@ -351,9 +351,9 @@ configureLayoutSection(void) iptr = malloc(sizeof(XF86ConfInputrefRec)); iptr->list.next = NULL; iptr->iref_option_lst = NULL; - iptr->iref_inputdev_str = "Keyboard0"; + iptr->iref_inputdev_str = xnfstrdup("Keyboard0"); iptr->iref_option_lst = - xf86addNewOption(iptr->iref_option_lst, strdup("CoreKeyboard"), + xf86addNewOption(iptr->iref_option_lst, xnfstrdup("CoreKeyboard"), NULL); ptr->lay_input_lst = (XF86ConfInputrefPtr) xf86addListItem((glp) ptr->lay_input_lst, (glp) iptr); @@ -431,9 +431,9 @@ configureFilesSection(void) parsePrologue(XF86ConfFilesPtr, XF86ConfFilesRec) if (xf86ModulePath) - ptr->file_modulepath = strdup(xf86ModulePath); + ptr->file_modulepath = xnfstrdup(xf86ModulePath); if (defaultFontPath) - ptr->file_fontpath = strdup(defaultFontPath); + ptr->file_fontpath = xnfstrdup(defaultFontPath); return ptr; } @@ -446,8 +446,8 @@ configureMonitorSection(int screennum) XNFasprintf(&tmp, "Monitor%d", screennum); ptr->mon_identifier = tmp; - ptr->mon_vendor = strdup("Monitor Vendor"); - ptr->mon_modelname = strdup("Monitor Model"); + ptr->mon_vendor = xnfstrdup("Monitor Vendor"); + ptr->mon_modelname = xnfstrdup("Monitor Model"); return ptr; } @@ -491,7 +491,7 @@ configureDDCMonitorSection(int screennum) XNFasprintf(&tmp, "Monitor%d", screennum); ptr->mon_identifier = tmp; - ptr->mon_vendor = strdup(ConfiguredMonitor->vendor.name); + ptr->mon_vendor = xnfstrdup(ConfiguredMonitor->vendor.name); XNFasprintf(&ptr->mon_modelname, "%x", ConfiguredMonitor->vendor.prod_id); /* features in centimetres, we want millimetres */ @@ -529,7 +529,7 @@ configureDDCMonitorSection(int screennum) if (ConfiguredMonitor->features.dpms) { ptr->mon_option_lst = - xf86addNewOption(ptr->mon_option_lst, strdup("DPMS"), NULL); + xf86addNewOption(ptr->mon_option_lst, xnfstrdup("DPMS"), NULL); } return ptr; diff --git a/xorg-server/hw/xfree86/common/xf86Xinput.c b/xorg-server/hw/xfree86/common/xf86Xinput.c index 3a0151374..f6f2b90dd 100644 --- a/xorg-server/hw/xfree86/common/xf86Xinput.c +++ b/xorg-server/hw/xfree86/common/xf86Xinput.c @@ -539,7 +539,7 @@ MatchAttrToken(const char *attr, struct xorg_list *patterns, * match. Each list entry is a separate Match line of the same type. */ xorg_list_for_each_entry(group, patterns, entry) { - const char *const *cur; + char *const *cur; Bool match = FALSE; for (cur = group->values; *cur; cur++) @@ -598,7 +598,7 @@ InputClassMatches(const XF86ConfInputClassPtr iclass, const InputInfoPtr idev, * See if any of the device's tags match any of the MatchTag tokens. */ if (!xorg_list_is_empty(&iclass->match_tag)) { - const char *const *tag; + char *const *tag; Bool match; if (!attrs->tags) diff --git a/xorg-server/hw/xfree86/common/xf86Xinput.h b/xorg-server/hw/xfree86/common/xf86Xinput.h index f94261a01..b6d125128 100644 --- a/xorg-server/hw/xfree86/common/xf86Xinput.h +++ b/xorg-server/hw/xfree86/common/xf86Xinput.h @@ -82,8 +82,8 @@ typedef struct _InputDriverRec { typedef struct _InputInfoRec { struct _InputInfoRec *next; - const char *name; - const char *driver; + char *name; + char *driver; int flags; diff --git a/xorg-server/hw/xfree86/os-support/linux/lnx_video.c b/xorg-server/hw/xfree86/os-support/linux/lnx_video.c index 824003d26..47f5abc2c 100644 --- a/xorg-server/hw/xfree86/os-support/linux/lnx_video.c +++ b/xorg-server/hw/xfree86/os-support/linux/lnx_video.c @@ -204,7 +204,7 @@ mtrr_cull_wc_region(int screenNum, unsigned long base, unsigned long size, xf86DrvMsgVerb(screenNum, X_WARNING, 0, "Failed to remove MMIO " "write-combining range (0x%lx,0x%lx)\n", - gent.base, (unsigned long) gent.size); + (unsigned long)gent.base, (unsigned long) gent.size); } } return wcreturn; diff --git a/xorg-server/hw/xfree86/parser/InputClass.c b/xorg-server/hw/xfree86/parser/InputClass.c index 24a124691..c2fbd22a7 100644 --- a/xorg-server/hw/xfree86/parser/InputClass.c +++ b/xorg-server/hw/xfree86/parser/InputClass.c @@ -63,7 +63,7 @@ xf86ConfigSymTabRec InputClassTab[] = { #define TOKEN_SEP "|" static void -add_group_entry(struct xorg_list *head, const char **values) +add_group_entry(struct xorg_list *head, char **values) { xf86MatchGroup *group; @@ -256,7 +256,7 @@ void xf86printInputClassSection(FILE * cf, XF86ConfInputClassPtr ptr) { const xf86MatchGroup *group; - const char *const *cur; + char *const *cur; while (ptr) { fprintf(cf, "Section \"InputClass\"\n"); @@ -362,7 +362,7 @@ xf86freeInputClassList(XF86ConfInputClassPtr ptr) while (ptr) { xf86MatchGroup *group, *next; - const char **list; + char **list; TestFree(ptr->identifier); TestFree(ptr->driver); @@ -370,55 +370,55 @@ xf86freeInputClassList(XF86ConfInputClassPtr ptr) xorg_list_for_each_entry_safe(group, next, &ptr->match_product, entry) { xorg_list_del(&group->entry); for (list = group->values; *list; list++) - free((void *) *list); + free(*list); free(group); } xorg_list_for_each_entry_safe(group, next, &ptr->match_vendor, entry) { xorg_list_del(&group->entry); for (list = group->values; *list; list++) - free((void *) *list); + free(*list); free(group); } xorg_list_for_each_entry_safe(group, next, &ptr->match_device, entry) { xorg_list_del(&group->entry); for (list = group->values; *list; list++) - free((void *) *list); + free(*list); free(group); } xorg_list_for_each_entry_safe(group, next, &ptr->match_os, entry) { xorg_list_del(&group->entry); for (list = group->values; *list; list++) - free((void *) *list); + free(*list); free(group); } xorg_list_for_each_entry_safe(group, next, &ptr->match_pnpid, entry) { xorg_list_del(&group->entry); for (list = group->values; *list; list++) - free((void *) *list); + free(*list); free(group); } xorg_list_for_each_entry_safe(group, next, &ptr->match_usbid, entry) { xorg_list_del(&group->entry); for (list = group->values; *list; list++) - free((void *) *list); + free(*list); free(group); } xorg_list_for_each_entry_safe(group, next, &ptr->match_driver, entry) { xorg_list_del(&group->entry); for (list = group->values; *list; list++) - free((void *) *list); + free(*list); free(group); } xorg_list_for_each_entry_safe(group, next, &ptr->match_tag, entry) { xorg_list_del(&group->entry); for (list = group->values; *list; list++) - free((void *) *list); + free(*list); free(group); } xorg_list_for_each_entry_safe(group, next, &ptr->match_layout, entry) { xorg_list_del(&group->entry); for (list = group->values; *list; list++) - free((void *) *list); + free(*list); free(group); } diff --git a/xorg-server/hw/xfree86/parser/xf86Parser.h b/xorg-server/hw/xfree86/parser/xf86Parser.h index 83607f26c..8f855ac09 100644 --- a/xorg-server/hw/xfree86/parser/xf86Parser.h +++ b/xorg-server/hw/xfree86/parser/xf86Parser.h @@ -279,8 +279,8 @@ typedef struct { typedef struct { GenericListRec list; - const char *inp_identifier; - const char *inp_driver; + char *inp_identifier; + char *inp_driver; XF86OptionPtr inp_option_lst; char *inp_comment; } XF86ConfInputRec, *XF86ConfInputPtr; @@ -288,7 +288,7 @@ typedef struct { typedef struct { GenericListRec list; XF86ConfInputPtr iref_inputdev; - const char *iref_inputdev_str; + char *iref_inputdev_str; XF86OptionPtr iref_option_lst; } XF86ConfInputrefRec, *XF86ConfInputrefPtr; @@ -299,13 +299,13 @@ typedef struct { typedef struct { struct xorg_list entry; - const char **values; + char **values; } xf86MatchGroup; typedef struct { GenericListRec list; char *identifier; - const char *driver; + char *driver; struct xorg_list match_product; struct xorg_list match_vendor; struct xorg_list match_device; diff --git a/xorg-server/hw/xquartz/quartzCocoa.m b/xorg-server/hw/xquartz/quartzCocoa.m index db2b3cfd6..d21fb7d91 100644 --- a/xorg-server/hw/xquartz/quartzCocoa.m +++ b/xorg-server/hw/xquartz/quartzCocoa.m @@ -48,9 +48,9 @@ * Clean out any autoreleased objects. */ void -QuartzBlockHandler(pointer blockData, +QuartzBlockHandler(void *blockData, OSTimePtr pTimeout, - pointer pReadmask) + void *pReadmask) { static NSAutoreleasePool *aPool = nil; @@ -62,9 +62,9 @@ QuartzBlockHandler(pointer blockData, * QuartzWakeupHandler */ void -QuartzWakeupHandler(pointer blockData, +QuartzWakeupHandler(void *blockData, int result, - pointer pReadmask) + void *pReadmask) { // nothing here } diff --git a/xorg-server/hw/xwin/InitOutput.c b/xorg-server/hw/xwin/InitOutput.c index b05ca2736..9413350e6 100644 --- a/xorg-server/hw/xwin/InitOutput.c +++ b/xorg-server/hw/xwin/InitOutput.c @@ -58,8 +58,11 @@ typedef WINAPI HRESULT(*SHGETFOLDERPATHPROC) (HWND hwndOwner, HANDLE hToken, DWORD dwFlags, LPTSTR pszPath); #endif - #include "glx_extinit.h" +#ifdef XWIN_GLX_WINDOWS +#include "glx/glwindows.h" +#endif + /* * References to external symbols */ diff --git a/xorg-server/hw/xwin/glx/gen_gl_wrappers.py b/xorg-server/hw/xwin/glx/gen_gl_wrappers.py index 683b9d903..cdbba638a 100644 --- a/xorg-server/hw/xwin/glx/gen_gl_wrappers.py +++ b/xorg-server/hw/xwin/glx/gen_gl_wrappers.py @@ -43,35 +43,18 @@ thunkdefs=False staticwrappers=False nodebug=False -#exclude base WGL API -WinGDI={key: 1 for key in [ - "wglCopyContext" - ,"wglCreateContext" - ,"wglCreateLayerContext" - ,"wglDeleteContext" - ,"wglGetCurrentContext" - ,"wglGetCurrentDC" - ,"wglGetProcAddress" - ,"wglMakeCurrent" - ,"wglShareLists" - ,"wglUseFontBitmapsA" - ,"wglUseFontBitmapsW" - ,"wglUseFontBitmaps" - ,"SwapBuffers" - ,"wglUseFontOutlinesA" - ,"wglUseFontOutlinesW" - ,"wglUseFontOutlines" - ,"wglDescribeLayerPlane" - ,"wglSetLayerPaletteEntries" - ,"wglGetLayerPaletteEntries" - ,"wglRealizeLayerPalette" - ,"wglSwapLayerBuffers" - ,"wglSwapMultipleBuffers" - ,"ChoosePixelFormat" - ,"DescribePixelFormat" - ,"GetEnhMetaFilePixelFormat" - ,"GetPixelFormat" - ,"SetPixelFormat" +# list of WGL extension functions we use +used_wgl_ext_fns = {key: 1 for key in [ + "wglSwapIntervalEXT", + "wglGetExtensionsStringARB", + "wglDestroyPbufferARB", + "wglGetPbufferDCARB", + "wglReleasePbufferDCARB", + "wglCreatePbufferARB", + "wglMakeContextCurrentARB", + "wglChoosePixelFormatARB", + "wglGetPixelFormatAttribivARB", + "wglGetPixelFormatAttribivARB" ]} if __name__ == '__main__': @@ -162,7 +145,7 @@ class PreResolveOutputGenerator(OutputGenerator): def genCmd(self, cmd, name): OutputGenerator.genCmd(self, cmd, name) - if name in WinGDI: + if prefix == 'wgl' and not name in used_wgl_ext_fns: return self.outFile.write('RESOLVE_DECL(PFN' + name.upper() + 'PROC);\n') @@ -190,7 +173,7 @@ class WrapperOutputGenerator(OutputGenerator): def genCmd(self, cmd, name): OutputGenerator.genCmd(self, cmd, name) - if name in WinGDI: + if prefix == 'wgl' and not name in used_wgl_ext_fns: return proto=noneStr(cmd.elem.find('proto')) diff --git a/xorg-server/hw/xwin/glx/indirect.c b/xorg-server/hw/xwin/glx/indirect.c index f130651fb..690611428 100644 --- a/xorg-server/hw/xwin/glx/indirect.c +++ b/xorg-server/hw/xwin/glx/indirect.c @@ -1613,7 +1613,7 @@ glxWinCreateContext(__GLXscreen * screen, glxWinReleaseTexImage }; - context = (__GLXWinContext *) calloc(1, sizeof(__GLXWinContext)); + context = calloc(1, sizeof(__GLXWinContext)); if (!context) return NULL; diff --git a/xorg-server/hw/xwin/win.h b/xorg-server/hw/xwin/win.h index 0adb227c0..80fc504f6 100644 --- a/xorg-server/hw/xwin/win.h +++ b/xorg-server/hw/xwin/win.h @@ -751,7 +751,7 @@ Bool winAllocatePrivates(ScreenPtr pScreen); Bool - winInitCmapPrivates(ColormapPtr pCmap, int index); + winInitCmapPrivates(ColormapPtr pCmap, int i); Bool winAllocateCmapPrivates(ColormapPtr pCmap); @@ -1056,12 +1056,12 @@ Bool winScreenInit(ScreenPtr pScreen, int argc, char **argv); Bool - winFinishScreenInitFB(int index, ScreenPtr pScreen, int argc, char **argv); + winFinishScreenInitFB(int i, ScreenPtr pScreen, int argc, char **argv); #if defined(XWIN_NATIVEGDI) Bool -winFinishScreenInitNativeGDI(int index, +winFinishScreenInitNativeGDI(int i, ScreenPtr pScreen, int argc, char **argv); #endif diff --git a/xorg-server/hw/xwin/winallpriv.c b/xorg-server/hw/xwin/winallpriv.c index cc3b3d1ba..629af92c9 100644 --- a/xorg-server/hw/xwin/winallpriv.c +++ b/xorg-server/hw/xwin/winallpriv.c @@ -58,7 +58,7 @@ winAllocatePrivates(ScreenPtr pScreen) } /* Allocate memory for the screen private structure */ - pScreenPriv = (winPrivScreenPtr) malloc(sizeof(winPrivScreenRec)); + pScreenPriv = malloc(sizeof(winPrivScreenRec)); if (!pScreenPriv) { ErrorF("winAllocateScreenPrivates - malloc () failed\n"); return FALSE; @@ -150,7 +150,7 @@ winAllocateCmapPrivates(ColormapPtr pCmap) } /* Allocate memory for our private structure */ - pCmapPriv = (winPrivCmapPtr) malloc(sizeof(winPrivCmapRec)); + pCmapPriv = malloc(sizeof(winPrivCmapRec)); if (!pCmapPriv) { ErrorF("winAllocateCmapPrivates - malloc () failed\n"); return FALSE; diff --git a/xorg-server/hw/xwin/winclipboardinit.c b/xorg-server/hw/xwin/winclipboardinit.c index 304e6df9f..157006dab 100644 --- a/xorg-server/hw/xwin/winclipboardinit.c +++ b/xorg-server/hw/xwin/winclipboardinit.c @@ -77,7 +77,7 @@ winInitClipboard(void) } /* - * Create the Windows window that we use to recieve Windows messages + * Create the Windows window that we use to receive Windows messages */ HWND diff --git a/xorg-server/hw/xwin/winclipboardxevents.c b/xorg-server/hw/xwin/winclipboardxevents.c index 226c3f055..7d3c30e85 100644 --- a/xorg-server/hw/xwin/winclipboardxevents.c +++ b/xorg-server/hw/xwin/winclipboardxevents.c @@ -248,7 +248,7 @@ winClipboardFlushXEvents(HWND hwnd, (LPCWSTR) pszGlobalData, -1, NULL, 0, NULL, NULL); /* NOTE: iConvertDataLen includes space for null terminator */ - pszConvertData = (char *) malloc(iConvertDataLen); + pszConvertData = malloc(iConvertDataLen); WideCharToMultiByte(CP_UTF8, 0, (LPCWSTR) pszGlobalData, @@ -581,8 +581,7 @@ winClipboardFlushXEvents(HWND hwnd, pszReturnData, -1, NULL, 0); /* Allocate memory for the Unicode string */ - pwszUnicodeStr - = (wchar_t *) malloc(sizeof(wchar_t) * (iUnicodeLen + 1)); + pwszUnicodeStr = malloc(sizeof(wchar_t) * (iUnicodeLen + 1)); if (!pwszUnicodeStr) { ErrorF("winClipboardFlushXEvents - SelectionNotify " "malloc failed for pwszUnicodeStr, aborting.\n"); diff --git a/xorg-server/hw/xwin/wincursor.c b/xorg-server/hw/xwin/wincursor.c index a35336a34..f3ac0f7ae 100644 --- a/xorg-server/hw/xwin/wincursor.c +++ b/xorg-server/hw/xwin/wincursor.c @@ -255,10 +255,8 @@ winLoadCursor(ScreenPtr pScreen, CursorPtr pCursor, int screen) bi.bV4BlueMask = 0x000000FF; bi.bV4AlphaMask = 0xFF000000; - lpBits = - (uint32_t *) calloc(pScreenPriv->cursor.sm_cx * - pScreenPriv->cursor.sm_cy, - sizeof(uint32_t)); + lpBits = calloc(pScreenPriv->cursor.sm_cx * pScreenPriv->cursor.sm_cy, + sizeof(uint32_t)); if (lpBits) { int y; @@ -302,9 +300,7 @@ winLoadCursor(ScreenPtr pScreen, CursorPtr pCursor, int screen) pbmiColors[2].rgbBlue = pCursor->foreBlue >> 8; pbmiColors[2].rgbReserved = 0; - lpBits = - (uint32_t *) calloc(pScreenPriv->cursor.sm_cx * - pScreenPriv->cursor.sm_cy, sizeof(char)); + lpBits = calloc(pScreenPriv->cursor.sm_cx * pScreenPriv->cursor.sm_cy, 1); pCur = (unsigned char *) lpBits; if (lpBits) { diff --git a/xorg-server/hw/xwin/winkeybd.c b/xorg-server/hw/xwin/winkeybd.c index b6b208612..3a75ab268 100644 --- a/xorg-server/hw/xwin/winkeybd.c +++ b/xorg-server/hw/xwin/winkeybd.c @@ -128,7 +128,7 @@ winKeybdBell(int iPercent, DeviceIntPtr pDeviceInt, void *pCtrl, int iClass) * sound on systems with a sound card or it will beep the PC speaker * on systems that do not have a sound card. */ - MessageBeep(MB_OK); + if (iPercent > 0) MessageBeep(MB_OK); } /* Change some keyboard configuration parameters */ diff --git a/xorg-server/hw/xwin/winmonitors.h b/xorg-server/hw/xwin/winmonitors.h index 8201e47f4..5fe3ecd52 100644 --- a/xorg-server/hw/xwin/winmonitors.h +++ b/xorg-server/hw/xwin/winmonitors.h @@ -40,4 +40,4 @@ struct GetMonitorInfoData { HMONITOR monitorHandle; }; -Bool QueryMonitor(int index, struct GetMonitorInfoData *data); +Bool QueryMonitor(int i, struct GetMonitorInfoData *data); diff --git a/xorg-server/hw/xwin/winmultiwindowwm.c b/xorg-server/hw/xwin/winmultiwindowwm.c index 1dd8ba5b3..9f12521bc 100644 --- a/xorg-server/hw/xwin/winmultiwindowwm.c +++ b/xorg-server/hw/xwin/winmultiwindowwm.c @@ -111,6 +111,7 @@ typedef struct _WMInfo { WMMsgQueueRec wmMsgQueue; Atom atmWmProtos; Atom atmWmDelete; + Atom atmWmTakeFocus; Atom atmPrivMap; Bool fAllowOtherWM; } WMInfoRec, *WMInfoPtr; @@ -405,7 +406,7 @@ Xutf8TextPropertyToString(Display * pDisplay, XTextProperty * xtp) for (i = 0; i < nNum; i++) iLen += strlen(ppList[i]); - pszReturnData = (char *) malloc(iLen + 1); + pszReturnData = malloc(iLen + 1); pszReturnData[0] = '\0'; for (i = 0; i < nNum; i++) strcat(pszReturnData, ppList[i]); @@ -413,7 +414,7 @@ Xutf8TextPropertyToString(Display * pDisplay, XTextProperty * xtp) XFreeStringList(ppList); } else { - pszReturnData = (char *) malloc(1); + pszReturnData = malloc(1); pszReturnData[0] = '\0'; } @@ -453,6 +454,27 @@ GetWindowName(Display * pDisplay, Window iWin, char **ppWindowName) } /* + * Does the client support the specified WM_PROTOCOLS protocol? + */ + +static Bool +IsWmProtocolAvailable(Display * pDisplay, Window iWindow, Atom atmProtocol) +{ + int i, n, found = 0; + Atom *protocols; + + if (XGetWMProtocols(pDisplay, iWindow, &protocols, &n)) { + for (i = 0; i < n; ++i) + if (protocols[i] == atmProtocol) + ++found; + + XFree(protocols); + } + + return found > 0; +} + +/* * Send a message to the X server from the WM thread */ @@ -537,7 +559,7 @@ UpdateName(WMInfoPtr pWMInfo, Window iWindow) int iLen = MultiByteToWideChar(CP_UTF8, 0, pszWindowName, -1, NULL, 0); wchar_t *pwszWideWindowName = - (wchar_t *) malloc(sizeof(wchar_t) * (iLen + 1)); + malloc(sizeof(wchar_t)*(iLen + 1)); MultiByteToWideChar(CP_UTF8, 0, pszWindowName, -1, pwszWideWindowName, iLen); @@ -805,21 +827,10 @@ winMultiWindowWMProc(void *pArg) ErrorF("\tWM_WM_KILL\n"); #endif { - int i, n, found = 0; - Atom *protocols; - - /* --- */ - if (XGetWMProtocols(pWMInfo->pDisplay, - pNode->msg.iWindow, &protocols, &n)) { - for (i = 0; i < n; ++i) - if (protocols[i] == pWMInfo->atmWmDelete) - ++found; - - XFree(protocols); - } - /* --- */ - if (found) + if (IsWmProtocolAvailable(pWMInfo->pDisplay, + pNode->msg.iWindow, + pWMInfo->atmWmDelete)) SendXMessage(pWMInfo->pDisplay, pNode->msg.iWindow, pWMInfo->atmWmProtos, pWMInfo->atmWmDelete); @@ -832,11 +843,39 @@ winMultiWindowWMProc(void *pArg) #if CYGMULTIWINDOW_DEBUG ErrorF("\tWM_WM_ACTIVATE\n"); #endif - /* Set the input focus */ - XSetInputFocus(pWMInfo->pDisplay, - pNode->msg.iWindow, - RevertToPointerRoot, CurrentTime); + + /* + ICCCM 4.1.7 is pretty opaque, but it appears that the rules are + actually quite simple: + -- the WM_HINTS input field determines whether the WM should call + XSetInputFocus() + -- independently, the WM_TAKE_FOCUS protocol determines whether + the WM should send a WM_TAKE_FOCUS ClientMessage. + */ + { + Bool neverFocus = FALSE; + XWMHints *hints = XGetWMHints(pWMInfo->pDisplay, pNode->msg.iWindow); + + if (hints) { + if (hints->flags & InputHint) + neverFocus = !hints->input; + XFree(hints); + } + + if (!neverFocus) + XSetInputFocus(pWMInfo->pDisplay, + pNode->msg.iWindow, + RevertToPointerRoot, CurrentTime); + + if (IsWmProtocolAvailable(pWMInfo->pDisplay, + pNode->msg.iWindow, + pWMInfo->atmWmTakeFocus)) + SendXMessage(pWMInfo->pDisplay, + pNode->msg.iWindow, + pWMInfo->atmWmProtos, pWMInfo->atmWmTakeFocus); + + } break; case WM_WM_NAME_EVENT: @@ -1237,9 +1276,9 @@ winInitWM(void **ppWMInfo, pthread_mutex_t * ppmServerStarted, int dwScreen, HWND hwndScreen, BOOL allowOtherWM) { - WMProcArgPtr pArg = (WMProcArgPtr) malloc(sizeof(WMProcArgRec)); - WMInfoPtr pWMInfo = (WMInfoPtr) malloc(sizeof(WMInfoRec)); - XMsgProcArgPtr pXMsgArg = (XMsgProcArgPtr) malloc(sizeof(XMsgProcArgRec)); + WMProcArgPtr pArg = malloc(sizeof(WMProcArgRec)); + WMInfoPtr pWMInfo = malloc(sizeof(WMInfoRec)); + XMsgProcArgPtr pXMsgArg = malloc(sizeof(XMsgProcArgRec)); /* Bail if the input parameters are bad */ if (pArg == NULL || pWMInfo == NULL || pXMsgArg == NULL) { @@ -1404,6 +1443,8 @@ winInitMultiWindowWM(WMInfoPtr pWMInfo, WMProcArgPtr pProcArg) "WM_PROTOCOLS", False); pWMInfo->atmWmDelete = XInternAtom(pWMInfo->pDisplay, "WM_DELETE_WINDOW", False); + pWMInfo->atmWmTakeFocus = XInternAtom(pWMInfo->pDisplay, + "WM_TAKE_FOCUS", False); pWMInfo->atmPrivMap = XInternAtom(pWMInfo->pDisplay, WINDOWSWM_NATIVE_HWND, False); @@ -1432,7 +1473,7 @@ winSendMessageToWM(void *pWMInfo, winWMMessagePtr pMsg) ErrorF("winSendMessageToWM ()\n"); #endif - pNode = (WMMsgNodePtr) malloc(sizeof(WMMsgNodeRec)); + pNode = malloc(sizeof(WMMsgNodeRec)); if (pNode != NULL) { memcpy(&pNode->msg, pMsg, sizeof(winWMMessageRec)); PushMessage(&((WMInfoPtr) pWMInfo)->wmMsgQueue, pNode); diff --git a/xorg-server/hw/xwin/winnativegdi.c b/xorg-server/hw/xwin/winnativegdi.c index a2a5123a0..1859698a0 100644 --- a/xorg-server/hw/xwin/winnativegdi.c +++ b/xorg-server/hw/xwin/winnativegdi.c @@ -344,8 +344,7 @@ winCreateDIBNativeGDI(int iWidth, int iHeight, int iDepth, } /* Allocate bitmap info header */ - pbmih = (BITMAPINFOHEADER *) malloc(sizeof(BITMAPINFOHEADER) - + 256 * sizeof(RGBQUAD)); + pbmih = malloc(sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD)); if (pbmih == NULL) { ErrorF("winCreateDIBNativeGDI - malloc () failed\n"); return FALSE; diff --git a/xorg-server/hw/xwin/winprefslex.l b/xorg-server/hw/xwin/winprefslex.l index 15f707766..fd13edc05 100644 --- a/xorg-server/hw/xwin/winprefslex.l +++ b/xorg-server/hw/xwin/winprefslex.l @@ -45,7 +45,7 @@ extern void ErrorF (const char* /*f*/, ...); static char *makestr(char *str) { char *ptr; - ptr = (char*)malloc (strlen(str)+1); + ptr = malloc(strlen(str)+1); if (!ptr) { ErrorF ("winMultiWindowLex:makestr() out of memory\n"); @@ -90,6 +90,7 @@ ALWAYSONTOP { return ALWAYSONTOP; } DEBUG { return DEBUGOUTPUT; } RELOAD { return RELOAD; } TRAYICON { return TRAYICON; } +FORCEEXIT { return FORCEEXIT; } SILENTEXIT { return SILENTEXIT; } "{" { return LB; } "}" { return RB; } diff --git a/xorg-server/hw/xwin/winprefsyacc.y b/xorg-server/hw/xwin/winprefsyacc.y index 3b376b3e7..683fc44ca 100644 --- a/xorg-server/hw/xwin/winprefsyacc.y +++ b/xorg-server/hw/xwin/winprefsyacc.y @@ -311,10 +311,9 @@ static void AddMenuLine (char *text, MENUCOMMANDTYPE cmd, char *param) { if (menu.menuItem==NULL) - menu.menuItem = (MENUITEM*)malloc(sizeof(MENUITEM)); + menu.menuItem = malloc(sizeof(MENUITEM)); else - menu.menuItem = (MENUITEM*) - realloc(menu.menuItem, sizeof(MENUITEM)*(menu.menuItems+1)); + menu.menuItem = realloc(menu.menuItem, sizeof(MENUITEM)*(menu.menuItems+1)); strncpy (menu.menuItem[menu.menuItems].text, text, MENU_MAX); menu.menuItem[menu.menuItems].text[MENU_MAX] = 0; @@ -339,10 +338,9 @@ CloseMenu (void) } if (pref.menuItems) - pref.menu = (MENUPARSED*) - realloc (pref.menu, (pref.menuItems+1)*sizeof(MENUPARSED)); + pref.menu = realloc (pref.menu, (pref.menuItems+1)*sizeof(MENUPARSED)); else - pref.menu = (MENUPARSED*)malloc (sizeof(MENUPARSED)); + pref.menu = malloc (sizeof(MENUPARSED)); memcpy (pref.menu+pref.menuItems, &menu, sizeof(MENUPARSED)); pref.menuItems++; @@ -365,10 +363,9 @@ static void AddIconLine (char *matchstr, char *iconfile) { if (pref.icon==NULL) - pref.icon = (ICONITEM*)malloc(sizeof(ICONITEM)); + pref.icon = malloc(sizeof(ICONITEM)); else - pref.icon = (ICONITEM*) - realloc(pref.icon, sizeof(ICONITEM)*(pref.iconItems+1)); + pref.icon = realloc(pref.icon, sizeof(ICONITEM)*(pref.iconItems+1)); strncpy(pref.icon[pref.iconItems].match, matchstr, MENU_MAX); pref.icon[pref.iconItems].match[MENU_MAX] = 0; @@ -401,10 +398,9 @@ static void AddStyleLine (char *matchstr, unsigned long style) { if (pref.style==NULL) - pref.style = (STYLEITEM*)malloc(sizeof(STYLEITEM)); + pref.style = malloc(sizeof(STYLEITEM)); else - pref.style = (STYLEITEM*) - realloc(pref.style, sizeof(STYLEITEM)*(pref.styleItems+1)); + pref.style = realloc(pref.style, sizeof(STYLEITEM)*(pref.styleItems+1)); strncpy(pref.style[pref.styleItems].match, matchstr, MENU_MAX); pref.style[pref.styleItems].match[MENU_MAX] = 0; @@ -434,10 +430,9 @@ static void AddSysMenuLine (char *matchstr, char *menuname, int pos) { if (pref.sysMenu==NULL) - pref.sysMenu = (SYSMENUITEM*)malloc(sizeof(SYSMENUITEM)); + pref.sysMenu = malloc(sizeof(SYSMENUITEM)); else - pref.sysMenu = (SYSMENUITEM*) - realloc(pref.sysMenu, sizeof(SYSMENUITEM)*(pref.sysMenuItems+1)); + pref.sysMenu = realloc(pref.sysMenu, sizeof(SYSMENUITEM)*(pref.sysMenuItems+1)); strncpy (pref.sysMenu[pref.sysMenuItems].match, matchstr, MENU_MAX); pref.sysMenu[pref.sysMenuItems].match[MENU_MAX] = 0; diff --git a/xorg-server/hw/xwin/winshadgdi.c b/xorg-server/hw/xwin/winshadgdi.c index 2e3c64ce9..5c815eb73 100644 --- a/xorg-server/hw/xwin/winshadgdi.c +++ b/xorg-server/hw/xwin/winshadgdi.c @@ -184,8 +184,7 @@ winQueryRGBBitsAndMasks(ScreenPtr pScreen) } /* Allocate a bitmap header and color table */ - pbmih = (BITMAPINFOHEADER *) malloc(sizeof(BITMAPINFOHEADER) - + 256 * sizeof(RGBQUAD)); + pbmih = malloc(sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD)); if (pbmih == NULL) { ErrorF("winQueryRGBBitsAndMasks - malloc failed\n"); return FALSE; @@ -545,8 +544,7 @@ winInitScreenShadowGDI(ScreenPtr pScreen) pScreenPriv->hdcShadow = CreateCompatibleDC(pScreenPriv->hdcScreen); /* Allocate bitmap info header */ - pScreenPriv->pbmih = (BITMAPINFOHEADER *) malloc(sizeof(BITMAPINFOHEADER) - + 256 * sizeof(RGBQUAD)); + pScreenPriv->pbmih = malloc(sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD)); if (pScreenPriv->pbmih == NULL) { ErrorF("winInitScreenShadowGDI - malloc () failed\n"); return FALSE; diff --git a/xorg-server/hw/xwin/winwin32rootless.c b/xorg-server/hw/xwin/winwin32rootless.c index 724976a84..0b62696f3 100644 --- a/xorg-server/hw/xwin/winwin32rootless.c +++ b/xorg-server/hw/xwin/winwin32rootless.c @@ -184,8 +184,8 @@ InitWin32RootlessEngine(win32RootlessWindowPtr pRLWinPriv) /* Allocate bitmap info header */ pRLWinPriv->pbmihShadow = - (BITMAPINFOHEADER *) malloc(sizeof(BITMAPINFOHEADER) - + 256 * sizeof(RGBQUAD)); + malloc(sizeof(BITMAPINFOHEADER) + + 256 * sizeof(RGBQUAD)); if (pRLWinPriv->pbmihShadow == NULL) { ErrorF("InitWin32RootlessEngine - malloc () failed\n"); return; @@ -214,8 +214,7 @@ winMWExtWMCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen, newX, newY, pFrame->width, pFrame->height); #endif - pRLWinPriv = - (win32RootlessWindowPtr) malloc(sizeof(win32RootlessWindowRec)); + pRLWinPriv = malloc(sizeof(win32RootlessWindowRec)); pRLWinPriv->pFrame = pFrame; pRLWinPriv->pfb = NULL; pRLWinPriv->hbmpShadow = NULL; diff --git a/xorg-server/hw/xwin/winwindow.c b/xorg-server/hw/xwin/winwindow.c index 759aa5eee..8c1c28f2a 100644 --- a/xorg-server/hw/xwin/winwindow.c +++ b/xorg-server/hw/xwin/winwindow.c @@ -155,7 +155,7 @@ winCopyWindowNativeGDI(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) nbox = RegionNumRects(prgnDst); /* Allocate source points for each box */ - if (!(pptSrc = (DDXPointPtr) malloc(nbox * sizeof(DDXPointRec)))) + if (!(pptSrc = malloc(nbox * sizeof(DDXPointRec)))) return; /* Set an iterator pointer */ diff --git a/xorg-server/hw/xwin/winwindowswm.c b/xorg-server/hw/xwin/winwindowswm.c index c3503dbf9..2805ff7ce 100644 --- a/xorg-server/hw/xwin/winwindowswm.c +++ b/xorg-server/hw/xwin/winwindowswm.c @@ -162,7 +162,7 @@ ProcWindowsWMSelectInput(ClientPtr client) } /* build the entry */ - pNewEvent = (WMEventPtr) malloc(sizeof(WMEventRec)); + pNewEvent = malloc(sizeof(WMEventRec)); if (!pNewEvent) return BadAlloc; pNewEvent->next = 0; @@ -183,7 +183,7 @@ ProcWindowsWMSelectInput(ClientPtr client) * done through the resource database. */ if (!pHead) { - pHead = (WMEventPtr *) malloc(sizeof(WMEventPtr)); + pHead = malloc(sizeof(WMEventPtr)); if (!pHead || !AddResource(eventResource, eventResourceType, (void *) pHead)) { diff --git a/xorg-server/include/eventstr.h b/xorg-server/include/eventstr.h index 3950584d5..cce903d04 100644 --- a/xorg-server/include/eventstr.h +++ b/xorg-server/include/eventstr.h @@ -176,7 +176,7 @@ struct _DeviceChangedEvent { struct { uint32_t min; /**< Minimum value */ uint32_t max; /**< Maximum value */ - double value; /**< Current value */; + double value; /**< Current value */ /* FIXME: frac parts of min/max */ uint32_t resolution; /**< Resolution counts/m */ uint8_t mode; /**< Relative or Absolute */ diff --git a/xorg-server/include/input.h b/xorg-server/include/input.h index 455963f6a..93c45107d 100644 --- a/xorg-server/include/input.h +++ b/xorg-server/include/input.h @@ -95,8 +95,8 @@ SOFTWARE. #define NO_AXIS_LIMITS -1 -#define MAP_LENGTH 256 -#define DOWN_LENGTH 32 /* 256/8 => number of bytes to hold 256 bits */ +#define MAP_LENGTH MAX_BUTTONS +#define DOWN_LENGTH (MAX_BUTTONS/8) /* 256/8 => number of bytes to hold 256 bits */ #define NullGrab ((GrabPtr)NULL) #define PointerRootWin ((WindowPtr)PointerRoot) #define NoneWin ((WindowPtr)None) @@ -221,12 +221,12 @@ typedef struct _InputOption InputOption; typedef struct _XI2Mask XI2Mask; typedef struct _InputAttributes { - const char *product; - const char *vendor; - const char *device; - const char *pnp_id; - const char *usb_id; - const char **tags; /* null-terminated */ + char *product; + char *vendor; + char *device; + char *pnp_id; + char *usb_id; + char **tags; /* null-terminated */ uint32_t flags; } InputAttributes; diff --git a/xorg-server/include/inputstr.h b/xorg-server/include/inputstr.h index dfcf7c383..f6cfb049d 100644 --- a/xorg-server/include/inputstr.h +++ b/xorg-server/include/inputstr.h @@ -542,7 +542,7 @@ typedef struct _DeviceIntRec { GrabInfoRec deviceGrab; /* grab on the device */ int type; /* MASTER_POINTER, MASTER_KEYBOARD, SLAVE */ Atom xinput_type; - const char *name; + char *name; int id; KeyClassPtr key; ValuatorClassPtr valuator; diff --git a/xorg-server/include/misc.h b/xorg-server/include/misc.h index 165d42e85..17de71041 100644 --- a/xorg-server/include/misc.h +++ b/xorg-server/include/misc.h @@ -246,7 +246,7 @@ padding_for_int32(const int bytes) } -extern const char **xstrtokenize(const char *str, const char *separators); +extern char **xstrtokenize(const char *str, const char *separators); extern void FormatInt64(int64_t num, char *string); extern void FormatUInt64(uint64_t num, char *string); extern void FormatUInt64Hex(uint64_t num, char *string); diff --git a/xorg-server/include/xkbrules.h b/xorg-server/include/xkbrules.h index 956eade0b..ab5b4b266 100644 --- a/xorg-server/include/xkbrules.h +++ b/xorg-server/include/xkbrules.h @@ -30,11 +30,11 @@ /***====================================================================***/ typedef struct _XkbRMLVOSet { - const char *rules; - const char *model; - const char *layout; - const char *variant; - const char *options; + char *rules; + char *model; + char *layout; + char *variant; + char *options; } XkbRMLVOSet; typedef struct _XkbRF_VarDefs { diff --git a/xorg-server/include/xkbsrv.h b/xorg-server/include/xkbsrv.h index 0b9ca06d9..e79979927 100644 --- a/xorg-server/include/xkbsrv.h +++ b/xorg-server/include/xkbsrv.h @@ -738,6 +738,14 @@ extern _X_EXPORT void XkbClearAllLatchesAndLocks(DeviceIntPtr /* dev */ , XkbEventCausePtr /* cause */ ); +extern _X_EXPORT void XkbInitRules(XkbRMLVOSet * /* rmlvo */, + const char * /* rules */, + const char * /* model */, + const char * /* layout */, + const char * /* variant */, + const char * /* options */ + ) ; + extern _X_EXPORT void XkbGetRulesDflts(XkbRMLVOSet * /* rmlvo */ ); diff --git a/xorg-server/mi/mieq.c b/xorg-server/mi/mieq.c index bc7f94523..36aa21357 100644 --- a/xorg-server/mi/mieq.c +++ b/xorg-server/mi/mieq.c @@ -286,7 +286,7 @@ mieqEnqueue(DeviceIntPtr pDev, InternalEvent *e) else if (miEventQueue.dropped % QUEUE_DROP_BACKTRACE_FREQUENCY == 0 && miEventQueue.dropped / QUEUE_DROP_BACKTRACE_FREQUENCY <= QUEUE_DROP_BACKTRACE_MAX) { - ErrorFSigSafe("[mi] EQ overflow continuing. %u events have been " + ErrorFSigSafe("[mi] EQ overflow continuing. %zu events have been " "dropped.\n", miEventQueue.dropped); if (miEventQueue.dropped / QUEUE_DROP_BACKTRACE_FREQUENCY == QUEUE_DROP_BACKTRACE_MAX) { diff --git a/xorg-server/os/log.c b/xorg-server/os/log.c index 8deb81040..38193eed6 100644 --- a/xorg-server/os/log.c +++ b/xorg-server/os/log.c @@ -195,7 +195,9 @@ LogInit(const char *fname, const char *backup) char *logFileName = NULL; if (fname && *fname) { +#if __GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ > 2 #pragma GCC diagnostic ignored "-Wformat-nonliteral" +#endif if (asprintf(&logFileName, fname, display) == -1) FatalError("Cannot allocate space for the log file name\n"); @@ -206,7 +208,9 @@ LogInit(const char *fname, const char *backup) char *suffix; char *oldLog; +#if __GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ > 2 #pragma GCC diagnostic ignored "-Wformat-nonliteral" +#endif if ((asprintf(&suffix, backup, display) == -1) || (asprintf(&oldLog, "%s%s", logFileName, suffix) == -1)) FatalError("Cannot allocate space for the log file name\n"); diff --git a/xorg-server/os/utils.c b/xorg-server/os/utils.c index dc18a67b1..497779b52 100644 --- a/xorg-server/os/utils.c +++ b/xorg-server/os/utils.c @@ -1973,10 +1973,10 @@ CheckUserAuthorization(void) * Tokenize a string into a NULL terminated array of strings. Always returns * an allocated array unless an error occurs. */ -const char ** +char ** xstrtokenize(const char *str, const char *separators) { - const char **list, **nlist; + char **list, **nlist; char *tok, *tmp; unsigned num = 0, n; @@ -2004,7 +2004,7 @@ xstrtokenize(const char *str, const char *separators) error: free(tmp); for (n = 0; n < num; n++) - free((void *) list[n]); + free(list[n]); free(list); return NULL; } diff --git a/xorg-server/randr/rrcrtc.c b/xorg-server/randr/rrcrtc.c index 6e181ba2c..6da698ea0 100644 --- a/xorg-server/randr/rrcrtc.c +++ b/xorg-server/randr/rrcrtc.c @@ -522,9 +522,19 @@ RRCrtcSet(RRCrtcPtr crtc, ScreenPtr pScreen = crtc->pScreen; Bool ret = FALSE; Bool recompute = TRUE; + Bool crtcChanged; + int o; rrScrPriv(pScreen); + crtcChanged = FALSE; + for (o = 0; o < numOutputs; o++) { + if (outputs[o] && outputs[o]->crtc != crtc) { + crtcChanged = TRUE; + break; + } + } + /* See if nothing changed */ if (crtc->mode == mode && crtc->x == x && @@ -532,7 +542,8 @@ RRCrtcSet(RRCrtcPtr crtc, crtc->rotation == rotation && crtc->numOutputs == numOutputs && !memcmp(crtc->outputs, outputs, numOutputs * sizeof(RROutputPtr)) && - !RRCrtcPendingProperties(crtc) && !RRCrtcPendingTransform(crtc)) { + !RRCrtcPendingProperties(crtc) && !RRCrtcPendingTransform(crtc) && + !crtcChanged) { recompute = FALSE; ret = TRUE; } @@ -604,7 +615,6 @@ RRCrtcSet(RRCrtcPtr crtc, #endif } if (ret) { - int o; RRTellChanged(pScreen); diff --git a/xorg-server/test/Makefile.am b/xorg-server/test/Makefile.am index 2852bb3e0..f8aa65950 100644 --- a/xorg-server/test/Makefile.am +++ b/xorg-server/test/Makefile.am @@ -36,7 +36,7 @@ fixes_LDADD=$(TEST_LDADD) xfree86_LDADD=$(TEST_LDADD) touch_LDADD=$(TEST_LDADD) signal_logging_LDADD=$(TEST_LDADD) -hashtabletest_LDADD=$(TEST_LDADD) $(top_srcdir)/Xext/hashtable.c +hashtabletest_LDADD=$(TEST_LDADD) os_LDADD=$(TEST_LDADD) libxservertest_la_LIBADD = $(XSERVER_LIBS) diff --git a/xorg-server/test/input.c b/xorg-server/test/input.c index aaa7a69d3..9b5db8991 100644 --- a/xorg-server/test/input.c +++ b/xorg-server/test/input.c @@ -1101,7 +1101,7 @@ xi_unregister_handlers(void) static void cmp_attr_fields(InputAttributes * attr1, InputAttributes * attr2) { - const char **tags1, **tags2; + char **tags1, **tags2; assert(attr1 && attr2); assert(attr1 != attr2); @@ -1180,50 +1180,54 @@ cmp_attr_fields(InputAttributes * attr1, InputAttributes * attr2) static void dix_input_attributes(void) { - InputAttributes orig = { 0 }; + InputAttributes *orig; InputAttributes *new; - const char *tags[4] = { "tag1", "tag2", "tag2", NULL }; new = DuplicateInputAttributes(NULL); assert(!new); - new = DuplicateInputAttributes(&orig); - assert(memcmp(&orig, new, sizeof(InputAttributes)) == 0); + orig = calloc(1, sizeof(InputAttributes)); + assert(orig); - orig.product = "product name"; - new = DuplicateInputAttributes(&orig); - cmp_attr_fields(&orig, new); + new = DuplicateInputAttributes(orig); + assert(memcmp(orig, new, sizeof(InputAttributes)) == 0); + + orig->product = xnfstrdup("product name"); + new = DuplicateInputAttributes(orig); + cmp_attr_fields(orig, new); FreeInputAttributes(new); - orig.vendor = "vendor name"; - new = DuplicateInputAttributes(&orig); - cmp_attr_fields(&orig, new); + orig->vendor = xnfstrdup("vendor name"); + new = DuplicateInputAttributes(orig); + cmp_attr_fields(orig, new); FreeInputAttributes(new); - orig.device = "device path"; - new = DuplicateInputAttributes(&orig); - cmp_attr_fields(&orig, new); + orig->device = xnfstrdup("device path"); + new = DuplicateInputAttributes(orig); + cmp_attr_fields(orig, new); FreeInputAttributes(new); - orig.pnp_id = "PnPID"; - new = DuplicateInputAttributes(&orig); - cmp_attr_fields(&orig, new); + orig->pnp_id = xnfstrdup("PnPID"); + new = DuplicateInputAttributes(orig); + cmp_attr_fields(orig, new); FreeInputAttributes(new); - orig.usb_id = "USBID"; - new = DuplicateInputAttributes(&orig); - cmp_attr_fields(&orig, new); + orig->usb_id = xnfstrdup("USBID"); + new = DuplicateInputAttributes(orig); + cmp_attr_fields(orig, new); FreeInputAttributes(new); - orig.flags = 0xF0; - new = DuplicateInputAttributes(&orig); - cmp_attr_fields(&orig, new); + orig->flags = 0xF0; + new = DuplicateInputAttributes(orig); + cmp_attr_fields(orig, new); FreeInputAttributes(new); - orig.tags = tags; - new = DuplicateInputAttributes(&orig); - cmp_attr_fields(&orig, new); + orig->tags = xstrtokenize("tag1 tag2 tag3", " "); + new = DuplicateInputAttributes(orig); + cmp_attr_fields(orig, new); FreeInputAttributes(new); + + FreeInputAttributes(orig); } static void @@ -1386,8 +1390,8 @@ dix_valuator_alloc(void) assert(v->numAxes == num_axes); #if !defined(__i386__) && !defined(__m68k__) && !defined(__sh__) /* must be double-aligned on 64 bit */ - assert(((void *) v->axisVal - (void *) v) % sizeof(double) == 0); - assert(((void *) v->axes - (void *) v) % sizeof(double) == 0); + assert(offsetof(struct _ValuatorClassRec, axisVal) % sizeof(double) == 0); + assert(offsetof(struct _ValuatorClassRec, axes) % sizeof(double) == 0); #endif num_axes++; } diff --git a/xorg-server/test/os.c b/xorg-server/test/os.c index 2d005a0d4..d85dcffbe 100644 --- a/xorg-server/test/os.c +++ b/xorg-server/test/os.c @@ -150,10 +150,10 @@ static void block_sigio_test_nested(void) tail guard must be hit. */ void (*old_handler)(int); - old_handler = signal(SIGIO, sighandler); + old_handler = OsSignal(SIGIO, sighandler); expect_signal = 1; assert(raise(SIGIO) == 0); - assert(signal(SIGIO, old_handler) == sighandler); + assert(OsSignal(SIGIO, old_handler) == sighandler); #endif } diff --git a/xorg-server/test/signal-logging.c b/xorg-server/test/signal-logging.c index d894373f0..88b37c14e 100644 --- a/xorg-server/test/signal-logging.c +++ b/xorg-server/test/signal-logging.c @@ -346,7 +346,11 @@ static void logging_format(void) ptr = 1; do { char expected[30]; +#ifdef __sun /* Solaris doesn't autoadd "0x" to %p format */ + sprintf(expected, "(EE) 0x%p\n", (void*)ptr); +#else sprintf(expected, "(EE) %p\n", (void*)ptr); +#endif LogMessageVerbSigSafe(X_ERROR, -1, "%p\n", (void*)ptr); read_log_msg(logmsg); assert(strcmp(logmsg, expected) == 0); diff --git a/xorg-server/test/touch.c b/xorg-server/test/touch.c index df1db11de..981c694b6 100644 --- a/xorg-server/test/touch.c +++ b/xorg-server/test/touch.c @@ -40,7 +40,7 @@ touch_grow_queue(void) int i; memset(&dev, 0, sizeof(dev)); - dev.name = "test device"; + dev.name = xnfstrdup("test device"); dev.id = 2; dev.valuator = &val; val.numAxes = 5; @@ -82,6 +82,8 @@ touch_grow_queue(void) assert(t->client_id == 0); assert(t->ddx_id == 0); } + + free(dev.name); } static void @@ -95,7 +97,7 @@ touch_find_ddxid(void) int i; memset(&dev, 0, sizeof(dev)); - dev.name = "test device"; + dev.name = xnfstrdup("test device"); dev.id = 2; dev.valuator = &val; val.numAxes = 5; @@ -150,6 +152,8 @@ touch_find_ddxid(void) ProcessWorkQueue(); ti = TouchFindByDDXID(&dev, 40, TRUE); assert(ti == &dev.last.touches[size]); + + free(dev.name); } static void @@ -164,7 +168,7 @@ touch_begin_ddxtouch(void) int size = 5; memset(&dev, 0, sizeof(dev)); - dev.name = "test device"; + dev.name = xnfstrdup("test device"); dev.id = 2; dev.valuator = &val; val.numAxes = 5; @@ -195,6 +199,8 @@ touch_begin_ddxtouch(void) assert(ti->client_id > last_client_id); assert(!ti->emulate_pointer); last_client_id = ti->client_id; + + free(dev.name); } static void @@ -212,7 +218,7 @@ touch_begin_touch(void) screenInfo.screens[0] = &screen; memset(&dev, 0, sizeof(dev)); - dev.name = "test device"; + dev.name = xnfstrdup("test device"); dev.id = 2; memset(&sprite, 0, sizeof(sprite)); @@ -237,6 +243,8 @@ touch_begin_touch(void) assert(ti->emulate_pointer); assert(touch.num_touches == 1); + + free(dev.name); } static void @@ -251,7 +259,7 @@ touch_init(void) screenInfo.screens[0] = &screen; memset(&dev, 0, sizeof(dev)); - dev.name = "test device"; + dev.name = xnfstrdup("test device"); memset(&sprite, 0, sizeof(sprite)); dev.spriteInfo = &sprite; @@ -264,6 +272,8 @@ touch_init(void) rc = InitTouchClassDeviceStruct(&dev, 1, XIDirectTouch, 2); assert(rc == TRUE); assert(dev.touch); + + free(dev.name); } int diff --git a/xorg-server/test/xkb.c b/xorg-server/test/xkb.c index 955e72dff..9047f594c 100644 --- a/xorg-server/test/xkb.c +++ b/xorg-server/test/xkb.c @@ -82,15 +82,17 @@ xkb_get_rules_test(void) static void xkb_set_rules_test(void) { - XkbRMLVOSet rmlvo = { - .rules = "test-rules", - .model = "test-model", - .layout = "test-layout", - .variant = "test-variant", - .options = "test-options" - }; + XkbRMLVOSet rmlvo; XkbRMLVOSet rmlvo_new = { NULL }; + XkbInitRules(&rmlvo, "test-rules", "test-model", "test-layout", + "test-variant", "test-options"); + assert(rmlvo.rules); + assert(rmlvo.model); + assert(rmlvo.layout); + assert(rmlvo.variant); + assert(rmlvo.options); + XkbSetRulesDflts(&rmlvo); XkbGetRulesDflts(&rmlvo_new); @@ -106,6 +108,8 @@ xkb_set_rules_test(void) assert(strcmp(rmlvo.layout, rmlvo_new.layout) == 0); assert(strcmp(rmlvo.variant, rmlvo_new.variant) == 0); assert(strcmp(rmlvo.options, rmlvo_new.options) == 0); + + XkbFreeRMLVOSet(&rmlvo, FALSE); } /** diff --git a/xorg-server/xkb/xkbInit.c b/xorg-server/xkb/xkbInit.c index 22b971fc6..33420b6b6 100644 --- a/xorg-server/xkb/xkbInit.c +++ b/xorg-server/xkb/xkbInit.c @@ -129,11 +129,11 @@ XkbFreeRMLVOSet(XkbRMLVOSet * rmlvo, Bool freeRMLVO) if (!rmlvo) return; - free((void *) rmlvo->rules); - free((void *) rmlvo->model); - free((void *) rmlvo->layout); - free((void *) rmlvo->variant); - free((void *) rmlvo->options); + free(rmlvo->rules); + free(rmlvo->model); + free(rmlvo->layout); + free(rmlvo->variant); + free(rmlvo->options); if (freeRMLVO) free(rmlvo); @@ -206,6 +206,21 @@ XkbWriteRulesProp(ClientPtr client, void *closure) return TRUE; } +void +XkbInitRules(XkbRMLVOSet *rmlvo, + const char *rules, + const char *model, + const char *layout, + const char *variant, + const char *options) +{ + rmlvo->rules = rules ? xnfstrdup(rules) : NULL; + rmlvo->model = model ? xnfstrdup(model) : NULL; + rmlvo->layout = layout ? xnfstrdup(layout) : NULL; + rmlvo->variant = variant ? xnfstrdup(variant) : NULL; + rmlvo->options = options ? xnfstrdup(options) : NULL; +} + static void XkbSetRulesUsed(XkbRMLVOSet * rmlvo) { diff --git a/xorg-server/xkeyboard-config/rules/base.xml.in b/xorg-server/xkeyboard-config/rules/base.xml.in index 198b3a7be..c924edf6d 100644 --- a/xorg-server/xkeyboard-config/rules/base.xml.in +++ b/xorg-server/xkeyboard-config/rules/base.xml.in @@ -4412,7 +4412,7 @@ <variant> <configItem> <name>yz</name> - <_description>Serbian (Cyrillic, Z and ZHE swapped)</_description> + <_description>Serbian (Cyrillic, ZE and ZHE swapped)</_description> </configItem> </variant> <variant> diff --git a/xorg-server/xkeyboard-config/symbols/ara b/xorg-server/xkeyboard-config/symbols/ara index e677aaab1..d048b0090 100644 --- a/xorg-server/xkeyboard-config/symbols/ara +++ b/xorg-server/xkeyboard-config/symbols/ara @@ -94,7 +94,7 @@ xkb_symbols "azerty" { key <AE11> { [ parenright, degree ] }; }; -partial alphanumeric_keys +partial hidden alphanumeric_keys xkb_symbols "digits_KP" { name[Group1]= "Arabic (digits_KP)"; diff --git a/xorg-server/xkeyboard-config/symbols/cz b/xorg-server/xkeyboard-config/symbols/cz index 083cc7674..97ab3cf68 100644 --- a/xorg-server/xkeyboard-config/symbols/cz +++ b/xorg-server/xkeyboard-config/symbols/cz @@ -1,117 +1,118 @@ default partial alphanumeric_keys xkb_symbols "basic" { - // This layout conforms to a new cz compromise standard designed - // to satisfy most unix, windows and mac users. - // 2001 by Kamil Toman <ktoman@email.cz> + // This layout conforms to a new Czech compromise standard + // designed to satisfy most Unix, Windows and Mac users. + // 2001 by Kamil Toman <ktoman@email.cz> include "latin" - name[Group1]= "Czech"; - key <TLDE> { [ semicolon, dead_abovering, grave, asciitilde ] }; - key <AE01> { [ plus, 1, exclam, dead_tilde ] }; - key <AE02> { [ ecaron, 2, at, dead_caron ] }; - key <AE03> { [ scaron, 3, numbersign, dead_circumflex ] }; - key <AE04> { [ ccaron, 4, dollar, dead_breve ] }; - key <AE05> { [ rcaron, 5, percent, dead_abovering ] }; - key <AE06> { [ zcaron, 6, asciicircum, dead_ogonek ] }; - key <AE07> { [ yacute, 7, ampersand, dead_grave ] }; - key <AE08> { [ aacute, 8, asterisk, dead_abovedot] }; - key <AE09> { [ iacute, 9, braceleft, dead_acute ] }; - key <AE10> { [ eacute, 0, braceright, dead_doubleacute ] }; - key <AE11> { [ equal, percent, NoSymbol, dead_diaeresis ] }; - key <AE12> { [dead_acute, dead_caron, dead_macron, dead_cedilla ] }; - - key <AD01> { [ q, Q, backslash, NoSymbol ] }; - key <AD02> { [ w, W, bar, Nosymbol ] }; - key <AD03> { [ e, E, EuroSign, NoSymbol ] }; - key <AD04> { [ r, R, NoSymbol, NoSymbol ] }; - key <AD05> { [ t, T, NoSymbol, NoSymbol ] }; - key <AD06> { [ z, Z, NoSymbol, NoSymbol ] }; - key <AD07> { [ u, U, NoSymbol, NoSymbol ] }; - key <AD08> { [ i, I, NoSymbol, NoSymbol ] }; - key <AD09> { [ o, O, NoSymbol, NoSymbol ] }; - key <AD10> { [ p, P, NoSymbol, NoSymbol ] }; - - key <AD11> { [ uacute, slash, bracketleft, division ] }; - key <AD12> { [parenright, parenleft, bracketright, multiply ] }; - - key <AC01> { [ a, A, asciitilde, NoSymbol ] }; - key <AC02> { [ s, S, dstroke, NoSymbol ] }; - key <AC03> { [ d, D, Dstroke, NoSymbol ] }; - key <AC04> { [ f, F, bracketleft, NoSymbol ] }; - key <AC05> { [ g, G, bracketright, NoSymbol ] }; - key <AC06> { [ h, H, grave, NoSymbol ] }; - key <AC07> { [ j, J, apostrophe, NoSymbol ] }; - key <AC08> { [ k, K, lstroke, NoSymbol ] }; - key <AC09> { [ l, L, Lstroke, NoSymbol ] }; - - key <AC10> { [ uring, quotedbl, dollar, NoSymbol ] }; - key <AC11> { [ section, exclam, apostrophe, ssharp ] }; - key <AC12> { [ EuroSign, dead_diaeresis, NoSymbol, NoSymbol ] }; - key <BKSL> { [dead_diaeresis, apostrophe, backslash, bar ] }; - - key <LSGT> { [ backslash, bar, slash, NoSymbol ] }; - key <AB01> { [ y, Y, degree, NoSymbol ] }; - key <AB02> { [ x, X, numbersign, Nosymbol ] }; - key <AB03> { [ c, C, ampersand, NoSymbol ] }; - key <AB04> { [ v, V, at, NoSymbol ] }; - key <AB05> { [ b, B, braceleft, NoSymbol ] }; - key <AB06> { [ n, N, braceright, NoSymbol ] }; - key <AB07> { [ m, M, asciicircum, NoSymbol ] }; - key <AB08> { [ comma, question, less, NoSymbol ] }; - key <AB09> { [ period, colon, greater, NoSymbol ] }; - key <AB10> { [ minus, underscore, asterisk, NoSymbol ] }; - - key <SPCE> { [ space, space, space, space ] }; + key <TLDE> { [ semicolon, dead_abovering, grave, asciitilde ] }; + key <AE01> { [ plus, 1, exclam, dead_tilde ] }; + key <AE02> { [ ecaron, 2, at, dead_caron ] }; + key <AE03> { [ scaron, 3, numbersign, dead_circumflex ] }; + key <AE04> { [ ccaron, 4, dollar, dead_breve ] }; + key <AE05> { [ rcaron, 5, percent, dead_abovering]}; + key <AE06> { [ zcaron, 6, asciicircum, dead_ogonek ] }; + key <AE07> { [ yacute, 7, ampersand, dead_grave ] }; + key <AE08> { [ aacute, 8, asterisk, dead_abovedot] }; + key <AE09> { [ iacute, 9, braceleft, dead_acute ] }; + key <AE10> { [ eacute, 0, braceright, dead_doubleacute ] }; + key <AE11> { [ equal, percent, NoSymbol, dead_diaeresis]}; + key <AE12> { [dead_acute, dead_caron, dead_macron, dead_cedilla ] }; + + key <AD01> { [ q, Q, backslash, NoSymbol ] }; + key <AD02> { [ w, W, bar, Nosymbol ] }; + key <AD03> { [ e, E, EuroSign, NoSymbol ] }; + key <AD04> { [ r, R, NoSymbol, NoSymbol ] }; + key <AD05> { [ t, T, NoSymbol, NoSymbol ] }; + key <AD06> { [ z, Z, NoSymbol, NoSymbol ] }; + key <AD07> { [ u, U, NoSymbol, NoSymbol ] }; + key <AD08> { [ i, I, NoSymbol, NoSymbol ] }; + key <AD09> { [ o, O, NoSymbol, NoSymbol ] }; + key <AD10> { [ p, P, NoSymbol, NoSymbol ] }; + + key <AD11> { [ uacute, slash, bracketleft, division ] }; + key <AD12> { [parenright, parenleft, bracketright, multiply ] }; + + key <AC01> { [ a, A, asciitilde, NoSymbol ] }; + key <AC02> { [ s, S, dstroke, NoSymbol ] }; + key <AC03> { [ d, D, Dstroke, NoSymbol ] }; + key <AC04> { [ f, F, bracketleft, NoSymbol ] }; + key <AC05> { [ g, G, bracketright, NoSymbol ] }; + key <AC06> { [ h, H, grave, NoSymbol ] }; + key <AC07> { [ j, J, apostrophe, NoSymbol ] }; + key <AC08> { [ k, K, lstroke, NoSymbol ] }; + key <AC09> { [ l, L, Lstroke, NoSymbol ] }; + + key <AC10> { [ uring, quotedbl, dollar, NoSymbol ] }; + key <AC11> { [ section, exclam, apostrophe, ssharp ] }; + key <AC12> { [ EuroSign, dead_diaeresis, NoSymbol, NoSymbol ] }; + key <BKSL> { [dead_diaeresis, apostrophe, backslash, bar ] }; + + key <LSGT> { [ backslash, bar, slash, NoSymbol ] }; + key <AB01> { [ y, Y, degree, NoSymbol ] }; + key <AB02> { [ x, X, numbersign, Nosymbol ] }; + key <AB03> { [ c, C, ampersand, NoSymbol ] }; + key <AB04> { [ v, V, at, NoSymbol ] }; + key <AB05> { [ b, B, braceleft, NoSymbol ] }; + key <AB06> { [ n, N, braceright, NoSymbol ] }; + key <AB07> { [ m, M, asciicircum, NoSymbol ] }; + key <AB08> { [ comma, question, less, NoSymbol ] }; + key <AB09> { [ period, colon, greater, NoSymbol ] }; + key <AB10> { [ minus, underscore, asterisk, NoSymbol ] }; + + key <SPCE> { [ space, space, space, space ] }; include "level3(ralt_switch)" }; -// Use <BKSL> instead of <LSGT> (useful for keyboard without <LSGT> key) xkb_symbols "bksl" { + + // Use <BKSL> instead of <LSGT> (useful for keyboards without <LSGT> key). + include "cz(basic)" name[Group1]= "Czech (with <\|> key)"; - key <BKSL> { [ backslash, bar, slash, NoSymbol ] }; + key <BKSL> { [ backslash, bar, slash, NoSymbol ] }; }; partial alphanumeric_keys xkb_symbols "qwerty" { - // This layout represent actual keyboard layout. It complies with symbols - // printed on keys. - // ----------------------------------------------------------------------- - // This layout was created in 2011 by Lukáš Mojžíš <lmojzis@grenames.cz> + // This layout represents the actual Czech keyboards; + // it complies with the symbols printed on the keys. + // 2011 by Lukáš Mojžíš <lmojzis@grenames.cz> include "cz(basic)" name[Group1]= "Czech (qwerty)"; - key <AB01> { [ z, Z, degree, NoSymbol ] }; - key <AC10> { [ uring, quotedbl, semicolon, colon ] }; - key <AC11> { [ section, exclam, apostrophe, ssharp ] }; - key <AD06> { [ y, Y, NoSymbol, NoSymbol ] }; - key <AD11> { [ uacute, slash, bracketleft, braceleft ] }; - key <AD12> { [parenright, parenleft, bracketright, braceright ] }; - key <AE09> { [ iacute, 9, parenleft, dead_acute ] }; - key <AE10> { [ eacute, 0, parenright, dead_doubleacute ] }; + key <AB01> { [ z, Z, degree, NoSymbol ] }; + key <AC10> { [ uring, quotedbl, semicolon, colon ] }; + key <AC11> { [ section, exclam, apostrophe, ssharp ] }; + key <AD06> { [ y, Y, NoSymbol, NoSymbol ] }; + key <AD11> { [ uacute, slash, bracketleft, braceleft ] }; + key <AD12> { [parenright, parenleft, bracketright, braceright ] }; + key <AE09> { [ iacute, 9, parenleft, dead_acute ] }; + key <AE10> { [ eacute, 0, parenright, dead_doubleacute ] }; }; -// Use <BKSL> instead of <LSGT> (useful for keyboard without <LSGT> key) xkb_symbols "qwerty_bksl" { - include "cz(qwerty)" + // Use <BKSL> instead of <LSGT> (useful for keyboards without <LSGT> key). + + include "cz(qwerty)" name[Group1]= "Czech (qwerty, extended Backslash)"; - key <BKSL> { [ backslash, bar, slash, NoSymbol ] }; + key <BKSL> { [ backslash, bar, slash, NoSymbol ] }; }; partial alphanumeric_keys alternate_group xkb_symbols "ucw" { - // This layout is usually used as the second group, it contains - // accented characters only, no 'latin' set. + // This layout is usually used as the second group, + // it contains accented characters only, no 'latin' set. // 2008 by Milan Vancura <mvancura@suse.cz> name[Group1]= "Czech (UCW layout, accented letters only)"; @@ -149,10 +150,10 @@ xkb_symbols "ucw" { partial alphanumeric_keys xkb_symbols "dvorak-ucw" { - // US Dvorak layout extend with UCW - AltGr produces accented characters + // US Dvorak layout extended with UCW, + // AltGr produces accented characters. include "us(dvorak)" - name[Group1]= "Czech (US Dvorak with CZ UCW support)"; key <AB03> { [ j, J, eacute, Eacute ] }; diff --git a/xorg-server/xkeyboard-config/symbols/es b/xorg-server/xkeyboard-config/symbols/es index 749a86d71..ab29a05df 100644 --- a/xorg-server/xkeyboard-config/symbols/es +++ b/xorg-server/xkeyboard-config/symbols/es @@ -26,7 +26,7 @@ xkb_symbols "basic" { include "level3(ralt_switch)" }; -partial alphanumeric +partial alphanumeric_keys xkb_symbols "winkeys" { include "es(basic)" diff --git a/xorg-server/xkeyboard-config/symbols/il b/xorg-server/xkeyboard-config/symbols/il index 24028a867..48452d620 100644 --- a/xorg-server/xkeyboard-config/symbols/il +++ b/xorg-server/xkeyboard-config/symbols/il @@ -299,7 +299,7 @@ xkb_symbols "biblicalSIL" { key <AC01> { [ U05B7, U05B8, U05C7, U05B2 ] }; //patah Qamats Qam. Qatan hat. patah key <AC02> { [ hebrew_samech, U05E9 ] }; //Samech, shin no dot - - key <AC03> { [ hebrew_dalet ] }; //dalet - - - - key <AC04> { [ UFB2B, hebrew_sin, U05C2 ] }; //UCSv6 Sin sin (nodot) sindot - + key <AC04> { [ UFB2B, hebrew_shin, U05C2 ] }; //UCSv6 Sin shin (nodot) sindot - key <AC05> { [ hebrew_gimel, VoidSymbol, U25E6, U2022 ] }; //gimel - bullet(DSS) bulletfill (DSS) key <AC06> { [ hebrew_he, VoidSymbol, U0336, U030A ] };//he - strikeout(DSS) Ring Above(DSS) key <AC07> { [ UFB2A, hebrew_shin, U05C1] }; //UCSv6 Shin shin (nodot) shindot - diff --git a/xorg-server/xkeyboard-config/symbols/in b/xorg-server/xkeyboard-config/symbols/in index 054671513..04c35a200 100644 --- a/xorg-server/xkeyboard-config/symbols/in +++ b/xorg-server/xkeyboard-config/symbols/in @@ -1230,7 +1230,7 @@ xkb_symbols "tam_TSCII" { key <AB06> { [ 0x10000b6, 0x10000aa ] }; // au key <AB07> { [ 0x10000ab, 0x10000ac ] }; // a, A key <AB08> { [ 0x10000fe, 0x10000ae ] }; // i, I - +}; partial alphanumeric_keys xkb_symbols "tam_TAB" { @@ -1392,7 +1392,7 @@ xkb_symbols "guru" { key <AE08> { [ U0A6e ] }; key <AE09> { [ U0A6F, parenleft ] }; key <AE10> { [ U0A66, parenright ] }; - key <AE11> { [ gur_visarga ] }; + key <AE11> { [ U0A03 ] }; key <AE12> { [ equal, plus ] }; // Mainly long vowels @@ -1638,7 +1638,7 @@ xkb_symbols "hin-wx" { key <AB01> { [ 0x1000901, 0x100093C, 0x100093D, 0x1000950] }; key <AB02> { [ 0x1000926, 0x1000927 ] }; key <AB03> { [ 0x100091A, 0x100091B ] }; - key <AB04> { [ 0x1000935, dead_V ] }; + key <AB04> { [ 0x1000935 ] }; key <AB05> { [ 0x100092C, 0x100092D ] }; key <AB06> { [ 0x1000928, 0x1000923 ] }; key <AB07> { [ 0x100092E, 0x1000902 ] }; diff --git a/xorg-server/xkeyboard-config/symbols/it b/xorg-server/xkeyboard-config/symbols/it index 8dd4365de..e9d0f306b 100644 --- a/xorg-server/xkeyboard-config/symbols/it +++ b/xorg-server/xkeyboard-config/symbols/it @@ -61,7 +61,7 @@ xkb_symbols "nodeadkeys" { key <BKSL> { [ ugrave, section, grave, breve ] }; }; -partial alphanueric_keys +partial alphanumeric_keys xkb_symbols "winkeys" { include "it(basic)" diff --git a/xorg-server/xkeyboard-config/symbols/kz b/xorg-server/xkeyboard-config/symbols/kz index 9f6260238..4f807d182 100644 --- a/xorg-server/xkeyboard-config/symbols/kz +++ b/xorg-server/xkeyboard-config/symbols/kz @@ -69,8 +69,6 @@ key.type[group1] = "ALPHABETIC"; key <AB07> { [ Cyrillic_softsign, Cyrillic_SOFTSIGN ] }; key <AB08> { [ Cyrillic_be, Cyrillic_BE ] }; key <AB09> { [ Cyrillic_yu, Cyrillic_YU ] }; - -key.type[group1]="TWO_LEVEL"; }; // Kikkarin KZ1 diff --git a/xorg-server/xkeyboard-config/symbols/lv b/xorg-server/xkeyboard-config/symbols/lv index 8b0e9d719..f1b831605 100644 --- a/xorg-server/xkeyboard-config/symbols/lv +++ b/xorg-server/xkeyboard-config/symbols/lv @@ -408,7 +408,7 @@ xkb_symbols "minuskeydvorak" { name[Group1]= "Latvian (US Dvorak, minus variant)"; - key <AC11> {[ISO_Level3_Latch, ISO_Level3_Latch, mimus, underscore]}; + key <AC11> {[ISO_Level3_Latch, ISO_Level3_Latch, minus, underscore]}; key <SPCE> {[space, space, minus, underscore]}; modifier_map Mod5 { <AR11> }; @@ -467,7 +467,7 @@ xkb_symbols "minuskeydvorakprogr" { name[Group1]= "Latvian (programmer US Dvorak, minus variant)"; - key <AC11> {[ISO_Level3_Latch, ISO_Level3_Latch, mimus, underscore]}; + key <AC11> {[ISO_Level3_Latch, ISO_Level3_Latch, minus, underscore]}; key <SPCE> {[space, space, minus, underscore]}; modifier_map Mod5 { <AC11> }; diff --git a/xorg-server/xkeyboard-config/symbols/ru b/xorg-server/xkeyboard-config/symbols/ru index 782a3d75a..2b34a4d52 100644 --- a/xorg-server/xkeyboard-config/symbols/ru +++ b/xorg-server/xkeyboard-config/symbols/ru @@ -1,5 +1,4 @@ -// based on -// russian standard keyboard +// Keyboard layouts for Russia. // AEN <aen@logic.ru> // 2001/12/23 by Leon Kanter <leon@blackcatlinux.com> // 2005/12/09 Valery Inozemtsev <shrek@altlinux.ru> @@ -7,83 +6,84 @@ // Windows layout default partial alphanumeric_keys xkb_symbols "winkeys" { - include "ru(common)" + include "ru(common)" name[Group1]= "Russian"; - key <AE03> { [ 3, numerosign ] }; - key <AE04> { [ 4, semicolon ] }; - key <AE05> { [ 5, percent ] }; - key <AE06> { [ 6, colon ] }; - key <AE07> { [ 7, question ] }; - key <AE08> { [ 8, asterisk ] }; + key <AE03> { [ 3, numerosign ] }; + key <AE04> { [ 4, semicolon ] }; + key <AE05> { [ 5, percent ] }; + key <AE06> { [ 6, colon ] }; + key <AE07> { [ 7, question ] }; + key <AE08> { [ 8, asterisk ] }; - key <AB10> { [ period, comma ] }; - key <BKSL> { [ backslash, slash ] }; + key <AB10> { [ period, comma ] }; + key <BKSL> { [ backslash, slash ] }; }; partial hidden alphanumeric_keys xkb_symbols "common" { - key <AE01> { [ 1, exclam ] }; - key <AE02> { [ 2, quotedbl ] }; - key <AE03> { [ 3, numbersign ] }; - key <AE04> { [ 4, asterisk ] }; - key <AE05> { [ 5, colon ] }; - key <AE06> { [ 6, comma ] }; - key <AE07> { [ 7, period ] }; - key <AE08> { [ 8, semicolon ] }; - key <AE09> { [ 9, parenleft ] }; - key <AE10> { [ 0, parenright ] }; - key <AE11> { [ minus, underscore ] }; - key <AE12> { [ equal, plus ] }; - key <BKSL> { [ backslash, bar ] }; - key <AB10> { [ slash, question ] }; - key <LSGT> { [ slash, bar ] }; - - key <TLDE> { [ Cyrillic_io, Cyrillic_IO ] }; - key <AD01> { [ Cyrillic_shorti, Cyrillic_SHORTI ] }; - key <AD02> { [ Cyrillic_tse, Cyrillic_TSE ] }; - key <AD03> { [ Cyrillic_u, Cyrillic_U ] }; - key <AD04> { [ Cyrillic_ka, Cyrillic_KA ] }; - key <AD05> { [ Cyrillic_ie, Cyrillic_IE ] }; - key <AD06> { [ Cyrillic_en, Cyrillic_EN ] }; - key <AD07> { [ Cyrillic_ghe, Cyrillic_GHE ] }; - key <AD08> { [ Cyrillic_sha, Cyrillic_SHA ] }; - key <AD09> { [ Cyrillic_shcha, Cyrillic_SHCHA ] }; - key <AD10> { [ Cyrillic_ze, Cyrillic_ZE ] }; - key <AD11> { [ Cyrillic_ha, Cyrillic_HA ] }; - key <AD12> { [Cyrillic_hardsign,Cyrillic_HARDSIGN ] }; - key <AC01> { [ Cyrillic_ef, Cyrillic_EF ] }; - key <AC02> { [ Cyrillic_yeru, Cyrillic_YERU ] }; - key <AC03> { [ Cyrillic_ve, Cyrillic_VE ] }; - key <AC04> { [ Cyrillic_a, Cyrillic_A ] }; - key <AC05> { [ Cyrillic_pe, Cyrillic_PE ] }; - key <AC06> { [ Cyrillic_er, Cyrillic_ER ] }; - key <AC07> { [ Cyrillic_o, Cyrillic_O ] }; - key <AC08> { [ Cyrillic_el, Cyrillic_EL ] }; - key <AC09> { [ Cyrillic_de, Cyrillic_DE ] }; - key <AC10> { [ Cyrillic_zhe, Cyrillic_ZHE ] }; - key <AC11> { [ Cyrillic_e, Cyrillic_E ] }; - key <AB01> { [ Cyrillic_ya, Cyrillic_YA ] }; - key <AB02> { [ Cyrillic_che, Cyrillic_CHE ] }; - key <AB03> { [ Cyrillic_es, Cyrillic_ES ] }; - key <AB04> { [ Cyrillic_em, Cyrillic_EM ] }; - key <AB05> { [ Cyrillic_i, Cyrillic_I ] }; - key <AB06> { [ Cyrillic_te, Cyrillic_TE ] }; - key <AB07> { [Cyrillic_softsign,Cyrillic_SOFTSIGN ] }; - key <AB08> { [ Cyrillic_be, Cyrillic_BE ] }; - key <AB09> { [ Cyrillic_yu, Cyrillic_YU ] }; - - key.type[group1]="TWO_LEVEL"; + key <AE01> { [ 1, exclam ] }; + key <AE02> { [ 2, quotedbl ] }; + key <AE03> { [ 3, numbersign ] }; + key <AE04> { [ 4, asterisk ] }; + key <AE05> { [ 5, colon ] }; + key <AE06> { [ 6, comma ] }; + key <AE07> { [ 7, period ] }; + key <AE08> { [ 8, semicolon ] }; + key <AE09> { [ 9, parenleft ] }; + key <AE10> { [ 0, parenright ] }; + key <AE11> { [ minus, underscore ] }; + key <AE12> { [ equal, plus ] }; + key <BKSL> { [ backslash, bar ] }; + + key <AB10> { [ slash, question ] }; + key <LSGT> { [ slash, bar ] }; + + key <TLDE> { [ Cyrillic_io, Cyrillic_IO ] }; + key <AD01> { [ Cyrillic_shorti, Cyrillic_SHORTI ] }; + key <AD02> { [ Cyrillic_tse, Cyrillic_TSE ] }; + key <AD03> { [ Cyrillic_u, Cyrillic_U ] }; + key <AD04> { [ Cyrillic_ka, Cyrillic_KA ] }; + key <AD05> { [ Cyrillic_ie, Cyrillic_IE ] }; + key <AD06> { [ Cyrillic_en, Cyrillic_EN ] }; + key <AD07> { [ Cyrillic_ghe, Cyrillic_GHE ] }; + key <AD08> { [ Cyrillic_sha, Cyrillic_SHA ] }; + key <AD09> { [ Cyrillic_shcha, Cyrillic_SHCHA ] }; + key <AD10> { [ Cyrillic_ze, Cyrillic_ZE ] }; + key <AD11> { [ Cyrillic_ha, Cyrillic_HA ] }; + key <AD12> { [ Cyrillic_hardsign, Cyrillic_HARDSIGN ] }; + + key <AC01> { [ Cyrillic_ef, Cyrillic_EF ] }; + key <AC02> { [ Cyrillic_yeru, Cyrillic_YERU ] }; + key <AC03> { [ Cyrillic_ve, Cyrillic_VE ] }; + key <AC04> { [ Cyrillic_a, Cyrillic_A ] }; + key <AC05> { [ Cyrillic_pe, Cyrillic_PE ] }; + key <AC06> { [ Cyrillic_er, Cyrillic_ER ] }; + key <AC07> { [ Cyrillic_o, Cyrillic_O ] }; + key <AC08> { [ Cyrillic_el, Cyrillic_EL ] }; + key <AC09> { [ Cyrillic_de, Cyrillic_DE ] }; + key <AC10> { [ Cyrillic_zhe, Cyrillic_ZHE ] }; + key <AC11> { [ Cyrillic_e, Cyrillic_E ] }; + + key <AB01> { [ Cyrillic_ya, Cyrillic_YA ] }; + key <AB02> { [ Cyrillic_che, Cyrillic_CHE ] }; + key <AB03> { [ Cyrillic_es, Cyrillic_ES ] }; + key <AB04> { [ Cyrillic_em, Cyrillic_EM ] }; + key <AB05> { [ Cyrillic_i, Cyrillic_I ] }; + key <AB06> { [ Cyrillic_te, Cyrillic_TE ] }; + key <AB07> { [ Cyrillic_softsign, Cyrillic_SOFTSIGN ] }; + key <AB08> { [ Cyrillic_be, Cyrillic_BE ] }; + key <AB09> { [ Cyrillic_yu, Cyrillic_YU ] }; include "kpdl(comma)" }; partial alphanumeric_keys xkb_symbols "legacy" { - include "ru(common)" + include "ru(common)" name[Group1]= "Russian (legacy)"; }; @@ -92,118 +92,121 @@ xkb_symbols "olpc" { include "ru(common)" - key <TLDE> { [ 0x01000451, 0x01000401, grave ] }; // Ñ‘, Ð - key <AE03> { [ 3, numbersign, 0x01002116 ] }; // â„– - key <AE04> { [ 4, dollar, semicolon ] }; - key <AE06> { [ 6, asciicircum, colon ] }; - key <AE07> { [ 7, ampersand ] }; - key <AE09> { [ 9, parenleft, acute ] }; - key <AC12> { [ backslash, bar, slash ] }; + key <TLDE> { [ 0x01000451, 0x01000401, grave ] }; // Ñ‘, Ð + key <AE03> { [ 3, numbersign, 0x01002116 ] }; // â„– + key <AE04> { [ 4, dollar, semicolon ] }; + key <AE06> { [ 6, asciicircum, colon ] }; + key <AE07> { [ 7, ampersand ] }; + key <AE09> { [ 9, parenleft, acute ] }; + key <AC12> { [ backslash, bar, slash ] }; include "group(olpc)" }; partial alphanumeric_keys xkb_symbols "typewriter" { + include "ru(common)" name[Group1]= "Russian (typewriter)"; - key <TLDE> { [ bar, plus ] }; - key <AE01> { [ numerosign, 1 ] }; - key <AE02> { [ minus, 2 ] }; - key <AE03> { [ slash, 3 ] }; - key <AE04> { [ quotedbl, 4 ] }; - key <AE05> { [ colon, 5 ] }; - key <AE06> { [ comma, 6 ] }; - key <AE07> { [ period, 7 ] }; - key <AE08> { [ underscore, 8 ] }; - key <AE09> { [ question, 9 ] }; - key <AE10> { [ percent, 0 ] }; - key <AE11> { [ exclam, equal ] }; - key <AE12> { [ semicolon, backslash ] }; - - key <BKSL> { [ parenright, parenleft ] }; - - key <AD12> { [Cyrillic_hardsign,Cyrillic_HARDSIGN ] }; - key <AB10> { [ Cyrillic_io, Cyrillic_IO ] }; + + key <TLDE> { [ bar, plus ] }; + key <AE01> { [ numerosign, 1 ] }; + key <AE02> { [ minus, 2 ] }; + key <AE03> { [ slash, 3 ] }; + key <AE04> { [ quotedbl, 4 ] }; + key <AE05> { [ colon, 5 ] }; + key <AE06> { [ comma, 6 ] }; + key <AE07> { [ period, 7 ] }; + key <AE08> { [ underscore, 8 ] }; + key <AE09> { [ question, 9 ] }; + key <AE10> { [ percent, 0 ] }; + key <AE11> { [ exclam, equal ] }; + key <AE12> { [ semicolon, backslash ] }; + + key <BKSL> { [ parenright, parenleft ] }; + + key <AD12> { [ Cyrillic_hardsign, Cyrillic_HARDSIGN ] }; + key <AB10> { [ Cyrillic_io, Cyrillic_IO ] }; }; partial alphanumeric_keys xkb_symbols "typewriter-legacy" { + include "ru(common)" name[Group1]= "Russian (typewriter, legacy)"; - key <TLDE> { [ apostrophe, quotedbl ] }; - key <AE01> { [ exclam, 1 ] }; - key <AE02> { [ numerosign, 2 ] }; - key <AE03> { [ slash, 3 ] }; - key <AE04> { [ semicolon, 4 ] }; - key <AE05> { [ colon, 5 ] }; - key <AE06> { [ comma, 6 ] }; - key <AE07> { [ period, 7 ] }; - key <AE08> { [ underscore, 8 ] }; - key <AE09> { [ question, 9 ] }; - key <AE10> { [ percent, 0 ] }; - key <BKSL> { [ parenleft, parenright ] }; - - key <AD12> { [Cyrillic_hardsign,Cyrillic_HARDSIGN ] }; - key <AB10> { [ Cyrillic_io, Cyrillic_IO ] }; + + key <TLDE> { [ apostrophe, quotedbl ] }; + key <AE01> { [ exclam, 1 ] }; + key <AE02> { [ numerosign, 2 ] }; + key <AE03> { [ slash, 3 ] }; + key <AE04> { [ semicolon, 4 ] }; + key <AE05> { [ colon, 5 ] }; + key <AE06> { [ comma, 6 ] }; + key <AE07> { [ period, 7 ] }; + key <AE08> { [ underscore, 8 ] }; + key <AE09> { [ question, 9 ] }; + key <AE10> { [ percent, 0 ] }; + + key <BKSL> { [ parenleft, parenright ] }; + + key <AD12> { [ Cyrillic_hardsign, Cyrillic_HARDSIGN ] }; + key <AB10> { [ Cyrillic_io, Cyrillic_IO ] }; }; partial alphanumeric_keys xkb_symbols "phonetic" { - name[Group1]= "Russian (phonetic)"; - - key <AE01> { [ 1, exclam ] }; - key <AE02> { [ 2, at ] }; - key <AE03> { [ 3, Cyrillic_io ] }; - key <AE04> { [ 4, Cyrillic_IO ] }; - key <AE05> { [ 5, Cyrillic_hardsign ] }; - key <AE06> { [ 6, Cyrillic_HARDSIGN ] }; - key <AE07> { [ 7, ampersand ] }; - key <AE08> { [ 8, asterisk ] }; - key <AE09> { [ 9, parenleft ] }; - key <AE10> { [ 0, parenright ] }; - key <AE11> { [ minus, underscore ] }; - - key <AB09> { [ period, greater ] }; - key <AB10> { [ slash, question ] }; - key <AB08> { [ comma, less ] }; - key <AC10> { [ semicolon, colon ] }; - key <AC11> { [ apostrophe, quotedbl ] }; - key <LSGT> { [ bar, brokenbar ] }; - - key <TLDE> { [ Cyrillic_yu, Cyrillic_YU ] }; - key <LatQ> { [ Cyrillic_ya, Cyrillic_YA ] }; - key <LatZ> { [ Cyrillic_ze, Cyrillic_ZE ] }; - key <LatS> { [ Cyrillic_es, Cyrillic_ES ] }; - key <LatA> { [ Cyrillic_a, Cyrillic_A ] }; - key <LatW> { [ Cyrillic_ve, Cyrillic_VE ] }; - key <LatC> { [ Cyrillic_tse, Cyrillic_TSE ] }; - key <LatX> { [ Cyrillic_ha, Cyrillic_HA ] }; - key <LatD> { [ Cyrillic_de, Cyrillic_DE ] }; - key <LatE> { [ Cyrillic_ie, Cyrillic_IE ] }; - key <LatV> { [ Cyrillic_zhe, Cyrillic_ZHE ] }; - key <LatF> { [ Cyrillic_ef, Cyrillic_EF ] }; - key <LatT> { [ Cyrillic_te, Cyrillic_TE ] }; - key <LatR> { [ Cyrillic_er, Cyrillic_ER ] }; - key <LatN> { [ Cyrillic_en, Cyrillic_EN ] }; - key <LatB> { [ Cyrillic_be, Cyrillic_BE ] }; - key <LatH> { [ Cyrillic_che, Cyrillic_CHE ] }; - key <LatG> { [ Cyrillic_ghe, Cyrillic_GHE ] }; - key <LatY> { [ Cyrillic_yeru, Cyrillic_YERU ] }; - key <LatM> { [ Cyrillic_em, Cyrillic_EM ] }; - key <LatJ> { [ Cyrillic_shorti, Cyrillic_SHORTI ] }; - key <LatU> { [ Cyrillic_u, Cyrillic_U ] }; - key <LatK> { [ Cyrillic_ka, Cyrillic_KA ] }; - key <LatI> { [ Cyrillic_i, Cyrillic_I ] }; - key <LatO> { [ Cyrillic_o, Cyrillic_O ] }; - key <LatL> { [ Cyrillic_el, Cyrillic_EL ] }; - key <LatP> { [ Cyrillic_pe, Cyrillic_PE ] }; - - key <AD11> { [ Cyrillic_sha, Cyrillic_SHA ] }; - key <AE12> { [ Cyrillic_softsign, Cyrillic_SOFTSIGN ] }; - key <AD12> { [ Cyrillic_shcha, Cyrillic_SHCHA ] }; - key <BKSL> { [ Cyrillic_e, Cyrillic_E ] }; + key <AE01> { [ 1, exclam ] }; + key <AE02> { [ 2, at ] }; + key <AE03> { [ 3, Cyrillic_io ] }; + key <AE04> { [ 4, Cyrillic_IO ] }; + key <AE05> { [ 5, Cyrillic_hardsign ] }; + key <AE06> { [ 6, Cyrillic_HARDSIGN ] }; + key <AE07> { [ 7, ampersand ] }; + key <AE08> { [ 8, asterisk ] }; + key <AE09> { [ 9, parenleft ] }; + key <AE10> { [ 0, parenright ] }; + key <AE11> { [ minus, underscore ] }; + + key <AB09> { [ period, greater ] }; + key <AB10> { [ slash, question ] }; + key <AB08> { [ comma, less ] }; + key <AC10> { [ semicolon, colon ] }; + key <AC11> { [ apostrophe, quotedbl ] }; + key <LSGT> { [ bar, brokenbar ] }; + + key <TLDE> { [ Cyrillic_yu, Cyrillic_YU ] }; + key <LatQ> { [ Cyrillic_ya, Cyrillic_YA ] }; + key <LatZ> { [ Cyrillic_ze, Cyrillic_ZE ] }; + key <LatS> { [ Cyrillic_es, Cyrillic_ES ] }; + key <LatA> { [ Cyrillic_a, Cyrillic_A ] }; + key <LatW> { [ Cyrillic_ve, Cyrillic_VE ] }; + key <LatC> { [ Cyrillic_tse, Cyrillic_TSE ] }; + key <LatX> { [ Cyrillic_ha, Cyrillic_HA ] }; + key <LatD> { [ Cyrillic_de, Cyrillic_DE ] }; + key <LatE> { [ Cyrillic_ie, Cyrillic_IE ] }; + key <LatV> { [ Cyrillic_zhe, Cyrillic_ZHE ] }; + key <LatF> { [ Cyrillic_ef, Cyrillic_EF ] }; + key <LatT> { [ Cyrillic_te, Cyrillic_TE ] }; + key <LatR> { [ Cyrillic_er, Cyrillic_ER ] }; + key <LatN> { [ Cyrillic_en, Cyrillic_EN ] }; + key <LatB> { [ Cyrillic_be, Cyrillic_BE ] }; + key <LatH> { [ Cyrillic_che, Cyrillic_CHE ] }; + key <LatG> { [ Cyrillic_ghe, Cyrillic_GHE ] }; + key <LatY> { [ Cyrillic_yeru, Cyrillic_YERU ] }; + key <LatM> { [ Cyrillic_em, Cyrillic_EM ] }; + key <LatJ> { [ Cyrillic_shorti, Cyrillic_SHORTI ] }; + key <LatU> { [ Cyrillic_u, Cyrillic_U ] }; + key <LatK> { [ Cyrillic_ka, Cyrillic_KA ] }; + key <LatI> { [ Cyrillic_i, Cyrillic_I ] }; + key <LatO> { [ Cyrillic_o, Cyrillic_O ] }; + key <LatL> { [ Cyrillic_el, Cyrillic_EL ] }; + key <LatP> { [ Cyrillic_pe, Cyrillic_PE ] }; + + key <AD11> { [ Cyrillic_sha, Cyrillic_SHA ] }; + key <AE12> { [ Cyrillic_softsign, Cyrillic_SOFTSIGN ] }; + key <AD12> { [ Cyrillic_shcha, Cyrillic_SHCHA ] }; + key <BKSL> { [ Cyrillic_e, Cyrillic_E ] }; }; partial alphanumeric_keys @@ -212,146 +215,128 @@ xkb_symbols "phonetic_winkeys" { include "ru(phonetic)" name[Group1]= "Russian (phonetic WinKeys)"; - key <LatX> { [ Cyrillic_ha, Cyrillic_HA ] }; - key <LatH> { [ Cyrillic_che, Cyrillic_CHE ] }; - key <AE12> { [ Cyrillic_softsign, Cyrillic_SOFTSIGN ] }; - + key <LatX> { [ Cyrillic_ha, Cyrillic_HA ] }; + key <LatH> { [ Cyrillic_che, Cyrillic_CHE ] }; + key <AE12> { [ Cyrillic_softsign, Cyrillic_SOFTSIGN ] }; }; partial alphanumeric_keys xkb_symbols "tt" { + include "ru(winkeys)" name[Group1]= "Tatar"; key.type[group1]="FOUR_LEVEL"; - key <TLDE> { [ 0x010004bb, 0x010004ba, - Cyrillic_io, Cyrillic_IO ] }; - key <AD02> { [ 0x010004e9, 0x010004e8, - Cyrillic_tse, Cyrillic_TSE ] }; - key <AD09> { [ 0x010004d9, 0x010004d8, - Cyrillic_shcha, Cyrillic_SHCHA ] }; - key <AD12> { [ 0x010004af, 0x010004ae, - Cyrillic_hardsign,Cyrillic_HARDSIGN ] }; - key <AC10> { [ 0x010004a3, 0x010004a2, - Cyrillic_zhe, Cyrillic_ZHE ] }; - key <AB07> { [ 0x01000497, 0x01000496, - Cyrillic_softsign,Cyrillic_SOFTSIGN ] }; + key <TLDE> { [ 0x010004bb, 0x010004ba, Cyrillic_io, Cyrillic_IO ] }; + key <AD02> { [ 0x010004e9, 0x010004e8, Cyrillic_tse, Cyrillic_TSE ] }; + key <AD09> { [ 0x010004d9, 0x010004d8, Cyrillic_shcha, Cyrillic_SHCHA ] }; + key <AD12> { [ 0x010004af, 0x010004ae, Cyrillic_hardsign, Cyrillic_HARDSIGN ] }; + key <AC10> { [ 0x010004a3, 0x010004a2, Cyrillic_zhe, Cyrillic_ZHE ] }; + key <AB07> { [ 0x01000497, 0x01000496, Cyrillic_softsign, Cyrillic_SOFTSIGN ] }; include "level3(ralt_switch)" - }; partial alphanumeric_keys xkb_symbols "os_legacy" { - include "ru(common)" + include "ru(common)" name[Group1]= "Ossetian (legacy)"; - key <TLDE> { [ Cyrillic_e, Cyrillic_E ] }; - key <AC07> { [ Cyrillic_o, Cyrillic_O, Cyrillic_io, Cyrillic_IO ] }; - key <AC11> { [ 0x010004D5, 0x010004D4 ] }; + key <TLDE> { [ Cyrillic_e, Cyrillic_E ] }; + key <AC07> { [ Cyrillic_o, Cyrillic_O, Cyrillic_io, Cyrillic_IO ] }; + key <AC11> { [ 0x010004D5, 0x010004D4 ] }; }; partial alphanumeric_keys xkb_symbols "os_winkeys" { - include "ru(winkeys)" + include "ru(winkeys)" name[Group1]= "Ossetian (WinKeys)"; - key <TLDE> { [ Cyrillic_e, Cyrillic_E ] }; - key <AC07> { [ Cyrillic_o, Cyrillic_O, Cyrillic_io, Cyrillic_IO ] }; - key <AC11> { [ 0x010004D5, 0x010004D4 ] }; + key <TLDE> { [ Cyrillic_e, Cyrillic_E ] }; + key <AC07> { [ Cyrillic_o, Cyrillic_O, Cyrillic_io, Cyrillic_IO ] }; + key <AC11> { [ 0x010004D5, 0x010004D4 ] }; }; partial alphanumeric_keys xkb_symbols "cv" { - include "ru(winkeys)" + include "ru(winkeys)" name[Group1]= "Chuvash"; key.type[group1]="FOUR_LEVEL"; - key <AD03> { [ Cyrillic_u, Cyrillic_U, - U04F3, U04F2 ] }; - key <AD05> { [ Cyrillic_ie, Cyrillic_IE, - U04D7, U04D6 ] }; - key <AC04> { [ Cyrillic_a, Cyrillic_A, - U04D1, U04D0 ] }; - key <AB03> { [ Cyrillic_es, Cyrillic_ES, - U04AB, U04AA ] }; + key <AD03> { [ Cyrillic_u, Cyrillic_U, U04F3, U04F2 ] }; + key <AD05> { [ Cyrillic_ie, Cyrillic_IE, U04D7, U04D6 ] }; + key <AC04> { [ Cyrillic_a, Cyrillic_A, U04D1, U04D0 ] }; + key <AB03> { [ Cyrillic_es, Cyrillic_ES, U04AB, U04AA ] }; include "level3(ralt_switch)" }; partial alphanumeric_keys xkb_symbols "udm" { - include "ru(winkeys)" + include "ru(winkeys)" name[Group1]= "Udmurt"; key.type[group1]="FOUR_LEVEL"; - key <AE01> { [ question, exclam, 1, 1 ] }; - key <AE02> { [ parenleft, quotedbl, 2, 2 ] }; - key <AE03> { [ parenright, numerosign, 3, 3 ] }; - key <AE04> { [ colon, semicolon, 4, 4 ] }; - key <AE05> { [ asterisk, percent, 5, 5 ] }; - key <AE06> { [ 0x010004dd, 0x010004dc, 6, 6 ] }; - key <AE07> { [ 0x010004e7, 0x010004e6, 7, 7 ] }; - key <AE08> { [ 0x010004f5, 0x010004f4, 8, 8 ] }; - key <AE09> { [ 0x010004e5, 0x010004e4, 9, 9 ] }; - key <AE10> { [ 0x010004df, 0x010004de, 0, 0 ] }; + key <AE01> { [ question, exclam, 1, 1 ] }; + key <AE02> { [ parenleft, quotedbl, 2, 2 ] }; + key <AE03> { [ parenright, numerosign, 3, 3 ] }; + key <AE04> { [ colon, semicolon, 4, 4 ] }; + key <AE05> { [ asterisk, percent, 5, 5 ] }; + key <AE06> { [ 0x010004dd, 0x010004dc, 6, 6 ] }; + key <AE07> { [ 0x010004e7, 0x010004e6, 7, 7 ] }; + key <AE08> { [ 0x010004f5, 0x010004f4, 8, 8 ] }; + key <AE09> { [ 0x010004e5, 0x010004e4, 9, 9 ] }; + key <AE10> { [ 0x010004df, 0x010004de, 0, 0 ] }; include "level3(ralt_switch)" }; partial alphanumeric_keys xkb_symbols "cv_latin" { - include "us(alt-intl)" + include "us(alt-intl)" name[Group1]= "Chuvash (Latin)"; key.type[group1]="FOUR_LEVEL"; - key <AD01> { [ q, Q, 0x01000161, 0x01000160 ] }; - key <AD02> { [ w, W, udiaeresis, Udiaeresis ] }; - key <AD03> { [ e, E, 0x01000115, 0x01000114 ] }; - key <AD07> { [ u, U, udiaeresis, Udiaeresis ] }; - key <AD08> { [ i, I, 0x0100012d, 0x0100012c ] }; - key <AD09> { [ o, O, odiaeresis, Odiaeresis ] }; - key <AC01> { [ a, A, abreve, Abreve ] }; - key <AC02> { [ s, S, scedilla, Scedilla ] }; - key <AC05> { [ g, G, gbreve, Gbreve ] }; - key <AC07> { [ j, J, 0x01000131, 0x01000130 ] }; - key <AB03> { [ c, C, ccedilla, Ccedilla ] }; + key <AD01> { [ q, Q, 0x01000161, 0x01000160 ] }; + key <AD02> { [ w, W, udiaeresis, Udiaeresis ] }; + key <AD03> { [ e, E, 0x01000115, 0x01000114 ] }; + key <AD07> { [ u, U, udiaeresis, Udiaeresis ] }; + key <AD08> { [ i, I, 0x0100012d, 0x0100012c ] }; + key <AD09> { [ o, O, odiaeresis, Odiaeresis ] }; + key <AC01> { [ a, A, abreve, Abreve ] }; + key <AC02> { [ s, S, scedilla, Scedilla ] }; + key <AC05> { [ g, G, gbreve, Gbreve ] }; + key <AC07> { [ j, J, 0x01000131, 0x01000130 ] }; + key <AB03> { [ c, C, ccedilla, Ccedilla ] }; include "level3(ralt_switch)" - }; // Komi language layout -// based on -// russian standard keyboard // Vlad Shakhov <lumpen.intellectual@gmail.com> -// Last Changes 2007/10/23 by Vlad Shakhov <lumpen.intellectual@gmail.com> - +// last changes 2007/10/23 partial alphanumeric_keys xkb_symbols "kom" { include "ru(winkeys)" - name[Group1]= "Komi"; key.type[group1]="FOUR_LEVEL_ALPHABETIC"; -// cyrilllic o with diaeresis - key <AC07> { [ Cyrillic_o, Cyrillic_O, - U04E7, U04E6 ] }; + // cyrilllic o with diaeresis + key <AC07> { [ Cyrillic_o, Cyrillic_O, U04E7, U04E6 ] }; -// hard I as additional key for soft Cyrillic_I - key <AB05> { [ Cyrillic_i, Cyrillic_I, - Ukrainian_i, Ukrainian_I ] }; + // hard I as additional key for soft Cyrillic_I + key <AB05> { [ Cyrillic_i, Cyrillic_I, Ukrainian_i, Ukrainian_I ] }; include "level3(ralt_switch)" }; @@ -364,37 +349,23 @@ partial alphanumeric_keys xkb_symbols "sah" { include "ru(winkeys)" - name[Group1]= "Yakut"; key.type[group1]="FOUR_LEVEL_ALPHABETIC"; - key <TLDE> { [ Cyrillic_io, Cyrillic_IO, - U04EB, U04EA ] }; - key <AD01> { [ Cyrillic_shorti, Cyrillic_SHORTI, - U048B, U048A ] }; - key <AD03> { [ Cyrillic_u, Cyrillic_U, - Cyrillic_u_straight, Cyrillic_U_straight ] }; - key <AD04> { [ Cyrillic_ka, Cyrillic_KA, - U04C4, U04C3 ] }; - key <AD06> { [ Cyrillic_en, Cyrillic_EN, - U04A5, U04A4 ] }; - key <AD07> { [ Cyrillic_ghe, Cyrillic_GHE, - U0495, U0494 ] }; - key <AD10> { [ Cyrillic_ze, Cyrillic_ZE, - U04E1, U04E0 ] }; - key <AD11> { [ Cyrillic_ha, Cyrillic_HA, - Cyrillic_shha, Cyrillic_SHHA ] }; - key <AC07> { [ Cyrillic_o, Cyrillic_O, - Cyrillic_o_bar, Cyrillic_O_bar ] }; - key <AC10> { [ Cyrillic_zhe, Cyrillic_ZHE, - U0461, U0460 ] }; - key <AB02> { [ Cyrillic_che, Cyrillic_CHE, - Cyrillic_u_macron, Cyrillic_U_macron ] }; - key <AB04> { [ Cyrillic_em, Cyrillic_EM, - U04C8, U04C7 ] }; - key <AB05> { [ Cyrillic_i, Cyrillic_I, - Cyrillic_i_macron, Cyrillic_I_macron ] }; + key <TLDE> { [ Cyrillic_io, Cyrillic_IO, U04EB, U04EA ] }; + key <AD01> { [ Cyrillic_shorti, Cyrillic_SHORTI, U048B, U048A ] }; + key <AD03> { [ Cyrillic_u, Cyrillic_U, Cyrillic_u_straight, Cyrillic_U_straight ] }; + key <AD04> { [ Cyrillic_ka, Cyrillic_KA, U04C4, U04C3 ] }; + key <AD06> { [ Cyrillic_en, Cyrillic_EN, U04A5, U04A4 ] }; + key <AD07> { [ Cyrillic_ghe, Cyrillic_GHE, U0495, U0494 ] }; + key <AD10> { [ Cyrillic_ze, Cyrillic_ZE, U04E1, U04E0 ] }; + key <AD11> { [ Cyrillic_ha, Cyrillic_HA, Cyrillic_shha, Cyrillic_SHHA ] }; + key <AC07> { [ Cyrillic_o, Cyrillic_O, Cyrillic_o_bar, Cyrillic_O_bar ] }; + key <AC10> { [ Cyrillic_zhe, Cyrillic_ZHE, U0461, U0460 ] }; + key <AB02> { [ Cyrillic_che, Cyrillic_CHE, Cyrillic_u_macron, Cyrillic_U_macron ] }; + key <AB04> { [ Cyrillic_em, Cyrillic_EM, U04C8, U04C7 ] }; + key <AB05> { [ Cyrillic_i, Cyrillic_I, Cyrillic_i_macron, Cyrillic_I_macron ] }; include "level3(ralt_switch)" }; @@ -404,38 +375,37 @@ xkb_symbols "sah" { //based on the Kalmyk language layout: http://soft.oyrat.org/ //Nikolay Korneev <halmg@oyrat.org> //Toli Miron <mirontoli@gmail.com> - partial alphanumeric_keys xkb_symbols "xal" { - include "ru(winkeys)" + include "ru(winkeys)" name[Group1]= "Kalmyk"; key.type[group1]="FOUR_LEVEL"; - key <AE01> { [ question, exclam, 1 ] }; - key <AE02> { [ numerosign, quotedbl, 2 ] }; - key <AE03> { [ Cyrillic_u_straight, Cyrillic_U_straight, 3 ] }; - key <AE04> { [ Cyrillic_schwa, Cyrillic_SCHWA, 4 ] }; - key <AE05> { [ asterisk, percent, 5 ] }; - key <AE06> { [ Cyrillic_en_descender, Cyrillic_EN_descender, 6 ] }; - key <AE07> { [ Cyrillic_o_bar, Cyrillic_O_bar, 7 ] }; - key <AE08> { [ Cyrillic_shha, Cyrillic_SHHA, 8 ] }; - key <AE09> { [ Cyrillic_zhe_descender, Cyrillic_ZHE_descender, 9 ] }; - key <AE10> { [ semicolon, colon, 0 ] }; - - key <TLDE> { [ parenleft, parenright, Cyrillic_io, Cyrillic_IO ] }; - - key <AD02> { [ Cyrillic_tse, Cyrillic_TSE, dollar ] }; - key <AD03> { [ Cyrillic_u, Cyrillic_U, EuroSign ] }; - key <AD04> { [ Cyrillic_ka, Cyrillic_KA, registered ] }; - key <AD05> { [ Cyrillic_ie, Cyrillic_IE, trademark ] }; - key <AD11> { [ Cyrillic_ha, Cyrillic_HA, bracketleft ] }; - key <AD12> { [ Cyrillic_hardsign, Cyrillic_HARDSIGN, bracketright ] }; - key <AC11> { [ Cyrillic_e, Cyrillic_E, apostrophe ] }; - key <AB03> { [ Cyrillic_es, Cyrillic_ES, copyright ] }; - key <AB08> { [ Cyrillic_be, Cyrillic_BE, less ] }; - key <AB09> { [ Cyrillic_yu, Cyrillic_YU, greater ] }; + key <AE01> { [ question, exclam, 1 ] }; + key <AE02> { [ numerosign, quotedbl, 2 ] }; + key <AE03> { [ Cyrillic_u_straight, Cyrillic_U_straight, 3 ] }; + key <AE04> { [ Cyrillic_schwa, Cyrillic_SCHWA, 4 ] }; + key <AE05> { [ asterisk, percent, 5 ] }; + key <AE06> { [ Cyrillic_en_descender, Cyrillic_EN_descender, 6 ] }; + key <AE07> { [ Cyrillic_o_bar, Cyrillic_O_bar, 7 ] }; + key <AE08> { [ Cyrillic_shha, Cyrillic_SHHA, 8 ] }; + key <AE09> { [ Cyrillic_zhe_descender, Cyrillic_ZHE_descender, 9 ] }; + key <AE10> { [ semicolon, colon, 0 ] }; + + key <TLDE> { [ parenleft, parenright, Cyrillic_io, Cyrillic_IO ] }; + + key <AD02> { [ Cyrillic_tse, Cyrillic_TSE, dollar ] }; + key <AD03> { [ Cyrillic_u, Cyrillic_U, EuroSign ] }; + key <AD04> { [ Cyrillic_ka, Cyrillic_KA, registered ] }; + key <AD05> { [ Cyrillic_ie, Cyrillic_IE, trademark ] }; + key <AD11> { [ Cyrillic_ha, Cyrillic_HA, bracketleft ] }; + key <AD12> { [ Cyrillic_hardsign, Cyrillic_HARDSIGN, bracketright ] }; + key <AC11> { [ Cyrillic_e, Cyrillic_E, apostrophe ] }; + key <AB03> { [ Cyrillic_es, Cyrillic_ES, copyright ] }; + key <AB08> { [ Cyrillic_be, Cyrillic_BE, less ] }; + key <AB09> { [ Cyrillic_yu, Cyrillic_YU, greater ] }; include "level3(ralt_switch)" }; @@ -444,84 +414,84 @@ partial alphanumeric_keys xkb_symbols "dos" { include "ru(common)" - name[Group1]= "Russian (DOS)"; - key <TLDE> { [ parenright, parenleft ] }; - key <AE04> { [ 4, currency ] }; - key <AE09> { [ 9, question ] }; - key <AE10> { [ 0, percent ] }; + key <TLDE> { [ parenright, parenleft ] }; + key <AE04> { [ 4, currency ] }; + key <AE09> { [ 9, question ] }; + key <AE10> { [ 0, percent ] }; - key <AB10> { [ Cyrillic_io, Cyrillic_IO ] }; + key <AB10> { [ Cyrillic_io, Cyrillic_IO ] }; }; partial alphanumeric_keys xkb_symbols "bak" { - include "ru(winkeys)" + include "ru(winkeys)" name[Group1]= "Bashkirian"; + key.type[group1]="FOUR_LEVEL"; - key <TLDE> { [ 0x010004d9, 0x010004d8, Cyrillic_io, Cyrillic_IO ] }; - key <AE01> { [ exclam, quotedbl, 1, 1 ] }; - key <AE02> { [ 0x010004e9, 0x010004e8, 2, 2 ] }; - key <AE03> { [ 0x010004a1, 0x010004a0, 3, 3 ] }; - key <AE04> { [ 0x01000493, 0x01000492, 4, 4 ] }; - key <AE05> { [ 0x010004ab, 0x010004aa, 5, 5 ] }; - key <AE06> { [ colon, semicolon, 6, 6 ] }; - key <AE07> { [ 0x01000499, 0x01000498, 7, 7 ] }; - key <AE08> { [ 0x010004bb, 0x010004ba, 8, 8 ] }; - key <AE09> { [ question, parenleft, 9, 9 ] }; - key <AE10> { [ numerosign, parenright, 0, 0 ] }; - key <AE11> { [ minus, percent, minus, underscore ]}; - key <AE12> { [ 0x010004af, 0x010004ae, equal, plus ]}; - key <BKSL> { [ 0x010004a3, 0x010004a2, backslash, slash ]}; + key <TLDE> { [ 0x010004d9, 0x010004d8, Cyrillic_io, Cyrillic_IO ] }; + key <AE01> { [ exclam, quotedbl, 1, 1 ] }; + key <AE02> { [ 0x010004e9, 0x010004e8, 2, 2 ] }; + key <AE03> { [ 0x010004a1, 0x010004a0, 3, 3 ] }; + key <AE04> { [ 0x01000493, 0x01000492, 4, 4 ] }; + key <AE05> { [ 0x010004ab, 0x010004aa, 5, 5 ] }; + key <AE06> { [ colon, semicolon, 6, 6 ] }; + key <AE07> { [ 0x01000499, 0x01000498, 7, 7 ] }; + key <AE08> { [ 0x010004bb, 0x010004ba, 8, 8 ] }; + key <AE09> { [ question, parenleft, 9, 9 ] }; + key <AE10> { [ numerosign, parenright, 0, 0 ] }; + key <AE11> { [ minus, percent, minus, underscore ] }; + key <AE12> { [ 0x010004af, 0x010004ae, equal, plus ] }; + key <BKSL> { [ 0x010004a3, 0x010004a2, backslash, slash ] }; include "level3(ralt_switch)" }; -// Serbian charecters added as third level symbols to Russian keyboard layout. - +// Serbian characters are added as third-level symbols to Russian keyboard layout. partial alphanumeric_keys xkb_symbols "srp" { - include "ru(common)" - include "level3(ralt_switch)" + include "ru(common)" name[Group1]= "Serbian (Russia)"; - key <AE03> { [ 3, numerosign ] }; - key <AE04> { [ 4, semicolon ] }; - key <AE05> { [ 5, percent ] }; - key <AE06> { [ 6, colon ] }; - key <AE07> { [ 7, question ] }; - key <AE08> { [ 8, asterisk ] }; - key <AB10> { [ period, comma ] }; - key <BKSL> { [ backslash, slash ] }; - key <AD01> { [ Cyrillic_shorti, Cyrillic_SHORTI, U458, U408 ] }; - key <AD06> { [ Cyrillic_en, Cyrillic_EN, U45A, U40A ] }; - key <AC08> { [ Cyrillic_el, Cyrillic_EL, U459, U409 ] }; - key <AC09> { [ Cyrillic_de, Cyrillic_DE, U45F, U40F ] }; - key <AC10> { [ Cyrillic_zhe, Cyrillic_ZHE, U452, U402 ] }; - key <AB02> { [ Cyrillic_che, Cyrillic_CHE, U45B, U40B ] }; + key <AE03> { [ 3, numerosign ] }; + key <AE04> { [ 4, semicolon ] }; + key <AE05> { [ 5, percent ] }; + key <AE06> { [ 6, colon ] }; + key <AE07> { [ 7, question ] }; + key <AE08> { [ 8, asterisk ] }; + key <AB10> { [ period, comma ] }; + key <BKSL> { [ backslash, slash ] }; + key <AD01> { [ Cyrillic_shorti, Cyrillic_SHORTI, U458, U408 ] }; + key <AD06> { [ Cyrillic_en, Cyrillic_EN, U45A, U40A ] }; + key <AC08> { [ Cyrillic_el, Cyrillic_EL, U459, U409 ] }; + key <AC09> { [ Cyrillic_de, Cyrillic_DE, U45F, U40F ] }; + key <AC10> { [ Cyrillic_zhe, Cyrillic_ZHE, U452, U402 ] }; + key <AB02> { [ Cyrillic_che, Cyrillic_CHE, U45B, U40B ] }; + + include "level3(ralt_switch)" }; // Mari language layout -// based on Russian standard keyboard // http://www.marlamuter.ru/ partial alphanumeric_keys xkb_symbols "chm" { - include "ru(common)" + include "ru(common)" name[Group1]= "Mari"; key.type[group1]="FOUR_LEVEL_ALPHABETIC"; - key <AC04> { [ Cyrillic_a, Cyrillic_A, U04D3, U04D2 ] }; - key <AD03> { [ Cyrillic_u, Cyrillic_U, U04F1, U04F0 ] }; - key <AC02> { [ Cyrillic_ui, Cyrillic_UI, U04F9, U04F8 ] }; - key <AD06> { [ Cyrillic_n, Cyrillic_N, U04A5, U04A4 ] }; - key <AC11> { [ Cyrillic_e, Cyrillic_E, U04E9, U04E8 ] }; - key <AC10> { [ Cyrillic_zh, Cyrillic_ZH, U04EB, U04EA ] }; - key <AC01> { [ Cyrillic_f, Cyrillic_F, UF537, UF536 ] }; + + key <AC04> { [ Cyrillic_a, Cyrillic_A, U04D3, U04D2 ] }; + key <AD03> { [ Cyrillic_u, Cyrillic_U, U04F1, U04F0 ] }; + key <AC02> { [ Cyrillic_yeru, Cyrillic_YERU, U04F9, U04F8 ] }; + key <AD06> { [ Cyrillic_en, Cyrillic_EN, U04A5, U04A4 ] }; + key <AC11> { [ Cyrillic_e, Cyrillic_E, U04E9, U04E8 ] }; + key <AC10> { [ Cyrillic_zhe, Cyrillic_ZHE, U04EB, U04EA ] }; + key <AC01> { [ Cyrillic_ef, Cyrillic_EF, UF537, UF536 ] }; include "level3(ralt_switch)" }; @@ -529,71 +499,73 @@ xkb_symbols "chm" { // EXTRAS: // Church Slavonic language layout -// based on -// russian standard keyboard -// Aleksandr Andreev and Yuri Shardt -// Last Changes 2010/08/01. Contact <aleksandr.andreev@gmail.com> - +// based on the Russian standard keyboard +// by Aleksandr Andreev and Yuri Shardt +// last changes 2010/08/01; contact <aleksandr.andreev@gmail.com> partial alphanumeric_keys -xkb_symbols "chu" -{ - name[Group1]= "Church Slavonic"; - key <TLDE> { [ U0457, U0407, U0482, U20DD ] }; // ї Ї ҂ e.g: а⃝ where the last is a combining ten thousands sign - key <AE01> { [ U0461, U0460, U047D, U047C] }; // ѡ Ѡ ѽ Ѽ - key <AE02> { [ U0454, U0404, U0465, U0464] }; // є Є ѥ Ѥ - key <AE03> { [ U046F, U046E, U0469, U0468] }; // ѯ Ѯ ѩ Ѩ - key <AE04> { [ U0471, U0470, U046D, U046C] }; // ѱ Ѱ ѭ Ѭ - key <AE05> { [ U0473, U0472, UA657, UA656] }; // ѳ Ѳ iotified A - key <AE06> { [ U0475, U0474, U0477, U0476] }; // ѵ Ѵ ѷ Ѷ - key <AE07> { [ U047B, U047A, UA64D, UA64C] }; // ѻ Ѻ ꙍ Ꙍ - key <AE08> { [ U047F, U047E, U046B, U046A] }; // ѿ Ѿ ѫ Ѫ - key <AE09> { [ U0455, U0405, parenleft, U002A ] }; // ѕ Ѕ ( * - key <AE10> { [ Cyrillic_u, Cyrillic_U, parenright, U0488 ] }; // у У ) NB: for diagraph Ouk, use Cyrillic_o + Cyrillic_u - key <AE11> { [ U0483, U0486, U0487, U005F] }; // а҃ а҆ а҇, _ (titlo, psili, pokrytie, underscore) - key <AE12> { [ U0301, U0300, U0484, UA67E] }; // а̀ а́ а҄ ꙾ (oxia, varia, kamora, kavyka) - key <AD01> { [ Cyrillic_shorti, Cyrillic_SHORTI, U0456 ] }; - key <AD02> { [ Cyrillic_tse, Cyrillic_TSE, U2DF0 ] }; - key <AD03> { [ UA64B, UA64A, U2DF9 ] }; // Cyrillic monograph Uk (not U)! - key <AD04> { [ Cyrillic_ka, Cyrillic_KA, U2DE6 ] }; - key <AD05> { [ Cyrillic_ie, Cyrillic_IE, U2DF7 ] }; - key <AD06> { [ Cyrillic_en, Cyrillic_EN, U2DE9 ] }; - key <AD07> { [ Cyrillic_ghe, Cyrillic_GHE, U2DE2 ] }; - key <AD08> { [ Cyrillic_sha, Cyrillic_SHA, U2DF2 ] }; - key <AD09> { [ Cyrillic_shcha, Cyrillic_SHCHA, U2DF3 ] }; - key <AD10> { [ Cyrillic_ze, Cyrillic_ZE, U2DE5 ] }; - key <AD11> { [ Cyrillic_ha, Cyrillic_HA, U2DEF ] }; - key <AD12> { [Cyrillic_hardsign,Cyrillic_HARDSIGN, UA67D ] }; // Payerok - key <BKSL> { [backslash, slash, colon, question] }; // \ / : ? (note, for Slavonic question use semicolon - key <AC01> { [ Cyrillic_ef, Cyrillic_EF ] }; - key <AC02> { [ Cyrillic_yeru, Cyrillic_YERU ] }; - key <AC03> { [ Cyrillic_ve, Cyrillic_VE, U2DE1 ] }; - key <AC04> { [ Cyrillic_a, Cyrillic_A, U2DF6 ] }; - key <AC05> { [ Cyrillic_pe, Cyrillic_PE, U2DEB ] }; - key <AC06> { [ Cyrillic_er, Cyrillic_ER, U2DEC ] }; - key <AC07> { [ Cyrillic_o, Cyrillic_O, U2DEA ] }; - key <AC08> { [ Cyrillic_el, Cyrillic_EL, U2DE7 ] }; - key <AC09> { [ Cyrillic_de, Cyrillic_DE, U2DE3 ] }; - key <AC10> { [ Cyrillic_zhe, Cyrillic_ZHE, U2DE4 ] }; - key <AC11> { [ U0463, U0462, U2DFA ] }; // Yat - key <AB01> { [ U0467, U0466, U2DFD ] }; // Small Yus - key <AB02> { [ Cyrillic_che, Cyrillic_CHE, U2DF1 ] }; - key <AB03> { [ Cyrillic_es, Cyrillic_ES, U2DED ] }; - key <AB04> { [ Cyrillic_em, Cyrillic_EM, U2DE8 ] }; - key <AB05> { [ Cyrillic_i, Cyrillic_I ] }; - key <AB06> { [ Cyrillic_te, Cyrillic_TE, U2DEE ] }; - key <AB07> { [Cyrillic_softsign,Cyrillic_SOFTSIGN ] }; - key <AB08> { [ Cyrillic_be, Cyrillic_BE, U2DE0 ] }; - key <AB09> { [ Cyrillic_yu, Cyrillic_YU, U2DFB ] }; - key <AB10> { [ period, comma, semicolon, exclam ] }; +xkb_symbols "chu" { + + name[Group1]= "Church Slavonic"; + + key <TLDE> { [ U0457, U0407, U0482, U20DD ] }; // ї Ї ҂ e.g: а⃝ where the last is a combining ten thousands sign + key <AE01> { [ U0461, U0460, U047D, U047C ] }; // ѡ Ѡ ѽ Ѽ + key <AE02> { [ U0454, U0404, U0465, U0464 ] }; // є Є ѥ Ѥ + key <AE03> { [ U046F, U046E, U0469, U0468 ] }; // ѯ Ѯ ѩ Ѩ + key <AE04> { [ U0471, U0470, U046D, U046C ] }; // ѱ Ѱ ѭ Ѭ + key <AE05> { [ U0473, U0472, UA657, UA656 ] }; // ѳ Ѳ iotified A + key <AE06> { [ U0475, U0474, U0477, U0476 ] }; // ѵ Ѵ ѷ Ѷ + key <AE07> { [ U047B, U047A, UA64D, UA64C ] }; // ѻ Ѻ ꙍ Ꙍ + key <AE08> { [ U047F, U047E, U046B, U046A ] }; // ѿ Ѿ ѫ Ѫ + key <AE09> { [ U0455, U0405,parenleft,U002A ] }; // ѕ Ѕ ( * + key <AE10> { [Cyrillic_u,Cyrillic_U,parenright,U0488]}; // у У ) NB: for digraph Ouk, use Cyrillic_o + Cyrillic_u + key <AE11> { [ U0483, U0486, U0487, U005F ] }; // а҃ а҆ а҇, _ (titlo, psili, pokrytie, underscore) + key <AE12> { [ U0301, U0300, U0484, UA67E ] }; // а̀ а́ а҄ ꙾ (oxia, varia, kamora, kavyka) + + key <AD01> { [ Cyrillic_shorti, Cyrillic_SHORTI, U0456 ] }; + key <AD02> { [ Cyrillic_tse, Cyrillic_TSE, U2DF0 ] }; + key <AD03> { [ UA64B, UA64A, U2DF9 ] }; // Cyrillic monograph Uk (not U)! + key <AD04> { [ Cyrillic_ka, Cyrillic_KA, U2DE6 ] }; + key <AD05> { [ Cyrillic_ie, Cyrillic_IE, U2DF7 ] }; + key <AD06> { [ Cyrillic_en, Cyrillic_EN, U2DE9 ] }; + key <AD07> { [ Cyrillic_ghe, Cyrillic_GHE, U2DE2 ] }; + key <AD08> { [ Cyrillic_sha, Cyrillic_SHA, U2DF2 ] }; + key <AD09> { [ Cyrillic_shcha, Cyrillic_SHCHA, U2DF3 ] }; + key <AD10> { [ Cyrillic_ze, Cyrillic_ZE, U2DE5 ] }; + key <AD11> { [ Cyrillic_ha, Cyrillic_HA, U2DEF ] }; + key <AD12> { [Cyrillic_hardsign,Cyrillic_HARDSIGN, UA67D ] }; // Payerok + key <BKSL> { [ backslash, slash, colon, question ] }; // \ / : ? NB: for Slavonic question, use semicolon + + key <AC01> { [ Cyrillic_ef, Cyrillic_EF ] }; + key <AC02> { [ Cyrillic_yeru, Cyrillic_YERU ] }; + key <AC03> { [ Cyrillic_ve, Cyrillic_VE, U2DE1 ] }; + key <AC04> { [ Cyrillic_a, Cyrillic_A, U2DF6 ] }; + key <AC05> { [ Cyrillic_pe, Cyrillic_PE, U2DEB ] }; + key <AC06> { [ Cyrillic_er, Cyrillic_ER, U2DEC ] }; + key <AC07> { [ Cyrillic_o, Cyrillic_O, U2DEA ] }; + key <AC08> { [ Cyrillic_el, Cyrillic_EL, U2DE7 ] }; + key <AC09> { [ Cyrillic_de, Cyrillic_DE, U2DE3 ] }; + key <AC10> { [ Cyrillic_zhe, Cyrillic_ZHE, U2DE4 ] }; + key <AC11> { [ U0463, U0462, U2DFA ] }; // Yat + + key <AB01> { [ U0467, U0466, U2DFD ] }; // Small Yus + key <AB02> { [ Cyrillic_che, Cyrillic_CHE, U2DF1 ] }; + key <AB03> { [ Cyrillic_es, Cyrillic_ES, U2DED ] }; + key <AB04> { [ Cyrillic_em, Cyrillic_EM, U2DE8 ] }; + key <AB05> { [ Cyrillic_i, Cyrillic_I ] }; + key <AB06> { [ Cyrillic_te, Cyrillic_TE, U2DEE ] }; + key <AB07> { [Cyrillic_softsign,Cyrillic_SOFTSIGN ] }; + key <AB08> { [ Cyrillic_be, Cyrillic_BE, U2DE0 ] }; + key <AB09> { [ Cyrillic_yu, Cyrillic_YU, U2DFB ] }; + key <AB10> { [ period, comma, semicolon, exclam ] }; }; // RUU (Russian-Ukrainian United keyboard layout). -// Modified Russian standart keyboard with third level contains Ukrainian -// and Belorusian alphabetic letters and commonly used Unicode symbols. -// Description http://wiki.opennet.ru/RUU [russian] +// This is a modified Russian standard keyboard, with the third level containing +// Ukrainian and Belorusian alphabetic letters and commonly used Unicode symbols. +// For a description see http://wiki.opennet.ru/RUU [in Russian]. // Vasyĺ V. Vercynśkyj <fuckel@ukr.net> -// Last Changes 2011/05/11 +// last changes 2011/05/11 // // ┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┲━━━━━━━━━┓ // │ ' ~ │ ! ≈ │ " ∞ │ № ₴ │ ; € │ % ‰ │ : ≤ │ ? ≥ │ * × │ ( { │ ) } │ _ – │ + ± ┃ ⌫ ┃ @@ -611,43 +583,43 @@ xkb_symbols "chu" // ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ // ┃ Ctrl ┃ Meta ┃ Alt ┃ Space ┃AltGr ⇮┃ Menu ┃ Ctrl ┃ // ┗━━━━━━━┻━━━━━━━┻━━━━━━━┹───────────────────────────────────┺━━━━━━━┻━━━━━━━┻━━━━━━━┛ - - - partial alphanumeric_keys xkb_symbols "ruu" { - include "ru(common)" + include "ru(common)" name[Group1]= "Russian (with Ukrainian-Belorussian layout)"; - key <TLDE> { [ U2019, apostrophe, U0301, asciitilde ] }; // Apostrophe and Stress symbol - key <AE01> { [ 1, exclam, U00F7, U2248 ] }; // Division Sign and Almost Equal To - key <AE02> { [ 2, quotedbl, currency, infinity ] }; - key <AE03> { [ 3, numerosign, U00A7, U20B4 ] }; // Paragraph and Hryvnia sign - key <AE04> { [ 4, semicolon, dollar, EuroSign ] }; - key <AE05> { [ 5, percent, degree, U2030 ] }; // Per Mille Sign - key <AE06> { [ 6, colon, less, U2264 ] }; // Less-Than Or Equal To - key <AE07> { [ 7, question, greater, U2265 ] }; // Greater-Than Or Equal To - key <AE08> { [ 8, asterisk, enfilledcircbullet, U00D7 ] }; // Multiplication Sign - key <AE09> { [ 9, parenleft, bracketleft, braceleft ] }; - key <AE10> { [ 0, parenright, bracketright, braceright ] }; - key <AE11> { [ minus, underscore, emdash, endash ] }; - key <AE12> { [ equal, plus, notequal, plusminus ] }; - key <AD03> { [ Cyrillic_u, Cyrillic_U, Byelorussian_shortu, Byelorussian_SHORTU ] }; - key <AD04> { [ Cyrillic_ka, Cyrillic_KA, registered ] }; // Registered tm - key <AD05> { [ Cyrillic_ie, Cyrillic_IE, Cyrillic_io, Cyrillic_IO ] }; - key <AD07> { [Cyrillic_ghe, Cyrillic_GHE, Ukrainian_ghe_with_upturn, Ukrainian_GHE_WITH_UPTURN ] }; - key <AD10> { [ Cyrillic_ze, Cyrillic_ZE, U00B6 ] }; // Pilcrow Sign - key <AD12> { [Cyrillic_hardsign, Cyrillic_HARDSIGN, Ukrainian_yi, Ukrainian_YI ] }; - key <AC02> { [ Cyrillic_yeru, Cyrillic_YERU, Ukrainian_i, Ukrainian_I ] }; - key <AC11> { [ Cyrillic_e, Cyrillic_E, Ukrainian_ie,Ukrainian_IE ] }; - key <BKSL> { [ slash, bar, backslash, U00A6 ] }; // Broken Bar - key <AB03> { [ Cyrillic_es, Cyrillic_ES, copyright ] }; - key <AB06> { [ Cyrillic_te, Cyrillic_TE, trademark ] }; - key <AB07> { [ Cyrillic_softsign, Cyrillic_SOFTSIGN, U00B5 ] }; // Micro Sign - key <AB08> { [ Cyrillic_be, Cyrillic_BE, guillemotleft, doublelowquotemark ] }; - key <AB09> { [ Cyrillic_yu, Cyrillic_YU, guillemotright, leftdoublequotemark ] }; - key <AB10> { [ period, comma, slash, ellipsis ] }; + key <TLDE> { [ U2019, apostrophe, U0301, asciitilde ] }; // Apostrophe and Stress symbol + key <AE01> { [ 1, exclam, U00F7, U2248 ] }; // Division Sign and Almost Equal To + key <AE02> { [ 2, quotedbl, currency, infinity ] }; + key <AE03> { [ 3, numerosign, U00A7, U20B4 ] }; // Paragraph and Hryvnia sign + key <AE04> { [ 4, semicolon, dollar, EuroSign ] }; + key <AE05> { [ 5, percent, degree, U2030 ] }; // Per Mille Sign + key <AE06> { [ 6, colon, less, U2264 ] }; // Less-Than Or Equal To + key <AE07> { [ 7, question, greater, U2265 ] }; // Greater-Than Or Equal To + key <AE08> { [ 8, asterisk, enfilledcircbullet, U00D7 ] }; // Multiplication Sign + key <AE09> { [ 9, parenleft, bracketleft, braceleft ] }; + key <AE10> { [ 0, parenright, bracketright, braceright ] }; + key <AE11> { [ minus, underscore, emdash, endash ] }; + key <AE12> { [ equal, plus, notequal, plusminus ] }; + + key <AD03> { [ Cyrillic_u, Cyrillic_U, Byelorussian_shortu, Byelorussian_SHORTU ] }; + key <AD04> { [ Cyrillic_ka, Cyrillic_KA, registered ] }; // Registered tm + key <AD05> { [ Cyrillic_ie, Cyrillic_IE, Cyrillic_io, Cyrillic_IO ] }; + key <AD07> { [ Cyrillic_ghe, Cyrillic_GHE, Ukrainian_ghe_with_upturn, Ukrainian_GHE_WITH_UPTURN ] }; + key <AD10> { [ Cyrillic_ze, Cyrillic_ZE, U00B6 ] }; // Pilcrow Sign + key <AD12> { [ Cyrillic_hardsign, Cyrillic_HARDSIGN, Ukrainian_yi, Ukrainian_YI ] }; + + key <AC02> { [ Cyrillic_yeru, Cyrillic_YERU, Ukrainian_i, Ukrainian_I ] }; + key <AC11> { [ Cyrillic_e, Cyrillic_E, Ukrainian_ie, Ukrainian_IE ] }; + key <BKSL> { [ slash, bar, backslash, U00A6 ] }; // Broken Bar + + key <AB03> { [ Cyrillic_es, Cyrillic_ES, copyright ] }; + key <AB06> { [ Cyrillic_te, Cyrillic_TE, trademark ] }; + key <AB07> { [ Cyrillic_softsign, Cyrillic_SOFTSIGN, U00B5 ] }; // Micro Sign + key <AB08> { [ Cyrillic_be, Cyrillic_BE, guillemotleft, doublelowquotemark ] }; + key <AB09> { [ Cyrillic_yu, Cyrillic_YU, guillemotright, leftdoublequotemark ] }; + key <AB10> { [ period, comma, slash, ellipsis ] }; include "level3(ralt_switch)" }; @@ -660,18 +632,18 @@ partial alphanumeric_keys // Apple layout partial alphanumeric_keys xkb_symbols "mac" { -include "ru(common)" + include "ru(common)" name[Group1]= "Russian (Macintosh)"; - key <LSGT> { [ less, greater ] }; - key <AE02> { [ 2, quotedbl ] }; - key <AE03> { [ 3, numerosign ] }; - key <AE04> { [ 4, percent ] }; - key <AE05> { [ 5, colon ] }; - key <AE06> { [ 6, comma ] }; - key <AE07> { [ 7, period ] }; - key <AE08> { [ 8, semicolon ] }; - key <TLDE> { [ bracketright, bracketleft ] }; - key <BKSL> { [ Cyrillic_io, Cyrillic_IO ] }; + key <LSGT> { [ less, greater ] }; + key <AE02> { [ 2, quotedbl ] }; + key <AE03> { [ 3, numerosign ] }; + key <AE04> { [ 4, percent ] }; + key <AE05> { [ 5, colon ] }; + key <AE06> { [ 6, comma ] }; + key <AE07> { [ 7, period ] }; + key <AE08> { [ 8, semicolon ] }; + key <TLDE> { [ bracketright, bracketleft ] }; + key <BKSL> { [ Cyrillic_io, Cyrillic_IO ] }; }; diff --git a/xorg-server/xkeyboard-config/symbols/se b/xorg-server/xkeyboard-config/symbols/se index 320a1861d..be07cadf9 100644 --- a/xorg-server/xkeyboard-config/symbols/se +++ b/xorg-server/xkeyboard-config/symbols/se @@ -309,3 +309,54 @@ partial alphanumeric_keys xkb_symbols "sun_type6" { include "sun_vndr/se(sun_type6)" }; + +partial alphanumeric_keys +xkb_symbols "dvorak_a5" { + + include "se(basic)" + + name[Group1]="Swedish (Dvorak A5)"; + + key <AE12> { [ dead_acute, dead_grave, plusminus, none ] }; + + key <AD01> { [ aring, Aring, braceleft, none ] }; + key <AD02> { [ adiaeresis, Adiaeresis, braceright, none ] }; + key <AD03> { [ odiaeresis, Odiaeresis, bracketleft, none ] }; + key <AD04> { [ p, P, bracketright, none ] }; + key <AD05> { [ y, Y, dollar, none ] }; + key <AD06> { [ f, F, quotedbl, none ] }; + key <AD07> { [ g, G, question, none ] }; + key <AD08> { [ c, C, ampersand, none ] }; + key <AD09> { [ r, R, less, none ] }; + key <AD10> { [ l, L, greater, none ] }; + key <AD11> { [ comma, semicolon, dead_cedilla, none ] }; + key <AD12> { [ dead_diaeresis, dead_circumflex, dead_tilde, asciicircum ] }; + + key <AC01> { [ a, A, semicolon, none ] }; + key <AC02> { [ o, O, slash, none ] }; + key <AC03> { [ e, E, parenleft, none ] }; + key <AC04> { [ u, U, parenright, none ] }; + key <AC05> { [ i, I, bar, none ] }; + key <AC06> { [ d, D, numbersign, none ] }; + key <AC07> { [ h, H, asciicircum, none ] }; + key <AC08> { [ t, T, numbersign, none ] }; + key <AC09> { [ n, N, quotedbl, none ] }; + key <AC10> { [ s, S, asciitilde, none ] }; + key <AC11> { [ minus, underscore, grave, none ] }; + + key <AB01> { [ period, colon, colon, none ] }; + key <AB02> { [ q, Q, equal, none ] }; + key <AB03> { [ j, J, at, none ] }; + key <AB04> { [ k, K, exclam, none ] }; + key <AB05> { [ x, X, backslash, none ] }; + key <AB06> { [ b, B, percent, none ] }; + key <AB07> { [ m, M, grave, none ] }; + key <AB08> { [ w, W, lstroke, none ] }; + key <AB09> { [ v, V, leftdoublequotemark, none ] }; + key <AB10> { [ z, Z, guillemotleft, none ] }; + + key <BKSL> { [ apostrophe, asterisk, asterisk, none ] }; + +}; + + diff --git a/xorg-server/xkeyboard-config/symbols/sk b/xorg-server/xkeyboard-config/symbols/sk index 2162d533d..3be0b92e8 100644 --- a/xorg-server/xkeyboard-config/symbols/sk +++ b/xorg-server/xkeyboard-config/symbols/sk @@ -1,105 +1,105 @@ default partial alphanumeric_keys xkb_symbols "basic" { - // This layout conforms to a new sk compromise standard designed - // to satisfy most unix, windows and mac users. - // 2001 by Kamil Toman <ktoman@email.cz> + // This layout conforms to a new Slovak compromise standard + // designed to satisfy most Unix, Windows and Mac users. + // 2001 by Kamil Toman <ktoman@email.cz> include "latin" - name[Group1] = "Slovak"; - key <TLDE> { [ semicolon, dead_abovering, grave, asciitilde ] }; - key <AE01> { [ plus, 1, exclam, dead_tilde ] }; - key <AE02> { [ lcaron, 2, at, dead_caron ] }; - key <AE03> { [ scaron, 3, numbersign, dead_circumflex ] }; - key <AE04> { [ ccaron, 4, dollar, dead_breve ] }; - key <AE05> { [ tcaron, 5, percent, dead_abovering ] }; - key <AE06> { [ zcaron, 6, asciicircum, dead_ogonek ] }; - key <AE07> { [ yacute, 7, ampersand, dead_grave ] }; - key <AE08> { [ aacute, 8, asterisk, dead_abovedot ] }; - key <AE09> { [ iacute, 9, braceleft, dead_acute ] }; - key <AE10> { [ eacute, 0, braceright, dead_doubleacute ] }; - key <AE11> { [ equal, percent, NoSymbol, dead_diaeresis ] }; - key <AE12> { [dead_acute, dead_caron, dead_macron, dead_cedilla ] }; - - key <AD01> { [ q, Q, backslash, NoSymbol ] }; - key <AD02> { [ w, W, bar, Nosymbol ] }; - key <AD03> { [ e, E, EuroSign, NoSymbol ] }; - key <AD04> { [ r, R, NoSymbol, NoSymbol ] }; - key <AD05> { [ t, T, NoSymbol, NoSymbol ] }; - key <AD06> { [ z, Z, NoSymbol, NoSymbol ] }; - key <AD07> { [ u, U, NoSymbol, NoSymbol ] }; - key <AD08> { [ i, I, NoSymbol, NoSymbol ] }; - key <AD09> { [ o, O, NoSymbol, NoSymbol ] }; - key <AD10> { [ p, P, NoSymbol, NoSymbol ] }; - - key <AD11> { [ uacute, slash, bracketleft, division ] }; - key <AD12> { [adiaeresis, parenleft, bracketright, multiply ] }; - - key <AC01> { [ a, A, asciitilde, NoSymbol ] }; - key <AC02> { [ s, S, dstroke, NoSymbol ] }; - key <AC03> { [ d, D, Dstroke, NoSymbol ] }; - key <AC04> { [ f, F, bracketleft, NoSymbol ] }; - key <AC05> { [ g, G, bracketright, NoSymbol ] }; - key <AC06> { [ h, H, grave, NoSymbol ] }; - key <AC07> { [ j, J, apostrophe, NoSymbol ] }; - key <AC08> { [ k, K, lstroke, NoSymbol ] }; - key <AC09> { [ l, L, Lstroke, NoSymbol ] }; - - key <AC10> { [ocircumflex, quotedbl, dollar, NoSymbol ] }; - key <AC11> { [ section, exclam, apostrophe, ssharp ] }; - key <AC12> { [ EuroSign, dead_diaeresis, NoSymbol, NoSymbol ] }; - key <BKSL> { [ ncaron, parenright, backslash, bar ] }; - - key <LSGT> { [ backslash, bar, slash, NoSymbol ] }; - key <AB01> { [ y, Y, degree, NoSymbol ] }; - key <AB02> { [ x, X, numbersign, Nosymbol ] }; - key <AB03> { [ c, C, ampersand, NoSymbol ] }; - key <AB04> { [ v, V, at, NoSymbol ] }; - key <AB05> { [ b, B, braceleft, NoSymbol ] }; - key <AB06> { [ n, N, braceright, NoSymbol ] }; - key <AB07> { [ m, M, asciicircum, NoSymbol ] }; - key <AB08> { [ comma, question, less, NoSymbol ] }; - key <AB09> { [ period, colon, greater, NoSymbol ] }; - key <AB10> { [ minus, underscore, asterisk, NoSymbol ] }; + key <TLDE> { [ semicolon, dead_abovering, grave, asciitilde ] }; + key <AE01> { [ plus, 1, exclam, dead_tilde ] }; + key <AE02> { [ lcaron, 2, at, dead_caron ] }; + key <AE03> { [ scaron, 3, numbersign, dead_circumflex ] }; + key <AE04> { [ ccaron, 4, dollar, dead_breve ] }; + key <AE05> { [ tcaron, 5, percent, dead_abovering]}; + key <AE06> { [ zcaron, 6, asciicircum, dead_ogonek ] }; + key <AE07> { [ yacute, 7, ampersand, dead_grave ] }; + key <AE08> { [ aacute, 8, asterisk, dead_abovedot] }; + key <AE09> { [ iacute, 9, braceleft, dead_acute ] }; + key <AE10> { [ eacute, 0, braceright, dead_doubleacute ] }; + key <AE11> { [ equal, percent, NoSymbol, dead_diaeresis]}; + key <AE12> { [dead_acute, dead_caron, dead_macron, dead_cedilla ] }; + + key <AD01> { [ q, Q, backslash, NoSymbol ] }; + key <AD02> { [ w, W, bar, Nosymbol ] }; + key <AD03> { [ e, E, EuroSign, NoSymbol ] }; + key <AD04> { [ r, R, NoSymbol, NoSymbol ] }; + key <AD05> { [ t, T, NoSymbol, NoSymbol ] }; + key <AD06> { [ z, Z, NoSymbol, NoSymbol ] }; + key <AD07> { [ u, U, NoSymbol, NoSymbol ] }; + key <AD08> { [ i, I, NoSymbol, NoSymbol ] }; + key <AD09> { [ o, O, NoSymbol, NoSymbol ] }; + key <AD10> { [ p, P, NoSymbol, NoSymbol ] }; + + key <AD11> { [ uacute, slash, bracketleft, division ] }; + key <AD12> { [adiaeresis, parenleft, bracketright, multiply ] }; + + key <AC01> { [ a, A, asciitilde, NoSymbol ] }; + key <AC02> { [ s, S, dstroke, NoSymbol ] }; + key <AC03> { [ d, D, Dstroke, NoSymbol ] }; + key <AC04> { [ f, F, bracketleft, NoSymbol ] }; + key <AC05> { [ g, G, bracketright, NoSymbol ] }; + key <AC06> { [ h, H, grave, NoSymbol ] }; + key <AC07> { [ j, J, apostrophe, NoSymbol ] }; + key <AC08> { [ k, K, lstroke, NoSymbol ] }; + key <AC09> { [ l, L, Lstroke, NoSymbol ] }; + + key <AC10> { [ocircumflex, quotedbl, dollar, NoSymbol ] }; + key <AC11> { [ section, exclam, apostrophe, ssharp ] }; + key <AC12> { [ EuroSign, dead_diaeresis, NoSymbol, NoSymbol ] }; + key <BKSL> { [ ncaron, parenright, backslash, bar ] }; + + key <LSGT> { [ backslash, bar, slash, NoSymbol ] }; + key <AB01> { [ y, Y, degree, NoSymbol ] }; + key <AB02> { [ x, X, numbersign, Nosymbol ] }; + key <AB03> { [ c, C, ampersand, NoSymbol ] }; + key <AB04> { [ v, V, at, NoSymbol ] }; + key <AB05> { [ b, B, braceleft, NoSymbol ] }; + key <AB06> { [ n, N, braceright, NoSymbol ] }; + key <AB07> { [ m, M, asciicircum, NoSymbol ] }; + key <AB08> { [ comma, question, less, NoSymbol ] }; + key <AB09> { [ period, colon, greater, NoSymbol ] }; + key <AB10> { [ minus, underscore, asterisk, NoSymbol ] }; key <SPCE> { [ space, space, nobreakspace, nobreakspace ] }; include "level3(ralt_switch)" }; -// Use <BKSL> instead of <LSGT> (useful for keyboard without <LSGT> key) xkb_symbols "bksl" { - include "sk(basic)" + // Use <BKSL> instead of <LSGT> (useful for keyboards without <LSGT> key). + + include "sk(basic)" name[Group1] = "Slovak (extended Backslash)"; - key <BKSL> { [ backslash, bar, slash, NoSymbol ] }; + key <BKSL> { [ backslash, bar, slash, NoSymbol ] }; }; partial alphanumeric_keys xkb_symbols "qwerty" { - // This layout should work exactly as a sk with the exception - // of 'Z' and 'Y' keys, which are in the qwerty style (ie. swapped). + // This layout works exactly as the basic Slovak one with the exception + // of the 'Z' and 'Y' keys, which are in Qwerty style (i.e. swapped). // 2001 by Kamil Toman <ktoman@email.cz> include "sk(basic)" - name[Group1] = "Slovak (qwerty)"; - key <AB01> { [ z, Z, degree, NoSymbol ] }; - key <AD06> { [ y, Y, NoSymbol, NoSymbol ] }; + key <AB01> { [ z, Z, degree, NoSymbol ] }; + key <AD06> { [ y, Y, NoSymbol, NoSymbol ] }; }; -// Use <BKSL> instead of <LSGT> (useful for keyboard without <LSGT> key) xkb_symbols "qwerty_bksl" { - include "sk(qwerty)" + // Use <BKSL> instead of <LSGT> (useful for keyboards without <LSGT> key). + + include "sk(qwerty)" name[Group1] = "Slovak (qwerty, extended Backslash)"; - key <BKSL> { [ backslash, bar, slash, NoSymbol ] }; + key <BKSL> { [ backslash, bar, slash, NoSymbol ] }; }; // EXTRAS: diff --git a/xorg-server/xkeyboard-config/symbols/sun_vndr/pl b/xorg-server/xkeyboard-config/symbols/sun_vndr/pl index d5a7f5b04..15e96ef15 100644 --- a/xorg-server/xkeyboard-config/symbols/sun_vndr/pl +++ b/xorg-server/xkeyboard-config/symbols/sun_vndr/pl @@ -40,7 +40,7 @@ xkb_symbols "sun_type6" { key <AE03> { [ 3, numbersign ] }; key <AE04> { [ 4, dollar ] }; key <AE05> { [ 5, percent ] }; - key <AE06> { [ 6, asciicirum ] }; + key <AE06> { [ 6, asciicircum ] }; key <AE07> { [ 7, ampersand ] }; key <AE08> { [ 8, asterisk ] }; key <AE09> { [ 9, parenleft ] }; diff --git a/xorg-server/xkeyboard-config/symbols/sun_vndr/sk b/xorg-server/xkeyboard-config/symbols/sun_vndr/sk index 18696bb3f..0d161a7f0 100644 --- a/xorg-server/xkeyboard-config/symbols/sun_vndr/sk +++ b/xorg-server/xkeyboard-config/symbols/sun_vndr/sk @@ -34,7 +34,7 @@ xkb_symbols "sun_type6" { include "sun_vndr/us(sun_type6)" - key <TLDE> { [ semicolon, dead_abovering, grave asciitilde ] }; + key <TLDE> { [ semicolon, dead_abovering, grave, asciitilde ] }; key <AE01> { [ plus, 1, exclam, asciitilde ] }; key <AE02> { [ lcaron, 2, at, dead_caron ] }; key <AE03> { [ scaron, 3, numbersign, dead_circumflex ] }; diff --git a/xorg-server/xkeyboard-config/symbols/tr b/xorg-server/xkeyboard-config/symbols/tr index 1c288524b..15dd59ca6 100644 --- a/xorg-server/xkeyboard-config/symbols/tr +++ b/xorg-server/xkeyboard-config/symbols/tr @@ -1,9 +1,8 @@ -// based on -// Turkish keyboard symbols for PC and xkb -// This file distributed without any expressed or implied warranty +// Keyboard layouts for Turkey. +// This file distributed without any expressed or implied warranty. // Nilgün Belma Bugüner <nilgun@belgeler.org>, 2005 -//Default Layout (Turkish Q) +// Turkish Q layout default partial xkb_symbols "basic" { @@ -11,54 +10,54 @@ xkb_symbols "basic" { name[Group1]="Turkish"; - key <AE01> { [ 1, exclam, greater, exclamdown ] }; - key <AE02> { [ 2, apostrophe, sterling, twosuperior ] }; - key <AE03> { [ 3, asciicircum, numbersign, threesuperior ] }; - key <AE04> { [ 4, plus, dollar, onequarter ] }; - key <AE06> { [ 6, ampersand, threequarters, VoidSymbol ] }; - key <AE07> { [ 7, slash, braceleft, VoidSymbol ] }; - key <AE08> { [ 8, parenleft, bracketleft, VoidSymbol ] }; - key <AE09> { [ 9, parenright, bracketright, plusminus ] }; - key <AE10> { [ 0, equal, braceright, degree ] }; - key <AE11> { [ asterisk, question, backslash, questiondown ] }; - key <AE12> { [ minus, underscore, bar, VoidSymbol ] }; - - key <AD02> { [ w, W, VoidSymbol, VoidSymbol ] }; - key <AD03> { [ e, E, EuroSign, VoidSymbol ] }; - key <AD05> { [ t, T, trademark, VoidSymbol ] }; - key <AD07> { [ u, U, ucircumflex, Ucircumflex ] }; - key <AD08> { type[group1] = "FOUR_LEVEL_ALPHABETIC", - [ idotless, I, icircumflex, Icircumflex ] }; - key <AD09> { [ o, O, ocircumflex, Ocircumflex ] }; - key <AD10> { [ p, P, VoidSymbol, VoidSymbol ] }; - key <AD11> { [ gbreve, Gbreve ] }; - key <AD12> { [udiaeresis, Udiaeresis, asciitilde, dead_macron ] }; - - key <AC01> { [ a, A, acircumflex, Acircumflex ] }; - key <AC02> { [ s, S, section, VoidSymbol ] }; - key <AC03> { [ d, D, VoidSymbol, VoidSymbol ] }; - key <AC04> { [ f, F, ordfeminine, VoidSymbol ] }; - key <AC05> { [ g, G, VoidSymbol, VoidSymbol ] }; - key <AC06> { [ h, H, VoidSymbol, VoidSymbol ] }; - key <AC08> { [ k, K, VoidSymbol, VoidSymbol ] }; - key <AC09> { [ l, L, VoidSymbol, VoidSymbol ] }; - key <AC10> { [ scedilla, Scedilla, acute, dead_acute ] }; - key <AC11> { type[group1] = "FOUR_LEVEL_SEMIALPHABETIC", - [ i, Iabovedot, apostrophe, dead_caron ] }; - key <TLDE> { [ quotedbl, eacute, less, degree ] }; - - key <BKSL> { [ comma, semicolon, grave, dead_grave ] }; - key <LSGT> { [ less, greater, bar, brokenbar ] }; - key <AB08> { [odiaeresis, Odiaeresis, multiply, VoidSymbol ] }; - key <AB09> { [ ccedilla, Ccedilla, periodcentered, division ] }; - key <AB10> { [ period, colon, dead_abovedot, dead_abovedot ] }; + key <AE01> { [ 1, exclam, greater, exclamdown ] }; + key <AE02> { [ 2, apostrophe, sterling, twosuperior ] }; + key <AE03> { [ 3,asciicircum, numbersign, threesuperior ] }; + key <AE04> { [ 4, plus, dollar, onequarter ] }; + key <AE06> { [ 6, ampersand, threequarters, VoidSymbol ] }; + key <AE07> { [ 7, slash, braceleft, VoidSymbol ] }; + key <AE08> { [ 8, parenleft, bracketleft, VoidSymbol ] }; + key <AE09> { [ 9, parenright, bracketright, plusminus ] }; + key <AE10> { [ 0, equal, braceright, degree ] }; + key <AE11> { [ asterisk, question, backslash, questiondown ] }; + key <AE12> { [ minus, underscore, bar, VoidSymbol ] }; + + key <AD02> { [ w, W, VoidSymbol, VoidSymbol ] }; + key <AD03> { [ e, E, EuroSign, VoidSymbol ] }; + key <AD05> { [ t, T, trademark, VoidSymbol ] }; + key <AD07> { [ u, U, ucircumflex, Ucircumflex ] }; + key <AD08> { type[group1] = "FOUR_LEVEL_ALPHABETIC", + [ idotless, I, icircumflex, Icircumflex ] }; + key <AD09> { [ o, O, ocircumflex, Ocircumflex ] }; + key <AD10> { [ p, P, VoidSymbol, VoidSymbol ] }; + key <AD11> { [ gbreve, Gbreve ] }; + key <AD12> { [udiaeresis, Udiaeresis, asciitilde, dead_macron ] }; + + key <AC01> { [ a, A, acircumflex, Acircumflex ] }; + key <AC02> { [ s, S, section, VoidSymbol ] }; + key <AC03> { [ d, D, VoidSymbol, VoidSymbol ] }; + key <AC04> { [ f, F, ordfeminine, VoidSymbol ] }; + key <AC05> { [ g, G, VoidSymbol, VoidSymbol ] }; + key <AC06> { [ h, H, VoidSymbol, VoidSymbol ] }; + key <AC08> { [ k, K, VoidSymbol, VoidSymbol ] }; + key <AC09> { [ l, L, VoidSymbol, VoidSymbol ] }; + key <AC10> { [ scedilla, Scedilla, acute, dead_acute ] }; + key <AC11> { type[group1] = "FOUR_LEVEL_SEMIALPHABETIC", + [ i, Iabovedot, apostrophe, dead_caron ] }; + key <TLDE> { [ quotedbl, eacute, less, degree ] }; + + key <BKSL> { [ comma, semicolon, grave, dead_grave ] }; + key <LSGT> { [ less, greater, bar, brokenbar ] }; + key <AB08> { [odiaeresis, Odiaeresis, multiply, VoidSymbol ] }; + key <AB09> { [ ccedilla, Ccedilla,periodcentered, division ] }; + key <AB10> { [ period, colon, dead_abovedot, dead_abovedot ] }; include "kpdl(comma)" include "level3(ralt_switch)" }; -// Turkish F Layout +// Turkish F layout partial xkb_symbols "f" { @@ -66,64 +65,64 @@ xkb_symbols "f" { name[Group1]="Turkish (F)"; - key <AE01> { [ 1, exclam, onesuperior, exclamdown ] }; - key <AE02> { [ 2, quotedbl, twosuperior, VoidSymbol ] }; - key <AE03> { [ 3, asciicircum, numbersign, threesuperior ] }; - key <AE04> { [ 4, dollar, onequarter, VoidSymbol ] }; - key <AE06> { [ 6, ampersand, threequarters, VoidSymbol ] }; - key <AE07> { [ 7, apostrophe, braceleft, VoidSymbol ] }; - key <AE08> { [ 8, parenleft, bracketleft, VoidSymbol ] }; - key <AE09> { [ 9, parenright, bracketright, plusminus ] }; - key <AE10> { [ 0, equal, braceright, degree ] }; - key <AE11> { [ slash, question, backslash, questiondown ] }; - key <AE12> { [ minus, underscore, bar, VoidSymbol ] }; - - key <AD01> { [ f, F, at, VoidSymbol ] }; - key <AD02> { [ g, G, VoidSymbol, VoidSymbol ] }; - key <AD03> { [ gbreve, Gbreve, VoidSymbol, VoidSymbol ] }; - key <AD04> { type[group1] = "FOUR_LEVEL_SEMIALPHABETIC", - [ idotless, I, paragraph, VoidSymbol ] }; - key <AD05> { [ o, O, ocircumflex, Ocircumflex ] }; - key <AD06> { [ d, D, yen, VoidSymbol ] }; - key <AD07> { [ r, R, registered, VoidSymbol ] }; - key <AD08> { [ n, N, VoidSymbol, VoidSymbol ] }; - key <AD09> { [ h, H, degree, VoidSymbol ] }; - key <AD10> { [ p, P, sterling, VoidSymbol ] }; - key <AD11> { [ q, Q, dead_diaeresis, dead_abovering ] }; - key <AD12> { [ w, W, asciitilde, dead_breve ] }; - - key <AC01> { [ u, U, ucircumflex, Ucircumflex ] }; - key <AC02> { type[group1] = "FOUR_LEVEL_ALPHABETIC", - [ i, Iabovedot, icircumflex, Icircumflex ] }; - key <AC03> { [ e, E, EuroSign, VoidSymbol ] }; - key <AC04> { [ a, A, acircumflex, Acircumflex ] }; - key <AC05> { [udiaeresis, Udiaeresis, ucircumflex, Ucircumflex ] }; - key <AC06> { [ t, T, trademark, VoidSymbol ] }; - key <AC07> { [ k, K, VoidSymbol, VoidSymbol ] }; - key <AC08> { [ m, M, mu, VoidSymbol ] }; - key <AC09> { [ l, L, VoidSymbol, VoidSymbol ] }; - key <AC10> { [ y, Y, acute, dead_acute ] }; - key <AC11> { [ scedilla, Scedilla, numbersign, dead_caron ] }; - key <TLDE> { [ plus, asterisk, notsign, plusminus ] }; - - key <BKSL> { [ x, X, grave, dead_grave ] }; - key <AB01> { [ j, J, guillemotleft, VoidSymbol ] }; - key <AB02> { [odiaeresis, Odiaeresis, guillemotright, VoidSymbol ] }; - key <AB03> { [ v, V, leftdoublequotemark, VoidSymbol ] }; - key <AB04> { [ c, C, cent, copyright ] }; - key <AB05> { [ ccedilla, Ccedilla, rightdoublequotemark, VoidSymbol] }; - key <AB06> { [ z, Z, VoidSymbol, VoidSymbol ] }; - key <AB07> { [ s, S, section, VoidSymbol ] }; - key <AB08> { [ b, B, multiply, nobreakspace ] }; - key <AB09> { [ period, colon, division, dead_abovedot] }; - key <AB10> { [ comma, semicolon, periodcentered, VoidSymbol ] }; - key <LSGT> { [ less, greater, bar, brokenbar ] }; + key <AE01> { [ 1, exclam, onesuperior, exclamdown ] }; + key <AE02> { [ 2, quotedbl, twosuperior, VoidSymbol ] }; + key <AE03> { [ 3,asciicircum, numbersign, threesuperior ] }; + key <AE04> { [ 4, dollar, onequarter, VoidSymbol ] }; + key <AE06> { [ 6, ampersand, threequarters, VoidSymbol ] }; + key <AE07> { [ 7, apostrophe, braceleft, VoidSymbol ] }; + key <AE08> { [ 8, parenleft, bracketleft, VoidSymbol ] }; + key <AE09> { [ 9, parenright, bracketright, plusminus ] }; + key <AE10> { [ 0, equal, braceright, degree ] }; + key <AE11> { [ slash, question, backslash, questiondown ] }; + key <AE12> { [ minus, underscore, bar, VoidSymbol ] }; + + key <AD01> { [ f, F, at, VoidSymbol ] }; + key <AD02> { [ g, G, VoidSymbol, VoidSymbol ] }; + key <AD03> { [ gbreve, Gbreve, VoidSymbol, VoidSymbol ] }; + key <AD04> { type[group1] = "FOUR_LEVEL_SEMIALPHABETIC", + [ idotless, I, paragraph, VoidSymbol ] }; + key <AD05> { [ o, O, ocircumflex, Ocircumflex ] }; + key <AD06> { [ d, D, yen, VoidSymbol ] }; + key <AD07> { [ r, R, registered, VoidSymbol ] }; + key <AD08> { [ n, N, VoidSymbol, VoidSymbol ] }; + key <AD09> { [ h, H, degree, VoidSymbol ] }; + key <AD10> { [ p, P, sterling, VoidSymbol ] }; + key <AD11> { [ q, Q,dead_diaeresis,dead_abovering ] }; + key <AD12> { [ w, W, asciitilde, dead_breve ] }; + + key <AC01> { [ u, U, ucircumflex, Ucircumflex ] }; + key <AC02> { type[group1] = "FOUR_LEVEL_ALPHABETIC", + [ i, Iabovedot, icircumflex, Icircumflex ] }; + key <AC03> { [ e, E, EuroSign, VoidSymbol ] }; + key <AC04> { [ a, A, acircumflex, Acircumflex ] }; + key <AC05> { [udiaeresis, Udiaeresis, ucircumflex, Ucircumflex ] }; + key <AC06> { [ t, T, trademark, VoidSymbol ] }; + key <AC07> { [ k, K, VoidSymbol, VoidSymbol ] }; + key <AC08> { [ m, M, mu, VoidSymbol ] }; + key <AC09> { [ l, L, VoidSymbol, VoidSymbol ] }; + key <AC10> { [ y, Y, acute, dead_acute ] }; + key <AC11> { [ scedilla, Scedilla, numbersign, dead_caron ] }; + key <TLDE> { [ plus, asterisk, notsign, plusminus ] }; + + key <BKSL> { [ x, X, grave, dead_grave ] }; + key <AB01> { [ j, J, guillemotleft, VoidSymbol ] }; + key <AB02> { [odiaeresis, Odiaeresis,guillemotright, VoidSymbol ] }; + key <AB03> { [ v, V, leftdoublequotemark, VoidSymbol ] }; + key <AB04> { [ c, C, cent, copyright ] }; + key <AB05> { [ ccedilla, Ccedilla,rightdoublequotemark, VoidSymbol ] }; + key <AB06> { [ z, Z, VoidSymbol, VoidSymbol ] }; + key <AB07> { [ s, S, section, VoidSymbol ] }; + key <AB08> { [ b, B, multiply, nobreakspace ] }; + key <AB09> { [ period, colon, division, dead_abovedot ] }; + key <AB10> { [ comma, semicolon,periodcentered, VoidSymbol ] }; + key <LSGT> { [ less, greater, bar, brokenbar ] }; include "kpdl(comma)" include "level3(ralt_switch)" }; -// Turkish Alt-Q Layout +// Turkish Alt-Q layout partial xkb_symbols "alt" { @@ -135,19 +134,19 @@ xkb_symbols "alt" { key <AE08> { [ 8, asterisk, leftt, topt ] }; key <AE09> { [ 9, parenleft, rightt, bott ] }; key <AE10> { [ 0, parenright, lowrightcorner, uprightcorner ] }; - key <AE11> { [ minus, underscore, horizlinescan5, vertbar ] }; - key <AE12> { [ equal, plus, crossinglines ] }; + key <AE11> { [ minus, underscore, horizlinescan5, vertbar ] }; + key <AE12> { [ equal, plus, crossinglines ] }; - key <AD03> { [ e, E, EuroSign, VoidSymbol ] }; -// key <AD05> { [ t, T, trademark, VoidSymbol > - key <AD07> { [ u, U, udiaeresis, Udiaeresis ] }; - key <AD08> { [ i, I, idotless, Iabovedot ] }; - key <AD09> { [ o, O, odiaeresis, Odiaeresis ] }; - key <AC01> { [ a, A, acircumflex, Acircumflex ] }; - key <AC02> { [ s, S, scedilla, Scedilla ] }; - key <AC05> { [ g, G, gbreve, Gbreve ] }; + key <AD03> { [ e, E, EuroSign, VoidSymbol ] }; +// key <AD05> { [ t, T, trademark, VoidSymbol > + key <AD07> { [ u, U, udiaeresis, Udiaeresis ] }; + key <AD08> { [ i, I, idotless, Iabovedot ] }; + key <AD09> { [ o, O, odiaeresis, Odiaeresis ] }; + key <AC01> { [ a, A, acircumflex, Acircumflex ] }; + key <AC02> { [ s, S, scedilla, Scedilla ] }; + key <AC05> { [ g, G, gbreve, Gbreve ] }; - key <AB03> { [ c, C, ccedilla, Ccedilla ] }; + key <AB03> { [ c, C, ccedilla, Ccedilla ] }; include "level3(ralt_switch)" }; @@ -155,26 +154,18 @@ xkb_symbols "alt" { partial alphanumeric_keys xkb_symbols "Sundeadkeys" { - - // For naming consistency include "tr(basic)" - }; partial alphanumeric_keys xkb_symbols "sundeadkeys" { - - // For naming consistency include "tr(Sundeadkeys)" - name[Group1]="Turkish (Sun dead keys)"; }; -// Kurdish Q Layout +// Kurdish Q layout // Erdal Ronahi <erdal.ronahi@gmail.com>, 2006 // http://ferheng.org -// http://www.pckurd.net - partial xkb_symbols "ku" { @@ -182,14 +173,14 @@ xkb_symbols "ku" { name[Group1]="Kurdish (Turkey, Latin Q)"; - key <AD08> { [ i, I, idotless, I ] }; - key <AD11> { [ x, X, gbreve, Gbreve ] }; - key <AD12> { [ucircumflex, Ucircumflex, asciitilde, dead_macron] }; - key <AC11> { [icircumflex, Icircumflex, apostrophe, dead_caron ] }; - key <AB08> { [ecircumflex, Ecircumflex, odiaeresis, Odiaeresis ] }; + key <AD08> { [ i, I, idotless, I ] }; + key <AD11> { [ x, X, gbreve, Gbreve ] }; + key <AD12> { [ucircumflex, Ucircumflex, asciitilde, dead_macron ] }; + key <AC11> { [icircumflex, Icircumflex, apostrophe, dead_caron ] }; + key <AB08> { [ecircumflex, Ecircumflex, odiaeresis, Odiaeresis ] }; }; -// Kurdish F Layout +// Kurdish F layout partial xkb_symbols "ku_f" { @@ -197,18 +188,17 @@ xkb_symbols "ku_f" { name[Group1]="Kurdish (Turkey, F)"; - key <AD03> { [ x, X, gbreve, Gbreve] }; - key <AD04> { [ i, I, paragraph, VoidSymbol ] }; - key <AD05> { [ o, O, ocircumflex, Ocircumflex ] }; - - key <AC01> { [ ucircumflex, Ucircumflex, udiaeresis, Udiaeresis ] }; - key <AC02> { [ icircumflex, Icircumflex, i, Iabovedot ] }; - key <AC05> { [ u, U, udiaeresis, Udiaeresis ] }; - key <AB02> { [ecircumflex, Ecircumflex, odiaeresis, Odiaeresis ] }; + key <AD03> { [ x, X, gbreve, Gbreve ] }; + key <AD04> { [ i, I, paragraph, VoidSymbol ] }; + key <AD05> { [ o, O, ocircumflex, Ocircumflex ] }; + key <AC01> { [ucircumflex, Ucircumflex, udiaeresis, Udiaeresis ] }; + key <AC02> { [icircumflex, Icircumflex, i, Iabovedot ] }; + key <AC05> { [ u, U, udiaeresis, Udiaeresis ] }; + key <AB02> { [ecircumflex, Ecircumflex, odiaeresis, Odiaeresis ] }; }; -// Kurdish Alt-Q Layout +// Kurdish Alt-Q layout partial xkb_symbols "ku_alt" { @@ -216,56 +206,61 @@ xkb_symbols "ku_alt" { name[Group1]="Kurdish (Turkey, Latin Alt-Q)"; - key <AD03> { [ e, E, ecircumflex, Ecircumflex ] }; - key <AD07> { [ u, U, ucircumflex, Ucircumflex ] }; - key <AD08> { [ i, I, icircumflex, Icircumflex ] }; - key <AD09> { [ o, O, odiaeresis, Odiaeresis ] }; + key <AD03> { [ e, E, ecircumflex, Ecircumflex ] }; + key <AD07> { [ u, U, ucircumflex, Ucircumflex ] }; + key <AD08> { [ i, I, icircumflex, Icircumflex ] }; + key <AD09> { [ o, O, odiaeresis, Odiaeresis ] }; }; -// Turkish international Q Layout +// Turkish international Q layout // Alexis Pellicier <alexis.pellicier@nds.k12.tr>, 2007 partial xkb_symbols "intl" { + include "latin" name[Group1]="Turkish (international with dead keys)"; - key <AE01> { type[group1] = "FOUR_LEVEL", [ 1, exclam, onesuperior, exclamdown ] }; - key <AE02> { type[group1] = "FOUR_LEVEL", [ 2, apostrophe, sterling, twosuperior ] }; - key <AE03> { type[group1] = "FOUR_LEVEL", [ 3, dead_circumflex, numbersign, threesuperior ] }; - key <AE04> { type[group1] = "FOUR_LEVEL", [ 4, plus, dollar, onequarter ] }; - key <AE06> { type[group1] = "FOUR_LEVEL", [ 6, ampersand, threequarters, VoidSymbol ] }; - key <AE07> { type[group1] = "FOUR_LEVEL", [ 7, slash, braceleft, VoidSymbol ] }; - key <AE08> { type[group1] = "FOUR_LEVEL", [ 8, parenleft, bracketleft, VoidSymbol ] }; - key <AE09> { type[group1] = "FOUR_LEVEL", [ 9, parenright, bracketright, plusminus ] }; - key <AE10> { type[group1] = "FOUR_LEVEL", [ 0, equal, braceright, degree ] }; - key <AE11> { type[group1] = "FOUR_LEVEL", [ asterisk, question, backslash, questiondown ] }; - key <AE12> { type[group1] = "FOUR_LEVEL", [ minus, underscore, division, VoidSymbol ] }; - key <AD02> { [ w, W, VoidSymbol, VoidSymbol ] }; - key <AD03> { [ e, E, EuroSign, cent ] }; - key <AD05> { [ t, T, trademark, VoidSymbol ] }; - key <AD07> { [ u, U, ucircumflex, Ucircumflex ] }; - key <AD08> { [ idotless, I, icircumflex, Icircumflex ] }; - key <AD09> { [ o, O, ocircumflex, Ocircumflex ] }; - key <AD10> { [ p, P, VoidSymbol, VoidSymbol ] }; - key <AD11> { [ gbreve, Gbreve, dead_diaeresis ] }; - key <AD12> { [udiaeresis, Udiaeresis, dead_tilde, dead_macron ] }; - key <AC01> { [ a, A, acircumflex, Acircumflex ] }; - key <AC02> { [ s, S, section, VoidSymbol ] }; - key <AC03> { [ d, D, VoidSymbol, VoidSymbol ] }; - key <AC04> { [ f, F, ordfeminine, VoidSymbol ] }; - key <AC05> { [ g, G, VoidSymbol, VoidSymbol ] }; - key <AC06> { [ h, H, VoidSymbol, VoidSymbol ] }; - key <AC08> { [ k, K, VoidSymbol, VoidSymbol ] }; - key <AC09> { [ l, L, VoidSymbol, VoidSymbol ] }; - key <AC10> { [ scedilla, Scedilla, dead_acute, dead_acute ] }; - key <AC11> { [ i, Iabovedot, apostrophe, dead_caron ] }; - key <TLDE> { type[group1] = "FOUR_LEVEL",[ quotedbl, eacute, plusminus, degree ] }; - key <BKSL> { type[group1] = "FOUR_LEVEL",[ comma, semicolon, dead_grave, dead_grave ] }; - key <LSGT> { type[group1] = "FOUR_LEVEL",[ less, greater, bar, brokenbar ] }; - key <AB08> { [odiaeresis, Odiaeresis, multiply, VoidSymbol ] }; - key <AB09> { [ ccedilla, Ccedilla, periodcentered, division ] }; - key <AB10> { type[group1] = "FOUR_LEVEL",[ period, colon, dead_abovedot, dead_abovedot ] }; + key <AE01> { type[group1] = "FOUR_LEVEL", [ 1, exclam, onesuperior, exclamdown ] }; + key <AE02> { type[group1] = "FOUR_LEVEL", [ 2, apostrophe, sterling, twosuperior ] }; + key <AE03> { type[group1] = "FOUR_LEVEL", [ 3, dead_circumflex, numbersign, threesuperior ] }; + key <AE04> { type[group1] = "FOUR_LEVEL", [ 4, plus, dollar, onequarter ] }; + key <AE06> { type[group1] = "FOUR_LEVEL", [ 6, ampersand, threequarters, VoidSymbol ] }; + key <AE07> { type[group1] = "FOUR_LEVEL", [ 7, slash, braceleft, VoidSymbol ] }; + key <AE08> { type[group1] = "FOUR_LEVEL", [ 8, parenleft, bracketleft, VoidSymbol ] }; + key <AE09> { type[group1] = "FOUR_LEVEL", [ 9, parenright, bracketright, plusminus ] }; + key <AE10> { type[group1] = "FOUR_LEVEL", [ 0, equal, braceright, degree ] }; + key <AE11> { type[group1] = "FOUR_LEVEL", [ asterisk, question, backslash, questiondown ] }; + key <AE12> { type[group1] = "FOUR_LEVEL", [ minus, underscore, division, VoidSymbol ] }; + + key <AD02> { [ w, W, VoidSymbol, VoidSymbol ] }; + key <AD03> { [ e, E, EuroSign, cent ] }; + key <AD05> { [ t, T, trademark, VoidSymbol ] }; + key <AD07> { [ u, U, ucircumflex, Ucircumflex ] }; + key <AD08> { [ idotless, I, icircumflex, Icircumflex ] }; + key <AD09> { [ o, O, ocircumflex, Ocircumflex ] }; + key <AD10> { [ p, P, VoidSymbol, VoidSymbol ] }; + key <AD11> { [ gbreve, Gbreve, dead_diaeresis ] }; + key <AD12> { [udiaeresis, Udiaeresis, dead_tilde, dead_macron ] }; + + key <AC01> { [ a, A, acircumflex, Acircumflex ] }; + key <AC02> { [ s, S, section, VoidSymbol ] }; + key <AC03> { [ d, D, VoidSymbol, VoidSymbol ] }; + key <AC04> { [ f, F, ordfeminine, VoidSymbol ] }; + key <AC05> { [ g, G, VoidSymbol, VoidSymbol ] }; + key <AC06> { [ h, H, VoidSymbol, VoidSymbol ] }; + key <AC08> { [ k, K, VoidSymbol, VoidSymbol ] }; + key <AC09> { [ l, L, VoidSymbol, VoidSymbol ] }; + key <AC10> { [ scedilla, Scedilla, dead_acute, dead_acute ] }; + key <AC11> { [ i, Iabovedot, apostrophe, dead_caron ] }; + + key <TLDE> { type[group1] = "FOUR_LEVEL", [ quotedbl, eacute, plusminus, degree ] }; + key <BKSL> { type[group1] = "FOUR_LEVEL", [ comma, semicolon, dead_grave, dead_grave ] }; + key <LSGT> { type[group1] = "FOUR_LEVEL", [ less, greater, bar, brokenbar ] }; + + key <AB08> { [odiaeresis, Odiaeresis, multiply, VoidSymbol ] }; + key <AB09> { [ ccedilla, Ccedilla, periodcentered, division ] }; + key <AB10> { type[group1] = "FOUR_LEVEL", [ period, colon, dead_abovedot, dead_abovedot ] }; include "nbsp(level3)" include "level3(ralt_switch)" @@ -274,36 +269,36 @@ xkb_symbols "intl" { partial alphanumeric_keys xkb_symbols "olpc" { - name[Group1]= "Turkish"; - include "tr(intl)" - - key <AE01> { [ 1, exclam, VoidSymbol, VoidSymbol ] }; - key <AE06> { [ 6, ampersand, VoidSymbol, VoidSymbol ] }; - key <AE12> { type[group1] = "FOUR_LEVEL", [ minus, underscore, bar, VoidSymbol ] }; + include "tr(intl)" - key <AB03> { [ c, C, leftdoublequotemark, VoidSymbol ] }; - key <AB04> { [ v, V, rightdoublequotemark, VoidSymbol ] }; - key <AB05> { [ b, B, VoidSymbol, VoidSymbol ] }; - key <AB08> { [odiaeresis, Odiaeresis, VoidSymbol, VoidSymbol ] }; + name[Group1]= "Turkish"; - key <AB09> { [ ccedilla, Ccedilla, multiply, VoidSymbol ] }; - key <AB10> { [ period, colon, division, dead_abovedot ] }; + key <AE01> { [ 1, exclam, VoidSymbol, VoidSymbol ] }; + key <AE06> { [ 6, ampersand, VoidSymbol, VoidSymbol ] }; + key <AE12> { type[group1] = "FOUR_LEVEL", + [ minus, underscore, bar, VoidSymbol ] }; - key <I219> { [ less, greater, VoidSymbol, VoidSymbol ] }; + key <AB03> { [ c, C, leftdoublequotemark, VoidSymbol ] }; + key <AB04> { [ v, V, rightdoublequotemark, VoidSymbol ] }; + key <AB05> { [ b, B, VoidSymbol, VoidSymbol ] }; + key <AB08> { [odiaeresis, Odiaeresis, VoidSymbol, VoidSymbol ] }; + key <AB09> { [ ccedilla, Ccedilla, multiply, VoidSymbol ] }; + key <AB10> { [ period, colon, division, dead_abovedot ] }; + key <I219> { [ less, greater, VoidSymbol, VoidSymbol ] }; }; // Crimean Tatar (Crimean Turkish) layouts. // First released (by Ubuntu): 2009-02-24. -// These layouts are not yet standard. In particular, the mapping of -// letter 'x' might change in the future. This letter is not used in the -// current official alphabet, but is included in the layouts for foreign words -// and shortcuts. +// These layouts are not yet standard. In particular, the mapping of +// the letter 'x' might change in the future. This letter is not used +// in the current official alphabet, but is included in the layouts for +// foreign words and for shortcuts. // Reşat SABIQ <tilde.birlik @ gmail . com>, 2009 // Özgür Qarahan <qarahan @ gmail . com>, 2009 -// Crimean Tatar (Crimean Turkish) Q Layout +// Crimean Tatar (Crimean Turkish) Q layout partial xkb_symbols "crh" { @@ -311,16 +306,16 @@ xkb_symbols "crh" { name[Group1]="Crimean Tatar (Turkish Q)"; - key <AE11> { [ x, X, asterisk, question ] }; + key <AE11> { [ x, X, asterisk, question ] }; - key <AC04> { [ f, F, iacute, Iacute ] }; - key <AC07> { [ j, J, ibreve, Ibreve ] }; - key <TLDE> { [ quotedbl, backslash, less, degree ] }; + key <AC04> { [ f, F, iacute, Iacute ] }; + key <AC07> { [ j, J, ibreve, Ibreve ] }; + key <TLDE> { [ quotedbl, backslash, less, degree ] }; - key <AB02> { [ ntilde, Ntilde, guillemotright, greater ] }; + key <AB02> { [ ntilde, Ntilde, guillemotright, greater ] }; }; -// Crimean Tatar (Crimean Turkish) F Layout +// Crimean Tatar (Crimean Turkish) F layout partial xkb_symbols "crh_f" { @@ -328,18 +323,18 @@ xkb_symbols "crh_f" { name[Group1]="Crimean Tatar (Turkish F)"; - key <AE11> { [ x, X, slash, question ] }; + key <AE11> { [ x, X, slash, question ] }; - key <AD04> { type[group1] = "FOUR_LEVEL_SEMIALPHABETIC", - [ idotless, I, iacute, Iacute ] }; + key <AD04> { type[group1] = "FOUR_LEVEL_SEMIALPHABETIC", + [ idotless, I, iacute, Iacute ] }; - key <AC07> { [ k, K, ibreve, Ibreve ] }; - key <TLDE> { [ plus, asterisk, backslash, plusminus ] }; + key <AC07> { [ k, K, ibreve, Ibreve ] }; + key <TLDE> { [ plus, asterisk, backslash, plusminus ] }; - key <BKSL> { [ ntilde, Ntilde, grave, dead_grave ] }; + key <BKSL> { [ ntilde, Ntilde, grave, dead_grave ] }; }; -// Crimean Tatar (Crimean Turkish) Alt-Q Layout +// Crimean Tatar (Crimean Turkish) Alt-Q layout partial xkb_symbols "crh_alt" { @@ -347,10 +342,10 @@ xkb_symbols "crh_alt" { name[Group1]="Crimean Tatar (Turkish Alt-Q)"; - key <AC04> { [ f, F, iacute, Iacute ] }; - key <AC07> { [ j, J, ibreve, Ibreve ] }; + key <AC04> { [ f, F, iacute, Iacute ] }; + key <AC07> { [ j, J, ibreve, Ibreve ] }; - key <AB06> { [ n, N, ntilde, Ntilde ] }; + key <AB06> { [ n, N, ntilde, Ntilde ] }; }; // EXTRAS: diff --git a/xorg-server/xkeyboard-config/symbols/ua b/xorg-server/xkeyboard-config/symbols/ua index 81d696ec4..8852b9243 100644 --- a/xorg-server/xkeyboard-config/symbols/ua +++ b/xorg-server/xkeyboard-config/symbols/ua @@ -1,44 +1,45 @@ -// based on -// ukrainian standard keyboard +// Keyboard layouts for the Ukraine. // AEN <aen@logic.ru> & Leon Kanter <leon@geon.donetsk.ua> -// Last Changes 2007/10/03 by Andriy Rysin <arysin@yahoo.com> +// last changes 2007/10/03 by Andriy Rysin <arysin@yahoo.com> -// Unicode - 3d level added with some Unicode symbols (typographic quotes, m-dash, n-dash etc), -// some often used cyrillics from other slavic languages and some ASCII symbols used often (slash, brackets...) +// The legacy WinKeys layout extended on the third and fourth level with +// some Unicode symbols (typographic quotes, m-dash, n-dash, ...), some +// often-used Cyrillics from other Slavic languages, and some often-used +// ASCII symbols (slash, brackets, ...). default partial alphanumeric_keys xkb_symbols "unicode" { - include "ua(winkeys)" + include "ua(winkeys)" name[Group1]= "Ukrainian"; - key <TLDE> { [ U2019, apostrophe, U0301, asciitilde ] }; // Apostrophe and Stress symbol - key <AE01> { [ 1, exclam, onesuperior ] }; - key <AE02> { [ 2, quotedbl, twosuperior ] }; - key <AE03> { [ 3, numerosign, U00A7, U20B4 ] }; // Paragraph and Hryvnia sign - key <AE04> { [ 4, semicolon, dollar, EuroSign ] }; - key <AE05> { [ 5, percent, degree ] }; - key <AE06> { [ 6, colon, less ] }; - key <AE07> { [ 7, question, greater ] }; - key <AE08> { [ 8, asterisk, enfilledcircbullet ] }; - key <AE09> { [ 9, parenleft, bracketleft, braceleft ] }; - key <AE10> { [ 0, parenright, bracketright, braceright] }; - key <AE11> { [ minus, underscore, emdash, endash ] }; - key <AE12> { [ equal, plus, notequal, plusminus ] }; - - key <AD03> { [ Cyrillic_u, Cyrillic_U, Byelorussian_shortu, Byelorussian_SHORTU ]}; - key <AD04> { [ Cyrillic_ka, Cyrillic_KA, registered ] }; // Registered tm - key <AD05> { [ Cyrillic_ie, Cyrillic_IE, Cyrillic_io, Cyrillic_IO ] }; - key <AD12> { [ Ukrainian_yi,Ukrainian_YI, Cyrillic_hardsign, Cyrillic_HARDSIGN ] }; - key <AC02> { [ Ukrainian_i, Ukrainian_I, Cyrillic_yeru, Cyrillic_YERU ] }; - key <AC11> { [ Ukrainian_ie,Ukrainian_IE, Cyrillic_e, Cyrillic_E ] }; - - key <BKSL> { [ Ukrainian_ghe_with_upturn, Ukrainian_GHE_WITH_UPTURN, backslash, bar ] }; - - key <AB03> { [ Cyrillic_es, Cyrillic_ES, copyright ] }; - key <AB06> { [ Cyrillic_te, Cyrillic_TE, trademark ] }; - key <AB08> { [ Cyrillic_be, Cyrillic_BE, guillemotleft, doublelowquotemark ] }; - key <AB09> { [ Cyrillic_yu, Cyrillic_YU, guillemotright, leftdoublequotemark ] }; - key <AB10> { [ period, comma, slash, ellipsis ] }; + key <TLDE> { [ U2019, apostrophe, U0301, asciitilde ] }; // Apostrophe and Stress symbol + key <AE01> { [ 1, exclam, onesuperior ] }; + key <AE02> { [ 2, quotedbl, twosuperior ] }; + key <AE03> { [ 3, numerosign, U00A7, U20B4 ] }; // Paragraph and Hryvnia sign + key <AE04> { [ 4, semicolon, dollar, EuroSign ] }; + key <AE05> { [ 5, percent, degree ] }; + key <AE06> { [ 6, colon, less ] }; + key <AE07> { [ 7, question, greater ] }; + key <AE08> { [ 8, asterisk, enfilledcircbullet ] }; + key <AE09> { [ 9, parenleft, bracketleft, braceleft ] }; + key <AE10> { [ 0, parenright, bracketright, braceright ] }; + key <AE11> { [ minus, underscore, emdash, endash ] }; + key <AE12> { [ equal, plus, notequal, plusminus ] }; + + key <AD03> { [ Cyrillic_u, Cyrillic_U, Byelorussian_shortu, Byelorussian_SHORTU ] }; + key <AD04> { [ Cyrillic_ka, Cyrillic_KA, registered ] }; // Registered tm + key <AD05> { [ Cyrillic_ie, Cyrillic_IE, Cyrillic_io, Cyrillic_IO ] }; + key <AD12> { [ Ukrainian_yi, Ukrainian_YI, Cyrillic_hardsign,Cyrillic_HARDSIGN ] }; + key <AC02> { [ Ukrainian_i, Ukrainian_I, Cyrillic_yeru, Cyrillic_YERU ] }; + key <AC11> { [ Ukrainian_ie, Ukrainian_IE, Cyrillic_e, Cyrillic_E ] }; + + key <BKSL> { [ Ukrainian_ghe_with_upturn, Ukrainian_GHE_WITH_UPTURN, backslash, bar ] }; + + key <AB03> { [ Cyrillic_es, Cyrillic_ES, copyright ] }; + key <AB06> { [ Cyrillic_te, Cyrillic_TE, trademark ] }; + key <AB08> { [ Cyrillic_be, Cyrillic_BE, guillemotleft, doublelowquotemark ] }; + key <AB09> { [ Cyrillic_yu, Cyrillic_YU, guillemotright, leftdoublequotemark ] }; + key <AB10> { [ period, comma, slash, ellipsis ] }; include "level3(ralt_switch)" }; @@ -48,262 +49,262 @@ xkb_symbols "legacy" { name[Group1]= "Ukrainian (legacy)"; - key <TLDE> { [ apostrophe, asciitilde ] }; - key <AE01> { [ 1, exclam ] }; - key <AE02> { [ 2, quotedbl ] }; - key <AE03> { [ 3, numbersign ] }; - key <AE04> { [ 4, asterisk ] }; - key <AE05> { [ 5, colon ] }; - key <AE06> { [ 6, comma ] }; - key <AE07> { [ 7, period ] }; - key <AE08> { [ 8, semicolon ] }; - key <AE09> { [ 9, parenleft ] }; - key <AE10> { [ 0, parenright ] }; - key <AE11> { [ minus, underscore ] }; - key <AE12> { [ equal, plus ] }; - - key <AD01> { [ Cyrillic_shorti, Cyrillic_SHORTI ] }; - key <AD02> { [ Cyrillic_tse, Cyrillic_TSE ] }; - key <AD03> { [ Cyrillic_u, Cyrillic_U ] }; - key <AD04> { [ Cyrillic_ka, Cyrillic_KA ] }; - key <AD05> { [ Cyrillic_ie, Cyrillic_IE ] }; - key <AD06> { [ Cyrillic_en, Cyrillic_EN ] }; - key <AD07> { [ Cyrillic_ghe, Cyrillic_GHE ] }; - key <AD08> { [ Cyrillic_sha, Cyrillic_SHA ] }; - key <AD09> { [ Cyrillic_shcha, Cyrillic_SHCHA ] }; - key <AD10> { [ Cyrillic_ze, Cyrillic_ZE ] }; - key <AD11> { [ Cyrillic_ha, Cyrillic_HA ] }; - key <AD12> { [ Ukrainian_yi, Ukrainian_YI ] }; - key <BKSL> { [ Ukrainian_ghe_with_upturn, Ukrainian_GHE_WITH_UPTURN ] }; - - key <AC01> { [ Cyrillic_ef, Cyrillic_EF ] }; - key <AC02> { [ Ukrainian_i, Ukrainian_I ] }; - key <AC03> { [ Cyrillic_ve, Cyrillic_VE ] }; - key <AC04> { [ Cyrillic_a, Cyrillic_A ] }; - key <AC05> { [ Cyrillic_pe, Cyrillic_PE ] }; - key <AC06> { [ Cyrillic_er, Cyrillic_ER ] }; - key <AC07> { [ Cyrillic_o, Cyrillic_O ] }; - key <AC08> { [ Cyrillic_el, Cyrillic_EL ] }; - key <AC09> { [ Cyrillic_de, Cyrillic_DE ] }; - key <AC10> { [ Cyrillic_zhe, Cyrillic_ZHE ] }; - key <AC11> { [ Ukrainian_ie, Ukrainian_IE ] }; - - key <AB01> { [ Cyrillic_ya, Cyrillic_YA ] }; - key <AB02> { [ Cyrillic_che, Cyrillic_CHE ] }; - key <AB03> { [ Cyrillic_es, Cyrillic_ES ] }; - key <AB04> { [ Cyrillic_em, Cyrillic_EM ] }; - key <AB06> { [ Cyrillic_te, Cyrillic_TE ] }; - key <AB05> { [ Cyrillic_i, Cyrillic_I ] }; - key <AB07> { [Cyrillic_softsign,Cyrillic_SOFTSIGN ] }; - key <AB08> { [ Cyrillic_be, Cyrillic_BE ] }; - key <AB09> { [ Cyrillic_yu, Cyrillic_YU ] }; - key <AB10> { [ slash, question ] }; - - key <LSGT> { [ slash, bar ] }; + key <TLDE> { [ apostrophe, asciitilde ] }; + key <AE01> { [ 1, exclam ] }; + key <AE02> { [ 2, quotedbl ] }; + key <AE03> { [ 3, numbersign ] }; + key <AE04> { [ 4, asterisk ] }; + key <AE05> { [ 5, colon ] }; + key <AE06> { [ 6, comma ] }; + key <AE07> { [ 7, period ] }; + key <AE08> { [ 8, semicolon ] }; + key <AE09> { [ 9, parenleft ] }; + key <AE10> { [ 0, parenright ] }; + key <AE11> { [ minus, underscore ] }; + key <AE12> { [ equal, plus ] }; + + key <AD01> { [ Cyrillic_shorti, Cyrillic_SHORTI ] }; + key <AD02> { [ Cyrillic_tse, Cyrillic_TSE ] }; + key <AD03> { [ Cyrillic_u, Cyrillic_U ] }; + key <AD04> { [ Cyrillic_ka, Cyrillic_KA ] }; + key <AD05> { [ Cyrillic_ie, Cyrillic_IE ] }; + key <AD06> { [ Cyrillic_en, Cyrillic_EN ] }; + key <AD07> { [ Cyrillic_ghe, Cyrillic_GHE ] }; + key <AD08> { [ Cyrillic_sha, Cyrillic_SHA ] }; + key <AD09> { [ Cyrillic_shcha, Cyrillic_SHCHA ] }; + key <AD10> { [ Cyrillic_ze, Cyrillic_ZE ] }; + key <AD11> { [ Cyrillic_ha, Cyrillic_HA ] }; + key <AD12> { [ Ukrainian_yi, Ukrainian_YI ] }; + key <BKSL> { [ Ukrainian_ghe_with_upturn, Ukrainian_GHE_WITH_UPTURN ] }; + + key <AC01> { [ Cyrillic_ef, Cyrillic_EF ] }; + key <AC02> { [ Ukrainian_i, Ukrainian_I ] }; + key <AC03> { [ Cyrillic_ve, Cyrillic_VE ] }; + key <AC04> { [ Cyrillic_a, Cyrillic_A ] }; + key <AC05> { [ Cyrillic_pe, Cyrillic_PE ] }; + key <AC06> { [ Cyrillic_er, Cyrillic_ER ] }; + key <AC07> { [ Cyrillic_o, Cyrillic_O ] }; + key <AC08> { [ Cyrillic_el, Cyrillic_EL ] }; + key <AC09> { [ Cyrillic_de, Cyrillic_DE ] }; + key <AC10> { [ Cyrillic_zhe, Cyrillic_ZHE ] }; + key <AC11> { [ Ukrainian_ie, Ukrainian_IE ] }; + + key <AB01> { [ Cyrillic_ya, Cyrillic_YA ] }; + key <AB02> { [ Cyrillic_che, Cyrillic_CHE ] }; + key <AB03> { [ Cyrillic_es, Cyrillic_ES ] }; + key <AB04> { [ Cyrillic_em, Cyrillic_EM ] }; + key <AB06> { [ Cyrillic_te, Cyrillic_TE ] }; + key <AB05> { [ Cyrillic_i, Cyrillic_I ] }; + key <AB07> {[Cyrillic_softsign,Cyrillic_SOFTSIGN ] }; + key <AB08> { [ Cyrillic_be, Cyrillic_BE ] }; + key <AB09> { [ Cyrillic_yu, Cyrillic_YU ] }; + key <AB10> { [ slash, question ] }; + + key <LSGT> { [ slash, bar ] }; }; partial alphanumeric_keys xkb_symbols "winkeys" { - include "ua(legacy)" + include "ua(legacy)" name[Group1]= "Ukrainian (WinKeys)"; - key <AE03> { [ 3, numerosign ] }; - key <AE04> { [ 4, semicolon ] }; - key <AE05> { [ 5, percent ] }; - key <AE06> { [ 6, colon ] }; - key <AE07> { [ 7, question ] }; - key <AE08> { [ 8, asterisk ] }; - key <AB10> { [ period, comma ] }; + key <AE03> { [ 3, numerosign ] }; + key <AE04> { [ 4, semicolon ] }; + key <AE05> { [ 5, percent ] }; + key <AE06> { [ 6, colon ] }; + key <AE07> { [ 7, question ] }; + key <AE08> { [ 8, asterisk ] }; + key <AB10> { [ period, comma ] }; }; partial alphanumeric_keys xkb_symbols "typewriter" { - include "ua(legacy)" + include "ua(legacy)" name[Group1]= "Ukrainian (typewriter)"; - key <TLDE> { [ apostrophe, quotedbl ] }; - key <AE01> { [ exclam, 1 ] }; - key <AE02> { [ numerosign, 2 ] }; - key <AE03> { [ slash, 3 ] }; - key <AE04> { [ semicolon, 4 ] }; - key <AE05> { [ colon, 5 ] }; - key <AE06> { [ comma, 6 ] }; - key <AE07> { [ period, 7 ] }; - key <AE08> { [ underscore, 8 ] }; - key <AE09> { [ question, 9 ] }; - key <AE10> { [ percent, 0 ] }; - - key <AD12> { [ Ukrainian_ghe_with_upturn, Ukrainian_GHE_WITH_UPTURN ] }; + key <TLDE> { [ apostrophe, quotedbl ] }; + key <AE01> { [ exclam, 1 ] }; + key <AE02> { [ numerosign, 2 ] }; + key <AE03> { [ slash, 3 ] }; + key <AE04> { [ semicolon, 4 ] }; + key <AE05> { [ colon, 5 ] }; + key <AE06> { [ comma, 6 ] }; + key <AE07> { [ period, 7 ] }; + key <AE08> { [ underscore, 8 ] }; + key <AE09> { [ question, 9 ] }; + key <AE10> { [ percent, 0 ] }; - key <AC02> { [ Cyrillic_i, Cyrillic_I ] }; + key <AD12> { [ Ukrainian_ghe_with_upturn, Ukrainian_GHE_WITH_UPTURN ] }; - key <AB05> { [ Ukrainian_i, Ukrainian_I ] }; + key <AC02> { [ Cyrillic_i, Cyrillic_I ] }; - key <AB10> { [ Ukrainian_yi, Ukrainian_YI ] }; + key <AB05> { [ Ukrainian_i, Ukrainian_I ] }; + key <AB10> { [ Ukrainian_yi, Ukrainian_YI ] }; - key <BKSL> { [ parenleft, parenright ] }; + key <BKSL> { [ parenleft, parenright ] }; }; partial alphanumeric_keys xkb_symbols "phonetic" { - include "ua(legacy)" + include "ua(legacy)" name[Group1]= "Ukrainian (phonetic)"; - key <LatQ> { [ Cyrillic_ya, Cyrillic_YA ] }; - key <LatW> { [ Cyrillic_ve, Cyrillic_VE ] }; - key <LatE> { [ Cyrillic_ie, Cyrillic_IE ] }; - key <LatR> { [ Cyrillic_er, Cyrillic_ER ] }; - key <LatT> { [ Cyrillic_te, Cyrillic_TE ] }; - key <LatY> { [ Cyrillic_i, Cyrillic_I ] }; - key <LatU> { [ Cyrillic_u, Cyrillic_U ] }; - key <LatI> { [ Ukrainian_i, Ukrainian_I ] }; - key <LatO> { [ Cyrillic_o, Cyrillic_O ] }; - key <LatP> { [ Cyrillic_pe, Cyrillic_PE ] }; - key <AD11> { [ Cyrillic_sha, Cyrillic_SHA ] }; - key <AD12> { [ Cyrillic_shcha, Cyrillic_SHCHA ] }; - - key <LatA> { [ Cyrillic_a, Cyrillic_A ] }; - key <LatS> { [ Cyrillic_es, Cyrillic_ES ] }; - key <LatD> { [ Cyrillic_de, Cyrillic_DE ] }; - key <LatF> { [ Cyrillic_ef, Cyrillic_EF ] }; - key <LatG> { [ Cyrillic_ghe, Cyrillic_GHE ] }; - key <LatH> { [ Cyrillic_ha, Cyrillic_HA ] }; - key <LatJ> { [ Cyrillic_shorti, Cyrillic_SHORTI ] }; - key <LatK> { [ Cyrillic_ka, Cyrillic_KA ] }; - key <LatL> { [ Cyrillic_el, Cyrillic_EL ] }; - key <AC10> { [ Ukrainian_ghe_with_upturn, Ukrainian_GHE_WITH_UPTURN ] }; - key <AC11> { [ Cyrillic_che, Cyrillic_CHE ] }; - key <BKSL> { [ Cyrillic_yu, Cyrillic_YU ] }; - - key <LatZ> { [ Cyrillic_ze, Cyrillic_ZE ] }; - key <LatX> { [ Cyrillic_softsign, Cyrillic_SOFTSIGN ] }; - key <LatC> { [ Cyrillic_tse, Cyrillic_TSE ] }; - key <LatV> { [ Cyrillic_zhe, Cyrillic_ZHE ] }; - key <LatB> { [ Cyrillic_be, Cyrillic_BE ] }; - key <LatN> { [ Cyrillic_en, Cyrillic_EN ] }; - key <LatM> { [ Cyrillic_em, Cyrillic_EM ] }; - key <AB08> { [ Ukrainian_yi, Ukrainian_YI ] }; - key <AB09> { [ Ukrainian_ie, Ukrainian_IE ] }; - key <AB10> { [ slash, question ] }; + key <LatQ> { [ Cyrillic_ya, Cyrillic_YA ] }; + key <LatW> { [ Cyrillic_ve, Cyrillic_VE ] }; + key <LatE> { [ Cyrillic_ie, Cyrillic_IE ] }; + key <LatR> { [ Cyrillic_er, Cyrillic_ER ] }; + key <LatT> { [ Cyrillic_te, Cyrillic_TE ] }; + key <LatY> { [ Cyrillic_i, Cyrillic_I ] }; + key <LatU> { [ Cyrillic_u, Cyrillic_U ] }; + key <LatI> { [ Ukrainian_i, Ukrainian_I ] }; + key <LatO> { [ Cyrillic_o, Cyrillic_O ] }; + key <LatP> { [ Cyrillic_pe, Cyrillic_PE ] }; + key <AD11> { [ Cyrillic_sha, Cyrillic_SHA ] }; + key <AD12> { [ Cyrillic_shcha, Cyrillic_SHCHA ] }; + + key <LatA> { [ Cyrillic_a, Cyrillic_A ] }; + key <LatS> { [ Cyrillic_es, Cyrillic_ES ] }; + key <LatD> { [ Cyrillic_de, Cyrillic_DE ] }; + key <LatF> { [ Cyrillic_ef, Cyrillic_EF ] }; + key <LatG> { [ Cyrillic_ghe, Cyrillic_GHE ] }; + key <LatH> { [ Cyrillic_ha, Cyrillic_HA ] }; + key <LatJ> { [ Cyrillic_shorti, Cyrillic_SHORTI ] }; + key <LatK> { [ Cyrillic_ka, Cyrillic_KA ] }; + key <LatL> { [ Cyrillic_el, Cyrillic_EL ] }; + key <AC10> { [ Ukrainian_ghe_with_upturn, Ukrainian_GHE_WITH_UPTURN ] }; + key <AC11> { [ Cyrillic_che, Cyrillic_CHE ] }; + key <BKSL> { [ Cyrillic_yu, Cyrillic_YU ] }; + + key <LatZ> { [ Cyrillic_ze, Cyrillic_ZE ] }; + key <LatX> { [ Cyrillic_softsign, Cyrillic_SOFTSIGN ] }; + key <LatC> { [ Cyrillic_tse, Cyrillic_TSE ] }; + key <LatV> { [ Cyrillic_zhe, Cyrillic_ZHE ] }; + key <LatB> { [ Cyrillic_be, Cyrillic_BE ] }; + key <LatN> { [ Cyrillic_en, Cyrillic_EN ] }; + key <LatM> { [ Cyrillic_em, Cyrillic_EM ] }; + key <AB08> { [ Ukrainian_yi, Ukrainian_YI ] }; + key <AB09> { [ Ukrainian_ie, Ukrainian_IE ] }; + key <AB10> { [ slash, question ] }; }; -// ukrainian keyboard layout RSTU 2019-91 (Respublikanskij STandart Ukrajiny) +// Ukrainian RSTU 2019-91 keyboard layout (Respublikanskij STandart Ukrajiny). // Andrew Porokhnyak <aop@porokhnyak.org> partial alphanumeric_keys xkb_symbols "rstu" { - include "ua(legacy)" + include "ua(legacy)" name[Group1]= "Ukrainian (standard RSTU)"; - key <TLDE> { [ apostrophe, question ] }; - key <AE01> { [ exclam, 1 ] }; - key <AE02> { [ quotedbl, 2 ] }; - key <AE03> { [ numbersign, 3 ] }; - key <AE04> { [ semicolon, 4 ] }; - key <AE05> { [ colon, 5 ] }; - key <AE06> { [ comma, 6 ] }; - key <AE07> { [ period, 7 ] }; - key <AE08> { [ asterisk, 8 ] }; - key <AE09> { [ parenleft, 9 ] }; - key <AE10> { [ parenright, 0 ] }; + key <TLDE> { [ apostrophe, question ] }; + key <AE01> { [ exclam, 1 ] }; + key <AE02> { [ quotedbl, 2 ] }; + key <AE03> { [ numbersign, 3 ] }; + key <AE04> { [ semicolon, 4 ] }; + key <AE05> { [ colon, 5 ] }; + key <AE06> { [ comma, 6 ] }; + key <AE07> { [ period, 7 ] }; + key <AE08> { [ asterisk, 8 ] }; + key <AE09> { [ parenleft, 9 ] }; + key <AE10> { [ parenright, 0 ] }; - key <AD12> { [ Ukrainian_ghe_with_upturn, Ukrainian_GHE_WITH_UPTURN ] }; + key <AD12> { [ Ukrainian_ghe_with_upturn, Ukrainian_GHE_WITH_UPTURN ] }; - key <AC02> { [ Cyrillic_i, Cyrillic_I ] }; + key <AC02> { [ Cyrillic_i, Cyrillic_I ] }; - key <AB05> { [ Ukrainian_i, Ukrainian_I ] }; + key <AB05> { [ Ukrainian_i, Ukrainian_I ] }; + key <AB10> { [ Ukrainian_yi, Ukrainian_YI ] }; - key <AB10> { [ Ukrainian_yi, Ukrainian_YI ] }; - - key <BKSL> { [ slash, percent ] }; + key <BKSL> { [ slash, percent ] }; }; -// russian keyboard layout RSTU 2019-91 (Respublikanskij STandart Ukrajiny) +// Russian RSTU 2019-91 keyboard layout (Respublikanskij STandart Ukrajiny). // Andrew Porokhnyak <aop@porokhnyak.org> partial alphanumeric_keys xkb_symbols "rstu_ru" { + include "ru(common)" name[Group1]= "Russian (Ukraine, standard RSTU)"; - key <TLDE> { [ apostrophe, question ] }; - key <AE01> { [ exclam, 1 ] }; - key <AE02> { [ quotedbl, 2 ] }; - key <AE03> { [ numbersign, 3 ] }; - key <AE04> { [ semicolon, 4 ] }; - key <AE05> { [ colon, 5 ] }; - key <AE06> { [ comma, 6 ] }; - key <AE07> { [ period, 7 ] }; - key <AE08> { [ asterisk, 8 ] }; - key <AE09> { [ parenleft, 9 ] }; - key <AE10> { [ parenright, 0 ] }; - key <BKSL> { [ slash, percent ] }; - -key.type[group1]="ALPHABETIC"; - - key <AB10> { [ Cyrillic_io, Cyrillic_IO ] }; + key <TLDE> { [ apostrophe, question ] }; + key <AE01> { [ exclam, 1 ] }; + key <AE02> { [ quotedbl, 2 ] }; + key <AE03> { [ numbersign, 3 ] }; + key <AE04> { [ semicolon, 4 ] }; + key <AE05> { [ colon, 5 ] }; + key <AE06> { [ comma, 6 ] }; + key <AE07> { [ period, 7 ] }; + key <AE08> { [ asterisk, 8 ] }; + key <AE09> { [ parenleft, 9 ] }; + key <AE10> { [ parenright, 0 ] }; + key <BKSL> { [ slash, percent ] }; + + key.type[group1]="ALPHABETIC"; + + key <AB10> { [ Cyrillic_io, Cyrillic_IO ] }; }; -//Homophonic keyboard layout (Tomas Marko Miljenović) -//Based on Ukrainian National Transliteration, commonly used phonetic layouts for Mac and Win. -//Existing layout "phonetic" used as template. +// Homophonic keyboard layout (by Tomas Marko Miljenović), +// based on the Ukrainian National Transliteration, +// commonly used phonetic layouts for Mac and Win. partial alphanumeric_keys xkb_symbols "homophonic" { + include "ua(legacy)" name[Group1]= "Ukrainian (homophonic)"; - key <TLDE> { [ grave, underscore ] }; - key <AE01> { [ 1, exclam ] }; - key <AE02> { [ 2, at ] }; - key <AE03> { [ 3, semicolon ] }; - key <AE04> { [ 4, colon ] }; - key <AE05> { [ 5, percent ] }; - key <AE06> { [ 6, apostrophe ] }; - key <AE07> { [ 7, quotedbl ] }; - key <AE08> { [ 8, asterisk ] }; - key <AE09> { [ 9, parenleft ] }; - key <AE10> { [ 0, parenright ] }; - key <AE11> { [ Ukrainian_ie, Ukrainian_IE ] }; - key <AE12> { [ Ukrainian_yi, Ukrainian_YI ] }; - - key <LatQ> { [ Cyrillic_ya, Cyrillic_YA ] }; - key <LatW> { [ Cyrillic_sha, Cyrillic_SHA ] }; - key <LatE> { [ Cyrillic_ie, Cyrillic_IE ] }; - key <LatR> { [ Cyrillic_er, Cyrillic_ER ] }; - key <LatT> { [ Cyrillic_te, Cyrillic_TE ] }; - key <LatY> { [ Cyrillic_i, Cyrillic_I ] }; - key <LatU> { [ Cyrillic_u, Cyrillic_U ] }; - key <LatI> { [ Ukrainian_i, Ukrainian_I ] }; - key <LatO> { [ Cyrillic_o, Cyrillic_O ] }; - key <LatP> { [ Cyrillic_pe, Cyrillic_PE ] }; - key <AD11> { [ Cyrillic_yu, Cyrillic_YU ] }; - key <AD12> { [ Cyrillic_shcha, Cyrillic_SHCHA ] }; - - key <LatA> { [ Cyrillic_a, Cyrillic_A ] }; - key <LatS> { [ Cyrillic_es, Cyrillic_ES ] }; - key <LatD> { [ Cyrillic_de, Cyrillic_DE ] }; - key <LatF> { [ Cyrillic_ef, Cyrillic_EF ] }; - key <LatG> { [ Ukrainian_ghe_with_upturn, Ukrainian_GHE_WITH_UPTURN ] }; - key <LatH> { [ Cyrillic_ghe, Cyrillic_GHE ] }; - key <LatJ> { [ Cyrillic_shorti, Cyrillic_SHORTI ] }; - key <LatK> { [ Cyrillic_ka, Cyrillic_KA ] }; - key <LatL> { [ Cyrillic_el, Cyrillic_EL ] }; - key <AC10> { [ Cyrillic_che, Cyrillic_CHE ] }; - key <AC11> { [ Cyrillic_zhe, Cyrillic_ZHE ] }; - key <BKSL> { [ Cyrillic_softsign, Cyrillic_SOFTSIGN ] }; - - key <LatZ> { [ Cyrillic_ze, Cyrillic_ZE ] }; - key <LatX> { [ Cyrillic_ha, Cyrillic_HA ] }; - key <LatC> { [ Cyrillic_tse, Cyrillic_TSE ] }; - key <LatV> { [ Cyrillic_ve, Cyrillic_VE ] }; - key <LatB> { [ Cyrillic_be, Cyrillic_BE ] }; - key <LatN> { [ Cyrillic_en, Cyrillic_EN ] }; - key <LatM> { [ Cyrillic_em, Cyrillic_EM ] }; - key <AB08> { [ comma, less ] }; - key <AB09> { [ period, greater ] }; - key <AB10> { [ slash, question ] }; + key <TLDE> { [ grave, underscore ] }; + key <AE01> { [ 1, exclam ] }; + key <AE02> { [ 2, at ] }; + key <AE03> { [ 3, semicolon ] }; + key <AE04> { [ 4, colon ] }; + key <AE05> { [ 5, percent ] }; + key <AE06> { [ 6, apostrophe ] }; + key <AE07> { [ 7, quotedbl ] }; + key <AE08> { [ 8, asterisk ] }; + key <AE09> { [ 9, parenleft ] }; + key <AE10> { [ 0, parenright ] }; + key <AE11> { [ Ukrainian_ie, Ukrainian_IE ] }; + key <AE12> { [ Ukrainian_yi, Ukrainian_YI ] }; + + key <LatQ> { [ Cyrillic_ya, Cyrillic_YA ] }; + key <LatW> { [ Cyrillic_sha, Cyrillic_SHA ] }; + key <LatE> { [ Cyrillic_ie, Cyrillic_IE ] }; + key <LatR> { [ Cyrillic_er, Cyrillic_ER ] }; + key <LatT> { [ Cyrillic_te, Cyrillic_TE ] }; + key <LatY> { [ Cyrillic_i, Cyrillic_I ] }; + key <LatU> { [ Cyrillic_u, Cyrillic_U ] }; + key <LatI> { [ Ukrainian_i, Ukrainian_I ] }; + key <LatO> { [ Cyrillic_o, Cyrillic_O ] }; + key <LatP> { [ Cyrillic_pe, Cyrillic_PE ] }; + key <AD11> { [ Cyrillic_yu, Cyrillic_YU ] }; + key <AD12> { [ Cyrillic_shcha, Cyrillic_SHCHA ] }; + + key <LatA> { [ Cyrillic_a, Cyrillic_A ] }; + key <LatS> { [ Cyrillic_es, Cyrillic_ES ] }; + key <LatD> { [ Cyrillic_de, Cyrillic_DE ] }; + key <LatF> { [ Cyrillic_ef, Cyrillic_EF ] }; + key <LatG> { [ Ukrainian_ghe_with_upturn, Ukrainian_GHE_WITH_UPTURN ] }; + key <LatH> { [ Cyrillic_ghe, Cyrillic_GHE ] }; + key <LatJ> { [ Cyrillic_shorti, Cyrillic_SHORTI ] }; + key <LatK> { [ Cyrillic_ka, Cyrillic_KA ] }; + key <LatL> { [ Cyrillic_el, Cyrillic_EL ] }; + key <AC10> { [ Cyrillic_che, Cyrillic_CHE ] }; + key <AC11> { [ Cyrillic_zhe, Cyrillic_ZHE ] }; + key <BKSL> { [ Cyrillic_softsign, Cyrillic_SOFTSIGN ] }; + + key <LatZ> { [ Cyrillic_ze, Cyrillic_ZE ] }; + key <LatX> { [ Cyrillic_ha, Cyrillic_HA ] }; + key <LatC> { [ Cyrillic_tse, Cyrillic_TSE ] }; + key <LatV> { [ Cyrillic_ve, Cyrillic_VE ] }; + key <LatB> { [ Cyrillic_be, Cyrillic_BE ] }; + key <LatN> { [ Cyrillic_en, Cyrillic_EN ] }; + key <LatM> { [ Cyrillic_em, Cyrillic_EM ] }; + key <AB08> { [ comma, less ] }; + key <AB09> { [ period, greater ] }; + key <AB10> { [ slash, question ] }; }; // EXTRAS: |