aboutsummaryrefslogtreecommitdiff
path: root/xorg-server
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2014-04-23 22:41:48 +0200
committermarha <marha@users.sourceforge.net>2014-04-23 22:41:48 +0200
commitd26ea2f474c48afa7d3c261572da5d85b7b62bd8 (patch)
treef4b1f3cac1b011283ae536868c3aee42bc14ff07 /xorg-server
parentdda1497a1e88c6cb8b8d91a7bc61283b697e8ea0 (diff)
downloadvcxsrv-d26ea2f474c48afa7d3c261572da5d85b7b62bd8.tar.gz
vcxsrv-d26ea2f474c48afa7d3c261572da5d85b7b62bd8.tar.bz2
vcxsrv-d26ea2f474c48afa7d3c261572da5d85b7b62bd8.zip
fontconfig mesa xserver xkeyboard-config pixman git update 23 Apr 2014
xserver commit 99f0365b1fbdfd9238b9f5cc28491e4e6c7324f1 xkeyboard-config commit b5eb5418e5a9d76b172faadf6901bc9c83f2ddad pixman commit 5f661ee719be25c3aa0eb0d45e0db23a37e76468 fontconfig commit 81664fe54f117e4781fda5a30429b51858302e91 mesa commit fd92346c53ed32709c7b56ce58fb9c9bf43ce9a8
Diffstat (limited to 'xorg-server')
-rw-r--r--xorg-server/.gitignore1
-rw-r--r--xorg-server/Xext/xres.c4
-rw-r--r--xorg-server/composite/compwindow.c1
-rw-r--r--xorg-server/configure.ac7
-rw-r--r--xorg-server/dix/dixfonts.c2
-rw-r--r--xorg-server/dix/dixutils.c25
-rw-r--r--xorg-server/fb/fbpict.c2
-rw-r--r--xorg-server/glamor/Makefile.am6
-rw-r--r--xorg-server/glamor/glamor.c25
-rw-r--r--xorg-server/glamor/glamor_context.h9
-rw-r--r--xorg-server/glamor/glamor_copyarea.c18
-rw-r--r--xorg-server/glamor/glamor_core.c11
-rw-r--r--xorg-server/glamor/glamor_egl.c61
-rw-r--r--xorg-server/glamor/glamor_fbo.c42
-rw-r--r--xorg-server/glamor/glamor_fill.c13
-rw-r--r--xorg-server/glamor/glamor_font.c7
-rw-r--r--xorg-server/glamor/glamor_getimage.c96
-rw-r--r--xorg-server/glamor/glamor_glx.c26
-rw-r--r--xorg-server/glamor/glamor_glyphblt.c10
-rw-r--r--xorg-server/glamor/glamor_glyphs.c3
-rw-r--r--xorg-server/glamor/glamor_gradient.c24
-rw-r--r--xorg-server/glamor/glamor_image.c180
-rw-r--r--xorg-server/glamor/glamor_pixmap.c22
-rw-r--r--xorg-server/glamor/glamor_points.c5
-rw-r--r--xorg-server/glamor/glamor_priv.h23
-rw-r--r--xorg-server/glamor/glamor_putimage.c161
-rw-r--r--xorg-server/glamor/glamor_rects.c4
-rw-r--r--xorg-server/glamor/glamor_render.c64
-rw-r--r--xorg-server/glamor/glamor_spans.c10
-rw-r--r--xorg-server/glamor/glamor_text.c10
-rw-r--r--xorg-server/glamor/glamor_tile.c13
-rw-r--r--xorg-server/glamor/glamor_transfer.c6
-rw-r--r--xorg-server/glamor/glamor_trapezoid.c20
-rw-r--r--xorg-server/glamor/glamor_utils.h13
-rw-r--r--xorg-server/glamor/glamor_vbo.c17
-rw-r--r--xorg-server/glamor/glamor_xv.c7
-rw-r--r--xorg-server/glx/glxcmds.c22
-rw-r--r--xorg-server/glx/glxdri2.c124
-rw-r--r--xorg-server/glx/glxdriswrast.c10
-rw-r--r--xorg-server/glx/glxext.c27
-rw-r--r--xorg-server/glx/glxserver.h1
-rw-r--r--xorg-server/hw/dmx/config/xdmxconfig.c3
-rw-r--r--xorg-server/hw/kdrive/linux/linux.c7
-rw-r--r--xorg-server/hw/kdrive/src/kdrive.c9
-rw-r--r--xorg-server/hw/xfree86/.gitignore1
-rw-r--r--xorg-server/hw/xfree86/common/compiler.h3
-rw-r--r--xorg-server/hw/xfree86/dri/dri.c14
-rw-r--r--xorg-server/hw/xfree86/dri2/dri2.c23
-rw-r--r--xorg-server/hw/xfree86/man/Makefile.am2
-rw-r--r--xorg-server/hw/xfree86/man/Xorg.wrap.man4
-rw-r--r--xorg-server/hw/xfree86/man/Xwrapper.config.man2
-rw-r--r--xorg-server/hw/xfree86/modes/xf86RandR12.c7
-rw-r--r--xorg-server/hw/xfree86/shadowfb/shadow.c1590
-rw-r--r--xorg-server/hw/xfree86/xorg-wrapper.c75
-rw-r--r--xorg-server/hw/xwayland/xwayland.c10
-rw-r--r--xorg-server/include/dix.h2
-rw-r--r--xorg-server/include/opaque.h1
-rw-r--r--xorg-server/os/busfault.c1
-rw-r--r--xorg-server/os/connection.c7
-rw-r--r--xorg-server/os/log.c10
-rw-r--r--xorg-server/os/utils.c11
-rw-r--r--xorg-server/randr/randr.c2
-rw-r--r--xorg-server/randr/rrprovider.c4
-rw-r--r--xorg-server/randr/rrsdispatch.c138
-rw-r--r--xorg-server/render/render.c2
-rw-r--r--xorg-server/test/.gitignore3
-rw-r--r--xorg-server/test/Makefile.am8
-rw-r--r--xorg-server/test/signal-logging.c11
-rw-r--r--xorg-server/xfixes/region.c6
-rw-r--r--xorg-server/xkb/xkmread.c6
-rw-r--r--xorg-server/xkeyboard-config/rules/base.xml.in2
-rw-r--r--xorg-server/xkeyboard-config/symbols/fi16
-rw-r--r--xorg-server/xkeyboard-config/symbols/hr56
-rw-r--r--xorg-server/xkeyboard-config/symbols/jp2
-rw-r--r--xorg-server/xkeyboard-config/symbols/keypad2
-rw-r--r--xorg-server/xkeyboard-config/symbols/me2
-rw-r--r--xorg-server/xkeyboard-config/symbols/rs479
-rw-r--r--xorg-server/xkeyboard-config/symbols/ru14
78 files changed, 1160 insertions, 2507 deletions
diff --git a/xorg-server/.gitignore b/xorg-server/.gitignore
index 94a12fdc2..dc56b4651 100644
--- a/xorg-server/.gitignore
+++ b/xorg-server/.gitignore
@@ -41,6 +41,7 @@ mkinstalldirs
py-compile
stamp-h?
symlink-tree
+test-driver
texinfo.tex
ylwrap
diff --git a/xorg-server/Xext/xres.c b/xorg-server/Xext/xres.c
index b26cbb5c5..546b942a1 100644
--- a/xorg-server/Xext/xres.c
+++ b/xorg-server/Xext/xres.c
@@ -353,9 +353,9 @@ static unsigned long
ResGetApproxPixmapBytes(PixmapPtr pix)
{
unsigned long nPixels;
- int bytesPerPixel;
+ float bytesPerPixel;
- bytesPerPixel = pix->drawable.bitsPerPixel >> 3;
+ bytesPerPixel = (float)pix->drawable.bitsPerPixel / 8.0;
nPixels = pix->drawable.width * pix->drawable.height;
/* Divide by refcnt as pixmap could be shared between clients,
diff --git a/xorg-server/composite/compwindow.c b/xorg-server/composite/compwindow.c
index 882429414..9a6b2dae8 100644
--- a/xorg-server/composite/compwindow.c
+++ b/xorg-server/composite/compwindow.c
@@ -525,6 +525,7 @@ compCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
}
FreeScratchGC(pGC);
}
+ RegionUninit(&rgnDst);
return;
}
dx = pPixmap->screen_x - cw->oldx;
diff --git a/xorg-server/configure.ac b/xorg-server/configure.ac
index 695a4819a..0c8b5162d 100644
--- a/xorg-server/configure.ac
+++ b/xorg-server/configure.ac
@@ -629,7 +629,7 @@ AC_ARG_ENABLE(suid-wrapper, AS_HELP_STRING([--enable-suid-wrapper], [Build suid-
dnl DDXes.
AC_ARG_ENABLE(xorg, AS_HELP_STRING([--enable-xorg], [Build Xorg server (default: auto)]), [XORG=$enableval], [XORG=auto])
-AC_ARG_ENABLE(dmx, AS_HELP_STRING([--enable-dmx], [Build DMX server (default: auto)]), [DMX=$enableval], [DMX=no])
+AC_ARG_ENABLE(dmx, AS_HELP_STRING([--enable-dmx], [Build DMX server (default: no)]), [DMX=$enableval], [DMX=no])
AC_ARG_ENABLE(xvfb, AS_HELP_STRING([--enable-xvfb], [Build Xvfb server (default: yes)]), [XVFB=$enableval], [XVFB=yes])
AC_ARG_ENABLE(xnest, AS_HELP_STRING([--enable-xnest], [Build Xnest server (default: auto)]), [XNEST=$enableval], [XNEST=auto])
AC_ARG_ENABLE(xquartz, AS_HELP_STRING([--enable-xquartz], [Build Xquartz server for OS-X (default: auto)]), [XQUARTZ=$enableval], [XQUARTZ=auto])
@@ -789,13 +789,13 @@ APPLEWMPROTO="applewmproto >= 1.4"
XSHMFENCE="xshmfence >= 1.1"
dnl Required modules
-XPROTO="xproto >= 7.0.22"
+XPROTO="xproto >= 7.0.26"
RANDRPROTO="randrproto >= 1.4.0"
RENDERPROTO="renderproto >= 0.11"
XEXTPROTO="xextproto >= 7.2.99.901"
INPUTPROTO="inputproto >= 2.3"
KBPROTO="kbproto >= 1.0.3"
-FONTSPROTO="fontsproto"
+FONTSPROTO="fontsproto >= 2.1.3"
FIXESPROTO="fixesproto >= 5.0"
DAMAGEPROTO="damageproto >= 1.1"
XCMISCPROTO="xcmiscproto >= 1.2.0"
@@ -2458,7 +2458,6 @@ if test "x$XWAYLAND" = xyes; then
XWAYLAND_SYS_LIBS="$XWAYLANDMODULES_LIBS $GLX_SYS_LIBS"
AC_SUBST([XWAYLAND_LIBS])
AC_SUBST([XWAYLAND_SYS_LIBS])
- WAYLAND_SCANNER_RULES(['$(top_srcdir)/hw/xwayland'])
fi
diff --git a/xorg-server/dix/dixfonts.c b/xorg-server/dix/dixfonts.c
index 83d2539c7..1c6442c8f 100644
--- a/xorg-server/dix/dixfonts.c
+++ b/xorg-server/dix/dixfonts.c
@@ -1658,7 +1658,7 @@ SetFontPathElements(int npaths, unsigned char *paths, int *bad, Bool persist)
err = (*fpe_functions[fpe->type].init_fpe) (fpe);
if (err != Successful) {
if (persist) {
- ErrorF
+ DebugF
("[dix] Could not init font path element %s, removing from list!\n",
fpe->name);
}
diff --git a/xorg-server/dix/dixutils.c b/xorg-server/dix/dixutils.c
index 5de74c8b4..cdd370bd6 100644
--- a/xorg-server/dix/dixutils.c
+++ b/xorg-server/dix/dixutils.c
@@ -866,3 +866,28 @@ InitCallbackManager(void)
{
DeleteCallbackManager();
}
+
+/**
+ * Coordinates the global GL context used by modules in the X Server
+ * doing rendering with OpenGL.
+ *
+ * When setting a GL context (glXMakeCurrent() or eglMakeCurrent()),
+ * there is an expensive implied glFlush() required by the GLX and EGL
+ * APIs, so modules don't want to have to do it on every request. But
+ * the individual modules using GL also don't know about each other,
+ * so they have to coordinate who owns the current context.
+ *
+ * When you're about to do a MakeCurrent, you should set this variable
+ * to your context's address, and you can skip MakeCurrent if it's
+ * already set to yours.
+ *
+ * When you're about to do a DestroyContext, you should set this to
+ * NULL if it's set to your context.
+ *
+ * When you're about to do an unbindContext on a DRI driver, you
+ * should set this to NULL. Despite the unbindContext interface
+ * sounding like it only unbinds the passed in context, it actually
+ * unconditionally clears the dispatch table even if the given
+ * context wasn't current.
+ */
+void *lastGLContext = NULL;
diff --git a/xorg-server/fb/fbpict.c b/xorg-server/fb/fbpict.c
index c2ee8a552..21baf8950 100644
--- a/xorg-server/fb/fbpict.c
+++ b/xorg-server/fb/fbpict.c
@@ -191,7 +191,7 @@ fbGlyphs(CARD8 op,
pixman_glyph_get_extents(glyphCache, n_glyphs, pglyphs, &extents);
pixman_composite_glyphs(op, srcImage, dstImage, format,
- xSrc + srcXoff + xDst, ySrc + srcYoff + yDst,
+ xSrc + srcXoff + extents.x1 - xDst, ySrc + srcYoff + extents.y1 - yDst,
extents.x1, extents.y1,
extents.x1 + dstXoff, extents.y1 + dstYoff,
extents.x2 - extents.x1,
diff --git a/xorg-server/glamor/Makefile.am b/xorg-server/glamor/Makefile.am
index 4d0cc8138..bde58b632 100644
--- a/xorg-server/glamor/Makefile.am
+++ b/xorg-server/glamor/Makefile.am
@@ -13,25 +13,27 @@ libglamor_la_SOURCES = \
glamor_debug.h \
glamor_fill.c \
glamor_font.c \
+ glamor_font.h \
glamor_glx.c \
glamor_glyphs.c \
glamor_polylines.c \
- glamor_putimage.c \
glamor_segment.c \
+ glamor_image.c \
glamor_render.c \
glamor_gradient.c \
glamor_program.c \
+ glamor_program.h \
glamor_rects.c \
glamor_spans.c \
glamor_text.c \
glamor_transfer.c \
glamor_transfer.h \
glamor_transform.c \
+ glamor_transform.h \
glamor_trapezoid.c \
glamor_tile.c \
glamor_triangles.c\
glamor_addtraps.c\
- glamor_getimage.c\
glamor_copyplane.c\
glamor_glyphblt.c\
glamor_points.c\
diff --git a/xorg-server/glamor/glamor.c b/xorg-server/glamor/glamor.c
index 2c2d9760c..08f6ba174 100644
--- a/xorg-server/glamor/glamor.c
+++ b/xorg-server/glamor/glamor.c
@@ -146,7 +146,7 @@ glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
glamor_pixmap_type_t type = GLAMOR_TEXTURE_ONLY;
glamor_pixmap_private *pixmap_priv;
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
- glamor_pixmap_fbo *fbo;
+ glamor_pixmap_fbo *fbo = NULL;
int pitch;
GLenum format;
@@ -199,13 +199,12 @@ glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
pixmap_priv->base.box.x2 = w;
pixmap_priv->base.box.y2 = h;
fbo = glamor_create_fbo(glamor_priv, w, h, format, usage);
- }
- else {
- DEBUGF("Create LARGE pixmap %p width %d height %d\n", pixmap, w, h);
+ } else {
+ int tile_size = glamor_priv->max_fbo_size;
+ DEBUGF("Create LARGE pixmap %p width %d height %d, tile size %d\n", pixmap, w, h, tile_size);
pixmap_priv->type = GLAMOR_TEXTURE_LARGE;
fbo = glamor_create_fbo_array(glamor_priv, w, h, format, usage,
- glamor_priv->max_fbo_size,
- glamor_priv->max_fbo_size, pixmap_priv);
+ tile_size, tile_size, pixmap_priv);
}
if (fbo == NULL) {
@@ -248,11 +247,10 @@ glamor_block_handler(ScreenPtr screen)
{
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
glamor_priv->tick++;
glFlush();
glamor_fbo_expire(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;
@@ -265,9 +263,8 @@ _glamor_block_handler(void *data, OSTimePtr timeout, void *last_select_mask)
{
glamor_screen_private *glamor_priv = data;
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
glFlush();
- glamor_put_context(glamor_priv);
}
static void
@@ -509,7 +506,6 @@ glamor_init(ScreenPtr screen, unsigned int flags)
#ifdef GLAMOR_TRAPEZOID_SHADER
glamor_init_trapezoid_shader(screen);
#endif
- glamor_init_putimage_shaders(screen);
glamor_init_finish_access_shaders(screen);
#ifdef GLAMOR_GRADIENT_SHADER
glamor_init_gradient_shader(screen);
@@ -543,7 +539,6 @@ glamor_release_screen_priv(ScreenPtr screen)
#ifdef GLAMOR_TRAPEZOID_SHADER
glamor_fini_trapezoid_shader(screen);
#endif
- glamor_fini_putimage_shaders(screen);
glamor_fini_finish_access_shaders(screen);
#ifdef GLAMOR_GRADIENT_SHADER
glamor_fini_gradient_shader(screen);
@@ -662,7 +657,8 @@ glamor_fd_from_pixmap(ScreenPtr screen,
switch (pixmap_priv->type) {
case GLAMOR_TEXTURE_DRM:
case GLAMOR_TEXTURE_ONLY:
- glamor_pixmap_ensure_fbo(pixmap, GL_RGBA, 0);
+ if (!glamor_pixmap_ensure_fbo(pixmap, GL_RGBA, 0))
+ return -1;
return glamor_egl_dri3_fd_name_from_tex(screen,
pixmap,
pixmap_priv->base.fbo->tex,
@@ -686,7 +682,8 @@ glamor_name_from_pixmap(PixmapPtr pixmap, CARD16 *stride, CARD32 *size)
switch (pixmap_priv->type) {
case GLAMOR_TEXTURE_DRM:
case GLAMOR_TEXTURE_ONLY:
- glamor_pixmap_ensure_fbo(pixmap, GL_RGBA, 0);
+ if (!glamor_pixmap_ensure_fbo(pixmap, GL_RGBA, 0))
+ return -1;
return glamor_egl_dri3_fd_name_from_tex(pixmap->drawable.pScreen,
pixmap,
pixmap_priv->base.fbo->tex,
diff --git a/xorg-server/glamor/glamor_context.h b/xorg-server/glamor/glamor_context.h
index 8781afc48..47b87e620 100644
--- a/xorg-server/glamor/glamor_context.h
+++ b/xorg-server/glamor/glamor_context.h
@@ -43,14 +43,7 @@ struct glamor_context {
/** 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);
+ void (*make_current)(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 996611c6c..e1988225f 100644
--- a/xorg-server/glamor/glamor_copyarea.c
+++ b/xorg-server/glamor/glamor_copyarea.c
@@ -70,7 +70,7 @@ 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);
- glamor_get_context(glamor_priv);
+ glamor_make_current(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);
@@ -112,7 +112,6 @@ glamor_copy_n_to_n_fbo_blit(DrawablePtr src,
GL_COLOR_BUFFER_BIT, GL_NEAREST);
}
}
- glamor_put_context(glamor_priv);
glamor_priv->state = BLIT_STATE;
return TRUE;
}
@@ -155,7 +154,7 @@ glamor_copy_n_to_n_textured(DrawablePtr src,
glamor_get_drawable_deltas(dst, dst_pixmap, &dst_x_off, &dst_y_off);
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
glamor_set_destination_pixmap_priv_nc(dst_pixmap_priv);
glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT,
@@ -206,7 +205,6 @@ glamor_copy_n_to_n_textured(DrawablePtr src,
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
/* The source texture is bound to a fbo, we have to flush it here. */
- glamor_put_context(glamor_priv);
glamor_priv->state = RENDER_STATE;
glamor_priv->render_idle_cnt = 0;
return TRUE;
@@ -367,12 +365,10 @@ _glamor_copy_n_to_n(DrawablePtr src,
if (gc) {
if (!glamor_set_planemask(dst_pixmap, gc->planemask))
goto fall_back;
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
if (!glamor_set_alu(screen, gc->alu)) {
- glamor_put_context(glamor_priv);
- goto fail;
+ goto fail_noregion;
}
- glamor_put_context(glamor_priv);
}
if (!src_pixmap_priv) {
@@ -537,7 +533,6 @@ _glamor_copy_n_to_n(DrawablePtr src,
if (n_dst_region == 0)
ok = TRUE;
free(clipped_dst_regions);
- RegionUninit(&region);
}
else {
ok = __glamor_copy_n_to_n(src, dst, gc, box, nbox, dx, dy,
@@ -545,9 +540,10 @@ _glamor_copy_n_to_n(DrawablePtr src,
}
fail:
- glamor_get_context(glamor_priv);
+ RegionUninit(&region);
+ fail_noregion:
+ glamor_make_current(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 7b1615d2d..b34943761 100644
--- a/xorg-server/glamor/glamor_core.c
+++ b/xorg-server/glamor/glamor_core.c
@@ -127,7 +127,7 @@ glamor_prepare_access(DrawablePtr drawable, glamor_access_t access)
*/
assert(!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv) ||
access == GLAMOR_ACCESS_RO ||
- pixmap_priv->base.mapped_for_write);
+ pixmap_priv->base.map_access == GLAMOR_ACCESS_RW);
return TRUE;
}
pixmap_priv->base.map_access = access;
@@ -241,7 +241,7 @@ glamor_init_finish_access_shaders(ScreenPtr screen)
char *source;
glamor_priv = glamor_get_screen_private(screen);
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
glamor_priv->finish_access_prog[0] = glCreateProgram();
glamor_priv->finish_access_prog[1] = glCreateProgram();
@@ -300,7 +300,6 @@ glamor_init_finish_access_shaders(ScreenPtr screen)
glUniform1i(glamor_priv->finish_access_revert[1], 0);
glUniform1i(sampler_uniform_location, 0);
glUniform1i(glamor_priv->finish_access_swap_rb[1], 0);
- glamor_put_context(glamor_priv);
}
void
@@ -309,10 +308,9 @@ glamor_fini_finish_access_shaders(ScreenPtr screen)
glamor_screen_private *glamor_priv;
glamor_priv = glamor_get_screen_private(screen);
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
glDeleteProgram(glamor_priv->finish_access_prog[0]);
glDeleteProgram(glamor_priv->finish_access_prog[1]);
- glamor_put_context(glamor_priv);
}
void
@@ -341,11 +339,10 @@ glamor_finish_access(DrawablePtr drawable)
if (pixmap_priv->base.fbo->pbo != 0 && pixmap_priv->base.fbo->pbo_valid) {
assert(glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP);
- glamor_get_context(glamor_priv);
+ glamor_make_current(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 d37de9b95..54af2753e 100644
--- a/xorg-server/glamor/glamor_egl.c
+++ b/xorg-server/glamor/glamor_egl.c
@@ -95,30 +95,22 @@ glamor_egl_get_screen_private(ScrnInfoPtr scrn)
}
static void
-glamor_egl_get_context(struct glamor_context *glamor_ctx)
+glamor_egl_make_current(struct glamor_context *glamor_ctx)
{
- if (glamor_ctx->get_count++)
- return;
-
- if (glamor_ctx->ctx != eglGetCurrentContext()) {
- 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 void
-glamor_egl_put_context(struct glamor_context *glamor_ctx)
-{
- if (--glamor_ctx->get_count)
- return;
-
+ /* There's only a single global dispatch table in Mesa. EGL, GLX,
+ * and AIGLX's direct dispatch table manipulation don't talk to
+ * each other. We need to set the context to NULL first to avoid
+ * EGL's no-op context change fast path when switching back to
+ * EGL.
+ */
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 EGLImageKHR
@@ -166,10 +158,14 @@ glamor_get_flink_name(int fd, int handle, int *name)
}
static Bool
-glamor_create_texture_from_image(struct glamor_egl_screen_private
- *glamor_egl,
+glamor_create_texture_from_image(ScreenPtr screen,
EGLImageKHR image, GLuint * texture)
{
+ struct glamor_screen_private *glamor_priv =
+ glamor_get_screen_private(screen);
+
+ glamor_make_current(glamor_priv);
+
glGenTextures(1, texture);
glBindTexture(GL_TEXTURE_2D, *texture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
@@ -177,6 +173,7 @@ glamor_create_texture_from_image(struct glamor_egl_screen_private
glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, image);
glBindTexture(GL_TEXTURE_2D, 0);
+
return TRUE;
}
@@ -211,7 +208,7 @@ glamor_egl_create_argb8888_based_texture(ScreenPtr screen, int w, int h)
gbm_bo_destroy(bo);
if (image == EGL_NO_IMAGE_KHR)
return 0;
- glamor_create_texture_from_image(glamor_egl, image, &texture);
+ glamor_create_texture_from_image(screen, image, &texture);
eglDestroyImageKHR(glamor_egl->display, image);
return texture;
@@ -289,7 +286,7 @@ glamor_egl_create_textured_pixmap(PixmapPtr pixmap, int handle, int stride)
glamor_egl = glamor_egl_get_screen_private(scrn);
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
if (glamor_egl->has_gem) {
if (!glamor_get_flink_name(glamor_egl->fd, handle, &name)) {
xf86DrvMsg(scrn->scrnIndex, X_ERROR,
@@ -312,14 +309,13 @@ glamor_egl_create_textured_pixmap(PixmapPtr pixmap, int handle, int stride)
glamor_set_pixmap_type(pixmap, GLAMOR_DRM_ONLY);
goto done;
}
- glamor_create_texture_from_image(glamor_egl, image, &texture);
+ glamor_create_texture_from_image(screen, image, &texture);
glamor_set_pixmap_type(pixmap, GLAMOR_TEXTURE_DRM);
glamor_set_pixmap_texture(pixmap, texture);
pixmap_priv->base.image = image;
ret = TRUE;
done:
- glamor_put_context(glamor_priv);
return ret;
}
@@ -339,7 +335,7 @@ glamor_egl_create_textured_pixmap_from_gbm_bo(PixmapPtr pixmap, void *bo)
glamor_egl = glamor_egl_get_screen_private(scrn);
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
image = eglCreateImageKHR(glamor_egl->display,
glamor_egl->context,
@@ -348,14 +344,13 @@ glamor_egl_create_textured_pixmap_from_gbm_bo(PixmapPtr pixmap, void *bo)
glamor_set_pixmap_type(pixmap, GLAMOR_DRM_ONLY);
goto done;
}
- glamor_create_texture_from_image(glamor_egl, image, &texture);
+ glamor_create_texture_from_image(screen, image, &texture);
glamor_set_pixmap_type(pixmap, GLAMOR_TEXTURE_DRM);
glamor_set_pixmap_texture(pixmap, texture);
pixmap_priv->base.image = image;
ret = TRUE;
done:
- glamor_put_context(glamor_priv);
return ret;
}
@@ -413,7 +408,7 @@ glamor_egl_dri3_fd_name_from_tex(ScreenPtr screen,
glamor_egl = glamor_egl_get_screen_private(scrn);
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
image = pixmap_priv->base.image;
if (!image) {
@@ -448,7 +443,6 @@ glamor_egl_dri3_fd_name_from_tex(ScreenPtr screen,
gbm_bo_destroy(bo);
failure:
- glamor_put_context(glamor_priv);
return fd;
#else
return -1;
@@ -678,8 +672,7 @@ glamor_egl_screen_init(ScreenPtr screen, struct glamor_context *glamor_ctx)
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;
+ glamor_ctx->make_current = glamor_egl_make_current;
if (glamor_egl->dri3_capable) {
/* Tell the core that we have the interfaces for import/export
diff --git a/xorg-server/glamor/glamor_fbo.c b/xorg-server/glamor/glamor_fbo.c
index 4f6da67fb..552168381 100644
--- a/xorg-server/glamor/glamor_fbo.c
+++ b/xorg-server/glamor/glamor_fbo.c
@@ -129,7 +129,7 @@ glamor_pixmap_fbo_cache_get(glamor_screen_private *glamor_priv,
void
glamor_purge_fbo(glamor_pixmap_fbo *fbo)
{
- glamor_get_context(fbo->glamor_priv);
+ glamor_make_current(fbo->glamor_priv);
if (fbo->fb)
glDeleteFramebuffers(1, &fbo->fb);
@@ -137,7 +137,6 @@ glamor_purge_fbo(glamor_pixmap_fbo *fbo)
glDeleteTextures(1, &fbo->tex);
if (fbo->pbo)
glDeleteBuffers(1, &fbo->pbo);
- glamor_put_context(fbo->glamor_priv);
free(fbo);
}
@@ -175,12 +174,12 @@ glamor_pixmap_fbo_cache_put(glamor_pixmap_fbo *fbo)
#endif
}
-static void
+static int
glamor_pixmap_ensure_fb(glamor_pixmap_fbo *fbo)
{
- int status;
+ int status, err = 0;
- glamor_get_context(fbo->glamor_priv);
+ glamor_make_current(fbo->glamor_priv);
if (fbo->fb == 0)
glGenFramebuffers(1, &fbo->fb);
@@ -216,10 +215,11 @@ glamor_pixmap_ensure_fb(glamor_pixmap_fbo *fbo)
break;
}
- FatalError("destination is framebuffer incomplete: %s [%x]\n",
- str, status);
+ glamor_fallback("glamor: Failed to create fbo, %s\n", str);
+ err = -1;
}
- glamor_put_context(fbo->glamor_priv);
+
+ return err;
}
glamor_pixmap_fbo *
@@ -241,14 +241,17 @@ glamor_create_fbo_from_tex(glamor_screen_private *glamor_priv,
fbo->glamor_priv = glamor_priv;
if (flag == GLAMOR_CREATE_PIXMAP_MAP) {
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
glGenBuffers(1, &fbo->pbo);
- glamor_put_context(glamor_priv);
goto done;
}
- if (flag != GLAMOR_CREATE_FBO_NO_FBO)
- glamor_pixmap_ensure_fb(fbo);
+ if (flag != GLAMOR_CREATE_FBO_NO_FBO) {
+ if (glamor_pixmap_ensure_fb(fbo) != 0) {
+ glamor_purge_fbo(fbo);
+ fbo = NULL;
+ }
+ }
done:
return fbo;
@@ -341,14 +344,13 @@ _glamor_create_tex(glamor_screen_private *glamor_priv,
w, h);
}
if (!tex) {
- glamor_get_context(glamor_priv);
+ glamor_make_current(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;
}
@@ -367,10 +369,11 @@ glamor_create_fbo(glamor_screen_private *glamor_priv,
if (flag == GLAMOR_CREATE_PIXMAP_MAP)
goto no_tex;
- if (flag == GLAMOR_CREATE_PIXMAP_FIXUP)
- cache_flag = GLAMOR_CACHE_EXACT_SIZE;
- else
- cache_flag = 0;
+ /* Tiling from textures requires exact pixmap sizes. As we don't
+ * know which pixmaps will be used as tiles, just allocate
+ * everything at the requested size
+ */
+ cache_flag = GLAMOR_CACHE_EXACT_SIZE;
fbo = glamor_pixmap_fbo_cache_get(glamor_priv, w, h, format, cache_flag);
if (fbo)
@@ -565,7 +568,8 @@ glamor_pixmap_ensure_fbo(PixmapPtr pixmap, GLenum format, int flag)
pixmap->drawable.height, format);
if (flag != GLAMOR_CREATE_FBO_NO_FBO && pixmap_priv->base.fbo->fb == 0)
- glamor_pixmap_ensure_fb(pixmap_priv->base.fbo);
+ if (glamor_pixmap_ensure_fb(pixmap_priv->base.fbo) != 0)
+ return FALSE;
}
return TRUE;
diff --git a/xorg-server/glamor/glamor_fill.c b/xorg-server/glamor/glamor_fill.c
index 2fa726e72..073904d2a 100644
--- a/xorg-server/glamor/glamor_fill.c
+++ b/xorg-server/glamor/glamor_fill.c
@@ -156,7 +156,7 @@ glamor_init_solid_shader(ScreenPtr screen)
GLint fs_prog, vs_prog;
glamor_priv = glamor_get_screen_private(screen);
- glamor_get_context(glamor_priv);
+ glamor_make_current(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);
@@ -169,7 +169,6 @@ glamor_init_solid_shader(ScreenPtr screen)
glamor_priv->solid_color_uniform_location =
glGetUniformLocation(glamor_priv->solid_prog, "color");
- glamor_put_context(glamor_priv);
}
void
@@ -178,9 +177,8 @@ glamor_fini_solid_shader(ScreenPtr screen)
glamor_screen_private *glamor_priv;
glamor_priv = glamor_get_screen_private(screen);
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
glDeleteProgram(glamor_priv->solid_prog);
- glamor_put_context(glamor_priv);
}
static void
@@ -196,7 +194,7 @@ _glamor_solid_boxes(PixmapPtr pixmap, BoxPtr box, int nbox, float *color)
glamor_set_destination_pixmap_priv_nc(pixmap_priv);
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
glUseProgram(glamor_priv->solid_prog);
glUniform4fv(glamor_priv->solid_color_uniform_location, 1, color);
@@ -255,7 +253,6 @@ _glamor_solid_boxes(PixmapPtr pixmap, BoxPtr box, int nbox, float *color)
free(vertices);
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
- glamor_put_context(glamor_priv);
glamor_priv->state = RENDER_STATE;
glamor_priv->render_idle_cnt = 0;
}
@@ -338,13 +335,12 @@ glamor_solid(PixmapPtr pixmap, int x, int y, int width, int height,
return FALSE;
}
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
if (!glamor_set_alu(screen, alu)) {
if (alu == GXclear)
fg_pixel = 0;
else {
glamor_fallback("unsupported alu %x\n", alu);
- glamor_put_context(glamor_priv);
return FALSE;
}
}
@@ -355,7 +351,6 @@ glamor_solid(PixmapPtr pixmap, int x, int y, int width, int height,
glamor_solid_boxes(pixmap, &box, 1, fg_pixel);
glamor_set_alu(screen, GXcopy);
- glamor_put_context(glamor_priv);
return TRUE;
}
diff --git a/xorg-server/glamor/glamor_font.c b/xorg-server/glamor/glamor_font.c
index 47dfe2a69..f747d59a1 100644
--- a/xorg-server/glamor/glamor_font.c
+++ b/xorg-server/glamor/glamor_font.c
@@ -89,7 +89,7 @@ glamor_font_get(ScreenPtr screen, FontPtr font)
glamor_font->default_col = font->info.defaultCh;
glamor_priv = glamor_get_screen_private(screen);
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
glGenTextures(1, &glamor_font->texture_id);
glActiveTexture(GL_TEXTURE0);
@@ -119,8 +119,6 @@ glamor_font_get(ScreenPtr screen, FontPtr font)
}
}
- glamor_put_context(glamor_priv);
-
return glamor_font;
}
@@ -150,9 +148,8 @@ glamor_unrealize_font(ScreenPtr screen, FontPtr font)
glamor_font->realized = FALSE;
glamor_priv = glamor_get_screen_private(screen);
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
glDeleteTextures(1, &glamor_font->texture_id);
- glamor_put_context(glamor_priv);
/* Check to see if all of the screens are done with this font
* and free the private when that happens
diff --git a/xorg-server/glamor/glamor_getimage.c b/xorg-server/glamor/glamor_getimage.c
deleted file mode 100644
index a932473e8..000000000
--- a/xorg-server/glamor/glamor_getimage.c
+++ /dev/null
@@ -1,96 +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"
-
-static Bool
-_glamor_get_image(DrawablePtr drawable, int x, int y, int w, int h,
- unsigned int format, unsigned long planeMask, char *d,
- Bool fallback)
-{
- PixmapPtr pixmap, sub_pixmap;
- struct glamor_pixmap_private *pixmap_priv;
- int x_off, y_off;
- int stride;
- void *data;
-
- pixmap = glamor_get_drawable_pixmap(drawable);
- glamor_get_drawable_deltas(drawable, pixmap, &x_off, &y_off);
-
- if (format != ZPixmap)
- goto fall_back;
-
- if (!glamor_set_planemask(pixmap, planeMask)) {
- glamor_fallback("Failedto set planemask in glamor_solid.\n");
- goto fall_back;
- }
- pixmap_priv = glamor_get_pixmap_private(pixmap);
-
- if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
- goto fall_back;
- stride = PixmapBytePad(w, drawable->depth);
-
- x += drawable->x + x_off;
- y += drawable->y + y_off;
-
- data = glamor_download_sub_pixmap_to_cpu(pixmap, x, y, w, h, stride,
- d, 0, GLAMOR_ACCESS_RO);
- if (data != NULL) {
- assert(data == d);
- return TRUE;
- }
- fall_back:
- sub_pixmap = glamor_get_sub_pixmap(pixmap, x + x_off + drawable->x,
- y + y_off + drawable->y, w, h,
- GLAMOR_ACCESS_RO);
- if (sub_pixmap) {
- fbGetImage(&sub_pixmap->drawable, 0, 0, w, h, format, planeMask, d);
- glamor_put_sub_pixmap(sub_pixmap, pixmap,
- x + x_off + drawable->x,
- y + y_off + drawable->y, w, h, GLAMOR_ACCESS_RO);
- }
- else
- miGetImage(drawable, x, y, w, h, format, planeMask, d);
-
- return TRUE;
-}
-
-void
-glamor_get_image(DrawablePtr pDrawable, int x, int y, int w, int h,
- unsigned int format, unsigned long planeMask, char *d)
-{
- _glamor_get_image(pDrawable, x, y, w, h, format, planeMask, d, TRUE);
-}
-
-Bool
-glamor_get_image_nf(DrawablePtr pDrawable, int x, int y, int w, int h,
- unsigned int format, unsigned long planeMask, char *d)
-{
- return _glamor_get_image(pDrawable, x, y, w,
- h, format, planeMask, d, FALSE);
-}
diff --git a/xorg-server/glamor/glamor_glx.c b/xorg-server/glamor/glamor_glx.c
index 8f47c3d2c..7107c7c17 100644
--- a/xorg-server/glamor/glamor_glx.c
+++ b/xorg-server/glamor/glamor_glx.c
@@ -34,28 +34,21 @@
*/
static void
-glamor_glx_get_context(struct glamor_context *glamor_ctx)
+glamor_glx_make_current(struct glamor_context *glamor_ctx)
{
- GLXContext old_ctx;
-
- if (glamor_ctx->get_count++)
- return;
-
- old_ctx = glXGetCurrentContext();
- if (old_ctx == glamor_ctx->ctx)
- return;
+ /* There's only a single global dispatch table in Mesa. EGL, GLX,
+ * and AIGLX's direct dispatch table manipulation don't talk to
+ * each other. We need to set the context to NULL first to avoid
+ * GLX's no-op context change fast path when switching back to
+ * GLX.
+ */
+ glXMakeCurrent(glamor_ctx->display, None, None);
glXMakeCurrent(glamor_ctx->display, glamor_ctx->drawable_xid,
glamor_ctx->ctx);
}
-static void
-glamor_glx_put_context(struct glamor_context *glamor_ctx)
-{
- --glamor_ctx->get_count;
-}
-
Bool
glamor_glx_screen_init(struct glamor_context *glamor_ctx)
{
@@ -69,8 +62,7 @@ glamor_glx_screen_init(struct glamor_context *glamor_ctx)
glamor_ctx->drawable_xid = glXGetCurrentDrawable();
- glamor_ctx->get_context = glamor_glx_get_context;
- glamor_ctx->put_context = glamor_glx_put_context;
+ glamor_ctx->make_current = glamor_glx_make_current;
return True;
}
diff --git a/xorg-server/glamor/glamor_glyphblt.c b/xorg-server/glamor/glamor_glyphblt.c
index c031747f7..1c511ff2b 100644
--- a/xorg-server/glamor/glamor_glyphblt.c
+++ b/xorg-server/glamor/glamor_glyphblt.c
@@ -54,7 +54,7 @@ glamor_poly_glyph_blt_gl(DrawablePtr drawable, GCPtr gc,
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
goto bail;
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
prog = glamor_use_program_fill(pixmap, gc, &glamor_priv->poly_glyph_blt_progs,
&glamor_facet_poly_glyph_blt);
@@ -137,11 +137,9 @@ glamor_poly_glyph_blt_gl(DrawablePtr drawable, GCPtr gc,
glDisable(GL_COLOR_LOGIC_OP);
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
- glamor_put_context(glamor_priv);
return TRUE;
bail_ctx:
glDisable(GL_COLOR_LOGIC_OP);
- glamor_put_context(glamor_priv);
bail:
return FALSE;
}
@@ -212,20 +210,18 @@ glamor_push_pixels_points(GCPtr gc, PixmapPtr bitmap,
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
return FALSE;
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
if (!glamor_set_alu(screen, gc->alu)) {
if (gc->alu == GXclear)
fg_pixel = 0;
else {
glamor_fallback("unsupported alu %x\n", gc->alu);
- glamor_put_context(glamor_priv);
return FALSE;
}
}
if (!glamor_set_planemask(pixmap, gc->planemask)) {
glamor_fallback("Failed to set planemask in %s.\n", __FUNCTION__);
- glamor_put_context(glamor_priv);
return FALSE;
}
@@ -281,8 +277,6 @@ glamor_push_pixels_points(GCPtr gc, PixmapPtr bitmap,
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
- glamor_put_context(glamor_priv);
-
return TRUE;
}
diff --git a/xorg-server/glamor/glamor_glyphs.c b/xorg-server/glamor/glamor_glyphs.c
index a04ae8261..42f5f65f6 100644
--- a/xorg-server/glamor/glamor_glyphs.c
+++ b/xorg-server/glamor/glamor_glyphs.c
@@ -1285,9 +1285,8 @@ glamor_buffer_glyph(glamor_screen_private *glamor_priv,
* 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.*/
- glamor_get_context(glamor_priv);
+ glamor_make_current(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 c24f3427f..28d66917f 100644
--- a/xorg-server/glamor/glamor_gradient.c
+++ b/xorg-server/glamor/glamor_gradient.c
@@ -324,7 +324,7 @@ _glamor_create_radial_gradient_program(ScreenPtr screen, int stops_count,
return;
}
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
if (dyn_gen && glamor_priv->gradient_prog[SHADER_GRADIENT_RADIAL][2]) {
glDeleteProgram(glamor_priv->gradient_prog[SHADER_GRADIENT_RADIAL][2]);
@@ -371,8 +371,6 @@ _glamor_create_radial_gradient_program(ScreenPtr screen, int stops_count,
}
glamor_priv->gradient_prog[SHADER_GRADIENT_RADIAL][index] = gradient_prog;
-
- glamor_put_context(glamor_priv);
}
static void
@@ -519,7 +517,7 @@ _glamor_create_linear_gradient_program(ScreenPtr screen, int stops_count,
return;
}
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
if (dyn_gen && 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;
@@ -562,8 +560,6 @@ _glamor_create_linear_gradient_program(ScreenPtr screen, int stops_count,
}
glamor_priv->gradient_prog[SHADER_GRADIENT_LINEAR][index] = gradient_prog;
-
- glamor_put_context(glamor_priv);
}
void
@@ -595,7 +591,7 @@ glamor_fini_gradient_shader(ScreenPtr screen)
int i = 0;
glamor_priv = glamor_get_screen_private(screen);
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
for (i = 0; i < 3; i++) {
/* Linear Gradient */
@@ -607,8 +603,6 @@ glamor_fini_gradient_shader(ScreenPtr screen)
glDeleteProgram(glamor_priv->gradient_prog
[SHADER_GRADIENT_RADIAL][i]);
}
-
- glamor_put_context(glamor_priv);
}
static void
@@ -739,7 +733,7 @@ _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]);
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT,
GL_FALSE, 0, vertices);
@@ -749,8 +743,6 @@ _glamor_gradient_set_pixmap_destination(ScreenPtr screen,
glEnableVertexAttribArray(GLAMOR_VERTEX_POS);
glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
- glamor_put_context(glamor_priv);
-
return 1;
}
@@ -892,7 +884,7 @@ glamor_generate_radial_gradient_picture(ScreenPtr screen,
GLint r2_uniform_location = 0;
glamor_priv = glamor_get_screen_private(screen);
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
/* Create a pixmap with VBO. */
pixmap = glamor_create_pixmap(screen,
@@ -1123,7 +1115,6 @@ glamor_generate_radial_gradient_picture(ScreenPtr screen,
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
- glamor_put_context(glamor_priv);
return dst_picture;
GRADIENT_FAIL:
@@ -1140,7 +1131,6 @@ glamor_generate_radial_gradient_picture(ScreenPtr screen,
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
- glamor_put_context(glamor_priv);
return NULL;
}
@@ -1204,7 +1194,7 @@ glamor_generate_linear_gradient_picture(ScreenPtr screen,
GLint pt_distance_uniform_location = 0;
glamor_priv = glamor_get_screen_private(screen);
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
/* Create a pixmap with VBO. */
pixmap = glamor_create_pixmap(screen,
@@ -1468,7 +1458,6 @@ glamor_generate_linear_gradient_picture(ScreenPtr screen,
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
- glamor_put_context(glamor_priv);
return dst_picture;
GRADIENT_FAIL:
@@ -1485,7 +1474,6 @@ glamor_generate_linear_gradient_picture(ScreenPtr screen,
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
- glamor_put_context(glamor_priv);
return NULL;
}
diff --git a/xorg-server/glamor/glamor_image.c b/xorg-server/glamor/glamor_image.c
new file mode 100644
index 000000000..4791d089f
--- /dev/null
+++ b/xorg-server/glamor/glamor_image.c
@@ -0,0 +1,180 @@
+/*
+ * Copyright © 2014 Keith Packard
+ *
+ * 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 "glamor_priv.h"
+#include "glamor_transfer.h"
+#include "glamor_transform.h"
+
+/*
+ * PutImage. Only does ZPixmap right now as other formats are quite a bit harder
+ */
+
+static Bool
+glamor_put_image_gl(DrawablePtr drawable, GCPtr gc, int depth, int x, int y,
+ int w, int h, int leftPad, int format, char *bits)
+{
+ ScreenPtr screen = drawable->pScreen;
+ glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
+ PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
+ glamor_pixmap_private *pixmap_priv;
+ uint32_t byte_stride = PixmapBytePad(w, drawable->depth);
+ RegionRec region;
+ BoxRec box;
+ int off_x, off_y;
+
+ pixmap_priv = glamor_get_pixmap_private(pixmap);
+
+ if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
+ return FALSE;
+
+ if (gc->alu != GXcopy)
+ goto bail;
+
+ if (!glamor_pm_is_solid(&pixmap->drawable, gc->planemask))
+ goto bail;
+
+ if (format == XYPixmap && drawable->depth == 1 && leftPad == 0)
+ format = ZPixmap;
+
+ if (format != ZPixmap)
+ goto bail;
+
+ x += drawable->x;
+ y += drawable->y;
+ box.x1 = x;
+ box.y1 = y;
+ box.x2 = box.x1 + w;
+ box.y2 = box.y1 + h;
+ RegionInit(&region, &box, 1);
+ RegionIntersect(&region, &region, gc->pCompositeClip);
+
+ glamor_get_drawable_deltas(drawable, pixmap, &off_x, &off_y);
+ if (off_x || off_y) {
+ x += off_x;
+ y += off_y;
+ RegionTranslate(&region, off_x, off_y);
+ }
+
+ glamor_make_current(glamor_priv);
+
+ glamor_upload_region(pixmap, &region, x, y, (uint8_t *) bits, byte_stride);
+
+ RegionUninit(&region);
+ return TRUE;
+bail:
+ return FALSE;
+}
+
+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))
+ fbPutImage(drawable, gc, depth, x, y, w, h, leftPad, format, bits);
+ glamor_finish_access(drawable);
+}
+
+void
+glamor_put_image(DrawablePtr drawable, GCPtr gc, int depth, int x, int y,
+ int w, int h, int leftPad, int format, char *bits)
+{
+ if (glamor_put_image_gl(drawable, gc, depth, x, y, w, h, leftPad, format, bits))
+ return;
+ glamor_put_image_bail(drawable, gc, depth, x, y, w, h, leftPad, format, bits);
+}
+
+Bool
+glamor_put_image_nf(DrawablePtr drawable, GCPtr gc, int depth, int x, int y,
+ int w, int h, int leftPad, int format, char *bits)
+{
+ if (glamor_put_image_gl(drawable, gc, depth, x, y, w, h, leftPad, format, bits))
+ return TRUE;
+ if (glamor_ddx_fallback_check_pixmap(drawable) &&
+ glamor_ddx_fallback_check_gc(gc))
+ return FALSE;
+ glamor_put_image_bail(drawable, gc, depth, x, y, w, h, leftPad, format, bits);
+ return TRUE;
+}
+
+static Bool
+glamor_get_image_gl(DrawablePtr drawable, int x, int y, int w, int h,
+ unsigned int format, unsigned long plane_mask, char *d)
+{
+ PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
+ glamor_pixmap_private *pixmap_priv;
+ uint32_t byte_stride = PixmapBytePad(w, drawable->depth);
+ BoxRec box;
+ int off_x, off_y;
+
+ pixmap_priv = glamor_get_pixmap_private(pixmap);
+ if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
+ goto bail;
+
+ if (format != ZPixmap || !glamor_pm_is_solid(drawable, plane_mask))
+ goto bail;
+
+ glamor_get_drawable_deltas(drawable, pixmap, &off_x, &off_y);
+ box.x1 = x;
+ box.x2 = x + w;
+ box.y1 = y;
+ box.y2 = y + h;
+ glamor_download_boxes(pixmap, &box, 1,
+ drawable->x + off_x, drawable->y + off_y,
+ -x, -y,
+ (uint8_t *) d, byte_stride);
+ return TRUE;
+bail:
+ return FALSE;
+}
+
+static void
+glamor_get_image_bail(DrawablePtr drawable, int x, int y, int w, int h,
+ unsigned int format, unsigned long plane_mask, char *d)
+{
+ if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RO))
+ fbGetImage(drawable, x, y, w, h, format, plane_mask, d);
+ glamor_finish_access(drawable);
+}
+
+void
+glamor_get_image(DrawablePtr drawable, int x, int y, int w, int h,
+ unsigned int format, unsigned long plane_mask, char *d)
+{
+ if (glamor_get_image_gl(drawable, x, y, w, h, format, plane_mask, d))
+ return;
+ glamor_get_image_bail(drawable, x, y, w, h, format, plane_mask, d);
+}
+
+Bool
+glamor_get_image_nf(DrawablePtr drawable, int x, int y, int w, int h,
+ unsigned int format, unsigned long plane_mask, char *d)
+{
+ if (glamor_get_image_gl(drawable, x, y, w, h, format, plane_mask, d))
+ return TRUE;
+
+ if (glamor_ddx_fallback_check_pixmap(drawable))
+ return FALSE;
+
+ glamor_get_image_bail(drawable, x, y, w, h, format, plane_mask, d);
+ return TRUE;
+}
diff --git a/xorg-server/glamor/glamor_pixmap.c b/xorg-server/glamor/glamor_pixmap.c
index a811f6015..54b414bc2 100644
--- a/xorg-server/glamor/glamor_pixmap.c
+++ b/xorg-server/glamor/glamor_pixmap.c
@@ -66,12 +66,10 @@ void
glamor_set_destination_pixmap_fbo(glamor_pixmap_fbo *fbo, int x0, int y0,
int width, int height)
{
- glamor_get_context(fbo->glamor_priv);
+ glamor_make_current(fbo->glamor_priv);
glBindFramebuffer(GL_FRAMEBUFFER, fbo->fb);
glViewport(x0, y0, width, height);
-
- glamor_put_context(fbo->glamor_priv);
}
void
@@ -707,7 +705,7 @@ __glamor_upload_pixmap_to_texture(PixmapPtr pixmap, unsigned int *tex,
int non_sub = 0;
unsigned int iformat = 0;
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
if (*tex == 0) {
glGenTextures(1, tex);
if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP)
@@ -735,7 +733,6 @@ __glamor_upload_pixmap_to_texture(PixmapPtr pixmap, unsigned int *tex,
if (bits == NULL)
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
- glamor_put_context(glamor_priv);
}
static Bool
@@ -832,7 +829,7 @@ _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. */
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT,
GL_FALSE, 2 * sizeof(float), vertices);
glEnableVertexAttribArray(GLAMOR_VERTEX_POS);
@@ -859,8 +856,6 @@ _glamor_upload_bits_to_pixmap_texture(PixmapPtr pixmap, GLenum format,
glDeleteTextures(1, &tex);
glBindFramebuffer(GL_FRAMEBUFFER, 0);
- glamor_put_context(glamor_priv);
-
if (need_free_bits)
free(bits);
return TRUE;
@@ -1140,7 +1135,7 @@ glamor_es2_pixmap_read_prepare(PixmapPtr source, int x, int y, int w, int h,
if (temp_fbo == NULL)
return NULL;
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
temp_xscale = 1.0 / w;
temp_yscale = 1.0 / h;
@@ -1177,7 +1172,6 @@ glamor_es2_pixmap_read_prepare(PixmapPtr source, int x, int y, int w, int h,
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
- glamor_put_context(glamor_priv);
return temp_fbo;
}
@@ -1223,6 +1217,7 @@ _glamor_download_sub_pixmap_to_cpu(PixmapPtr pixmap, GLenum format,
assert(0);
}
+ glamor_make_current(glamor_priv);
glamor_set_destination_pixmap_priv_nc(pixmap_priv);
need_post_conversion = (revert > REVERT_NORMAL);
@@ -1255,7 +1250,6 @@ _glamor_download_sub_pixmap_to_cpu(PixmapPtr pixmap, GLenum format,
fbo_y_off = 0;
}
- glamor_get_context(glamor_priv);
glPixelStorei(GL_PACK_ALIGNMENT, 4);
if (glamor_priv->has_pack_invert || glamor_priv->yInverted) {
@@ -1286,7 +1280,7 @@ _glamor_download_sub_pixmap_to_cpu(PixmapPtr pixmap, GLenum format,
unsigned int temp_pbo;
int yy;
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
glGenBuffers(1, &temp_pbo);
glBindBuffer(GL_PIXEL_PACK_BUFFER, temp_pbo);
glBufferData(GL_PIXEL_PACK_BUFFER, stride * h, NULL, GL_STREAM_READ);
@@ -1301,7 +1295,6 @@ _glamor_download_sub_pixmap_to_cpu(PixmapPtr pixmap, GLenum format,
}
glBindFramebuffer(GL_FRAMEBUFFER, 0);
- glamor_put_context(glamor_priv);
if (need_post_conversion) {
/* As OpenGL desktop version never enters here.
@@ -1473,10 +1466,9 @@ glamor_download_pixmap_to_cpu(PixmapPtr pixmap, glamor_access_t access)
data = malloc(stride * pixmap->drawable.height);
}
else {
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
if (pixmap_priv->base.fbo->pbo == 0)
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_points.c b/xorg-server/glamor/glamor_points.c
index 0d58e555f..d4525e294 100644
--- a/xorg-server/glamor/glamor_points.c
+++ b/xorg-server/glamor/glamor_points.c
@@ -52,7 +52,7 @@ glamor_poly_point_gl(DrawablePtr drawable, GCPtr gc, int mode, int npt, DDXPoint
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
goto bail;
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
if (prog->failed)
goto bail_ctx;
@@ -105,8 +105,6 @@ glamor_poly_point_gl(DrawablePtr drawable, GCPtr gc, int mode, int npt, DDXPoint
glDisable(GL_COLOR_LOGIC_OP);
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
- glamor_put_context(glamor_priv);
-
glamor_priv->state = RENDER_STATE;
glamor_priv->render_idle_cnt = 0;
@@ -114,7 +112,6 @@ glamor_poly_point_gl(DrawablePtr drawable, GCPtr gc, int mode, int npt, DDXPoint
bail_ctx:
glDisable(GL_COLOR_LOGIC_OP);
- glamor_put_context(glamor_priv);
bail:
return FALSE;
}
diff --git a/xorg-server/glamor/glamor_priv.h b/xorg-server/glamor/glamor_priv.h
index 0cafac4b5..a2a21fca0 100644
--- a/xorg-server/glamor/glamor_priv.h
+++ b/xorg-server/glamor/glamor_priv.h
@@ -277,11 +277,6 @@ typedef struct glamor_screen_private {
/* glamor trapezoid shader. */
GLint trapezoid_prog;
- /* glamor_putimage */
- GLint put_image_xybitmap_prog;
- GLint put_image_xybitmap_fg_uniform_location;
- GLint put_image_xybitmap_bg_uniform_location;
-
PixmapPtr *back_pixmap;
int screen_fbo;
struct glamor_saved_procs saved_procs;
@@ -704,12 +699,6 @@ void glamor_glyphs(CARD8 op,
void glamor_poly_lines(DrawablePtr drawable, GCPtr gc, int mode, int n,
DDXPointPtr points);
-/* glamor_putimage.c */
-void glamor_put_image(DrawablePtr drawable, GCPtr gc, int depth, int x, int y,
- int w, int h, int leftPad, int format, char *bits);
-void glamor_init_putimage_shaders(ScreenPtr screen);
-void glamor_fini_putimage_shaders(ScreenPtr screen);
-
/* glamor_render.c */
Bool glamor_composite_clipped_region(CARD8 op,
PicturePtr source,
@@ -951,9 +940,6 @@ Bool glamor_fixup_pixmap_priv(ScreenPtr screen,
void glamor_picture_format_fixup(PicturePtr picture,
glamor_pixmap_private *pixmap_priv);
-void glamor_get_image(DrawablePtr pDrawable, int x, int y, int w, int h,
- unsigned int format, unsigned long planeMask, char *d);
-
void glamor_add_traps(PicturePtr pPicture,
INT16 x_off, INT16 y_off, int ntrap, xTrap *traps);
@@ -994,6 +980,15 @@ void
glamor_poly_fill_rect(DrawablePtr drawable,
GCPtr gc, int nrect, xRectangle *prect);
+/* glamor_image.c */
+void
+glamor_put_image(DrawablePtr drawable, GCPtr gc, int depth, int x, int y,
+ int w, int h, int leftPad, int format, char *bits);
+
+void
+glamor_get_image(DrawablePtr pDrawable, int x, int y, int w, int h,
+ unsigned int format, unsigned long planeMask, char *d);
+
/* glamor_glyphblt.c */
void glamor_image_glyph_blt(DrawablePtr pDrawable, GCPtr pGC,
int x, int y, unsigned int nglyph,
diff --git a/xorg-server/glamor/glamor_putimage.c b/xorg-server/glamor/glamor_putimage.c
deleted file mode 100644
index cf7197bfc..000000000
--- a/xorg-server/glamor/glamor_putimage.c
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * Copyright © 2009 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:
- * Eric Anholt <eric@anholt.net>
- * Zhigang Gong <zhigang.gong@linux.intel.com>
- *
- */
-
-/** @file glamor_putaimge.c
- *
- * XPutImage implementation
- */
-#include "glamor_priv.h"
-
-void
-glamor_init_putimage_shaders(ScreenPtr screen)
-{
-}
-
-void
-glamor_fini_putimage_shaders(ScreenPtr screen)
-{
-}
-
-static Bool
-_glamor_put_image(DrawablePtr drawable, GCPtr gc, int depth, int x, int y,
- int w, int h, int left_pad, int image_format, char *bits,
- Bool fallback)
-{
- PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
- glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
- RegionPtr clip;
- int x_off, y_off;
- Bool ret = FALSE;
- PixmapPtr temp_pixmap, sub_pixmap;
- glamor_pixmap_private *temp_pixmap_priv;
- BoxRec box;
-
- glamor_get_drawable_deltas(drawable, pixmap, &x_off, &y_off);
- clip = fbGetCompositeClip(gc);
- if (image_format == XYBitmap) {
- assert(depth == 1);
- goto fail;
- }
-
- if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) {
- glamor_fallback("has no fbo.\n");
- goto fail;
- }
-
- if (image_format != ZPixmap) {
- glamor_fallback("non-ZPixmap\n");
- goto fail;
- }
-
- if (!glamor_set_planemask(pixmap, gc->planemask)) {
- goto fail;
- }
- /* create a temporary pixmap and upload the bits to that
- * pixmap, then apply clip copy it to the destination pixmap.*/
- box.x1 = x + drawable->x;
- box.y1 = y + drawable->y;
- box.x2 = x + w + drawable->x;
- box.y2 = y + h + drawable->y;
-
- if ((clip != NULL && RegionContainsRect(clip, &box) != rgnIN)
- || gc->alu != GXcopy) {
- temp_pixmap = glamor_create_pixmap(drawable->pScreen, w, h, depth, 0);
- if (temp_pixmap == NULL)
- goto fail;
-
- temp_pixmap_priv = glamor_get_pixmap_private(temp_pixmap);
-
- if (GLAMOR_PIXMAP_PRIV_IS_PICTURE(pixmap_priv)) {
- temp_pixmap_priv->base.picture = pixmap_priv->base.picture;
- temp_pixmap_priv->base.is_picture = pixmap_priv->base.is_picture;
- }
-
- glamor_upload_sub_pixmap_to_texture(temp_pixmap, 0, 0, w, h,
- pixmap->devKind, bits, 0);
-
- glamor_copy_area(&temp_pixmap->drawable, drawable, gc, 0, 0, w, h, x,
- y);
- glamor_destroy_pixmap(temp_pixmap);
- }
- else
- glamor_upload_sub_pixmap_to_texture(pixmap, x + drawable->x + x_off,
- y + drawable->y + y_off, w, h,
- PixmapBytePad(w, depth), bits, 0);
- ret = TRUE;
- goto done;
-
- fail:
- glamor_set_planemask(pixmap, ~0);
-
- if (!fallback && glamor_ddx_fallback_check_pixmap(&pixmap->drawable))
- goto done;
-
- glamor_fallback("to %p (%c)\n",
- drawable, glamor_get_drawable_location(drawable));
-
- sub_pixmap = glamor_get_sub_pixmap(pixmap, x + x_off + drawable->x,
- y + y_off + drawable->y, w, h,
- GLAMOR_ACCESS_RW);
- if (sub_pixmap) {
- if (clip != NULL)
- pixman_region_translate(clip, -x - drawable->x, -y - drawable->y);
-
- fbPutImage(&sub_pixmap->drawable, gc, depth, 0, 0, w, h,
- left_pad, image_format, bits);
-
- glamor_put_sub_pixmap(sub_pixmap, pixmap,
- x + x_off + drawable->x,
- y + y_off + drawable->y, w, h, GLAMOR_ACCESS_RW);
- if (clip != NULL)
- pixman_region_translate(clip, x + drawable->x, y + drawable->y);
- }
- else
- fbPutImage(drawable, gc, depth, x, y, w, h,
- left_pad, image_format, bits);
- ret = TRUE;
-
- done:
- return ret;
-}
-
-void
-glamor_put_image(DrawablePtr drawable, GCPtr gc, int depth, int x, int y,
- int w, int h, int left_pad, int image_format, char *bits)
-{
- _glamor_put_image(drawable, gc, depth, x, y, w, h,
- left_pad, image_format, bits, TRUE);
-}
-
-Bool
-glamor_put_image_nf(DrawablePtr drawable, GCPtr gc, int depth, int x, int y,
- int w, int h, int left_pad, int image_format, char *bits)
-{
- return _glamor_put_image(drawable, gc, depth, x, y, w, h,
- left_pad, image_format, bits, FALSE);
-}
diff --git a/xorg-server/glamor/glamor_rects.c b/xorg-server/glamor/glamor_rects.c
index 7731edec4..3a5c3f3f9 100644
--- a/xorg-server/glamor/glamor_rects.c
+++ b/xorg-server/glamor/glamor_rects.c
@@ -57,7 +57,7 @@ glamor_poly_fill_rect_gl(DrawablePtr drawable,
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
goto bail;
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
if (glamor_priv->glsl_version >= 130) {
prog = glamor_use_program_fill(pixmap, gc,
@@ -144,11 +144,9 @@ glamor_poly_fill_rect_gl(DrawablePtr drawable,
glVertexAttribDivisor(GLAMOR_VERTEX_POS, 0);
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
- glamor_put_context(glamor_priv);
return TRUE;
bail_ctx:
glDisable(GL_COLOR_LOGIC_OP);
- glamor_put_context(glamor_priv);
bail:
return FALSE;
}
diff --git a/xorg-server/glamor/glamor_render.c b/xorg-server/glamor/glamor_render.c
index cdf8effdc..5a7a23880 100644
--- a/xorg-server/glamor/glamor_render.c
+++ b/xorg-server/glamor/glamor_render.c
@@ -316,13 +316,13 @@ glamor_create_composite_shader(ScreenPtr screen, struct shader_key *key,
GLint source_sampler_uniform_location, mask_sampler_uniform_location;
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
vs = glamor_create_composite_vs(key);
if (vs == 0)
- goto out;
+ return;
fs = glamor_create_composite_fs(key);
if (fs == 0)
- goto out;
+ return;
prog = glCreateProgram();
glAttachShader(prog, vs);
@@ -363,9 +363,6 @@ glamor_create_composite_shader(ScreenPtr screen, struct shader_key *key,
glGetUniformLocation(prog, "mask_repeat_mode");
}
}
-
- out:
- glamor_put_context(glamor_priv);
}
static glamor_composite_shader *
@@ -406,7 +403,7 @@ glamor_init_composite_shaders(ScreenPtr screen)
int eb_size;
glamor_priv = glamor_get_screen_private(screen);
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
glGenBuffers(1, &glamor_priv->ebo);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, glamor_priv->ebo);
@@ -416,8 +413,6 @@ glamor_init_composite_shaders(ScreenPtr screen)
glamor_init_eb(eb, GLAMOR_COMPOSITE_VBO_VERT_CNT);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, eb_size, eb, GL_STATIC_DRAW);
free(eb);
-
- glamor_put_context(glamor_priv);
}
void
@@ -428,7 +423,7 @@ glamor_fini_composite_shaders(ScreenPtr screen)
int i, j, k;
glamor_priv = glamor_get_screen_private(screen);
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
glDeleteBuffers(1, &glamor_priv->ebo);
@@ -439,8 +434,6 @@ glamor_fini_composite_shaders(ScreenPtr screen)
if (shader->prog)
glDeleteProgram(shader->prog);
}
-
- glamor_put_context(glamor_priv);
}
static Bool
@@ -496,7 +489,7 @@ glamor_set_composite_texture(glamor_screen_private *glamor_priv, int unit,
float wh[4];
int repeat_type;
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
glActiveTexture(GL_TEXTURE0 + unit);
glBindTexture(GL_TEXTURE_2D, pixmap_priv->base.fbo->tex);
repeat_type = picture->repeatType;
@@ -564,7 +557,6 @@ glamor_set_composite_texture(glamor_screen_private *glamor_priv, int unit,
repeat_type -= RepeatFix;
}
glUniform1i(repeat_location, repeat_type);
- glamor_put_context(glamor_priv);
}
static void
@@ -685,7 +677,7 @@ glamor_setup_composite_vbo(ScreenPtr screen, int n_verts)
vert_size = n_verts * glamor_priv->vb_stride;
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
vb = glamor_get_vbo_space(screen, vert_size, &vbo_offset);
glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT, GL_FALSE,
@@ -707,7 +699,6 @@ glamor_setup_composite_vbo(ScreenPtr screen, int n_verts)
4 : 2) * sizeof(float));
glEnableVertexAttribArray(GLAMOR_VERTEX_MASK);
}
- glamor_put_context(glamor_priv);
return vb;
}
@@ -717,7 +708,7 @@ glamor_flush_composite_rects(ScreenPtr screen)
{
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
if (!glamor_priv->render_nr_verts)
return;
@@ -730,7 +721,6 @@ glamor_flush_composite_rects(ScreenPtr screen)
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] = {
@@ -880,7 +870,10 @@ glamor_composite_choose_shader(CARD8 op,
goto fail;
}
else {
- key.source = SHADER_SOURCE_TEXTURE_ALPHA;
+ if (PICT_FORMAT_A(source->format))
+ key.source = SHADER_SOURCE_TEXTURE_ALPHA;
+ else
+ key.source = SHADER_SOURCE_TEXTURE;
}
if (mask) {
@@ -1038,6 +1031,16 @@ glamor_composite_choose_shader(CARD8 op,
}
#endif
+ /* If the source and mask are two differently-formatted views of
+ * the same pixmap bits, and the pixmap was already uploaded (so
+ * the dynamic code above doesn't apply), then fall back to
+ * software. We should use texture views to fix this properly.
+ */
+ if (source_pixmap && source_pixmap == mask_pixmap &&
+ source->format != mask->format) {
+ goto fail;
+ }
+
/*Before enter the rendering stage, we need to fixup
* transformed source and mask, if the transform is not int translate. */
if (key.source != SHADER_SOURCE_SOLID
@@ -1102,7 +1105,7 @@ glamor_composite_set_shader_blend(glamor_pixmap_private *dest_priv,
glamor_priv = dest_priv->base.glamor_priv;
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
glUseProgram(shader->prog);
if (key->source == SHADER_SOURCE_SOLID) {
@@ -1136,8 +1139,6 @@ glamor_composite_set_shader_blend(glamor_pixmap_private *dest_priv,
glEnable(GL_BLEND);
glBlendFunc(op_info->source_blend, op_info->dest_blend);
}
-
- glamor_put_context(glamor_priv);
}
static Bool
@@ -1192,7 +1193,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);
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
glamor_priv->has_source_coords = key.source != SHADER_SOURCE_SOLID;
glamor_priv->has_mask_coords = (key.mask != SHADER_MASK_NONE &&
@@ -1318,7 +1319,6 @@ glamor_composite_with_shader(CARD8 op,
glamor_priv->render_idle_cnt = 0;
if (saved_source_format)
source->format = saved_source_format;
- glamor_put_context(glamor_priv);
ret = TRUE;
return ret;
@@ -1450,8 +1450,8 @@ glamor_composite_clipped_region(CARD8 op,
|| source_pixmap->drawable.height != height)))) {
temp_src =
glamor_convert_gradient_picture(screen, source,
- extent->x1 + x_source - x_dest,
- extent->y1 + y_source - y_dest,
+ x_source,
+ y_source,
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 = -extent->x1 + x_dest;
- y_temp_src = -extent->y1 + y_dest;
+ x_temp_src = 0;
+ y_temp_src = 0;
}
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,
- extent->x1 + x_mask - x_dest,
- extent->y1 + y_mask - y_dest,
+ x_mask,
+ y_mask,
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 = -extent->x1 + x_dest;
- y_temp_mask = -extent->y1 + y_dest;
+ x_temp_mask = 0;
+ y_temp_mask = 0;
}
/* Do two-pass PictOpOver componentAlpha, until we enable
* dual source color blending.
diff --git a/xorg-server/glamor/glamor_spans.c b/xorg-server/glamor/glamor_spans.c
index 98842cdde..46ba6c38f 100644
--- a/xorg-server/glamor/glamor_spans.c
+++ b/xorg-server/glamor/glamor_spans.c
@@ -61,7 +61,7 @@ glamor_fill_spans_gl(DrawablePtr drawable,
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
goto bail;
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
if (glamor_priv->glsl_version >= 130) {
prog = glamor_use_program_fill(pixmap, gc, &glamor_priv->fill_spans_program,
@@ -152,11 +152,9 @@ glamor_fill_spans_gl(DrawablePtr drawable,
glVertexAttribDivisor(GLAMOR_VERTEX_POS, 0);
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
- glamor_put_context(glamor_priv);
return TRUE;
bail_ctx:
glDisable(GL_COLOR_LOGIC_OP);
- glamor_put_context(glamor_priv);
bail:
return FALSE;
}
@@ -222,7 +220,7 @@ glamor_get_spans_gl(DrawablePtr drawable, int wmax,
glamor_format_for_pixmap(pixmap, &format, &type);
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
glamor_pixmap_loop(pixmap_priv, box_x, box_y) {
BoxPtr box = glamor_pixmap_box_at(pixmap_priv, box_x, box_y);
@@ -261,7 +259,6 @@ glamor_get_spans_gl(DrawablePtr drawable, int wmax,
}
}
- glamor_put_context(glamor_priv);
return TRUE;
bail:
return FALSE;
@@ -327,7 +324,7 @@ glamor_set_spans_gl(DrawablePtr drawable, GCPtr gc, char *src,
glamor_get_drawable_deltas(drawable, pixmap, &off_x, &off_y);
glamor_format_for_pixmap(pixmap, &format, &type);
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
@@ -397,7 +394,6 @@ glamor_set_spans_gl(DrawablePtr drawable, GCPtr gc, char *src,
}
}
- glamor_put_context(glamor_priv);
return TRUE;
bail:
diff --git a/xorg-server/glamor/glamor_text.c b/xorg-server/glamor/glamor_text.c
index 0e4b74c56..395116d5b 100644
--- a/xorg-server/glamor/glamor_text.c
+++ b/xorg-server/glamor/glamor_text.c
@@ -267,7 +267,7 @@ glamor_poly_text(DrawablePtr drawable, GCPtr gc,
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
goto bail;
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
prog = glamor_use_program_fill(pixmap, gc, &glamor_priv->poly_text_progs, &glamor_facet_poly_text);
@@ -279,8 +279,6 @@ glamor_poly_text(DrawablePtr drawable, GCPtr gc,
glDisable(GL_COLOR_LOGIC_OP);
- glamor_put_context(glamor_priv);
-
glamor_priv->state = RENDER_STATE;
glamor_priv->render_idle_cnt = 0;
@@ -289,7 +287,6 @@ glamor_poly_text(DrawablePtr drawable, GCPtr gc,
bail_ctx:
glDisable(GL_COLOR_LOGIC_OP);
- glamor_put_context(glamor_priv);
bail:
return FALSE;
}
@@ -420,7 +417,7 @@ glamor_image_text(DrawablePtr drawable, GCPtr gc,
glamor_get_glyphs(gc->font, glamor_font, count, chars, sixteen, charinfo);
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
if (TERMINALFONT(gc->font))
prog = &glamor_priv->te_text_prog;
@@ -482,8 +479,6 @@ glamor_image_text(DrawablePtr drawable, GCPtr gc,
(void) glamor_text(drawable, gc, glamor_font, prog,
x, y, count, chars, charinfo, sixteen);
- glamor_put_context(glamor_priv);
-
glamor_priv->state = RENDER_STATE;
glamor_priv->render_idle_cnt = 0;
@@ -491,7 +486,6 @@ glamor_image_text(DrawablePtr drawable, GCPtr gc,
bail:
glDisable(GL_COLOR_LOGIC_OP);
- glamor_put_context(glamor_priv);
return FALSE;
}
diff --git a/xorg-server/glamor/glamor_tile.c b/xorg-server/glamor/glamor_tile.c
index 9e115cad1..4e479763e 100644
--- a/xorg-server/glamor/glamor_tile.c
+++ b/xorg-server/glamor/glamor_tile.c
@@ -62,7 +62,7 @@ glamor_init_tile_shader(ScreenPtr screen)
GLint sampler_uniform_location;
glamor_priv = glamor_get_screen_private(screen);
- glamor_get_context(glamor_priv);
+ glamor_make_current(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);
@@ -82,7 +82,6 @@ glamor_init_tile_shader(ScreenPtr screen)
glamor_priv->tile_wh =
glGetUniformLocation(glamor_priv->tile_prog, "wh");
- glamor_put_context(glamor_priv);
}
void
@@ -91,9 +90,8 @@ glamor_fini_tile_shader(ScreenPtr screen)
glamor_screen_private *glamor_priv;
glamor_priv = glamor_get_screen_private(screen);
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
glDeleteProgram(glamor_priv->tile_prog);
- glamor_put_context(glamor_priv);
}
static void
@@ -123,7 +121,7 @@ _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);
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
glUseProgram(glamor_priv->tile_prog);
glamor_pixmap_fbo_fix_wh_ratio(wh, src_pixmap_priv);
@@ -155,7 +153,6 @@ _glamor_tile(PixmapPtr pixmap, PixmapPtr tile,
glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
- glamor_put_context(glamor_priv);
glamor_priv->state = RENDER_STATE;
glamor_priv->render_idle_cnt = 0;
@@ -193,10 +190,9 @@ glamor_tile(PixmapPtr pixmap, PixmapPtr tile,
goto fail;
}
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
if (!glamor_set_alu(screen, alu)) {
glamor_fallback("unsupported alu %x\n", alu);
- glamor_put_context(glamor_priv);
goto fail;
}
@@ -290,7 +286,6 @@ glamor_tile(PixmapPtr pixmap, PixmapPtr tile,
_glamor_tile(pixmap, tile, x, y, width, height, tile_x, tile_y);
glamor_set_alu(screen, GXcopy);
- glamor_put_context(glamor_priv);
return TRUE;
fail:
return FALSE;
diff --git a/xorg-server/glamor/glamor_transfer.c b/xorg-server/glamor/glamor_transfer.c
index 0378bb076..ad875c962 100644
--- a/xorg-server/glamor/glamor_transfer.c
+++ b/xorg-server/glamor/glamor_transfer.c
@@ -70,7 +70,7 @@ glamor_upload_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox,
glamor_format_for_pixmap(pixmap, &format, &type);
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
@@ -127,7 +127,6 @@ glamor_upload_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox,
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
- glamor_put_context(glamor_priv);
}
/*
@@ -180,7 +179,7 @@ glamor_download_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox,
glamor_format_for_pixmap(pixmap, &format, &type);
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
glPixelStorei(GL_PACK_ALIGNMENT, 4);
glPixelStorei(GL_PACK_ROW_LENGTH, byte_stride / bytes_per_pixel);
@@ -226,7 +225,6 @@ glamor_download_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox,
glPixelStorei(GL_PACK_ROW_LENGTH, 0);
glPixelStorei(GL_PACK_SKIP_ROWS, 0);
glPixelStorei(GL_PACK_SKIP_PIXELS, 0);
- glamor_put_context(glamor_priv);
}
/*
diff --git a/xorg-server/glamor/glamor_trapezoid.c b/xorg-server/glamor/glamor_trapezoid.c
index c76b8bb2a..4aba469af 100644
--- a/xorg-server/glamor/glamor_trapezoid.c
+++ b/xorg-server/glamor/glamor_trapezoid.c
@@ -235,14 +235,13 @@ glamor_flush_composite_triangles(ScreenPtr screen)
{
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
glamor_put_vbo_space(screen);
if (!glamor_priv->render_nr_verts)
return;
glDrawArrays(GL_TRIANGLES, 0, glamor_priv->render_nr_verts);
- glamor_put_context(glamor_priv);
}
static Bool
@@ -627,7 +626,7 @@ glamor_setup_composite_vbo_for_trapezoid(ScreenPtr screen, int n_verts)
vert_size = n_verts * glamor_priv->vb_stride;
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
@@ -667,8 +666,6 @@ glamor_setup_composite_vbo_for_trapezoid(ScreenPtr screen, int n_verts)
vbo_offset + stride * sizeof(float));
glEnableVertexAttribArray(GLAMOR_VERTEX_RIGHT_PARAM);
- glamor_put_context(glamor_priv);
-
return vb;
}
@@ -811,7 +808,7 @@ _glamor_trapezoids_with_shader(CARD8 op,
goto TRAPEZOID_OUT;
}
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
box = REGION_RECTS(&region);
nbox = REGION_NUM_RECTS(&region);
@@ -979,7 +976,6 @@ _glamor_trapezoids_with_shader(CARD8 op,
glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
glDisableVertexAttribArray(GLAMOR_VERTEX_MASK);
glDisable(GL_BLEND);
- glamor_put_context(glamor_priv);
TRAPEZOID_OUT:
if (box) {
@@ -1332,7 +1328,7 @@ glamor_init_trapezoid_shader(ScreenPtr screen)
"}\n";
glamor_priv = glamor_get_screen_private(screen);
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
glamor_priv->trapezoid_prog = glCreateProgram();
@@ -1354,8 +1350,6 @@ glamor_init_trapezoid_shader(ScreenPtr screen)
GLAMOR_VERTEX_RIGHT_PARAM, "v_right_param");
glamor_link_glsl_prog(screen, glamor_priv->trapezoid_prog, "trapezoid");
-
- glamor_put_context(glamor_priv);
}
void
@@ -1364,9 +1358,8 @@ glamor_fini_trapezoid_shader(ScreenPtr screen)
glamor_screen_private *glamor_priv;
glamor_priv = glamor_get_screen_private(screen);
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
glDeleteProgram(glamor_priv->trapezoid_prog);
- glamor_put_context(glamor_priv);
}
static Bool
@@ -1406,7 +1399,7 @@ _glamor_generate_trapezoid_with_shader(ScreenPtr screen, PicturePtr picture,
return FALSE;
}
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
glamor_set_destination_pixmap_priv_nc(pixmap_priv);
@@ -1564,7 +1557,6 @@ _glamor_generate_trapezoid_with_shader(ScreenPtr screen, PicturePtr picture,
glDisableVertexAttribArray(GLAMOR_VERTEX_TOP_BOTTOM);
glDisableVertexAttribArray(GLAMOR_VERTEX_LEFT_PARAM);
glDisableVertexAttribArray(GLAMOR_VERTEX_RIGHT_PARAM);
- glamor_put_context(glamor_priv);
return TRUE;
}
diff --git a/xorg-server/glamor/glamor_utils.h b/xorg-server/glamor/glamor_utils.h
index 53b7d9bec..4c1581ef5 100644
--- a/xorg-server/glamor/glamor_utils.h
+++ b/xorg-server/glamor/glamor_utils.h
@@ -1499,15 +1499,12 @@ __fls(unsigned long x)
#endif
static inline void
-glamor_get_context(glamor_screen_private * glamor_priv)
+glamor_make_current(glamor_screen_private *glamor_priv)
{
- glamor_priv->ctx.get_context(&glamor_priv->ctx);
-}
-
-static inline void
-glamor_put_context(glamor_screen_private * glamor_priv)
-{
- glamor_priv->ctx.put_context(&glamor_priv->ctx);
+ if (lastGLContext != &glamor_priv->ctx) {
+ lastGLContext = &glamor_priv->ctx;
+ glamor_priv->ctx.make_current(&glamor_priv->ctx);
+ }
}
#endif
diff --git a/xorg-server/glamor/glamor_vbo.c b/xorg-server/glamor/glamor_vbo.c
index 2731692d6..c6785594b 100644
--- a/xorg-server/glamor/glamor_vbo.c
+++ b/xorg-server/glamor/glamor_vbo.c
@@ -48,7 +48,7 @@ glamor_get_vbo_space(ScreenPtr screen, unsigned size, char **vbo_offset)
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
void *data;
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
glBindBuffer(GL_ARRAY_BUFFER, glamor_priv->vbo);
@@ -79,7 +79,6 @@ glamor_get_vbo_space(ScreenPtr screen, unsigned size, char **vbo_offset)
*/
glamor_priv->has_buffer_storage = false;
glamor_priv->vbo_size = 0;
- glamor_put_context(glamor_priv);
return glamor_get_vbo_space(screen, size, vbo_offset);
}
@@ -130,8 +129,6 @@ glamor_get_vbo_space(ScreenPtr screen, unsigned size, char **vbo_offset)
data = glamor_priv->vb;
}
- glamor_put_context(glamor_priv);
-
return data;
}
@@ -140,7 +137,7 @@ glamor_put_vbo_space(ScreenPtr screen)
{
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
if (glamor_priv->has_buffer_storage) {
/* If we're in the ARB_buffer_storage path, we have a
@@ -155,8 +152,6 @@ glamor_put_vbo_space(ScreenPtr screen)
}
glBindBuffer(GL_ARRAY_BUFFER, 0);
-
- glamor_put_context(glamor_priv);
}
void
@@ -164,11 +159,9 @@ glamor_init_vbo(ScreenPtr screen)
{
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
glGenBuffers(1, &glamor_priv->vbo);
-
- glamor_put_context(glamor_priv);
}
void
@@ -176,11 +169,9 @@ glamor_fini_vbo(ScreenPtr screen)
{
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
glDeleteBuffers(1, &glamor_priv->vbo);
if (!glamor_priv->has_map_buffer_range)
free(glamor_priv->vb);
-
- glamor_put_context(glamor_priv);
}
diff --git a/xorg-server/glamor/glamor_xv.c b/xorg-server/glamor/glamor_xv.c
index 4e60fa3a4..369b02b61 100644
--- a/xorg-server/glamor/glamor_xv.c
+++ b/xorg-server/glamor/glamor_xv.c
@@ -97,7 +97,7 @@ glamor_init_xv_shader(ScreenPtr screen)
GLint fs_prog, vs_prog;
glamor_priv = glamor_get_screen_private(screen);
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
glamor_priv->xv_prog = glCreateProgram();
vs_prog = glamor_compile_glsl_prog(GL_VERTEX_SHADER, xv_vs);
@@ -110,8 +110,6 @@ glamor_init_xv_shader(ScreenPtr screen)
glBindAttribLocation(glamor_priv->xv_prog,
GLAMOR_VERTEX_SOURCE, "v_texcoord0");
glamor_link_glsl_prog(screen, glamor_priv->xv_prog, "xv");
-
- glamor_put_context(glamor_priv);
}
#define ClipValue(v,min,max) ((v) < (min) ? (min) : (v) > (max) ? (max) : (v))
@@ -316,7 +314,7 @@ glamor_display_textured_video(glamor_port_private *port_priv)
&src_yscale[i]);
}
}
- glamor_get_context(glamor_priv);
+ glamor_make_current(glamor_priv);
glUseProgram(glamor_priv->xv_prog);
uloc = glGetUniformLocation(glamor_priv->xv_prog, "offsetyco");
@@ -404,7 +402,6 @@ glamor_display_textured_video(glamor_port_private *port_priv)
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
- glamor_put_context(glamor_priv);
DamageDamageRegion(port_priv->pDraw, &port_priv->clip);
}
diff --git a/xorg-server/glx/glxcmds.c b/xorg-server/glx/glxcmds.c
index 187e42665..2fc3f4cc8 100644
--- a/xorg-server/glx/glxcmds.c
+++ b/xorg-server/glx/glxcmds.c
@@ -188,7 +188,7 @@ validGlxDrawable(ClientPtr client, XID id, int type, int access_mode,
void
__glXContextDestroy(__GLXcontext * context)
{
- __glXFlushContextCache();
+ lastGLContext = NULL;
}
static void
@@ -275,6 +275,17 @@ DoCreateContext(__GLXclientState * cl, GLXContextID gcId,
** Allocate memory for the new context
*/
if (!isDirect) {
+ /* Only allow creating indirect GLX contexts if allowed by
+ * server command line. Indirect GLX is of limited use (since
+ * it's only GL 1.4), it's slower than direct contexts, and
+ * it's a massive attack surface for buffer overflow type
+ * errors.
+ */
+ if (!enableIndirectGLX) {
+ client->errorValue = isDirect;
+ return BadValue;
+ }
+
/* Without any attributes, the only error that the driver should be
* able to generate is BadAlloc. As result, just drop the error
* returned from the driver on the floor.
@@ -434,10 +445,6 @@ static void
StopUsingContext(__GLXcontext * glxc)
{
if (glxc) {
- if (glxc == __glXLastContext) {
- /* Tell server GL library */
- __glXLastContext = 0;
- }
glxc->currentClient = NULL;
if (!glxc->idExists) {
FreeResourceByType(glxc->id, __glXContextRes, FALSE);
@@ -448,7 +455,6 @@ StopUsingContext(__GLXcontext * glxc)
static void
StartUsingContext(__GLXclientState * cl, __GLXcontext * glxc)
{
- __glXLastContext = glxc;
glxc->currentClient = cl->client;
}
@@ -627,7 +633,7 @@ DoMakeCurrent(__GLXclientState * cl,
if (!(*prevglxc->loseCurrent) (prevglxc)) {
return __glXError(GLXBadContext);
}
- __glXFlushContextCache();
+ lastGLContext = NULL;
if (!prevglxc->isDirect) {
prevglxc->drawPriv = NULL;
prevglxc->readPriv = NULL;
@@ -640,7 +646,9 @@ DoMakeCurrent(__GLXclientState * cl,
glxc->readPriv = readPriv;
/* make the context current */
+ lastGLContext = glxc;
if (!(*glxc->makeCurrent) (glxc)) {
+ lastGLContext = NULL;
glxc->drawPriv = NULL;
glxc->readPriv = NULL;
return __glXError(GLXBadContext);
diff --git a/xorg-server/glx/glxdri2.c b/xorg-server/glx/glxdri2.c
index 5d1a45bff..c756bf570 100644
--- a/xorg-server/glx/glxdri2.c
+++ b/xorg-server/glx/glxdri2.c
@@ -115,55 +115,54 @@ __glXDRIdrawableDestroy(__GLXdrawable * drawable)
}
static void
-__glXDRIdrawableCopySubBuffer(__GLXdrawable * drawable,
- int x, int y, int w, int h)
+copy_box(__GLXdrawable * drawable,
+ int dst, int src,
+ int x, int y, int w, int h)
{
- __GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable;
BoxRec box;
RegionRec region;
+ __GLXcontext *cx = lastGLContext;
box.x1 = x;
- box.y1 = private->height - y - h;
+ box.y1 = y;
box.x2 = x + w;
- box.y2 = private->height - y;
+ box.y2 = y + h;
RegionInit(&region, &box, 0);
- DRI2CopyRegion(drawable->pDraw, &region,
- DRI2BufferFrontLeft, DRI2BufferBackLeft);
+ DRI2CopyRegion(drawable->pDraw, &region, dst, src);
+ if (cx != lastGLContext) {
+ lastGLContext = cx;
+ cx->makeCurrent(cx);
+ }
}
static void
-__glXDRIdrawableWaitX(__GLXdrawable * drawable)
+__glXDRIdrawableCopySubBuffer(__GLXdrawable * drawable,
+ int x, int y, int w, int h)
{
__GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable;
- BoxRec box;
- RegionRec region;
- box.x1 = 0;
- box.y1 = 0;
- box.x2 = private->width;
- box.y2 = private->height;
- RegionInit(&region, &box, 0);
+ copy_box(drawable, x, private->height - y - h,
+ w, h,
+ DRI2BufferFrontLeft, DRI2BufferBackLeft);
+}
+
+static void
+__glXDRIdrawableWaitX(__GLXdrawable * drawable)
+{
+ __GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable;
- DRI2CopyRegion(drawable->pDraw, &region,
- DRI2BufferFakeFrontLeft, DRI2BufferFrontLeft);
+ copy_box(drawable, DRI2BufferFakeFrontLeft, DRI2BufferFrontLeft,
+ 0, 0, private->width, private->height);
}
static void
__glXDRIdrawableWaitGL(__GLXdrawable * drawable)
{
__GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable;
- BoxRec box;
- RegionRec region;
-
- box.x1 = 0;
- box.y1 = 0;
- box.x2 = private->width;
- box.y2 = private->height;
- RegionInit(&region, &box, 0);
- DRI2CopyRegion(drawable->pDraw, &region,
- DRI2BufferFrontLeft, DRI2BufferFakeFrontLeft);
+ copy_box(drawable, DRI2BufferFrontLeft, DRI2BufferFakeFrontLeft,
+ 0, 0, private->width, private->height);
}
static void
@@ -204,26 +203,37 @@ __glXDRIdrawableSwapBuffers(ClientPtr client, __GLXdrawable * drawable)
__GLXDRIdrawable *priv = (__GLXDRIdrawable *) drawable;
__GLXDRIscreen *screen = priv->screen;
CARD64 unused;
+ __GLXcontext *cx = lastGLContext;
+ int status;
if (screen->flush) {
(*screen->flush->flush) (priv->driDrawable);
(*screen->flush->invalidate) (priv->driDrawable);
}
- if (DRI2SwapBuffers(client, drawable->pDraw, 0, 0, 0, &unused,
- __glXdriSwapEvent, drawable) != Success)
- return FALSE;
+ status = DRI2SwapBuffers(client, drawable->pDraw, 0, 0, 0, &unused,
+ __glXdriSwapEvent, drawable);
+ if (cx != lastGLContext) {
+ lastGLContext = cx;
+ cx->makeCurrent(cx);
+ }
- return TRUE;
+ return status == Success;
}
static int
__glXDRIdrawableSwapInterval(__GLXdrawable * drawable, int interval)
{
+ __GLXcontext *cx = lastGLContext;
+
if (interval <= 0) /* || interval > BIGNUM? */
return GLX_BAD_VALUE;
DRI2SwapInterval(drawable->pDraw, interval);
+ if (cx != lastGLContext) {
+ lastGLContext = cx;
+ cx->makeCurrent(cx);
+ }
return 0;
}
@@ -276,7 +286,16 @@ static Bool
__glXDRIcontextWait(__GLXcontext * baseContext,
__GLXclientState * cl, int *error)
{
- if (DRI2WaitSwap(cl->client, baseContext->drawPriv->pDraw)) {
+ __GLXcontext *cx = lastGLContext;
+ Bool ret;
+
+ ret = DRI2WaitSwap(cl->client, baseContext->drawPriv->pDraw);
+ if (cx != lastGLContext) {
+ lastGLContext = cx;
+ cx->makeCurrent(cx);
+ }
+
+ if (ret) {
*error = cl->client->noClientException;
return TRUE;
}
@@ -600,6 +619,8 @@ __glXDRIscreenCreateDrawable(ClientPtr client,
__GLXDRIscreen *driScreen = (__GLXDRIscreen *) screen;
__GLXDRIconfig *config = (__GLXDRIconfig *) glxConfig;
__GLXDRIdrawable *private;
+ __GLXcontext *cx = lastGLContext;
+ Bool ret;
private = calloc(1, sizeof *private);
if (private == NULL)
@@ -618,9 +639,15 @@ __glXDRIscreenCreateDrawable(ClientPtr client,
private->base.waitGL = __glXDRIdrawableWaitGL;
private->base.waitX = __glXDRIdrawableWaitX;
- if (DRI2CreateDrawable2(client, pDraw, drawId,
- __glXDRIinvalidateBuffers, private,
- &private->dri2_id)) {
+ ret = DRI2CreateDrawable2(client, pDraw, drawId,
+ __glXDRIinvalidateBuffers, private,
+ &private->dri2_id);
+ if (cx != lastGLContext) {
+ lastGLContext = cx;
+ cx->makeCurrent(cx);
+ }
+
+ if (ret) {
free(private);
return NULL;
}
@@ -642,9 +669,22 @@ dri2GetBuffers(__DRIdrawable * driDrawable,
DRI2BufferPtr *buffers;
int i;
int j;
+ __GLXcontext *cx = lastGLContext;
buffers = DRI2GetBuffers(private->base.pDraw,
width, height, attachments, count, out_count);
+ if (cx != lastGLContext) {
+ lastGLContext = cx;
+ cx->makeCurrent(cx);
+
+ /* If DRI2GetBuffers() changed the GL context, it may also have
+ * invalidated the DRI2 buffers, so let's get them again
+ */
+ buffers = DRI2GetBuffers(private->base.pDraw,
+ width, height, attachments, count, out_count);
+ assert(lastGLContext == cx);
+ }
+
if (*out_count > MAX_DRAWABLE_BUFFERS) {
*out_count = 0;
return NULL;
@@ -686,10 +726,24 @@ dri2GetBuffersWithFormat(__DRIdrawable * driDrawable,
DRI2BufferPtr *buffers;
int i;
int j = 0;
+ __GLXcontext *cx = lastGLContext;
buffers = DRI2GetBuffersWithFormat(private->base.pDraw,
width, height, attachments, count,
out_count);
+ if (cx != lastGLContext) {
+ lastGLContext = cx;
+ cx->makeCurrent(cx);
+
+ /* If DRI2GetBuffersWithFormat() changed the GL context, it may also have
+ * invalidated the DRI2 buffers, so let's get them again
+ */
+ buffers = DRI2GetBuffersWithFormat(private->base.pDraw,
+ width, height, attachments, count,
+ out_count);
+ assert(lastGLContext == cx);
+ }
+
if (*out_count > MAX_DRAWABLE_BUFFERS) {
*out_count = 0;
return NULL;
diff --git a/xorg-server/glx/glxdriswrast.c b/xorg-server/glx/glxdriswrast.c
index 6fa328831..c30ce9aed 100644
--- a/xorg-server/glx/glxdriswrast.c
+++ b/xorg-server/glx/glxdriswrast.c
@@ -337,6 +337,7 @@ swrastPutImage(__DRIdrawable * draw, int op,
__GLXDRIdrawable *drawable = loaderPrivate;
DrawablePtr pDraw = drawable->base.pDraw;
GCPtr gc;
+ __GLXcontext *cx = lastGLContext;
switch (op) {
case __DRI_SWRAST_IMAGE_OP_DRAW:
@@ -352,6 +353,10 @@ swrastPutImage(__DRIdrawable * draw, int op,
ValidateGC(pDraw, gc);
gc->ops->PutImage(pDraw, gc, pDraw->depth, x, y, w, h, 0, ZPixmap, data);
+ if (cx != lastGLContext) {
+ lastGLContext = cx;
+ cx->makeCurrent(cx);
+ }
}
static void
@@ -361,8 +366,13 @@ swrastGetImage(__DRIdrawable * draw,
__GLXDRIdrawable *drawable = loaderPrivate;
DrawablePtr pDraw = drawable->base.pDraw;
ScreenPtr pScreen = pDraw->pScreen;
+ __GLXcontext *cx = lastGLContext;
pScreen->GetImage(pDraw, x, y, w, h, ZPixmap, ~0L, data);
+ if (cx != lastGLContext) {
+ lastGLContext = cx;
+ cx->makeCurrent(cx);
+ }
}
static const __DRIswrastLoaderExtension swrastLoaderExtension = {
diff --git a/xorg-server/glx/glxext.c b/xorg-server/glx/glxext.c
index c9b8cc5b3..c0142fe2e 100644
--- a/xorg-server/glx/glxext.c
+++ b/xorg-server/glx/glxext.c
@@ -48,12 +48,6 @@
#include "indirect_util.h"
/*
-** The last context used by the server. It is the context that is current
-** from the server's perspective.
-*/
-__GLXcontext *__glXLastContext;
-
-/*
** X resources.
*/
RESTYPE __glXContextRes;
@@ -79,7 +73,7 @@ static int __glXDispatch(ClientPtr);
static void
ResetExtension(ExtensionEntry * extEntry)
{
- __glXFlushContextCache();
+ lastGLContext = NULL;
}
/*
@@ -141,8 +135,7 @@ DrawableGone(__GLXdrawable * glxPriv, XID xid)
(c->drawPriv == glxPriv || c->readPriv == glxPriv)) {
/* just force a re-bind the next time through */
(*c->loseCurrent) (c);
- if (c == __glXLastContext)
- __glXFlushContextCache();
+ lastGLContext = NULL;
}
if (c->drawPriv == glxPriv)
c->drawPriv = NULL;
@@ -203,8 +196,8 @@ __glXFreeContext(__GLXcontext * cx)
free(cx->feedbackBuf);
free(cx->selectBuf);
- if (cx == __glXLastContext) {
- __glXFlushContextCache();
+ if (cx == lastGLContext) {
+ lastGLContext = NULL;
}
/* We can get here through both regular dispatching from
@@ -296,6 +289,7 @@ glxClientCallback(CallbackListPtr *list, void *closure, void *data)
next = c->next;
if (c->currentClient == pClient) {
c->loseCurrent(c);
+ lastGLContext = NULL;
c->currentClient = NULL;
__glXFreeContext(c);
}
@@ -406,12 +400,6 @@ GlxExtensionInit(void)
/************************************************************************/
-void
-__glXFlushContextCache(void)
-{
- __glXLastContext = 0;
-}
-
/*
** Make a context the current one for the GL (in this implementation, there
** is only one instance of the GL, and we use it to serve all GL clients by
@@ -449,21 +437,22 @@ __glXForceCurrent(__GLXclientState * cl, GLXContextTag tag, int *error)
if (cx->wait && (*cx->wait) (cx, cl, error))
return NULL;
- if (cx == __glXLastContext) {
+ if (cx == lastGLContext) {
/* No need to re-bind */
return cx;
}
/* Make this context the current one for the GL. */
if (!cx->isDirect) {
+ lastGLContext = cx;
if (!(*cx->makeCurrent) (cx)) {
/* Bind failed, and set the error code. Bummer */
+ lastGLContext = NULL;
cl->client->errorValue = cx->id;
*error = __glXError(GLXBadContextState);
return 0;
}
}
- __glXLastContext = cx;
return cx;
}
diff --git a/xorg-server/glx/glxserver.h b/xorg-server/glx/glxserver.h
index 3f2ae3593..a324b290f 100644
--- a/xorg-server/glx/glxserver.h
+++ b/xorg-server/glx/glxserver.h
@@ -84,7 +84,6 @@ void __glXScreenInitVisuals(__GLXscreen * screen);
/*
** The last context used (from the server's persective) is cached.
*/
-extern __GLXcontext *__glXLastContext;
extern __GLXcontext *__glXForceCurrent(__GLXclientState *, GLXContextTag,
int *);
diff --git a/xorg-server/hw/dmx/config/xdmxconfig.c b/xorg-server/hw/dmx/config/xdmxconfig.c
index 2b7b9683b..0540d0173 100644
--- a/xorg-server/hw/dmx/config/xdmxconfig.c
+++ b/xorg-server/hw/dmx/config/xdmxconfig.c
@@ -303,7 +303,6 @@ dmxConfigCanvasUpdate(void)
fs = XQueryFont(dpy, gcontext);
for (pt = dmxConfigCurrent->subentry; pt; pt = pt->next) {
int x, y, len;
- int xo = 3, yo = fs->ascent + fs->descent + 2;
GC gc;
if (pt->type != dmxConfigDisplay)
@@ -321,6 +320,8 @@ dmxConfigCanvasUpdate(void)
y = dmxConfigWidgetHeight - 1;
XDrawRectangle(dpy, win, gc, x, y, w, h);
if (fs && len) {
+ int xo = 3, yo = fs->ascent + fs->descent + 2;
+
while (len && XTextWidth(fs, pt->display->name, len) >= w - 2 * xo)
--len;
if (len)
diff --git a/xorg-server/hw/kdrive/linux/linux.c b/xorg-server/hw/kdrive/linux/linux.c
index 6284de576..73a8169bf 100644
--- a/xorg-server/hw/kdrive/linux/linux.c
+++ b/xorg-server/hw/kdrive/linux/linux.c
@@ -68,13 +68,16 @@ LinuxCheckChown(const char *file)
struct stat st;
__uid_t u;
__gid_t g;
+ int r;
if (stat(file, &st) < 0)
return;
u = getuid();
g = getgid();
- if (st.st_uid != u || st.st_gid != g)
- chown(file, u, g);
+ if (st.st_uid != u || st.st_gid != g) {
+ r = chown(file, u, g);
+ (void) r;
+ }
}
static int
diff --git a/xorg-server/hw/kdrive/src/kdrive.c b/xorg-server/hw/kdrive/src/kdrive.c
index 8eb8cd02e..9814fc66a 100644
--- a/xorg-server/hw/kdrive/src/kdrive.c
+++ b/xorg-server/hw/kdrive/src/kdrive.c
@@ -118,10 +118,17 @@ KdDoSwitchCmd(const char *reason)
{
if (kdSwitchCmd) {
char *command;
+ int ret;
if (asprintf(&command, "%s %s", kdSwitchCmd, reason) == -1)
return;
- system(command);
+
+ /* Ignore the return value from system; I'm not sure
+ * there's anything more useful to be done when
+ * it fails
+ */
+ ret = system(command);
+ (void) ret;
free(command);
}
}
diff --git a/xorg-server/hw/xfree86/.gitignore b/xorg-server/hw/xfree86/.gitignore
index fb6830b2c..c84c37ffb 100644
--- a/xorg-server/hw/xfree86/.gitignore
+++ b/xorg-server/hw/xfree86/.gitignore
@@ -1,4 +1,5 @@
Xorg
+Xorg.wrap
Xorg.sh
xorg.conf.example
sdksyms.c
diff --git a/xorg-server/hw/xfree86/common/compiler.h b/xorg-server/hw/xfree86/common/compiler.h
index 3a57186be..fb95f58bf 100644
--- a/xorg-server/hw/xfree86/common/compiler.h
+++ b/xorg-server/hw/xfree86/common/compiler.h
@@ -103,6 +103,7 @@
#if !defined(__sparc__) && !defined(__sparc) && !defined(__arm32__) && !defined(__nds32__) \
&& !(defined(__alpha__) && defined(linux)) \
&& !(defined(__ia64__) && defined(linux)) \
+ && !(defined(__mips64) && defined(linux)) \
extern _X_EXPORT void outb(unsigned short, unsigned char);
extern _X_EXPORT void outw(unsigned short, unsigned short);
@@ -721,7 +722,7 @@ xf86WriteMmio32LeNB(__volatile__ void *base, const unsigned long offset,
}
#elif defined(__mips__) || (defined(__arm32__) && !defined(__linux__))
-#ifdef __arm32__
+#if defined(__arm32__) || defined(__mips64)
#define PORT_SIZE long
#else
#define PORT_SIZE short
diff --git a/xorg-server/hw/xfree86/dri/dri.c b/xorg-server/hw/xfree86/dri/dri.c
index 60339995d..95828bbac 100644
--- a/xorg-server/hw/xfree86/dri/dri.c
+++ b/xorg-server/hw/xfree86/dri/dri.c
@@ -177,19 +177,15 @@ DRIOpenDRMMaster(ScrnInfoPtr pScrn,
memset(&tmp, 0, sizeof(tmp));
/* Check the DRM lib version.
- * drmGetLibVersion was not supported in version 1.0, so check for
- * symbol first to avoid possible crash or hang.
*/
drmlibmajor = 1;
drmlibminor = 0;
- if (xf86LoaderCheckSymbol("drmGetLibVersion")) {
- drmlibv = drmGetLibVersion(-1);
- if (drmlibv != NULL) {
- drmlibmajor = drmlibv->version_major;
- drmlibminor = drmlibv->version_minor;
- drmFreeVersion(drmlibv);
- }
+ drmlibv = drmGetLibVersion(-1);
+ if (drmlibv != NULL) {
+ drmlibmajor = drmlibv->version_major;
+ drmlibminor = drmlibv->version_minor;
+ drmFreeVersion(drmlibv);
}
/* Check if the libdrm can handle falling back to loading based on name
diff --git a/xorg-server/hw/xfree86/dri2/dri2.c b/xorg-server/hw/xfree86/dri2/dri2.c
index 729a323da..76708cabc 100644
--- a/xorg-server/hw/xfree86/dri2/dri2.c
+++ b/xorg-server/hw/xfree86/dri2/dri2.c
@@ -1092,6 +1092,14 @@ DRI2SwapBuffers(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc,
return BadDrawable;
}
+ /* According to spec, return expected swapbuffers count SBC after this swap
+ * will complete. This is ignored unless we return Success, but it must be
+ * initialized on every path where we return Success or the caller will send
+ * an uninitialized value off the stack to the client. So let's initialize
+ * it as early as possible, just to be sure.
+ */
+ *swap_target = pPriv->swap_count + pPriv->swapsPending + 1;
+
for (i = 0; i < pPriv->bufferCount; i++) {
if (pPriv->buffers[i]->attachment == DRI2BufferFrontLeft)
pDestBuffer = (DRI2BufferPtr) pPriv->buffers[i];
@@ -1149,17 +1157,13 @@ DRI2SwapBuffers(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc,
* we have to account for the current swap count, interval, and the
* number of pending swaps.
*/
- *swap_target = pPriv->last_swap_target + pPriv->swap_interval;
+ target_msc = pPriv->last_swap_target + pPriv->swap_interval;
}
- else {
- /* glXSwapBuffersMscOML could have a 0 target_msc, honor it */
- *swap_target = target_msc;
- }
pPriv->swapsPending++;
ret = (*ds->ScheduleSwap) (client, pDraw, pDestBuffer, pSrcBuffer,
- swap_target, divisor, remainder, func, data);
+ &target_msc, divisor, remainder, func, data);
if (!ret) {
pPriv->swapsPending--; /* didn't schedule */
xf86DrvMsg(pScreen->myNum, X_ERROR,
@@ -1167,12 +1171,7 @@ DRI2SwapBuffers(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc,
return BadDrawable;
}
- pPriv->last_swap_target = *swap_target;
-
- /* According to spec, return expected swapbuffers count SBC after this swap
- * will complete.
- */
- *swap_target = pPriv->swap_count + pPriv->swapsPending;
+ pPriv->last_swap_target = target_msc;
DRI2InvalidateDrawableAll(pDraw);
diff --git a/xorg-server/hw/xfree86/man/Makefile.am b/xorg-server/hw/xfree86/man/Makefile.am
index f41d26c4e..5da404cbb 100644
--- a/xorg-server/hw/xfree86/man/Makefile.am
+++ b/xorg-server/hw/xfree86/man/Makefile.am
@@ -5,4 +5,6 @@ fileman_PRE = xorg.conf.man xorg.conf.d.man
if SUID_WRAPPER
appman_PRE += Xorg.wrap.man
fileman_PRE += Xwrapper.config.man
+else
+EXTRA_DIST += Xorg.wrap.man Xwrapper.config.man
endif
diff --git a/xorg-server/hw/xfree86/man/Xorg.wrap.man b/xorg-server/hw/xfree86/man/Xorg.wrap.man
index f2153e35b..58937c74b 100644
--- a/xorg-server/hw/xfree86/man/Xorg.wrap.man
+++ b/xorg-server/hw/xfree86/man/Xorg.wrap.man
@@ -1,4 +1,4 @@
-.\" Xwrapper.wrap.1
+.\" Xwrapper.wrap.__appmansuffix__
.\"
.\" Copyright 2014 Red Hat, Inc.
.\"
@@ -26,7 +26,7 @@
.\"
.\" shorthand for double quote that works everywhere.
.ds q \N'34'
-.TH Xorg.wrap 1 __xorgversion__
+.TH Xorg.wrap __appmansuffix__ __xorgversion__
.SH NAME
Xorg.wrap \- Xorg X server binary wrapper
.SH DESCRIPTION
diff --git a/xorg-server/hw/xfree86/man/Xwrapper.config.man b/xorg-server/hw/xfree86/man/Xwrapper.config.man
index 800947c55..5c777c940 100644
--- a/xorg-server/hw/xfree86/man/Xwrapper.config.man
+++ b/xorg-server/hw/xfree86/man/Xwrapper.config.man
@@ -1 +1 @@
-.so man1/Xorg.wrap.1
+.so man__appmansuffix__/Xorg.wrap.__appmansuffix__
diff --git a/xorg-server/hw/xfree86/modes/xf86RandR12.c b/xorg-server/hw/xfree86/modes/xf86RandR12.c
index 66139dcf0..8a04dfc2c 100644
--- a/xorg-server/hw/xfree86/modes/xf86RandR12.c
+++ b/xorg-server/hw/xfree86/modes/xf86RandR12.c
@@ -1256,12 +1256,13 @@ xf86RandR12CrtcSetGamma(ScreenPtr pScreen, RRCrtcPtr randr_crtc)
CARD16 *tmp_ptr;
tmp_ptr =
- realloc(crtc->gamma_red, 3 * crtc->gamma_size * sizeof(CARD16));
+ realloc(crtc->gamma_red,
+ 3 * randr_crtc->gammaSize * sizeof(CARD16));
if (!tmp_ptr)
return FALSE;
crtc->gamma_red = tmp_ptr;
- crtc->gamma_green = crtc->gamma_red + crtc->gamma_size;
- crtc->gamma_blue = crtc->gamma_green + crtc->gamma_size;
+ crtc->gamma_green = crtc->gamma_red + randr_crtc->gammaSize;
+ crtc->gamma_blue = crtc->gamma_green + randr_crtc->gammaSize;
}
crtc->gamma_size = randr_crtc->gammaSize;
diff --git a/xorg-server/hw/xfree86/shadowfb/shadow.c b/xorg-server/hw/xfree86/shadowfb/shadow.c
index 43529398a..10f72cc99 100644
--- a/xorg-server/hw/xfree86/shadowfb/shadow.c
+++ b/xorg-server/hw/xfree86/shadowfb/shadow.c
@@ -1,8 +1,8 @@
/*
Copyright (C) 1999. The XFree86 Project Inc.
+ Copyright 2014 Red Hat, Inc.
Written by Mark Vojkovich (mvojkovi@ucsd.edu)
-
Pre-fb-write callbacks and RENDER support - Nolan Leake (nolan@vmware.com)
*/
@@ -29,107 +29,23 @@
#include "picturestr.h"
static Bool ShadowCloseScreen(ScreenPtr pScreen);
-static void ShadowCopyWindow(WindowPtr pWin,
- DDXPointRec ptOldOrg, RegionPtr prgn);
-static Bool ShadowCreateGC(GCPtr pGC);
-
-static Bool ShadowEnterVT(ScrnInfoPtr pScrn);
-static void ShadowLeaveVT(ScrnInfoPtr pScrn);
-
-static void ShadowComposite(CARD8 op,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst, CARD16 width, CARD16 height);
+static Bool ShadowCreateScreenResources(ScreenPtr pScreen);
typedef struct {
ScrnInfoPtr pScrn;
RefreshAreaFuncPtr preRefresh;
RefreshAreaFuncPtr postRefresh;
CloseScreenProcPtr CloseScreen;
- CopyWindowProcPtr CopyWindow;
- CreateGCProcPtr CreateGC;
- ModifyPixmapHeaderProcPtr ModifyPixmapHeader;
- CompositeProcPtr Composite;
- Bool (*EnterVT) (ScrnInfoPtr);
- void (*LeaveVT) (ScrnInfoPtr);
- Bool vtSema;
+ CreateScreenResourcesProcPtr CreateScreenResources;
} ShadowScreenRec, *ShadowScreenPtr;
-typedef struct {
- const GCOps *ops;
- const GCFuncs *funcs;
-} ShadowGCRec, *ShadowGCPtr;
-
static DevPrivateKeyRec ShadowScreenKeyRec;
-#define ShadowScreenKey (&ShadowScreenKeyRec)
-
-static DevPrivateKeyRec ShadowGCKeyRec;
-
-#define ShadowGCKey (&ShadowGCKeyRec)
-
-#define GET_SCREEN_PRIVATE(pScreen) \
- (ShadowScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, ShadowScreenKey)
-#define GET_GC_PRIVATE(pGC) \
- (ShadowGCPtr)dixLookupPrivate(&(pGC)->devPrivates, ShadowGCKey)
-
-#define SHADOW_GC_FUNC_PROLOGUE(pGC)\
- ShadowGCPtr pGCPriv = GET_GC_PRIVATE(pGC);\
- (pGC)->funcs = pGCPriv->funcs;\
- if(pGCPriv->ops)\
- (pGC)->ops = pGCPriv->ops
-
-#define SHADOW_GC_FUNC_EPILOGUE(pGC)\
- pGCPriv->funcs = (pGC)->funcs;\
- (pGC)->funcs = &ShadowGCFuncs;\
- if(pGCPriv->ops) {\
- pGCPriv->ops = (pGC)->ops;\
- (pGC)->ops = &ShadowGCOps;\
- }
-
-#define SHADOW_GC_OP_PROLOGUE(pGC)\
- ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pGC->pScreen); \
- ShadowGCPtr pGCPriv = GET_GC_PRIVATE(pGC);\
- const GCFuncs *oldFuncs = pGC->funcs;\
- pGC->funcs = pGCPriv->funcs;\
- pGC->ops = pGCPriv->ops
-
-#define SHADOW_GC_OP_EPILOGUE(pGC)\
- pGCPriv->ops = pGC->ops;\
- pGC->funcs = oldFuncs;\
- pGC->ops = &ShadowGCOps
-
-#define IS_VISIBLE(pWin) (pPriv->vtSema && \
- (((WindowPtr)pWin)->visibility != VisibilityFullyObscured))
-
-#define TRIM_BOX(box, pGC) { \
- BoxPtr extents = &pGC->pCompositeClip->extents;\
- if(box.x1 < extents->x1) box.x1 = extents->x1; \
- if(box.x2 > extents->x2) box.x2 = extents->x2; \
- if(box.y1 < extents->y1) box.y1 = extents->y1; \
- if(box.y2 > extents->y2) box.y2 = extents->y2; \
- }
-
-#define TRANSLATE_BOX(box, pDraw) { \
- box.x1 += pDraw->x; \
- box.x2 += pDraw->x; \
- box.y1 += pDraw->y; \
- box.y2 += pDraw->y; \
- }
-
-#define TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC) { \
- TRANSLATE_BOX(box, pDraw); \
- TRIM_BOX(box, pGC); \
- }
-
-#define BOX_NOT_EMPTY(box) \
- (((box.x2 - box.x1) > 0) && ((box.y2 - box.y1) > 0))
+static ShadowScreenPtr
+shadowfbGetScreenPrivate(ScreenPtr pScreen)
+{
+ return dixLookupPrivate(&(pScreen)->devPrivates, &ShadowScreenKeyRec);
+}
Bool
ShadowFBInit2(ScreenPtr pScreen,
@@ -138,7 +54,6 @@ ShadowFBInit2(ScreenPtr pScreen,
{
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
ShadowScreenPtr pPriv;
- PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
if (!preRefreshArea && !postRefreshArea)
return FALSE;
@@ -146,39 +61,20 @@ ShadowFBInit2(ScreenPtr pScreen,
if (!dixRegisterPrivateKey(&ShadowScreenKeyRec, PRIVATE_SCREEN, 0))
return FALSE;
- if (!dixRegisterPrivateKey
- (&ShadowGCKeyRec, PRIVATE_GC, sizeof(ShadowGCRec)))
- return FALSE;
-
if (!(pPriv = (ShadowScreenPtr) malloc(sizeof(ShadowScreenRec))))
return FALSE;
- dixSetPrivate(&pScreen->devPrivates, ShadowScreenKey, pPriv);
+ dixSetPrivate(&pScreen->devPrivates, &ShadowScreenKeyRec, pPriv);
pPriv->pScrn = pScrn;
pPriv->preRefresh = preRefreshArea;
pPriv->postRefresh = postRefreshArea;
- pPriv->vtSema = TRUE;
pPriv->CloseScreen = pScreen->CloseScreen;
- pPriv->CopyWindow = pScreen->CopyWindow;
- pPriv->CreateGC = pScreen->CreateGC;
- pPriv->ModifyPixmapHeader = pScreen->ModifyPixmapHeader;
-
- pPriv->EnterVT = pScrn->EnterVT;
- pPriv->LeaveVT = pScrn->LeaveVT;
+ pPriv->CreateScreenResources = pScreen->CreateScreenResources;
pScreen->CloseScreen = ShadowCloseScreen;
- pScreen->CopyWindow = ShadowCopyWindow;
- pScreen->CreateGC = ShadowCreateGC;
-
- pScrn->EnterVT = ShadowEnterVT;
- pScrn->LeaveVT = ShadowLeaveVT;
-
- if (ps) {
- pPriv->Composite = ps->Composite;
- ps->Composite = ShadowComposite;
- }
+ pScreen->CreateScreenResources = ShadowCreateScreenResources;
return TRUE;
}
@@ -189,1451 +85,83 @@ ShadowFBInit(ScreenPtr pScreen, RefreshAreaFuncPtr refreshArea)
return ShadowFBInit2(pScreen, NULL, refreshArea);
}
-/**********************************************************/
-
-static Bool
-ShadowEnterVT(ScrnInfoPtr pScrn)
-{
- Bool ret;
- ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScrn->pScreen);
-
- pScrn->EnterVT = pPriv->EnterVT;
- ret = (*pPriv->EnterVT) (pScrn);
- pPriv->EnterVT = pScrn->EnterVT;
- pScrn->EnterVT = ShadowEnterVT;
- if (ret) {
- pPriv->vtSema = TRUE;
- return TRUE;
- }
-
- return FALSE;
-}
-
-static void
-ShadowLeaveVT(ScrnInfoPtr pScrn)
-{
- ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScrn->pScreen);
-
- pPriv->vtSema = FALSE;
-
- pScrn->LeaveVT = pPriv->LeaveVT;
- (*pPriv->LeaveVT) (pScrn);
- pPriv->LeaveVT = pScrn->LeaveVT;
- pScrn->LeaveVT = ShadowLeaveVT;
-}
-
-/**********************************************************/
-
-static Bool
-ShadowCloseScreen(ScreenPtr pScreen)
-{
- ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
- ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScreen);
- PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
-
- pScreen->CloseScreen = pPriv->CloseScreen;
- pScreen->CopyWindow = pPriv->CopyWindow;
- pScreen->CreateGC = pPriv->CreateGC;
- pScreen->ModifyPixmapHeader = pPriv->ModifyPixmapHeader;
-
- pScrn->EnterVT = pPriv->EnterVT;
- pScrn->LeaveVT = pPriv->LeaveVT;
-
- if (ps) {
- ps->Composite = pPriv->Composite;
- }
-
- free((void *) pPriv);
-
- return (*pScreen->CloseScreen) (pScreen);
-}
+/*
+ * Note that we don't do DamageEmpty, or indeed look at the region inside the
+ * DamagePtr at all. This is an optimization, believe it or not. The
+ * incoming RegionPtr is the new damage, and if we were to empty the region
+ * miext/damage would just have to waste time reallocating and re-unioning
+ * it every time, whereas if we leave it around the union gets fast-pathed
+ * away.
+ */
static void
-ShadowCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgn)
+shadowfbReportPre(DamagePtr damage, RegionPtr reg, void *closure)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScreen);
- int num = 0;
- RegionRec rgnDst;
-
- if (pPriv->vtSema) {
- RegionNull(&rgnDst);
- RegionCopy(&rgnDst, prgn);
-
- RegionTranslate(&rgnDst,
- pWin->drawable.x - ptOldOrg.x,
- pWin->drawable.y - ptOldOrg.y);
- RegionIntersect(&rgnDst, &pWin->borderClip, &rgnDst);
- if ((num = RegionNumRects(&rgnDst))) {
- if (pPriv->preRefresh)
- (*pPriv->preRefresh) (pPriv->pScrn, num, RegionRects(&rgnDst));
- }
- else {
- RegionUninit(&rgnDst);
- }
- }
+ ShadowScreenPtr pPriv = closure;
- pScreen->CopyWindow = pPriv->CopyWindow;
- (*pScreen->CopyWindow) (pWin, ptOldOrg, prgn);
- pScreen->CopyWindow = ShadowCopyWindow;
+ if (!pPriv->pScrn->vtSema)
+ return;
- if (num) {
- if (pPriv->postRefresh)
- (*pPriv->postRefresh) (pPriv->pScrn, num, RegionRects(&rgnDst));
- RegionUninit(&rgnDst);
- }
+ pPriv->preRefresh(pPriv->pScrn, RegionNumRects(reg), RegionRects(reg));
}
static void
-ShadowComposite(CARD8 op,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst, INT16 yDst, CARD16 width, CARD16 height)
+shadowfbReportPost(DamagePtr damage, RegionPtr reg, void *closure)
{
- ScreenPtr pScreen = pDst->pDrawable->pScreen;
- ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScreen);
- PictureScreenPtr ps = GetPictureScreen(pScreen);
- BoxRec box;
- BoxPtr extents;
- Bool boxNotEmpty = FALSE;
+ ShadowScreenPtr pPriv = closure;
- if (pPriv->vtSema && pDst->pDrawable->type == DRAWABLE_WINDOW) {
+ if (!pPriv->pScrn->vtSema)
+ return;
- box.x1 = pDst->pDrawable->x + xDst;
- box.y1 = pDst->pDrawable->y + yDst;
- box.x2 = box.x1 + width;
- box.y2 = box.y1 + height;
-
- extents = &pDst->pCompositeClip->extents;
- if (box.x1 < extents->x1)
- box.x1 = extents->x1;
- if (box.x2 > extents->x2)
- box.x2 = extents->x2;
- if (box.y1 < extents->y1)
- box.y1 = extents->y1;
- if (box.y2 > extents->y2)
- box.y2 = extents->y2;
-
- if (BOX_NOT_EMPTY(box)) {
- if (pPriv->preRefresh)
- (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
- boxNotEmpty = TRUE;
- }
- }
-
- ps->Composite = pPriv->Composite;
- (*ps->Composite) (op, pSrc, pMask, pDst, xSrc, ySrc,
- xMask, yMask, xDst, yDst, width, height);
- ps->Composite = ShadowComposite;
-
- if (pPriv->postRefresh && boxNotEmpty) {
- (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
- }
+ pPriv->postRefresh(pPriv->pScrn, RegionNumRects(reg), RegionRects(reg));
}
-/**********************************************************/
-
-static void ShadowValidateGC(GCPtr, unsigned long, DrawablePtr);
-static void ShadowChangeGC(GCPtr, unsigned long);
-static void ShadowCopyGC(GCPtr, unsigned long, GCPtr);
-static void ShadowDestroyGC(GCPtr);
-static void ShadowChangeClip(GCPtr, int, void *, int);
-static void ShadowDestroyClip(GCPtr);
-static void ShadowCopyClip(GCPtr, GCPtr);
-
-GCFuncs ShadowGCFuncs = {
- ShadowValidateGC, ShadowChangeGC, ShadowCopyGC, ShadowDestroyGC,
- ShadowChangeClip, ShadowDestroyClip, ShadowCopyClip
-};
-
-extern GCOps ShadowGCOps;
-
static Bool
-ShadowCreateGC(GCPtr pGC)
+ShadowCreateScreenResources(ScreenPtr pScreen)
{
- ScreenPtr pScreen = pGC->pScreen;
- ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScreen);
- ShadowGCPtr pGCPriv = GET_GC_PRIVATE(pGC);
Bool ret;
+ WindowPtr pWin = pScreen->root;
+ ShadowScreenPtr pPriv = shadowfbGetScreenPrivate(pScreen);
- pScreen->CreateGC = pPriv->CreateGC;
- if ((ret = (*pScreen->CreateGC) (pGC))) {
- pGCPriv->ops = NULL;
- pGCPriv->funcs = pGC->funcs;
- pGC->funcs = &ShadowGCFuncs;
- }
- pScreen->CreateGC = ShadowCreateGC;
-
- return ret;
-}
-
-static void
-ShadowValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDraw)
-{
- SHADOW_GC_FUNC_PROLOGUE(pGC);
- (*pGC->funcs->ValidateGC) (pGC, changes, pDraw);
- if (pDraw->type == DRAWABLE_WINDOW)
- pGCPriv->ops = pGC->ops; /* just so it's not NULL */
- else
- pGCPriv->ops = NULL;
- SHADOW_GC_FUNC_EPILOGUE(pGC);
-}
-
-static void
-ShadowDestroyGC(GCPtr pGC)
-{
- SHADOW_GC_FUNC_PROLOGUE(pGC);
- (*pGC->funcs->DestroyGC) (pGC);
- SHADOW_GC_FUNC_EPILOGUE(pGC);
-}
-
-static void
-ShadowChangeGC(GCPtr pGC, unsigned long mask)
-{
- SHADOW_GC_FUNC_PROLOGUE(pGC);
- (*pGC->funcs->ChangeGC) (pGC, mask);
- SHADOW_GC_FUNC_EPILOGUE(pGC);
-}
+ pScreen->CreateScreenResources = pPriv->CreateScreenResources;
+ ret = pScreen->CreateScreenResources(pScreen);
+ pPriv->CreateScreenResources = pScreen->CreateScreenResources;
+ pScreen->CreateScreenResources = ShadowCreateScreenResources;
-static void
-ShadowCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst)
-{
- SHADOW_GC_FUNC_PROLOGUE(pGCDst);
- (*pGCDst->funcs->CopyGC) (pGCSrc, mask, pGCDst);
- SHADOW_GC_FUNC_EPILOGUE(pGCDst);
-}
-
-static void
-ShadowChangeClip(GCPtr pGC, int type, void *pvalue, int nrects)
-{
- SHADOW_GC_FUNC_PROLOGUE(pGC);
- (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects);
- SHADOW_GC_FUNC_EPILOGUE(pGC);
-}
-
-static void
-ShadowCopyClip(GCPtr pgcDst, GCPtr pgcSrc)
-{
- SHADOW_GC_FUNC_PROLOGUE(pgcDst);
- (*pgcDst->funcs->CopyClip) (pgcDst, pgcSrc);
- SHADOW_GC_FUNC_EPILOGUE(pgcDst);
-}
-
-static void
-ShadowDestroyClip(GCPtr pGC)
-{
- SHADOW_GC_FUNC_PROLOGUE(pGC);
- (*pGC->funcs->DestroyClip) (pGC);
- SHADOW_GC_FUNC_EPILOGUE(pGC);
-}
-
-/**********************************************************/
-
-static void
-ShadowFillSpans(DrawablePtr pDraw,
- GC * pGC,
- int nInit, DDXPointPtr pptInit, int *pwidthInit, int fSorted)
-{
- SHADOW_GC_OP_PROLOGUE(pGC);
-
- if (IS_VISIBLE(pDraw) && nInit) {
- DDXPointPtr ppt = pptInit;
- int *pwidth = pwidthInit;
- int i = nInit;
- BoxRec box;
- Bool boxNotEmpty = FALSE;
-
- box.x1 = ppt->x;
- box.x2 = box.x1 + *pwidth;
- box.y2 = box.y1 = ppt->y;
-
- while (--i) {
- ppt++;
- pwidth++;
- if (box.x1 > ppt->x)
- box.x1 = ppt->x;
- if (box.x2 < (ppt->x + *pwidth))
- box.x2 = ppt->x + *pwidth;
- if (box.y1 > ppt->y)
- box.y1 = ppt->y;
- else if (box.y2 < ppt->y)
- box.y2 = ppt->y;
- }
-
- box.y2++;
-
- if (!pGC->miTranslate) {
- TRANSLATE_BOX(box, pDraw);
- }
- TRIM_BOX(box, pGC);
-
- if (BOX_NOT_EMPTY(box)) {
- if (pPriv->preRefresh)
- (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
- boxNotEmpty = TRUE;
- }
-
- (*pGC->ops->FillSpans) (pDraw, pGC, nInit, pptInit, pwidthInit,
- fSorted);
-
- if (boxNotEmpty && pPriv->postRefresh)
- (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
- }
- else
- (*pGC->ops->FillSpans) (pDraw, pGC, nInit, pptInit, pwidthInit,
- fSorted);
-
- SHADOW_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-ShadowSetSpans(DrawablePtr pDraw,
- GCPtr pGC,
- char *pcharsrc,
- DDXPointPtr pptInit, int *pwidthInit, int nspans, int fSorted)
-{
- SHADOW_GC_OP_PROLOGUE(pGC);
-
- if (IS_VISIBLE(pDraw) && nspans) {
- DDXPointPtr ppt = pptInit;
- int *pwidth = pwidthInit;
- int i = nspans;
- BoxRec box;
- Bool boxNotEmpty = FALSE;
-
- box.x1 = ppt->x;
- box.x2 = box.x1 + *pwidth;
- box.y2 = box.y1 = ppt->y;
-
- while (--i) {
- ppt++;
- pwidth++;
- if (box.x1 > ppt->x)
- box.x1 = ppt->x;
- if (box.x2 < (ppt->x + *pwidth))
- box.x2 = ppt->x + *pwidth;
- if (box.y1 > ppt->y)
- box.y1 = ppt->y;
- else if (box.y2 < ppt->y)
- box.y2 = ppt->y;
- }
-
- box.y2++;
-
- if (!pGC->miTranslate) {
- TRANSLATE_BOX(box, pDraw);
- }
- TRIM_BOX(box, pGC);
-
- if (BOX_NOT_EMPTY(box)) {
- if (pPriv->preRefresh)
- (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
- boxNotEmpty = TRUE;
- }
-
- (*pGC->ops->SetSpans) (pDraw, pGC, pcharsrc, pptInit,
- pwidthInit, nspans, fSorted);
-
- if (boxNotEmpty && pPriv->postRefresh)
- (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
- }
- else
- (*pGC->ops->SetSpans) (pDraw, pGC, pcharsrc, pptInit,
- pwidthInit, nspans, fSorted);
-
- SHADOW_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-ShadowPutImage(DrawablePtr pDraw,
- GCPtr pGC,
- int depth,
- int x, int y, int w, int h,
- int leftPad, int format, char *pImage)
-{
- BoxRec box;
- Bool boxNotEmpty = FALSE;
-
- SHADOW_GC_OP_PROLOGUE(pGC);
-
- if (IS_VISIBLE(pDraw)) {
- box.x1 = x + pDraw->x;
- box.x2 = box.x1 + w;
- box.y1 = y + pDraw->y;
- box.y2 = box.y1 + h;
+ /* this might look like it leaks, but the damage code reaps listeners
+ * when their drawable disappears.
+ */
+ if (ret) {
+ DamagePtr damage;
- TRIM_BOX(box, pGC);
- if (BOX_NOT_EMPTY(box)) {
- if (pPriv->preRefresh)
- (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
- boxNotEmpty = TRUE;
+ if (pPriv->preRefresh) {
+ damage = DamageCreate(shadowfbReportPre, NULL,
+ DamageReportRawRegion,
+ TRUE, pScreen, pPriv);
+ DamageRegister(&pWin->drawable, damage);
}
- }
-
- (*pGC->ops->PutImage) (pDraw, pGC, depth, x, y, w, h,
- leftPad, format, pImage);
-
- if (boxNotEmpty && pPriv->postRefresh)
- (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
-
- SHADOW_GC_OP_EPILOGUE(pGC);
-}
-
-static RegionPtr
-ShadowCopyArea(DrawablePtr pSrc,
- DrawablePtr pDst,
- GC * pGC,
- int srcx, int srcy, int width, int height, int dstx, int dsty)
-{
- RegionPtr ret;
- BoxRec box;
- Bool boxNotEmpty = FALSE;
-
- SHADOW_GC_OP_PROLOGUE(pGC);
-
- if (IS_VISIBLE(pDst)) {
- box.x1 = dstx + pDst->x;
- box.x2 = box.x1 + width;
- box.y1 = dsty + pDst->y;
- box.y2 = box.y1 + height;
-
- TRIM_BOX(box, pGC);
- if (BOX_NOT_EMPTY(box)) {
- if (pPriv->preRefresh)
- (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
- boxNotEmpty = TRUE;
+ if (pPriv->postRefresh) {
+ damage = DamageCreate(shadowfbReportPost, NULL,
+ DamageReportRawRegion,
+ TRUE, pScreen, pPriv);
+ DamageSetReportAfterOp(damage, TRUE);
+ DamageRegister(&pWin->drawable, damage);
}
}
- ret = (*pGC->ops->CopyArea) (pSrc, pDst,
- pGC, srcx, srcy, width, height, dstx, dsty);
-
- if (boxNotEmpty && pPriv->postRefresh)
- (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
-
- SHADOW_GC_OP_EPILOGUE(pGC);
-
return ret;
}
-static RegionPtr
-ShadowCopyPlane(DrawablePtr pSrc,
- DrawablePtr pDst,
- GCPtr pGC,
- int srcx, int srcy,
- int width, int height,
- int dstx, int dsty, unsigned long bitPlane)
-{
- RegionPtr ret;
- BoxRec box;
- Bool boxNotEmpty = FALSE;
-
- SHADOW_GC_OP_PROLOGUE(pGC);
-
- if (IS_VISIBLE(pDst)) {
- box.x1 = dstx + pDst->x;
- box.x2 = box.x1 + width;
- box.y1 = dsty + pDst->y;
- box.y2 = box.y1 + height;
-
- TRIM_BOX(box, pGC);
- if (BOX_NOT_EMPTY(box)) {
- if (pPriv->preRefresh)
- (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
- boxNotEmpty = TRUE;
- }
- }
-
- ret = (*pGC->ops->CopyPlane) (pSrc, pDst,
- pGC, srcx, srcy, width, height, dstx, dsty,
- bitPlane);
-
- if (boxNotEmpty && pPriv->postRefresh)
- (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
-
- SHADOW_GC_OP_EPILOGUE(pGC);
-
- return ret;
-}
-
-static void
-ShadowPolyPoint(DrawablePtr pDraw,
- GCPtr pGC, int mode, int nptInit, xPoint * pptInit)
-{
- BoxRec box;
- Bool boxNotEmpty = FALSE;
-
- SHADOW_GC_OP_PROLOGUE(pGC);
-
- if (IS_VISIBLE(pDraw) && nptInit) {
- xPoint *ppt = pptInit;
- int npt = nptInit;
-
- box.x2 = box.x1 = pptInit->x;
- box.y2 = box.y1 = pptInit->y;
-
- /* this could be slow if the points were spread out */
-
- while (--npt) {
- ppt++;
- if (box.x1 > ppt->x)
- box.x1 = ppt->x;
- else if (box.x2 < ppt->x)
- box.x2 = ppt->x;
- if (box.y1 > ppt->y)
- box.y1 = ppt->y;
- else if (box.y2 < ppt->y)
- box.y2 = ppt->y;
- }
-
- box.x2++;
- box.y2++;
-
- TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC);
- if (BOX_NOT_EMPTY(box)) {
- if (pPriv->preRefresh)
- (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
- boxNotEmpty = TRUE;
- }
- }
-
- (*pGC->ops->PolyPoint) (pDraw, pGC, mode, nptInit, pptInit);
-
- if (boxNotEmpty && pPriv->postRefresh)
- (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
-
- SHADOW_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-ShadowPolylines(DrawablePtr pDraw,
- GCPtr pGC, int mode, int nptInit, DDXPointPtr pptInit)
-{
- BoxRec box;
- Bool boxNotEmpty = FALSE;
-
- SHADOW_GC_OP_PROLOGUE(pGC);
-
- if (IS_VISIBLE(pDraw) && nptInit) {
- DDXPointPtr ppt = pptInit;
- int npt = nptInit;
- int extra = pGC->lineWidth >> 1;
-
- box.x2 = box.x1 = pptInit->x;
- box.y2 = box.y1 = pptInit->y;
-
- if (npt > 1) {
- if (pGC->joinStyle == JoinMiter)
- extra = 6 * pGC->lineWidth;
- else if (pGC->capStyle == CapProjecting)
- extra = pGC->lineWidth;
- }
-
- if (mode == CoordModePrevious) {
- int x = box.x1;
- int y = box.y1;
-
- while (--npt) {
- ppt++;
- x += ppt->x;
- y += ppt->y;
- if (box.x1 > x)
- box.x1 = x;
- else if (box.x2 < x)
- box.x2 = x;
- if (box.y1 > y)
- box.y1 = y;
- else if (box.y2 < y)
- box.y2 = y;
- }
- }
- else {
- while (--npt) {
- ppt++;
- if (box.x1 > ppt->x)
- box.x1 = ppt->x;
- else if (box.x2 < ppt->x)
- box.x2 = ppt->x;
- if (box.y1 > ppt->y)
- box.y1 = ppt->y;
- else if (box.y2 < ppt->y)
- box.y2 = ppt->y;
- }
- }
-
- box.x2++;
- box.y2++;
-
- if (extra) {
- box.x1 -= extra;
- box.x2 += extra;
- box.y1 -= extra;
- box.y2 += extra;
- }
-
- TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC);
- if (BOX_NOT_EMPTY(box)) {
- if (pPriv->preRefresh)
- (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
- boxNotEmpty = TRUE;
- }
- }
-
- (*pGC->ops->Polylines) (pDraw, pGC, mode, nptInit, pptInit);
-
- if (boxNotEmpty && pPriv->postRefresh)
- (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
-
- SHADOW_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-ShadowPolySegment(DrawablePtr pDraw,
- GCPtr pGC, int nsegInit, xSegment * pSegInit)
-{
- BoxRec box;
- Bool boxNotEmpty = FALSE;
-
- SHADOW_GC_OP_PROLOGUE(pGC);
-
- if (IS_VISIBLE(pDraw) && nsegInit) {
- int extra = pGC->lineWidth;
- xSegment *pSeg = pSegInit;
- int nseg = nsegInit;
-
- if (pGC->capStyle != CapProjecting)
- extra >>= 1;
-
- if (pSeg->x2 > pSeg->x1) {
- box.x1 = pSeg->x1;
- box.x2 = pSeg->x2;
- }
- else {
- box.x2 = pSeg->x1;
- box.x1 = pSeg->x2;
- }
-
- if (pSeg->y2 > pSeg->y1) {
- box.y1 = pSeg->y1;
- box.y2 = pSeg->y2;
- }
- else {
- box.y2 = pSeg->y1;
- box.y1 = pSeg->y2;
- }
-
- while (--nseg) {
- pSeg++;
- if (pSeg->x2 > pSeg->x1) {
- if (pSeg->x1 < box.x1)
- box.x1 = pSeg->x1;
- if (pSeg->x2 > box.x2)
- box.x2 = pSeg->x2;
- }
- else {
- if (pSeg->x2 < box.x1)
- box.x1 = pSeg->x2;
- if (pSeg->x1 > box.x2)
- box.x2 = pSeg->x1;
- }
- if (pSeg->y2 > pSeg->y1) {
- if (pSeg->y1 < box.y1)
- box.y1 = pSeg->y1;
- if (pSeg->y2 > box.y2)
- box.y2 = pSeg->y2;
- }
- else {
- if (pSeg->y2 < box.y1)
- box.y1 = pSeg->y2;
- if (pSeg->y1 > box.y2)
- box.y2 = pSeg->y1;
- }
- }
-
- box.x2++;
- box.y2++;
-
- if (extra) {
- box.x1 -= extra;
- box.x2 += extra;
- box.y1 -= extra;
- box.y2 += extra;
- }
-
- TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC);
- if (BOX_NOT_EMPTY(box)) {
- if (pPriv->preRefresh)
- (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
- boxNotEmpty = TRUE;
- }
- }
-
- (*pGC->ops->PolySegment) (pDraw, pGC, nsegInit, pSegInit);
-
- if (boxNotEmpty && pPriv->postRefresh)
- (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
-
- SHADOW_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-ShadowPolyRectangle(DrawablePtr pDraw,
- GCPtr pGC, int nRectsInit, xRectangle *pRectsInit)
-{
- BoxRec box;
- BoxPtr pBoxInit = NULL;
- Bool boxNotEmpty = FALSE;
- int num = 0;
-
- SHADOW_GC_OP_PROLOGUE(pGC);
-
- if (IS_VISIBLE(pDraw) && nRectsInit) {
- xRectangle *pRects = pRectsInit;
- int nRects = nRectsInit;
-
- if (nRects >= 32) {
- int extra = pGC->lineWidth >> 1;
-
- box.x1 = pRects->x;
- box.x2 = box.x1 + pRects->width;
- box.y1 = pRects->y;
- box.y2 = box.y1 + pRects->height;
-
- while (--nRects) {
- pRects++;
- if (box.x1 > pRects->x)
- box.x1 = pRects->x;
- if (box.x2 < (pRects->x + pRects->width))
- box.x2 = pRects->x + pRects->width;
- if (box.y1 > pRects->y)
- box.y1 = pRects->y;
- if (box.y2 < (pRects->y + pRects->height))
- box.y2 = pRects->y + pRects->height;
- }
-
- if (extra) {
- box.x1 -= extra;
- box.x2 += extra;
- box.y1 -= extra;
- box.y2 += extra;
- }
-
- box.x2++;
- box.y2++;
-
- TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC);
- if (BOX_NOT_EMPTY(box)) {
- if (pPriv->preRefresh)
- (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
- boxNotEmpty = TRUE;
- }
- }
- else {
- BoxPtr pbox;
- int offset1, offset2, offset3;
-
- offset2 = pGC->lineWidth;
- if (!offset2)
- offset2 = 1;
- offset1 = offset2 >> 1;
- offset3 = offset2 - offset1;
-
- pBoxInit = (BoxPtr) malloc(nRects * 4 * sizeof(BoxRec));
- pbox = pBoxInit;
-
- while (nRects--) {
- pbox->x1 = pRects->x - offset1;
- pbox->y1 = pRects->y - offset1;
- pbox->x2 = pbox->x1 + pRects->width + offset2;
- pbox->y2 = pbox->y1 + offset2;
- TRIM_AND_TRANSLATE_BOX((*pbox), pDraw, pGC);
- if (BOX_NOT_EMPTY((*pbox))) {
- num++;
- pbox++;
- }
-
- pbox->x1 = pRects->x - offset1;
- pbox->y1 = pRects->y + offset3;
- pbox->x2 = pbox->x1 + offset2;
- pbox->y2 = pbox->y1 + pRects->height - offset2;
- TRIM_AND_TRANSLATE_BOX((*pbox), pDraw, pGC);
- if (BOX_NOT_EMPTY((*pbox))) {
- num++;
- pbox++;
- }
-
- pbox->x1 = pRects->x + pRects->width - offset1;
- pbox->y1 = pRects->y + offset3;
- pbox->x2 = pbox->x1 + offset2;
- pbox->y2 = pbox->y1 + pRects->height - offset2;
- TRIM_AND_TRANSLATE_BOX((*pbox), pDraw, pGC);
- if (BOX_NOT_EMPTY((*pbox))) {
- num++;
- pbox++;
- }
-
- pbox->x1 = pRects->x - offset1;
- pbox->y1 = pRects->y + pRects->height - offset1;
- pbox->x2 = pbox->x1 + pRects->width + offset2;
- pbox->y2 = pbox->y1 + offset2;
- TRIM_AND_TRANSLATE_BOX((*pbox), pDraw, pGC);
- if (BOX_NOT_EMPTY((*pbox))) {
- num++;
- pbox++;
- }
-
- pRects++;
- }
-
- if (num) {
- if (pPriv->preRefresh)
- (*pPriv->preRefresh) (pPriv->pScrn, num, pBoxInit);
- }
- else {
- free(pBoxInit);
- }
- }
- }
-
- (*pGC->ops->PolyRectangle) (pDraw, pGC, nRectsInit, pRectsInit);
-
- if (boxNotEmpty && pPriv->postRefresh) {
- (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
- }
- else if (num) {
- if (pPriv->postRefresh)
- (*pPriv->postRefresh) (pPriv->pScrn, num, pBoxInit);
- free(pBoxInit);
- }
-
- SHADOW_GC_OP_EPILOGUE(pGC);
-
-}
-
-static void
-ShadowPolyArc(DrawablePtr pDraw, GCPtr pGC, int narcsInit, xArc * parcsInit)
-{
- BoxRec box;
- Bool boxNotEmpty = FALSE;
-
- SHADOW_GC_OP_PROLOGUE(pGC);
-
- if (IS_VISIBLE(pDraw) && narcsInit) {
- int narcs = narcsInit;
- xArc *parcs = parcsInit;
- int extra = pGC->lineWidth >> 1;
-
- box.x1 = parcs->x;
- box.x2 = box.x1 + parcs->width;
- box.y1 = parcs->y;
- box.y2 = box.y1 + parcs->height;
-
- /* should I break these up instead ? */
-
- while (--narcs) {
- parcs++;
- if (box.x1 > parcs->x)
- box.x1 = parcs->x;
- if (box.x2 < (parcs->x + parcs->width))
- box.x2 = parcs->x + parcs->width;
- if (box.y1 > parcs->y)
- box.y1 = parcs->y;
- if (box.y2 < (parcs->y + parcs->height))
- box.y2 = parcs->y + parcs->height;
- }
-
- if (extra) {
- box.x1 -= extra;
- box.x2 += extra;
- box.y1 -= extra;
- box.y2 += extra;
- }
-
- box.x2++;
- box.y2++;
-
- TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC);
- if (BOX_NOT_EMPTY(box)) {
- if (pPriv->preRefresh)
- (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
- boxNotEmpty = TRUE;
- }
- }
-
- (*pGC->ops->PolyArc) (pDraw, pGC, narcsInit, parcsInit);
-
- if (boxNotEmpty && pPriv->postRefresh)
- (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
-
- SHADOW_GC_OP_EPILOGUE(pGC);
-
-}
-
-static void
-ShadowFillPolygon(DrawablePtr pDraw,
- GCPtr pGC,
- int shape, int mode, int count, DDXPointPtr pptInit)
-{
- SHADOW_GC_OP_PROLOGUE(pGC);
-
- if (IS_VISIBLE(pDraw) && (count > 2)) {
- DDXPointPtr ppt = pptInit;
- int i = count;
- BoxRec box;
- Bool boxNotEmpty = FALSE;
-
- box.x2 = box.x1 = ppt->x;
- box.y2 = box.y1 = ppt->y;
-
- if (mode != CoordModeOrigin) {
- int x = box.x1;
- int y = box.y1;
-
- while (--i) {
- ppt++;
- x += ppt->x;
- y += ppt->y;
- if (box.x1 > x)
- box.x1 = x;
- else if (box.x2 < x)
- box.x2 = x;
- if (box.y1 > y)
- box.y1 = y;
- else if (box.y2 < y)
- box.y2 = y;
- }
- }
- else {
- while (--i) {
- ppt++;
- if (box.x1 > ppt->x)
- box.x1 = ppt->x;
- else if (box.x2 < ppt->x)
- box.x2 = ppt->x;
- if (box.y1 > ppt->y)
- box.y1 = ppt->y;
- else if (box.y2 < ppt->y)
- box.y2 = ppt->y;
- }
- }
-
- box.x2++;
- box.y2++;
-
- TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC);
- if (BOX_NOT_EMPTY(box)) {
- if (pPriv->preRefresh)
- (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
- boxNotEmpty = TRUE;
- }
-
- (*pGC->ops->FillPolygon) (pDraw, pGC, shape, mode, count, pptInit);
-
- if (boxNotEmpty && pPriv->postRefresh)
- (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
- }
- else
- (*pGC->ops->FillPolygon) (pDraw, pGC, shape, mode, count, pptInit);
-
- SHADOW_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-ShadowPolyFillRect(DrawablePtr pDraw,
- GCPtr pGC, int nRectsInit, xRectangle *pRectsInit)
-{
- SHADOW_GC_OP_PROLOGUE(pGC);
-
- if (IS_VISIBLE(pDraw) && nRectsInit) {
- BoxRec box;
- Bool boxNotEmpty = FALSE;
- xRectangle *pRects = pRectsInit;
- int nRects = nRectsInit;
-
- box.x1 = pRects->x;
- box.x2 = box.x1 + pRects->width;
- box.y1 = pRects->y;
- box.y2 = box.y1 + pRects->height;
-
- while (--nRects) {
- pRects++;
- if (box.x1 > pRects->x)
- box.x1 = pRects->x;
- if (box.x2 < (pRects->x + pRects->width))
- box.x2 = pRects->x + pRects->width;
- if (box.y1 > pRects->y)
- box.y1 = pRects->y;
- if (box.y2 < (pRects->y + pRects->height))
- box.y2 = pRects->y + pRects->height;
- }
-
- /* cfb messes with the pRectsInit so we have to do our
- calculations first */
-
- TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC);
- if (BOX_NOT_EMPTY(box)) {
- if (pPriv->preRefresh)
- (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
- boxNotEmpty = TRUE;
- }
-
- (*pGC->ops->PolyFillRect) (pDraw, pGC, nRectsInit, pRectsInit);
-
- if (boxNotEmpty && pPriv->postRefresh)
- (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
- }
- else
- (*pGC->ops->PolyFillRect) (pDraw, pGC, nRectsInit, pRectsInit);
-
- SHADOW_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-ShadowPolyFillArc(DrawablePtr pDraw, GCPtr pGC, int narcsInit, xArc * parcsInit)
-{
- BoxRec box;
- Bool boxNotEmpty = FALSE;
-
- SHADOW_GC_OP_PROLOGUE(pGC);
-
- if (IS_VISIBLE(pDraw) && narcsInit) {
- xArc *parcs = parcsInit;
- int narcs = narcsInit;
-
- box.x1 = parcs->x;
- box.x2 = box.x1 + parcs->width;
- box.y1 = parcs->y;
- box.y2 = box.y1 + parcs->height;
-
- /* should I break these up instead ? */
-
- while (--narcs) {
- parcs++;
- if (box.x1 > parcs->x)
- box.x1 = parcs->x;
- if (box.x2 < (parcs->x + parcs->width))
- box.x2 = parcs->x + parcs->width;
- if (box.y1 > parcs->y)
- box.y1 = parcs->y;
- if (box.y2 < (parcs->y + parcs->height))
- box.y2 = parcs->y + parcs->height;
- }
-
- TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC);
- if (BOX_NOT_EMPTY(box)) {
- if (pPriv->preRefresh)
- (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
- boxNotEmpty = TRUE;
- }
- }
-
- (*pGC->ops->PolyFillArc) (pDraw, pGC, narcsInit, parcsInit);
-
- if (boxNotEmpty && pPriv->postRefresh)
- (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
-
- SHADOW_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-ShadowTextExtent(FontPtr pFont, int count, char *chars,
- FontEncoding fontEncoding, BoxPtr box)
-{
- unsigned long n, i;
- int w;
- CharInfoPtr charinfo[255]; /* encoding only has 1 byte for count */
-
- GetGlyphs(pFont, (unsigned long) count, (unsigned char *) chars,
- fontEncoding, &n, charinfo);
- w = 0;
- for (i = 0; i < n; i++) {
- w += charinfo[i]->metrics.characterWidth;
- }
- if (i) {
- w += charinfo[i - 1]->metrics.rightSideBearing;
- }
-
- box->x1 = 0;
- if (n) {
- if (charinfo[0]->metrics.leftSideBearing < 0) {
- box->x1 = charinfo[0]->metrics.leftSideBearing;
- }
- }
- box->x2 = w;
- box->y1 = -FONTMAXBOUNDS(pFont, ascent);
- box->y2 = FONTMAXBOUNDS(pFont, descent);
-}
-
-static void
-ShadowFontToBox(BoxPtr BB, DrawablePtr pDrawable, GCPtr pGC, int x, int y,
- int count, char *chars, int wide)
-{
- FontPtr pFont;
-
- pFont = pGC->font;
- if (pFont->info.constantWidth) {
- int ascent, descent, left, right = 0;
-
- ascent = max(pFont->info.fontAscent, pFont->info.maxbounds.ascent);
- descent = max(pFont->info.fontDescent, pFont->info.maxbounds.descent);
- left = pFont->info.maxbounds.leftSideBearing;
- if (count > 0) {
- right = (count - 1) * pFont->info.maxbounds.characterWidth;
- }
- right += pFont->info.maxbounds.rightSideBearing;
- BB->x1 =
- max(pDrawable->x + x - left,
- RegionExtents(&((WindowPtr) pDrawable)->winSize)->x1);
- BB->y1 =
- max(pDrawable->y + y - ascent,
- RegionExtents(&((WindowPtr) pDrawable)->winSize)->y1);
- BB->x2 =
- min(pDrawable->x + x + right,
- RegionExtents(&((WindowPtr) pDrawable)->winSize)->x2);
- BB->y2 =
- min(pDrawable->y + y + descent,
- RegionExtents(&((WindowPtr) pDrawable)->winSize)->y2);
- }
- else {
- ShadowTextExtent(pFont, count, chars, wide ? (FONTLASTROW(pFont) == 0)
- ? Linear16Bit : TwoD16Bit : Linear8Bit, BB);
- BB->x1 =
- max(pDrawable->x + x + BB->x1,
- RegionExtents(&((WindowPtr) pDrawable)->winSize)->x1);
- BB->y1 =
- max(pDrawable->y + y + BB->y1,
- RegionExtents(&((WindowPtr) pDrawable)->winSize)->y1);
- BB->x2 =
- min(pDrawable->x + x + BB->x2,
- RegionExtents(&((WindowPtr) pDrawable)->winSize)->x2);
- BB->y2 =
- min(pDrawable->y + y + BB->y2,
- RegionExtents(&((WindowPtr) pDrawable)->winSize)->y2);
- }
-}
-
-static int
-ShadowPolyText8(DrawablePtr pDraw,
- GCPtr pGC, int x, int y, int count, char *chars)
-{
- int width;
- BoxRec box;
- Bool boxNotEmpty = FALSE;
-
- SHADOW_GC_OP_PROLOGUE(pGC);
-
- if (IS_VISIBLE(pDraw)) {
- ShadowFontToBox(&box, pDraw, pGC, x, y, count, chars, 0);
-
- TRIM_BOX(box, pGC);
- if (BOX_NOT_EMPTY(box)) {
- if (pPriv->preRefresh)
- (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
- boxNotEmpty = TRUE;
- }
- }
-
- width = (*pGC->ops->PolyText8) (pDraw, pGC, x, y, count, chars);
-
- if (boxNotEmpty && pPriv->postRefresh)
- (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
-
- SHADOW_GC_OP_EPILOGUE(pGC);
-
- return width;
-}
-
-static int
-ShadowPolyText16(DrawablePtr pDraw,
- GCPtr pGC, int x, int y, int count, unsigned short *chars)
-{
- int width;
- BoxRec box;
- Bool boxNotEmpty = FALSE;
-
- SHADOW_GC_OP_PROLOGUE(pGC);
-
- if (IS_VISIBLE(pDraw)) {
- ShadowFontToBox(&box, pDraw, pGC, x, y, count, (char *) chars, 1);
-
- TRIM_BOX(box, pGC);
- if (BOX_NOT_EMPTY(box)) {
- if (pPriv->preRefresh)
- (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
- boxNotEmpty = TRUE;
- }
- }
-
- width = (*pGC->ops->PolyText16) (pDraw, pGC, x, y, count, chars);
-
- if (boxNotEmpty && pPriv->postRefresh)
- (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
-
- SHADOW_GC_OP_EPILOGUE(pGC);
-
- return width;
-}
-
-static void
-ShadowImageText8(DrawablePtr pDraw,
- GCPtr pGC, int x, int y, int count, char *chars)
-{
- BoxRec box;
- Bool boxNotEmpty = FALSE;
-
- SHADOW_GC_OP_PROLOGUE(pGC);
-
- if (IS_VISIBLE(pDraw) && count) {
- int top, bot, Min, Max;
-
- top = max(FONTMAXBOUNDS(pGC->font, ascent), FONTASCENT(pGC->font));
- bot = max(FONTMAXBOUNDS(pGC->font, descent), FONTDESCENT(pGC->font));
-
- Min = count * FONTMINBOUNDS(pGC->font, characterWidth);
- if (Min > 0)
- Min = 0;
- Max = count * FONTMAXBOUNDS(pGC->font, characterWidth);
- if (Max < 0)
- Max = 0;
-
- /* ugh */
- box.x1 = pDraw->x + x + Min + FONTMINBOUNDS(pGC->font, leftSideBearing);
- box.x2 = pDraw->x + x + Max +
- FONTMAXBOUNDS(pGC->font, rightSideBearing);
-
- box.y1 = pDraw->y + y - top;
- box.y2 = pDraw->y + y + bot;
-
- TRIM_BOX(box, pGC);
- if (BOX_NOT_EMPTY(box)) {
- if (pPriv->preRefresh)
- (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
- boxNotEmpty = TRUE;
- }
- }
-
- (*pGC->ops->ImageText8) (pDraw, pGC, x, y, count, chars);
-
- if (boxNotEmpty && pPriv->postRefresh)
- (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
-
- SHADOW_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-ShadowImageText16(DrawablePtr pDraw,
- GCPtr pGC, int x, int y, int count, unsigned short *chars)
-{
- BoxRec box;
- Bool boxNotEmpty = FALSE;
-
- SHADOW_GC_OP_PROLOGUE(pGC);
-
- if (IS_VISIBLE(pDraw) && count) {
- int top, bot, Min, Max;
-
- top = max(FONTMAXBOUNDS(pGC->font, ascent), FONTASCENT(pGC->font));
- bot = max(FONTMAXBOUNDS(pGC->font, descent), FONTDESCENT(pGC->font));
-
- Min = count * FONTMINBOUNDS(pGC->font, characterWidth);
- if (Min > 0)
- Min = 0;
- Max = count * FONTMAXBOUNDS(pGC->font, characterWidth);
- if (Max < 0)
- Max = 0;
-
- /* ugh */
- box.x1 = pDraw->x + x + Min + FONTMINBOUNDS(pGC->font, leftSideBearing);
- box.x2 = pDraw->x + x + Max +
- FONTMAXBOUNDS(pGC->font, rightSideBearing);
-
- box.y1 = pDraw->y + y - top;
- box.y2 = pDraw->y + y + bot;
-
- TRIM_BOX(box, pGC);
- if (BOX_NOT_EMPTY(box)) {
- if (pPriv->preRefresh)
- (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
- boxNotEmpty = TRUE;
- }
- }
-
- (*pGC->ops->ImageText16) (pDraw, pGC, x, y, count, chars);
-
- if (boxNotEmpty && pPriv->postRefresh)
- (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
-
- SHADOW_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-ShadowImageGlyphBlt(DrawablePtr pDraw,
- GCPtr pGC,
- int x, int y,
- unsigned int nglyphInit,
- CharInfoPtr * ppciInit, void *pglyphBase)
-{
- BoxRec box;
- Bool boxNotEmpty = FALSE;
-
- SHADOW_GC_OP_PROLOGUE(pGC);
-
- if (IS_VISIBLE(pDraw) && nglyphInit) {
- CharInfoPtr *ppci = ppciInit;
- unsigned int nglyph = nglyphInit;
- int top, bot, width = 0;
-
- top = max(FONTMAXBOUNDS(pGC->font, ascent), FONTASCENT(pGC->font));
- bot = max(FONTMAXBOUNDS(pGC->font, descent), FONTDESCENT(pGC->font));
-
- box.x1 = ppci[0]->metrics.leftSideBearing;
- if (box.x1 > 0)
- box.x1 = 0;
- box.x2 = ppci[nglyph - 1]->metrics.rightSideBearing -
- ppci[nglyph - 1]->metrics.characterWidth;
- if (box.x2 < 0)
- box.x2 = 0;
-
- box.x2 += pDraw->x + x;
- box.x1 += pDraw->x + x;
-
- while (nglyph--) {
- width += (*ppci)->metrics.characterWidth;
- ppci++;
- }
-
- if (width > 0)
- box.x2 += width;
- else
- box.x1 += width;
-
- box.y1 = pDraw->y + y - top;
- box.y2 = pDraw->y + y + bot;
-
- TRIM_BOX(box, pGC);
- if (BOX_NOT_EMPTY(box)) {
- if (pPriv->preRefresh)
- (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
- boxNotEmpty = TRUE;
- }
- }
-
- (*pGC->ops->ImageGlyphBlt) (pDraw, pGC, x, y, nglyphInit,
- ppciInit, pglyphBase);
-
- if (boxNotEmpty && pPriv->postRefresh)
- (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
-
- SHADOW_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-ShadowPolyGlyphBlt(DrawablePtr pDraw,
- GCPtr pGC,
- int x, int y,
- unsigned int nglyphInit,
- CharInfoPtr * ppciInit, void *pglyphBase)
-{
- BoxRec box;
- Bool boxNotEmpty = FALSE;
-
- SHADOW_GC_OP_PROLOGUE(pGC);
-
- if (IS_VISIBLE(pDraw) && nglyphInit) {
- CharInfoPtr *ppci = ppciInit;
- unsigned int nglyph = nglyphInit;
-
- /* ugh */
- box.x1 = pDraw->x + x + ppci[0]->metrics.leftSideBearing;
- box.x2 = pDraw->x + x + ppci[nglyph - 1]->metrics.rightSideBearing;
-
- if (nglyph > 1) {
- int width = 0;
-
- while (--nglyph) {
- width += (*ppci)->metrics.characterWidth;
- ppci++;
- }
-
- if (width > 0)
- box.x2 += width;
- else
- box.x1 += width;
- }
-
- box.y1 = pDraw->y + y - FONTMAXBOUNDS(pGC->font, ascent);
- box.y2 = pDraw->y + y + FONTMAXBOUNDS(pGC->font, descent);
-
- TRIM_BOX(box, pGC);
- if (BOX_NOT_EMPTY(box)) {
- if (pPriv->preRefresh)
- (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
- boxNotEmpty = TRUE;
- }
- }
-
- (*pGC->ops->PolyGlyphBlt) (pDraw, pGC, x, y, nglyphInit,
- ppciInit, pglyphBase);
-
- if (boxNotEmpty && pPriv->postRefresh)
- (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
-
- SHADOW_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-ShadowPushPixels(GCPtr pGC,
- PixmapPtr pBitMap,
- DrawablePtr pDraw, int dx, int dy, int xOrg, int yOrg)
+static Bool
+ShadowCloseScreen(ScreenPtr pScreen)
{
- BoxRec box;
- Bool boxNotEmpty = FALSE;
-
- SHADOW_GC_OP_PROLOGUE(pGC);
-
- if (IS_VISIBLE(pDraw)) {
- box.x1 = xOrg;
- box.y1 = yOrg;
-
- if (!pGC->miTranslate) {
- box.x1 += pDraw->x;
- box.y1 += pDraw->y;
- }
+ ShadowScreenPtr pPriv = shadowfbGetScreenPrivate(pScreen);
- box.x2 = box.x1 + dx;
- box.y2 = box.y1 + dy;
-
- TRIM_BOX(box, pGC);
- if (BOX_NOT_EMPTY(box)) {
- if (pPriv->preRefresh)
- (*pPriv->preRefresh) (pPriv->pScrn, 1, &box);
- boxNotEmpty = TRUE;
- }
- }
-
- (*pGC->ops->PushPixels) (pGC, pBitMap, pDraw, dx, dy, xOrg, yOrg);
+ pScreen->CloseScreen = pPriv->CloseScreen;
+ pScreen->CreateScreenResources = pPriv->CreateScreenResources;
- if (boxNotEmpty && pPriv->postRefresh)
- (*pPriv->postRefresh) (pPriv->pScrn, 1, &box);
+ free(pPriv);
- SHADOW_GC_OP_EPILOGUE(pGC);
+ return (*pScreen->CloseScreen) (pScreen);
}
-
-GCOps ShadowGCOps = {
- ShadowFillSpans, ShadowSetSpans,
- ShadowPutImage, ShadowCopyArea,
- ShadowCopyPlane, ShadowPolyPoint,
- ShadowPolylines, ShadowPolySegment,
- ShadowPolyRectangle, ShadowPolyArc,
- ShadowFillPolygon, ShadowPolyFillRect,
- ShadowPolyFillArc, ShadowPolyText8,
- ShadowPolyText16, ShadowImageText8,
- ShadowImageText16, ShadowImageGlyphBlt,
- ShadowPolyGlyphBlt, ShadowPushPixels,
-};
diff --git a/xorg-server/hw/xfree86/xorg-wrapper.c b/xorg-server/hw/xfree86/xorg-wrapper.c
index 90c8c11ef..4ea47331b 100644
--- a/xorg-server/hw/xfree86/xorg-wrapper.c
+++ b/xorg-server/hw/xfree86/xorg-wrapper.c
@@ -25,6 +25,7 @@
#include "dix-config.h"
+#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <stdint.h>
@@ -34,12 +35,17 @@
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <sys/types.h>
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+#include <sys/consio.h>
+#endif
#include <unistd.h>
-#include <drm/drm.h>
+#include <drm.h>
#include <xf86drm.h> /* For DRM_DEV_NAME */
#define CONFIG_FILE SYSCONFDIR "/X11/Xwrapper.config"
+static const char *progname;
+
enum { ROOT_ONLY, CONSOLE_ONLY, ANYBODY };
/* KISS non locale / LANG parsing isspace version */
@@ -88,18 +94,21 @@ static void parse_config(int *allowed, int *needs_root_rights)
/* Split in a key + value pair */
equals = strchr(stripped, '=');
if (!equals) {
- fprintf(stderr, "Syntax error at %s line %d\n", CONFIG_FILE, line);
+ fprintf(stderr, "%s: Syntax error at %s line %d\n", progname,
+ CONFIG_FILE, line);
exit(1);
}
*equals = 0;
key = strip(stripped); /* To remove trailing whitespace from key */
value = strip(equals + 1); /* To remove leading whitespace from val */
if (!key[0]) {
- fprintf(stderr, "Missing key at %s line %d\n", CONFIG_FILE, line);
+ fprintf(stderr, "%s: Missing key at %s line %d\n", progname,
+ CONFIG_FILE, line);
exit(1);
}
if (!value[0]) {
- fprintf(stderr, "Missing value at %s line %d\n", CONFIG_FILE, line);
+ fprintf(stderr, "%s: Missing value at %s line %d\n", progname,
+ CONFIG_FILE, line);
exit(1);
}
@@ -113,8 +122,8 @@ static void parse_config(int *allowed, int *needs_root_rights)
*allowed = ANYBODY;
else {
fprintf(stderr,
- "Invalid value '%s' for 'allowed_users' at %s line %d\n",
- value, CONFIG_FILE, line);
+ "%s: Invalid value '%s' for 'allowed_users' at %s line %d\n",
+ progname, value, CONFIG_FILE, line);
exit(1);
}
}
@@ -127,8 +136,8 @@ static void parse_config(int *allowed, int *needs_root_rights)
*needs_root_rights = -1;
else {
fprintf(stderr,
- "Invalid value '%s' for 'needs_root_rights' at %s line %d\n",
- value, CONFIG_FILE, line);
+ "%s: Invalid value '%s' for 'needs_root_rights' at %s line %d\n",
+ progname, value, CONFIG_FILE, line);
exit(1);
}
}
@@ -136,18 +145,45 @@ static void parse_config(int *allowed, int *needs_root_rights)
/* Backward compatibility with older Debian Xwrapper, ignore */
}
else {
- fprintf(stderr, "Invalid key '%s' at %s line %d\n", key,
- CONFIG_FILE, line);
+ fprintf(stderr, "%s: Invalid key '%s' at %s line %d\n", key,
+ progname, CONFIG_FILE, line);
exit(1);
}
}
fclose(f);
}
+static int on_console(int fd)
+{
+#if defined(__linux__)
+ struct stat st;
+ int r;
+
+ r = fstat(fd, &st);
+ if (r == 0 && S_ISCHR(st.st_mode) && major(st.st_rdev) == 4)
+ return 1;
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+ int idx;
+
+ if (ioctl(fd, VT_GETINDEX, &idx) != -1)
+ return 1;
+#else
+#warning This program needs porting to your kernel.
+ static int seen;
+
+ if (!seen) {
+ fprintf(stderr, "%s: Unable to determine if running on a console\n",
+ progname);
+ seen = 1;
+ }
+#endif
+
+ return 0;
+}
+
int main(int argc, char *argv[])
{
struct drm_mode_card_res res;
- struct stat st;
char buf[PATH_MAX];
int i, r, fd;
int kms_cards = 0;
@@ -155,6 +191,8 @@ int main(int argc, char *argv[])
int allowed = CONSOLE_ONLY;
int needs_root_rights = -1;
+ progname = argv[0];
+
parse_config(&allowed, &needs_root_rights);
/* For non root users check if they are allowed to run the X server */
@@ -168,8 +206,7 @@ int main(int argc, char *argv[])
case CONSOLE_ONLY:
/* Some of stdin / stdout / stderr maybe redirected to a file */
for (i = STDIN_FILENO; i <= STDERR_FILENO; i++) {
- r = fstat(i, &st);
- if (r == 0 && S_ISCHR(st.st_mode) && major(st.st_rdev) == 4)
+ if (on_console(i))
break;
}
if (i > STDERR_FILENO) {
@@ -207,11 +244,13 @@ int main(int argc, char *argv[])
uid_t realuid = getuid();
if (setresgid(-1, realgid, realgid) != 0) {
- perror("Could not drop setgid privileges");
+ fprintf(stderr, "%s: Could not drop setgid privileges: %s\n",
+ progname, strerror(errno));
exit(1);
}
if (setresuid(-1, realuid, realuid) != 0) {
- perror("Could not drop setuid privileges");
+ fprintf(stderr, "%s: Could not drop setuid privileges: %s\n",
+ progname, strerror(errno));
exit(1);
}
}
@@ -220,12 +259,14 @@ int main(int argc, char *argv[])
/* Check if the server is executable by our real uid */
if (access(buf, X_OK) != 0) {
- perror("Missing execute permissions for " SUID_WRAPPER_DIR "Xorg.bin");
+ fprintf(stderr, "%s: Missing execute permissions for %s/Xorg.bin: %s\n",
+ progname, SUID_WRAPPER_DIR, strerror(errno));
exit(1);
}
argv[0] = buf;
(void) execv(argv[0], argv);
- perror("Failed to execute " SUID_WRAPPER_DIR "/Xorg.bin");
+ fprintf(stderr, "%s: Failed to execute %s/Xorg.bin: %s\n",
+ progname, SUID_WRAPPER_DIR, strerror(errno));
exit(1);
}
diff --git a/xorg-server/hw/xwayland/xwayland.c b/xorg-server/hw/xwayland/xwayland.c
index c2c6481af..b966e5070 100644
--- a/xorg-server/hw/xwayland/xwayland.c
+++ b/xorg-server/hw/xwayland/xwayland.c
@@ -218,7 +218,6 @@ xwl_realize_window(WindowPtr window)
screen->RealizeWindow = xwl_realize_window;
if (xwl_screen->rootless && !window->parent) {
- ErrorF("Clearing root clip\n");
RegionNull(&window->clipList);
RegionNull(&window->borderClip);
RegionNull(&window->winSize);
@@ -573,8 +572,10 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
fbPictureInit(pScreen, 0, 0);
+#ifdef HAVE_XSHMFENCE
if (!miSyncShmScreenInit(pScreen))
return FALSE;
+#endif
xwl_screen->wayland_fd = wl_display_get_fd(xwl_screen->display);
AddGeneralSocket(xwl_screen->wayland_fd);
@@ -616,8 +617,10 @@ xwl_log_handler(const char *format, va_list args)
FatalError("%s", msg);
}
-static const ExtensionModule glx_extension[] = {
+static const ExtensionModule xwayland_extensions[] = {
+#ifdef GLXEXT
{ GlxExtensionInit, "GLX", &noGlxExtension },
+#endif
};
void
@@ -639,7 +642,8 @@ InitOutput(ScreenInfo * screen_info, int argc, char **argv)
screen_info->bitmapBitOrder = BITMAP_BIT_ORDER;
screen_info->numPixmapFormats = ARRAY_SIZE(depths);
- LoadExtensionList(glx_extension, ARRAY_SIZE(glx_extension), FALSE);
+ LoadExtensionList(xwayland_extensions,
+ ARRAY_SIZE(xwayland_extensions), FALSE);
/* Cast away warning from missing printf annotation for
* wl_log_func_t. Wayland 1.5 will have the annotation, so we can
diff --git a/xorg-server/include/dix.h b/xorg-server/include/dix.h
index 8371df072..f42e23655 100644
--- a/xorg-server/include/dix.h
+++ b/xorg-server/include/dix.h
@@ -608,4 +608,6 @@ CorePointerProc(DeviceIntPtr dev, int what);
extern _X_HIDDEN int
CoreKeyboardProc(DeviceIntPtr dev, int what);
+extern _X_EXPORT void *lastGLContext;
+
#endif /* DIX_H */
diff --git a/xorg-server/include/opaque.h b/xorg-server/include/opaque.h
index 6b8071c5b..a2c54aa6a 100644
--- a/xorg-server/include/opaque.h
+++ b/xorg-server/include/opaque.h
@@ -56,6 +56,7 @@ extern _X_EXPORT Bool explicit_display;
extern _X_EXPORT int defaultBackingStore;
extern _X_EXPORT Bool disableBackingStore;
extern _X_EXPORT Bool enableBackingStore;
+extern _X_EXPORT Bool enableIndirectGLX;
extern _X_EXPORT Bool PartialNetwork;
extern _X_EXPORT Bool RunFromSigStopParent;
diff --git a/xorg-server/os/busfault.c b/xorg-server/os/busfault.c
index 43bb6ea8a..ac0268fd5 100644
--- a/xorg-server/os/busfault.c
+++ b/xorg-server/os/busfault.c
@@ -142,6 +142,7 @@ busfault_init(void)
act.sa_sigaction = busfault_sigaction;
act.sa_flags = SA_SIGINFO;
+ sigemptyset(&act.sa_mask);
if (sigaction(SIGBUS, &act, &old_act) < 0)
return FALSE;
previous_busfault_sigaction = old_act.sa_sigaction;
diff --git a/xorg-server/os/connection.c b/xorg-server/os/connection.c
index e914d9d94..40d9ff39b 100644
--- a/xorg-server/os/connection.c
+++ b/xorg-server/os/connection.c
@@ -353,9 +353,12 @@ NotifyParentProcess(void)
{
#if !defined(WIN32)
if (displayfd >= 0) {
- write(displayfd, display, strlen(display));
- write(displayfd, "\n", 1);
+ if (write(displayfd, display, strlen(display)) != strlen(display))
+ FatalError("Cannot write display number to fd %d\n", displayfd);
+ if (write(displayfd, "\n", 1) != 1)
+ FatalError("Cannot write display number to fd %d\n", displayfd);
close(displayfd);
+ displayfd = -1;
}
if (RunFromSmartParent) {
if (ParentProcess > 1) {
diff --git a/xorg-server/os/log.c b/xorg-server/os/log.c
index 38193eed6..a0f2a81f3 100644
--- a/xorg-server/os/log.c
+++ b/xorg-server/os/log.c
@@ -491,13 +491,14 @@ static void
LogSWrite(int verb, const char *buf, size_t len, Bool end_line)
{
static Bool newline = TRUE;
+ int ret;
if (verb < 0 || logVerbosity >= verb)
- write(2, buf, len);
+ ret = write(2, buf, len);
if (verb < 0 || logFileVerbosity >= verb) {
if (inSignalContext && logFileFd >= 0) {
- write(logFileFd, buf, len);
+ ret = write(logFileFd, buf, len);
#ifndef WIN32
if (logFlush && logSync)
fsync(logFileFd);
@@ -529,6 +530,11 @@ LogSWrite(int verb, const char *buf, size_t len, Bool end_line)
bufferPos += len;
}
}
+
+ /* There's no place to log an error message if the log write
+ * fails...
+ */
+ (void) ret;
}
void
diff --git a/xorg-server/os/utils.c b/xorg-server/os/utils.c
index 6e6974e89..bc5e7df4d 100644
--- a/xorg-server/os/utils.c
+++ b/xorg-server/os/utils.c
@@ -194,6 +194,8 @@ Bool noGEExtension = FALSE;
Bool CoreDump;
+Bool enableIndirectGLX = TRUE;
+
#ifdef PANORAMIX
Bool PanoramiXExtensionDisabledHack = FALSE;
#endif
@@ -313,7 +315,8 @@ LockServer(void)
if (lfd < 0)
FatalError("Could not create lock file in %s\n", tmp);
snprintf(pid_str, sizeof(pid_str), "%10ld\n", (long) getpid());
- (void) write(lfd, pid_str, 11);
+ if (write(lfd, pid_str, 11) != 11)
+ FatalError("Could not write pid to lock file in %s\n", tmp);
(void) fchmod(lfd, 0444);
(void) close(lfd);
@@ -537,6 +540,8 @@ UseMsg(void)
ErrorF("-fn string default font name\n");
ErrorF("-fp string default font path\n");
ErrorF("-help prints message with these options\n");
+ ErrorF("+iglx Allow creating indirect GLX contexts (default)\n");
+ ErrorF("-iglx Prohibit creating indirect GLX contexts\n");
ErrorF("-I ignore all remaining arguments\n");
#ifdef RLIMIT_DATA
ErrorF("-ld int limit data space to N Kb\n");
@@ -783,6 +788,10 @@ ProcessCommandLine(int argc, char *argv[])
UseMsg();
exit(0);
}
+ else if (strcmp(argv[i], "+iglx") == 0)
+ enableIndirectGLX = TRUE;
+ else if (strcmp(argv[i], "-iglx") == 0)
+ enableIndirectGLX = FALSE;
else if ((skip = XkbProcessArguments(argc, argv, i)) != 0) {
if (skip > 0)
i += skip - 1;
diff --git a/xorg-server/randr/randr.c b/xorg-server/randr/randr.c
index 3c97714d8..6e3f14b4e 100644
--- a/xorg-server/randr/randr.c
+++ b/xorg-server/randr/randr.c
@@ -679,7 +679,7 @@ static int
SProcRRDispatch(ClientPtr client)
{
REQUEST(xReq);
- if (stuff->data >= RRNumberRequests || !ProcRandrVector[stuff->data])
+ if (stuff->data >= RRNumberRequests || !SProcRandrVector[stuff->data])
return BadRequest;
return (*SProcRandrVector[stuff->data]) (client);
}
diff --git a/xorg-server/randr/rrprovider.c b/xorg-server/randr/rrprovider.c
index 3ce7d75b0..4507ba894 100644
--- a/xorg-server/randr/rrprovider.c
+++ b/xorg-server/randr/rrprovider.c
@@ -285,7 +285,7 @@ ProcRRSetProviderOutputSource(ClientPtr client)
RRProviderPtr provider, source_provider = NULL;
ScreenPtr pScreen;
- REQUEST_AT_LEAST_SIZE(xRRSetProviderOutputSourceReq);
+ REQUEST_SIZE_MATCH(xRRSetProviderOutputSourceReq);
VERIFY_RR_PROVIDER(stuff->provider, provider, DixReadAccess);
@@ -320,7 +320,7 @@ ProcRRSetProviderOffloadSink(ClientPtr client)
RRProviderPtr provider, sink_provider = NULL;
ScreenPtr pScreen;
- REQUEST_AT_LEAST_SIZE(xRRSetProviderOffloadSinkReq);
+ REQUEST_SIZE_MATCH(xRRSetProviderOffloadSinkReq);
VERIFY_RR_PROVIDER(stuff->provider, provider, DixReadAccess);
if (!(provider->capabilities & RR_Capability_SourceOffload))
diff --git a/xorg-server/randr/rrsdispatch.c b/xorg-server/randr/rrsdispatch.c
index 9968c7f81..08c3b6abe 100644
--- a/xorg-server/randr/rrsdispatch.c
+++ b/xorg-server/randr/rrsdispatch.c
@@ -434,6 +434,133 @@ SProcRRGetOutputPrimary(ClientPtr client)
return ProcRandrVector[stuff->randrReqType] (client);
}
+static int SProcRRGetProviders(ClientPtr client)
+{
+ REQUEST(xRRGetProvidersReq);
+
+ REQUEST_SIZE_MATCH(xRRGetProvidersReq);
+ swaps(&stuff->length);
+ swapl(&stuff->window);
+ return ProcRandrVector[stuff->randrReqType] (client);
+}
+
+static int SProcRRGetProviderInfo(ClientPtr client)
+{
+ REQUEST(xRRGetProviderInfoReq);
+
+ REQUEST_SIZE_MATCH(xRRGetProviderInfoReq);
+ swaps(&stuff->length);
+ swapl(&stuff->provider);
+ swapl(&stuff->configTimestamp);
+ return ProcRandrVector[stuff->randrReqType] (client);
+}
+
+static int SProcRRSetProviderOffloadSink(ClientPtr client)
+{
+ REQUEST(xRRSetProviderOffloadSinkReq);
+
+ REQUEST_SIZE_MATCH(xRRSetProviderOffloadSinkReq);
+ swaps(&stuff->length);
+ swapl(&stuff->provider);
+ swapl(&stuff->sink_provider);
+ swapl(&stuff->configTimestamp);
+ return ProcRandrVector[stuff->randrReqType] (client);
+}
+
+static int SProcRRSetProviderOutputSource(ClientPtr client)
+{
+ REQUEST(xRRSetProviderOutputSourceReq);
+
+ REQUEST_SIZE_MATCH(xRRSetProviderOutputSourceReq);
+ swaps(&stuff->length);
+ swapl(&stuff->provider);
+ swapl(&stuff->source_provider);
+ swapl(&stuff->configTimestamp);
+ return ProcRandrVector[stuff->randrReqType] (client);
+}
+
+static int SProcRRListProviderProperties(ClientPtr client)
+{
+ REQUEST(xRRListProviderPropertiesReq);
+
+ REQUEST_SIZE_MATCH(xRRListProviderPropertiesReq);
+ swaps(&stuff->length);
+ swapl(&stuff->provider);
+ return ProcRandrVector[stuff->randrReqType] (client);
+}
+
+static int SProcRRQueryProviderProperty(ClientPtr client)
+{
+ REQUEST(xRRQueryProviderPropertyReq);
+
+ REQUEST_SIZE_MATCH(xRRQueryProviderPropertyReq);
+ swaps(&stuff->length);
+ swapl(&stuff->provider);
+ swapl(&stuff->property);
+ return ProcRandrVector[stuff->randrReqType] (client);
+}
+
+static int SProcRRConfigureProviderProperty(ClientPtr client)
+{
+ REQUEST(xRRConfigureProviderPropertyReq);
+
+ REQUEST_AT_LEAST_SIZE(xRRConfigureProviderPropertyReq);
+ swaps(&stuff->length);
+ swapl(&stuff->provider);
+ swapl(&stuff->property);
+ /* TODO: no way to specify format? */
+ SwapRestL(stuff);
+ return ProcRandrVector[stuff->randrReqType] (client);
+}
+
+static int SProcRRChangeProviderProperty(ClientPtr client)
+{
+ REQUEST(xRRChangeProviderPropertyReq);
+
+ REQUEST_AT_LEAST_SIZE(xRRChangeProviderPropertyReq);
+ swaps(&stuff->length);
+ swapl(&stuff->provider);
+ swapl(&stuff->property);
+ swapl(&stuff->type);
+ swapl(&stuff->nUnits);
+ switch (stuff->format) {
+ case 8:
+ break;
+ case 16:
+ SwapRestS(stuff);
+ break;
+ case 32:
+ SwapRestL(stuff);
+ break;
+ }
+ return ProcRandrVector[stuff->randrReqType] (client);
+}
+
+static int SProcRRDeleteProviderProperty(ClientPtr client)
+{
+ REQUEST(xRRDeleteProviderPropertyReq);
+
+ REQUEST_SIZE_MATCH(xRRDeleteProviderPropertyReq);
+ swaps(&stuff->length);
+ swapl(&stuff->provider);
+ swapl(&stuff->property);
+ return ProcRandrVector[stuff->randrReqType] (client);
+}
+
+static int SProcRRGetProviderProperty(ClientPtr client)
+{
+ REQUEST(xRRGetProviderPropertyReq);
+
+ REQUEST_SIZE_MATCH(xRRGetProviderPropertyReq);
+ swaps(&stuff->length);
+ swapl(&stuff->provider);
+ swapl(&stuff->property);
+ swapl(&stuff->type);
+ swapl(&stuff->longOffset);
+ swapl(&stuff->longLength);
+ return ProcRandrVector[stuff->randrReqType] (client);
+}
+
int (*SProcRandrVector[RRNumberRequests]) (ClientPtr) = {
SProcRRQueryVersion, /* 0 */
/* we skip 1 to make old clients fail pretty immediately */
@@ -472,4 +599,15 @@ int (*SProcRandrVector[RRNumberRequests]) (ClientPtr) = {
SProcRRSetPanning, /* 29 */
SProcRRSetOutputPrimary, /* 30 */
SProcRRGetOutputPrimary, /* 31 */
+/* V1.4 additions */
+ SProcRRGetProviders, /* 32 */
+ SProcRRGetProviderInfo, /* 33 */
+ SProcRRSetProviderOffloadSink, /* 34 */
+ SProcRRSetProviderOutputSource, /* 35 */
+ SProcRRListProviderProperties, /* 36 */
+ SProcRRQueryProviderProperty, /* 37 */
+ SProcRRConfigureProviderProperty, /* 38 */
+ SProcRRChangeProviderProperty, /* 39 */
+ SProcRRDeleteProviderProperty, /* 40 */
+ SProcRRGetProviderProperty, /* 41 */
};
diff --git a/xorg-server/render/render.c b/xorg-server/render/render.c
index 3b7151a69..9ac4a98e7 100644
--- a/xorg-server/render/render.c
+++ b/xorg-server/render/render.c
@@ -638,7 +638,7 @@ ProcRenderSetPictureClipRectangles(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xRenderSetPictureClipRectanglesReq);
VERIFY_PICTURE(pPicture, stuff->picture, client, DixSetAttrAccess);
if (!pPicture->pDrawable)
- return BadDrawable;
+ return RenderErrBase + BadPicture;
nr = (client->req_len << 2) - sizeof(xRenderSetPictureClipRectanglesReq);
if (nr & 4)
diff --git a/xorg-server/test/.gitignore b/xorg-server/test/.gitignore
index acbda7a57..a62fc3d70 100644
--- a/xorg-server/test/.gitignore
+++ b/xorg-server/test/.gitignore
@@ -4,9 +4,12 @@ input
list
misc
os
+sdksyms.c
string
touch
xfree86
xkb
xtest
signal-logging
+*.log
+*.trs
diff --git a/xorg-server/test/Makefile.am b/xorg-server/test/Makefile.am
index 3ad24d9ec..32edc7a3b 100644
--- a/xorg-server/test/Makefile.am
+++ b/xorg-server/test/Makefile.am
@@ -41,7 +41,7 @@ os_LDADD=$(TEST_LDADD)
libxservertest_la_LIBADD = $(XSERVER_LIBS)
if XORG
-nodist_libxservertest_la_SOURCES = $(top_builddir)/hw/xfree86/sdksyms.c
+nodist_libxservertest_la_SOURCES = sdksyms.c
libxservertest_la_LIBADD += \
$(top_builddir)/hw/xfree86/loader/libloader.la \
$(top_builddir)/hw/xfree86/os-support/libxorgos.la \
@@ -55,6 +55,12 @@ libxservertest_la_LIBADD += \
$(top_builddir)/hw/xfree86/dixmods/libxorgxkb.la \
@XORG_LIBS@
+BUILT_SOURCES = sdksyms.c
+CLEANFILES = sdksyms.c
+
+sdksyms.c: $(top_builddir)/hw/xfree86/sdksyms.c
+ $(AM_V_GEN)$(LN_S) $(top_builddir)/hw/xfree86/sdksyms.c
+
if DRI
libxservertest_la_LIBADD += $(top_builddir)/hw/xfree86/dri/libdri.la
endif
diff --git a/xorg-server/test/signal-logging.c b/xorg-server/test/signal-logging.c
index 88b37c14e..432012195 100644
--- a/xorg-server/test/signal-logging.c
+++ b/xorg-server/test/signal-logging.c
@@ -178,9 +178,14 @@ static void logging_format(void)
LogInit(log_file_path, NULL);
assert(f = fopen(log_file_path, "r"));
-#define read_log_msg(msg) \
- fgets(read_buf, sizeof(read_buf), f); \
- msg = strchr(read_buf, ']') + 2; /* advance past [time.stamp] */
+#define read_log_msg(msg) do { \
+ msg = fgets(read_buf, sizeof(read_buf), f); \
+ assert(msg != NULL); \
+ msg = strchr(read_buf, ']'); \
+ assert(msg != NULL); \
+ assert(strlen(msg) > 2); \
+ msg = msg + 2; /* advance past [time.stamp] */ \
+ } while (0)
/* boring test message */
LogMessageVerbSigSafe(X_ERROR, -1, "test message\n");
diff --git a/xorg-server/xfixes/region.c b/xorg-server/xfixes/region.c
index cc8f1a5ef..f9de52542 100644
--- a/xorg-server/xfixes/region.c
+++ b/xorg-server/xfixes/region.c
@@ -269,6 +269,9 @@ ProcXFixesCreateRegionFromPicture(ClientPtr client)
VERIFY_PICTURE(pPicture, stuff->picture, client, DixGetAttrAccess);
+ if (!pPicture->pDrawable)
+ return RenderErrBase + BadPicture;
+
switch (pPicture->clientClipType) {
case CT_PIXMAP:
pRegion = BitmapToRegion(pPicture->pDrawable->pScreen,
@@ -750,6 +753,9 @@ ProcXFixesSetPictureClipRegion(ClientPtr client)
VERIFY_PICTURE(pPicture, stuff->picture, client, DixSetAttrAccess);
VERIFY_REGION_OR_NONE(pRegion, stuff->region, client, DixReadAccess);
+ if (!pPicture->pDrawable)
+ return RenderErrBase + BadPicture;
+
return SetPictureClipRegion(pPicture, stuff->xOrigin, stuff->yOrigin,
pRegion);
}
diff --git a/xorg-server/xkb/xkmread.c b/xorg-server/xkb/xkmread.c
index 258bb91b5..b6241b5c7 100644
--- a/xorg-server/xkb/xkmread.c
+++ b/xorg-server/xkb/xkmread.c
@@ -1204,7 +1204,8 @@ XkmReadTOC(FILE * file, xkmFileInfo * file_info, int max_toc,
}
return 0;
}
- fread(file_info, SIZEOF(xkmFileInfo), 1, file);
+ if (fread(file_info, SIZEOF(xkmFileInfo), 1, file) != 1)
+ return 0;
size_toc = file_info->num_toc;
if (size_toc > max_toc) {
DebugF("Warning! Too many TOC entries; last %d ignored\n",
@@ -1212,7 +1213,8 @@ XkmReadTOC(FILE * file, xkmFileInfo * file_info, int max_toc,
size_toc = max_toc;
}
for (i = 0; i < size_toc; i++) {
- fread(&toc[i], SIZEOF(xkmSectionInfo), 1, file);
+ if (fread(&toc[i], SIZEOF(xkmSectionInfo), 1, file) != 1)
+ return 0;
}
return 1;
}
diff --git a/xorg-server/xkeyboard-config/rules/base.xml.in b/xorg-server/xkeyboard-config/rules/base.xml.in
index c924edf6d..59b03c338 100644
--- a/xorg-server/xkeyboard-config/rules/base.xml.in
+++ b/xorg-server/xkeyboard-config/rules/base.xml.in
@@ -3905,7 +3905,7 @@
<variant>
<configItem>
<name>cyrillicyz</name>
- <_description>Montenegrin (Cyrillic, Z and ZHE swapped)</_description>
+ <_description>Montenegrin (Cyrillic, ZE and ZHE swapped)</_description>
</configItem>
</variant>
<variant>
diff --git a/xorg-server/xkeyboard-config/symbols/fi b/xorg-server/xkeyboard-config/symbols/fi
index 1818243dd..1bf9ff074 100644
--- a/xorg-server/xkeyboard-config/symbols/fi
+++ b/xorg-server/xkeyboard-config/symbols/fi
@@ -101,8 +101,7 @@ xkb_symbols "classic" {
partial alphanumeric_keys hidden
xkb_symbols "fi" {
- // Classic Finnish keyboard layout with dead keys support
- // and all ISO-8859-1 and ISO-8859-15 characters available
+ // Classic Finnish keyboard layout with dead keys
key <TLDE> { [ section, onehalf, onequarter, threequarters ] };
key <AE01> { [ 1, exclam, exclamdown, onesuperior ] };
@@ -112,8 +111,8 @@ xkb_symbols "fi" {
key <AE05> { [ 5, percent, EuroSign, masculine ] };
key <AE06> { [ 6, ampersand, yen, ordfeminine ] };
key <AE07> { [ 7, slash, braceleft, plusminus ] };
- key <AE08> { [ 8, parenleft, bracketleft, guillemotleft ] };
- key <AE09> { [ 9, parenright, bracketright, guillemotright ] };
+ key <AE08> { [ 8, parenleft, bracketleft, less ] };
+ key <AE09> { [ 9, parenright, bracketright, greater ] };
key <AE10> { [ 0, equal, braceright, degree ] };
key <AE11> { [ plus, question, backslash, questiondown ] };
key <AE12> { [ dead_acute, dead_grave, dead_cedilla, dead_ogonek ] };
@@ -205,9 +204,10 @@ xkb_symbols "mac" {
name[Group1]="Finnish (Macintosh)";
};
-// EXTRAS:
-
partial alphanumeric_keys
- xkb_symbols "sun_type6" {
- include "sun_vndr/fi(sun_type6)"
+xkb_symbols "sun_type6" {
+
+ // Sun Type 6/7 keyboard for Finland
+
+ include "sun_vndr/fi(sun_type6)"
};
diff --git a/xorg-server/xkeyboard-config/symbols/hr b/xorg-server/xkeyboard-config/symbols/hr
index 61fc39221..cdceea1fe 100644
--- a/xorg-server/xkeyboard-config/symbols/hr
+++ b/xorg-server/xkeyboard-config/symbols/hr
@@ -4,12 +4,12 @@ xkb_symbols "basic" {
include "rs(latin)"
name[Group1]="Croatian";
- // Redefine these keys to match XFree86 Croatian layout
- key <AE01> { [ 1, exclam, asciitilde, dead_tilde ] };
- key <AE03> { [ 3, numbersign, asciicircum, dead_circumflex ] };
- key <AE05> { [ 5, percent, degree, dead_abovering ] };
- key <AE07> { [ 7, slash, grave, dead_grave ] };
- key <AB10> { [ minus, underscore, dead_belowdot, dead_abovedot ] };
+ // Redefine these keys to match the XFree86 Croatian layout.
+ key <AE01> { [ 1, exclam, asciitilde, dead_tilde ] };
+ key <AE03> { [ 3, numbersign, asciicircum, dead_circumflex ] };
+ key <AE05> { [ 5, percent, degree, dead_abovering ] };
+ key <AE07> { [ 7, slash, grave, dead_grave ] };
+ key <AB10> { [ minus, underscore, dead_belowdot, dead_abovedot ] };
};
partial alphanumeric_keys
@@ -18,28 +18,28 @@ xkb_symbols "us" {
include "us"
name[Group1]= "Croatian (US keyboard with Croatian letters)";
- key <AD01> { [ any, any, backslash ] };
- key <AD02> { [ any, any, bar ] };
- key <AD03> { [ any, any, EuroSign ] };
- key <AD06> { [ any, any, z, Z ] };
- key <AD11> { [ any, any, scaron, Scaron ] };
- key <AD12> { [ any, any, dstroke, Dstroke ] };
- key <AC04> { [ any, any, bracketleft ] };
- key <AC05> { [ any, any, bracketright ] };
- key <AC08> { [ any, any, lstroke ] };
- key <AC09> { [ any, any, Lstroke ] };
- key <AC10> { [ any, any, ccaron, Ccaron ] };
- key <AC11> { [ any, any, cacute, Cacute ] };
- key <LSGT> { [ any, any, bar ] };
- key <AB01> { [ any, any, y, Y ] };
- key <AB04> { [ any, any, at ] };
- key <AB05> { [ any, any, braceleft ] };
- key <AB06> { [ any, any, braceright ] };
- key <AB07> { [ any, any, section ] };
- key <AB08> { [ any, any, semicolon ] };
- key <AB09> { [ any, any, colon ] };
- key <AB10> { [ any, any, minus, underscore ] };
- key <BKSL> { [ any, any, zcaron, Zcaron ] };
+ key <AD01> { [ any, any, backslash ] };
+ key <AD02> { [ any, any, bar ] };
+ key <AD03> { [ any, any, EuroSign ] };
+ key <AD06> { [ any, any, z, Z ] };
+ key <AD11> { [ any, any, scaron, Scaron ] };
+ key <AD12> { [ any, any, dstroke, Dstroke ] };
+ key <AC04> { [ any, any, bracketleft ] };
+ key <AC05> { [ any, any, bracketright ] };
+ key <AC08> { [ any, any, lstroke ] };
+ key <AC09> { [ any, any, Lstroke ] };
+ key <AC10> { [ any, any, ccaron, Ccaron ] };
+ key <AC11> { [ any, any, cacute, Cacute ] };
+ key <LSGT> { [ any, any, bar ] };
+ key <AB01> { [ any, any, y, Y ] };
+ key <AB04> { [ any, any, at ] };
+ key <AB05> { [ any, any, braceleft ] };
+ key <AB06> { [ any, any, braceright ] };
+ key <AB07> { [ any, any, section ] };
+ key <AB08> { [ any, any, semicolon ] };
+ key <AB09> { [ any, any, colon ] };
+ key <AB10> { [ any, any, minus, underscore ] };
+ key <BKSL> { [ any, any, zcaron, Zcaron ] };
include "level3(ralt_switch)"
};
diff --git a/xorg-server/xkeyboard-config/symbols/jp b/xorg-server/xkeyboard-config/symbols/jp
index f0b2c4d75..26dfdf9bd 100644
--- a/xorg-server/xkeyboard-config/symbols/jp
+++ b/xorg-server/xkeyboard-config/symbols/jp
@@ -131,7 +131,7 @@ xkb_symbols "kana86" {
name[Group1]= "Japanese (Kana 86)";
key <ESC> { [ Escape ] };
- key <NMLK> { [ Num_Lock, Pointer_EnableKeys ] };
+ key <NMLK> { [ Num_Lock ] };
key <BKSP> { [ BackSpace ] };
key <TAB> { [ Tab, ISO_Left_Tab ] };
key <RTRN> { [ Return ] };
diff --git a/xorg-server/xkeyboard-config/symbols/keypad b/xorg-server/xkeyboard-config/symbols/keypad
index 9b49a5773..0187ecbeb 100644
--- a/xorg-server/xkeyboard-config/symbols/keypad
+++ b/xorg-server/xkeyboard-config/symbols/keypad
@@ -211,7 +211,7 @@ xkb_symbols "core" {
modifier_map Mod2 { Num_Lock };
- key <NMLK> { [ Num_Lock, Pointer_EnableKeys ] };
+ key <NMLK> { [ Num_Lock ] };
key <KPEN> { [ KP_Enter ] };
key <KPEQ> { [ KP_Equal ] };
};
diff --git a/xorg-server/xkeyboard-config/symbols/me b/xorg-server/xkeyboard-config/symbols/me
index acb37e76d..1ada63493 100644
--- a/xorg-server/xkeyboard-config/symbols/me
+++ b/xorg-server/xkeyboard-config/symbols/me
@@ -21,7 +21,7 @@ xkb_symbols "cyrillic" {
partial alphanumeric_keys
xkb_symbols "cyrillicyz" {
include "rs(yz)"
- name[Group1]= "Montenegrin (Cyrillic, Z and ZHE swapped)";
+ name[Group1]= "Montenegrin (Cyrillic, ZE and ZHE swapped)";
};
partial alphanumeric_keys
diff --git a/xorg-server/xkeyboard-config/symbols/rs b/xorg-server/xkeyboard-config/symbols/rs
index 06025e17e..c39f4ed49 100644
--- a/xorg-server/xkeyboard-config/symbols/rs
+++ b/xorg-server/xkeyboard-config/symbols/rs
@@ -1,342 +1,331 @@
-// Bosnian, Croatian, Serbian and Slovenian XKB keyboard mapping
-// (derived from "Danube" D.2)
+// Bosnian, Croatian, Serbian and Slovenian XKB keyboard mappings.
//
-// Danube D.2 from 2003-05-12 is available at http://srpski.org/dunav/
+// Derived from "Danube" D.2 from 2003-05-12,
+// which is available at http://srpski.org/dunav/.
//
// Original authors:
// Danilo Segan (Данило Шеган) <danilo@kvota.net>
// Chusslove Illich (Часлав Илић) <caslav.ilic@gmx.net>
//
// Danilo Segan <danilo@kvota.net>:
-// - Modified for inclusion in XFree86
-// - Further modifications on 2005-08-18 to support Bosnian, Croatian
-// and Slovenian in xkeyboard-config
-//
+// - Modified for inclusion in XFree86.
+// - Further modifications on 2005-08-18 to support Bosnian,
+// Croatian and Slovenian in xkeyboard-config.
default partial alphanumeric_keys
xkb_symbols "basic" {
- name[Group1]= "Serbian";
+ name[Group1]= "Serbian";
- include "rs(cyrlevel3)"
- include "rs(common)"
- include "rs(cyralpha)"
- include "level3(ralt_switch)"
+ include "rs(cyrlevel3)"
+ include "rs(common)"
+ include "rs(cyralpha)"
+ include "level3(ralt_switch)"
};
-
partial alphanumeric_keys
xkb_symbols "latin" {
- name[Group1]= "Serbian (Latin)";
+ name[Group1]= "Serbian (Latin)";
- include "latin(type3)"
- include "rs(latalpha)"
- include "rs(latlevel3)"
- include "rs(common)"
- include "level3(ralt_switch)"
+ include "latin(type3)"
+ include "rs(latalpha)"
+ include "rs(latlevel3)"
+ include "rs(common)"
+ include "level3(ralt_switch)"
};
-
partial alphanumeric_keys
xkb_symbols "yz" {
- include "rs(basic)"
- name[Group1]= "Serbian (Cyrillic, ZE and ZHE swapped)";
+ include "rs(basic)"
+ name[Group1]= "Serbian (Cyrillic, ZE and ZHE swapped)";
- key <AD06> { [ Cyrillic_zhe, Cyrillic_ZHE, any,any ] }; // y
- key <AB01> { [ Cyrillic_ze, Cyrillic_ZE, any,any ] }; // z
+ key <AD06> { [ Cyrillic_zhe, Cyrillic_ZHE, any, any ] }; // y
+ key <AB01> { [ Cyrillic_ze, Cyrillic_ZE, any, any ] }; // z
};
partial hidden alphanumeric_keys
xkb_symbols "common" {
- // "Common" keys: keys which are same for both latin and cyrillic keyboards
-
- key.type[Group1] = "FOUR_LEVEL";
-
- key <TLDE> { [ grave, asciitilde, any,any ] }; //
- key <AE01> { [ 1, exclam, any,any ] }; //
- key <AE02> { [ 2, quotedbl, any,any ] }; //
- key <AE03> { [ 3, numbersign, any,any ] }; //
- key <AE04> { [ 4, dollar, any,any ] }; //
- key <AE05> { [ 5, percent, any,any ] }; //
- key <AE06> { [ 6, ampersand, any,any ] }; //
- key <AE07> { [ 7, slash, any,any ] }; //
- key <AE08> { [ 8, parenleft, any,any ] }; //
- key <AE09> { [ 9, parenright, any,any ] }; //
- key <AE10> { [ 0, equal, any,any ] }; //
- key <AE11> { [ apostrophe, question, any,any ] }; //
- key <AE12> { [ plus, asterisk, any,any ] }; //
-
- key <AB08> { [ comma, semicolon, any,any ] }; //
- key <AB09> { [ period, colon, any,any ] }; //
- key <AB10> { [ minus, underscore, any,any ] }; //
-
- include "kpdl(comma)"
+ // "Common" keys: keys that are the same
+ // for both latin and cyrillic keyboards.
+
+ key.type[Group1] = "FOUR_LEVEL";
+
+ key <TLDE> { [ grave, asciitilde, any, any ] };
+ key <AE01> { [ 1, exclam, any, any ] };
+ key <AE02> { [ 2, quotedbl, any, any ] };
+ key <AE03> { [ 3, numbersign, any, any ] };
+ key <AE04> { [ 4, dollar, any, any ] };
+ key <AE05> { [ 5, percent, any, any ] };
+ key <AE06> { [ 6, ampersand, any, any ] };
+ key <AE07> { [ 7, slash, any, any ] };
+ key <AE08> { [ 8, parenleft, any, any ] };
+ key <AE09> { [ 9, parenright, any, any ] };
+ key <AE10> { [ 0, equal, any, any ] };
+ key <AE11> { [ apostrophe, question, any, any ] };
+ key <AE12> { [ plus, asterisk, any, any ] };
+
+ key <AB08> { [ comma, semicolon, any, any ] };
+ key <AB09> { [ period, colon, any, any ] };
+ key <AB10> { [ minus, underscore, any, any ] };
+
+ include "kpdl(comma)"
};
partial hidden alphanumeric_keys
xkb_symbols "cyralpha" {
- key.type[Group1] = "FOUR_LEVEL_ALPHABETIC";
-
- key <AD01> { [ Cyrillic_lje, Cyrillic_LJE, any,any ] }; // q
- key <AD02> { [ Cyrillic_nje, Cyrillic_NJE, any,any ] }; // w
- key <AD03> { [ Cyrillic_ie, Cyrillic_IE, any,any ] }; // e
- key <AD04> { [ Cyrillic_er, Cyrillic_ER, any,any ] }; // r
- key <AD05> { [ Cyrillic_te, Cyrillic_TE, any,any ] }; // t
- key <AD06> { [ Cyrillic_ze, Cyrillic_ZE, any,any ] }; // y
- key <AD07> { [ Cyrillic_u, Cyrillic_U, any,any ] }; // u
- key <AD08> { [ Cyrillic_i, Cyrillic_I, any,any ] }; // i
- key <AD09> { [ Cyrillic_o, Cyrillic_O, any,any ] }; // o
- key <AD10> { [ Cyrillic_pe, Cyrillic_PE, any,any ] }; // p
- key <AD11> { [ Cyrillic_sha, Cyrillic_SHA, any,any ] }; // [ {
- key <AD12> { [ Serbian_dje, Serbian_DJE, any,any ] }; // ] }
-
- key <AC01> { [ Cyrillic_a, Cyrillic_A, any,any ] }; // a
- key <AC02> { [ Cyrillic_es, Cyrillic_ES, any,any ] }; // s
- key <AC03> { [ Cyrillic_de, Cyrillic_DE, any,any ] }; // d
- key <AC04> { [ Cyrillic_ef, Cyrillic_EF, any,any ] }; // f
- key <AC05> { [ Cyrillic_ghe, Cyrillic_GHE, any,any ] }; // g
- key <AC06> { [ Cyrillic_ha, Cyrillic_HA, any,any ] }; // h
- key <AC07> { [ Cyrillic_je, Cyrillic_JE, any,any ] }; // j
- key <AC08> { [ Cyrillic_ka, Cyrillic_KA, any,any ] }; // k
- key <AC09> { [ Cyrillic_el, Cyrillic_EL, any,any ] }; // l
- key <AC10> { [ Cyrillic_che, Cyrillic_CHE, any,any ] }; // ; :
- key <AC11> { [ Serbian_tshe, Serbian_TSHE, any,any ] }; // ' "
- key <BKSL> { [ Cyrillic_zhe, Cyrillic_ZHE, any,any ] }; // \ |
-
- key <AB01> { [ Cyrillic_zhe, Cyrillic_ZHE, any,any ] }; // z
- key <AB02> { [ Cyrillic_dzhe, Cyrillic_DZHE, any,any ] }; // x
- key <AB03> { [ Cyrillic_tse, Cyrillic_TSE, any,any ] }; // c
- key <AB04> { [ Cyrillic_ve, Cyrillic_VE, any,any ] }; // v
- key <AB05> { [ Cyrillic_be, Cyrillic_BE, any,any ] }; // b
- key <AB06> { [ Cyrillic_en, Cyrillic_EN, any,any ] }; // n
- key <AB07> { [ Cyrillic_em, Cyrillic_EM, any,any ] }; // m
+ key.type[Group1] = "FOUR_LEVEL_ALPHABETIC";
+
+ key <AD01> { [ Cyrillic_lje, Cyrillic_LJE, any, any ] }; // q
+ key <AD02> { [ Cyrillic_nje, Cyrillic_NJE, any, any ] }; // w
+ key <AD03> { [ Cyrillic_ie, Cyrillic_IE, any, any ] }; // e
+ key <AD04> { [ Cyrillic_er, Cyrillic_ER, any, any ] }; // r
+ key <AD05> { [ Cyrillic_te, Cyrillic_TE, any, any ] }; // t
+ key <AD06> { [ Cyrillic_ze, Cyrillic_ZE, any, any ] }; // y
+ key <AD07> { [ Cyrillic_u, Cyrillic_U, any, any ] }; // u
+ key <AD08> { [ Cyrillic_i, Cyrillic_I, any, any ] }; // i
+ key <AD09> { [ Cyrillic_o, Cyrillic_O, any, any ] }; // o
+ key <AD10> { [ Cyrillic_pe, Cyrillic_PE, any, any ] }; // p
+ key <AD11> { [ Cyrillic_sha, Cyrillic_SHA, any, any ] }; // [ {
+ key <AD12> { [ Serbian_dje, Serbian_DJE, any, any ] }; // ] }
+
+ key <AC01> { [ Cyrillic_a, Cyrillic_A, any, any ] }; // a
+ key <AC02> { [ Cyrillic_es, Cyrillic_ES, any, any ] }; // s
+ key <AC03> { [ Cyrillic_de, Cyrillic_DE, any, any ] }; // d
+ key <AC04> { [ Cyrillic_ef, Cyrillic_EF, any, any ] }; // f
+ key <AC05> { [ Cyrillic_ghe, Cyrillic_GHE, any, any ] }; // g
+ key <AC06> { [ Cyrillic_ha, Cyrillic_HA, any, any ] }; // h
+ key <AC07> { [ Cyrillic_je, Cyrillic_JE, any, any ] }; // j
+ key <AC08> { [ Cyrillic_ka, Cyrillic_KA, any, any ] }; // k
+ key <AC09> { [ Cyrillic_el, Cyrillic_EL, any, any ] }; // l
+ key <AC10> { [ Cyrillic_che, Cyrillic_CHE, any, any ] }; // ; :
+ key <AC11> { [ Serbian_tshe, Serbian_TSHE, any, any ] }; // ' "
+ key <BKSL> { [ Cyrillic_zhe, Cyrillic_ZHE, any, any ] }; // \ |
+
+ key <AB01> { [ Cyrillic_zhe, Cyrillic_ZHE, any, any ] }; // z
+ key <AB02> { [ Cyrillic_dzhe, Cyrillic_DZHE, any, any ] }; // x
+ key <AB03> { [ Cyrillic_tse, Cyrillic_TSE, any, any ] }; // c
+ key <AB04> { [ Cyrillic_ve, Cyrillic_VE, any, any ] }; // v
+ key <AB05> { [ Cyrillic_be, Cyrillic_BE, any, any ] }; // b
+ key <AB06> { [ Cyrillic_en, Cyrillic_EN, any, any ] }; // n
+ key <AB07> { [ Cyrillic_em, Cyrillic_EM, any, any ] }; // m
};
partial hidden alphanumeric_keys
xkb_symbols "latalpha" {
- key.type[Group1] = "FOUR_LEVEL_ALPHABETIC";
+ key.type[Group1] = "FOUR_LEVEL_ALPHABETIC";
- key <AD11> { [ scaron, Scaron, any,any ] }; //
- key <AD12> { [ dstroke, Dstroke, any,any ] }; //
-
- key <AC10> { [ ccaron, Ccaron, any,any ] }; //
- key <AC11> { [ cacute, Cacute, any,any ] }; //
- key <BKSL> { [ zcaron, Zcaron, any,any ] }; //
+ key <AD11> { [ scaron, Scaron, any, any ] }; // [ {
+ key <AD12> { [ dstroke, Dstroke, any, any ] }; // ] }
+ key <AC10> { [ ccaron, Ccaron, any, any ] }; // ; :
+ key <AC11> { [ cacute, Cacute, any, any ] }; // ' "
+ key <BKSL> { [ zcaron, Zcaron, any, any ] }; // \ |
};
partial hidden alphanumeric_keys
xkb_symbols "twoletter" {
- // These are letters which are written in latin transcription with two-characters.
- key <AD01> { type[Group1] = "SEPARATE_CAPS_AND_SHIFT_ALPHABETIC",
- [ U1C9, U1C8, any, U1C7 ] }; // q
- key <AD02> { type[Group1] = "SEPARATE_CAPS_AND_SHIFT_ALPHABETIC",
- [ U1CC, U1CB, any, U1CA ] }; // w
- key <AB02> { type[Group1] = "SEPARATE_CAPS_AND_SHIFT_ALPHABETIC",
- [ U1C6, U1C5, any, U1C4 ] }; // x
+ // Letters which are written in latin transcription with two characters.
+ key <AD01> { type[Group1] = "SEPARATE_CAPS_AND_SHIFT_ALPHABETIC",
+ [ U1C9, U1C8, any, U1C7 ] }; // q
+ key <AD02> { type[Group1] = "SEPARATE_CAPS_AND_SHIFT_ALPHABETIC",
+ [ U1CC, U1CB, any, U1CA ] }; // w
+ key <AB02> { type[Group1] = "SEPARATE_CAPS_AND_SHIFT_ALPHABETIC",
+ [ U1C6, U1C5, any, U1C4 ] }; // x
- // Also replace letter Y with Zcaron, since Y is of no use any longer
- key <AB01> { [ zcaron, Zcaron, any,any ] }; //
+ // Also replace letter Y with Zcaron, since Y is of no use any longer.
+ key <AB01> { [ zcaron, Zcaron, any, any ] }; // z
};
partial hidden alphanumeric_keys
xkb_symbols "latlevel3" {
- key <TLDE> { [ any,any, notsign, notsign ] }; // ` ~
- key <AE01> { [ any,any, dead_tilde, asciitilde ] }; // 1 !
- key <AE02> { [ any,any, dead_caron, caron ] }; // 2 @
- key <AE03> { [ any,any, dead_circumflex, asciicircum ] }; // 3 #
- key <AE04> { [ any,any, dead_breve, breve ] }; // 4 $
- key <AE05> { [ any,any, dead_abovering, degree ] }; // 5 %
- key <AE06> { [ any,any, dead_ogonek, ogonek ] }; // 6 ^
- key <AE07> { [ any,any, dead_grave, grave ] }; // 7 &
- key <AE08> { [ any,any, dead_abovedot, abovedot ] }; // 8 *
- key <AE09> { [ any,any, dead_acute, apostrophe ] }; // 9 (
- key <AE10> { [ any,any, dead_doubleacute, doubleacute ] }; // 0 )
- key <AE11> { [ any,any, dead_diaeresis, diaeresis ] }; // - _
- key <AE12> { [ any,any, dead_cedilla, cedilla ] }; // = +
-
- key <AD01> { [ any,any, backslash, Greek_OMEGA ] }; // q
- key <AD02> { [ any,any, bar, Lstroke ] }; // w
- key <AD03> { [ any,any, EuroSign, EuroSign ] }; // e
- key <AD04> { [ any,any, paragraph, registered ] }; // r
- key <AD05> { [ any,any, tslash, Tslash ] }; // t // ALPHABETIC
- key <AD06> { [ any,any, leftarrow, yen ] }; // y
- key <AD07> { [ any,any, downarrow, uparrow ] }; // u
- key <AD08> { [ any,any, rightarrow, idotless ] }; // i
- key <AD09> { [ any,any, oslash, Ooblique ] }; // o // ALPHABETIC
- key <AD10> { [ any,any, thorn, THORN ] }; // p // ALPHABETIC
- key <AD11> { [ any,any, division, dead_abovering ] }; // [
- key <AD12> { [ any,any, multiply, dead_macron ] }; // ]
-
- key <AC01> { [ any,any, ae, AE ] }; // a // ALPHABETIC
- key <AC02> { [ any,any, doublelowquotemark, guillemotright ] }; // s
- key <AC03> { [ any,any, leftdoublequotemark, guillemotleft ] }; // d
- key <AC04> { [ any,any, bracketleft, ordfeminine ] }; // f
- key <AC05> { [ any,any, bracketright, ENG ] }; // g
- key <AC06> { [ any,any, hstroke, Hstroke ] }; // h // ALPHABETIC
- key <AC07> { [ any,any, NoSymbol, NoSymbol ] }; // j
- key <AC08> { [ any,any, lstroke, ampersand ] }; // k
- key <AC09> { [ any,any, lstroke, Lstroke ] }; // l
- key <AC10> { [ any,any, dead_acute, dead_doubleacute ] }; // ;
- key <AC11> { [ any,any, ssharp, dead_caron ] }; // '
- key <BKSL> { [ any,any, currency, dead_breve ] }; // \
-
- key <AB01> { [ any,any, leftsinglequotemark, guillemotright ] }; // z
- key <AB02> { [ any,any, rightsinglequotemark,guillemotleft ] }; // x
- key <AB03> { [ any,any, cent, copyright ] }; // c
- key <AB04> { [ any,any, at, grave ] }; // v
- key <AB05> { [ any,any, braceleft, apostrophe ] }; // b
- key <AB06> { [ any,any, braceright, braceright ] }; // n
- key <AB07> { [ any,any, asciicircum, masculine ] }; // m
- key <AB08> { [ any,any, less, multiply ] }; // , <
- key <AB09> { [ any,any, greater, division ] }; // . >
- key <AB10> { [ any,any, emdash, endash ] }; // / ?
-
+ key <TLDE> { [ any, any, notsign, notsign ] }; // ` ~
+ key <AE01> { [ any, any, dead_tilde, asciitilde ] }; // 1 !
+ key <AE02> { [ any, any, dead_caron, caron ] }; // 2 @
+ key <AE03> { [ any, any, dead_circumflex, asciicircum ] }; // 3 #
+ key <AE04> { [ any, any, dead_breve, breve ] }; // 4 $
+ key <AE05> { [ any, any, dead_abovering, degree ] }; // 5 %
+ key <AE06> { [ any, any, dead_ogonek, ogonek ] }; // 6 ^
+ key <AE07> { [ any, any, dead_grave, grave ] }; // 7 &
+ key <AE08> { [ any, any, dead_abovedot, abovedot ] }; // 8 *
+ key <AE09> { [ any, any, dead_acute, apostrophe ] }; // 9 (
+ key <AE10> { [ any, any, dead_doubleacute, doubleacute ] }; // 0 )
+ key <AE11> { [ any, any, dead_diaeresis, diaeresis ] }; // - _
+ key <AE12> { [ any, any, dead_cedilla, cedilla ] }; // = +
+
+ key <AD01> { [ any, any, backslash, Greek_OMEGA ] }; // q
+ key <AD02> { [ any, any, bar, Lstroke ] }; // w
+ key <AD03> { [ any, any, EuroSign, EuroSign ] }; // e
+ key <AD04> { [ any, any, paragraph, registered ] }; // r
+ key <AD05> { [ any, any, tslash, Tslash ] }; // t // ALPHABETIC
+ key <AD06> { [ any, any, leftarrow, yen ] }; // y
+ key <AD07> { [ any, any, downarrow, uparrow ] }; // u
+ key <AD08> { [ any, any, rightarrow, idotless ] }; // i
+ key <AD09> { [ any, any, oslash, Ooblique ] }; // o // ALPHABETIC
+ key <AD10> { [ any, any, thorn, THORN ] }; // p // ALPHABETIC
+ key <AD11> { [ any, any, division, dead_abovering ] }; // [
+ key <AD12> { [ any, any, multiply, dead_macron ] }; // ]
+
+ key <AC01> { [ any, any, ae, AE ] }; // a // ALPHABETIC
+ key <AC02> { [ any, any, doublelowquotemark, guillemotright ] }; // s
+ key <AC03> { [ any, any, leftdoublequotemark, guillemotleft ] }; // d
+ key <AC04> { [ any, any, bracketleft, ordfeminine ] }; // f
+ key <AC05> { [ any, any, bracketright, ENG ] }; // g
+ key <AC06> { [ any, any, hstroke, Hstroke ] }; // h // ALPHABETIC
+ key <AC07> { [ any, any, NoSymbol, NoSymbol ] }; // j
+ key <AC08> { [ any, any, lstroke, ampersand ] }; // k
+ key <AC09> { [ any, any, lstroke, Lstroke ] }; // l
+ key <AC10> { [ any, any, dead_acute, dead_doubleacute ] }; // ;
+ key <AC11> { [ any, any, ssharp, dead_caron ] }; // '
+ key <BKSL> { [ any, any, currency, dead_breve ] }; // \
+
+ key <AB01> { [ any, any, leftsinglequotemark, guillemotright ] }; // z
+ key <AB02> { [ any, any, rightsinglequotemark,guillemotleft ] }; // x
+ key <AB03> { [ any, any, cent, copyright ] }; // c
+ key <AB04> { [ any, any, at, grave ] }; // v
+ key <AB05> { [ any, any, braceleft, apostrophe ] }; // b
+ key <AB06> { [ any, any, braceright, braceright ] }; // n
+ key <AB07> { [ any, any, asciicircum, masculine ] }; // m
+ key <AB08> { [ any, any, less, multiply ] }; // , <
+ key <AB09> { [ any, any, greater, division ] }; // . >
+ key <AB10> { [ any, any, emdash, endash ] }; // / ?
};
partial hidden alphanumeric_keys
xkb_symbols "cyrlevel3" {
- key <TLDE> { [ any,any, degree, notsign ] }; // ` ~
- key <AE03> { [ any,any, dead_circumflex, NoSymbol ] }; // 3 #
- key <AE07> { [ any,any, dead_grave, NoSymbol ] }; // 7 &
- key <AE08> { [ any,any, dead_doublegrave, NoSymbol ] }; // 8 *
- key <AE09> { [ any,any, dead_acute, NoSymbol ] }; // 9 (
- key <AE10> { [ any,any, dead_invertedbreve, NoSymbol ] }; // 0 )
- key <AE11> { [ any,any, dead_macron, NoSymbol ] }; // - _
-
- key <AD01> { [ any,any, backslash, NoSymbol ] }; // q
- key <AD02> { [ any,any, bar, NoSymbol ] }; // w
- key <AD03> { [ any,any, EuroSign, sterling ] }; // e
- key <AD04> { [ any,any, paragraph, registered ] }; // r
- key <AD05> { [ any,any, ellipsis, NoSymbol ] }; // t // ALPHABETIC
- key <AD06> { [ any,any, leftarrow, yen ] }; // y
- key <AD07> { [ any,any, downarrow, uparrow ] }; // u
- key <AD08> { [ any,any, rightarrow, NoSymbol ] }; // i
- key <AD09> { [ any,any, section, NoSymbol ] }; // o // ALPHABETIC
- key <AD11> { [ any,any, division, NoSymbol ] }; // [
- key <AD12> { [ any,any, multiply, NoSymbol ] }; // ]
-
- key <AC02> { [ any,any, doublelowquotemark, guillemotright ] }; // s
- key <AC03> { [ any,any, leftdoublequotemark, guillemotleft ] }; // d
- key <AC04> { [ any,any, bracketleft, NoSymbol ] }; // f
- key <AC05> { [ any,any, bracketright, NoSymbol ] }; // g
- key <BKSL> { [ any,any, currency, NoSymbol ] }; // \
-
- key <AB01> { [ any,any, leftsinglequotemark, NoSymbol ] }; // z
- key <AB02> { [ any,any, rightsinglequotemark,NoSymbol ] }; // x
- key <AB03> { [ any,any, cent, copyright ] }; // c
- key <AB04> { [ any,any, at, NoSymbol ] }; // v
- key <AB05> { [ any,any, braceleft, NoSymbol ] }; // b
- key <AB06> { [ any,any, braceright, NoSymbol ] }; // n
- key <AB07> { [ any,any, asciicircum, NoSymbol ] }; // m
- key <AB08> { [ any,any, less, NoSymbol ] }; // , <
- key <AB09> { [ any,any, greater, NoSymbol ] }; // . >
- key <AB10> { [ any,any, emdash, endash ] }; // / ?
+ key <TLDE> { [ any, any, degree, notsign ] }; // ` ~
+ key <AE03> { [ any, any, dead_circumflex, NoSymbol ] }; // 3 #
+ key <AE07> { [ any, any, dead_grave, NoSymbol ] }; // 7 &
+ key <AE08> { [ any, any, dead_doublegrave, NoSymbol ] }; // 8 *
+ key <AE09> { [ any, any, dead_acute, NoSymbol ] }; // 9 (
+ key <AE10> { [ any, any, dead_invertedbreve, NoSymbol ] }; // 0 )
+ key <AE11> { [ any, any, dead_macron, NoSymbol ] }; // - _
+
+ key <AD01> { [ any, any, backslash, NoSymbol ] }; // q
+ key <AD02> { [ any, any, bar, NoSymbol ] }; // w
+ key <AD03> { [ any, any, EuroSign, sterling ] }; // e
+ key <AD04> { [ any, any, paragraph, registered ] }; // r
+ key <AD05> { [ any, any, ellipsis, NoSymbol ] }; // t // ALPHABETIC
+ key <AD06> { [ any, any, leftarrow, yen ] }; // y
+ key <AD07> { [ any, any, downarrow, uparrow ] }; // u
+ key <AD08> { [ any, any, rightarrow, NoSymbol ] }; // i
+ key <AD09> { [ any, any, section, NoSymbol ] }; // o // ALPHABETIC
+ key <AD11> { [ any, any, division, NoSymbol ] }; // [
+ key <AD12> { [ any, any, multiply, NoSymbol ] }; // ]
+
+ key <AC02> { [ any, any, doublelowquotemark, guillemotright ] }; // s
+ key <AC03> { [ any, any, leftdoublequotemark, guillemotleft ] }; // d
+ key <AC04> { [ any, any, bracketleft, NoSymbol ] }; // f
+ key <AC05> { [ any, any, bracketright, NoSymbol ] }; // g
+ key <BKSL> { [ any, any, currency, NoSymbol ] }; // \
+
+ key <AB01> { [ any, any, leftsinglequotemark, NoSymbol ] }; // z
+ key <AB02> { [ any, any, rightsinglequotemark,NoSymbol ] }; // x
+ key <AB03> { [ any, any, cent, copyright ] }; // c
+ key <AB04> { [ any, any, at, NoSymbol ] }; // v
+ key <AB05> { [ any, any, braceleft, NoSymbol ] }; // b
+ key <AB06> { [ any, any, braceright, NoSymbol ] }; // n
+ key <AB07> { [ any, any, asciicircum, NoSymbol ] }; // m
+ key <AB08> { [ any, any, less, NoSymbol ] }; // , <
+ key <AB09> { [ any, any, greater, NoSymbol ] }; // . >
+ key <AB10> { [ any, any, emdash, endash ] }; // / ?
};
partial alphanumeric_keys
xkb_symbols "latinunicode" {
- // This mapping supports the Unicode characters 0x1c4-0x1cc (dz, lj, and nj
- // as single character). You get the title form with AltGr+Shift.
+ // This mapping supports the Unicode characters 0x1c4-0x1cc (dz, lj, and nj
+ // as single character). You get the title form with AltGr+Shift.
- include "rs(latin)"
+ include "rs(latin)"
+ name[Group1]= "Serbian (Latin Unicode)";
- name[Group1]= "Serbian (Latin Unicode)";
-
- include "rs(twoletter)"
+ include "rs(twoletter)"
};
partial alphanumeric_keys
xkb_symbols "latinyz" {
- // For those who insist on using "english-position" Z and Y.
-
- include "rs(latin)"
+ // For those who insist on using "english-position" Z and Y.
- name[Group1]= "Serbian (Latin qwerty)";
+ include "rs(latin)"
+ name[Group1]= "Serbian (Latin qwerty)";
- key <AD06> { [ y, Y, any,any ] }; // y
- key <AB01> { [ z, Z, any,any ] }; // z
+ key <AD06> { [ y, Y, any, any ] }; // y
+ key <AB01> { [ z, Z, any, any ] }; // z
};
partial alphanumeric_keys
xkb_symbols "latinunicodeyz" {
- // Unicode, ZHE and Z swapped.
-
- include "rs(latinunicode)"
+ // Unicode, ZHE and Z swapped.
- name[Group1]= "Serbian (Latin Unicode qwerty)";
+ include "rs(latinunicode)"
+ name[Group1]= "Serbian (Latin Unicode qwerty)";
- key <AD06> { [ zcaron, Zcaron, any,any ] }; // y
- key <AB01> { [ z, Z, any,any ] }; // z
+ key <AD06> { [ zcaron, Zcaron, any, any ] }; // y
+ key <AB01> { [ z, Z, any, any ] }; // z
};
xkb_symbols "alternatequotes" {
- // Another acceptable »pair of quotes« for Serbian
+ // Another acceptable »pair of quotes« for Serbian.
- include "rs(basic)"
+ include "rs(basic)"
+ name[Group1]= "Serbian (Cyrillic with guillemets)";
- name[Group1]= "Serbian (Cyrillic with guillemets)";
-
- key <AC02> { [ any,any, guillemotright, NoSymbol ] }; // s
- key <AC03> { [ any,any, guillemotleft, NoSymbol ] }; // d
+ key <AC02> { [ any, any, guillemotright, NoSymbol ] }; // s
+ key <AC03> { [ any, any, guillemotleft, NoSymbol ] }; // d
};
xkb_symbols "latinalternatequotes" {
- // Another acceptable »pair of quotes« for Serbian
-
- include "rs(latin)"
+ // Another acceptable »pair of quotes« for Serbian.
- name[Group1]= "Serbian (Latin with guillemets)";
+ include "rs(latin)"
+ name[Group1]= "Serbian (Latin with guillemets)";
- key <AC02> { [ any,any, guillemotright, NoSymbol ] }; // s
- key <AC03> { [ any,any, guillemotleft, NoSymbol ] }; // d
+ key <AC02> { [ any, any, guillemotright, NoSymbol ] }; // s
+ key <AC03> { [ any, any, guillemotleft, NoSymbol ] }; // d
};
xkb_symbols "rue" {
- // Layout for Pannonian Rusyn (spoken mainly in Serbia and
- // Croatia by the Rusyn people), based on Serbian Cyrillic layout.
- // Authors:
- // Ljubomir J. Papuga (Любомир Я. Папуґа) <papuga@zoho.com>
- // Mihajlo Hornjak <smeceiotpad@gmail.com>
-
- include "rs(basic)"
+ // Layout for Pannonian Rusyn (spoken mainly in Serbia and Croatia
+ // by the Rusyn people), based on Serbian Cyrillic layout.
+ // Authors:
+ // Ljubomir J. Papuga (Любомир Я. Папуґа) <papuga@zoho.com>
+ // Mihajlo Hornjak <smeceiotpad@gmail.com>
- name[Group1]= "Pannonian Rusyn";
+ include "rs(basic)"
+ name[Group1]= "Pannonian Rusyn";
- key <TLDE> { [ Cyrillic_softsign, Cyrillic_SOFTSIGN ] }; // `
+ key <TLDE> { [ Cyrillic_softsign, Cyrillic_SOFTSIGN ] }; // `
- key <AD01> { [ Cyrillic_ya, Cyrillic_YA ] }; // q
- key <AD02> { [ Ukrainian_ie, Ukrainian_IE ] }; // w
- key <AD12> { [ Cyrillic_shcha, Cyrillic_SHCHA ] }; // ]
+ key <AD01> { [ Cyrillic_ya, Cyrillic_YA ] }; // q
+ key <AD02> { [ Ukrainian_ie, Ukrainian_IE ] }; // w
+ key <AD12> { [ Cyrillic_shcha, Cyrillic_SHCHA ] }; // ]
- key <AC05> { [ Ukrainian_ghe_with_upturn, Ukrainian_GHE_WITH_UPTURN ] }; // g
- key <AC07> { [ Cyrillic_shorti, Cyrillic_SHORTI ] }; // j
- key <AC11> { [ Cyrillic_ghe, Cyrillic_GHE ] }; // '
+ key <AC05> { [ Ukrainian_ghe_with_upturn, Ukrainian_GHE_WITH_UPTURN ] }; // g
+ key <AC07> { [ Cyrillic_shorti, Cyrillic_SHORTI ] }; // j
+ key <AC11> { [ Cyrillic_ghe, Cyrillic_GHE ] }; // '
- key <AB01> { [ Cyrillic_yu, Cyrillic_YU ] }; // z
- key <AB02> { [ Ukrainian_yi, Ukrainian_YI ] }; // x
+ key <AB01> { [ Cyrillic_yu, Cyrillic_YU ] }; // z
+ key <AB02> { [ Ukrainian_yi, Ukrainian_YI ] }; // x
};
// EXTRAS:
xkb_symbols "combiningkeys" {
- // Raw combining characters instead of dead keys,
- // especially good for post-accenting texts.
-
- include "rs(basic)"
-
- name[Group1]= "Serbian (combining accents instead of dead keys)";
-
- key <AE03> { [ any,any, U0302, dead_circumflex ] }; // 3, U0302 = COMBINING CIRCUMFLEX ACCENT
- key <AE07> { [ any,any, U0300, NoSymbol ] }; // 7, U0300 = COMBINING GRAVE ACCENT
- key <AE08> { [ any,any, U030F, NoSymbol ] }; // 8, U030F = COMBINING DOUBLE GRAVE ACCENT
- key <AE09> { [ any,any, U0301, NoSymbol ] }; // 9, U0301 = COMBINING ACUTE ACCENT
- key <AE10> { [ any,any, U0311, NoSymbol ] }; // 0, U0311 = COMBINING INVERTED BREVE
- key <AE11> { [ any,any, U0304, NoSymbol ] }; // -, U0304 = COMBINING MACRON
+ // Raw combining characters instead of dead keys,
+ // especially good for post-accenting texts.
+
+ include "rs(basic)"
+ name[Group1]= "Serbian (combining accents instead of dead keys)";
+
+ key <AE03> { [ any, any, U0302, dead_circumflex ] }; // 3, U0302 = COMBINING CIRCUMFLEX ACCENT
+ key <AE07> { [ any, any, U0300, NoSymbol ] }; // 7, U0300 = COMBINING GRAVE ACCENT
+ key <AE08> { [ any, any, U030F, NoSymbol ] }; // 8, U030F = COMBINING DOUBLE GRAVE ACCENT
+ key <AE09> { [ any, any, U0301, NoSymbol ] }; // 9, U0301 = COMBINING ACUTE ACCENT
+ key <AE10> { [ any, any, U0311, NoSymbol ] }; // 0, U0311 = COMBINING INVERTED BREVE
+ key <AE11> { [ any, any, U0304, NoSymbol ] }; // -, U0304 = COMBINING MACRON
};
diff --git a/xorg-server/xkeyboard-config/symbols/ru b/xorg-server/xkeyboard-config/symbols/ru
index 2b34a4d52..fd1cc0ec5 100644
--- a/xorg-server/xkeyboard-config/symbols/ru
+++ b/xorg-server/xkeyboard-config/symbols/ru
@@ -182,7 +182,7 @@ xkb_symbols "phonetic" {
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 <LatX> { [ Cyrillic_softsign, Cyrillic_SOFTSIGN ] };
key <LatD> { [ Cyrillic_de, Cyrillic_DE ] };
key <LatE> { [ Cyrillic_ie, Cyrillic_IE ] };
key <LatV> { [ Cyrillic_zhe, Cyrillic_ZHE ] };
@@ -191,7 +191,7 @@ xkb_symbols "phonetic" {
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 <LatH> { [ Cyrillic_ha, Cyrillic_HA ] };
key <LatG> { [ Cyrillic_ghe, Cyrillic_GHE ] };
key <LatY> { [ Cyrillic_yeru, Cyrillic_YERU ] };
key <LatM> { [ Cyrillic_em, Cyrillic_EM ] };
@@ -204,7 +204,7 @@ xkb_symbols "phonetic" {
key <LatP> { [ Cyrillic_pe, Cyrillic_PE ] };
key <AD11> { [ Cyrillic_sha, Cyrillic_SHA ] };
- key <AE12> { [ Cyrillic_softsign, Cyrillic_SOFTSIGN ] };
+ key <AE12> { [ Cyrillic_che, Cyrillic_CHE ] };
key <AD12> { [ Cyrillic_shcha, Cyrillic_SHCHA ] };
key <BKSL> { [ Cyrillic_e, Cyrillic_E ] };
};
@@ -268,10 +268,10 @@ xkb_symbols "cv" {
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, 0x010004f3, 0x010004f2 ] };
+ key <AD05> { [ Cyrillic_ie, Cyrillic_IE, 0x010004d7, 0x010004d6 ] };
+ key <AC04> { [ Cyrillic_a, Cyrillic_A, 0x010004d1, 0x010004d0 ] };
+ key <AB03> { [ Cyrillic_es, Cyrillic_ES, 0x010004ab, 0x010004aa ] };
include "level3(ralt_switch)"
};