From c30d5eefc96925b4bef781806c7a0114eca1b8e0 Mon Sep 17 00:00:00 2001 From: marha Date: Thu, 26 Jun 2014 09:30:29 +0200 Subject: Opdated to openssl-1.0.1h xkeyboard-config fontconfig libX11 libxcb xcb-proto mesa xserver git update 26 June 2014 xserver commit a3b44ad8db1fa2f3b81c1ff9498f31c5323edd37 libxcb commit 125135452a554e89e49448e2c1ee6658324e1095 libxcb/xcb-proto commit 84bfd909bc3774a459b11614cfebeaa584a1eb38 xkeyboard-config commit 39a226707b133ab5540c2d30176cb3857e74dcca libX11 commit a4679baaa18142576d42d423afe816447f08336c fontconfig commit 274f2181f294af2eff3e8db106ec8d7bab2d3ff1 mesa commit 9a8acafa47558cafeb37f80f4b30061ac1962c69 --- xorg-server/configure.ac | 8 +- xorg-server/dix/getevents.c | 80 +++- xorg-server/exa/exa_unaccel.c | 2 +- xorg-server/glamor/glamor.c | 5 +- xorg-server/glamor/glamor_fbo.c | 1 + xorg-server/glamor/glamor_font.c | 1 + xorg-server/glamor/glamor_image.c | 3 +- xorg-server/glamor/glamor_pixmap.c | 1 + xorg-server/glamor/glamor_render.c | 16 +- xorg-server/glamor/glamor_vbo.c | 2 +- xorg-server/hw/xfree86/dri2/dri2.c | 36 +- xorg-server/hw/xwayland/Makefile.am | 31 +- xorg-server/hw/xwayland/drm.xml | 182 ++++++++ xorg-server/hw/xwayland/xwayland-glamor.c | 570 +++++++++++++++++++++++++ xorg-server/hw/xwayland/xwayland.c | 38 +- xorg-server/hw/xwayland/xwayland.h | 17 + xorg-server/include/servermd.h | 9 +- xorg-server/present/present.c | 27 +- xorg-server/xkeyboard-config/rules/base.xml.in | 2 +- xorg-server/xkeyboard-config/symbols/apl | 142 +++--- xorg-server/xkeyboard-config/symbols/fr | 1 - xorg-server/xkeyboard-config/symbols/inet | 2 +- 22 files changed, 1055 insertions(+), 121 deletions(-) create mode 100644 xorg-server/hw/xwayland/drm.xml create mode 100644 xorg-server/hw/xwayland/xwayland-glamor.c (limited to 'xorg-server') diff --git a/xorg-server/configure.ac b/xorg-server/configure.ac index 0a6e77255..2daa6beec 100644 --- a/xorg-server/configure.ac +++ b/xorg-server/configure.ac @@ -810,7 +810,7 @@ LIBDMX="dmx >= 1.0.99.1" LIBDRI="dri >= 7.8.0" LIBDRM="libdrm >= 2.3.0" LIBEGL="egl" -LIBGBM="gbm >= 9" +LIBGBM="gbm >= 10.2.0" LIBGL="gl >= 7.1.0" LIBXEXT="xext >= 1.0.99.4" LIBXFONT="xfont >= 1.4.2" @@ -1424,7 +1424,7 @@ AC_DEFINE(SHAPE, 1, [Support SHAPE extension]) AC_DEFINE_DIR(XKB_BASE_DIRECTORY, XKBPATH, [Path to XKB data]) AC_ARG_WITH(xkb-bin-directory, - AS_HELP_STRING([--with-xkb-bin-directory=DIR], [Directory containing xkbcomp program]), + AS_HELP_STRING([--with-xkb-bin-directory=DIR], [Directory containing xkbcomp program (default: ${bindir})]), [XKB_BIN_DIRECTORY="$withval"], [XKB_BIN_DIRECTORY="$bindir"]) @@ -2459,6 +2459,10 @@ if test "x$XWAYLAND" = xyes; then XWAYLAND_SYS_LIBS="$XWAYLANDMODULES_LIBS $GLX_SYS_LIBS" AC_SUBST([XWAYLAND_LIBS]) AC_SUBST([XWAYLAND_SYS_LIBS]) + + WAYLAND_PREFIX=`$PKG_CONFIG --variable=prefix wayland-client` + AC_PATH_PROG([WAYLAND_SCANNER], [wayland-scanner],, + [${WAYLAND_PREFIX}/bin$PATH_SEPARATOR$PATH]) fi diff --git a/xorg-server/dix/getevents.c b/xorg-server/dix/getevents.c index ffa89fad2..d68fa96d7 100644 --- a/xorg-server/dix/getevents.c +++ b/xorg-server/dix/getevents.c @@ -770,27 +770,65 @@ add_to_scroll_valuator(DeviceIntPtr dev, ValuatorMask *mask, int valuator, doubl } +/* FIXME: relative events from devices with absolute axis ranges is + fundamentally broken. We map the device coordinate range into the screen + range, but don't really account for device resolution in that. + + what we do here is a hack to make touchpads usable. for a given relative + motion vector in device coordinates: + 1. calculate physical movement on the device in metres + 2. calculate pixel vector that is the same physical movement on the + screen (times some magic number to provide sensible base speed) + 3. calculate what percentage this vector is of the current screen + width/height + 4. calculate equivalent vector in % on the device's min/max axis range + 5. Use that device vector as the actual motion vector + + e.g. 10/50mm on the device, 10/50mm on the screen are 30/100 pixels, + 30/100 pixels are 1/3% of the width, 1/3% of the device is a vector of + 20/80 -> use 20/80 as dx/dy. + + dx/dy is then applied to the current position in device coordinates, + mapped to screen coordinates and thus the movement on the screen reflects + the motion direction on the device. + */ static void scale_for_device_resolution(DeviceIntPtr dev, ValuatorMask *mask) { - double y; + double x, y; ValuatorClassPtr v = dev->valuator; int xrange = v->axes[0].max_value - v->axes[0].min_value + 1; int yrange = v->axes[1].max_value - v->axes[1].min_value + 1; - double screen_ratio = 1.0 * screenInfo.width/screenInfo.height; - double device_ratio = 1.0 * xrange/yrange; - double resolution_ratio = 1.0; - double ratio; + /* Assume 100 units/m for devices without resolution */ + int xres = 100000, yres = 100000; - if (!valuator_mask_fetch_double(mask, 1, &y)) - return; + /* If we have multiple screens with different dpi, it gets complicated: + we have to map which screen we're on and then take the dpi of that + screen to be somewhat accurate. */ + const ScreenPtr s = screenInfo.screens[0]; + const double screen_res = 1000.0 * s->width/s->mmWidth; /* units/m */ - if (v->axes[0].resolution != 0 && v->axes[1].resolution != 0) - resolution_ratio = 1.0 * v->axes[0].resolution/v->axes[1].resolution; + /* some magic multiplier, so unaccelerated movement of x mm on the + device reflects x * magic mm on the screen */ + const double magic = 4; - ratio = device_ratio/resolution_ratio/screen_ratio; - valuator_mask_set_double(mask, 1, y / ratio); + if (v->axes[0].resolution != 0 && v->axes[1].resolution != 0) { + xres = v->axes[0].resolution; + yres = v->axes[1].resolution; + } + + if (valuator_mask_isset(mask, 0)) { + x = valuator_mask_get_double(mask, 0); + x = magic * x/xres * screen_res/screenInfo.width * xrange; + valuator_mask_set_double(mask, 0, x); + } + + if (valuator_mask_isset(mask, 1)) { + y = valuator_mask_get_double(mask, 1); + y = magic * y/yres * screen_res/screenInfo.height * yrange; + valuator_mask_set_double(mask, 1, y); + } } /** @@ -804,15 +842,6 @@ moveRelative(DeviceIntPtr dev, int flags, ValuatorMask *mask) { int i; Bool clip_xy = IsMaster(dev) || !IsFloating(dev); - ValuatorClassPtr v = dev->valuator; - - /* for abs devices in relative mode, we've just scaled wrong, since we - mapped the device's shape into the screen shape. Undo this. */ - if ((flags & POINTER_ABSOLUTE) == 0 && v && v->numAxes > 1 && - v->axes[0].min_value < v->axes[0].max_value && - v->axes[1].min_value < v->axes[1].max_value) { - scale_for_device_resolution(dev, mask); - } /* calc other axes, clip, drop back into valuators */ for (i = 0; i < valuator_mask_size(mask); i++) { @@ -1441,10 +1470,21 @@ fill_pointer_events(InternalEvent *events, DeviceIntPtr pDev, int type, set_raw_valuators(raw, &mask, raw->valuators.data); } else { + ValuatorClassPtr v = pDev->valuator; + transformRelative(pDev, &mask); + /* for abs devices in relative mode, we've just scaled wrong, since we + mapped the device's shape into the screen shape. Undo this. */ + if (v && v->numAxes > 1 && + v->axes[0].min_value < v->axes[0].max_value && + v->axes[1].min_value < v->axes[1].max_value) { + scale_for_device_resolution(pDev, &mask); + } + if (flags & POINTER_ACCELERATE) accelPointer(pDev, &mask, ms); + if ((flags & POINTER_NORAW) == 0 && raw) set_raw_valuators(raw, &mask, raw->valuators.data); diff --git a/xorg-server/exa/exa_unaccel.c b/xorg-server/exa/exa_unaccel.c index 58262e0b2..b0c6344a5 100644 --- a/xorg-server/exa/exa_unaccel.c +++ b/xorg-server/exa/exa_unaccel.c @@ -685,7 +685,7 @@ ExaCheckAddTraps(PicturePtr pPicture, EXA_PRE_FALLBACK(pScreen); - EXA_FALLBACK(("to pict %p (%c)\n", + EXA_FALLBACK(("to pict %p (%c)\n", pPicture, exaDrawableLocation(pPicture->pDrawable))); exaPrepareAccess(pPicture->pDrawable, EXA_PREPARE_DEST); swap(pExaScr, ps, AddTraps); diff --git a/xorg-server/glamor/glamor.c b/xorg-server/glamor/glamor.c index 08f6ba174..c398807f1 100644 --- a/xorg-server/glamor/glamor.c +++ b/xorg-server/glamor/glamor.c @@ -316,6 +316,7 @@ glamor_init(ScreenPtr screen, unsigned int flags) { glamor_screen_private *glamor_priv; int gl_version; + int max_viewport_size; #ifdef RENDER PictureScreenPtr ps = GetPictureScreenIfSet(screen); @@ -406,7 +407,9 @@ glamor_init(ScreenPtr screen, unsigned int flags) epoxy_has_gl_extension("GL_ARB_map_buffer_range"); glamor_priv->has_buffer_storage = epoxy_has_gl_extension("GL_ARB_buffer_storage"); - glGetIntegerv(GL_MAX_RENDERBUFFER_SIZE, &glamor_priv->max_fbo_size); + glGetIntegerv(GL_MAX_TEXTURE_SIZE, &glamor_priv->max_fbo_size); + glGetIntegerv(GL_MAX_VIEWPORT_DIMS, &max_viewport_size); + glamor_priv->max_fbo_size = MIN(glamor_priv->max_fbo_size, max_viewport_size); #ifdef MAX_FBO_SIZE glamor_priv->max_fbo_size = MAX_FBO_SIZE; #endif diff --git a/xorg-server/glamor/glamor_fbo.c b/xorg-server/glamor/glamor_fbo.c index 552168381..090dfd8e7 100644 --- a/xorg-server/glamor/glamor_fbo.c +++ b/xorg-server/glamor/glamor_fbo.c @@ -347,6 +347,7 @@ _glamor_create_tex(glamor_screen_private *glamor_priv, glamor_make_current(glamor_priv); glGenTextures(1, &tex); glBindTexture(GL_TEXTURE_2D, tex); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0); 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, diff --git a/xorg-server/glamor/glamor_font.c b/xorg-server/glamor/glamor_font.c index f747d59a1..57c607dc2 100644 --- a/xorg-server/glamor/glamor_font.c +++ b/xorg-server/glamor/glamor_font.c @@ -95,6 +95,7 @@ glamor_font_get(ScreenPtr screen, FontPtr font) glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, glamor_font->texture_id); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); diff --git a/xorg-server/glamor/glamor_image.c b/xorg-server/glamor/glamor_image.c index 4791d089f..b38b41212 100644 --- a/xorg-server/glamor/glamor_image.c +++ b/xorg-server/glamor/glamor_image.c @@ -88,8 +88,7 @@ static void glamor_put_image_bail(DrawablePtr drawable, GCPtr gc, int depth, int x, int y, int w, int h, int leftPad, int format, char *bits) { - if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW) && - glamor_prepare_access_gc(gc)) + if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW)) fbPutImage(drawable, gc, depth, x, y, w, h, leftPad, format, bits); glamor_finish_access(drawable); } diff --git a/xorg-server/glamor/glamor_pixmap.c b/xorg-server/glamor/glamor_pixmap.c index 54b414bc2..789d3772e 100644 --- a/xorg-server/glamor/glamor_pixmap.c +++ b/xorg-server/glamor/glamor_pixmap.c @@ -717,6 +717,7 @@ __glamor_upload_pixmap_to_texture(PixmapPtr pixmap, unsigned int *tex, } glBindTexture(GL_TEXTURE_2D, *tex); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0); 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); diff --git a/xorg-server/glamor/glamor_render.c b/xorg-server/glamor/glamor_render.c index 5a7a23880..14ab738eb 100644 --- a/xorg-server/glamor/glamor_render.c +++ b/xorg-server/glamor/glamor_render.c @@ -1450,8 +1450,8 @@ glamor_composite_clipped_region(CARD8 op, || source_pixmap->drawable.height != height)))) { temp_src = glamor_convert_gradient_picture(screen, source, - x_source, - y_source, + extent->x1 + x_source - x_dest, + extent->y1 + y_source - y_dest, width, height); if (!temp_src) { temp_src = source; @@ -1459,8 +1459,8 @@ glamor_composite_clipped_region(CARD8 op, } temp_src_priv = glamor_get_pixmap_private((PixmapPtr) (temp_src->pDrawable)); - x_temp_src = 0; - y_temp_src = 0; + x_temp_src = -extent->x1 + x_dest; + y_temp_src = -extent->y1 + y_dest; } if (mask @@ -1474,8 +1474,8 @@ glamor_composite_clipped_region(CARD8 op, * to do reduce one convertion. */ temp_mask = glamor_convert_gradient_picture(screen, mask, - x_mask, - y_mask, + extent->x1 + x_mask - x_dest, + extent->y1 + y_mask - y_dest, width, height); if (!temp_mask) { temp_mask = mask; @@ -1483,8 +1483,8 @@ glamor_composite_clipped_region(CARD8 op, } temp_mask_priv = glamor_get_pixmap_private((PixmapPtr) (temp_mask->pDrawable)); - x_temp_mask = 0; - y_temp_mask = 0; + x_temp_mask = -extent->x1 + x_dest; + y_temp_mask = -extent->y1 + y_dest; } /* Do two-pass PictOpOver componentAlpha, until we enable * dual source color blending. diff --git a/xorg-server/glamor/glamor_vbo.c b/xorg-server/glamor/glamor_vbo.c index c6785594b..e90610102 100644 --- a/xorg-server/glamor/glamor_vbo.c +++ b/xorg-server/glamor/glamor_vbo.c @@ -119,7 +119,7 @@ glamor_get_vbo_space(ScreenPtr screen, unsigned size, char **vbo_offset) if (glamor_priv->vbo_size < size) { glamor_priv->vbo_size = MAX(GLAMOR_VBO_SIZE, size); free(glamor_priv->vb); - glamor_priv->vb = XNFalloc(size); + glamor_priv->vb = XNFalloc(glamor_priv->vbo_size); } *vbo_offset = NULL; /* We point to the start of glamor_priv->vb every time, and diff --git a/xorg-server/hw/xfree86/dri2/dri2.c b/xorg-server/hw/xfree86/dri2/dri2.c index 6dd77963c..6459f11b1 100644 --- a/xorg-server/hw/xfree86/dri2/dri2.c +++ b/xorg-server/hw/xfree86/dri2/dri2.c @@ -130,6 +130,7 @@ typedef struct _DRI2Screen { HandleExposuresProcPtr HandleExposures; ConfigNotifyProcPtr ConfigNotify; + SetWindowPixmapProcPtr SetWindowPixmap; DRI2CreateBuffer2ProcPtr CreateBuffer2; DRI2DestroyBuffer2ProcPtr DestroyBuffer2; DRI2CopyRegion2ProcPtr CopyRegion2; @@ -415,18 +416,14 @@ DRI2DrawableGone(void *p, XID id) } static DRI2BufferPtr -create_buffer(DrawablePtr pDraw, +create_buffer(DRI2ScreenPtr ds, DrawablePtr pDraw, unsigned int attachment, unsigned int format) { - ScreenPtr primeScreen; - DRI2DrawablePtr pPriv; - DRI2ScreenPtr ds; DRI2BufferPtr buffer; - pPriv = DRI2GetDrawable(pDraw); - primeScreen = GetScreenPrime(pDraw->pScreen, pPriv->prime_id); - ds = DRI2GetScreenPrime(pDraw->pScreen, pPriv->prime_id); if (ds->CreateBuffer2) - buffer = (*ds->CreateBuffer2)(primeScreen, pDraw, attachment, format); + buffer = (*ds->CreateBuffer2)(GetScreenPrime(pDraw->pScreen, + DRI2GetDrawable(pDraw)->prime_id), + pDraw, attachment, format); else buffer = (*ds->CreateBuffer)(pDraw, attachment, format); return buffer; @@ -475,7 +472,7 @@ allocate_or_reuse_buffer(DrawablePtr pDraw, DRI2ScreenPtr ds, if ((old_buf < 0) || attachment == DRI2BufferFrontLeft || !dimensions_match || (pPriv->buffers[old_buf]->format != format)) { - *buffer = create_buffer (pDraw, attachment, format); + *buffer = create_buffer(ds, pDraw, attachment, format); return TRUE; } @@ -538,7 +535,7 @@ do_get_buffers(DrawablePtr pDraw, int *width, int *height, return NULL; } - ds = DRI2GetScreen(pDraw->pScreen); + ds = DRI2GetScreenPrime(pDraw->pScreen, pPriv->prime_id); dimensions_match = (pDraw->width == pPriv->width) && (pDraw->height == pPriv->height); @@ -1382,6 +1379,21 @@ DRI2ConfigNotify(WindowPtr pWin, int x, int y, int w, int h, int bw, return Success; } +static void +DRI2SetWindowPixmap(WindowPtr pWin, PixmapPtr pPix) +{ + DrawablePtr pDraw = (DrawablePtr) pWin; + ScreenPtr pScreen = pDraw->pScreen; + DRI2ScreenPtr ds = DRI2GetScreen(pScreen); + + pScreen->SetWindowPixmap = ds->SetWindowPixmap; + (*pScreen->SetWindowPixmap) (pWin, pPix); + ds->SetWindowPixmap = pScreen->SetWindowPixmap; + pScreen->SetWindowPixmap = DRI2SetWindowPixmap; + + DRI2InvalidateDrawableAll(pDraw); +} + #define MAX_PRIME DRI2DriverPrimeMask static int get_prime_id(void) @@ -1528,6 +1540,9 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info) ds->ConfigNotify = pScreen->ConfigNotify; pScreen->ConfigNotify = DRI2ConfigNotify; + ds->SetWindowPixmap = pScreen->SetWindowPixmap; + pScreen->SetWindowPixmap = DRI2SetWindowPixmap; + xf86DrvMsg(pScreen->myNum, X_INFO, "[DRI2] Setup complete\n"); for (i = 0; i < sizeof(driverTypeNames) / sizeof(driverTypeNames[0]); i++) { if (i < ds->numDrivers && ds->driverNames[i]) { @@ -1552,6 +1567,7 @@ DRI2CloseScreen(ScreenPtr pScreen) DRI2ScreenPtr ds = DRI2GetScreen(pScreen); pScreen->ConfigNotify = ds->ConfigNotify; + pScreen->SetWindowPixmap = ds->SetWindowPixmap; if (ds->prime_id) prime_id_allocate_bitmask &= ~(1 << ds->prime_id); diff --git a/xorg-server/hw/xwayland/Makefile.am b/xorg-server/hw/xwayland/Makefile.am index 36e6127df..dc16b8bbe 100644 --- a/xorg-server/hw/xwayland/Makefile.am +++ b/xorg-server/hw/xwayland/Makefile.am @@ -1,10 +1,13 @@ bin_PROGRAMS = Xwayland Xwayland_CFLAGS = \ + -I$(top_srcdir)/glamor \ -I$(top_srcdir)/dri3 \ -DHAVE_DIX_CONFIG_H \ $(XWAYLANDMODULES_CFLAGS) \ - $(DIX_CFLAGS) + $(DIX_CFLAGS) \ + $(GLAMOR_CFLAGS) \ + $(GBM_CFLAGS) Xwayland_SOURCES = \ xwayland.c \ @@ -19,6 +22,7 @@ Xwayland_SOURCES = \ $(top_srcdir)/mi/miinitext.c Xwayland_LDADD = \ + $(glamor_lib) \ $(XWAYLAND_LIBS) \ $(XWAYLAND_SYS_LIBS) \ $(XSERVER_SYS_LIBS) @@ -26,5 +30,30 @@ Xwayland_DEPENDENCIES = $(XWAYLAND_LIBS) Xwayland_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) +if GLAMOR_EGL +Xwayland_SOURCES += xwayland-glamor.c + +nodist_Xwayland_SOURCES = \ + drm-client-protocol.h \ + drm-protocol.c + +CLEANFILES = $(nodist_Xwayland_SOURCES) + +EXTRA_DIST = drm.xml + +xwayland-glamor.c : $(nodist_Xwayland_SOURCES) + +glamor_lib = $(top_builddir)/glamor/libglamor.la + +Xwayland_LDADD += $(GLAMOR_LIBS) $(GBM_LIBS) -lEGL -lGL +endif + + relink: $(AM_V_at)rm -f Xwayland$(EXEEXT) && $(MAKE) Xwayland$(EXEEXT) + +%-protocol.c : %.xml + $(AM_V_GEN)$(WAYLAND_SCANNER) code < $< > $@ + +%-client-protocol.h : %.xml + $(AM_V_GEN)$(WAYLAND_SCANNER) client-header < $< > $@ diff --git a/xorg-server/hw/xwayland/drm.xml b/xorg-server/hw/xwayland/drm.xml new file mode 100644 index 000000000..8a3ad69b2 --- /dev/null +++ b/xorg-server/hw/xwayland/drm.xml @@ -0,0 +1,182 @@ + + + + + Copyright © 2008-2011 Kristian Høgsberg + Copyright © 2010-2011 Intel Corporation + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that\n the above copyright notice appear in + all copies and that both that copyright notice and this permission + notice appear in supporting documentation, and that the name of + the copyright holders not be used in advertising or publicity + pertaining to distribution of the software without specific, + written prior permission. The copyright holders make no + representations about the suitability of this software for any + purpose. It is provided "as is" without express or implied + warranty. + + THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS + SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN + AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF + THIS SOFTWARE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Bitmask of capabilities. + + + + + + + + + + diff --git a/xorg-server/hw/xwayland/xwayland-glamor.c b/xorg-server/hw/xwayland/xwayland-glamor.c new file mode 100644 index 000000000..4be883fa3 --- /dev/null +++ b/xorg-server/hw/xwayland/xwayland-glamor.c @@ -0,0 +1,570 @@ +/* + * Copyright © 2011-2014 Intel Corporation + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of the + * copyright holders not be used in advertising or publicity + * pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied + * warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN + * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING + * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#include "xwayland.h" + +#include +#include +#include + +#define MESA_EGL_NO_X11_HEADERS +#include +#include +#include + +#include +#include +#include +#include "drm-client-protocol.h" + +struct xwl_pixmap { + struct wl_buffer *buffer; + struct gbm_bo *bo; + void *image; + unsigned int texture; +}; + +static void +xwl_glamor_egl_make_current(struct glamor_context *glamor_ctx) +{ + eglMakeCurrent(glamor_ctx->display, EGL_NO_SURFACE, + EGL_NO_SURFACE, EGL_NO_CONTEXT); + if (!eglMakeCurrent(glamor_ctx->display, + EGL_NO_SURFACE, EGL_NO_SURFACE, + glamor_ctx->ctx)) + FatalError("Failed to make EGL context current\n"); +} + +static uint32_t +drm_format_for_depth(int depth) +{ + switch (depth) { + case 15: + return WL_DRM_FORMAT_XRGB1555; + case 16: + return WL_DRM_FORMAT_RGB565; + case 24: + return WL_DRM_FORMAT_XRGB8888; + default: + ErrorF("unexpected depth: %d\n", depth); + case 32: + return WL_DRM_FORMAT_ARGB8888; + } +} + +static uint32_t +gbm_format_for_depth(int depth) +{ + switch (depth) { + case 16: + return GBM_FORMAT_RGB565; + case 24: + return GBM_FORMAT_XRGB8888; + default: + ErrorF("unexpected depth: %d\n", depth); + case 32: + return GBM_FORMAT_ARGB8888; + } +} + +void +glamor_egl_screen_init(ScreenPtr screen, struct glamor_context *glamor_ctx) +{ + struct xwl_screen *xwl_screen = xwl_screen_get(screen); + + glamor_ctx->ctx = xwl_screen->egl_context; + glamor_ctx->display = xwl_screen->egl_display; + + glamor_ctx->make_current = xwl_glamor_egl_make_current; + + xwl_screen->glamor_ctx = glamor_ctx; +} + +static PixmapPtr +xwl_glamor_create_pixmap_for_bo(ScreenPtr screen, struct gbm_bo *bo, int depth) +{ + PixmapPtr pixmap; + struct xwl_pixmap *xwl_pixmap; + struct xwl_screen *xwl_screen = xwl_screen_get(screen); + + xwl_pixmap = malloc(sizeof *xwl_pixmap); + if (xwl_pixmap == NULL) + return NULL; + + pixmap = glamor_create_pixmap(screen, + gbm_bo_get_width(bo), + gbm_bo_get_height(bo), + depth, + GLAMOR_CREATE_PIXMAP_NO_TEXTURE); + if (pixmap == NULL) { + free(xwl_pixmap); + return NULL; + } + + if (lastGLContext != xwl_screen->glamor_ctx) { + lastGLContext = xwl_screen->glamor_ctx; + xwl_glamor_egl_make_current(xwl_screen->glamor_ctx); + } + + xwl_pixmap->bo = bo; + xwl_pixmap->buffer = NULL; + xwl_pixmap->image = eglCreateImageKHR(xwl_screen->egl_display, + xwl_screen->egl_context, + EGL_NATIVE_PIXMAP_KHR, + xwl_pixmap->bo, NULL); + + glGenTextures(1, &xwl_pixmap->texture); + glBindTexture(GL_TEXTURE_2D, xwl_pixmap->texture); + glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, xwl_pixmap->image); + glBindTexture(GL_TEXTURE_2D, 0); + + xwl_pixmap_set_private(pixmap, xwl_pixmap); + + glamor_set_pixmap_texture(pixmap, xwl_pixmap->texture); + glamor_set_pixmap_type(pixmap, GLAMOR_TEXTURE_DRM); + + return pixmap; +} + +struct wl_buffer * +xwl_glamor_pixmap_get_wl_buffer(PixmapPtr pixmap) +{ + struct xwl_screen *xwl_screen = xwl_screen_get(pixmap->drawable.pScreen); + struct xwl_pixmap *xwl_pixmap = xwl_pixmap_get(pixmap); + int prime_fd; + + if (xwl_pixmap->buffer) + return xwl_pixmap->buffer; + + prime_fd = gbm_bo_get_fd(xwl_pixmap->bo); + if (prime_fd == -1) + return NULL; + + xwl_pixmap->buffer = + wl_drm_create_prime_buffer(xwl_screen->drm, prime_fd, + pixmap->drawable.width, + pixmap->drawable.height, + drm_format_for_depth(pixmap->drawable.depth), + 0, gbm_bo_get_stride(xwl_pixmap->bo), + 0, 0, + 0, 0); + + close(prime_fd); + + return xwl_pixmap->buffer; +} + +static PixmapPtr +xwl_glamor_create_pixmap(ScreenPtr screen, + int width, int height, int depth, unsigned int hint) +{ + struct xwl_screen *xwl_screen = xwl_screen_get(screen); + struct gbm_bo *bo; + + if (width > 0 && height > 0 && depth >= 15 && + (hint == 0 || + hint == CREATE_PIXMAP_USAGE_BACKING_PIXMAP || + hint == CREATE_PIXMAP_USAGE_SHARED)) { + bo = gbm_bo_create(xwl_screen->gbm, width, height, + gbm_format_for_depth(depth), + GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING); + + if (bo) + return xwl_glamor_create_pixmap_for_bo(screen, bo, depth); + } + + return glamor_create_pixmap(screen, width, height, depth, hint); +} + +static Bool +xwl_glamor_destroy_pixmap(PixmapPtr pixmap) +{ + struct xwl_screen *xwl_screen = xwl_screen_get(pixmap->drawable.pScreen); + struct xwl_pixmap *xwl_pixmap = xwl_pixmap_get(pixmap); + + if (xwl_pixmap && pixmap->refcnt == 1) { + if (xwl_pixmap->buffer) + wl_buffer_destroy(xwl_pixmap->buffer); + + eglDestroyImageKHR(xwl_screen->egl_display, xwl_pixmap->image); + gbm_bo_destroy(xwl_pixmap->bo); + free(xwl_pixmap); + } + + return glamor_destroy_pixmap(pixmap); +} + +static Bool +xwl_glamor_create_screen_resources(ScreenPtr screen) +{ + struct xwl_screen *xwl_screen = xwl_screen_get(screen); + int ret; + + screen->CreateScreenResources = xwl_screen->CreateScreenResources; + ret = (*screen->CreateScreenResources) (screen); + xwl_screen->CreateScreenResources = screen->CreateScreenResources; + screen->CreateScreenResources = xwl_glamor_create_screen_resources; + + if (!ret) + return ret; + + if (xwl_screen->rootless) + screen->devPrivate = + fbCreatePixmap(screen, 0, 0, screen->rootDepth, 0); + else { + screen->devPrivate = + xwl_glamor_create_pixmap(screen, screen->width, screen->height, + screen->rootDepth, + CREATE_PIXMAP_USAGE_BACKING_PIXMAP); + if (screen->devPrivate) + glamor_set_screen_pixmap(screen->devPrivate, NULL); + } + + return screen->devPrivate != NULL; +} + +static char +is_fd_render_node(int fd) +{ + struct stat render; + + if (fstat(fd, &render)) + return 0; + if (!S_ISCHR(render.st_mode)) + return 0; + if (render.st_rdev & 0x80) + return 1; + + return 0; +} + +static void +xwl_drm_init_egl(struct xwl_screen *xwl_screen) +{ + EGLint major, minor; + const char *version; + + if (xwl_screen->egl_display) + return; + + xwl_screen->expecting_event--; + + xwl_screen->gbm = gbm_create_device(xwl_screen->drm_fd); + if (xwl_screen->gbm == NULL) { + ErrorF("couldn't get display device\n"); + return; + } + + xwl_screen->egl_display = eglGetDisplay(xwl_screen->gbm); + if (xwl_screen->egl_display == EGL_NO_DISPLAY) { + ErrorF("eglGetDisplay() failed\n"); + return; + } + + eglBindAPI(EGL_OPENGL_API); + if (!eglInitialize(xwl_screen->egl_display, &major, &minor)) { + ErrorF("eglInitialize() failed\n"); + return; + } + + version = eglQueryString(xwl_screen->egl_display, EGL_VERSION); + ErrorF("glamor: EGL version %s:\n", version); + + xwl_screen->egl_context = eglCreateContext(xwl_screen->egl_display, + NULL, EGL_NO_CONTEXT, NULL); + if (xwl_screen->egl_context == EGL_NO_CONTEXT) { + ErrorF("Failed to create EGL context\n"); + return; + } + + if (!eglMakeCurrent(xwl_screen->egl_display, + EGL_NO_SURFACE, EGL_NO_SURFACE, + xwl_screen->egl_context)) { + ErrorF("Failed to make EGL context current\n"); + return; + } + + if (!epoxy_has_gl_extension("GL_OES_EGL_image")) { + ErrorF("GL_OES_EGL_image no available"); + return; + } + + return; +} + +static void +xwl_drm_handle_device(void *data, struct wl_drm *drm, const char *device) +{ + struct xwl_screen *xwl_screen = data; + drm_magic_t magic; + + xwl_screen->device_name = strdup(device); + if (!xwl_screen->device_name) + return; + + xwl_screen->drm_fd = open(xwl_screen->device_name, O_RDWR | O_CLOEXEC); + if (xwl_screen->drm_fd == -1) { + ErrorF("wayland-egl: could not open %s (%s)", + xwl_screen->device_name, strerror(errno)); + return; + } + + if (is_fd_render_node(xwl_screen->drm_fd)) { + xwl_screen->fd_render_node = 1; + xwl_drm_init_egl(xwl_screen); + } else { + drmGetMagic(xwl_screen->drm_fd, &magic); + wl_drm_authenticate(xwl_screen->drm, magic); + } +} + +static void +xwl_drm_handle_format(void *data, struct wl_drm *drm, uint32_t format) +{ + struct xwl_screen *xwl_screen = data; + + switch (format) { + case WL_DRM_FORMAT_ARGB8888: + xwl_screen->formats |= XWL_FORMAT_ARGB8888; + break; + case WL_DRM_FORMAT_XRGB8888: + xwl_screen->formats |= XWL_FORMAT_XRGB8888; + break; + case WL_DRM_FORMAT_RGB565: + xwl_screen->formats |= XWL_FORMAT_RGB565; + break; + } +} + +static void +xwl_drm_handle_authenticated(void *data, struct wl_drm *drm) +{ + struct xwl_screen *xwl_screen = data; + + if (!xwl_screen->egl_display) + xwl_drm_init_egl(xwl_screen); +} + +static void +xwl_drm_handle_capabilities(void *data, struct wl_drm *drm, uint32_t value) +{ + struct xwl_screen *xwl_screen = data; + + xwl_screen->capabilities = value; +} + +static const struct wl_drm_listener xwl_drm_listener = { + xwl_drm_handle_device, + xwl_drm_handle_format, + xwl_drm_handle_authenticated, + xwl_drm_handle_capabilities +}; + +Bool +xwl_screen_init_glamor(struct xwl_screen *xwl_screen, + uint32_t id, uint32_t version) +{ + if (version < 2) + return FALSE; + + xwl_screen->drm = + wl_registry_bind(xwl_screen->registry, id, &wl_drm_interface, 2); + wl_drm_add_listener(xwl_screen->drm, &xwl_drm_listener, xwl_screen); + xwl_screen->expecting_event++; + + return TRUE; +} + +void +glamor_egl_destroy_textured_pixmap(PixmapPtr pixmap) +{ + glamor_destroy_textured_pixmap(pixmap); +} + +int +glamor_egl_dri3_fd_name_from_tex(ScreenPtr screen, + PixmapPtr pixmap, + unsigned int tex, + Bool want_name, CARD16 *stride, CARD32 *size) +{ + return 0; +} + +unsigned int +glamor_egl_create_argb8888_based_texture(ScreenPtr screen, int w, int h) +{ + return 0; +} + +struct xwl_auth_state { + int fd; + ClientPtr client; +}; + +static void +sync_callback(void *data, struct wl_callback *callback, uint32_t serial) +{ + struct xwl_auth_state *state = data; + + dri3_send_open_reply(state->client, state->fd); + AttendClient(state->client); + free(state); + wl_callback_destroy(callback); +} + +static const struct wl_callback_listener sync_listener = { + sync_callback +}; + +static int +xwl_dri3_open_client(ClientPtr client, + ScreenPtr screen, + RRProviderPtr provider, + int *pfd) +{ + struct xwl_screen *xwl_screen = xwl_screen_get(screen); + struct xwl_auth_state *state; + struct wl_callback *callback; + drm_magic_t magic; + int fd; + + fd = open(xwl_screen->device_name, O_RDWR | O_CLOEXEC); + if (fd < 0) + return BadAlloc; + if (xwl_screen->fd_render_node) { + *pfd = fd; + return Success; + } + + state = malloc(sizeof *state); + if (state == NULL) { + close(fd); + return BadAlloc; + } + + state->client = client; + state->fd = fd; + + if (drmGetMagic(state->fd, &magic) < 0) { + close(state->fd); + free(state); + return BadMatch; + } + + wl_drm_authenticate(xwl_screen->drm, magic); + callback = wl_display_sync(xwl_screen->display); + wl_callback_add_listener(callback, &sync_listener, state); + + IgnoreClient(client); + + return Success; +} + +static PixmapPtr +xwl_dri3_pixmap_from_fd(ScreenPtr screen, int fd, + CARD16 width, CARD16 height, CARD16 stride, + CARD8 depth, CARD8 bpp) +{ + struct xwl_screen *xwl_screen = xwl_screen_get(screen); + struct gbm_import_fd_data data; + struct gbm_bo *bo; + PixmapPtr pixmap; + + if (width == 0 || height == 0 || + depth < 15 || bpp != BitsPerPixel(depth) || stride < width * bpp / 8) + return NULL; + + data.fd = fd; + data.width = width; + data.height = height; + data.stride = stride; + data.format = gbm_format_for_depth(depth); + bo = gbm_bo_import(xwl_screen->gbm, GBM_BO_IMPORT_FD, &data, + GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING); + if (bo == NULL) + return NULL; + + pixmap = xwl_glamor_create_pixmap_for_bo(screen, bo, depth); + if (pixmap == NULL) { + gbm_bo_destroy(bo); + return NULL; + } + + return pixmap; +} + +static int +xwl_dri3_fd_from_pixmap(ScreenPtr screen, PixmapPtr pixmap, + CARD16 *stride, CARD32 *size) +{ + struct xwl_pixmap *xwl_pixmap; + + xwl_pixmap = xwl_pixmap_get(pixmap); + + *stride = gbm_bo_get_stride(xwl_pixmap->bo); + *size = pixmap->drawable.width * *stride; + + return gbm_bo_get_fd(xwl_pixmap->bo); +} + +static dri3_screen_info_rec xwl_dri3_info = { + .version = 1, + .open = NULL, + .pixmap_from_fd = xwl_dri3_pixmap_from_fd, + .fd_from_pixmap = xwl_dri3_fd_from_pixmap, + .open_client = xwl_dri3_open_client, +}; + +Bool +xwl_glamor_init(struct xwl_screen *xwl_screen) +{ + ScreenPtr screen = xwl_screen->screen; + + if (xwl_screen->egl_context == EGL_NO_CONTEXT) { + ErrorF("Disabling glamor and dri3, EGL setup failed\n"); + return FALSE; + } + + if (!glamor_init(xwl_screen->screen, + GLAMOR_INVERTED_Y_AXIS | + GLAMOR_USE_EGL_SCREEN | + GLAMOR_USE_SCREEN | + GLAMOR_USE_PICTURE_SCREEN)) { + ErrorF("Failed to initialize glamor\n"); + return FALSE; + } + + if (!dri3_screen_init(xwl_screen->screen, &xwl_dri3_info)) { + ErrorF("Failed to initialize dri3\n"); + return FALSE; + } + + xwl_screen->CreateScreenResources = screen->CreateScreenResources; + screen->CreateScreenResources = xwl_glamor_create_screen_resources; + screen->CreatePixmap = xwl_glamor_create_pixmap; + screen->DestroyPixmap = xwl_glamor_destroy_pixmap; + + return TRUE; +} diff --git a/xorg-server/hw/xwayland/xwayland.c b/xorg-server/hw/xwayland/xwayland.c index b966e5070..17b7bf7fd 100644 --- a/xorg-server/hw/xwayland/xwayland.c +++ b/xorg-server/hw/xwayland/xwayland.c @@ -337,7 +337,13 @@ xwl_screen_post_damage(struct xwl_screen *xwl_screen) pixmap = (*xwl_screen->screen->GetWindowPixmap) (xwl_window->window); - buffer = xwl_shm_pixmap_get_wl_buffer(pixmap); +#if GLAMOR_HAS_GBM + if (xwl_screen->glamor) + buffer = xwl_glamor_pixmap_get_wl_buffer(pixmap); +#endif + if (!xwl_screen->glamor) + buffer = xwl_shm_pixmap_get_wl_buffer(pixmap); + wl_surface_attach(xwl_window->surface, buffer, 0, 0); for (i = 0; i < count; i++) { box = &RegionRects(region)[i]; @@ -373,6 +379,12 @@ registry_global(void *data, struct wl_registry *registry, uint32_t id, xwl_output_create(xwl_screen, id); xwl_screen->expecting_event++; } +#ifdef GLAMOR_HAS_GBM + else if (xwl_screen->glamor && + strcmp(interface, "wl_drm") == 0 && version >= 2) { + xwl_screen_init_glamor(xwl_screen, id, version); + } +#endif } static void @@ -495,6 +507,10 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv) dixSetPrivate(&pScreen->devPrivates, &xwl_screen_private_key, xwl_screen); xwl_screen->screen = pScreen; +#ifdef GLAMOR_HAS_GBM + xwl_screen->glamor = 1; +#endif + for (i = 1; i < argc; i++) { if (strcmp(argv[i], "-rootless") == 0) { xwl_screen->rootless = 1; @@ -514,6 +530,9 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv) atoi(argv[i + 1]); i++; } + else if (strcmp(argv[i], "-shm") == 0) { + xwl_screen->glamor = 0; + } } if (xwl_screen->listen_fd_count > 0) { @@ -591,10 +610,19 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv) if (!xwl_screen_init_cursor(xwl_screen)) return FALSE; - xwl_screen->CreateScreenResources = pScreen->CreateScreenResources; - pScreen->CreateScreenResources = xwl_shm_create_screen_resources; - pScreen->CreatePixmap = xwl_shm_create_pixmap; - pScreen->DestroyPixmap = xwl_shm_destroy_pixmap; +#ifdef GLAMOR_HAS_GBM + if (xwl_screen->glamor && !xwl_glamor_init(xwl_screen)) { + ErrorF("Failed to initialize glamor, falling back to sw\n"); + xwl_screen->glamor = 0; + } +#endif + + if (!xwl_screen->glamor) { + xwl_screen->CreateScreenResources = pScreen->CreateScreenResources; + pScreen->CreateScreenResources = xwl_shm_create_screen_resources; + pScreen->CreatePixmap = xwl_shm_create_pixmap; + pScreen->DestroyPixmap = xwl_shm_destroy_pixmap; + } xwl_screen->RealizeWindow = pScreen->RealizeWindow; pScreen->RealizeWindow = xwl_realize_window; diff --git a/xorg-server/hw/xwayland/xwayland.h b/xorg-server/hw/xwayland/xwayland.h index 8157e71ff..fc6855044 100644 --- a/xorg-server/hw/xwayland/xwayland.h +++ b/xorg-server/hw/xwayland/xwayland.h @@ -55,6 +55,7 @@ struct xwl_screen { int listen_fds[5]; int listen_fd_count; int rootless; + int glamor; CreateScreenResourcesProcPtr CreateScreenResources; CloseScreenProcPtr CloseScreen; @@ -83,6 +84,16 @@ struct xwl_screen { #define XWL_FORMAT_RGB565 (1 << 2) int prepare_read; + + char *device_name; + int drm_fd; + int fd_render_node; + struct wl_drm *drm; + uint32_t formats; + uint32_t capabilities; + void *egl_display, *egl_context; + struct gbm_device *gbm; + struct glamor_context *glamor_ctx; }; struct xwl_window { @@ -161,4 +172,10 @@ Bool xwl_shm_destroy_pixmap(PixmapPtr pixmap); struct wl_buffer *xwl_shm_pixmap_get_wl_buffer(PixmapPtr pixmap); +Bool xwl_glamor_init(struct xwl_screen *xwl_screen); + +Bool xwl_screen_init_glamor(struct xwl_screen *xwl_screen, + uint32_t id, uint32_t version); +struct wl_buffer *xwl_glamor_pixmap_get_wl_buffer(PixmapPtr pixmap); + #endif diff --git a/xorg-server/include/servermd.h b/xorg-server/include/servermd.h index 081123be9..e41331463 100644 --- a/xorg-server/include/servermd.h +++ b/xorg-server/include/servermd.h @@ -114,8 +114,13 @@ SOFTWARE. #if defined(__powerpc__) || defined(__ppc__) || defined(__ppc64__) -#define IMAGE_BYTE_ORDER MSBFirst -#define BITMAP_BIT_ORDER MSBFirst +#if defined(__LITTLE_ENDIAN__) +#define IMAGE_BYTE_ORDER LSBFirst +#define BITMAP_BIT_ORDER LSBFirst +#else +#define IMAGE_BYTE_ORDER MSBFirst +#define BITMAP_BIT_ORDER MSBFirst +#endif #define GLYPHPADBYTES 4 #endif /* PowerPC */ diff --git a/xorg-server/present/present.c b/xorg-server/present/present.c index 1bf3a5865..3aea0d7c6 100644 --- a/xorg-server/present/present.c +++ b/xorg-server/present/present.c @@ -382,6 +382,24 @@ present_set_tree_pixmap(WindowPtr window, PixmapPtr pixmap) TraverseTree(window, present_set_tree_pixmap_visit, &visit); } +static void +present_set_abort_flip(ScreenPtr screen) +{ + present_screen_priv_ptr screen_priv = present_screen_priv(screen); + + /* Switch back to using the screen pixmap now to avoid + * 2D applications drawing to the wrong pixmap. + */ + + if (screen_priv->flip_window) + present_set_tree_pixmap(screen_priv->flip_window, + (*screen->GetScreenPixmap)(screen)); + + present_set_tree_pixmap(screen->root, (*screen->GetScreenPixmap)(screen)); + + screen_priv->flip_pending->abort_flip = TRUE; +} + static void present_unflip(ScreenPtr screen) { @@ -511,7 +529,7 @@ present_check_flip_window (WindowPtr window) if (flip_pending->window == window) { if (!present_check_flip(flip_pending->crtc, window, flip_pending->pixmap, flip_pending->sync_flip, NULL, 0, 0)) - flip_pending->abort_flip = TRUE; + present_set_abort_flip(screen); } } else { /* @@ -578,6 +596,7 @@ present_execute(present_vblank_ptr vblank, uint64_t ust, uint64_t crtc_msc) } xorg_list_del(&vblank->event_queue); + xorg_list_del(&vblank->window_list); vblank->queued = FALSE; if (vblank->pixmap && vblank->window) { @@ -633,7 +652,7 @@ present_execute(present_vblank_ptr vblank, uint64_t ust, uint64_t crtc_msc) /* Check pending flip */ if (window == screen_priv->flip_pending->window) - screen_priv->flip_pending->abort_flip = TRUE; + present_set_abort_flip(screen); } else if (!screen_priv->unflip_event_id) { /* Check current flip @@ -752,7 +771,7 @@ present_pixmap(WindowPtr window, if (!vblank->queued) continue; - if (vblank->crtc != target_crtc || vblank->target_msc > target_msc) + if (vblank->crtc != target_crtc || vblank->target_msc != target_msc) continue; DebugPresent(("\tx %lld %p %8lld: %08lx -> %08lx (crtc %p)\n", @@ -915,7 +934,7 @@ present_flip_destroy(ScreenPtr screen) /* Do the actual cleanup once the flip has been performed by the hardware */ if (screen_priv->flip_pending) - screen_priv->flip_pending->abort_flip = TRUE; + present_set_abort_flip(screen); } void diff --git a/xorg-server/xkeyboard-config/rules/base.xml.in b/xorg-server/xkeyboard-config/rules/base.xml.in index 0b0c1482c..319878fab 100644 --- a/xorg-server/xkeyboard-config/rules/base.xml.in +++ b/xorg-server/xkeyboard-config/rules/base.xml.in @@ -794,7 +794,7 @@ microsoft4000 - <_description>Microsoft Natural Wireless Ergonomic Keyboard 4000 + <_description>Microsoft Natural Ergonomic Keyboard 4000 Microsoft Inc. diff --git a/xorg-server/xkeyboard-config/symbols/apl b/xorg-server/xkeyboard-config/symbols/apl index 0800b5bbd..c60f11723 100644 --- a/xorg-server/xkeyboard-config/symbols/apl +++ b/xorg-server/xkeyboard-config/symbols/apl @@ -5,7 +5,7 @@ // This file supports: // - The Sharp APL for Unix (SAX) layout // - The IBM APL2 layout -// - The Manugistics APL*PLUS II layout (version 5.1, 1993) +// - The Manugistics APL*PLUS II (Version 5.1, 1993) keyboard layout // - The Dyalog APL layout - with additions for box drawing and commands // Unicode APL table: http://aplwiki.com/UnicodeAplTable @@ -16,33 +16,33 @@ // This file doesn't deal with all the combining stuff -- I'm not an APL programmer, // and am not quite sure what's needed here. However, it may be possible to get this -// working with dead keys and the like. Patches gratefully accepted. +// working with dead keys and the like. Patches gratefully accepted. // Some of the shift-key assignments may differ from the APL tradition. If -// that's not considered acceptable, it should be possible to remap the +// that's not considered acceptable, it should be possible to remap the // shift keys. I have striven, however, to ensure that the use of shift keys -// in these maps is at least self-consistent. +// in these maps is at least self-consistent. -// I'm assuming that this will be used with another keyboard layout (i.e. for -// your language), with a special shift key to use these maps. +// I'm assuming that this will be used with another keyboard layout (ie. for +// your language), with a special shift key to use these maps. -// 2011-12-22 Geoff Streeter , -// added the Dyalog support; -// corrected (what he thinks) are some errors: -// resolving the confusion between APL's and Unicode's concept of Left and Right tacks; -// unsure about some of the inheritance from APL2 into APLPLUS -- patches welcome; -// complied with freedesktop.org requirement that the keycodes be in sorted order, -// which leads to the bottom to top (roughly) definitions. +// 2012-09-26 changed "overbar" to macron which fixed some strangeness in xterm -// The default layout still has to be the first one. Choosing the basic Dyalog layout is -// definitely better than using the "common" one. Choosing the complete Dyalog layout is -// not useful to non-Dyalog users. +// 2011-12-22 Geoff Streeter: geoff@dyalog.com +// Added the Dyalog support. +// Corrected (what he thinks) are some errors. +// Resolving the confusion between APL's and Unicode's concept of Left and Right tacks. +// Unsure about some of the inheritance from APL2 into APLPLUS. Patches welcome. +// Complied with freedesktop.org requirement that the keycodes be in sorted order. Which +// leads to the bottom to top (roughly) definitions. -default partial alphanumeric_keys +// default layout seems to have to be the first one. Choosing the basic Dyalog layout is definitely +// better than using the "common" one. Choosing the complete Dyalog layout is not useful to non-Dyalog +// users. + +default partial alphanumeric_keys xkb_symbols "basic" { include "apl(dyalog_base)" // forward reference good APL keyboard without Dyalogs extras - - name[Group1]= "APL keyboard symbols"; }; // ┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┲━━━━━━━━━┓ @@ -64,6 +64,7 @@ xkb_symbols "basic" { partial hidden alphanumeric_keys xkb_symbols "common" { + name[Group1]= "APL"; key { [ U2282 ] }; // Z: ⊂ -- Subset Of key { [ U2283 ] }; // X: ⊃ -- Superset Of @@ -96,7 +97,7 @@ xkb_symbols "common" { key { [ U2190 ] }; // [: ← -- Leftwards Arrow key { [ diaeresis ] }; - key { [ U00AF ] }; // ¯ -- Macron + key { [ macron ] }; // ¯ -- Macron key { [ less ] }; key { [ U2264 ] }; // ≤ -- Less-than Or Equal To key { [ equal ] }; @@ -128,7 +129,7 @@ xkb_symbols "common" { partial alphanumeric_keys xkb_symbols "unified" { - name[Group1]= "APL keyboard symbols (unified)"; + name[Group1]= "APL Keyboard Symbols: Unified Layout"; include "apl(common)" @@ -161,7 +162,7 @@ xkb_symbols "unified" { partial alphanumeric_keys xkb_symbols "sax" { - name[Group1]= "APL keyboard symbols (sax)"; + name[Group1]= "APL Keyboard Symbols"; include "apl(unified)" @@ -223,7 +224,7 @@ xkb_symbols "sax" { partial alphanumeric_keys xkb_symbols "apl2" { - name[Group1]= "APL keyboard symbols (IBM APL2)"; + name[Group1]= "APL Keyboard Symbols: IBM APL2"; include "apl(common)" @@ -235,7 +236,7 @@ xkb_symbols "apl2" { key { [ slash, backslash, U233F ] }; // /: ⌿ -- AFS Slash Bar key { [ bracketleft, parenleft, U234E ] }; // ;: ⍎ -- [See B key in SAX layout] - key { [ bracketright, parenright, U2355 ] }; // ': ⍕ -- [See N key in SAX layout] + key { [ bracketright, parenright, U2355 ] }; // ': ⍕ -- [See N key in SAX layout] key { [ NoSymbol, U2192, U235E ] }; // [: (←) → ⍞ -- Rightwards Arrow / AFS Quote Quad key { [ U2337, U2378, U2359 ] }; // ]: ⌷ ⍸ ⍙ -- AFS Squish Quad / AFS Iota Underbar / AFS Delta Underbar @@ -255,7 +256,7 @@ xkb_symbols "apl2" { key { [ U2261, U2377, U2364 ] }; // \: ≡ ⍷ ⍤ -- Identical To / AFS Epsilon Underbar / AFS Jot Diaeresis - key { [ NoSymbol, U233B, U2342 ] }; // `: ⌻ ⍂ -- + key { [ NoSymbol, U233B, U2342 ] }; // `: ⌻ ⍂ -- include "level3(ralt_switch)" }; @@ -283,13 +284,13 @@ xkb_symbols "apl2" { partial alphanumeric_keys xkb_symbols "aplplusII" { + name[Group1]= "APL Keyboard Symbols: Manugistics APL*PLUS II"; // AFS - short for APL Functional Symbol include "apl(apl2)" - name[Group1]= "APL keyboard symbols (Manugistics APL*PLUS II)"; key { [ bracketleft, parenleft, U234E ] }; // ;: ⍎ -- [See B key in SAX layout] - key { [ bracketright, parenright, U2355 ] }; // ': ⍕ -- [See N key in SAX layout] + key { [ bracketright, parenright, U2355 ] }; // ': ⍕ -- [See N key in SAX layout] key { [ U2190, NoSymbol, U235E ] }; // [: ← ⍞ -- Leftwards Arrow / AFS Quote Quad key { [ U2192, NoSymbol, U236C ] }; // ]: → ⍬ -- Rightwards Arrow / AFS Zilde key { [ NoSymbol, NoSymbol, U2261 ] }; // 1: ≡ -- Identical To @@ -320,9 +321,9 @@ xkb_symbols "aplplusII" { partial alphanumeric_keys xkb_symbols "aplx" { - include "apl(unified)" + name[Group1]= "APL Keyboard Symbols: APLX Unified APL Layout"; - name[Group1]= "APL keyboard symbols (APLX unified)"; + include "apl(unified)" key { [ U235D, U236A ] }; // ,: ⍝ ⍪ -- APL Functional Symbol Up Shoe Jot / APL Functional Symbol Comma Bar key { [ U2340, U2364 ] }; // .: ⍀ ⍤ -- APL Functional Symbol Backslash Bar / APL Functional Symbol Jot Diaeresis @@ -350,44 +351,57 @@ xkb_symbols "aplx" { }; // APL language support for the Dyalog keyboard. -// Dyalog Ltd sells this keyboard with APL engravings. The current model is -// engraved on a Cherry G80. Base languages for US, UK and DK are available. +// Dyalog Ltd sell this keyboard with APL engravings. The current model is +// engraved on a Cherry G80. Base languages for US, UK and DK are availible. -// Geoff Streeter, Dyalog Ltd. 2007-09-03 +// Geoff Streeter, Dyalog Ltd. 2007-09-03 +// geoff@dyalog.com // extended for APL special actions 2008-09-09 -// added a variant 2010-11-26 - -// The intention is that this keyboard layout overlays a base keyboard that provides +// add variant 2010-11-26 +// made BKSL and LTGT keys the same to remove a compatibility issue with the UK physical keyboard +// add key (quad equals) 2013-03-12 +// add currency 2014-05-23 +// add parallel 2014-05-23 +// add circle jot 2014-05-23 +// add t diaeresis 2014-05-23 +// add del diaerisis 2014-05-23 +// add quad query 2014-05-23 +// add dagger 2014-05-23 + +// The intention is that this keyboard layout overlays a base keyboard that provides // the alphabet and similar. If this keyboard is placed as the 2nd layout then it can // be reached with a latching shift to increase group by one. -partial hidden alphanumeric_keys +partial alphanumeric_keys xkb_symbols "dyalog_base" { + name[Group1]="APL"; + // ┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┲━━━━━━━━━┓ -// │ │ ⌶ │ ⍫ │ ⍒ │ ⍋ │ ⌽ │ ⍉ │ ⊖ │ ⍟ │ ⍱ │ ⍲ │ ! │ ⌹ ┃ ┃ +// │ ¤ │ ⌶ │ ⍫ │ ⍒ │ ⍋ │ ⌽ │ ⍉ │ ⊖ │ ⍟ │ ⍱ │ ⍲ │ ! │ ⌹ ┃ ┃ // │ ⋄ │ ¨ │ ¯ │ < │ ≤ │ = │ ≥ │ > │ ≠ │ ∨ │ ∧ │ × │ ÷ ┃ ┃ // ┢━━━━━┷━┱───┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┺━┳━━━━━━━┫ -// ┃ ┃ │ │ ⍷ │ │ ⍨ │ │ │ ⍸ │ ⍥ │ ⍣ │ ⍞ │ ⍬ ┃ ┃ +// ┃ ┃ ⍰ │ │ ⍷ │ ⌾ │ ⍨ │ │ │ ⍸ │ ⍥ │ ⍣ │ ⍞ │ ⍬ ┃ ┃ // ┃ ┃ ? │ ⍵ │ ∊ │ ⍴ │ ~ │ ↑ │ ↓ │ ⍳ │ ○ │ * │ ← │ → ┃ ┃ // ┣━━━━━━━┻┱────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┺┓ ┃ -// ┃ ┃ │ │ │ │ │ │ ⍤ │ │ ⌷ │ ≡ │ ≢ │ ⊣ ┃ ┃ +// ┃ ┃ │ │ │ │ ⍢ │ │ ⍤ │ ⌸ │ ⌷ │ ≡ │ ≢ │ ⊣ ┃ ┃ // ┃ ┃ ⍺ │ ⌈ │ ⌊ │ _ │ ∇ │ ∆ │ ∘ │ ' │ ⎕ │ ⍎ │ ⍕ │ ⊢ ┃ ┃ // ┣━━━━━━━┳┹────┬┴────┬┴────┬┴────┬┴────┬┴────┬┴────┬┴────┬┴────┬┴────┬┴────┲┷━━━━━┻━━━━━━┫ -// ┃ ┃ │ │ │ │ │ │ │ │ ⍪ │ ⍙ │ ⍠ ┃ ┃ +// ┃ ┃ │ │ │ │ │ ⍭ │ ⍡ │ ∥ │ ⍪ │ ⍙ │ ⍠ ┃ ┃ // ┃ ┃ │ ⊂ │ ⊃ │ ∩ │ ∪ │ ⊥ │ ⊤ │ | │ ⍝ │ ⍀ │ ⌿ ┃ ┃ // ┣━━━━━━━╋━━━━━┷━┳━━━┷━━━┱─┴─────┴─────┴─────┴─────┴─────┴───┲━┷━━━━━╈━━━━━┻━┳━━━━━━━┳━━━┛ // ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ // ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ // ┗━━━━━━━┻━━━━━━━┻━━━━━━━┹───────────────────────────────────┺━━━━━━━┻━━━━━━━┻━━━━━━━┛ + key { [ U2282 ] }; // subset of key { [ U2283 ] }; // superset of key { [ U2229 ] }; // intersection key { [ U222A ] }; // union - key { [ U22a5 ] }; // up tack - key { [ U22a4 ] }; // down tack - key { [ U007c ] }; // vertical line + key { [ U22a5, U236d ] }; // up tack, stile tide + key { [ U22a4, U2361 ] }; // down tack, down tack diaeresis + key { [ bar, U2225 ] }; // vertical line, parallel to key { [ U235d, U236a ] }; // up shoe jot, comma bar key { [ U2340, U2359 ] }; // backslash bar, delta underbar key { [ U233f, U2360 ] }; // slash bar, quad colon @@ -395,17 +409,17 @@ xkb_symbols "dyalog_base" { key { [ U2308 ] }; // left ceiling key { [ U230a ] }; // left floor key { [ underscore ] }; // low line - key { [ U2207 ] }; // nabla + key { [ U2207, U2362 ] }; // nabla, del diaerisis key { [ U2206 ] }; // increment key { [ U2218, U2364 ] }; // ring operator, jot diaeresis - key { [ apostrophe ] }; + key { [ apostrophe, U2338 ] }; // quote, key key { [ U2395, U2337 ] }; // quad, squish quad key { [ U234e, U2261 ] }; // up tack jot, identical to key { [ U2355, U2262 ] }; // down tack jot, not identical to - key { [ question ] }; + key { [ question, U2370 ] }; // ?, quad question key { [ U2375 ] }; // omega key { [ U220a, U2377 ] }; // small element of, epsilon underbar - key { [ U2374 ] }; // rho + key { [ U2374, U233E ] }; // rho, circle jot key { [ asciitilde, U2368 ] }; // tilde, tilde diaeresis key { [ U2191 ] }; // upwards arrow key { [ U2193 ] }; // downwards arrow @@ -415,7 +429,7 @@ xkb_symbols "dyalog_base" { key { [ U2190, U235e ] }; // left arrow, quote quad key { [ U2192, U236c ] }; // right arrow, zilde key { [ diaeresis, U2336 ] }; // i-beam - key { [ overbar, U236B ] }; // deltilde + key { [ macron, U236B ] }; // deltilde key { [ less, U2352 ] }; // downgrade key { [ U2264, U234b ] }; // lesseq upgrade key { [ equal, U233d ] }; // circlestile @@ -425,13 +439,15 @@ xkb_symbols "dyalog_base" { key { [ U2228, U2371 ] }; // logical or, down caret tilde key { [ U2227, U2372 ] }; // logical and, up caret tilde key { [ multiply, exclam ] }; - key { [ division, U2339 ] }; // quad divide + key { [ division, U2339 ] }; // quad divide key { [ U22a2, U22a3 ] }; // right tack, left tack - key { [ U22c4 ] }; // diamond + key { [ U22a2, U22a3 ] }; // right tack, left tack + key { [ U22c4, currency] }; // diamond }; -partial hidden keypad_keys +partial keypad_keys xkb_symbols "dyalog_box" { + name[Group1]="Dyalog box"; // ┌───┬───┬───┬───┐ // │ │ │ │ │ @@ -449,22 +465,22 @@ xkb_symbols "dyalog_box" { key { [ U2514 ] }; // box drawing light up and right key { [ U2534 ] }; // box drawing light up and horizontal key { [ U2518 ] }; // box drawing light up and left - key { [ U251c ] }; // box drawing light veritcal and right - key { [ U253c ] }; // box drawing light veritcal and horizontal - key { [ U2524 ] }; // box drawing light veritcal and left + key { [ U251c ] }; // box drawing light vertical and right + key { [ U253c ] }; // box drawing light vertical and horizontal + key { [ U2524 ] }; // box drawing light vertical and left key { [ U250c ] }; // box drawing light down and right key { [ U252c ] }; // box drawing light down and horizontal key { [ U2510 ] }; // box drawing light down and left key { [ U2502 ] }; // box drawing light vertical -}; +}; -partial hidden xkb_symbols "dyalog_codes" { + name[Group1]="Dyalog Codes"; // Layout of private use area for this. In the style of the Unicode book // -// APL special actions F800-F88F +// APL special actions F800-F88F // // │F800 F810 F820 F830 F840 F850 F860 F870 F880 // ├────┬────┬────┬────┬────┬────┬────┬────┬────┐ @@ -501,7 +517,7 @@ xkb_symbols "dyalog_codes" { // F│RL │FD │HK │Lc │BH │PU │ │ │OS │ // └────┴────┴────┴────┴────┴────┴────┴────┴────┘ // -// APL Function Keys F700-F7FF +// APL Function Keys F700-F7FF // // │F700 ... ... F7F0 // ├────┬────┬────┬────┬....┬────┬────┬────┬────┐ @@ -511,9 +527,9 @@ xkb_symbols "dyalog_codes" { // . // F│F15 │F31 │F47 │F63 │ │F207│F223│F239│F255│ // └────┴────┴────┴────┴....┴────┴────┴────┴────┘ -// +// // whilst these locations are defined. Dyalog's "aplkeys/xterm" file copes with -// normal function keys from the base keyboard rather than this overlay. +// normal function keys from the base keyboard rather than this overlay // ┌─────┐ ┌───┐ // │ │ │ZM │ @@ -537,6 +553,7 @@ xkb_symbols "dyalog_codes" { // ┃ ┃ ┃ ┃ TO ┃ ┃ ┃ ┃ // ┗━━━━━━━┻━━━━━━━┻━━━━━━━┹───────────────────────────────────┺━━━━━━━┻━━━━━━━┻━━━━━━━┛ + key { [ Uf850, Uf855 ] }; // BP CB key { [ Uf800 ] }; // QT key { [ Uf821, Uf821 ] }; // ZM, ZM put this on both, the unshifted one sometimes gets lost @@ -557,6 +574,7 @@ xkb_symbols "dyalog_codes" { key { [ Uf824, Uf854 ] }; // NX, RM key { [ Uf820 ] }; // BK + // ┌───┬───┬───┐ // │PT │LL │UL │ // │CP │LS │US │ @@ -584,6 +602,7 @@ xkb_symbols "dyalog_codes" { // │ │ │ │ // └───────┴───┴───┘ + key { [ Uf859 ] }; // TL key { [ Uf819 ] }; // RD key { [ Uf81a ] }; // TG @@ -594,5 +613,6 @@ xkb_symbols "dyalog" { include "apl(dyalog_base)" include "apl(dyalog_box)" include "apl(dyalog_codes)" - name[Group1] = "APL keyboard symbols (Dyalog)"; + name[Group1] = "Dyalog APL complete"; }; + diff --git a/xorg-server/xkeyboard-config/symbols/fr b/xorg-server/xkeyboard-config/symbols/fr index 3898b1c57..6658da4b5 100644 --- a/xorg-server/xkeyboard-config/symbols/fr +++ b/xorg-server/xkeyboard-config/symbols/fr @@ -128,7 +128,6 @@ xkb_symbols "oss" { include "latin" include "level3(ralt_switch)" include "nbsp(level4n)" - include "level5(rctrl_switch)" include "keypad(oss)" name[Group1]="French (alternative)"; diff --git a/xorg-server/xkeyboard-config/symbols/inet b/xorg-server/xkeyboard-config/symbols/inet index f7ccc6f81..613488f05 100644 --- a/xorg-server/xkeyboard-config/symbols/inet +++ b/xorg-server/xkeyboard-config/symbols/inet @@ -1271,7 +1271,7 @@ xkb_symbols "mx2750" { // Microsoft -// Microsoft Natural Wireless Ergonomic Keyboard 4000 +// Microsoft Natural Ergonomic Keyboard 4000 partial alphanumeric_keys xkb_symbols "microsoft4000" { include "inet(media_nav_common)" -- cgit v1.2.3