aboutsummaryrefslogtreecommitdiff
path: root/xorg-server
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2014-10-01 20:12:35 +0200
committermarha <marha@users.sourceforge.net>2014-10-01 20:12:35 +0200
commit19b4b68b35a047a83bd291ee8debac1adb0e946c (patch)
treed4d4520622ecf73fa0d076dc0bf517a1189b7d9f /xorg-server
parent4e080e0165d18887e2a0fccd7f30cf20fd04b178 (diff)
parent438af0c7d4bf60b408b259c88205ff2193195466 (diff)
downloadvcxsrv-19b4b68b35a047a83bd291ee8debac1adb0e946c.tar.gz
vcxsrv-19b4b68b35a047a83bd291ee8debac1adb0e946c.tar.bz2
vcxsrv-19b4b68b35a047a83bd291ee8debac1adb0e946c.zip
Merge remote-tracking branch 'origin/released'
Conflicts: mesalib/src/mesa/main/macros.h xorg-server/dix/registry.c xorg-server/hw/kdrive/ephyr/ephyrinit.c xorg-server/hw/xwin/Makefile.am xorg-server/hw/xwin/glx/.gitignore xorg-server/hw/xwin/glx/gen_gl_wrappers.py xorg-server/hw/xwin/glx/indirect.c xorg-server/hw/xwin/glx/winpriv.c xorg-server/hw/xwin/winclipboardthread.c xorg-server/hw/xwin/windisplay.c xorg-server/hw/xwin/winmultiwindowwm.c xorg-server/hw/xwin/winprefs.c
Diffstat (limited to 'xorg-server')
-rw-r--r--xorg-server/COPYING24
-rw-r--r--xorg-server/configure.ac41
-rw-r--r--xorg-server/dix/extension.c2
-rw-r--r--xorg-server/dix/main.c2
-rw-r--r--xorg-server/dix/pixmap.c18
-rwxr-xr-x[-rw-r--r--]xorg-server/dix/registry.c98
-rw-r--r--xorg-server/dix/resource.c2
-rw-r--r--xorg-server/glamor/glamor.c12
-rw-r--r--xorg-server/glamor/glamor_glyphs.c86
-rw-r--r--xorg-server/glamor/glamor_largepixmap.c96
-rw-r--r--xorg-server/glamor/glamor_pixmap.c2
-rw-r--r--xorg-server/glamor/glamor_priv.h50
-rw-r--r--xorg-server/glamor/glamor_trapezoid.c1708
-rw-r--r--xorg-server/glx/glxcmds.c7
-rw-r--r--xorg-server/glx/glxdriswrast.c2
-rw-r--r--xorg-server/hw/kdrive/ephyr/Makefile.am1
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyr.h2
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyrcursor.c262
-rwxr-xr-xxorg-server/hw/kdrive/ephyr/ephyrinit.c67
-rwxr-xr-xxorg-server/hw/kdrive/ephyr/hostx.c39
-rw-r--r--xorg-server/hw/kdrive/ephyr/hostx.h4
-rw-r--r--xorg-server/hw/xfree86/Makefile.am2
-rw-r--r--xorg-server/hw/xfree86/doc/README.DRIcomp3
-rw-r--r--xorg-server/hw/xfree86/doc/Registry1
-rw-r--r--xorg-server/hw/xfree86/drivers/Makefile.am5
-rw-r--r--xorg-server/hw/xfree86/drivers/modesetting/Makefile.am61
-rw-r--r--xorg-server/hw/xfree86/drivers/modesetting/driver.c1113
-rw-r--r--xorg-server/hw/xfree86/drivers/modesetting/driver.h81
-rw-r--r--xorg-server/hw/xfree86/drivers/modesetting/drmmode_display.c1616
-rw-r--r--xorg-server/hw/xfree86/drivers/modesetting/drmmode_display.h136
-rw-r--r--xorg-server/hw/xfree86/drivers/modesetting/modesetting.man54
-rw-r--r--xorg-server/hw/xfree86/int10/generic.c16
-rw-r--r--xorg-server/hw/xfree86/loader/loadmod.c46
-rw-r--r--xorg-server/hw/xfree86/man/xorg.conf.man6
-rw-r--r--xorg-server/hw/xfree86/os-support/bsd/Makefile.am4
-rw-r--r--xorg-server/hw/xfree86/os-support/bsd/alpha_video.c434
-rw-r--r--xorg-server/hw/xfree86/os-support/bsd/arm_video.c284
-rw-r--r--xorg-server/hw/xfree86/os-support/bsd/bsd_axp.c71
-rw-r--r--xorg-server/hw/xfree86/os-support/bsd/i386_video.c562
-rw-r--r--xorg-server/hw/xfree86/os-support/bsd/ppc_video.c56
-rw-r--r--xorg-server/hw/xfree86/os-support/bsd/sparc64_video.c40
-rw-r--r--xorg-server/hw/xfree86/os-support/hurd/Makefile.am2
-rw-r--r--xorg-server/hw/xfree86/os-support/hurd/hurd_mmap.c94
-rw-r--r--xorg-server/hw/xfree86/os-support/hurd/hurd_video.c65
-rw-r--r--xorg-server/hw/xfree86/os-support/linux/Makefile.am10
-rw-r--r--xorg-server/hw/xfree86/os-support/linux/int10/linux.c19
-rw-r--r--xorg-server/hw/xfree86/os-support/linux/lnx_axp.c103
-rw-r--r--xorg-server/hw/xfree86/os-support/linux/lnx_init.c6
-rw-r--r--xorg-server/hw/xfree86/os-support/linux/lnx_video.c676
-rw-r--r--xorg-server/hw/xfree86/os-support/shared/bios_mmap.c135
-rw-r--r--xorg-server/hw/xfree86/os-support/shared/vidmem.c205
-rw-r--r--xorg-server/hw/xfree86/os-support/shared/xf86Axp.c60
-rw-r--r--xorg-server/hw/xfree86/os-support/shared/xf86Axp.h33
-rw-r--r--xorg-server/hw/xfree86/os-support/solaris/sun_vid.c140
-rw-r--r--xorg-server/hw/xfree86/os-support/stub/Makefile.am1
-rw-r--r--xorg-server/hw/xfree86/os-support/stub/stub_bios.c12
-rw-r--r--xorg-server/hw/xfree86/os-support/xf86OSpriv.h11
-rw-r--r--xorg-server/hw/xfree86/os-support/xf86_OSproc.h26
-rw-r--r--xorg-server/hw/xwayland/Makefile.am4
-rw-r--r--xorg-server/hw/xwayland/xwayland-input.c9
-rw-r--r--xorg-server/hw/xwayland/xwayland.c48
-rw-r--r--xorg-server/hw/xwayland/xwayland.h1
-rwxr-xr-x[-rw-r--r--]xorg-server/hw/xwin/Makefile.am32
-rwxr-xr-x[-rw-r--r--]xorg-server/hw/xwin/glx/.gitignore0
-rw-r--r--xorg-server/hw/xwin/glx/glwindows.h5
-rwxr-xr-xxorg-server/hw/xwin/glx/indirect.c16
-rwxr-xr-x[-rw-r--r--]xorg-server/hw/xwin/glx/winpriv.c0
-rwxr-xr-x[-rw-r--r--]xorg-server/hw/xwin/winclipboardthread.c3
-rwxr-xr-x[-rw-r--r--]xorg-server/hw/xwin/windisplay.c38
-rw-r--r--xorg-server/hw/xwin/windisplay.h34
-rw-r--r--xorg-server/hw/xwin/winmsg.h2
-rwxr-xr-xxorg-server/hw/xwin/winmultiwindowwm.c5
-rwxr-xr-x[-rw-r--r--]xorg-server/hw/xwin/winprefs.c1
-rw-r--r--xorg-server/hw/xwin/winshadddnl.c4
-rw-r--r--xorg-server/include/dix-config.h.in3
-rwxr-xr-xxorg-server/include/pixmap.h6
-rw-r--r--xorg-server/include/pixmapstr.h1
-rw-r--r--xorg-server/include/registry.h40
-rw-r--r--xorg-server/include/xorg-config.h.in6
-rw-r--r--xorg-server/os/log.c10
-rwxr-xr-xxorg-server/os/utils.c6
-rw-r--r--xorg-server/present/present.c12
-rw-r--r--xorg-server/present/present.h1
-rw-r--r--xorg-server/present/present_event.c2
-rw-r--r--xorg-server/test/Makefile.am5
-rw-r--r--xorg-server/test/list.c24
-rw-r--r--xorg-server/test/signal-logging.c7
-rw-r--r--xorg-server/xkeyboard-config/rules/base.extras.xml.in292
-rw-r--r--xorg-server/xkeyboard-config/rules/base.xml.in269
-rw-r--r--xorg-server/xkeyboard-config/symbols/altwin4
-rw-r--r--xorg-server/xkeyboard-config/symbols/am2
-rw-r--r--xorg-server/xkeyboard-config/symbols/apl27
-rw-r--r--xorg-server/xkeyboard-config/symbols/ara3
-rw-r--r--xorg-server/xkeyboard-config/symbols/bg2
-rw-r--r--xorg-server/xkeyboard-config/symbols/br1
-rw-r--r--xorg-server/xkeyboard-config/symbols/brai2
-rw-r--r--xorg-server/xkeyboard-config/symbols/capslock24
-rw-r--r--xorg-server/xkeyboard-config/symbols/epo3
-rw-r--r--xorg-server/xkeyboard-config/symbols/fi2
-rw-r--r--xorg-server/xkeyboard-config/symbols/group2
-rw-r--r--xorg-server/xkeyboard-config/symbols/inet18
-rw-r--r--xorg-server/xkeyboard-config/symbols/ir67
-rw-r--r--xorg-server/xkeyboard-config/symbols/jp2
-rw-r--r--xorg-server/xkeyboard-config/symbols/keypad10
-rw-r--r--xorg-server/xkeyboard-config/symbols/kr4
-rw-r--r--xorg-server/xkeyboard-config/symbols/kz2
-rwxr-xr-xxorg-server/xkeyboard-config/symbols/level32
-rw-r--r--xorg-server/xkeyboard-config/symbols/pc2
-rw-r--r--xorg-server/xkeyboard-config/symbols/rs12
-rw-r--r--xorg-server/xkeyboard-config/symbols/ru2
110 files changed, 4323 insertions, 5470 deletions
diff --git a/xorg-server/COPYING b/xorg-server/COPYING
index cc52a3282..abf13c2e3 100644
--- a/xorg-server/COPYING
+++ b/xorg-server/COPYING
@@ -8,6 +8,7 @@ possible, and insert their name to this list. Please sort by surname
for people, and by the full name for other entities (e.g. Juliusz
Chroboczek sorts before Intel Corporation sorts before Daniel Stone).
+Copyright © 2011 Dave Airlie
Copyright © 2000-2001 Juliusz Chroboczek
Copyright © 1998 Egbert Eich
Copyright © 2006-2007 Intel Corporation
@@ -145,6 +146,29 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from the X Consortium.
+Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
+
+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, sub license, 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 NON-INFRINGEMENT.
+IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS 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.
+
+
Copyright © 1999-2000 SuSE, Inc.
Copyright © 2007 Red Hat, Inc.
diff --git a/xorg-server/configure.ac b/xorg-server/configure.ac
index cba7d24ea..be8bff629 100644
--- a/xorg-server/configure.ac
+++ b/xorg-server/configure.ac
@@ -235,29 +235,6 @@ dnl fbdev header
AC_CHECK_HEADERS([linux/fb.h], FBDEV=yes)
AM_CONDITIONAL(FBDEVHW, [test "x$FBDEV" = xyes])
-dnl MTRR header
-AC_CHECK_HEADERS([asm/mtrr.h], ac_cv_asm_mtrr_h=yes)
-if test "x$ac_cv_asm_mtrr_h" = xyes; then
- HAVE_MTRR=yes
-fi
-
-dnl BSD MTRR header
-AC_CHECK_HEADERS([sys/memrange.h], ac_cv_memrange_h=yes)
-if test "x$ac_cv_memrange_h" = xyes; then
- HAVE_MTRR=yes
-fi
-
-if test "x$HAVE_MTRR" = xyes; then
- AC_DEFINE(HAS_MTRR_SUPPORT, 1, [MTRR support available])
-fi
-
-dnl A NetBSD MTRR header
-AC_CHECK_HEADERS([machine/mtrr.h], ac_cv_machine_mtrr_h=yes)
-if test "x$ac_cv_machine_mtrr_h" = xyes; then
- AC_DEFINE(HAS_MTRR_BUILTIN, 1, [Define to 1 if NetBSD built-in MTRR
- support is available])
-fi
-
dnl FreeBSD kldload support (sys/linker.h)
AC_CHECK_HEADERS([sys/linker.h],
[ac_cv_sys_linker_h=yes],
@@ -587,7 +564,6 @@ AC_ARG_WITH(khronos-spec-dir, AS_HELP_STRING([--with-khronos-spec-dir=PATH], [Pa
[KHRONOS_SPEC_DIR=auto])
dnl Extensions.
-AC_ARG_ENABLE(registry, AS_HELP_STRING([--disable-registry], [Build string registry module (default: enabled)]), [XREGISTRY=$enableval], [XREGISTRY=yes])
AC_ARG_ENABLE(composite, AS_HELP_STRING([--disable-composite], [Build Composite extension (default: enabled)]), [COMPOSITE=$enableval], [COMPOSITE=yes])
AC_ARG_ENABLE(mitshm, AS_HELP_STRING([--disable-mitshm], [Build SHM extension (default: auto)]), [MITSHM=$enableval], [MITSHM=auto])
AC_ARG_ENABLE(xres, AS_HELP_STRING([--disable-xres], [Build XRes extension (default: enabled)]), [RES=$enableval], [RES=yes])
@@ -863,6 +839,7 @@ fi
PKG_CHECK_MODULES(UDEV, $LIBUDEV, [HAVE_LIBUDEV=yes], [HAVE_LIBUDEV=no])
if test "x$CONFIG_UDEV" = xauto; then
CONFIG_UDEV="$HAVE_LIBUDEV"
+ AC_DEFINE(HAVE_LIBUDEV, 1, [Define to 1 if libudev is available.])
fi
AM_CONDITIONAL(CONFIG_UDEV, [test "x$CONFIG_UDEV" = xyes])
if test "x$CONFIG_UDEV" = xyes; then
@@ -1038,11 +1015,6 @@ if test "x$XVMC" = xyes; then
AC_DEFINE(XvMCExtension, 1, [Build XvMC extension])
fi
-AM_CONDITIONAL(XREGISTRY, [test "x$XREGISTRY" = xyes])
-if test "x$XREGISTRY" = xyes; then
- AC_DEFINE(XREGISTRY, 1, [Build registry module])
-fi
-
AM_CONDITIONAL(COMPOSITE, [test "x$COMPOSITE" = xyes])
if test "x$COMPOSITE" = xyes; then
AC_DEFINE(COMPOSITE, 1, [Support Composite Extension])
@@ -2039,6 +2011,12 @@ if test "x$XORG" = xyes; then
XORG_SYS_LIBS="$XORG_SYS_LIBS $XORG_MODULES_LIBS"
fi
+ if test "x$DRM" = xyes; then
+ dnl 2.4.46 is required for cursor hotspot support.
+ PKG_CHECK_EXISTS(libdrm >= 2.4.46)
+ XORG_DRIVER_MODESETTING=yes
+ fi
+
AC_SUBST([XORG_LIBS])
AC_SUBST([XORG_SYS_LIBS])
AC_SUBST([XORG_INCS])
@@ -2109,6 +2087,7 @@ AM_CONDITIONAL([SOLARIS_VT], [test "x$solaris_vt" = xyes])
AM_CONDITIONAL([DGA], [test "x$DGA" = xyes])
AM_CONDITIONAL([XF86VIDMODE], [test "x$XF86VIDMODE" = xyes])
AM_CONDITIONAL([XORG_BUS_PLATFORM], [test "x$CONFIG_UDEV_KMS" = xyes])
+AM_CONDITIONAL([XORG_DRIVER_MODESETTING], [test "x$XORG_DRIVER_MODESETTING" = xyes])
dnl glamor
AM_CONDITIONAL([GLAMOR], [test "x$GLAMOR" = xyes])
@@ -2364,7 +2343,7 @@ if test "$KDRIVE" = yes; then
AC_DEFINE(KDRIVE_MOUSE, 1, [Enable KDrive mouse driver])
fi
- XEPHYR_REQUIRED_LIBS="xau xdmcp xcb xcb-shape xcb-aux xcb-image xcb-icccm xcb-shm xcb-keysyms xcb-randr"
+ XEPHYR_REQUIRED_LIBS="xau xdmcp xcb xcb-shape xcb-render xcb-renderutil xcb-aux xcb-image xcb-icccm xcb-shm xcb-keysyms xcb-randr"
if test "x$XV" = xyes; then
XEPHYR_REQUIRED_LIBS="$XEPHYR_REQUIRED_LIBS xcb-xv"
fi
@@ -2554,6 +2533,8 @@ hw/xfree86/dixmods/Makefile
hw/xfree86/doc/Makefile
hw/xfree86/dri/Makefile
hw/xfree86/dri2/Makefile
+hw/xfree86/drivers/Makefile
+hw/xfree86/drivers/modesetting/Makefile
hw/xfree86/exa/Makefile
hw/xfree86/exa/man/Makefile
hw/xfree86/fbdevhw/Makefile
diff --git a/xorg-server/dix/extension.c b/xorg-server/dix/extension.c
index 8240c42d9..1b8eefda9 100644
--- a/xorg-server/dix/extension.c
+++ b/xorg-server/dix/extension.c
@@ -139,7 +139,9 @@ AddExtension(const char *name, int NumEvents, int NumErrors,
ext->errorLast = 0;
}
+#ifdef X_REGISTRY_REQUEST
RegisterExtensionNames(ext);
+#endif
return ext;
}
diff --git a/xorg-server/dix/main.c b/xorg-server/dix/main.c
index 84c47d46e..c1b81aca0 100644
--- a/xorg-server/dix/main.c
+++ b/xorg-server/dix/main.c
@@ -314,6 +314,8 @@ dix_main(int argc, char *argv[], char *envp[])
dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
+ dixCloseRegistry();
+
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
if (!PanoramiXCreateConnectionBlock()) {
diff --git a/xorg-server/dix/pixmap.c b/xorg-server/dix/pixmap.c
index 4b880af58..00e298f5c 100644
--- a/xorg-server/dix/pixmap.c
+++ b/xorg-server/dix/pixmap.c
@@ -164,9 +164,9 @@ PixmapPtr PixmapShareToSlave(PixmapPtr pixmap, ScreenPtr slave)
}
Bool
-PixmapStartDirtyTracking(PixmapPtr src,
- PixmapPtr slave_dst,
- int x, int y)
+PixmapStartDirtyTracking2(PixmapPtr src,
+ PixmapPtr slave_dst,
+ int x, int y, int dst_x, int dst_y)
{
ScreenPtr screen = src->drawable.pScreen;
PixmapDirtyUpdatePtr dirty_update;
@@ -179,6 +179,8 @@ PixmapStartDirtyTracking(PixmapPtr src,
dirty_update->slave_dst = slave_dst;
dirty_update->x = x;
dirty_update->y = y;
+ dirty_update->dst_x = dst_x;
+ dirty_update->dst_y = dst_y;
dirty_update->damage = DamageCreate(NULL, NULL,
DamageReportNone,
@@ -195,6 +197,14 @@ PixmapStartDirtyTracking(PixmapPtr src,
}
Bool
+PixmapStartDirtyTracking(PixmapPtr src,
+ PixmapPtr slave_dst,
+ int x, int y)
+{
+ return PixmapStartDirtyTracking2(src, slave_dst, x, y, 0, 0);
+}
+
+Bool
PixmapStopDirtyTracking(PixmapPtr src, PixmapPtr slave_dst)
{
ScreenPtr screen = src->drawable.pScreen;
@@ -261,7 +271,7 @@ Bool PixmapSyncDirtyHelper(PixmapDirtyUpdatePtr dirty, RegionPtr dirty_region)
h = dst_box.y2 - dst_box.y1;
pGC->ops->CopyArea(&dirty->src->drawable, &dst->drawable, pGC,
- dirty->x + dst_box.x1, dirty->y + dst_box.y1, w, h, dst_box.x1, dst_box.y1);
+ dirty->x + dst_box.x1, dirty->y + dst_box.y1, w, h, dirty->dst_x + dst_box.x1, dirty->dst_y + dst_box.y1);
b++;
}
FreeScratchGC(pGC);
diff --git a/xorg-server/dix/registry.c b/xorg-server/dix/registry.c
index ce741c28e..aaccfbd09 100644..100755
--- a/xorg-server/dix/registry.c
+++ b/xorg-server/dix/registry.c
@@ -21,8 +21,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <dix-config.h>
#endif
-#ifdef XREGISTRY
-
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
@@ -32,6 +30,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "registry.h"
#define BASE_SIZE 16
+
+#ifdef X_REGISTRY_REQUEST
#define CORE "X11"
#define FILENAME SERVER_MISC_CONFIG_PATH "/protocol.txt"
@@ -43,9 +43,15 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
static FILE *fh;
static char ***requests, **events, **errors;
+static unsigned nmajor, *nminor, nevent, nerror;
+#endif
+
+#ifdef X_REGISTRY_RESOURCE
static const char **resources;
-static unsigned nmajor, *nminor, nevent, nerror, nresource;
+static unsigned nresource;
+#endif
+#if defined(X_REGISTRY_RESOURCE) || defined(X_REGISTRY_REQUEST)
/*
* File parsing routines
*/
@@ -73,7 +79,12 @@ double_size(void *p, unsigned n, unsigned size)
memset(*ptr + s, 0, f - s);
return TRUE;
}
+#endif
+#ifdef X_REGISTRY_REQUEST
+/*
+ * Request/event/error registry functions
+ */
static void
RegisterRequestName(unsigned major, unsigned minor, char *name)
{
@@ -198,28 +209,6 @@ RegisterExtensionNames(ExtensionEntry * extEntry)
}
}
-/*
- * Registration functions
- */
-
-void
-RegisterResourceName(RESTYPE resource, const char *name)
-{
- resource &= TypeMask;
-
- while (resource >= nresource) {
- if (!double_size((void*)&resources, nresource, sizeof(char *)))
- return;
- nresource = nresource ? nresource * 2 : BASE_SIZE;
- }
-
- resources[resource] = name;
-}
-
-/*
- * Lookup functions
- */
-
const char *
LookupRequestName(int major, int minor)
{
@@ -270,6 +259,26 @@ LookupErrorName(int error)
return errors[error] ? errors[error] : XREGISTRY_UNKNOWN;
}
+#endif /* X_REGISTRY_REQUEST */
+
+#ifdef X_REGISTRY_RESOURCE
+/*
+ * Resource registry functions
+ */
+
+void
+RegisterResourceName(RESTYPE resource, const char *name)
+{
+ resource &= TypeMask;
+
+ while (resource >= nresource) {
+ if (!double_size((void*)&resources, nresource, sizeof(char *)))
+ return;
+ nresource = nresource ? nresource * 2 : BASE_SIZE;
+ }
+
+ resources[resource] = name;
+}
const char *
LookupResourceName(RESTYPE resource)
@@ -280,10 +289,12 @@ LookupResourceName(RESTYPE resource)
return resources[resource] ? resources[resource] : XREGISTRY_UNKNOWN;
}
+#endif /* X_REGISTRY_RESOURCE */
void
dixFreeRegistry(void)
{
+#ifdef X_REGISTRY_REQUEST
/* Free all memory */
while (nmajor--) {
while (nminor[nmajor])
@@ -300,21 +311,30 @@ dixFreeRegistry(void)
while (nerror--)
free(errors[nerror]);
free(errors);
-
- free((void*)resources);
-
requests = NULL;
nminor = NULL;
events = NULL;
errors = NULL;
- resources = NULL;
+ nmajor = nevent = nerror = 0;
+#endif
- nmajor = nevent = nerror = nresource = 0;
+#ifdef X_REGISTRY_RESOURCE
+ free((void*)resources);
+
+ resources = NULL;
+ nresource = 0;
+#endif
+}
+void
+dixCloseRegistry(void)
+{
+#ifdef X_REGISTRY_REQUEST
if (fh) {
fclose(fh);
fh = NULL;
}
+#endif
}
/*
@@ -323,16 +343,26 @@ dixFreeRegistry(void)
void
dixResetRegistry(void)
{
+#ifdef X_REGISTRY_REQUEST
ExtensionEntry extEntry;
+#endif
dixFreeRegistry();
+#ifdef X_REGISTRY_REQUEST
/* Open the protocol file */
fh = fopen(FILENAME, "r");
if (!fh)
LogMessage(X_WARNING,
"Failed to open protocol names file " FILENAME "\n");
+ /* Add the core protocol */
+ memset(&extEntry, 0, sizeof(extEntry));
+ extEntry.name = CORE;
+ RegisterExtensionNames(&extEntry);
+#endif
+
+#ifdef X_REGISTRY_RESOURCE
/* Add built-in resources */
RegisterResourceName(RT_NONE, "NONE");
RegisterResourceName(RT_WINDOW, "WINDOW");
@@ -344,11 +374,5 @@ dixResetRegistry(void)
RegisterResourceName(RT_CMAPENTRY, "COLORMAP ENTRY");
RegisterResourceName(RT_OTHERCLIENT, "OTHER CLIENT");
RegisterResourceName(RT_PASSIVEGRAB, "PASSIVE GRAB");
-
- /* Add the core protocol */
- memset(&extEntry, 0, sizeof(extEntry));
- extEntry.name = CORE;
- RegisterExtensionNames(&extEntry);
+#endif
}
-
-#endif /* XREGISTRY */
diff --git a/xorg-server/dix/resource.c b/xorg-server/dix/resource.c
index a3f5fc845..fc725dbc9 100644
--- a/xorg-server/dix/resource.c
+++ b/xorg-server/dix/resource.c
@@ -524,8 +524,10 @@ CreateNewResourceType(DeleteType deleteFunc, const char *name)
resourceTypes[next].findSubResFunc = DefaultFindSubRes;
resourceTypes[next].errorValue = BadValue;
+#if X_REGISTRY_RESOURCE
/* Called even if name is NULL, to remove any previous entry */
RegisterResourceName(next, name);
+#endif
return next;
}
diff --git a/xorg-server/glamor/glamor.c b/xorg-server/glamor/glamor.c
index 521bc25c8..fc24b1bdd 100644
--- a/xorg-server/glamor/glamor.c
+++ b/xorg-server/glamor/glamor.c
@@ -296,6 +296,11 @@ glamor_create_screen_resources(ScreenPtr screen)
ret = screen->CreateScreenResources(screen);
screen->CreateScreenResources = glamor_create_screen_resources;
+ if (!glamor_glyphs_init(screen)) {
+ ErrorF("Failed to initialize glyphs\n");
+ ret = FALSE;
+ }
+
if (!glamor_realize_glyph_caches(screen)) {
ErrorF("Failed to initialize glyph cache\n");
ret = FALSE;
@@ -510,15 +515,11 @@ glamor_init(ScreenPtr screen, unsigned int flags)
glamor_init_vbo(screen);
glamor_init_pixmap_fbo(screen);
-#ifdef GLAMOR_TRAPEZOID_SHADER
- glamor_init_trapezoid_shader(screen);
-#endif
glamor_init_finish_access_shaders(screen);
#ifdef GLAMOR_GRADIENT_SHADER
glamor_init_gradient_shader(screen);
#endif
glamor_pixmap_init(screen);
- glamor_glyphs_init(screen);
glamor_sync_init(screen);
glamor_priv->screen = screen;
@@ -542,9 +543,6 @@ glamor_release_screen_priv(ScreenPtr screen)
#endif
glamor_fini_vbo(screen);
glamor_fini_pixmap_fbo(screen);
-#ifdef GLAMOR_TRAPEZOID_SHADER
- glamor_fini_trapezoid_shader(screen);
-#endif
glamor_fini_finish_access_shaders(screen);
#ifdef GLAMOR_GRADIENT_SHADER
glamor_fini_gradient_shader(screen);
diff --git a/xorg-server/glamor/glamor_glyphs.c b/xorg-server/glamor/glamor_glyphs.c
index f570d7519..1f1362487 100644
--- a/xorg-server/glamor/glamor_glyphs.c
+++ b/xorg-server/glamor/glamor_glyphs.c
@@ -62,14 +62,6 @@
*/
#define GLYPH_BUFFER_SIZE 1024
-#define CACHE_PICTURE_SIZE 1024
-#define GLYPH_MIN_SIZE 8
-#define GLYPH_MAX_SIZE 64
-#define GLYPH_CACHE_SIZE ((CACHE_PICTURE_SIZE) * CACHE_PICTURE_SIZE / (GLYPH_MIN_SIZE * GLYPH_MIN_SIZE))
-#define MASK_CACHE_MAX_SIZE 32
-#define MASK_CACHE_WIDTH (CACHE_PICTURE_SIZE / MASK_CACHE_MAX_SIZE)
-#define MASK_CACHE_MASK ((1LL << (MASK_CACHE_WIDTH)) - 1)
-
typedef struct {
PicturePtr source;
glamor_composite_rect_t rects[GLYPH_BUFFER_SIZE + 4];
@@ -96,9 +88,11 @@ typedef enum {
static DevPrivateKeyRec glamor_glyph_key;
static inline struct glamor_glyph *
-glamor_glyph_get_private(GlyphPtr glyph)
+glamor_glyph_get_private(ScreenPtr screen, GlyphPtr glyph)
{
- return (struct glamor_glyph *) glyph->devPrivates;
+ struct glamor_glyph *privates = (struct glamor_glyph*)glyph->devPrivates;
+
+ return &privates[screen->myNum];
}
/*
@@ -121,24 +115,8 @@ glamor_glyph_get_private(GlyphPtr glyph)
* gain.
*/
-struct glamor_glyph_mask_cache_entry {
- int idx;
- int width;
- int height;
- int x;
- int y;
-};
-
-static struct glamor_glyph_mask_cache {
- PixmapPtr pixmap;
- struct glamor_glyph_mask_cache_entry mcache[MASK_CACHE_WIDTH];
- unsigned int free_bitmap;
- unsigned int cleared_bitmap;
-} *mask_cache[GLAMOR_NUM_GLYPH_CACHE_FORMATS] = {
-NULL};
-
static void
-clear_mask_cache_bitmap(struct glamor_glyph_mask_cache *maskcache,
+clear_mask_cache_bitmap(glamor_glyph_mask_cache_t *maskcache,
unsigned int clear_mask_bits)
{
unsigned int i = 0;
@@ -160,7 +138,7 @@ clear_mask_cache_bitmap(struct glamor_glyph_mask_cache *maskcache,
}
static void
-clear_mask_cache(struct glamor_glyph_mask_cache *maskcache)
+clear_mask_cache(glamor_glyph_mask_cache_t *maskcache)
{
int x = 0;
int cnt = MASK_CACHE_WIDTH;
@@ -222,7 +200,7 @@ find_continuous_bits(unsigned int bits, int bits_cnt, unsigned int *pbits_mask)
}
static struct glamor_glyph_mask_cache_entry *
-get_mask_cache(struct glamor_glyph_mask_cache *maskcache, int blocks)
+get_mask_cache(glamor_glyph_mask_cache_t *maskcache, int blocks)
{
int free_cleared_bit, idx = -1;
int retry_cnt = 0;
@@ -255,7 +233,7 @@ get_mask_cache(struct glamor_glyph_mask_cache *maskcache, int blocks)
}
static void
-put_mask_cache_bitmap(struct glamor_glyph_mask_cache *maskcache,
+put_mask_cache_bitmap(glamor_glyph_mask_cache_t *maskcache,
unsigned int bitmap)
{
maskcache->free_bitmap |= bitmap;
@@ -269,7 +247,7 @@ glamor_unrealize_glyph_caches(ScreenPtr pScreen)
glamor_screen_private *glamor = glamor_get_screen_private(pScreen);
int i;
- if (!glamor->glyph_cache_initialized)
+ if (!glamor->glyph_caches_realized)
return;
for (i = 0; i < GLAMOR_NUM_GLYPH_CACHE_FORMATS; i++) {
@@ -281,10 +259,10 @@ glamor_unrealize_glyph_caches(ScreenPtr pScreen)
if (cache->glyphs)
free(cache->glyphs);
- if (mask_cache[i])
- free(mask_cache[i]);
+ if (glamor->mask_cache[i])
+ free(glamor->mask_cache[i]);
}
- glamor->glyph_cache_initialized = FALSE;
+ glamor->glyph_caches_realized = FALSE;
}
void
@@ -314,6 +292,9 @@ glamor_realize_glyph_caches(ScreenPtr pScreen)
};
int i;
+ if (glamor->glyph_caches_realized)
+ return TRUE;
+
memset(glamor->glyphCaches, 0, sizeof(glamor->glyphCaches));
for (i = 0; i < sizeof(formats) / sizeof(formats[0]); i++) {
@@ -353,12 +334,13 @@ glamor_realize_glyph_caches(ScreenPtr pScreen)
goto bail;
cache->evict = rand() % GLYPH_CACHE_SIZE;
- mask_cache[i] = calloc(1, sizeof(*mask_cache[i]));
- mask_cache[i]->pixmap = pixmap;
- clear_mask_cache(mask_cache[i]);
+ glamor->mask_cache[i] = calloc(1, sizeof(*glamor->mask_cache[i]));
+ glamor->mask_cache[i]->pixmap = pixmap;
+ clear_mask_cache(glamor->mask_cache[i]);
}
assert(i == GLAMOR_NUM_GLYPH_CACHE_FORMATS);
+ glamor->glyph_caches_realized = TRUE;
return TRUE;
bail:
@@ -375,17 +357,11 @@ glamor_realize_glyph_caches(ScreenPtr pScreen)
Bool
glamor_glyphs_init(ScreenPtr pScreen)
{
- glamor_screen_private *glamor = glamor_get_screen_private(pScreen);
-
- if (glamor->glyph_cache_initialized)
- return TRUE;
-
if (!dixRegisterPrivateKey(&glamor_glyph_key,
- PRIVATE_GLYPH, sizeof(struct glamor_glyph)))
+ PRIVATE_GLYPH,
+ screenInfo.numScreens * sizeof(struct glamor_glyph)))
return FALSE;
- glamor->glyph_cache_initialized = TRUE;
-
return TRUE;
}
@@ -463,7 +439,7 @@ glamor_glyph_unrealize(ScreenPtr screen, GlyphPtr glyph)
struct glamor_glyph *priv;
/* Use Lookup in case we have not attached to this glyph. */
- priv = glamor_glyph_get_private(glyph);
+ priv = glamor_glyph_get_private(screen, glyph);
if (priv->cached)
priv->cache->glyphs[priv->pos] = NULL;
@@ -794,7 +770,7 @@ glamor_glyphs_intersect(int nlist, GlyphListPtr list, GlyphPtr *glyphs,
if (y1 < MINSHORT)
y1 = MINSHORT;
if (check_fake_overlap)
- priv = glamor_glyph_get_private(glyph);
+ priv = glamor_glyph_get_private(screen, glyph);
x2 = x1 + glyph->info.width;
y2 = y1 + glyph->info.height;
@@ -1082,7 +1058,7 @@ glamor_glyph_cache(glamor_screen_private *glamor, GlyphPtr glyph, int *out_x,
mask = glamor_glyph_count_to_mask(s);
pos = (cache->count + s - 1) & mask;
- priv = glamor_glyph_get_private(glyph);
+ priv = glamor_glyph_get_private(screen, glyph);
if (pos < GLYPH_CACHE_SIZE) {
cache->count = pos + s;
}
@@ -1094,7 +1070,7 @@ glamor_glyph_cache(glamor_screen_private *glamor, GlyphPtr glyph, int *out_x,
if (evicted == NULL)
continue;
- evicted_priv = glamor_glyph_get_private(evicted);
+ evicted_priv = glamor_glyph_get_private(screen, evicted);
assert(evicted_priv->pos == i);
if (evicted_priv->size >= s) {
cache->glyphs[i] = NULL;
@@ -1115,7 +1091,7 @@ glamor_glyph_cache(glamor_screen_private *glamor, GlyphPtr glyph, int *out_x,
if (evicted != NULL) {
- evicted_priv = glamor_glyph_get_private(evicted);
+ evicted_priv = glamor_glyph_get_private(screen, evicted);
assert(evicted_priv->pos == pos + s);
evicted_priv->cached = FALSE;
@@ -1182,7 +1158,7 @@ unsigned long long dst_glyphs_cnt = 0;
struct glyphs_flush_mask_arg {
PicturePtr mask;
glamor_glyph_buffer_t *buffer;
- struct glamor_glyph_mask_cache *maskcache;
+ glamor_glyph_mask_cache_t *maskcache;
unsigned int used_bitmap;
};
@@ -1242,7 +1218,7 @@ glamor_buffer_glyph(glamor_screen_private *glamor_priv,
glamor_glyph_cache_t *cache;
if (glyphs_dst_mode != GLYPHS_DST_MODE_MASK_TO_DST)
- priv = glamor_glyph_get_private(glyph);
+ priv = glamor_glyph_get_private(screen, glyph);
if (PICT_FORMAT_BPP(format) == 1)
format = PICT_a8;
@@ -1300,7 +1276,7 @@ glamor_buffer_glyph(glamor_screen_private *glamor_priv,
rect->x_src = 0 + dx;
rect->y_src = 0 + dy;
}
- priv = glamor_glyph_get_private(glyph);
+ priv = glamor_glyph_get_private(screen, glyph);
}
rect->x_dst = x_glyph;
@@ -1398,7 +1374,7 @@ glamor_glyphs_via_mask(CARD8 op,
glamor_glyph_buffer_t *pmask_buffer;
struct glyphs_flush_mask_arg *pmask_arg;
struct glamor_glyph_mask_cache_entry *mce = NULL;
- struct glamor_glyph_mask_cache *maskcache;
+ glamor_glyph_mask_cache_t *maskcache;
glamor_glyph_cache_t *cache;
int glyphs_dst_mode;
@@ -1419,7 +1395,7 @@ glamor_glyphs_via_mask(CARD8 op,
cache = &glamor_priv->glyphCaches
[PICT_FORMAT_RGB(mask_format->format) != 0];
- maskcache = mask_cache[PICT_FORMAT_RGB(mask_format->format) != 0];
+ maskcache = glamor_priv->mask_cache[PICT_FORMAT_RGB(mask_format->format) != 0];
x = -extents.x1;
y = -extents.y1;
diff --git a/xorg-server/glamor/glamor_largepixmap.c b/xorg-server/glamor/glamor_largepixmap.c
index 5a4bec571..9b2458453 100644
--- a/xorg-server/glamor/glamor_largepixmap.c
+++ b/xorg-server/glamor/glamor_largepixmap.c
@@ -2,6 +2,12 @@
#include "glamor_priv.h"
+static inline glamor_pixmap_private_large_t *
+__glamor_large(glamor_pixmap_private *pixmap_priv) {
+ assert(pixmap_priv->type == GLAMOR_TEXTURE_LARGE);
+ return &pixmap_priv->large;
+}
+
/**
* Clip the boxes regards to each pixmap's block array.
*
@@ -154,9 +160,9 @@ glamor_compute_clipped_regions_ext(glamor_pixmap_private *pixmap_priv,
*result_regions;
int i, j, x, y, k, inner_n_regions;
int width, height;
- glamor_pixmap_private_large_t *priv;
-
- priv = &pixmap_priv->large;
+ BoxPtr box_array;
+ BoxRec small_box;
+ int block_w, block_h;
DEBUGF("ext called \n");
@@ -170,14 +176,16 @@ glamor_compute_clipped_regions_ext(glamor_pixmap_private *pixmap_priv,
clipped_regions[0].block_idx = 0;
RegionCopy(clipped_regions[0].region, region);
*n_region = 1;
- priv->block_w = priv->base.pixmap->drawable.width;
- priv->block_h = priv->base.pixmap->drawable.height;
- priv->box_array = &priv->box;
- priv->box.x1 = priv->box.y1 = 0;
- priv->box.x2 = priv->block_w;
- priv->box.y2 = priv->block_h;
+ block_w = pixmap_priv->base.pixmap->drawable.width;
+ block_h = pixmap_priv->base.pixmap->drawable.height;
+ box_array = &small_box;
+ small_box.x1 = small_box.y1 = 0;
+ small_box.x2 = block_w;
+ small_box.y2 = block_h;
}
else {
+ glamor_pixmap_private_large_t *priv = __glamor_large(pixmap_priv);
+
clipped_regions = __glamor_compute_clipped_regions(priv->block_w,
priv->block_h,
priv->block_wcnt,
@@ -193,20 +201,23 @@ glamor_compute_clipped_regions_ext(glamor_pixmap_private *pixmap_priv,
*n_region = 0;
return NULL;
}
+ block_w = priv->block_w;
+ block_h = priv->block_h;
+ box_array = priv->box_array;
}
- if (inner_block_w >= priv->block_w && inner_block_h >= priv->block_h)
+ if (inner_block_w >= block_w && inner_block_h >= block_h)
return clipped_regions;
result_regions = calloc(*n_region
- * ((priv->block_w + inner_block_w - 1) /
+ * ((block_w + inner_block_w - 1) /
inner_block_w)
- * ((priv->block_h + inner_block_h - 1) /
+ * ((block_h + inner_block_h - 1) /
inner_block_h), sizeof(*result_regions));
k = 0;
for (i = 0; i < *n_region; i++) {
- x = priv->box_array[clipped_regions[i].block_idx].x1;
- y = priv->box_array[clipped_regions[i].block_idx].y1;
- width = priv->box_array[clipped_regions[i].block_idx].x2 - x;
- height = priv->box_array[clipped_regions[i].block_idx].y2 - y;
+ x = box_array[clipped_regions[i].block_idx].x1;
+ y = box_array[clipped_regions[i].block_idx].y1;
+ width = box_array[clipped_regions[i].block_idx].x2 - x;
+ height = box_array[clipped_regions[i].block_idx].y2 - y;
inner_regions = __glamor_compute_clipped_regions(inner_block_w,
inner_block_h,
0, x, y,
@@ -343,8 +354,6 @@ _glamor_compute_clipped_regions(glamor_pixmap_private *pixmap_priv,
int x_center_shift = 0, y_center_shift = 0;
glamor_pixmap_private_large_t *priv;
- priv = &pixmap_priv->large;
-
DEBUGRegionPrint(region);
if (pixmap_priv->type != GLAMOR_TEXTURE_LARGE) {
clipped_regions = calloc(1, sizeof(*clipped_regions));
@@ -355,6 +364,8 @@ _glamor_compute_clipped_regions(glamor_pixmap_private *pixmap_priv,
return clipped_regions;
}
+ priv = __glamor_large(pixmap_priv);
+
pixmap_width = priv->base.pixmap->drawable.width;
pixmap_height = priv->base.pixmap->drawable.height;
if (repeat_type == 0 || repeat_type == RepeatPad) {
@@ -751,7 +762,7 @@ glamor_merge_clipped_regions(glamor_pixmap_private *pixmap_priv,
int pixmap_width, pixmap_height;
glamor_pixmap_private_large_t *priv;
- priv = &pixmap_priv->large;
+ priv = __glamor_large(pixmap_priv);
pixmap_width = priv->base.pixmap->drawable.width;
pixmap_height = priv->base.pixmap->drawable.height;
@@ -970,7 +981,7 @@ _glamor_process_transformed_clipped_region(glamor_pixmap_private *priv,
need_clean_fbo);
}
else {
- SET_PIXMAP_FBO_CURRENT(priv, clipped_regions[0].block_idx);
+ glamor_set_pixmap_fbo_current(priv, clipped_regions[0].block_idx);
if (repeat_type == RepeatReflect || repeat_type == RepeatNormal) {
/* The required source areas are in one region,
* we need to shift the corresponding box's coords to proper position,
@@ -985,15 +996,15 @@ _glamor_process_transformed_clipped_region(glamor_pixmap_private *priv,
shift_y = (temp_box->y1 - rem) / priv->base.pixmap->drawable.height;
if (shift_x != 0) {
- priv->large.box.x1 +=
+ __glamor_large(priv)->box.x1 +=
shift_x * priv->base.pixmap->drawable.width;
- priv->large.box.x2 +=
+ __glamor_large(priv)->box.x2 +=
shift_x * priv->base.pixmap->drawable.width;
}
if (shift_y != 0) {
- priv->large.box.y1 +=
+ __glamor_large(priv)->box.y1 +=
shift_y * priv->base.pixmap->drawable.height;
- priv->large.box.y2 +=
+ __glamor_large(priv)->box.y2 +=
shift_y * priv->base.pixmap->drawable.height;
}
}
@@ -1028,6 +1039,7 @@ glamor_composite_largepixmap_region(CARD8 op,
int is_normal_source_fbo = 0;
int is_normal_mask_fbo = 0;
int fixed_block_width, fixed_block_height;
+ int dest_block_width, dest_block_height;
int null_source, null_mask;
glamor_pixmap_private *need_free_source_pixmap_priv = NULL;
glamor_pixmap_private *need_free_mask_pixmap_priv = NULL;
@@ -1044,8 +1056,16 @@ glamor_composite_largepixmap_region(CARD8 op,
else
mask_repeat_type = RepeatNone;
- fixed_block_width = dest_pixmap_priv->large.block_w;
- fixed_block_height = dest_pixmap_priv->large.block_h;
+ if (dest_pixmap_priv->type == GLAMOR_TEXTURE_LARGE) {
+ dest_block_width = __glamor_large(dest_pixmap_priv)->block_w;
+ dest_block_height = __glamor_large(dest_pixmap_priv)->block_h;
+ } else {
+ dest_block_width = dest_pixmap_priv->base.pixmap->drawable.width;
+ dest_block_height = dest_pixmap_priv->base.pixmap->drawable.height;
+ }
+ fixed_block_width = dest_block_width;
+ fixed_block_height = dest_block_height;
+
/* If we got an totally out-of-box region for a source or mask
* region without repeat, we need to set it as null_source and
* give it a solid color (0,0,0,0). */
@@ -1071,8 +1091,8 @@ glamor_composite_largepixmap_region(CARD8 op,
int source_transformed_block_width, source_transformed_block_height;
if (!glamor_get_transform_block_size(source->transform,
- source_pixmap_priv->large.block_w,
- source_pixmap_priv->large.block_h,
+ __glamor_large(source_pixmap_priv)->block_w,
+ __glamor_large(source_pixmap_priv)->block_h,
&source_transformed_block_width,
&source_transformed_block_height))
{
@@ -1093,8 +1113,8 @@ glamor_composite_largepixmap_region(CARD8 op,
int mask_transformed_block_width, mask_transformed_block_height;
if (!glamor_get_transform_block_size(mask->transform,
- mask_pixmap_priv->large.block_w,
- mask_pixmap_priv->large.block_h,
+ __glamor_large(mask_pixmap_priv)->block_w,
+ __glamor_large(mask_pixmap_priv)->block_h,
&mask_transformed_block_width,
&mask_transformed_block_height)) {
DEBUGF("mask block size less than 1, fallback.\n");
@@ -1111,8 +1131,8 @@ glamor_composite_largepixmap_region(CARD8 op,
/*compute the correct block width and height whose transformed source/mask
*region can fit into one texture.*/
- if (force_clip || fixed_block_width < dest_pixmap_priv->large.block_w
- || fixed_block_height < dest_pixmap_priv->large.block_h)
+ if (force_clip || fixed_block_width < dest_block_width
+ || fixed_block_height < dest_block_height)
clipped_dest_regions =
glamor_compute_clipped_regions_ext(dest_pixmap_priv, region,
&n_dest_regions,
@@ -1140,7 +1160,7 @@ glamor_composite_largepixmap_region(CARD8 op,
DEBUGF("dest region %d idx %d\n", i,
clipped_dest_regions[i].block_idx);
DEBUGRegionPrint(clipped_dest_regions[i].region);
- SET_PIXMAP_FBO_CURRENT(dest_pixmap_priv,
+ glamor_set_pixmap_fbo_current(dest_pixmap_priv,
clipped_dest_regions[i].block_idx);
if (source_pixmap_priv &&
source_pixmap_priv->type == GLAMOR_TEXTURE_LARGE) {
@@ -1180,7 +1200,7 @@ glamor_composite_largepixmap_region(CARD8 op,
DEBUGF("source clipped result %d region: \n", n_source_regions);
for (j = 0; j < n_source_regions; j++) {
if (is_normal_source_fbo)
- SET_PIXMAP_FBO_CURRENT(source_pixmap_priv,
+ glamor_set_pixmap_fbo_current(source_pixmap_priv,
clipped_source_regions[j].block_idx);
if (mask_pixmap_priv &&
@@ -1267,12 +1287,12 @@ glamor_composite_largepixmap_region(CARD8 op,
clipped_mask_regions[k].block_idx);
DEBUGRegionPrint(clipped_mask_regions[k].region);
if (is_normal_mask_fbo) {
- SET_PIXMAP_FBO_CURRENT(mask_pixmap_priv,
+ glamor_set_pixmap_fbo_current(mask_pixmap_priv,
clipped_mask_regions[k].
block_idx);
DEBUGF("mask fbo off %d %d \n",
- mask_pixmap_priv->large.box.x1,
- mask_pixmap_priv->large.box.y1);
+ __glamor_large(mask_pixmap_priv)->box.x1,
+ __glamor_large(mask_pixmap_priv)->box.y1);
DEBUGF("start composite mask hasn't transform.\n");
RegionTranslate(clipped_mask_regions[k].region,
x_dest - x_mask +
@@ -1378,7 +1398,7 @@ glamor_composite_largepixmap_region(CARD8 op,
clipped_mask_regions[k].block_idx);
DEBUGRegionPrint(clipped_mask_regions[k].region);
if (is_normal_mask_fbo) {
- SET_PIXMAP_FBO_CURRENT(mask_pixmap_priv,
+ glamor_set_pixmap_fbo_current(mask_pixmap_priv,
clipped_mask_regions[k].
block_idx);
RegionTranslate(clipped_mask_regions[k].region,
diff --git a/xorg-server/glamor/glamor_pixmap.c b/xorg-server/glamor/glamor_pixmap.c
index ccb49f3c6..11e9ebb00 100644
--- a/xorg-server/glamor/glamor_pixmap.c
+++ b/xorg-server/glamor/glamor_pixmap.c
@@ -985,7 +985,7 @@ glamor_upload_sub_pixmap_to_texture(PixmapPtr pixmap, int x, int y, int w,
assert(pbo == 0);
- SET_PIXMAP_FBO_CURRENT(pixmap_priv, clipped_regions[i].block_idx);
+ glamor_set_pixmap_fbo_current(pixmap_priv, clipped_regions[i].block_idx);
boxes = RegionRects(clipped_regions[i].region);
nbox = RegionNumRects(clipped_regions[i].region);
diff --git a/xorg-server/glamor/glamor_priv.h b/xorg-server/glamor/glamor_priv.h
index 385c0279d..c089db895 100644
--- a/xorg-server/glamor/glamor_priv.h
+++ b/xorg-server/glamor/glamor_priv.h
@@ -167,6 +167,30 @@ typedef struct {
uint16_t evict;
} glamor_glyph_cache_t;
+#define CACHE_PICTURE_SIZE 1024
+#define GLYPH_MIN_SIZE 8
+#define GLYPH_MAX_SIZE 64
+#define GLYPH_CACHE_SIZE ((CACHE_PICTURE_SIZE) * CACHE_PICTURE_SIZE / (GLYPH_MIN_SIZE * GLYPH_MIN_SIZE))
+
+#define MASK_CACHE_MAX_SIZE 32
+#define MASK_CACHE_WIDTH (CACHE_PICTURE_SIZE / MASK_CACHE_MAX_SIZE)
+#define MASK_CACHE_MASK ((1LL << (MASK_CACHE_WIDTH)) - 1)
+
+struct glamor_glyph_mask_cache_entry {
+ int idx;
+ int width;
+ int height;
+ int x;
+ int y;
+};
+
+typedef struct {
+ PixmapPtr pixmap;
+ struct glamor_glyph_mask_cache_entry mcache[MASK_CACHE_WIDTH];
+ unsigned int free_bitmap;
+ unsigned int cleared_bitmap;
+} glamor_glyph_mask_cache_t;
+
struct glamor_saved_procs {
CloseScreenProcPtr close_screen;
CreateScreenResourcesProcPtr create_screen_resources;
@@ -268,7 +292,8 @@ typedef struct glamor_screen_private {
[SHADER_MASK_COUNT]
[SHADER_IN_COUNT];
glamor_glyph_cache_t glyphCaches[GLAMOR_NUM_GLYPH_CACHE_FORMATS];
- Bool glyph_cache_initialized;
+ glamor_glyph_mask_cache_t *mask_cache[GLAMOR_NUM_GLYPH_CACHE_FORMATS];
+ Bool glyph_caches_realized;
/* shaders to restore a texture to another texture. */
GLint finish_access_prog[2];
@@ -281,9 +306,6 @@ typedef struct glamor_screen_private {
int linear_max_nstops;
int radial_max_nstops;
- /* glamor trapezoid shader. */
- GLint trapezoid_prog;
-
PixmapPtr *back_pixmap;
int screen_fbo;
struct glamor_saved_procs saved_procs;
@@ -413,14 +435,6 @@ typedef struct glamor_pixmap_clipped_regions {
RegionPtr region;
} glamor_pixmap_clipped_regions;
-#define SET_PIXMAP_FBO_CURRENT(priv, idx) \
- do { \
- if (priv->type == GLAMOR_TEXTURE_LARGE) { \
- (priv)->large.base.fbo = priv->large.fbo_array[idx]; \
- (priv)->large.box = priv->large.box_array[idx]; \
- } \
- } while(0)
-
typedef struct glamor_pixmap_private_base {
glamor_pixmap_type_t type;
enum glamor_fbo_state gl_fbo;
@@ -493,6 +507,15 @@ typedef struct glamor_pixmap_private {
};
} glamor_pixmap_private;
+static inline void
+glamor_set_pixmap_fbo_current(glamor_pixmap_private *priv, int idx)
+{
+ if (priv->type == GLAMOR_TEXTURE_LARGE) {
+ priv->large.base.fbo = priv->large.fbo_array[idx];
+ priv->large.box = priv->large.box_array[idx];
+ }
+}
+
static inline glamor_pixmap_fbo *
glamor_pixmap_fbo_at(glamor_pixmap_private *priv, int x, int y)
{
@@ -719,8 +742,6 @@ void glamor_composite_glyph_rects(CARD8 op,
void glamor_composite_rects(CARD8 op,
PicturePtr pDst,
xRenderColor *color, int nRect, xRectangle *rects);
-void glamor_init_trapezoid_shader(ScreenPtr screen);
-void glamor_fini_trapezoid_shader(ScreenPtr screen);
PicturePtr glamor_convert_gradient_picture(ScreenPtr screen,
PicturePtr source,
int x_source,
@@ -1063,7 +1084,6 @@ void glamor_xv_render(glamor_port_private *port_priv);
#define GLAMOR_PIXMAP_DYNAMIC_UPLOAD
#define GLAMOR_GRADIENT_SHADER
-#define GLAMOR_TRAPEZOID_SHADER
#define GLAMOR_TEXTURED_LARGE_PIXMAP 1
#define WALKAROUND_LARGE_TEXTURE_MAP
#if 0
diff --git a/xorg-server/glamor/glamor_trapezoid.c b/xorg-server/glamor/glamor_trapezoid.c
index d61d11f79..f8bf6c97f 100644
--- a/xorg-server/glamor/glamor_trapezoid.c
+++ b/xorg-server/glamor/glamor_trapezoid.c
@@ -36,1522 +36,6 @@
#include "mipict.h"
#include "fbpict.h"
-static xFixed
-_glamor_linefixedX(xLineFixed *l, xFixed y, Bool ceil)
-{
- xFixed dx = l->p2.x - l->p1.x;
- xFixed_32_32 ex = (xFixed_32_32) (y - l->p1.y) * dx;
- xFixed dy = l->p2.y - l->p1.y;
-
- if (ceil)
- ex += (dy - 1);
- return l->p1.x + (xFixed) (ex / dy);
-}
-
-static xFixed
-_glamor_linefixedY(xLineFixed *l, xFixed x, Bool ceil)
-{
- xFixed dy = l->p2.y - l->p1.y;
- xFixed_32_32 ey = (xFixed_32_32) (x - l->p1.x) * dy;
- xFixed dx = l->p2.x - l->p1.x;
-
- if (ceil)
- ey += (dx - 1);
- return l->p1.y + (xFixed) (ey / dx);
-}
-
-#ifdef GLAMOR_TRAPEZOID_SHADER
-
-#define GLAMOR_VERTEX_TOP_BOTTOM (GLAMOR_VERTEX_SOURCE + 1)
-#define GLAMOR_VERTEX_LEFT_PARAM (GLAMOR_VERTEX_SOURCE + 2)
-#define GLAMOR_VERTEX_RIGHT_PARAM (GLAMOR_VERTEX_SOURCE + 3)
-
-#define DEBUG_CLIP_VTX 0
-
-#define POINT_INSIDE_CLIP_RECT(point, rect) \
- (point[0] >= IntToxFixed(rect->x1) \
- && point[0] <= IntToxFixed(rect->x2) \
- && point[1] >= IntToxFixed(rect->y1) \
- && point[1] <= IntToxFixed(rect->y2))
-
-static xFixed
-_glamor_lines_crossfixedY(xLineFixed *l, xLineFixed *r)
-{
- xFixed dx1 = l->p2.x - l->p1.x;
- xFixed dx2 = r->p2.x - r->p1.x;
- xFixed dy1 = l->p2.y - l->p1.y;
- xFixed dy2 = r->p2.y - r->p1.y;
- xFixed_32_32 tmp = (xFixed_32_32) dy2 * dy1;
- xFixed_32_32 dividend1 = (tmp >> 32) * (l->p1.x - r->p1.x);
- xFixed_32_32 dividend2;
- xFixed_32_32 dividend3;
- xFixed_32_32 divisor;
-
- tmp = (xFixed_32_32) dx1 *dy2;
-
- dividend2 = (tmp >> 32) * l->p1.y;
- tmp = (xFixed_32_32) dy1 *dx2;
-
- dividend3 = (tmp >> 32) * r->p1.y;
- divisor = ((xFixed_32_32) dx1 * (xFixed_32_32) dy2
- - (xFixed_32_32) dy1 * (xFixed_32_32) dx2) >> 32;
-
- if (divisor)
- return (xFixed) ((dividend2 - dividend1 - dividend3) / divisor);
-
- return 0xFFFFFFFF;
-}
-
-static Bool
-point_inside_trapezoid(int point[2], xTrapezoid *trap, xFixed cut_y)
-{
- int ret = TRUE;
- int tmp;
-
- if (point[1] > trap->bottom) {
- ret = FALSE;
- if (DEBUG_CLIP_VTX) {
- ErrorF("Out of Trap bottom, point[1] = %d(0x%x)), "
- "bottom = %d(0x%x)\n",
- (unsigned int) xFixedToInt(point[1]), point[1],
- (unsigned int) xFixedToInt(trap->bottom),
- (unsigned int) trap->bottom);
- }
-
- return ret;
- }
-
- if (point[1] < trap->top) {
- ret = FALSE;
- if (DEBUG_CLIP_VTX) {
- ErrorF("Out of Trap top, point[1] = %d(0x%x)), "
- "top = %d(0x%x)\n",
- (unsigned int) xFixedToInt(point[1]), point[1],
- (unsigned int) xFixedToInt(trap->top),
- (unsigned int) trap->top);
- }
-
- return ret;
- }
-
- tmp = _glamor_linefixedX(&trap->left, point[1], FALSE);
- if (point[0] < tmp) {
- ret = FALSE;
-
- if (abs(cut_y - trap->top) < pixman_fixed_1_minus_e &&
- abs(point[1] - trap->top) < pixman_fixed_1_minus_e &&
- tmp - point[0] < pixman_fixed_1_minus_e) {
- ret = TRUE;
- }
- else if (abs(cut_y - trap->bottom) < pixman_fixed_1_minus_e &&
- point[1] - trap->bottom < pixman_fixed_1_minus_e &&
- tmp - point[0] < pixman_fixed_1_minus_e) {
- ret = TRUE;
- }
-
- if (DEBUG_CLIP_VTX && !ret) {
- ErrorF("Out of Trap left, point[0] = %d(0x%x)), "
- "left = %d(0x%x)\n",
- (unsigned int) xFixedToInt(point[0]), point[0],
- (unsigned int) xFixedToInt(tmp), (unsigned int) tmp);
- }
-
- if (!ret)
- return ret;
- }
-
- tmp = _glamor_linefixedX(&trap->right, point[1], TRUE);
- if (point[0] > tmp) {
- ret = FALSE;
-
- if (abs(cut_y - trap->top) < pixman_fixed_1_minus_e &&
- abs(point[1] - trap->top) < pixman_fixed_1_minus_e &&
- point[0] - tmp < pixman_fixed_1_minus_e) {
- ret = TRUE;
- }
- else if (abs(cut_y - trap->bottom) < pixman_fixed_1_minus_e &&
- abs(point[1] - trap->bottom) < pixman_fixed_1_minus_e &&
- point[0] - tmp < pixman_fixed_1_minus_e) {
- ret = TRUE;
- }
-
- if (DEBUG_CLIP_VTX && !ret) {
- ErrorF("Out of Trap right, point[0] = %d(0x%x)), "
- "right = %d(0x%x)\n",
- (unsigned int) xFixedToInt(point[0]), point[0],
- (unsigned int) xFixedToInt(tmp), (unsigned int) tmp);
- }
-
- if (!ret)
- return ret;
- }
-
- return ret;
-}
-
-static void
-glamor_emit_composite_vert(ScreenPtr screen,
- float *vb,
- const float *src_coords,
- const float *mask_coords,
- const float *dst_coords, int i)
-{
- glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
- int j = 0;
-
- vb += i * glamor_priv->vb_stride / sizeof(float);
-
- vb[j++] = dst_coords[i * 2 + 0];
- vb[j++] = dst_coords[i * 2 + 1];
- if (glamor_priv->has_source_coords) {
- vb[j++] = src_coords[i * 2 + 0];
- vb[j++] = src_coords[i * 2 + 1];
- }
- if (glamor_priv->has_mask_coords) {
- vb[j++] = mask_coords[i * 2 + 0];
- vb[j++] = mask_coords[i * 2 + 1];
- }
-
- glamor_priv->render_nr_verts++;
-}
-
-static void
-glamor_emit_composite_triangle(ScreenPtr screen,
- float *vb,
- const float *src_coords,
- const float *mask_coords,
- const float *dst_coords)
-{
- glamor_emit_composite_vert(screen, vb,
- src_coords, mask_coords, dst_coords, 0);
- glamor_emit_composite_vert(screen, vb,
- src_coords, mask_coords, dst_coords, 1);
- glamor_emit_composite_vert(screen, vb,
- src_coords, mask_coords, dst_coords, 2);
-}
-
-static void
-glamor_flush_composite_triangles(ScreenPtr screen)
-{
- glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
-
- 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);
-}
-
-static Bool
-_glamor_clip_trapezoid_vertex(xTrapezoid *trap, BoxPtr pbox,
- int vertex[6], int *num)
-{
- xFixed edge_cross_y = 0xFFFFFFFF;
- int tl[2];
- int bl[2];
- int tr[2];
- int br[2];
- int left_cut_top[2];
- int left_cut_left[2];
- int left_cut_right[2];
- int left_cut_bottom[2];
- int right_cut_top[2];
- int right_cut_left[2];
- int right_cut_right[2];
- int right_cut_bottom[2];
- int tmp[2];
- int tmp_vtx[20 * 2];
- float tmp_vtx_slope[20];
- BoxRec trap_bound;
- int i = 0;
- int vertex_num = 0;
-
- if (DEBUG_CLIP_VTX) {
- ErrorF
- ("The parameter of xTrapezoid is:\ntop: %d 0x%x\tbottom: %d 0x%x\n"
- "left: p1 (%d 0x%x, %d 0x%x)\tp2 (%d 0x%x, %d 0x%x)\n"
- "right: p1 (%d 0x%x, %d 0x%x)\tp2 (%d 0x%x, %d 0x%x)\n",
- xFixedToInt(trap->top), (unsigned int) trap->top,
- xFixedToInt(trap->bottom), (unsigned int) trap->bottom,
- xFixedToInt(trap->left.p1.x), (unsigned int) trap->left.p1.x,
- xFixedToInt(trap->left.p1.y), (unsigned int) trap->left.p1.y,
- xFixedToInt(trap->left.p2.x), (unsigned int) trap->left.p2.x,
- xFixedToInt(trap->left.p2.y), (unsigned int) trap->left.p2.y,
- xFixedToInt(trap->right.p1.x), (unsigned int) trap->right.p1.x,
- xFixedToInt(trap->right.p1.y), (unsigned int) trap->right.p1.y,
- xFixedToInt(trap->right.p2.x), (unsigned int) trap->right.p2.x,
- xFixedToInt(trap->right.p2.y), (unsigned int) trap->right.p2.y);
- }
-
- miTrapezoidBounds(1, trap, &trap_bound);
- if (DEBUG_CLIP_VTX)
- ErrorF("The bounds for this traps is: bounds.x1 = %d, bounds.x2 = %d, "
- "bounds.y1 = %d, bounds.y2 = %d\n", trap_bound.x1, trap_bound.x2,
- trap_bound.y1, trap_bound.y2);
-
- if (trap_bound.x1 > pbox->x2 || trap_bound.x2 < pbox->x1)
- return FALSE;
- if (trap_bound.y1 > pbox->y2 || trap_bound.y2 < pbox->y1)
- return FALSE;
-
-#define IS_TRAP_EDGE_VERTICAL(edge) \
- (edge->p1.x == edge->p2.x)
-
-#define CACULATE_CUT_VERTEX(vtx, cal_x, ceil, vh_edge, edge) \
- do { \
- if(cal_x) { \
- vtx[1] = (vh_edge); \
- vtx[0] = (_glamor_linefixedX( \
- edge, vh_edge, ceil)); \
- if(DEBUG_CLIP_VTX) \
- ErrorF("The intersection point of line y=%d and " \
- "line of p1:(%d,%d) -- p2 (%d,%d) " \
- "is (%d, %d)\n", \
- xFixedToInt(vh_edge), \
- xFixedToInt(edge->p1.x), \
- xFixedToInt(edge->p1.y), \
- xFixedToInt(edge->p2.x), \
- xFixedToInt(edge->p2.y), \
- xFixedToInt(vtx[0]), \
- xFixedToInt(vtx[1])); \
- } else { \
- vtx[0] = (vh_edge); \
- vtx[1] = (_glamor_linefixedY( \
- edge, vh_edge, ceil)); \
- if(DEBUG_CLIP_VTX) \
- ErrorF("The intersection point of line x=%d and " \
- "line of p1:(%d,%d) -- p2 (%d,%d) " \
- "is (%d, %d)\n", \
- xFixedToInt(vh_edge), \
- xFixedToInt(edge->p1.x), \
- xFixedToInt(edge->p1.y), \
- xFixedToInt(edge->p2.x), \
- xFixedToInt(edge->p2.y), \
- xFixedToInt(vtx[0]), \
- xFixedToInt(vtx[1])); \
- } \
- } while(0)
-
-#define ADD_VERTEX_IF_INSIDE(vtx) \
- if(POINT_INSIDE_CLIP_RECT(vtx, pbox) \
- && point_inside_trapezoid(vtx, trap, edge_cross_y)){ \
- tmp_vtx[vertex_num] = xFixedToInt(vtx[0]); \
- tmp_vtx[vertex_num + 1] = xFixedToInt(vtx[1]); \
- vertex_num += 2; \
- if(DEBUG_CLIP_VTX) \
- ErrorF("@ Point: (%d, %d) is inside " \
- "the Rect and Trapezoid\n", \
- xFixedToInt(vtx[0]), \
- xFixedToInt(vtx[1])); \
- } else if(DEBUG_CLIP_VTX){ \
- ErrorF("X Point: (%d, %d) is outside " \
- "the Rect and Trapezoid\t", \
- xFixedToInt(vtx[0]), \
- xFixedToInt(vtx[1])); \
- if(POINT_INSIDE_CLIP_RECT(vtx, pbox)) \
- ErrorF("The Point is outside " \
- "the Trapezoid\n"); \
- else \
- ErrorF("The Point is outside " \
- "the Rect\n"); \
- }
-
- /*Trap's right edge cut right edge. */
- if ((!IS_TRAP_EDGE_VERTICAL((&trap->left))) ||
- (!IS_TRAP_EDGE_VERTICAL((&trap->right)))) {
- edge_cross_y = _glamor_lines_crossfixedY((&trap->left), (&trap->right));
- if (DEBUG_CLIP_VTX) {
- ErrorF("Trap's left edge cut right edge at %d(0x%x), "
- "trap_top = %x, trap_bottom = %x\n",
- xFixedToInt(edge_cross_y), edge_cross_y,
- (unsigned int) trap->top, (unsigned int) trap->bottom);
- }
- }
-
- /*Trap's TopLeft, BottomLeft, TopRight and BottomRight. */
- CACULATE_CUT_VERTEX(tl, 1, FALSE, trap->top, (&trap->left));
- CACULATE_CUT_VERTEX(bl, 1, FALSE, trap->bottom, (&trap->left));
- CACULATE_CUT_VERTEX(tr, 1, TRUE, trap->top, (&trap->right));
- CACULATE_CUT_VERTEX(br, 1, TRUE, trap->bottom, (&trap->right));
-
- if (DEBUG_CLIP_VTX)
- ErrorF("Trap's TopLeft, BottomLeft, TopRight and BottomRight\n");
- if (DEBUG_CLIP_VTX)
- ErrorF("Caculate the vertex of trapezoid:\n"
- " (%3d, %3d)-------------------------(%3d, %3d)\n"
- " / \\ \n"
- " / \\ \n"
- " / \\ \n"
- " (%3d, %3d)---------------------------------(%3d, %3d)\n"
- "Clip with rect:\n"
- " (%3d, %3d)------------------------(%3d, %3d) \n"
- " | | \n"
- " | | \n"
- " | | \n"
- " (%3d, %3d)------------------------(%3d, %3d) \n",
- xFixedToInt(tl[0]), xFixedToInt(tl[1]), xFixedToInt(tr[0]),
- xFixedToInt(tr[1]), xFixedToInt(bl[0]), xFixedToInt(bl[1]),
- xFixedToInt(br[0]), xFixedToInt(br[1]),
- pbox->x1, pbox->y1, pbox->x2, pbox->y1, pbox->x1, pbox->y2,
- pbox->x2, pbox->y2);
-
- ADD_VERTEX_IF_INSIDE(tl);
- ADD_VERTEX_IF_INSIDE(bl);
- ADD_VERTEX_IF_INSIDE(tr);
- ADD_VERTEX_IF_INSIDE(br);
-
- /*Trap's left edge cut Rect. */
- if (DEBUG_CLIP_VTX)
- ErrorF("Trap's left edge cut Rect\n");
- CACULATE_CUT_VERTEX(left_cut_top, 1, FALSE, IntToxFixed(pbox->y1),
- (&trap->left));
- ADD_VERTEX_IF_INSIDE(left_cut_top);
- if (!IS_TRAP_EDGE_VERTICAL((&trap->left))) {
- CACULATE_CUT_VERTEX(left_cut_left, 0, FALSE, IntToxFixed(pbox->x1),
- (&trap->left));
- ADD_VERTEX_IF_INSIDE(left_cut_left);
- }
- CACULATE_CUT_VERTEX(left_cut_bottom, 1, FALSE, IntToxFixed(pbox->y2),
- (&trap->left));
- ADD_VERTEX_IF_INSIDE(left_cut_bottom);
- if (!IS_TRAP_EDGE_VERTICAL((&trap->left))) {
- CACULATE_CUT_VERTEX(left_cut_right, 0, FALSE, IntToxFixed(pbox->x2),
- (&trap->left));
- ADD_VERTEX_IF_INSIDE(left_cut_right);
- }
-
- /*Trap's right edge cut Rect. */
- if (DEBUG_CLIP_VTX)
- ErrorF("Trap's right edge cut Rect\n");
- CACULATE_CUT_VERTEX(right_cut_top, 1, TRUE, IntToxFixed(pbox->y1),
- (&trap->right));
- ADD_VERTEX_IF_INSIDE(right_cut_top);
- if (!IS_TRAP_EDGE_VERTICAL((&trap->right))) {
- CACULATE_CUT_VERTEX(right_cut_left, 0, TRUE, IntToxFixed(pbox->x1),
- (&trap->right));
- ADD_VERTEX_IF_INSIDE(right_cut_left);
- }
- CACULATE_CUT_VERTEX(right_cut_bottom, 1, TRUE, IntToxFixed(pbox->y2),
- (&trap->right));
- ADD_VERTEX_IF_INSIDE(right_cut_bottom);
- if (!IS_TRAP_EDGE_VERTICAL((&trap->right))) {
- CACULATE_CUT_VERTEX(right_cut_right, 0, TRUE, IntToxFixed(pbox->x2),
- (&trap->right));
- ADD_VERTEX_IF_INSIDE(right_cut_right);
- }
-
- /* Trap's top cut Left and Right of rect. */
- if (DEBUG_CLIP_VTX)
- ErrorF("Trap's top cut Left and Right of rect\n");
- tmp[0] = IntToxFixed(pbox->x1);
- tmp[1] = trap->top;
- ADD_VERTEX_IF_INSIDE(tmp);
- tmp[0] = IntToxFixed(pbox->x2);
- tmp[1] = trap->top;
- ADD_VERTEX_IF_INSIDE(tmp);
-
- /* Trap's bottom cut Left and Right of rect. */
- if (DEBUG_CLIP_VTX)
- ErrorF("Trap's bottom cut Left and Right of rect\n");
- tmp[0] = IntToxFixed(pbox->x1);
- tmp[1] = trap->bottom;
- ADD_VERTEX_IF_INSIDE(tmp);
- tmp[0] = IntToxFixed(pbox->x2);
- tmp[1] = trap->bottom;
- ADD_VERTEX_IF_INSIDE(tmp);
-
- /* The orginal 4 vertex of rect. */
- if (DEBUG_CLIP_VTX)
- ErrorF("The orginal 4 vertex of rect\n");
- tmp[0] = IntToxFixed(pbox->x1);
- tmp[1] = IntToxFixed(pbox->y1);
- ADD_VERTEX_IF_INSIDE(tmp);
- tmp[0] = IntToxFixed(pbox->x1);
- tmp[1] = IntToxFixed(pbox->y2);
- ADD_VERTEX_IF_INSIDE(tmp);
- tmp[0] = IntToxFixed(pbox->x2);
- tmp[1] = IntToxFixed(pbox->y2);
- ADD_VERTEX_IF_INSIDE(tmp);
- tmp[0] = IntToxFixed(pbox->x2);
- tmp[1] = IntToxFixed(pbox->y1);
- ADD_VERTEX_IF_INSIDE(tmp);
-
- if (DEBUG_CLIP_VTX) {
- ErrorF("\nThe candidate vertex number is %d\n", vertex_num / 2);
- for (i = 0; i < vertex_num / 2; i++) {
- ErrorF("(%d, %d) ", tmp_vtx[2 * i], tmp_vtx[2 * i + 1]);
- }
- ErrorF("\n");
- }
-
- /* Sort the vertex by X and then Y. */
- for (i = 0; i < vertex_num / 2; i++) {
- int j;
-
- for (j = 0; j < vertex_num / 2 - i - 1; j++) {
- if (tmp_vtx[2 * j] > tmp_vtx[2 * (j + 1)]
- || (tmp_vtx[2 * j] == tmp_vtx[2 * (j + 1)]
- && tmp_vtx[2 * j + 1] > tmp_vtx[2 * (j + 1) + 1])) {
- tmp[0] = tmp_vtx[2 * j];
- tmp[1] = tmp_vtx[2 * j + 1];
- tmp_vtx[2 * j] = tmp_vtx[2 * (j + 1)];
- tmp_vtx[2 * j + 1] = tmp_vtx[2 * (j + 1) + 1];
- tmp_vtx[2 * (j + 1)] = tmp[0];
- tmp_vtx[2 * (j + 1) + 1] = tmp[1];
- }
- }
-
- }
-
- if (DEBUG_CLIP_VTX) {
- ErrorF("\nAfter sort vertex number is:\n");
- for (i = 0; i < vertex_num / 2; i++) {
- ErrorF("(%d, %d) ", tmp_vtx[2 * i], tmp_vtx[2 * i + 1]);
- }
- ErrorF("\n");
- }
-
- memset(vertex, -1, 2 * 6);
- *num = 0;
-
- for (i = 0; i < vertex_num / 2; i++) {
- if (*num > 0 && vertex[2 * (*num - 1)] == tmp_vtx[2 * i]
- && vertex[2 * (*num - 1) + 1] == tmp_vtx[2 * i + 1]) {
- /*same vertex. */
- if (DEBUG_CLIP_VTX)
- ErrorF("X Point:(%d, %d) discard\n",
- tmp_vtx[2 * i], tmp_vtx[2 * i + 1]);
- continue;
- }
-
- (*num)++;
- if (*num > 6) {
- if (DEBUG_CLIP_VTX)
- FatalError("Trapezoid clip with Rect can never have vtx"
- "number bigger than 6\n");
- else {
- ErrorF("Trapezoid clip with Rect can never have vtx"
- "number bigger than 6\n");
- *num = 6;
- break;
- }
- }
-
- vertex[2 * (*num - 1)] = tmp_vtx[2 * i];
- vertex[2 * (*num - 1) + 1] = tmp_vtx[2 * i + 1];
- if (DEBUG_CLIP_VTX)
- ErrorF("@ Point:(%d, %d) select, num now is %d\n",
- tmp_vtx[2 * i], tmp_vtx[2 * i + 1], *num);
- }
-
- /* Now we need to arrange the vtx in the polygon's counter-clockwise
- order. We first select the left and top point as the start point and
- sort every vtx by the slope from vtx to the start vtx. */
- for (i = 1; i < *num; i++) {
- tmp_vtx_slope[i] = (vertex[2 * i] != vertex[0] ?
- (float) (vertex[2 * i + 1] -
- vertex[1]) / (float) (vertex[2 * i] -
- vertex[0])
- : (float) INT_MAX);
- }
-
- if (DEBUG_CLIP_VTX) {
- ErrorF("\nvtx number: %d, VTX and slope:\n", *num);
- for (i = 0; i < *num; i++) {
- ErrorF("(%d, %d):%f ",
- vertex[2 * i], vertex[2 * i + 1], tmp_vtx_slope[i]);
- }
- ErrorF("\n");
- }
-
- /* Sort the vertex by slope. */
- for (i = 0; i < *num - 1; i++) {
- int j;
- float tmp_slope;
-
- for (j = 1; j < *num - i - 1; j++) {
- if (tmp_vtx_slope[j] < tmp_vtx_slope[j + 1]) {
- tmp_slope = tmp_vtx_slope[j];
- tmp_vtx_slope[j] = tmp_vtx_slope[j + 1];
- tmp_vtx_slope[j + 1] = tmp_slope;
- tmp[0] = vertex[2 * j];
- tmp[1] = vertex[2 * j + 1];
- vertex[2 * j] = vertex[2 * (j + 1)];
- vertex[2 * j + 1] = vertex[2 * (j + 1) + 1];
- vertex[2 * (j + 1)] = tmp[0];
- vertex[2 * (j + 1) + 1] = tmp[1];
- }
- }
- }
-
- if (DEBUG_CLIP_VTX) {
- ErrorF("\nBefore return, vtx number: %d, VTX and slope:\n", *num);
- for (i = 0; i < *num; i++) {
- ErrorF("(%d, %d):%f ",
- vertex[2 * i], vertex[2 * i + 1], tmp_vtx_slope[i]);
- }
- ErrorF("\n");
- }
-
- return TRUE;
-}
-
-static void *
-glamor_setup_composite_vbo_for_trapezoid(ScreenPtr screen, int n_verts)
-{
- glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
- int stride;
- int vert_size;
- char *vbo_offset;
- void *vb;
-
- glamor_priv->render_nr_verts = 0;
-
- /* For GLAMOR_VERTEX_POS */
- glamor_priv->vb_stride = 2 * sizeof(float);
-
- /* For GLAMOR_GLAMOR_VERTEX_SOURCE */
- glamor_priv->vb_stride += 2 * sizeof(float);
-
- /* For GLAMOR_VERTEX_TOP_BOTTOM */
- glamor_priv->vb_stride += 2 * sizeof(float);
-
- /* For GLAMOR_VERTEX_LEFT_PARAM */
- glamor_priv->vb_stride += 4 * sizeof(float);
-
- /* For GLAMOR_VERTEX_RIGHT_PARAM */
- glamor_priv->vb_stride += 4 * sizeof(float);
-
- vert_size = n_verts * glamor_priv->vb_stride;
-
- glamor_make_current(glamor_priv);
-
- glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
- glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
- glDisableVertexAttribArray(GLAMOR_VERTEX_TOP_BOTTOM);
- glDisableVertexAttribArray(GLAMOR_VERTEX_LEFT_PARAM);
- glDisableVertexAttribArray(GLAMOR_VERTEX_RIGHT_PARAM);
-
- vb = glamor_get_vbo_space(screen, vert_size, &vbo_offset);
-
- /* Set the vertex pointer. */
- glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT,
- GL_FALSE, glamor_priv->vb_stride,
- vbo_offset);
- glEnableVertexAttribArray(GLAMOR_VERTEX_POS);
- stride = 2;
-
- glVertexAttribPointer(GLAMOR_VERTEX_SOURCE, 2, GL_FLOAT,
- GL_FALSE, glamor_priv->vb_stride,
- vbo_offset + stride * sizeof(float));
- glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
- stride += 2;
-
- glVertexAttribPointer(GLAMOR_VERTEX_TOP_BOTTOM, 2, GL_FLOAT,
- GL_FALSE, glamor_priv->vb_stride,
- vbo_offset + stride * sizeof(float));
- glEnableVertexAttribArray(GLAMOR_VERTEX_TOP_BOTTOM);
- stride += 2;
-
- glVertexAttribPointer(GLAMOR_VERTEX_LEFT_PARAM, 4, GL_FLOAT,
- GL_FALSE, glamor_priv->vb_stride,
- vbo_offset + stride * sizeof(float));
- glEnableVertexAttribArray(GLAMOR_VERTEX_LEFT_PARAM);
- stride += 4;
-
- glVertexAttribPointer(GLAMOR_VERTEX_RIGHT_PARAM, 4, GL_FLOAT,
- GL_FALSE, glamor_priv->vb_stride,
- vbo_offset + stride * sizeof(float));
- glEnableVertexAttribArray(GLAMOR_VERTEX_RIGHT_PARAM);
-
- return vb;
-}
-
-static Bool
-_glamor_trapezoids_with_shader(CARD8 op,
- PicturePtr src, PicturePtr dst,
- PictFormatPtr mask_format, INT16 x_src,
- INT16 y_src, int ntrap, xTrapezoid * traps)
-{
- ScreenPtr screen = dst->pDrawable->pScreen;
- glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
- struct shader_key key;
- glamor_composite_shader *shader = NULL;
- struct blendinfo op_info;
- PictFormatShort saved_source_format = 0;
- PixmapPtr source_pixmap = NULL;
- PixmapPtr dest_pixmap = NULL;
- glamor_pixmap_private *source_pixmap_priv = NULL;
- glamor_pixmap_private *dest_pixmap_priv = NULL;
- glamor_pixmap_private *temp_src_priv = NULL;
- int x_temp_src, y_temp_src;
- int src_width, src_height;
- int source_x_off, source_y_off;
- GLfloat src_xscale = 1, src_yscale = 1;
- int x_dst, y_dst;
- int dest_x_off, dest_y_off;
- GLfloat dst_xscale, dst_yscale;
- BoxRec bounds;
- PicturePtr temp_src = src;
- int vert_stride = 3;
- int ntriangle_per_loop;
- int nclip_rect;
- int mclip_rect;
- int clip_processed;
- int clipped_vtx[6 * 2];
- RegionRec region;
- BoxPtr box = NULL;
- BoxPtr pbox = NULL;
- int traps_count = 0;
- int traps_not_completed = 0;
- xTrapezoid *ptrap = NULL;
- int nbox;
- float src_matrix[9];
- Bool ret = FALSE;
-
- /* If a mask format wasn't provided, we get to choose, but behavior should
- * be as if there was no temporary mask the traps were accumulated into.
- */
- if (!mask_format) {
- if (dst->polyEdge == PolyEdgeSharp)
- mask_format = PictureMatchFormat(screen, 1, PICT_a1);
- else
- mask_format = PictureMatchFormat(screen, 8, PICT_a8);
- for (; ntrap; ntrap--, traps++)
- glamor_trapezoids(op, src, dst, mask_format, x_src,
- y_src, 1, traps);
- return TRUE;
- }
-
- miTrapezoidBounds(ntrap, traps, &bounds);
- DEBUGF("The bounds for all traps is: bounds.x1 = %d, bounds.x2 = %d, "
- "bounds.y1 = %d, bounds.y2 = %d\n", bounds.x1, bounds.x2,
- bounds.y1, bounds.y2);
-
- /* No area need to render. */
- if (bounds.y1 >= bounds.y2 || bounds.x1 >= bounds.x2)
- return TRUE;
-
- dest_pixmap = glamor_get_drawable_pixmap(dst->pDrawable);
- dest_pixmap_priv = glamor_get_pixmap_private(dest_pixmap);
-
- if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(dest_pixmap_priv)
- || dest_pixmap_priv->type == GLAMOR_TEXTURE_LARGE) {
- /* Currently. Always fallback to cpu if destination is in CPU memory. */
- ret = FALSE;
- DEBUGF("dst pixmap has no FBO.\n");
- goto TRAPEZOID_OUT;
- }
-
- if (src->pDrawable) {
- source_pixmap = glamor_get_drawable_pixmap(src->pDrawable);
- source_pixmap_priv = glamor_get_pixmap_private(source_pixmap);
- temp_src_priv = source_pixmap_priv;
- if (source_pixmap_priv
- && (source_pixmap_priv->type == GLAMOR_DRM_ONLY
- || source_pixmap_priv->type == GLAMOR_TEXTURE_LARGE)) {
- ret = FALSE;
- goto TRAPEZOID_OUT;
- }
- }
-
- x_dst = bounds.x1;
- y_dst = bounds.y1;
-
- src_width = bounds.x2 - bounds.x1;
- src_height = bounds.y2 - bounds.y1;
-
- x_temp_src = x_src + bounds.x1 - (traps[0].left.p1.x >> 16);
- y_temp_src = y_src + bounds.y1 - (traps[0].left.p1.y >> 16);
-
- if ((!src->pDrawable && (src->pSourcePict->type != SourcePictTypeSolidFill)) //1. The Gradient case.
- /* 2. Has no fbo but can upload. */
- || (src->pDrawable && !GLAMOR_PIXMAP_PRIV_HAS_FBO(source_pixmap_priv)
- && ((src_width * src_height * 4 <
- source_pixmap->drawable.width * source_pixmap->drawable.height)
- || !glamor_check_fbo_size(glamor_priv,
- source_pixmap->drawable.width,
- source_pixmap->drawable.height)))) {
-
- if (!glamor_check_fbo_size(glamor_priv, src_width, src_height)) {
- ret = FALSE;
- goto TRAPEZOID_OUT;
- }
- temp_src = glamor_convert_gradient_picture(screen, src,
- x_src, y_src,
- src_width, src_height);
- if (!temp_src) {
- temp_src = src;
- ret = FALSE;
- DEBUGF("Convert gradient picture failed\n");
- goto TRAPEZOID_OUT;
- }
- temp_src_priv =
- glamor_get_pixmap_private((PixmapPtr) temp_src->pDrawable);
- x_temp_src = y_temp_src = 0;
- }
-
- x_dst += dst->pDrawable->x;
- y_dst += dst->pDrawable->y;
- if (temp_src->pDrawable) {
- x_temp_src += temp_src->pDrawable->x;
- y_temp_src += temp_src->pDrawable->y;
- }
-
- if (!miComputeCompositeRegion(&region,
- temp_src, NULL, dst,
- x_temp_src, y_temp_src,
- 0, 0, x_dst, y_dst, src_width, src_height)) {
- DEBUGF("All the regions are clipped out, do nothing\n");
- goto TRAPEZOID_OUT;
- }
-
- glamor_make_current(glamor_priv);
-
- box = REGION_RECTS(&region);
- nbox = REGION_NUM_RECTS(&region);
- pbox = box;
-
- ret = glamor_composite_choose_shader(op, temp_src, NULL, dst,
- temp_src_priv, NULL, dest_pixmap_priv,
- &key, &shader, &op_info,
- &saved_source_format);
- if (ret == FALSE) {
- DEBUGF("can not set the shader program for composite\n");
- goto TRAPEZOID_RESET_GL;
- }
- glamor_set_destination_pixmap_priv_nc(dest_pixmap_priv);
- glamor_composite_set_shader_blend(dest_pixmap_priv, &key, shader, &op_info);
- glamor_priv->has_source_coords = key.source != SHADER_SOURCE_SOLID;
- glamor_priv->has_mask_coords = (key.mask != SHADER_MASK_NONE &&
- key.mask != SHADER_MASK_SOLID);
-
- glamor_get_drawable_deltas(dst->pDrawable, dest_pixmap,
- &dest_x_off, &dest_y_off);
-
- pixmap_priv_get_dest_scale(dest_pixmap_priv, &dst_xscale, &dst_yscale);
-
- if (glamor_priv->has_source_coords) {
- source_pixmap = glamor_get_drawable_pixmap(temp_src->pDrawable);
- source_pixmap_priv = glamor_get_pixmap_private(source_pixmap);
- glamor_get_drawable_deltas(temp_src->pDrawable,
- source_pixmap, &source_x_off, &source_y_off);
- pixmap_priv_get_scale(source_pixmap_priv, &src_xscale, &src_yscale);
- glamor_picture_get_matrixf(temp_src, src_matrix);
- vert_stride += 3;
- }
-
- if (glamor_priv->has_mask_coords) {
- DEBUGF("Should never have mask coords here!\n");
- ret = FALSE;
- goto TRAPEZOID_RESET_GL;
- }
-
- /* A trapezoid clip with a rectangle will at most generate a hexagon,
- which can be devided into 4 triangles to render. */
- ntriangle_per_loop =
- (vert_stride * nbox * ntrap * 4) >
- GLAMOR_COMPOSITE_VBO_VERT_CNT ? (GLAMOR_COMPOSITE_VBO_VERT_CNT /
- vert_stride) : nbox * ntrap * 4;
- ntriangle_per_loop = (ntriangle_per_loop / 4) * 4;
-
- nclip_rect = nbox;
- while (nclip_rect) {
- float *vb;
-
- mclip_rect = (nclip_rect * ntrap * 4) > ntriangle_per_loop ?
- (ntriangle_per_loop / (4 * ntrap)) : nclip_rect;
-
- if (!mclip_rect) { /* Maybe too many traps. */
- mclip_rect = 1;
- ptrap = traps;
- traps_count = ntriangle_per_loop / 4;
- traps_not_completed = ntrap - traps_count;
- }
- else {
- traps_count = ntrap;
- ptrap = traps;
- traps_not_completed = 0;
- }
-
- NTRAPS_LOOP_AGAIN:
-
- vb = glamor_setup_composite_vbo(screen,
- (mclip_rect * traps_count *
- 4 * vert_stride));
- clip_processed = mclip_rect;
-
- while (mclip_rect--) {
- while (traps_count--) {
- int vtx_num;
- int i;
- float vertices[3 * 2], source_texcoords[3 * 2];
-
- DEBUGF
- ("In loop of render trapezoid, nclip_rect = %d, mclip_rect = %d, "
- "clip_processed = %d, traps_count = %d, traps_not_completed = %d\n",
- nclip_rect, mclip_rect, clip_processed, traps_count,
- traps_not_completed);
-
- if (_glamor_clip_trapezoid_vertex
- (ptrap, pbox, clipped_vtx, &vtx_num)) {
- for (i = 0; i < vtx_num - 2; i++) {
- int clipped_vtx_tmp[3 * 2];
-
- clipped_vtx_tmp[0] = clipped_vtx[0];
- clipped_vtx_tmp[1] = clipped_vtx[1];
- clipped_vtx_tmp[2] = clipped_vtx[(i + 1) * 2];
- clipped_vtx_tmp[3] = clipped_vtx[(i + 1) * 2 + 1];
- clipped_vtx_tmp[4] = clipped_vtx[(i + 2) * 2];
- clipped_vtx_tmp[5] = clipped_vtx[(i + 2) * 2 + 1];
- glamor_set_normalize_tri_vcoords(dst_xscale, dst_yscale,
- clipped_vtx_tmp,
- vertices);
- DEBUGF("vertices of triangle: (%f X %f), (%f X %f), "
- "(%f X %f)\n", vertices[0], vertices[1],
- vertices[2], vertices[3], vertices[4],
- vertices[5]);
-
- if (key.source != SHADER_SOURCE_SOLID) {
- if (src->transform) {
- glamor_set_transformed_normalize_tri_tcoords
- (source_pixmap_priv, src_matrix, src_xscale,
- src_yscale, clipped_vtx_tmp,
- source_texcoords);
- }
- else {
- glamor_set_normalize_tri_tcoords(src_xscale,
- src_yscale,
- clipped_vtx_tmp,
- source_texcoords);
- }
-
- DEBUGF("source_texcoords of triangle: (%f X %f), "
- "(%f X %f), (%f X %f)\n",
- source_texcoords[0], source_texcoords[1],
- source_texcoords[2], source_texcoords[3],
- source_texcoords[4], source_texcoords[5]);
- }
-
- glamor_emit_composite_triangle(screen, vb,
- source_texcoords,
- NULL, vertices);
- vb += 3 * glamor_priv->vb_stride / sizeof(float);
- }
- }
-
- ptrap++;
- }
-
- if (traps_not_completed) { /* one loop of ntraps not completed */
- mclip_rect = 1;
- traps_count = traps_not_completed > (ntriangle_per_loop / 4) ?
- (ntriangle_per_loop / 4) : traps_not_completed;
- traps_not_completed -= traps_count;
- glamor_flush_composite_triangles(screen);
- goto NTRAPS_LOOP_AGAIN;
- }
- else {
- ptrap = traps;
- traps_count = ntrap;
- }
-
- pbox++;
- }
-
- glamor_flush_composite_triangles(screen);
-
- nclip_rect -= clip_processed;
- }
-
- ret = TRUE;
-
- TRAPEZOID_RESET_GL:
- glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
- glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
- glDisableVertexAttribArray(GLAMOR_VERTEX_MASK);
- glDisable(GL_BLEND);
-
- TRAPEZOID_OUT:
- if (box) {
- REGION_UNINIT(dst->pDrawable->pScreen, &region);
- }
-
- if (temp_src != src) {
- FreePicture(temp_src, 0);
- }
- else {
- if (saved_source_format) {
- src->format = saved_source_format;
- }
- }
-
- return ret;
-}
-
-void
-glamor_init_trapezoid_shader(ScreenPtr screen)
-{
- glamor_screen_private *glamor_priv;
- GLint fs_prog, vs_prog;
-
- const char *trapezoid_vs =
- GLAMOR_DEFAULT_PRECISION
- "attribute vec4 v_position;\n"
- "attribute vec2 v_texcoord;\n"
- /* v_top_bottom, v_left_param and v_right_param contain the
- constant value for all the vertex of one rect. Using uniform
- is more suitable but we need to reset the uniform variables
- for every rect rendering and can not use the vbo, which causes
- performance loss. So we set these attributes to same value
- for every vertex of one rect and so it is also a constant in FS */
- "attribute vec2 v_top_bottom;\n"
- "attribute vec4 v_left_param;\n"
- "attribute vec4 v_right_param;\n"
- "\n"
- "varying vec2 source_texture;\n"
- "varying float trap_top;\n"
- "varying float trap_bottom;\n"
- "varying float trap_left_x;\n"
- "varying float trap_left_y;\n"
- "varying float trap_left_slope;\n"
- "varying float trap_left_vertical_f;\n"
- "varying float trap_right_x;\n"
- "varying float trap_right_y;\n"
- "varying float trap_right_slope;\n"
- "varying float trap_right_vertical_f;\n"
- "\n"
- "void main()\n"
- "{\n"
- " gl_Position = v_position;\n"
- " source_texture = v_texcoord.xy;\n"
- " trap_top = v_top_bottom.x;\n"
- " trap_bottom = v_top_bottom.y;\n"
- " \n"
- " trap_left_x = v_left_param.x;\n"
- " trap_left_y = v_left_param.y;\n"
- " trap_left_slope = v_left_param.z;\n"
- " trap_left_vertical_f = v_left_param.w;\n"
- " \n"
- " trap_right_x = v_right_param.x;\n"
- " trap_right_y = v_right_param.y;\n"
- " trap_right_slope = v_right_param.z;\n"
- " trap_right_vertical_f = v_right_param.w;\n"
- "}\n";
-
- /*
- * Because some GL fill function do not support the MultSample
- * anti-alias, we need to do the MSAA here. This manner like
- * pixman, will caculate the value of area in trapezoid dividing
- * the totol area for each pixel, as follow:
- |
- ----+------------------------------------------------------>
- |
- | -------------
- | / \
- | / \
- | / \
- | / +----------------+
- | / |.....\ |
- | / |......\ |
- | / |.......\ |
- | / |........\ |
- | /-------------------+---------\ |
- | | |
- | | |
- | +----------------+
- |
- \|/
-
- */
- const char *trapezoid_fs =
- GLAMOR_DEFAULT_PRECISION
- "varying vec2 source_texture; \n"
- "varying float trap_top; \n"
- "varying float trap_bottom; \n"
- "varying float trap_left_x; \n"
- "varying float trap_left_y; \n"
- "varying float trap_left_slope; \n"
- "varying float trap_left_vertical_f; \n"
- "varying float trap_right_x; \n"
- "varying float trap_right_y; \n"
- "varying float trap_right_slope; \n"
- "varying float trap_right_vertical_f; \n"
- "float x_per_pix = 1.0;"
- "float y_per_pix = 1.0;"
- "\n"
- "float get_alpha_val() \n"
- "{ \n"
- " float x_up_cut_left; \n"
- " float x_bottom_cut_left; \n"
- " float x_up_cut_right; \n"
- " float x_bottom_cut_right; \n"
- " bool trap_left_vertical;\n"
- " bool trap_right_vertical;\n"
- " if (abs(trap_left_vertical_f - 1.0) <= 0.0001)\n"
- " trap_left_vertical = true;\n"
- " else\n"
- " trap_left_vertical = false;\n"
- " if (abs(trap_right_vertical_f - 1.0) <= 0.0001)\n"
- " trap_right_vertical = true;\n"
- " else\n"
- " trap_right_vertical = false;\n"
- " \n"
- " if(trap_left_vertical == true) { \n"
- " x_up_cut_left = trap_left_x; \n"
- " x_bottom_cut_left = trap_left_x; \n"
- " } else { \n"
- " x_up_cut_left = trap_left_x \n"
- " + (source_texture.y - y_per_pix/2.0 - trap_left_y) \n"
- " / trap_left_slope; \n"
- " x_bottom_cut_left = trap_left_x \n"
- " + (source_texture.y + y_per_pix/2.0 - trap_left_y) \n"
- " / trap_left_slope; \n"
- " } \n"
- " \n"
- " if(trap_right_vertical == true) { \n"
- " x_up_cut_right = trap_right_x; \n"
- " x_bottom_cut_right = trap_right_x; \n"
- " } else { \n"
- " x_up_cut_right = trap_right_x \n"
- " + (source_texture.y - y_per_pix/2.0 - trap_right_y) \n"
- " / trap_right_slope; \n"
- " x_bottom_cut_right = trap_right_x \n"
- " + (source_texture.y + y_per_pix/2.0 - trap_right_y) \n"
- " / trap_right_slope; \n"
- " } \n"
- " \n"
- " if((x_up_cut_left <= source_texture.x - x_per_pix/2.0) && \n"
- " (x_bottom_cut_left <= source_texture.x - x_per_pix/2.0) && \n"
- " (x_up_cut_right >= source_texture.x + x_per_pix/2.0) && \n"
- " (x_bottom_cut_right >= source_texture.x + x_per_pix/2.0) && \n"
- " (trap_top <= source_texture.y - y_per_pix/2.0) && \n"
- " (trap_bottom >= source_texture.y + y_per_pix/2.0)) { \n"
- // The complete inside case.
- " return 1.0; \n"
- " } else if((trap_top > source_texture.y + y_per_pix/2.0) || \n"
- " (trap_bottom < source_texture.y - y_per_pix/2.0)) { \n"
- // The complete outside. Above the top or Below the bottom.
- " return 0.0; \n"
- " } else { \n"
- " if((x_up_cut_right < source_texture.x - x_per_pix/2.0 && \n"
- " x_bottom_cut_right < source_texture.x - x_per_pix/2.0) \n"
- " || (x_up_cut_left > source_texture.x + x_per_pix/2.0 && \n"
- " x_bottom_cut_left > source_texture.x + x_per_pix/2.0)) { \n"
- // The complete outside. At Left or Right of the trapezoide.
- " return 0.0; \n"
- " } \n"
- " } \n"
- // Get here, the pix is partly inside the trapezoid.
- " { \n"
- " float percent = 0.0; \n"
- " float up = (source_texture.y - y_per_pix/2.0) >= trap_top ? \n"
- " (source_texture.y - y_per_pix/2.0) : trap_top; \n"
- " float bottom = (source_texture.y + y_per_pix/2.0) <= trap_bottom ? \n"
- " (source_texture.y + y_per_pix/2.0) : trap_bottom; \n"
- " float left = source_texture.x - x_per_pix/2.0; \n"
- " float right = source_texture.x + x_per_pix/2.0; \n"
- " \n"
- " percent = (bottom - up) / y_per_pix; \n"
- " \n"
- " if(trap_left_vertical == true) { \n"
- " if(trap_left_x > source_texture.x - x_per_pix/2.0 && \n"
- " trap_left_x < source_texture.x + x_per_pix/2.0) \n"
- " left = trap_left_x; \n"
- " } \n"
- " if(trap_right_vertical == true) { \n"
- " if(trap_right_x > source_texture.x - x_per_pix/2.0 && \n"
- " trap_right_x < source_texture.x + x_per_pix/2.0) \n"
- " right = trap_right_x; \n"
- " } \n"
- " if((up >= bottom) || (left >= right)) \n"
- " return 0.0; \n"
- " \n"
- " percent = percent * ((right - left)/x_per_pix); \n"
- " if(trap_left_vertical == true && trap_right_vertical == true) \n"
- " return percent; \n"
- " \n"
- " if(trap_left_vertical != true) { \n"
- " float area; \n"
- // the slope should never be 0.0 here
- " float up_x = trap_left_x + (up - trap_left_y)/trap_left_slope; \n"
- " float bottom_x = trap_left_x + (bottom - trap_left_y)/trap_left_slope; \n"
- " if(trap_left_slope < 0.0 && up_x > left) { \n"
- /* case 1
- |
- ----+------------------------------------->
- | /
- | /
- | +---/--------+
- | | /.........|
- | | /..........|
- | |/...........|
- | /............|
- | /|............|
- | +------------+
- |
- \|/
- */
- " float left_y = trap_left_y + trap_left_slope*(left - trap_left_x); \n"
- " if((up_x > left) && (left_y > up)) { \n"
- " area = 0.5 * (up_x - left) * (left_y - up); \n"
- " if(up_x > right) { \n"
- " float right_y = trap_left_y \n"
- " + trap_left_slope*(right - trap_left_x); \n"
- " area = area - 0.5 * (up_x - right) * (right_y - up); \n"
- " } \n"
- " if(left_y > bottom) { \n"
- " area = area - 0.5 * (bottom_x - left) * (left_y - bottom); \n"
- " } \n"
- " } else { \n"
- " area = 0.0; \n"
- " } \n"
- " percent = percent * (1.0 - (area/((right-left)*(bottom-up)))); \n"
- " } else if(trap_left_slope > 0.0 && bottom_x > left) { \n"
- /* case 2
- |
- ----+------------------------------------->
- | \
- | \
- | +\-----------+
- | | \..........|
- | | \.........|
- | | \........|
- | | \.......|
- | | \......|
- | +------\-----+
- | \
- | \
- \|/
- */
- " float right_y = trap_left_y + trap_left_slope*(right - trap_left_x); \n"
- " if((up_x < right) && (right_y > up)) { \n"
- " area = 0.5 * (right - up_x) * (right_y - up); \n"
- " if(up_x < left) { \n"
- " float left_y = trap_left_y \n"
- " + trap_left_slope*(left - trap_left_x); \n"
- " area = area - 0.5 * (left - up_x) * (left_y - up); \n"
- " } \n"
- " if(right_y > bottom) { \n"
- " area = area - 0.5 * (right - bottom_x) * (right_y - bottom); \n"
- " } \n"
- " } else { \n"
- " area = 0.0; \n"
- " } \n"
- " percent = percent * (area/((right-left)*(bottom-up))); \n"
- " } \n"
- " } \n"
- " \n"
- " if(trap_right_vertical != true) { \n"
- " float area; \n"
- // the slope should never be 0.0 here
- " float up_x = trap_right_x + (up - trap_right_y)/trap_right_slope; \n"
- " float bottom_x = trap_right_x + (bottom - trap_right_y)/trap_right_slope; \n"
- " if(trap_right_slope < 0.0 && bottom_x < right) { \n"
- /* case 3
- |
- ----+------------------------------------->
- | /
- | +--------/---+
- | |......./ |
- | |....../ |
- | |...../ |
- | |..../ |
- | |.../ |
- | +--/---------+
- | /
- |
- \|/
- */
- " float left_y = trap_right_y + trap_right_slope*(left - trap_right_x); \n"
- " if((up_x > left) && (left_y > up)) { \n"
- " area = 0.5 * (up_x - left) * (left_y - up); \n"
- " if(up_x > right) { \n"
- " float right_y = trap_right_y \n"
- " + trap_right_slope*(right - trap_right_x); \n"
- " area = area - 0.5 * (up_x - right) * (right_y - up); \n"
- " } \n"
- " if(left_y > bottom) { \n"
- " area = area - 0.5 * (bottom_x - left) * (left_y - bottom); \n"
- " } \n"
- " } else { \n"
- " area = 0.0; \n"
- " } \n"
- " percent = percent * (area/((right-left)*(bottom-up))); \n"
- " } else if(trap_right_slope > 0.0 && up_x < right) { \n"
- /* case 4
- |
- ----+------------------------------------->
- | \
- | +--------\---+
- | |.........\ |
- | |..........\ |
- | |...........\|
- | |............\
- | |............|\
- | +------------+ \
- | \
- |
- \|/
- */
- " float right_y = trap_right_y + trap_right_slope*(right - trap_right_x); \n"
- " if((up_x < right) && (right_y > up)) { \n"
- " area = 0.5 * (right - up_x) * (right_y - up); \n"
- " if(up_x < left) { \n"
- " float left_y = trap_right_y \n"
- " + trap_right_slope*(left - trap_right_x); \n"
- " area = area - 0.5 * (left - up_x) * (left_y - up); \n"
- " } \n"
- " if(right_y > bottom) { \n"
- " area = area - 0.5 * (right - bottom_x) * (right_y - bottom); \n"
- " } \n"
- " } else { \n"
- " area = 0.0; \n"
- " } \n"
- " percent = percent * (1.0 - (area/((right-left)*(bottom-up)))); \n"
- " } \n"
- " } \n"
- " \n"
- " return percent; \n"
- " } \n"
- "} \n"
- "\n"
- "void main() \n"
- "{ \n"
- " float alpha_val = get_alpha_val(); \n"
- " gl_FragColor = vec4(0.0, 0.0, 0.0, alpha_val); \n"
- "}\n";
-
- glamor_priv = glamor_get_screen_private(screen);
- glamor_make_current(glamor_priv);
-
- glamor_priv->trapezoid_prog = glCreateProgram();
-
- vs_prog = glamor_compile_glsl_prog(GL_VERTEX_SHADER, trapezoid_vs);
- fs_prog = glamor_compile_glsl_prog(GL_FRAGMENT_SHADER, trapezoid_fs);
-
- glAttachShader(glamor_priv->trapezoid_prog, vs_prog);
- glAttachShader(glamor_priv->trapezoid_prog, fs_prog);
-
- glBindAttribLocation(glamor_priv->trapezoid_prog,
- GLAMOR_VERTEX_POS, "v_positionsition");
- glBindAttribLocation(glamor_priv->trapezoid_prog,
- GLAMOR_VERTEX_SOURCE, "v_texcoord");
- glBindAttribLocation(glamor_priv->trapezoid_prog,
- GLAMOR_VERTEX_TOP_BOTTOM, "v_top_bottom");
- glBindAttribLocation(glamor_priv->trapezoid_prog,
- GLAMOR_VERTEX_LEFT_PARAM, "v_left_param");
- glBindAttribLocation(glamor_priv->trapezoid_prog,
- GLAMOR_VERTEX_RIGHT_PARAM, "v_right_param");
-
- glamor_link_glsl_prog(screen, glamor_priv->trapezoid_prog, "trapezoid");
-}
-
-void
-glamor_fini_trapezoid_shader(ScreenPtr screen)
-{
- glamor_screen_private *glamor_priv;
-
- glamor_priv = glamor_get_screen_private(screen);
- glamor_make_current(glamor_priv);
- glDeleteProgram(glamor_priv->trapezoid_prog);
-}
-
-static Bool
-_glamor_generate_trapezoid_with_shader(ScreenPtr screen, PicturePtr picture,
- xTrapezoid *traps, int ntrap,
- BoxRec *bounds)
-{
- glamor_screen_private *glamor_priv;
- glamor_pixmap_private *pixmap_priv;
- PixmapPtr pixmap = NULL;
- GLint trapezoid_prog;
- GLfloat xscale, yscale;
- float left_slope, right_slope;
- xTrapezoid *ptrap;
- BoxRec one_trap_bound;
- int nrect_max;
- int i, j;
- float params[4];
-
- glamor_priv = glamor_get_screen_private(screen);
- trapezoid_prog = glamor_priv->trapezoid_prog;
-
- pixmap = glamor_get_drawable_pixmap(picture->pDrawable);
- pixmap_priv = glamor_get_pixmap_private(pixmap);
-
- if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)
- || pixmap_priv->type == GLAMOR_TEXTURE_LARGE) { /* should always have here. */
- DEBUGF("GLAMOR_PIXMAP_PRIV_HAS_FBO check failed, fallback\n");
- return FALSE;
- }
-
- /* First, clear all to zero */
- glamor_solid(pixmap, 0, 0, pixmap_priv->base.pixmap->drawable.width,
- pixmap_priv->base.pixmap->drawable.height, 0);
-
- glamor_make_current(glamor_priv);
-
- glamor_set_destination_pixmap_priv_nc(pixmap_priv);
-
- pixmap_priv_get_dest_scale(pixmap_priv, (&xscale), (&yscale));
-
- /* Now draw the Trapezoid mask. */
- glUseProgram(trapezoid_prog);
-
- glEnable(GL_BLEND);
- glBlendFunc(GL_ONE, GL_ONE);
-
- nrect_max = GLAMOR_COMPOSITE_VBO_VERT_CNT / (4 * GLAMOR_VERTEX_RIGHT_PARAM);
-
- for (i = 0; i < ntrap;) {
- float *vertices;
- int mrect;
- int stride;
-
- mrect = (ntrap - i) > nrect_max ? nrect_max : (ntrap - i);
- vertices = glamor_setup_composite_vbo_for_trapezoid(screen, 4 * mrect);
- stride = glamor_priv->vb_stride / sizeof(float);
-
- for (j = 0; j < mrect; j++) {
- ptrap = traps + i + j;
-
- DEBUGF
- ("--- The parameter of xTrapezoid is:\ntop: %d 0x%x\tbottom: %d 0x%x\n"
- "left: p1 (%d 0x%x, %d 0x%x)\tp2 (%d 0x%x, %d 0x%x)\n"
- "right: p1 (%d 0x%x, %d 0x%x)\tp2 (%d 0x%x, %d 0x%x)\n",
- xFixedToInt(ptrap->top), ptrap->top,
- xFixedToInt(ptrap->bottom), ptrap->bottom,
- xFixedToInt(ptrap->left.p1.x), ptrap->left.p1.x,
- xFixedToInt(ptrap->left.p1.y), ptrap->left.p1.y,
- xFixedToInt(ptrap->left.p2.x), ptrap->left.p2.x,
- xFixedToInt(ptrap->left.p2.y), ptrap->left.p2.y,
- xFixedToInt(ptrap->right.p1.x), ptrap->right.p1.x,
- xFixedToInt(ptrap->right.p1.y), ptrap->right.p1.y,
- xFixedToInt(ptrap->right.p2.x), ptrap->right.p2.x,
- xFixedToInt(ptrap->right.p2.y), ptrap->right.p2.y);
-
- miTrapezoidBounds(1, ptrap, &one_trap_bound);
-
- vertices += 2;
- glamor_set_tcoords_ext((one_trap_bound.x1), (one_trap_bound.y1),
- (one_trap_bound.x2), (one_trap_bound.y2),
- vertices, stride);
- DEBUGF("tex_vertices --> leftup : %f X %f, rightup: %f X %f,"
- "rightbottom: %f X %f, leftbottom : %f X %f\n", vertices[0],
- vertices[1], vertices[1 * stride], vertices[1 * stride + 1],
- vertices[2 * stride], vertices[2 * stride + 1],
- vertices[3 * stride], vertices[3 * stride + 1]);
-
- /* Need to rebase. */
- one_trap_bound.x1 -= bounds->x1;
- one_trap_bound.x2 -= bounds->x1;
- one_trap_bound.y1 -= bounds->y1;
- one_trap_bound.y2 -= bounds->y1;
-
- vertices -= 2;
-
- glamor_set_normalize_vcoords_ext(pixmap_priv, xscale, yscale,
- one_trap_bound.x1,
- one_trap_bound.y1,
- one_trap_bound.x2,
- one_trap_bound.y2,
- vertices, stride);
- DEBUGF("vertices --> leftup : %f X %f, rightup: %f X %f,"
- "rightbottom: %f X %f, leftbottom : %f X %f\n", vertices[0],
- vertices[1], vertices[1 * stride], vertices[1 * stride + 1],
- vertices[2 * stride], vertices[2 * stride + 1],
- vertices[3 * stride], vertices[3 * stride + 1]);
- vertices += 4;
-
- /* Set the top and bottom. */
- params[0] = ((float) ptrap->top) / 65536;
- params[1] = ((float) ptrap->bottom) / 65536;
- glamor_set_const_ext(params, 2, vertices, 4, stride);
- vertices += 2;
-
- /* Set the left params. */
- params[0] = ((float) ptrap->left.p1.x) / 65536;
- params[1] = ((float) ptrap->left.p1.y) / 65536;
-
- if (ptrap->left.p1.x == ptrap->left.p2.x) {
- left_slope = 0.0;
- params[3] = 1.0;
- }
- else {
- left_slope = ((float) (ptrap->left.p1.y - ptrap->left.p2.y))
- / ((float) (ptrap->left.p1.x - ptrap->left.p2.x));
- params[3] = 0.0;
- }
- params[2] = left_slope;
- glamor_set_const_ext(params, 4, vertices, 4, stride);
- vertices += 4;
-
- /* Set the left params. */
- params[0] = ((float) ptrap->right.p1.x) / 65536;
- params[1] = ((float) ptrap->right.p1.y) / 65536;
-
- if (ptrap->right.p1.x == ptrap->right.p2.x) {
- right_slope = 0.0;
- params[3] = 1.0;
- }
- else {
- right_slope = ((float) (ptrap->right.p1.y - ptrap->right.p2.y))
- / ((float) (ptrap->right.p1.x - ptrap->right.p2.x));
- params[3] = 0.0;
- }
- params[2] = right_slope;
- glamor_set_const_ext(params, 4, vertices, 4, stride);
- vertices += 4;
-
- DEBUGF("trap_top = %f, trap_bottom = %f, "
- "trap_left_x = %f, trap_left_y = %f, left_slope = %f, "
- "trap_right_x = %f, trap_right_y = %f, right_slope = %f\n",
- ((float) ptrap->top) / 65536,
- ((float) ptrap->bottom) / 65536,
- ((float) ptrap->left.p1.x) / 65536,
- ((float) ptrap->left.p1.y) / 65536, left_slope,
- ((float) ptrap->right.p1.x) / 65536,
- ((float) ptrap->right.p1.y) / 65536, right_slope);
-
- glamor_priv->render_nr_verts += 4;
- vertices += 3 * stride;
- }
-
- i += mrect;
-
- glamor_put_vbo_space(screen);
-
- /* Now rendering. */
- if (!glamor_priv->render_nr_verts)
- continue;
-
- if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) {
- glDrawRangeElements(GL_TRIANGLES, 0,
- glamor_priv->render_nr_verts,
- (glamor_priv->render_nr_verts * 3) / 2,
- GL_UNSIGNED_SHORT, NULL);
- } else {
- glDrawElements(GL_TRIANGLES,
- (glamor_priv->render_nr_verts * 3) / 2,
- GL_UNSIGNED_SHORT, NULL);
- }
- }
-
- glBlendFunc(GL_ONE, GL_ZERO);
- glDisable(GL_BLEND);
- glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
- glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
- glDisableVertexAttribArray(GLAMOR_VERTEX_TOP_BOTTOM);
- glDisableVertexAttribArray(GLAMOR_VERTEX_LEFT_PARAM);
- glDisableVertexAttribArray(GLAMOR_VERTEX_RIGHT_PARAM);
- return TRUE;
-}
-
-#endif /*GLAMOR_TRAPEZOID_SHADER */
-
/**
* Creates an appropriate picture for temp mask use.
*/
@@ -1559,7 +43,7 @@ static PicturePtr
glamor_create_mask_picture(ScreenPtr screen,
PicturePtr dst,
PictFormatPtr pict_format,
- CARD16 width, CARD16 height, int gpu)
+ CARD16 width, CARD16 height)
{
PixmapPtr pixmap;
PicturePtr picture;
@@ -1574,15 +58,9 @@ glamor_create_mask_picture(ScreenPtr screen,
return 0;
}
- if (gpu) {
- pixmap = glamor_create_pixmap(screen, width, height,
- pict_format->depth, 0);
- }
- else {
- pixmap = glamor_create_pixmap(screen, 0, 0,
- pict_format->depth,
- GLAMOR_CREATE_PIXMAP_CPU);
- }
+ pixmap = glamor_create_pixmap(screen, 0, 0,
+ pict_format->depth,
+ GLAMOR_CREATE_PIXMAP_CPU);
if (!pixmap)
return 0;
@@ -1592,61 +70,15 @@ glamor_create_mask_picture(ScreenPtr screen,
return picture;
}
-static int
-_glamor_trapezoid_bounds(int ntrap, xTrapezoid *traps, BoxPtr box)
-{
- int has_large_trapezoid = 0;
-
- box->y1 = MAXSHORT;
- box->y2 = MINSHORT;
- box->x1 = MAXSHORT;
- box->x2 = MINSHORT;
-
- for (; ntrap; ntrap--, traps++) {
- INT16 x1, y1, x2, y2;
-
- if (!xTrapezoidValid(traps))
- continue;
- y1 = xFixedToInt(traps->top);
- if (y1 < box->y1)
- box->y1 = y1;
-
- y2 = xFixedToInt(xFixedCeil(traps->bottom));
- if (y2 > box->y2)
- box->y2 = y2;
-
- x1 = xFixedToInt(min
- (_glamor_linefixedX(&traps->left, traps->top, FALSE),
- _glamor_linefixedX(&traps->left, traps->bottom,
- FALSE)));
- if (x1 < box->x1)
- box->x1 = x1;
-
- x2 = xFixedToInt(xFixedCeil
- (max
- (_glamor_linefixedX(&traps->right, traps->top, TRUE),
- _glamor_linefixedX(&traps->right, traps->bottom,
- TRUE))));
- if (x2 > box->x2)
- box->x2 = x2;
-
- if (!has_large_trapezoid && (x2 - x1) > 256 && (y2 - y1) > 32)
- has_large_trapezoid = 1;
- }
-
- return has_large_trapezoid;
-}
-
/**
- * glamor_trapezoids will first try to create a trapezoid mask using shader,
- * if failed, miTrapezoids will generate trapezoid mask accumulating in
+ * glamor_trapezoids will generate trapezoid mask accumulating in
* system memory.
*/
-static Bool
-_glamor_trapezoids(CARD8 op,
- PicturePtr src, PicturePtr dst,
- PictFormatPtr mask_format, INT16 x_src, INT16 y_src,
- int ntrap, xTrapezoid *traps, Bool fallback)
+void
+glamor_trapezoids(CARD8 op,
+ PicturePtr src, PicturePtr dst,
+ PictFormatPtr mask_format, INT16 x_src, INT16 y_src,
+ int ntrap, xTrapezoid *traps)
{
ScreenPtr screen = dst->pDrawable->pScreen;
BoxRec bounds;
@@ -1656,8 +88,6 @@ _glamor_trapezoids(CARD8 op,
int width, height, stride;
PixmapPtr pixmap;
pixman_image_t *image = NULL;
- int ret = 0;
- int has_large_trapezoid;
/* If a mask format wasn't provided, we get to choose, but behavior should
* be as if there was no temporary mask the traps were accumulated into.
@@ -1670,16 +100,13 @@ _glamor_trapezoids(CARD8 op,
for (; ntrap; ntrap--, traps++)
glamor_trapezoids(op, src, dst, mask_format, x_src,
y_src, 1, traps);
- return TRUE;
+ return;
}
- has_large_trapezoid = _glamor_trapezoid_bounds(ntrap, traps, &bounds);
- DEBUGF("The bounds for all traps is: bounds.x1 = %d, bounds.x2 = %d, "
- "bounds.y1 = %d, bounds.y2 = %d, ---- ntrap = %d\n", bounds.x1,
- bounds.x2, bounds.y1, bounds.y2, ntrap);
+ miTrapezoidBounds(ntrap, traps, &bounds);
if (bounds.y1 >= bounds.y2 || bounds.x1 >= bounds.x2)
- return TRUE;
+ return;
x_dst = traps[0].left.p1.x >> 16;
y_dst = traps[0].left.p1.y >> 16;
@@ -1688,85 +115,34 @@ _glamor_trapezoids(CARD8 op,
height = bounds.y2 - bounds.y1;
stride = PixmapBytePad(width, mask_format->depth);
-#ifdef GLAMOR_TRAPEZOID_SHADER
- /* We seperate the render to two paths.
- Some GL implemetation do not implement the Anti-Alias for triangles
- and polygen's filling. So when the edge is not vertical or horizontal,
- sawtooth will be obvious. The trapezoid is widely used to render wide
- lines and circles. In these case, the line or circle will be divided
- into a large number of small trapezoids to approximate it, so the sawtooth
- at the edge will cause the result not be acceptable.
- When the depth of the mask is 1, there is no Anti-Alias needed, so we
- use the clip logic to generate the result directly(fast path).
- When the depth is not 1, AA is needed and we use a shader to generate
- a temp mask pixmap.
- */
- if (mask_format->depth == 1) {
- ret = _glamor_trapezoids_with_shader(op, src, dst, mask_format,
- x_src, y_src, ntrap, traps);
- if (ret)
- return TRUE;
- }
- else {
- if (has_large_trapezoid || ntrap > 256) {
- /* The shader speed is relative slower than pixman when generating big chunk
- trapezoid mask. We fallback to pixman to improve the performance. */
- ;
- }
- else if (dst->polyMode == PolyModeImprecise) {
- /* The precise mode is that we sample the trapezoid on the centre points of
- an (2*n+1)x(2*n-1) subpixel grid. It is computationally expensive in shader
- and we use inside area ratio to replace it if the polymode == Imprecise. */
- picture = glamor_create_mask_picture(screen, dst, mask_format,
- width, height, 1);
- if (!picture)
- return TRUE;
-
- ret =
- _glamor_generate_trapezoid_with_shader(screen, picture, traps,
- ntrap, &bounds);
+ picture = glamor_create_mask_picture(screen, dst, mask_format,
+ width, height);
+ if (!picture)
+ return;
- if (!ret)
- FreePicture(picture, 0);
- }
+ image = pixman_image_create_bits(picture->format,
+ width, height, NULL, stride);
+ if (!image) {
+ FreePicture(picture, 0);
+ return;
}
-#endif
- if (!ret) {
- DEBUGF("Fallback to sw rasterize of trapezoid\n");
+ for (; ntrap; ntrap--, traps++)
+ pixman_rasterize_trapezoid(image,
+ (pixman_trapezoid_t *) traps,
+ -bounds.x1, -bounds.y1);
- picture = glamor_create_mask_picture(screen, dst, mask_format,
- width, height, 0);
- if (!picture)
- return TRUE;
-
- image = pixman_image_create_bits(picture->format,
- width, height, NULL, stride);
- if (!image) {
- FreePicture(picture, 0);
- return TRUE;
- }
-
- for (; ntrap; ntrap--, traps++)
- pixman_rasterize_trapezoid(image,
- (pixman_trapezoid_t *) traps,
- -bounds.x1, -bounds.y1);
+ pixmap = glamor_get_drawable_pixmap(picture->pDrawable);
- pixmap = glamor_get_drawable_pixmap(picture->pDrawable);
-
- screen->ModifyPixmapHeader(pixmap, width, height,
- mask_format->depth,
- BitsPerPixel(mask_format->depth),
- PixmapBytePad(width,
- mask_format->depth),
- pixman_image_get_data(image));
- }
+ screen->ModifyPixmapHeader(pixmap, width, height,
+ mask_format->depth,
+ BitsPerPixel(mask_format->depth),
+ PixmapBytePad(width,
+ mask_format->depth),
+ pixman_image_get_data(image));
x_rel = bounds.x1 + x_src - x_dst;
y_rel = bounds.y1 + y_src - y_dst;
- DEBUGF("x_src = %d, y_src = %d, x_dst = %d, y_dst = %d, "
- "x_rel = %d, y_rel = %d\n", x_src, y_src, x_dst,
- y_dst, x_rel, y_rel);
CompositePicture(op, src, picture, dst,
x_rel, y_rel,
@@ -1778,19 +154,6 @@ _glamor_trapezoids(CARD8 op,
pixman_image_unref(image);
FreePicture(picture, 0);
- return TRUE;
-}
-
-void
-glamor_trapezoids(CARD8 op,
- PicturePtr src, PicturePtr dst,
- PictFormatPtr mask_format, INT16 x_src, INT16 y_src,
- int ntrap, xTrapezoid *traps)
-{
- DEBUGF("x_src = %d, y_src = %d, ntrap = %d\n", x_src, y_src, ntrap);
-
- _glamor_trapezoids(op, src, dst, mask_format, x_src,
- y_src, ntrap, traps, TRUE);
}
Bool
@@ -1801,8 +164,9 @@ glamor_trapezoids_nf(CARD8 op,
{
DEBUGF("x_src = %d, y_src = %d, ntrap = %d\n", x_src, y_src, ntrap);
- return _glamor_trapezoids(op, src, dst, mask_format, x_src,
- y_src, ntrap, traps, FALSE);
+ glamor_trapezoids(op, src, dst, mask_format, x_src,
+ y_src, ntrap, traps);
+ return TRUE;
}
#endif /* RENDER */
diff --git a/xorg-server/glx/glxcmds.c b/xorg-server/glx/glxcmds.c
index c39a3f461..b4f5c46a5 100644
--- a/xorg-server/glx/glxcmds.c
+++ b/xorg-server/glx/glxcmds.c
@@ -2513,13 +2513,16 @@ __glXsendSwapEvent(__GLXdrawable *drawable, int type, CARD64 ust,
#if PRESENT
static void
-__glXpresentCompleteNotify(WindowPtr window, CARD8 present_mode, CARD32 serial,
- uint64_t ust, uint64_t msc)
+__glXpresentCompleteNotify(WindowPtr window, CARD8 present_kind, CARD8 present_mode,
+ CARD32 serial, uint64_t ust, uint64_t msc)
{
__GLXdrawable *drawable;
int glx_type;
int rc;
+ if (present_kind != PresentCompleteKindPixmap)
+ return;
+
rc = dixLookupResourceByType((void **) &drawable, window->drawable.id,
__glXDrawableRes, serverClient, DixGetAttrAccess);
diff --git a/xorg-server/glx/glxdriswrast.c b/xorg-server/glx/glxdriswrast.c
index d4dcd9080..c49175803 100644
--- a/xorg-server/glx/glxdriswrast.c
+++ b/xorg-server/glx/glxdriswrast.c
@@ -337,7 +337,7 @@ swrastGetDrawableInfo(__DRIdrawable * draw,
DrawablePtr pDraw = drawable->base.pDraw;
*x = pDraw->x;
- *y = pDraw->x;
+ *y = pDraw->y;
*w = pDraw->width;
*h = pDraw->height;
}
diff --git a/xorg-server/hw/kdrive/ephyr/Makefile.am b/xorg-server/hw/kdrive/ephyr/Makefile.am
index 10c59174f..155e11eb3 100644
--- a/xorg-server/hw/kdrive/ephyr/Makefile.am
+++ b/xorg-server/hw/kdrive/ephyr/Makefile.am
@@ -68,6 +68,7 @@ Xephyr_SOURCES = \
ephyr_draw.c \
os.c \
ephyrinit.c \
+ ephyrcursor.c \
hostx.c \
hostx.h \
$(XV_SRCS) \
diff --git a/xorg-server/hw/kdrive/ephyr/ephyr.h b/xorg-server/hw/kdrive/ephyr/ephyr.h
index ffe7db1c2..c07c8b2b2 100644
--- a/xorg-server/hw/kdrive/ephyr/ephyr.h
+++ b/xorg-server/hw/kdrive/ephyr/ephyr.h
@@ -199,8 +199,6 @@ extern KdOsFuncs EphyrOsFuncs;
extern Bool ephyrCursorInit(ScreenPtr pScreen);
-extern void ephyrCursorEnable(ScreenPtr pScreen);
-
extern int ephyrBufferHeight(KdScreenInfo * screen);
extern int ephyrBufferHeight(KdScreenInfo *screen);
diff --git a/xorg-server/hw/kdrive/ephyr/ephyrcursor.c b/xorg-server/hw/kdrive/ephyr/ephyrcursor.c
new file mode 100644
index 000000000..852be33e0
--- /dev/null
+++ b/xorg-server/hw/kdrive/ephyr/ephyrcursor.c
@@ -0,0 +1,262 @@
+/*
+ * Copyright © 2014 Red Hat, Inc.
+ *
+ * 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.
+ *
+ * Author:
+ * Adam Jackson <ajax@redhat.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "ephyr.h"
+#include "ephyrlog.h"
+#include "hostx.h"
+#include "cursorstr.h"
+#include <xcb/render.h>
+#include <xcb/xcb_renderutil.h>
+
+static DevPrivateKeyRec ephyrCursorPrivateKey;
+
+typedef struct _ephyrCursor {
+ xcb_cursor_t cursor;
+} ephyrCursorRec, *ephyrCursorPtr;
+
+static ephyrCursorPtr
+ephyrGetCursor(CursorPtr cursor)
+{
+ return dixGetPrivateAddr(&cursor->devPrivates, &ephyrCursorPrivateKey);
+}
+
+static void
+ephyrRealizeCoreCursor(EphyrScrPriv *scr, CursorPtr cursor)
+{
+ ephyrCursorPtr hw = ephyrGetCursor(cursor);
+ xcb_connection_t *conn = hostx_get_xcbconn();
+ xcb_pixmap_t source, mask;
+ xcb_image_t *image;
+ xcb_gcontext_t gc;
+ int w = cursor->bits->width, h = cursor->bits->height;
+ uint32_t gcmask = XCB_GC_FUNCTION |
+ XCB_GC_PLANE_MASK |
+ XCB_GC_FOREGROUND |
+ XCB_GC_BACKGROUND |
+ XCB_GC_CLIP_MASK;
+ uint32_t val[] = {
+ XCB_GX_COPY, /* function */
+ ~0, /* planemask */
+ 1L, /* foreground */
+ 0L, /* background */
+ None, /* clipmask */
+ };
+
+ source = xcb_generate_id(conn);
+ mask = xcb_generate_id(conn);
+ xcb_create_pixmap(conn, 1, source, scr->win, w, h);
+ xcb_create_pixmap(conn, 1, mask, scr->win, w, h);
+
+ gc = xcb_generate_id(conn);
+ xcb_create_gc(conn, gc, source, gcmask, val);
+
+ image = xcb_image_create_native(conn, w, h, XCB_IMAGE_FORMAT_XY_BITMAP,
+ 1, NULL, ~0, NULL);
+ image->data = cursor->bits->source;
+ xcb_image_put(conn, source, gc, image, 0, 0, 0);
+ xcb_image_destroy(image);
+
+ image = xcb_image_create_native(conn, w, h, XCB_IMAGE_FORMAT_XY_BITMAP,
+ 1, NULL, ~0, NULL);
+ image->data = cursor->bits->mask;
+ xcb_image_put(conn, mask, gc, image, 0, 0, 0);
+ xcb_image_destroy(image);
+
+ xcb_free_gc(conn, gc);
+
+ hw->cursor = xcb_generate_id(conn);
+ xcb_create_cursor(conn, hw->cursor, source, mask,
+ cursor->foreRed, cursor->foreGreen, cursor->foreBlue,
+ cursor->backRed, cursor->backGreen, cursor->backBlue,
+ cursor->bits->xhot, cursor->bits->yhot);
+
+ xcb_free_pixmap(conn, source);
+ xcb_free_pixmap(conn, mask);
+}
+
+#ifdef ARGB_CURSOR
+static xcb_render_pictformat_t
+get_argb_format(void)
+{
+ static xcb_render_pictformat_t format;
+ if (format == None) {
+ xcb_connection_t *conn = hostx_get_xcbconn();
+ xcb_render_query_pict_formats_cookie_t cookie;
+ xcb_render_query_pict_formats_reply_t *formats;
+
+ cookie = xcb_render_query_pict_formats(conn);
+ formats =
+ xcb_render_query_pict_formats_reply(conn, cookie, NULL);
+
+ format =
+ xcb_render_util_find_standard_format(formats,
+ XCB_PICT_STANDARD_ARGB_32)->id;
+
+ free(formats);
+ }
+
+ return format;
+}
+
+static void
+ephyrRealizeARGBCursor(EphyrScrPriv *scr, CursorPtr cursor)
+{
+ ephyrCursorPtr hw = ephyrGetCursor(cursor);
+ xcb_connection_t *conn = hostx_get_xcbconn();
+ xcb_gcontext_t gc;
+ xcb_pixmap_t source;
+ xcb_render_picture_t picture;
+ xcb_image_t *image;
+ int w = cursor->bits->width, h = cursor->bits->height;
+
+ /* dix' storage is PICT_a8r8g8b8 */
+ source = xcb_generate_id(conn);
+ xcb_create_pixmap(conn, 32, source, scr->win, w, h);
+
+ gc = xcb_generate_id(conn);
+ xcb_create_gc(conn, gc, source, 0, NULL);
+ image = xcb_image_create_native(conn, w, h, XCB_IMAGE_FORMAT_Z_PIXMAP,
+ 32, NULL, ~0, NULL);
+ image->data = (void *)cursor->bits->argb;
+ xcb_image_put(conn, source, gc, image, 0, 0, 0);
+ xcb_free_gc(conn, gc);
+ xcb_image_destroy(image);
+
+ picture = xcb_generate_id(conn);
+ xcb_render_create_picture(conn, picture, source, get_argb_format(),
+ 0, NULL);
+ xcb_free_pixmap(conn, source);
+
+ hw->cursor = xcb_generate_id(conn);
+ xcb_render_create_cursor(conn, hw->cursor, picture,
+ cursor->bits->xhot, cursor->bits->yhot);
+
+ xcb_render_free_picture(conn, picture);
+}
+
+static Bool
+can_argb_cursor(void)
+{
+ static const xcb_render_query_version_reply_t *v;
+
+ if (!v)
+ v = xcb_render_util_query_version(hostx_get_xcbconn());
+
+ return v->major_version == 0 && v->minor_version >= 5;
+}
+#endif
+
+static Bool
+ephyrRealizeCursor(DeviceIntPtr dev, ScreenPtr screen, CursorPtr cursor)
+{
+ KdScreenPriv(screen);
+ KdScreenInfo *kscr = pScreenPriv->screen;
+ EphyrScrPriv *scr = kscr->driver;
+
+#ifdef ARGB_CURSOR
+ if (cursor->bits->argb && can_argb_cursor())
+ ephyrRealizeARGBCursor(scr, cursor);
+ else
+#endif
+ {
+ ephyrRealizeCoreCursor(scr, cursor);
+ }
+ return TRUE;
+}
+
+static Bool
+ephyrUnrealizeCursor(DeviceIntPtr dev, ScreenPtr screen, CursorPtr cursor)
+{
+ ephyrCursorPtr hw = ephyrGetCursor(cursor);
+
+ if (hw->cursor) {
+ xcb_free_cursor(hostx_get_xcbconn(), hw->cursor);
+ hw->cursor = None;
+ }
+
+ return TRUE;
+}
+
+static void
+ephyrSetCursor(DeviceIntPtr dev, ScreenPtr screen, CursorPtr cursor, int x,
+ int y)
+{
+ KdScreenPriv(screen);
+ KdScreenInfo *kscr = pScreenPriv->screen;
+ EphyrScrPriv *scr = kscr->driver;
+ uint32_t attr = None;
+
+ if (cursor)
+ attr = ephyrGetCursor(cursor)->cursor;
+ else
+ attr = hostx_get_empty_cursor();
+
+ xcb_change_window_attributes(hostx_get_xcbconn(), scr->win,
+ XCB_CW_CURSOR, &attr);
+ xcb_flush(hostx_get_xcbconn());
+}
+
+static void
+ephyrMoveCursor(DeviceIntPtr dev, ScreenPtr screen, int x, int y)
+{
+}
+
+static Bool
+ephyrDeviceCursorInitialize(DeviceIntPtr dev, ScreenPtr screen)
+{
+ return TRUE;
+}
+
+static void
+ephyrDeviceCursorCleanup(DeviceIntPtr dev, ScreenPtr screen)
+{
+}
+
+miPointerSpriteFuncRec EphyrPointerSpriteFuncs = {
+ ephyrRealizeCursor,
+ ephyrUnrealizeCursor,
+ ephyrSetCursor,
+ ephyrMoveCursor,
+ ephyrDeviceCursorInitialize,
+ ephyrDeviceCursorCleanup
+};
+
+Bool
+ephyrCursorInit(ScreenPtr screen)
+{
+ if (!dixRegisterPrivateKey(&ephyrCursorPrivateKey, PRIVATE_CURSOR_BITS,
+ sizeof(ephyrCursorRec)))
+ return FALSE;
+
+ miPointerInitialize(screen,
+ &EphyrPointerSpriteFuncs,
+ &ephyrPointerScreenFuncs, FALSE);
+
+ return TRUE;
+}
diff --git a/xorg-server/hw/kdrive/ephyr/ephyrinit.c b/xorg-server/hw/kdrive/ephyr/ephyrinit.c
index dee15b530..c7358b52e 100755
--- a/xorg-server/hw/kdrive/ephyr/ephyrinit.c
+++ b/xorg-server/hw/kdrive/ephyr/ephyrinit.c
@@ -372,10 +372,8 @@ OsVendorInit(void)
{
EPHYR_DBG("mark");
- if (hostx_want_host_cursor()) {
+ if (hostx_want_host_cursor())
ephyrFuncs.initCursor = &ephyrCursorInit;
- ephyrFuncs.enableCursor = &ephyrCursorEnable;
- }
KdOsInit(&EphyrOsFuncs);
}
@@ -389,69 +387,6 @@ OsVendorFatalError(void)
#endif
-/* 'Fake' cursor stuff, could be improved */
-
-static Bool
-ephyrRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
-{
- return TRUE;
-}
-
-static Bool
-ephyrUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
-{
- return TRUE;
-}
-
-static void
-ephyrSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor, int x,
- int y)
-{
- ;
-}
-
-static void
-ephyrMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
-{
- ;
-}
-
-static Bool
-ephyrDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScreen)
-{
- return TRUE;
-}
-
-static void
-ephyrDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScreen)
-{
-}
-
-miPointerSpriteFuncRec EphyrPointerSpriteFuncs = {
- ephyrRealizeCursor,
- ephyrUnrealizeCursor,
- ephyrSetCursor,
- ephyrMoveCursor,
- ephyrDeviceCursorInitialize,
- ephyrDeviceCursorCleanup
-};
-
-Bool
-ephyrCursorInit(ScreenPtr pScreen)
-{
- miPointerInitialize(pScreen,
- &EphyrPointerSpriteFuncs,
- &ephyrPointerScreenFuncs, FALSE);
-
- return TRUE;
-}
-
-void
-ephyrCursorEnable(ScreenPtr pScreen)
-{
- ;
-}
-
KdCardFuncs ephyrFuncs = {
ephyrCardInit, /* cardinit */
ephyrScreenInitialize, /* scrinit */
diff --git a/xorg-server/hw/kdrive/ephyr/hostx.c b/xorg-server/hw/kdrive/ephyr/hostx.c
index 4b69171a0..ae92545fc 100755
--- a/xorg-server/hw/kdrive/ephyr/hostx.c
+++ b/xorg-server/hw/kdrive/ephyr/hostx.c
@@ -73,6 +73,8 @@ struct EphyrHostXVars {
xcb_visualtype_t *visual;
Window winroot;
xcb_gcontext_t gc;
+ xcb_render_pictformat_t argb_format;
+ xcb_cursor_t empty_cursor;
int depth;
Bool use_sw_cursor;
Bool use_fullscreen;
@@ -208,6 +210,12 @@ hostx_use_sw_cursor(void)
HostX.use_sw_cursor = TRUE;
}
+xcb_cursor_t
+hostx_get_empty_cursor(void)
+{
+ return HostX.empty_cursor;
+}
+
int
hostx_want_preexisting_window(KdScreenInfo *screen)
{
@@ -414,8 +422,8 @@ hostx_init(void)
{
uint32_t attrs[2];
uint32_t attr_mask = 0;
- xcb_cursor_t empty_cursor;
xcb_pixmap_t cursor_pxm;
+ xcb_gcontext_t cursor_gc;
uint16_t red, green, blue;
uint32_t pixel;
int index;
@@ -424,6 +432,7 @@ hostx_init(void)
size_t class_len;
const xcb_query_extension_reply_t *shm_rep;
xcb_screen_t *xscreen;
+ xcb_rectangle_t rect = { 0, 0, 1, 1 };
attrs[0] =
XCB_EVENT_MASK_BUTTON_PRESS
@@ -600,18 +609,25 @@ hostx_init(void)
xcb_change_gc(HostX.conn, HostX.gc, XCB_GC_FOREGROUND, &pixel);
+ cursor_pxm = xcb_generate_id(HostX.conn);
+ xcb_create_pixmap(HostX.conn, 1, cursor_pxm, HostX.winroot, 1, 1);
+ cursor_gc = xcb_generate_id(HostX.conn);
+ pixel = 0;
+ xcb_create_gc(HostX.conn, cursor_gc, cursor_pxm,
+ XCB_GC_FOREGROUND, &pixel);
+ xcb_poly_fill_rectangle(HostX.conn, cursor_pxm, cursor_gc, 1, &rect);
+ xcb_free_gc(HostX.conn, cursor_gc);
+ HostX.empty_cursor = xcb_generate_id(HostX.conn);
+ xcb_create_cursor(HostX.conn,
+ HostX.empty_cursor,
+ cursor_pxm, cursor_pxm,
+ 0,0,0,
+ 0,0,0,
+ 1,1);
+ xcb_free_pixmap(HostX.conn, cursor_pxm);
if (!hostx_want_host_cursor ()) {
CursorVisible = TRUE;
/* Ditch the cursor, we provide our 'own' */
- cursor_pxm = xcb_generate_id(HostX.conn);
- xcb_create_pixmap(HostX.conn, 1, cursor_pxm, HostX.winroot, 1, 1);
- empty_cursor = xcb_generate_id(HostX.conn);
- xcb_create_cursor(HostX.conn,
- empty_cursor,
- cursor_pxm, cursor_pxm,
- 0,0,0,
- 0,0,0,
- 1,1);
for (index = 0; index < HostX.n_screens; index++) {
KdScreenInfo *screen = HostX.screens[index];
EphyrScrPriv *scrpriv = screen->driver;
@@ -619,9 +635,8 @@ hostx_init(void)
xcb_change_window_attributes(HostX.conn,
scrpriv->win,
XCB_CW_CURSOR,
- &empty_cursor);
+ &HostX.empty_cursor);
}
- xcb_free_pixmap(HostX.conn, cursor_pxm);
}
#ifdef _MSC_VER
diff --git a/xorg-server/hw/kdrive/ephyr/hostx.h b/xorg-server/hw/kdrive/ephyr/hostx.h
index d108d48be..1be8d0bb1 100644
--- a/xorg-server/hw/kdrive/ephyr/hostx.h
+++ b/xorg-server/hw/kdrive/ephyr/hostx.h
@@ -29,6 +29,7 @@
#include <X11/X.h>
#include <X11/Xmd.h>
#include <xcb/xcb.h>
+#include <xcb/render.h>
#include "ephyr.h"
#define EPHYR_WANT_DEBUG 0
@@ -86,6 +87,9 @@ int
void
hostx_use_sw_cursor(void);
+xcb_cursor_t
+ hostx_get_empty_cursor(void);
+
void
hostx_get_output_geometry(const char *output,
int *x, int *y,
diff --git a/xorg-server/hw/xfree86/Makefile.am b/xorg-server/hw/xfree86/Makefile.am
index c5992c372..30f7c8ffd 100644
--- a/xorg-server/hw/xfree86/Makefile.am
+++ b/xorg-server/hw/xfree86/Makefile.am
@@ -38,7 +38,7 @@ SUBDIRS = common ddc x86emu $(INT10_SUBDIR) os-support parser \
ramdac $(VGAHW_SUBDIR) loader modes $(DRI_SUBDIR) \
$(DRI2_SUBDIR) . $(VBE_SUBDIR) i2c dixmods \
fbdevhw shadowfb exa $(XF86UTILS_SUBDIR) doc man \
- $(GLAMOR_EGL_SUBDIR)
+ $(GLAMOR_EGL_SUBDIR) drivers
DIST_SUBDIRS = common ddc i2c x86emu int10 fbdevhw os-support \
parser ramdac shadowfb vbe vgahw \
diff --git a/xorg-server/hw/xfree86/doc/README.DRIcomp b/xorg-server/hw/xfree86/doc/README.DRIcomp
index 2d3ebf148..73886504f 100644
--- a/xorg-server/hw/xfree86/doc/README.DRIcomp
+++ b/xorg-server/hw/xfree86/doc/README.DRIcomp
@@ -142,9 +142,6 @@ Here are the basic steps for kernel setup.
o Enable all chipsets' support for AGP
- o It's recommended that you turn on MTRRs under Processor type and
- Features, but not required.
-
o Configure the rest of the kernel as required for your system (i.e. Eth-
ernet, SCSI, etc)
diff --git a/xorg-server/hw/xfree86/doc/Registry b/xorg-server/hw/xfree86/doc/Registry
index 48e24a2f4..ad5b9bffb 100644
--- a/xorg-server/hw/xfree86/doc/Registry
+++ b/xorg-server/hw/xfree86/doc/Registry
@@ -231,7 +231,6 @@ DDC B C Enable/disable DDC
DDC1 B C Enable/disable DDC1
DDC2 B C Enable/disable DDC2
DPMS O C Enable DPMS
-MTRR B C Enable/disable setting MTRRs
BaudRate I I Serial port baud rate
ButtonNumber I I Button number (for touch screen?)
diff --git a/xorg-server/hw/xfree86/drivers/Makefile.am b/xorg-server/hw/xfree86/drivers/Makefile.am
new file mode 100644
index 000000000..04d787f52
--- /dev/null
+++ b/xorg-server/hw/xfree86/drivers/Makefile.am
@@ -0,0 +1,5 @@
+SUBDIRS =
+
+if XORG_DRIVER_MODESETTING
+SUBDIRS += modesetting
+endif
diff --git a/xorg-server/hw/xfree86/drivers/modesetting/Makefile.am b/xorg-server/hw/xfree86/drivers/modesetting/Makefile.am
new file mode 100644
index 000000000..ca3279e23
--- /dev/null
+++ b/xorg-server/hw/xfree86/drivers/modesetting/Makefile.am
@@ -0,0 +1,61 @@
+# Copyright 2005 Adam Jackson.
+#
+# 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
+# on the rights to use, copy, modify, merge, publish, distribute, sub
+# license, 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 NON-INFRINGEMENT. IN NO EVENT SHALL
+# ADAM JACKSON 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.
+
+# this is obnoxious:
+# -module lets us name the module exactly how we want
+# -avoid-version prevents gratuitous .0.0.0 version numbers on the end
+# _ladir passes a dummy rpath to libtool so the thing will actually link
+# TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc.
+
+AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) $(LIBDRM_CFLAGS) $(UDEV_CFLAGS) $(CWARNFLAGS)
+
+AM_CPPFLAGS = \
+ $(XORG_INCS) \
+ -I$(srcdir)/../../ddc \
+ -I$(srcdir)/../../i2c \
+ -I$(srcdir)/../../modes \
+ -I$(srcdir)/../../parser \
+ -I$(srcdir)/../../ramdac \
+ $(NULL)
+
+modesetting_drv_la_LTLIBRARIES = modesetting_drv.la
+modesetting_drv_la_LDFLAGS = -module -avoid-version
+modesetting_drv_la_LIBADD = $(UDEV_LIBS) $(DRM_LIBS)
+modesetting_drv_ladir = @moduledir@/drivers
+
+modesetting_drv_la_SOURCES = \
+ driver.c \
+ driver.h \
+ drmmode_display.c \
+ drmmode_display.h
+
+drivermandir = $(DRIVER_MAN_DIR)
+driverman_PRE = modesetting.man
+driverman_DATA = $(driverman_PRE:man=@DRIVER_MAN_SUFFIX@)
+
+EXTRA_DIST = modesetting.man
+
+CLEANFILES = $(driverman_DATA)
+
+# String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure
+SUFFIXES = .$(DRIVER_MAN_SUFFIX) .man
+
+.man.$(DRIVER_MAN_SUFFIX):
+ $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
diff --git a/xorg-server/hw/xfree86/drivers/modesetting/driver.c b/xorg-server/hw/xfree86/drivers/modesetting/driver.c
new file mode 100644
index 000000000..adfb69c9f
--- /dev/null
+++ b/xorg-server/hw/xfree86/drivers/modesetting/driver.c
@@ -0,0 +1,1113 @@
+/*
+ * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * Copyright 2011 Dave Airlie
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, 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 NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS 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.
+ *
+ *
+ * Original Author: Alan Hourihane <alanh@tungstengraphics.com>
+ * Rewrite: Dave Airlie <airlied@redhat.com>
+ *
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include "dix-config.h"
+#endif
+
+#include <unistd.h>
+#include <fcntl.h>
+#include "xf86.h"
+#include "xf86_OSproc.h"
+#include "compiler.h"
+#include "xf86Pci.h"
+#include "mipointer.h"
+#include "micmap.h"
+#include <X11/extensions/randr.h>
+#include "fb.h"
+#include "edid.h"
+#include "xf86i2c.h"
+#include "xf86Crtc.h"
+#include "miscstruct.h"
+#include "dixstruct.h"
+#include "shadow.h"
+#include "xf86xv.h"
+#include <X11/extensions/Xv.h>
+#include <xorg-config.h>
+#ifdef XSERVER_PLATFORM_BUS
+#include "xf86platformBus.h"
+#endif
+#if XSERVER_LIBPCIACCESS
+#include <pciaccess.h>
+#endif
+
+#include "driver.h"
+
+static void AdjustFrame(ScrnInfoPtr pScrn, int x, int y);
+static Bool CloseScreen(ScreenPtr pScreen);
+static Bool EnterVT(ScrnInfoPtr pScrn);
+static void Identify(int flags);
+static const OptionInfoRec *AvailableOptions(int chipid, int busid);
+static ModeStatus ValidMode(ScrnInfoPtr pScrn, DisplayModePtr mode, Bool verbose,
+ int flags);
+static void FreeScreen(ScrnInfoPtr pScrn);
+static void LeaveVT(ScrnInfoPtr pScrn);
+static Bool SwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode);
+static Bool ScreenInit(ScreenPtr pScreen, int argc, char **argv);
+static Bool PreInit(ScrnInfoPtr pScrn, int flags);
+
+static Bool Probe(DriverPtr drv, int flags);
+static Bool ms_pci_probe(DriverPtr driver,
+ int entity_num, struct pci_device *device,
+ intptr_t match_data);
+static Bool ms_driver_func(ScrnInfoPtr scrn, xorgDriverFuncOp op,
+ void *data);
+
+#ifdef XSERVER_LIBPCIACCESS
+static const struct pci_id_match ms_device_match[] = {
+ {
+ PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY,
+ 0x00030000, 0x00ff0000, 0
+ },
+
+ { 0, 0, 0 },
+};
+#endif
+
+#ifdef XSERVER_PLATFORM_BUS
+static Bool ms_platform_probe(DriverPtr driver,
+ int entity_num, int flags, struct xf86_platform_device *device,
+ intptr_t match_data);
+#endif
+
+_X_EXPORT DriverRec modesetting = {
+ 1,
+ "modesetting",
+ Identify,
+ Probe,
+ AvailableOptions,
+ NULL,
+ 0,
+ ms_driver_func,
+ ms_device_match,
+ ms_pci_probe,
+#ifdef XSERVER_PLATFORM_BUS
+ ms_platform_probe,
+#endif
+};
+
+static SymTabRec Chipsets[] = {
+ {0, "kms" },
+ {-1, NULL}
+};
+
+typedef enum
+{
+ OPTION_SW_CURSOR,
+ OPTION_DEVICE_PATH,
+ OPTION_SHADOW_FB,
+} modesettingOpts;
+
+static const OptionInfoRec Options[] = {
+ {OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE},
+ {OPTION_DEVICE_PATH, "kmsdev", OPTV_STRING, {0}, FALSE },
+ {OPTION_SHADOW_FB, "ShadowFB", OPTV_BOOLEAN, {0}, FALSE },
+ {-1, NULL, OPTV_NONE, {0}, FALSE}
+};
+
+int modesettingEntityIndex = -1;
+
+static MODULESETUPPROTO(Setup);
+
+static XF86ModuleVersionInfo VersRec = {
+ "modesetting",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XORG_VERSION_CURRENT,
+ XORG_VERSION_MAJOR,
+ XORG_VERSION_MINOR,
+ XORG_VERSION_PATCH,
+ ABI_CLASS_VIDEODRV,
+ ABI_VIDEODRV_VERSION,
+ MOD_CLASS_VIDEODRV,
+ {0, 0, 0, 0}
+};
+
+_X_EXPORT XF86ModuleData modesettingModuleData = { &VersRec, Setup, NULL };
+
+static void *
+Setup(void * module, void * opts, int *errmaj, int *errmin)
+{
+ static Bool setupDone = 0;
+
+ /* This module should be loaded only once, but check to be sure.
+ */
+ if (!setupDone) {
+ setupDone = 1;
+ xf86AddDriver(&modesetting, module, HaveDriverFuncs);
+
+ /*
+ * The return value must be non-NULL on success even though there
+ * is no TearDownProc.
+ */
+ return (void *) 1;
+ } else {
+ if (errmaj)
+ *errmaj = LDR_ONCEONLY;
+ return NULL;
+ }
+}
+
+static void
+Identify(int flags)
+{
+ xf86PrintChipsets("modesetting", "Driver for Modesetting Kernel Drivers",
+ Chipsets);
+}
+
+static int open_hw(const char *dev)
+{
+ int fd;
+ if (dev)
+ fd = open(dev, O_RDWR, 0);
+ else {
+ dev = getenv("KMSDEVICE");
+ if ((NULL == dev) || ((fd = open(dev, O_RDWR, 0)) == -1)) {
+ dev = "/dev/dri/card0";
+ fd = open(dev,O_RDWR, 0);
+ }
+ }
+ if (fd == -1)
+ xf86DrvMsg(-1, X_ERROR,"open %s: %s\n", dev, strerror(errno));
+
+ return fd;
+}
+
+static int check_outputs(int fd)
+{
+ drmModeResPtr res = drmModeGetResources(fd);
+ int ret;
+
+ if (!res)
+ return FALSE;
+ ret = res->count_connectors > 0;
+ drmModeFreeResources(res);
+ return ret;
+}
+
+static Bool probe_hw(const char *dev, struct xf86_platform_device *platform_dev)
+{
+ int fd;
+
+#if XF86_PDEV_SERVER_FD
+ if (platform_dev && (platform_dev->flags & XF86_PDEV_SERVER_FD)) {
+ fd = xf86_platform_device_odev_attributes(platform_dev)->fd;
+ if (fd == -1)
+ return FALSE;
+ return check_outputs(fd);
+ }
+#endif
+
+ fd = open_hw(dev);
+ if (fd != -1) {
+ int ret = check_outputs(fd);
+ close(fd);
+ return ret;
+ }
+ return FALSE;
+}
+
+static char *
+ms_DRICreatePCIBusID(const struct pci_device *dev)
+{
+ char *busID;
+
+ if (asprintf(&busID, "pci:%04x:%02x:%02x.%d",
+ dev->domain, dev->bus, dev->dev, dev->func) == -1)
+ return NULL;
+
+ return busID;
+}
+
+
+static Bool probe_hw_pci(const char *dev, struct pci_device *pdev)
+{
+ int ret = FALSE, fd = open_hw(dev);
+ char *id, *devid;
+ drmSetVersion sv;
+
+ if (fd == -1)
+ return FALSE;
+
+ sv.drm_di_major = 1;
+ sv.drm_di_minor = 4;
+ sv.drm_dd_major = -1;
+ sv.drm_dd_minor = -1;
+ if (drmSetInterfaceVersion(fd, &sv)) {
+ close(fd);
+ return FALSE;
+ }
+
+
+ id = drmGetBusid(fd);
+ devid = ms_DRICreatePCIBusID(pdev);
+
+ if (id && devid && !strcmp(id, devid))
+ ret = check_outputs(fd);
+
+ close(fd);
+ free(id);
+ free(devid);
+ return ret;
+}
+static const OptionInfoRec *
+AvailableOptions(int chipid, int busid)
+{
+ return Options;
+}
+
+static Bool
+ms_driver_func(ScrnInfoPtr scrn, xorgDriverFuncOp op, void *data)
+{
+ xorgHWFlags *flag;
+
+ switch (op) {
+ case GET_REQUIRED_HW_INTERFACES:
+ flag = (CARD32 *)data;
+ (*flag) = 0;
+ return TRUE;
+ case SUPPORTS_SERVER_FDS:
+ return TRUE;
+ default:
+ return FALSE;
+ }
+}
+
+#if XSERVER_LIBPCIACCESS
+static Bool
+ms_pci_probe(DriverPtr driver,
+ int entity_num, struct pci_device *dev, intptr_t match_data)
+{
+ ScrnInfoPtr scrn = NULL;
+
+ scrn = xf86ConfigPciEntity(scrn, 0, entity_num, NULL,
+ NULL, NULL, NULL, NULL, NULL);
+ if (scrn) {
+ const char *devpath;
+ GDevPtr devSection = xf86GetDevFromEntity(scrn->entityList[0],
+ scrn->entityInstanceList[0]);
+
+ devpath = xf86FindOptionValue(devSection->options, "kmsdev");
+ if (probe_hw_pci(devpath, dev)) {
+ scrn->driverVersion = 1;
+ scrn->driverName = "modesetting";
+ scrn->name = "modeset";
+ scrn->Probe = NULL;
+ scrn->PreInit = PreInit;
+ scrn->ScreenInit = ScreenInit;
+ scrn->SwitchMode = SwitchMode;
+ scrn->AdjustFrame = AdjustFrame;
+ scrn->EnterVT = EnterVT;
+ scrn->LeaveVT = LeaveVT;
+ scrn->FreeScreen = FreeScreen;
+ scrn->ValidMode = ValidMode;
+
+ xf86DrvMsg(scrn->scrnIndex, X_CONFIG,
+ "claimed PCI slot %d@%d:%d:%d\n",
+ dev->bus, dev->domain, dev->dev, dev->func);
+ xf86DrvMsg(scrn->scrnIndex, X_INFO,
+ "using %s\n", devpath ? devpath : "default device");
+ } else
+ scrn = NULL;
+ }
+ return scrn != NULL;
+}
+#endif
+
+#ifdef XSERVER_PLATFORM_BUS
+static Bool
+ms_platform_probe(DriverPtr driver,
+ int entity_num, int flags, struct xf86_platform_device *dev, intptr_t match_data)
+{
+ ScrnInfoPtr scrn = NULL;
+ const char *path = xf86_platform_device_odev_attributes(dev)->path;
+ int scr_flags = 0;
+
+ if (flags & PLATFORM_PROBE_GPU_SCREEN)
+ scr_flags = XF86_ALLOCATE_GPU_SCREEN;
+
+ if (probe_hw(path, dev)) {
+ scrn = xf86AllocateScreen(driver, scr_flags);
+ xf86AddEntityToScreen(scrn, entity_num);
+
+ scrn->driverName = "modesetting";
+ scrn->name = "modesetting";
+ scrn->PreInit = PreInit;
+ scrn->ScreenInit = ScreenInit;
+ scrn->SwitchMode = SwitchMode;
+ scrn->AdjustFrame = AdjustFrame;
+ scrn->EnterVT = EnterVT;
+ scrn->LeaveVT = LeaveVT;
+ scrn->FreeScreen = FreeScreen;
+ scrn->ValidMode = ValidMode;
+ xf86DrvMsg(scrn->scrnIndex, X_INFO,
+ "using drv %s\n", path ? path : "default device");
+ }
+
+ return scrn != NULL;
+}
+#endif
+
+static Bool
+Probe(DriverPtr drv, int flags)
+{
+ int i, numDevSections;
+ GDevPtr *devSections;
+ Bool foundScreen = FALSE;
+ const char *dev;
+ ScrnInfoPtr scrn = NULL;
+
+ /* For now, just bail out for PROBE_DETECT. */
+ if (flags & PROBE_DETECT)
+ return FALSE;
+
+ /*
+ * Find the config file Device sections that match this
+ * driver, and return if there are none.
+ */
+ if ((numDevSections = xf86MatchDevice("modesetting", &devSections)) <= 0) {
+ return FALSE;
+ }
+
+ for (i = 0; i < numDevSections; i++) {
+
+ dev = xf86FindOptionValue(devSections[i]->options,"kmsdev");
+ if (probe_hw(dev, NULL)) {
+ int entity;
+ entity = xf86ClaimFbSlot(drv, 0, devSections[i], TRUE);
+ scrn = xf86ConfigFbEntity(scrn, 0, entity,
+ NULL, NULL, NULL, NULL);
+ }
+
+ if (scrn) {
+ foundScreen = TRUE;
+ scrn->driverVersion = 1;
+ scrn->driverName = "modesetting";
+ scrn->name = "modesetting";
+ scrn->Probe = Probe;
+ scrn->PreInit = PreInit;
+ scrn->ScreenInit = ScreenInit;
+ scrn->SwitchMode = SwitchMode;
+ scrn->AdjustFrame = AdjustFrame;
+ scrn->EnterVT = EnterVT;
+ scrn->LeaveVT = LeaveVT;
+ scrn->FreeScreen = FreeScreen;
+ scrn->ValidMode = ValidMode;
+
+ xf86DrvMsg(scrn->scrnIndex, X_INFO,
+ "using %s\n", dev ? dev : "default device");
+ }
+ }
+
+ free(devSections);
+
+ return foundScreen;
+}
+
+static Bool
+GetRec(ScrnInfoPtr pScrn)
+{
+ if (pScrn->driverPrivate)
+ return TRUE;
+
+ pScrn->driverPrivate = xnfcalloc(sizeof(modesettingRec), 1);
+
+ return TRUE;
+}
+
+static int dispatch_dirty_region(ScrnInfoPtr scrn,
+ PixmapPtr pixmap,
+ DamagePtr damage,
+ int fb_id)
+{
+ modesettingPtr ms = modesettingPTR(scrn);
+ RegionPtr dirty = DamageRegion(damage);
+ unsigned num_cliprects = REGION_NUM_RECTS(dirty);
+
+ if (num_cliprects) {
+ drmModeClip *clip = malloc(num_cliprects * sizeof(drmModeClip));
+ BoxPtr rect = REGION_RECTS(dirty);
+ int i, ret;
+
+ if (!clip)
+ return -ENOMEM;
+
+ /* XXX no need for copy? */
+ for (i = 0; i < num_cliprects; i++, rect++) {
+ clip[i].x1 = rect->x1;
+ clip[i].y1 = rect->y1;
+ clip[i].x2 = rect->x2;
+ clip[i].y2 = rect->y2;
+ }
+
+ /* TODO query connector property to see if this is needed */
+ ret = drmModeDirtyFB(ms->fd, fb_id, clip, num_cliprects);
+ free(clip);
+ DamageEmpty(damage);
+ if (ret) {
+ if (ret == -EINVAL)
+ return ret;
+ }
+ }
+ return 0;
+}
+
+static void dispatch_dirty(ScreenPtr pScreen)
+{
+ ScrnInfoPtr scrn = xf86ScreenToScrn(pScreen);
+ modesettingPtr ms = modesettingPTR(scrn);
+ PixmapPtr pixmap = pScreen->GetScreenPixmap(pScreen);
+ int fb_id = ms->drmmode.fb_id;
+ int ret;
+
+ ret = dispatch_dirty_region(scrn, pixmap, ms->damage, fb_id);
+ if (ret == -EINVAL || ret == -ENOSYS) {
+ ms->dirty_enabled = FALSE;
+ DamageUnregister(ms->damage);
+ DamageDestroy(ms->damage);
+ ms->damage = NULL;
+ xf86DrvMsg(scrn->scrnIndex, X_INFO, "Disabling kernel dirty updates, not required.\n");
+ return;
+ }
+}
+
+static void dispatch_dirty_crtc(ScrnInfoPtr scrn, xf86CrtcPtr crtc)
+{
+ modesettingPtr ms = modesettingPTR(scrn);
+ PixmapPtr pixmap = crtc->randr_crtc->scanout_pixmap;
+ msPixmapPrivPtr ppriv = msGetPixmapPriv(&ms->drmmode, pixmap);
+ drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+ DamagePtr damage = drmmode_crtc->slave_damage;
+ int fb_id = ppriv->fb_id;
+ int ret;
+
+ ret = dispatch_dirty_region(scrn, pixmap, damage, fb_id);
+ if (ret) {
+
+ }
+}
+
+static void dispatch_slave_dirty(ScreenPtr pScreen)
+{
+ ScrnInfoPtr scrn = xf86ScreenToScrn(pScreen);
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ int c;
+
+ for (c = 0; c < xf86_config->num_crtc; c++) {
+ xf86CrtcPtr crtc = xf86_config->crtc[c];
+
+ if (!crtc->randr_crtc)
+ continue;
+ if (!crtc->randr_crtc->scanout_pixmap)
+ continue;
+
+ dispatch_dirty_crtc(scrn, crtc);
+ }
+}
+
+static void msBlockHandler(ScreenPtr pScreen, void *pTimeout, void *pReadmask)
+{
+ modesettingPtr ms = modesettingPTR(xf86ScreenToScrn(pScreen));
+
+ pScreen->BlockHandler = ms->BlockHandler;
+ pScreen->BlockHandler(pScreen, pTimeout, pReadmask);
+ pScreen->BlockHandler = msBlockHandler;
+ if (pScreen->isGPU)
+ dispatch_slave_dirty(pScreen);
+ else if (ms->dirty_enabled)
+ dispatch_dirty(pScreen);
+}
+
+static void
+FreeRec(ScrnInfoPtr pScrn)
+{
+ modesettingPtr ms;
+
+ if (!pScrn)
+ return;
+
+ ms = modesettingPTR(pScrn);
+ if (!ms)
+ return;
+ pScrn->driverPrivate = NULL;
+
+ if (ms->fd > 0) {
+ int ret;
+
+ if (ms->pEnt->location.type == BUS_PCI)
+ ret = drmClose(ms->fd);
+ else
+#ifdef XF86_PDEV_SERVER_FD
+ if (!(ms->pEnt->location.type == BUS_PLATFORM &&
+ (ms->pEnt->location.id.plat->flags & XF86_PDEV_SERVER_FD)))
+#endif
+ ret = close(ms->fd);
+ (void) ret;
+ }
+ free(ms->Options);
+ free(ms);
+
+}
+
+#ifndef DRM_CAP_CURSOR_WIDTH
+#define DRM_CAP_CURSOR_WIDTH 0x8
+#endif
+
+#ifndef DRM_CAP_CURSOR_HEIGHT
+#define DRM_CAP_CURSOR_HEIGHT 0x9
+#endif
+
+static Bool
+PreInit(ScrnInfoPtr pScrn, int flags)
+{
+ modesettingPtr ms;
+ rgb defaultWeight = { 0, 0, 0 };
+ EntityInfoPtr pEnt;
+ EntPtr msEnt = NULL;
+ char *BusID = NULL;
+ const char *devicename;
+ Bool prefer_shadow = TRUE;
+ uint64_t value = 0;
+ int ret;
+ int bppflags;
+ int defaultdepth, defaultbpp;
+
+ if (pScrn->numEntities != 1)
+ return FALSE;
+
+ pEnt = xf86GetEntityInfo(pScrn->entityList[0]);
+
+ if (flags & PROBE_DETECT) {
+ return FALSE;
+ }
+
+ /* Allocate driverPrivate */
+ if (!GetRec(pScrn))
+ return FALSE;
+
+ ms = modesettingPTR(pScrn);
+ ms->SaveGeneration = -1;
+ ms->pEnt = pEnt;
+
+ pScrn->displayWidth = 640; /* default it */
+
+ /* Allocate an entity private if necessary */
+ if (xf86IsEntityShared(pScrn->entityList[0])) {
+ msEnt = xf86GetEntityPrivate(pScrn->entityList[0],
+ modesettingEntityIndex)->ptr;
+ ms->entityPrivate = msEnt;
+ } else
+ ms->entityPrivate = NULL;
+
+ if (xf86IsEntityShared(pScrn->entityList[0])) {
+ if (xf86IsPrimInitDone(pScrn->entityList[0])) {
+ /* do something */
+ } else {
+ xf86SetPrimInitDone(pScrn->entityList[0]);
+ }
+ }
+
+ pScrn->monitor = pScrn->confScreen->monitor;
+ pScrn->progClock = TRUE;
+ pScrn->rgbBits = 8;
+
+#if XSERVER_PLATFORM_BUS
+ if (pEnt->location.type == BUS_PLATFORM) {
+#ifdef XF86_PDEV_SERVER_FD
+ if (pEnt->location.id.plat->flags & XF86_PDEV_SERVER_FD)
+ ms->fd = xf86_platform_device_odev_attributes(pEnt->location.id.plat)->fd;
+ else
+#endif
+ {
+ char *path = xf86_platform_device_odev_attributes(pEnt->location.id.plat)->path;
+ ms->fd = open_hw(path);
+ }
+ }
+ else
+#endif
+ if (pEnt->location.type == BUS_PCI) {
+ ms->PciInfo = xf86GetPciInfoForEntity(ms->pEnt->index);
+ if (ms->PciInfo) {
+ BusID = malloc(64);
+ sprintf(BusID, "PCI:%d:%d:%d",
+#if XSERVER_LIBPCIACCESS
+ ((ms->PciInfo->domain << 8) | ms->PciInfo->bus),
+ ms->PciInfo->dev, ms->PciInfo->func
+#else
+ ((pciConfigPtr) ms->PciInfo->thisCard)->busnum,
+ ((pciConfigPtr) ms->PciInfo->thisCard)->devnum,
+ ((pciConfigPtr) ms->PciInfo->thisCard)->funcnum
+#endif
+ );
+ }
+ ms->fd = drmOpen(NULL, BusID);
+ } else {
+ devicename = xf86FindOptionValue(ms->pEnt->device->options, "kmsdev");
+ ms->fd = open_hw(devicename);
+ }
+ if (ms->fd < 0)
+ return FALSE;
+
+ ms->drmmode.fd = ms->fd;
+
+ pScrn->capabilities = 0;
+#ifdef DRM_CAP_PRIME
+ ret = drmGetCap(ms->fd, DRM_CAP_PRIME, &value);
+ if (ret == 0) {
+ if (value & DRM_PRIME_CAP_IMPORT)
+ pScrn->capabilities |= RR_Capability_SinkOutput;
+ }
+#endif
+ drmmode_get_default_bpp(pScrn, &ms->drmmode, &defaultdepth, &defaultbpp);
+ if (defaultdepth == 24 && defaultbpp == 24)
+ bppflags = SupportConvert32to24 | Support24bppFb;
+ else
+ bppflags = PreferConvert24to32 | SupportConvert24to32 | Support32bppFb;
+
+ if (!xf86SetDepthBpp
+ (pScrn, defaultdepth, defaultdepth, defaultbpp, bppflags))
+ return FALSE;
+
+ switch (pScrn->depth) {
+ case 15:
+ case 16:
+ case 24:
+ break;
+ default:
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Given depth (%d) is not supported by the driver\n",
+ pScrn->depth);
+ return FALSE;
+ }
+ xf86PrintDepthBpp(pScrn);
+
+ /* Process the options */
+ xf86CollectOptions(pScrn, NULL);
+ if (!(ms->Options = malloc(sizeof(Options))))
+ return FALSE;
+ memcpy(ms->Options, Options, sizeof(Options));
+ xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, ms->Options);
+
+ if (!xf86SetWeight(pScrn, defaultWeight, defaultWeight))
+ return FALSE;
+ if (!xf86SetDefaultVisual(pScrn, -1))
+ return FALSE;
+
+ if (xf86ReturnOptValBool(ms->Options, OPTION_SW_CURSOR, FALSE)) {
+ ms->drmmode.sw_cursor = TRUE;
+ }
+
+ ret = drmGetCap(ms->fd, DRM_CAP_DUMB_PREFER_SHADOW, &value);
+ if (!ret) {
+ prefer_shadow = !!value;
+ }
+
+ ms->cursor_width = 64;
+ ms->cursor_height = 64;
+ ret = drmGetCap(ms->fd, DRM_CAP_CURSOR_WIDTH, &value);
+ if (!ret) {
+ ms->cursor_width = value;
+ }
+ ret = drmGetCap(ms->fd, DRM_CAP_CURSOR_HEIGHT, &value);
+ if (!ret) {
+ ms->cursor_height = value;
+ }
+
+ ms->drmmode.shadow_enable = xf86ReturnOptValBool(ms->Options, OPTION_SHADOW_FB, prefer_shadow);
+
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ShadowFB: preferred %s, enabled %s\n", prefer_shadow ? "YES" : "NO", ms->drmmode.shadow_enable ? "YES" : "NO");
+ if (drmmode_pre_init(pScrn, &ms->drmmode, pScrn->bitsPerPixel / 8) == FALSE) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "KMS setup failed\n");
+ goto fail;
+ }
+
+ /*
+ * If the driver can do gamma correction, it should call xf86SetGamma() here.
+ */
+ {
+ Gamma zeros = { 0.0, 0.0, 0.0 };
+
+ if (!xf86SetGamma(pScrn, zeros)) {
+ return FALSE;
+ }
+ }
+
+ if (pScrn->modes == NULL) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No modes.\n");
+ return FALSE;
+ }
+
+ pScrn->currentMode = pScrn->modes;
+
+ /* Set display resolution */
+ xf86SetDpi(pScrn, 0, 0);
+
+ /* Load the required sub modules */
+ if (!xf86LoadSubModule(pScrn, "fb")) {
+ return FALSE;
+ }
+
+ if (ms->drmmode.shadow_enable) {
+ if (!xf86LoadSubModule(pScrn, "shadow")) {
+ return FALSE;
+ }
+ }
+
+ return TRUE;
+ fail:
+ return FALSE;
+}
+
+static void *
+msShadowWindow(ScreenPtr screen, CARD32 row, CARD32 offset, int mode,
+ CARD32 *size, void *closure)
+{
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(screen);
+ modesettingPtr ms = modesettingPTR(pScrn);
+ int stride;
+
+ stride = (pScrn->displayWidth * pScrn->bitsPerPixel) / 8;
+ *size = stride;
+
+ return ((uint8_t *)ms->drmmode.front_bo->ptr + row * stride + offset);
+}
+
+static void
+msUpdatePacked(ScreenPtr pScreen, shadowBufPtr pBuf)
+{
+ shadowUpdatePacked(pScreen, pBuf);
+}
+
+static Bool
+CreateScreenResources(ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
+ modesettingPtr ms = modesettingPTR(pScrn);
+ PixmapPtr rootPixmap;
+ Bool ret;
+ void *pixels;
+ pScreen->CreateScreenResources = ms->createScreenResources;
+ ret = pScreen->CreateScreenResources(pScreen);
+ pScreen->CreateScreenResources = CreateScreenResources;
+
+ if (!drmmode_set_desired_modes(pScrn, &ms->drmmode))
+ return FALSE;
+
+ drmmode_uevent_init(pScrn, &ms->drmmode);
+
+ if (!ms->drmmode.sw_cursor)
+ drmmode_map_cursor_bos(pScrn, &ms->drmmode);
+ pixels = drmmode_map_front_bo(&ms->drmmode);
+ if (!pixels)
+ return FALSE;
+
+ rootPixmap = pScreen->GetScreenPixmap(pScreen);
+
+ if (ms->drmmode.shadow_enable)
+ pixels = ms->drmmode.shadow_fb;
+
+ if (!pScreen->ModifyPixmapHeader(rootPixmap, -1, -1, -1, -1, -1, pixels))
+ FatalError("Couldn't adjust screen pixmap\n");
+
+ if (ms->drmmode.shadow_enable) {
+ if (!shadowAdd(pScreen, rootPixmap, msUpdatePacked,
+ msShadowWindow, 0, 0))
+ return FALSE;
+ }
+
+ ms->damage = DamageCreate(NULL, NULL, DamageReportNone, TRUE,
+ pScreen, rootPixmap);
+
+ if (ms->damage) {
+ DamageRegister(&rootPixmap->drawable, ms->damage);
+ ms->dirty_enabled = TRUE;
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Damage tracking initialized\n");
+ } else {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Failed to create screen damage record\n");
+ return FALSE;
+ }
+ return ret;
+}
+
+static Bool
+msShadowInit(ScreenPtr pScreen)
+{
+ if (!shadowSetup(pScreen)) {
+ return FALSE;
+ }
+ return TRUE;
+}
+
+static Bool
+msSetSharedPixmapBacking(PixmapPtr ppix, void *fd_handle)
+{
+ ScreenPtr screen = ppix->drawable.pScreen;
+ ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
+ modesettingPtr ms = modesettingPTR(scrn);
+ Bool ret;
+ int size = ppix->devKind * ppix->drawable.height;
+ int ihandle = (int)(long)fd_handle;
+
+ ret = drmmode_SetSlaveBO(ppix, &ms->drmmode, ihandle, ppix->devKind, size);
+ if (ret == FALSE)
+ return ret;
+
+ return TRUE;
+}
+
+static Bool
+SetMaster(ScrnInfoPtr pScrn)
+{
+ modesettingPtr ms = modesettingPTR(pScrn);
+ int ret;
+
+#ifdef XF86_PDEV_SERVER_FD
+ if (ms->pEnt->location.type == BUS_PLATFORM &&
+ (ms->pEnt->location.id.plat->flags & XF86_PDEV_SERVER_FD))
+ return TRUE;
+#endif
+
+ ret = drmSetMaster(ms->fd);
+ if (ret)
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "drmSetMaster failed: %s\n",
+ strerror(errno));
+
+ return ret == 0;
+}
+
+static Bool
+ScreenInit(ScreenPtr pScreen, int argc, char **argv)
+{
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
+ modesettingPtr ms = modesettingPTR(pScrn);
+ VisualPtr visual;
+
+ pScrn->pScreen = pScreen;
+
+ if (!SetMaster(pScrn))
+ return FALSE;
+
+ /* HW dependent - FIXME */
+ pScrn->displayWidth = pScrn->virtualX;
+ if (!drmmode_create_initial_bos(pScrn, &ms->drmmode))
+ return FALSE;
+
+ if (ms->drmmode.shadow_enable) {
+ ms->drmmode.shadow_fb = calloc(1, pScrn->displayWidth * pScrn->virtualY *
+ ((pScrn->bitsPerPixel + 7) >> 3));
+ if (!ms->drmmode.shadow_fb)
+ ms->drmmode.shadow_enable = FALSE;
+ }
+
+ miClearVisualTypes();
+
+ if (!miSetVisualTypes(pScrn->depth,
+ miGetDefaultVisualMask(pScrn->depth),
+ pScrn->rgbBits, pScrn->defaultVisual))
+ return FALSE;
+
+ if (!miSetPixmapDepths())
+ return FALSE;
+
+ if (!dixRegisterScreenSpecificPrivateKey(pScreen, &ms->drmmode.pixmapPrivateKeyRec,
+ PRIVATE_PIXMAP, sizeof(msPixmapPrivRec))) {
+ return FALSE;
+ }
+
+ pScrn->memPhysBase = 0;
+ pScrn->fbOffset = 0;
+
+ if (!fbScreenInit(pScreen, NULL,
+ pScrn->virtualX, pScrn->virtualY,
+ pScrn->xDpi, pScrn->yDpi,
+ pScrn->displayWidth, pScrn->bitsPerPixel))
+ return FALSE;
+
+ if (pScrn->bitsPerPixel > 8) {
+ /* Fixup RGB ordering */
+ visual = pScreen->visuals + pScreen->numVisuals;
+ while (--visual >= pScreen->visuals) {
+ if ((visual->class | DynamicClass) == DirectColor) {
+ visual->offsetRed = pScrn->offset.red;
+ visual->offsetGreen = pScrn->offset.green;
+ visual->offsetBlue = pScrn->offset.blue;
+ visual->redMask = pScrn->mask.red;
+ visual->greenMask = pScrn->mask.green;
+ visual->blueMask = pScrn->mask.blue;
+ }
+ }
+ }
+
+ fbPictureInit(pScreen, NULL, 0);
+
+ if (ms->drmmode.shadow_enable && !msShadowInit(pScreen)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "shadow fb init failed\n");
+ return FALSE;
+ }
+
+ ms->createScreenResources = pScreen->CreateScreenResources;
+ pScreen->CreateScreenResources = CreateScreenResources;
+
+ xf86SetBlackWhitePixels(pScreen);
+
+ xf86SetBackingStore(pScreen);
+ xf86SetSilkenMouse(pScreen);
+ miDCInitialize(pScreen, xf86GetPointerScreenFuncs());
+
+ /* Need to extend HWcursor support to handle mask interleave */
+ if (!ms->drmmode.sw_cursor)
+ xf86_cursors_init(pScreen, ms->cursor_width, ms->cursor_height,
+ HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64 |
+ HARDWARE_CURSOR_ARGB);
+
+ /* Must force it before EnterVT, so we are in control of VT and
+ * later memory should be bound when allocating, e.g rotate_mem */
+ pScrn->vtSema = TRUE;
+
+ pScreen->SaveScreen = xf86SaveScreen;
+ ms->CloseScreen = pScreen->CloseScreen;
+ pScreen->CloseScreen = CloseScreen;
+
+ ms->BlockHandler = pScreen->BlockHandler;
+ pScreen->BlockHandler = msBlockHandler;
+
+ pScreen->SetSharedPixmapBacking = msSetSharedPixmapBacking;
+
+ if (!xf86CrtcScreenInit(pScreen))
+ return FALSE;
+
+ if (!miCreateDefColormap(pScreen))
+ return FALSE;
+
+ xf86DPMSInit(pScreen, xf86DPMSSet, 0);
+
+ if (serverGeneration == 1)
+ xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options);
+
+ return EnterVT(pScrn);
+}
+
+static void
+AdjustFrame(ScrnInfoPtr pScrn, int x, int y)
+{
+ modesettingPtr ms = modesettingPTR(pScrn);
+
+ drmmode_adjust_frame(pScrn, &ms->drmmode, x, y);
+}
+
+static void
+FreeScreen(ScrnInfoPtr pScrn)
+{
+ FreeRec(pScrn);
+}
+
+static void
+LeaveVT(ScrnInfoPtr pScrn)
+{
+ modesettingPtr ms = modesettingPTR(pScrn);
+ xf86_hide_cursors(pScrn);
+
+ pScrn->vtSema = FALSE;
+
+#ifdef XF86_PDEV_SERVER_FD
+ if (ms->pEnt->location.type == BUS_PLATFORM &&
+ (ms->pEnt->location.id.plat->flags & XF86_PDEV_SERVER_FD))
+ return;
+#endif
+
+ drmDropMaster(ms->fd);
+}
+
+/*
+ * This gets called when gaining control of the VT, and from ScreenInit().
+ */
+static Bool
+EnterVT(ScrnInfoPtr pScrn)
+{
+ modesettingPtr ms = modesettingPTR(pScrn);
+
+ pScrn->vtSema = TRUE;
+
+ SetMaster(pScrn);
+
+ if (!drmmode_set_desired_modes(pScrn, &ms->drmmode))
+ return FALSE;
+
+ return TRUE;
+}
+
+static Bool
+SwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode)
+{
+ return xf86SetSingleMode(pScrn, mode, RR_Rotate_0);
+}
+
+static Bool
+CloseScreen(ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
+ modesettingPtr ms = modesettingPTR(pScrn);
+
+ if (ms->damage) {
+ DamageUnregister(ms->damage);
+ DamageDestroy(ms->damage);
+ ms->damage = NULL;
+ }
+
+ if (ms->drmmode.shadow_enable) {
+ shadowRemove(pScreen, pScreen->GetScreenPixmap(pScreen));
+ free(ms->drmmode.shadow_fb);
+ ms->drmmode.shadow_fb = NULL;
+ }
+ drmmode_uevent_fini(pScrn, &ms->drmmode);
+
+ drmmode_free_bos(pScrn, &ms->drmmode);
+
+ if (pScrn->vtSema) {
+ LeaveVT(pScrn);
+ }
+
+ pScreen->CreateScreenResources = ms->createScreenResources;
+ pScreen->BlockHandler = ms->BlockHandler;
+
+ pScrn->vtSema = FALSE;
+ pScreen->CloseScreen = ms->CloseScreen;
+ return (*pScreen->CloseScreen) (pScreen);
+}
+
+static ModeStatus
+ValidMode(ScrnInfoPtr arg, DisplayModePtr mode, Bool verbose, int flags)
+{
+ return MODE_OK;
+}
diff --git a/xorg-server/hw/xfree86/drivers/modesetting/driver.h b/xorg-server/hw/xfree86/drivers/modesetting/driver.h
new file mode 100644
index 000000000..450b29c2b
--- /dev/null
+++ b/xorg-server/hw/xfree86/drivers/modesetting/driver.h
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, 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 NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS 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.
+ *
+ *
+ * Author: Alan Hourihane <alanh@tungstengraphics.com>
+ *
+ */
+
+#include <errno.h>
+#include <drm.h>
+#include <xf86drm.h>
+#include <damage.h>
+
+#include "drmmode_display.h"
+#define DRV_ERROR(msg) xf86DrvMsg(pScrn->scrnIndex, X_ERROR, msg);
+
+typedef struct
+{
+ int lastInstance;
+ int refCount;
+ ScrnInfoPtr pScrn_1;
+ ScrnInfoPtr pScrn_2;
+} EntRec, *EntPtr;
+
+typedef struct _modesettingRec
+{
+ int fd;
+
+ EntPtr entityPrivate;
+
+ int Chipset;
+ EntityInfoPtr pEnt;
+#if XSERVER_LIBPCIACCESS
+ struct pci_device *PciInfo;
+#else
+ pciVideoPtr PciInfo;
+ PCITAG PciTag;
+#endif
+
+ Bool noAccel;
+ CloseScreenProcPtr CloseScreen;
+
+ /* Broken-out options. */
+ OptionInfoPtr Options;
+
+ unsigned int SaveGeneration;
+
+ CreateScreenResourcesProcPtr createScreenResources;
+ ScreenBlockHandlerProcPtr BlockHandler;
+ void *driver;
+
+ drmmode_rec drmmode;
+
+ DamagePtr damage;
+ Bool dirty_enabled;
+
+ uint32_t cursor_width, cursor_height;
+} modesettingRec, *modesettingPtr;
+
+#define modesettingPTR(p) ((modesettingPtr)((p)->driverPrivate))
diff --git a/xorg-server/hw/xfree86/drivers/modesetting/drmmode_display.c b/xorg-server/hw/xfree86/drivers/modesetting/drmmode_display.c
new file mode 100644
index 000000000..9723ccd0e
--- /dev/null
+++ b/xorg-server/hw/xfree86/drivers/modesetting/drmmode_display.c
@@ -0,0 +1,1616 @@
+/*
+ * Copyright © 2007 Red Hat, Inc.
+ *
+ * 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:
+ * Dave Airlie <airlied@redhat.com>
+ *
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include "dix-config.h"
+#endif
+
+#include <errno.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+#include <unistd.h>
+#include "xf86str.h"
+#include "X11/Xatom.h"
+#include "micmap.h"
+#include "xf86cmap.h"
+#include "xf86DDC.h"
+
+#include <xf86drm.h>
+#include "xf86Crtc.h"
+#include "drmmode_display.h"
+
+#include <cursorstr.h>
+
+#include <X11/extensions/dpmsconst.h>
+
+#include "driver.h"
+
+static struct dumb_bo *dumb_bo_create(int fd,
+ const unsigned width, const unsigned height,
+ const unsigned bpp)
+{
+ struct drm_mode_create_dumb arg;
+ struct dumb_bo *bo;
+ int ret;
+
+ bo = calloc(1, sizeof(*bo));
+ if (!bo)
+ return NULL;
+
+ memset(&arg, 0, sizeof(arg));
+ arg.width = width;
+ arg.height = height;
+ arg.bpp = bpp;
+
+ ret = drmIoctl(fd, DRM_IOCTL_MODE_CREATE_DUMB, &arg);
+ if (ret)
+ goto err_free;
+
+ bo->handle = arg.handle;
+ bo->size = arg.size;
+ bo->pitch = arg.pitch;
+
+ return bo;
+ err_free:
+ free(bo);
+ return NULL;
+}
+
+static int dumb_bo_map(int fd, struct dumb_bo *bo)
+{
+ struct drm_mode_map_dumb arg;
+ int ret;
+ void *map;
+
+ if (bo->ptr) {
+ bo->map_count++;
+ return 0;
+ }
+
+ memset(&arg, 0, sizeof(arg));
+ arg.handle = bo->handle;
+
+ ret = drmIoctl(fd, DRM_IOCTL_MODE_MAP_DUMB, &arg);
+ if (ret)
+ return ret;
+
+ map = mmap(0, bo->size, PROT_READ | PROT_WRITE, MAP_SHARED,
+ fd, arg.offset);
+ if (map == MAP_FAILED)
+ return -errno;
+
+ bo->ptr = map;
+ return 0;
+}
+
+#if 0
+static int dumb_bo_unmap(int fd, struct dumb_bo *bo)
+{
+ bo->map_count--;
+ return 0;
+}
+#endif
+
+static int dumb_bo_destroy(int fd, struct dumb_bo *bo)
+{
+ struct drm_mode_destroy_dumb arg;
+ int ret;
+
+ if (bo->ptr) {
+ munmap(bo->ptr, bo->size);
+ bo->ptr = NULL;
+ }
+
+ memset(&arg, 0, sizeof(arg));
+ arg.handle = bo->handle;
+ ret = drmIoctl(fd, DRM_IOCTL_MODE_DESTROY_DUMB, &arg);
+ if (ret)
+ return -errno;
+
+ free(bo);
+ return 0;
+}
+
+static struct dumb_bo *dumb_get_bo_from_handle(int fd, int handle, int pitch, int size)
+{
+ struct dumb_bo *bo;
+ int ret;
+
+ bo = calloc(1, sizeof(*bo));
+ if (!bo)
+ return NULL;
+
+ ret = drmPrimeFDToHandle(fd, handle, &bo->handle);
+ if (ret) {
+ free(bo);
+ return NULL;
+ }
+ bo->pitch = pitch;
+ bo->size = size;
+ return bo;
+}
+
+Bool drmmode_SetSlaveBO(PixmapPtr ppix,
+ drmmode_ptr drmmode,
+ int fd_handle, int pitch, int size)
+{
+ msPixmapPrivPtr ppriv = msGetPixmapPriv(drmmode, ppix);
+
+ ppriv->backing_bo = dumb_get_bo_from_handle(drmmode->fd, fd_handle, pitch, size);
+ if (!ppriv->backing_bo)
+ return FALSE;
+
+ close(fd_handle);
+ return TRUE;
+}
+
+static void
+drmmode_ConvertFromKMode(ScrnInfoPtr scrn,
+ drmModeModeInfo *kmode,
+ DisplayModePtr mode)
+{
+ memset(mode, 0, sizeof(DisplayModeRec));
+ mode->status = MODE_OK;
+
+ mode->Clock = kmode->clock;
+
+ mode->HDisplay = kmode->hdisplay;
+ mode->HSyncStart = kmode->hsync_start;
+ mode->HSyncEnd = kmode->hsync_end;
+ mode->HTotal = kmode->htotal;
+ mode->HSkew = kmode->hskew;
+
+ mode->VDisplay = kmode->vdisplay;
+ mode->VSyncStart = kmode->vsync_start;
+ mode->VSyncEnd = kmode->vsync_end;
+ mode->VTotal = kmode->vtotal;
+ mode->VScan = kmode->vscan;
+
+ mode->Flags = kmode->flags; //& FLAG_BITS;
+ mode->name = strdup(kmode->name);
+
+ if (kmode->type & DRM_MODE_TYPE_DRIVER)
+ mode->type = M_T_DRIVER;
+ if (kmode->type & DRM_MODE_TYPE_PREFERRED)
+ mode->type |= M_T_PREFERRED;
+ xf86SetModeCrtc (mode, scrn->adjustFlags);
+}
+
+static void
+drmmode_ConvertToKMode(ScrnInfoPtr scrn,
+ drmModeModeInfo *kmode,
+ DisplayModePtr mode)
+{
+ memset(kmode, 0, sizeof(*kmode));
+
+ kmode->clock = mode->Clock;
+ kmode->hdisplay = mode->HDisplay;
+ kmode->hsync_start = mode->HSyncStart;
+ kmode->hsync_end = mode->HSyncEnd;
+ kmode->htotal = mode->HTotal;
+ kmode->hskew = mode->HSkew;
+
+ kmode->vdisplay = mode->VDisplay;
+ kmode->vsync_start = mode->VSyncStart;
+ kmode->vsync_end = mode->VSyncEnd;
+ kmode->vtotal = mode->VTotal;
+ kmode->vscan = mode->VScan;
+
+ kmode->flags = mode->Flags; //& FLAG_BITS;
+ if (mode->name)
+ strncpy(kmode->name, mode->name, DRM_DISPLAY_MODE_LEN);
+ kmode->name[DRM_DISPLAY_MODE_LEN-1] = 0;
+
+}
+
+static void
+drmmode_crtc_dpms(xf86CrtcPtr crtc, int mode)
+{
+#if 0
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(crtc->scrn);
+// drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+// drmmode_ptr drmmode = drmmode_crtc->drmmode;
+
+ /* bonghits in the randr 1.2 - uses dpms to disable crtc - bad buzz */
+ if (mode == DPMSModeOff) {
+// drmModeSetCrtc(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id,
+// 0, 0, 0, NULL, 0, NULL);
+ }
+#endif
+}
+
+#if 0
+static PixmapPtr
+create_pixmap_for_fbcon(drmmode_ptr drmmode,
+ ScrnInfoPtr pScrn, int crtc_id)
+{
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ drmmode_crtc_private_ptr drmmode_crtc;
+ ScreenPtr pScreen = pScrn->pScreen;
+ PixmapPtr pixmap;
+ struct radeon_bo *bo;
+ drmModeFBPtr fbcon;
+ struct drm_gem_flink flink;
+
+ drmmode_crtc = xf86_config->crtc[crtc_id]->driver_private;
+
+ fbcon = drmModeGetFB(drmmode->fd, drmmode_crtc->mode_crtc->buffer_id);
+ if (fbcon == NULL)
+ return NULL;
+
+ flink.handle = fbcon->handle;
+ if (ioctl(drmmode->fd, DRM_IOCTL_GEM_FLINK, &flink) < 0) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Couldn't flink fbcon handle\n");
+ return NULL;
+ }
+
+ bo = radeon_bo_open(drmmode->bufmgr, flink.name, 0, 0, 0, 0);
+ if (bo == NULL) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Couldn't allocate bo for fbcon handle\n");
+ return NULL;
+ }
+
+ pixmap = drmmode_create_bo_pixmap(pScreen, fbcon->width, fbcon->height,
+ fbcon->depth, fbcon->bpp,
+ fbcon->pitch, bo);
+ if (!pixmap)
+ return NULL;
+
+ radeon_bo_unref(bo);
+ drmModeFreeFB(fbcon);
+ return pixmap;
+}
+
+#endif
+
+static Bool
+drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
+ Rotation rotation, int x, int y)
+{
+ ScrnInfoPtr pScrn = crtc->scrn;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(crtc->scrn);
+ drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+ drmmode_ptr drmmode = drmmode_crtc->drmmode;
+ int saved_x, saved_y;
+ Rotation saved_rotation;
+ DisplayModeRec saved_mode;
+ uint32_t *output_ids;
+ int output_count = 0;
+ Bool ret = TRUE;
+ int i;
+ uint32_t fb_id;
+ drmModeModeInfo kmode;
+ int height;
+
+ height = pScrn->virtualY;
+
+ if (drmmode->fb_id == 0) {
+ ret = drmModeAddFB(drmmode->fd,
+ pScrn->virtualX, height,
+ pScrn->depth, pScrn->bitsPerPixel,
+ drmmode->front_bo->pitch,
+ drmmode->front_bo->handle,
+ &drmmode->fb_id);
+ if (ret < 0) {
+ ErrorF("failed to add fb %d\n", ret);
+ return FALSE;
+ }
+ }
+
+ saved_mode = crtc->mode;
+ saved_x = crtc->x;
+ saved_y = crtc->y;
+ saved_rotation = crtc->rotation;
+
+ if (mode) {
+ crtc->mode = *mode;
+ crtc->x = x;
+ crtc->y = y;
+ crtc->rotation = rotation;
+ crtc->transformPresent = FALSE;
+ }
+
+ output_ids = calloc(sizeof(uint32_t), xf86_config->num_output);
+ if (!output_ids) {
+ ret = FALSE;
+ goto done;
+ }
+
+ if (mode) {
+ for (i = 0; i < xf86_config->num_output; i++) {
+ xf86OutputPtr output = xf86_config->output[i];
+ drmmode_output_private_ptr drmmode_output;
+
+ if (output->crtc != crtc)
+ continue;
+
+ drmmode_output = output->driver_private;
+ output_ids[output_count] = drmmode_output->mode_output->connector_id;
+ output_count++;
+ }
+
+ if (!xf86CrtcRotate(crtc)) {
+ goto done;
+ }
+ crtc->funcs->gamma_set(crtc, crtc->gamma_red, crtc->gamma_green,
+ crtc->gamma_blue, crtc->gamma_size);
+
+ drmmode_ConvertToKMode(crtc->scrn, &kmode, mode);
+
+ fb_id = drmmode->fb_id;
+ if (crtc->randr_crtc->scanout_pixmap) {
+ msPixmapPrivPtr ppriv = msGetPixmapPriv(drmmode, crtc->randr_crtc->scanout_pixmap);
+ fb_id = ppriv->fb_id;
+ x = y = 0;
+ } else if (drmmode_crtc->rotate_fb_id) {
+ fb_id = drmmode_crtc->rotate_fb_id;
+ x = y = 0;
+ }
+ ret = drmModeSetCrtc(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id,
+ fb_id, x, y, output_ids, output_count, &kmode);
+ if (ret)
+ xf86DrvMsg(crtc->scrn->scrnIndex, X_ERROR,
+ "failed to set mode: %s", strerror(-ret));
+ else
+ ret = TRUE;
+
+ if (crtc->scrn->pScreen)
+ xf86CrtcSetScreenSubpixelOrder(crtc->scrn->pScreen);
+ /* go through all the outputs and force DPMS them back on? */
+ for (i = 0; i < xf86_config->num_output; i++) {
+ xf86OutputPtr output = xf86_config->output[i];
+
+ if (output->crtc != crtc)
+ continue;
+
+ output->funcs->dpms(output, DPMSModeOn);
+ }
+ }
+
+#if 0
+ if (pScrn->pScreen &&
+ !xf86ReturnOptValBool(info->Options, OPTION_SW_CURSOR, FALSE))
+ xf86_reload_cursors(pScrn->pScreen);
+#endif
+done:
+ if (!ret) {
+ crtc->x = saved_x;
+ crtc->y = saved_y;
+ crtc->rotation = saved_rotation;
+ crtc->mode = saved_mode;
+ }
+#if defined(XF86_CRTC_VERSION) && XF86_CRTC_VERSION >= 3
+ else
+ crtc->active = TRUE;
+#endif
+
+ return ret;
+}
+
+static void
+drmmode_set_cursor_colors (xf86CrtcPtr crtc, int bg, int fg)
+{
+
+}
+
+static void
+drmmode_set_cursor_position (xf86CrtcPtr crtc, int x, int y)
+{
+ drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+ drmmode_ptr drmmode = drmmode_crtc->drmmode;
+
+ drmModeMoveCursor(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id, x, y);
+}
+
+static void
+drmmode_load_cursor_argb (xf86CrtcPtr crtc, CARD32 *image)
+{
+ modesettingPtr ms = modesettingPTR(crtc->scrn);
+ drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+ int i;
+ uint32_t *ptr;
+ uint32_t handle = drmmode_crtc->cursor_bo->handle;
+ int ret;
+ /* cursor should be mapped already */
+ ptr = (uint32_t *)(drmmode_crtc->cursor_bo->ptr);
+
+ for (i = 0; i < ms->cursor_width * ms->cursor_height; i++)
+ ptr[i] = image[i];// cpu_to_le32(image[i]);
+
+ ret = drmModeSetCursor(drmmode_crtc->drmmode->fd, drmmode_crtc->mode_crtc->crtc_id, handle,
+ ms->cursor_width, ms->cursor_height);
+ if (ret) {
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(crtc->scrn);
+ xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
+
+ cursor_info->MaxWidth = cursor_info->MaxHeight = 0;
+ drmmode_crtc->drmmode->sw_cursor = TRUE;
+ /* fallback to swcursor */
+ }
+}
+
+
+static void
+drmmode_hide_cursor (xf86CrtcPtr crtc)
+{
+ modesettingPtr ms = modesettingPTR(crtc->scrn);
+ drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+ drmmode_ptr drmmode = drmmode_crtc->drmmode;
+
+ drmModeSetCursor(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id, 0,
+ ms->cursor_width, ms->cursor_height);
+
+}
+
+static void
+drmmode_show_cursor (xf86CrtcPtr crtc)
+{
+ modesettingPtr ms = modesettingPTR(crtc->scrn);
+ drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+ drmmode_ptr drmmode = drmmode_crtc->drmmode;
+ uint32_t handle = drmmode_crtc->cursor_bo->handle;
+ static Bool use_set_cursor2 = TRUE;
+
+ if (use_set_cursor2) {
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(crtc->scrn);
+ CursorPtr cursor = xf86_config->cursor;
+ int ret;
+ ret = drmModeSetCursor2(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id, handle, ms->cursor_width, ms->cursor_height, cursor->bits->xhot, cursor->bits->yhot);
+ if (ret == -EINVAL)
+ use_set_cursor2 = FALSE;
+ else
+ return;
+ }
+
+ drmModeSetCursor(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id, handle,
+ ms->cursor_width, ms->cursor_height);
+}
+
+static void
+drmmode_crtc_gamma_set(xf86CrtcPtr crtc, uint16_t *red, uint16_t *green,
+ uint16_t *blue, int size)
+{
+ drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+ drmmode_ptr drmmode = drmmode_crtc->drmmode;
+
+ drmModeCrtcSetGamma(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id,
+ size, red, green, blue);
+}
+
+static Bool
+drmmode_set_scanout_pixmap(xf86CrtcPtr crtc, PixmapPtr ppix)
+{
+ drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+ drmmode_ptr drmmode = drmmode_crtc->drmmode;
+ msPixmapPrivPtr ppriv;
+ void *ptr;
+
+ if (!ppix) {
+ if (crtc->randr_crtc->scanout_pixmap) {
+ ppriv = msGetPixmapPriv(drmmode, crtc->randr_crtc->scanout_pixmap);
+ drmModeRmFB(drmmode->fd, ppriv->fb_id);
+ }
+ if (drmmode_crtc->slave_damage) {
+ DamageUnregister(drmmode_crtc->slave_damage);
+ drmmode_crtc->slave_damage = NULL;
+ }
+ return TRUE;
+ }
+
+ ppriv = msGetPixmapPriv(drmmode, ppix);
+ if (!drmmode_crtc->slave_damage) {
+ drmmode_crtc->slave_damage = DamageCreate(NULL, NULL,
+ DamageReportNone,
+ TRUE,
+ crtc->randr_crtc->pScreen,
+ NULL);
+ }
+ ptr = drmmode_map_slave_bo(drmmode, ppriv);
+ ppix->devPrivate.ptr = ptr;
+ DamageRegister(&ppix->drawable, drmmode_crtc->slave_damage);
+
+ if (ppriv->fb_id == 0) {
+ drmModeAddFB(drmmode->fd, ppix->drawable.width,
+ ppix->drawable.height,
+ ppix->drawable.depth,
+ ppix->drawable.bitsPerPixel,
+ ppix->devKind,
+ ppriv->backing_bo->handle,
+ &ppriv->fb_id);
+ }
+ return TRUE;
+}
+
+static void *drmmode_shadow_allocate(xf86CrtcPtr crtc, int width, int height)
+{
+ return NULL;
+}
+
+static PixmapPtr drmmode_shadow_create(xf86CrtcPtr crtc, void *data, int width,
+ int height)
+{
+ return NULL;
+}
+
+static const xf86CrtcFuncsRec drmmode_crtc_funcs = {
+ .dpms = drmmode_crtc_dpms,
+ .set_mode_major = drmmode_set_mode_major,
+ .set_cursor_colors = drmmode_set_cursor_colors,
+ .set_cursor_position = drmmode_set_cursor_position,
+ .show_cursor = drmmode_show_cursor,
+ .hide_cursor = drmmode_hide_cursor,
+ .load_cursor_argb = drmmode_load_cursor_argb,
+
+ .gamma_set = drmmode_crtc_gamma_set,
+ .destroy = NULL, /* XXX */
+ .set_scanout_pixmap = drmmode_set_scanout_pixmap,
+ .shadow_allocate = drmmode_shadow_allocate,
+ .shadow_create = drmmode_shadow_create,
+};
+
+static void
+drmmode_crtc_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int num)
+{
+ xf86CrtcPtr crtc;
+ drmmode_crtc_private_ptr drmmode_crtc;
+
+ crtc = xf86CrtcCreate(pScrn, &drmmode_crtc_funcs);
+ if (crtc == NULL)
+ return;
+
+ drmmode_crtc = xnfcalloc(sizeof(drmmode_crtc_private_rec), 1);
+ drmmode_crtc->mode_crtc = drmModeGetCrtc(drmmode->fd, drmmode->mode_res->crtcs[num]);
+ drmmode_crtc->drmmode = drmmode;
+ crtc->driver_private = drmmode_crtc;
+}
+
+static xf86OutputStatus
+drmmode_output_detect(xf86OutputPtr output)
+{
+ /* go to the hw and retrieve a new output struct */
+ drmmode_output_private_ptr drmmode_output = output->driver_private;
+ drmmode_ptr drmmode = drmmode_output->drmmode;
+ xf86OutputStatus status;
+ drmModeFreeConnector(drmmode_output->mode_output);
+
+ drmmode_output->mode_output = drmModeGetConnector(drmmode->fd, drmmode_output->output_id);
+ if (!drmmode_output->mode_output)
+ return XF86OutputStatusDisconnected;
+
+ switch (drmmode_output->mode_output->connection) {
+ case DRM_MODE_CONNECTED:
+ status = XF86OutputStatusConnected;
+ break;
+ case DRM_MODE_DISCONNECTED:
+ status = XF86OutputStatusDisconnected;
+ break;
+ default:
+ case DRM_MODE_UNKNOWNCONNECTION:
+ status = XF86OutputStatusUnknown;
+ break;
+ }
+ return status;
+}
+
+static Bool
+drmmode_output_mode_valid(xf86OutputPtr output, DisplayModePtr pModes)
+{
+ return MODE_OK;
+}
+
+static Bool
+has_panel_fitter(xf86OutputPtr output)
+{
+ drmmode_output_private_ptr drmmode_output = output->driver_private;
+ drmModeConnectorPtr koutput = drmmode_output->mode_output;
+ drmmode_ptr drmmode = drmmode_output->drmmode;
+ int i;
+
+ /* Presume that if the output supports scaling, then we have a
+ * panel fitter capable of adjust any mode to suit.
+ */
+ for (i = 0; i < koutput->count_props; i++) {
+ drmModePropertyPtr props;
+ Bool found = FALSE;
+
+ props = drmModeGetProperty(drmmode->fd, koutput->props[i]);
+ if (props) {
+ found = strcmp(props->name, "scaling mode") == 0;
+ drmModeFreeProperty(props);
+ }
+
+ if (found)
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static DisplayModePtr
+drmmode_output_add_gtf_modes(xf86OutputPtr output,
+ DisplayModePtr Modes)
+{
+ xf86MonPtr mon = output->MonInfo;
+ DisplayModePtr i, m, preferred = NULL;
+ int max_x = 0, max_y = 0;
+ float max_vrefresh = 0.0;
+
+ if (mon && GTF_SUPPORTED(mon->features.msc))
+ return Modes;
+
+ if (!has_panel_fitter(output))
+ return Modes;
+
+ for (m = Modes; m; m = m->next) {
+ if (m->type & M_T_PREFERRED)
+ preferred = m;
+ max_x = max(max_x, m->HDisplay);
+ max_y = max(max_y, m->VDisplay);
+ max_vrefresh = max(max_vrefresh, xf86ModeVRefresh(m));
+ }
+
+ max_vrefresh = max(max_vrefresh, 60.0);
+ max_vrefresh *= (1 + SYNC_TOLERANCE);
+
+ m = xf86GetDefaultModes();
+ xf86ValidateModesSize(output->scrn, m, max_x, max_y, 0);
+
+ for (i = m; i; i = i->next) {
+ if (xf86ModeVRefresh(i) > max_vrefresh)
+ i->status = MODE_VSYNC;
+ if (preferred &&
+ i->HDisplay >= preferred->HDisplay &&
+ i->VDisplay >= preferred->VDisplay &&
+ xf86ModeVRefresh(i) >= xf86ModeVRefresh(preferred))
+ i->status = MODE_VSYNC;
+ }
+
+ xf86PruneInvalidModes(output->scrn, &m, FALSE);
+
+ return xf86ModesAdd(Modes, m);
+}
+
+static DisplayModePtr
+drmmode_output_get_modes(xf86OutputPtr output)
+{
+ drmmode_output_private_ptr drmmode_output = output->driver_private;
+ drmModeConnectorPtr koutput = drmmode_output->mode_output;
+ drmmode_ptr drmmode = drmmode_output->drmmode;
+ int i;
+ DisplayModePtr Modes = NULL, Mode;
+ drmModePropertyPtr props;
+ xf86MonPtr mon = NULL;
+
+ if (!koutput)
+ return NULL;
+
+ /* look for an EDID property */
+ for (i = 0; i < koutput->count_props; i++) {
+ props = drmModeGetProperty(drmmode->fd, koutput->props[i]);
+ if (props && (props->flags & DRM_MODE_PROP_BLOB)) {
+ if (!strcmp(props->name, "EDID")) {
+ if (drmmode_output->edid_blob)
+ drmModeFreePropertyBlob(drmmode_output->edid_blob);
+ drmmode_output->edid_blob = drmModeGetPropertyBlob(drmmode->fd, koutput->prop_values[i]);
+ }
+ drmModeFreeProperty(props);
+ }
+ }
+
+ if (drmmode_output->edid_blob) {
+ mon = xf86InterpretEDID(output->scrn->scrnIndex,
+ drmmode_output->edid_blob->data);
+ if (mon && drmmode_output->edid_blob->length > 128)
+ mon->flags |= MONITOR_EDID_COMPLETE_RAWDATA;
+ }
+ xf86OutputSetEDID(output, mon);
+
+ /* modes should already be available */
+ for (i = 0; i < koutput->count_modes; i++) {
+ Mode = xnfalloc(sizeof(DisplayModeRec));
+
+ drmmode_ConvertFromKMode(output->scrn, &koutput->modes[i], Mode);
+ Modes = xf86ModesAdd(Modes, Mode);
+
+ }
+
+ return drmmode_output_add_gtf_modes(output, Modes);
+}
+
+static void
+drmmode_output_destroy(xf86OutputPtr output)
+{
+ drmmode_output_private_ptr drmmode_output = output->driver_private;
+ int i;
+
+ if (drmmode_output->edid_blob)
+ drmModeFreePropertyBlob(drmmode_output->edid_blob);
+ for (i = 0; i < drmmode_output->num_props; i++) {
+ drmModeFreeProperty(drmmode_output->props[i].mode_prop);
+ free(drmmode_output->props[i].atoms);
+ }
+ free(drmmode_output->props);
+ for (i = 0; i < drmmode_output->mode_output->count_encoders; i++) {
+ drmModeFreeEncoder(drmmode_output->mode_encoders[i]);
+ }
+ free(drmmode_output->mode_encoders);
+ drmModeFreeConnector(drmmode_output->mode_output);
+ free(drmmode_output);
+ output->driver_private = NULL;
+}
+
+static void
+drmmode_output_dpms(xf86OutputPtr output, int mode)
+{
+ drmmode_output_private_ptr drmmode_output = output->driver_private;
+ drmModeConnectorPtr koutput = drmmode_output->mode_output;
+ drmmode_ptr drmmode = drmmode_output->drmmode;
+
+ if (!koutput)
+ return;
+
+ drmModeConnectorSetProperty(drmmode->fd, koutput->connector_id,
+ drmmode_output->dpms_enum_id, mode);
+ return;
+}
+
+
+static Bool
+drmmode_property_ignore(drmModePropertyPtr prop)
+{
+ if (!prop)
+ return TRUE;
+ /* ignore blob prop */
+ if (prop->flags & DRM_MODE_PROP_BLOB)
+ return TRUE;
+ /* ignore standard property */
+ if (!strcmp(prop->name, "EDID") ||
+ !strcmp(prop->name, "DPMS"))
+ return TRUE;
+
+ return FALSE;
+}
+
+static void
+drmmode_output_create_resources(xf86OutputPtr output)
+{
+ drmmode_output_private_ptr drmmode_output = output->driver_private;
+ drmModeConnectorPtr mode_output = drmmode_output->mode_output;
+ drmmode_ptr drmmode = drmmode_output->drmmode;
+ drmModePropertyPtr drmmode_prop;
+ int i, j, err;
+
+ drmmode_output->props = calloc(mode_output->count_props, sizeof(drmmode_prop_rec));
+ if (!drmmode_output->props)
+ return;
+
+ drmmode_output->num_props = 0;
+ for (i = 0, j = 0; i < mode_output->count_props; i++) {
+ drmmode_prop = drmModeGetProperty(drmmode->fd, mode_output->props[i]);
+ if (drmmode_property_ignore(drmmode_prop)) {
+ drmModeFreeProperty(drmmode_prop);
+ continue;
+ }
+ drmmode_output->props[j].mode_prop = drmmode_prop;
+ drmmode_output->props[j].value = mode_output->prop_values[i];
+ drmmode_output->num_props++;
+ j++;
+ }
+
+ for (i = 0; i < drmmode_output->num_props; i++) {
+ drmmode_prop_ptr p = &drmmode_output->props[i];
+ drmmode_prop = p->mode_prop;
+
+ if (drmmode_prop->flags & DRM_MODE_PROP_RANGE) {
+ INT32 prop_range[2];
+ INT32 value = p->value;
+
+ p->num_atoms = 1;
+ p->atoms = calloc(p->num_atoms, sizeof(Atom));
+ if (!p->atoms)
+ continue;
+ p->atoms[0] = MakeAtom(drmmode_prop->name, strlen(drmmode_prop->name), TRUE);
+ prop_range[0] = drmmode_prop->values[0];
+ prop_range[1] = drmmode_prop->values[1];
+ err = RRConfigureOutputProperty(output->randr_output, p->atoms[0],
+ FALSE, TRUE,
+ drmmode_prop->flags & DRM_MODE_PROP_IMMUTABLE ? TRUE : FALSE,
+ 2, prop_range);
+ if (err != 0) {
+ xf86DrvMsg(output->scrn->scrnIndex, X_ERROR,
+ "RRConfigureOutputProperty error, %d\n", err);
+ }
+ err = RRChangeOutputProperty(output->randr_output, p->atoms[0],
+ XA_INTEGER, 32, PropModeReplace, 1, &value, FALSE, TRUE);
+ if (err != 0) {
+ xf86DrvMsg(output->scrn->scrnIndex, X_ERROR,
+ "RRChangeOutputProperty error, %d\n", err);
+ }
+ } else if (drmmode_prop->flags & DRM_MODE_PROP_ENUM) {
+ p->num_atoms = drmmode_prop->count_enums + 1;
+ p->atoms = calloc(p->num_atoms, sizeof(Atom));
+ if (!p->atoms)
+ continue;
+ p->atoms[0] = MakeAtom(drmmode_prop->name, strlen(drmmode_prop->name), TRUE);
+ for (j = 1; j <= drmmode_prop->count_enums; j++) {
+ struct drm_mode_property_enum *e = &drmmode_prop->enums[j-1];
+ p->atoms[j] = MakeAtom(e->name, strlen(e->name), TRUE);
+ }
+ err = RRConfigureOutputProperty(output->randr_output, p->atoms[0],
+ FALSE, FALSE,
+ drmmode_prop->flags & DRM_MODE_PROP_IMMUTABLE ? TRUE : FALSE,
+ p->num_atoms - 1, (INT32 *)&p->atoms[1]);
+ if (err != 0) {
+ xf86DrvMsg(output->scrn->scrnIndex, X_ERROR,
+ "RRConfigureOutputProperty error, %d\n", err);
+ }
+ for (j = 0; j < drmmode_prop->count_enums; j++)
+ if (drmmode_prop->enums[j].value == p->value)
+ break;
+ /* there's always a matching value */
+ err = RRChangeOutputProperty(output->randr_output, p->atoms[0],
+ XA_ATOM, 32, PropModeReplace, 1, &p->atoms[j+1], FALSE, TRUE);
+ if (err != 0) {
+ xf86DrvMsg(output->scrn->scrnIndex, X_ERROR,
+ "RRChangeOutputProperty error, %d\n", err);
+ }
+ }
+ }
+}
+
+static Bool
+drmmode_output_set_property(xf86OutputPtr output, Atom property,
+ RRPropertyValuePtr value)
+{
+ drmmode_output_private_ptr drmmode_output = output->driver_private;
+ drmmode_ptr drmmode = drmmode_output->drmmode;
+ int i;
+
+ for (i = 0; i < drmmode_output->num_props; i++) {
+ drmmode_prop_ptr p = &drmmode_output->props[i];
+
+ if (p->atoms[0] != property)
+ continue;
+
+ if (p->mode_prop->flags & DRM_MODE_PROP_RANGE) {
+ uint32_t val;
+
+ if (value->type != XA_INTEGER || value->format != 32 ||
+ value->size != 1)
+ return FALSE;
+ val = *(uint32_t *)value->data;
+
+ drmModeConnectorSetProperty(drmmode->fd, drmmode_output->output_id,
+ p->mode_prop->prop_id, (uint64_t)val);
+ return TRUE;
+ } else if (p->mode_prop->flags & DRM_MODE_PROP_ENUM) {
+ Atom atom;
+ const char *name;
+ int j;
+
+ if (value->type != XA_ATOM || value->format != 32 || value->size != 1)
+ return FALSE;
+ memcpy(&atom, value->data, 4);
+ name = NameForAtom(atom);
+
+ /* search for matching name string, then set its value down */
+ for (j = 0; j < p->mode_prop->count_enums; j++) {
+ if (!strcmp(p->mode_prop->enums[j].name, name)) {
+ drmModeConnectorSetProperty(drmmode->fd, drmmode_output->output_id,
+ p->mode_prop->prop_id, p->mode_prop->enums[j].value);
+ return TRUE;
+ }
+ }
+ }
+ }
+
+ return TRUE;
+}
+
+static Bool
+drmmode_output_get_property(xf86OutputPtr output, Atom property)
+{
+ return TRUE;
+}
+
+static const xf86OutputFuncsRec drmmode_output_funcs = {
+ .dpms = drmmode_output_dpms,
+ .create_resources = drmmode_output_create_resources,
+ .set_property = drmmode_output_set_property,
+ .get_property = drmmode_output_get_property,
+ .detect = drmmode_output_detect,
+ .mode_valid = drmmode_output_mode_valid,
+
+ .get_modes = drmmode_output_get_modes,
+ .destroy = drmmode_output_destroy
+};
+
+static int subpixel_conv_table[7] = { 0, SubPixelUnknown,
+ SubPixelHorizontalRGB,
+ SubPixelHorizontalBGR,
+ SubPixelVerticalRGB,
+ SubPixelVerticalBGR,
+ SubPixelNone };
+
+static const char * const output_names[] = { "None",
+ "VGA",
+ "DVI",
+ "DVI",
+ "DVI",
+ "Composite",
+ "S-video",
+ "LVDS",
+ "CTV",
+ "DIN",
+ "DisplayPort",
+ "HDMI",
+ "HDMI",
+ "TV",
+ "eDP",
+ "Virtual",
+ "DSI",
+};
+
+static void
+drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int num, int *num_dvi, int *num_hdmi)
+{
+ xf86OutputPtr output;
+ drmModeConnectorPtr koutput;
+ drmModeEncoderPtr *kencoders = NULL;
+ drmmode_output_private_ptr drmmode_output;
+ drmModePropertyPtr props;
+ char name[32];
+ int i;
+
+ koutput = drmModeGetConnector(drmmode->fd, drmmode->mode_res->connectors[num]);
+ if (!koutput)
+ return;
+
+ kencoders = calloc(sizeof(drmModeEncoderPtr), koutput->count_encoders);
+ if (!kencoders) {
+ goto out_free_encoders;
+ }
+
+ for (i = 0; i < koutput->count_encoders; i++) {
+ kencoders[i] = drmModeGetEncoder(drmmode->fd, koutput->encoders[i]);
+ if (!kencoders[i]) {
+ goto out_free_encoders;
+ }
+ }
+
+ /* need to do smart conversion here for compat with non-kms ATI driver */
+ if (koutput->connector_type >= MS_ARRAY_SIZE(output_names))
+ snprintf(name, 32, "Unknown-%d", koutput->connector_type_id - 1);
+ else if (pScrn->is_gpu)
+ snprintf(name, 32, "%s-%d-%d", output_names[koutput->connector_type], pScrn->scrnIndex - GPU_SCREEN_OFFSET + 1, koutput->connector_type_id - 1);
+ else
+ snprintf(name, 32, "%s-%d", output_names[koutput->connector_type], koutput->connector_type_id - 1);
+
+ output = xf86OutputCreate (pScrn, &drmmode_output_funcs, name);
+ if (!output) {
+ goto out_free_encoders;
+ }
+
+ drmmode_output = calloc(sizeof(drmmode_output_private_rec), 1);
+ if (!drmmode_output) {
+ xf86OutputDestroy(output);
+ goto out_free_encoders;
+ }
+
+ drmmode_output->output_id = drmmode->mode_res->connectors[num];
+ drmmode_output->mode_output = koutput;
+ drmmode_output->mode_encoders = kencoders;
+ drmmode_output->drmmode = drmmode;
+ output->mm_width = koutput->mmWidth;
+ output->mm_height = koutput->mmHeight;
+
+ output->subpixel_order = subpixel_conv_table[koutput->subpixel];
+ output->interlaceAllowed = TRUE;
+ output->doubleScanAllowed = TRUE;
+ output->driver_private = drmmode_output;
+
+ output->possible_crtcs = 0x7f;
+ for (i = 0; i < koutput->count_encoders; i++) {
+ output->possible_crtcs &= kencoders[i]->possible_crtcs;
+ }
+ /* work out the possible clones later */
+ output->possible_clones = 0;
+
+ for (i = 0; i < koutput->count_props; i++) {
+ props = drmModeGetProperty(drmmode->fd, koutput->props[i]);
+ if (props && (props->flags & DRM_MODE_PROP_ENUM)) {
+ if (!strcmp(props->name, "DPMS")) {
+ drmmode_output->dpms_enum_id = koutput->props[i];
+ drmModeFreeProperty(props);
+ break;
+ }
+ drmModeFreeProperty(props);
+ }
+ }
+
+ return;
+out_free_encoders:
+ if (kencoders){
+ for (i = 0; i < koutput->count_encoders; i++)
+ drmModeFreeEncoder(kencoders[i]);
+ free(kencoders);
+ }
+ drmModeFreeConnector(koutput);
+
+}
+
+static uint32_t find_clones(ScrnInfoPtr scrn, xf86OutputPtr output)
+{
+ drmmode_output_private_ptr drmmode_output = output->driver_private, clone_drmout;
+ int i;
+ xf86OutputPtr clone_output;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ int index_mask = 0;
+
+ if (drmmode_output->enc_clone_mask == 0)
+ return index_mask;
+
+ for (i = 0; i < xf86_config->num_output; i++) {
+ clone_output = xf86_config->output[i];
+ clone_drmout = clone_output->driver_private;
+ if (output == clone_output)
+ continue;
+
+ if (clone_drmout->enc_mask == 0)
+ continue;
+ if (drmmode_output->enc_clone_mask == clone_drmout->enc_mask)
+ index_mask |= (1 << i);
+ }
+ return index_mask;
+}
+
+
+static void
+drmmode_clones_init(ScrnInfoPtr scrn, drmmode_ptr drmmode)
+{
+ int i, j;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+
+ for (i = 0; i < xf86_config->num_output; i++) {
+ xf86OutputPtr output = xf86_config->output[i];
+ drmmode_output_private_ptr drmmode_output;
+
+ drmmode_output = output->driver_private;
+ drmmode_output->enc_clone_mask = 0xff;
+ /* and all the possible encoder clones for this output together */
+ for (j = 0; j < drmmode_output->mode_output->count_encoders; j++)
+ {
+ int k;
+ for (k = 0; k < drmmode->mode_res->count_encoders; k++) {
+ if (drmmode->mode_res->encoders[k] == drmmode_output->mode_encoders[j]->encoder_id)
+ drmmode_output->enc_mask |= (1 << k);
+ }
+
+ drmmode_output->enc_clone_mask &= drmmode_output->mode_encoders[j]->possible_clones;
+ }
+ }
+
+ for (i = 0; i < xf86_config->num_output; i++) {
+ xf86OutputPtr output = xf86_config->output[i];
+ output->possible_clones = find_clones(scrn, output);
+ }
+}
+
+static Bool
+drmmode_xf86crtc_resize (ScrnInfoPtr scrn, int width, int height)
+{
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ drmmode_crtc_private_ptr
+ drmmode_crtc = xf86_config->crtc[0]->driver_private;
+ drmmode_ptr drmmode = drmmode_crtc->drmmode;
+ struct dumb_bo *old_front = NULL;
+ Bool ret;
+ ScreenPtr screen = xf86ScrnToScreen(scrn);
+ uint32_t old_fb_id;
+ int i, pitch, old_width, old_height, old_pitch;
+ int cpp = (scrn->bitsPerPixel + 7) / 8;
+ PixmapPtr ppix = screen->GetScreenPixmap(screen);
+ void *new_pixels;
+
+ if (scrn->virtualX == width && scrn->virtualY == height)
+ return TRUE;
+
+ xf86DrvMsg(scrn->scrnIndex, X_INFO,
+ "Allocate new frame buffer %dx%d stride\n",
+ width, height);
+
+ old_width = scrn->virtualX;
+ old_height = scrn->virtualY;
+ old_pitch = drmmode->front_bo->pitch;
+ old_fb_id = drmmode->fb_id;
+ old_front = drmmode->front_bo;
+
+ drmmode->front_bo = dumb_bo_create(drmmode->fd, width, height, scrn->bitsPerPixel);
+ if (!drmmode->front_bo)
+ goto fail;
+
+ pitch = drmmode->front_bo->pitch;
+
+ scrn->virtualX = width;
+ scrn->virtualY = height;
+ scrn->displayWidth = pitch / cpp;
+
+ ret = drmModeAddFB(drmmode->fd, width, height, scrn->depth,
+ scrn->bitsPerPixel, pitch,
+ drmmode->front_bo->handle,
+ &drmmode->fb_id);
+ if (ret)
+ goto fail;
+
+ new_pixels = drmmode_map_front_bo(drmmode);
+ if (!new_pixels)
+ goto fail;
+
+ if (!drmmode->shadow_enable)
+ screen->ModifyPixmapHeader(ppix, width, height, -1, -1,
+ pitch, new_pixels);
+ else {
+ void *new_shadow;
+ uint32_t size = scrn->displayWidth * scrn->virtualY *
+ ((scrn->bitsPerPixel + 7) >> 3);
+ new_shadow = calloc(1, size);
+ if (new_shadow == NULL)
+ goto fail;
+ free(drmmode->shadow_fb);
+ drmmode->shadow_fb = new_shadow;
+ screen->ModifyPixmapHeader(ppix, width, height, -1, -1,
+ pitch, drmmode->shadow_fb);
+ }
+
+ for (i = 0; i < xf86_config->num_crtc; i++) {
+ xf86CrtcPtr crtc = xf86_config->crtc[i];
+
+ if (!crtc->enabled)
+ continue;
+
+ drmmode_set_mode_major(crtc, &crtc->mode,
+ crtc->rotation, crtc->x, crtc->y);
+ }
+
+ if (old_fb_id) {
+ drmModeRmFB(drmmode->fd, old_fb_id);
+ dumb_bo_destroy(drmmode->fd, old_front);
+ }
+
+ return TRUE;
+
+ fail:
+ if (drmmode->front_bo)
+ dumb_bo_destroy(drmmode->fd, drmmode->front_bo);
+ drmmode->front_bo = old_front;
+ scrn->virtualX = old_width;
+ scrn->virtualY = old_height;
+ scrn->displayWidth = old_pitch / cpp;
+ drmmode->fb_id = old_fb_id;
+
+ return FALSE;
+}
+
+static const xf86CrtcConfigFuncsRec drmmode_xf86crtc_config_funcs = {
+ drmmode_xf86crtc_resize
+};
+
+Bool drmmode_pre_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int cpp)
+{
+ int i, num_dvi = 0, num_hdmi = 0;
+ int ret;
+ uint64_t value = 0;
+
+ /* check for dumb capability */
+ ret = drmGetCap(drmmode->fd, DRM_CAP_DUMB_BUFFER, &value);
+ if (ret > 0 || value != 1) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "KMS doesn't support dumb interface\n");
+ return FALSE;
+ }
+
+ xf86CrtcConfigInit(pScrn, &drmmode_xf86crtc_config_funcs);
+
+ drmmode->scrn = pScrn;
+ drmmode->cpp = cpp;
+ drmmode->mode_res = drmModeGetResources(drmmode->fd);
+ if (!drmmode->mode_res)
+ return FALSE;
+
+ xf86CrtcSetSizeRange(pScrn, 320, 200, drmmode->mode_res->max_width, drmmode->mode_res->max_height);
+ for (i = 0; i < drmmode->mode_res->count_crtcs; i++)
+ if (!xf86IsEntityShared(pScrn->entityList[0]) || pScrn->confScreen->device->screen == i)
+ drmmode_crtc_init(pScrn, drmmode, i);
+
+ for (i = 0; i < drmmode->mode_res->count_connectors; i++)
+ drmmode_output_init(pScrn, drmmode, i, &num_dvi, &num_hdmi);
+
+ /* workout clones */
+ drmmode_clones_init(pScrn, drmmode);
+
+#if XF86_CRTC_VERSION >= 5
+ xf86ProviderSetup(pScrn, NULL, "modesetting");
+#endif
+
+ xf86InitialConfiguration(pScrn, TRUE);
+
+ return TRUE;
+}
+
+void drmmode_adjust_frame(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int x, int y)
+{
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ xf86OutputPtr output = config->output[config->compat_output];
+ xf86CrtcPtr crtc = output->crtc;
+
+ if (crtc && crtc->enabled) {
+ drmmode_set_mode_major(crtc, &crtc->mode, crtc->rotation,
+ x, y);
+ }
+}
+
+Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
+{
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ int c;
+
+ for (c = 0; c < config->num_crtc; c++) {
+ xf86CrtcPtr crtc = config->crtc[c];
+ drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+ xf86OutputPtr output = NULL;
+ int o;
+
+ /* Skip disabled CRTCs */
+ if (!crtc->enabled) {
+ drmModeSetCrtc(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id,
+ 0, 0, 0, NULL, 0, NULL);
+ continue;
+ }
+
+ if (config->output[config->compat_output]->crtc == crtc)
+ output = config->output[config->compat_output];
+ else
+ {
+ for (o = 0; o < config->num_output; o++)
+ if (config->output[o]->crtc == crtc)
+ {
+ output = config->output[o];
+ break;
+ }
+ }
+ /* paranoia */
+ if (!output)
+ continue;
+
+ /* Mark that we'll need to re-set the mode for sure */
+ memset(&crtc->mode, 0, sizeof(crtc->mode));
+ if (!crtc->desiredMode.CrtcHDisplay)
+ {
+ DisplayModePtr mode = xf86OutputFindClosestMode (output, pScrn->currentMode);
+
+ if (!mode)
+ return FALSE;
+ crtc->desiredMode = *mode;
+ crtc->desiredRotation = RR_Rotate_0;
+ crtc->desiredX = 0;
+ crtc->desiredY = 0;
+ }
+
+ if (!crtc->funcs->set_mode_major(crtc, &crtc->desiredMode, crtc->desiredRotation,
+ crtc->desiredX, crtc->desiredY))
+ return FALSE;
+ }
+ return TRUE;
+}
+
+static void drmmode_load_palette(ScrnInfoPtr pScrn, int numColors,
+ int *indices, LOCO *colors, VisualPtr pVisual)
+{
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ uint16_t lut_r[256], lut_g[256], lut_b[256];
+ int index, j, i;
+ int c;
+
+ for (c = 0; c < xf86_config->num_crtc; c++) {
+ xf86CrtcPtr crtc = xf86_config->crtc[c];
+ drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+
+ for (i = 0 ; i < 256; i++) {
+ lut_r[i] = drmmode_crtc->lut_r[i] << 6;
+ lut_g[i] = drmmode_crtc->lut_g[i] << 6;
+ lut_b[i] = drmmode_crtc->lut_b[i] << 6;
+ }
+
+ switch(pScrn->depth) {
+ case 15:
+ for (i = 0; i < numColors; i++) {
+ index = indices[i];
+ for (j = 0; j < 8; j++) {
+ lut_r[index * 8 + j] = colors[index].red << 6;
+ lut_g[index * 8 + j] = colors[index].green << 6;
+ lut_b[index * 8 + j] = colors[index].blue << 6;
+ }
+ }
+ break;
+ case 16:
+ for (i = 0; i < numColors; i++) {
+ index = indices[i];
+
+ if (i <= 31) {
+ for (j = 0; j < 8; j++) {
+ lut_r[index * 8 + j] = colors[index].red << 6;
+ lut_b[index * 8 + j] = colors[index].blue << 6;
+ }
+ }
+
+ for (j = 0; j < 4; j++) {
+ lut_g[index * 4 + j] = colors[index].green << 6;
+ }
+ }
+ break;
+ default:
+ for (i = 0; i < numColors; i++) {
+ index = indices[i];
+ lut_r[index] = colors[index].red << 6;
+ lut_g[index] = colors[index].green << 6;
+ lut_b[index] = colors[index].blue << 6;
+ }
+ break;
+ }
+
+ /* Make the change through RandR */
+ if (crtc->randr_crtc)
+ RRCrtcGammaSet(crtc->randr_crtc, lut_r, lut_g, lut_b);
+ else
+ crtc->funcs->gamma_set(crtc, lut_r, lut_g, lut_b, 256);
+ }
+}
+
+Bool drmmode_setup_colormap(ScreenPtr pScreen, ScrnInfoPtr pScrn)
+{
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 0,
+ "Initializing kms color map\n");
+ if (!miCreateDefColormap(pScreen))
+ return FALSE;
+ /* all radeons support 10 bit CLUTs */
+ if (!xf86HandleColormaps(pScreen, 256, 10,
+ drmmode_load_palette, NULL,
+ CMAP_PALETTED_TRUECOLOR
+#if 0 /* This option messes up text mode! (eich@suse.de) */
+ | CMAP_LOAD_EVEN_IF_OFFSCREEN
+#endif
+ | CMAP_RELOAD_ON_MODE_SWITCH))
+ return FALSE;
+ return TRUE;
+}
+
+#ifdef HAVE_UDEV
+static void
+drmmode_handle_uevents(int fd, void *closure)
+{
+ drmmode_ptr drmmode = closure;
+ ScrnInfoPtr scrn = drmmode->scrn;
+ struct udev_device *dev;
+ dev = udev_monitor_receive_device(drmmode->uevent_monitor);
+ if (!dev)
+ return;
+
+ RRGetInfo(xf86ScrnToScreen(scrn), TRUE);
+ udev_device_unref(dev);
+}
+#endif
+
+void drmmode_uevent_init(ScrnInfoPtr scrn, drmmode_ptr drmmode)
+{
+#ifdef HAVE_UDEV
+ struct udev *u;
+ struct udev_monitor *mon;
+
+ u = udev_new();
+ if (!u)
+ return;
+ mon = udev_monitor_new_from_netlink(u, "udev");
+ if (!mon) {
+ udev_unref(u);
+ return;
+ }
+
+ if (udev_monitor_filter_add_match_subsystem_devtype(mon,
+ "drm",
+ "drm_minor") < 0 ||
+ udev_monitor_enable_receiving(mon) < 0) {
+ udev_monitor_unref(mon);
+ udev_unref(u);
+ return;
+ }
+
+ drmmode->uevent_handler =
+ xf86AddGeneralHandler(udev_monitor_get_fd(mon),
+ drmmode_handle_uevents,
+ drmmode);
+
+ drmmode->uevent_monitor = mon;
+#endif
+}
+
+void drmmode_uevent_fini(ScrnInfoPtr scrn, drmmode_ptr drmmode)
+{
+#ifdef HAVE_UDEV
+ if (drmmode->uevent_handler) {
+ struct udev *u = udev_monitor_get_udev(drmmode->uevent_monitor);
+ xf86RemoveGeneralHandler(drmmode->uevent_handler);
+
+ udev_monitor_unref(drmmode->uevent_monitor);
+ udev_unref(u);
+ }
+#endif
+}
+
+/* create front and cursor BOs */
+Bool drmmode_create_initial_bos(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
+{
+ modesettingPtr ms = modesettingPTR(pScrn);
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ int width;
+ int height;
+ int bpp = pScrn->bitsPerPixel;
+ int i;
+ int cpp = (bpp + 7) / 8;
+
+ width = pScrn->virtualX;
+ height = pScrn->virtualY;
+
+ drmmode->front_bo = dumb_bo_create(drmmode->fd, width, height, bpp);
+ if (!drmmode->front_bo)
+ return FALSE;
+ pScrn->displayWidth = drmmode->front_bo->pitch / cpp;
+
+ width = ms->cursor_width;
+ height = ms->cursor_height;
+ bpp = 32;
+ for (i = 0; i < xf86_config->num_crtc; i++) {
+ xf86CrtcPtr crtc = xf86_config->crtc[i];
+ drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+ drmmode_crtc->cursor_bo = dumb_bo_create(drmmode->fd, width, height, bpp);
+ }
+ return TRUE;
+}
+
+void *drmmode_map_front_bo(drmmode_ptr drmmode)
+{
+ int ret;
+
+ if (drmmode->front_bo->ptr)
+ return drmmode->front_bo->ptr;
+
+ ret = dumb_bo_map(drmmode->fd, drmmode->front_bo);
+ if (ret)
+ return NULL;
+
+ return drmmode->front_bo->ptr;
+
+}
+
+void *drmmode_map_slave_bo(drmmode_ptr drmmode, msPixmapPrivPtr ppriv)
+{
+ int ret;
+
+ if (ppriv->backing_bo->ptr)
+ return ppriv->backing_bo->ptr;
+
+ ret = dumb_bo_map(drmmode->fd, ppriv->backing_bo);
+ if (ret)
+ return NULL;
+
+ return ppriv->backing_bo->ptr;
+}
+
+Bool drmmode_map_cursor_bos(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
+{
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ int i, ret;
+ for (i = 0; i < xf86_config->num_crtc; i++) {
+ xf86CrtcPtr crtc = xf86_config->crtc[i];
+ drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+ ret = dumb_bo_map(drmmode->fd, drmmode_crtc->cursor_bo);
+ if (ret)
+ return FALSE;
+ }
+ return TRUE;
+}
+
+void drmmode_free_bos(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
+{
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ int i;
+
+ if (drmmode->fb_id) {
+ drmModeRmFB(drmmode->fd, drmmode->fb_id);
+ drmmode->fb_id = 0;
+ }
+
+ dumb_bo_destroy(drmmode->fd, drmmode->front_bo);
+ drmmode->front_bo = NULL;
+
+ for (i = 0; i < xf86_config->num_crtc; i++) {
+ xf86CrtcPtr crtc = xf86_config->crtc[i];
+ drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+ dumb_bo_destroy(drmmode->fd, drmmode_crtc->cursor_bo);
+ }
+}
+
+/* ugly workaround to see if we can create 32bpp */
+void drmmode_get_default_bpp(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int *depth, int *bpp)
+{
+ drmModeResPtr mode_res;
+ uint64_t value;
+ struct dumb_bo *bo;
+ uint32_t fb_id;
+ int ret;
+
+ /* 16 is fine */
+ ret = drmGetCap(drmmode->fd, DRM_CAP_DUMB_PREFERRED_DEPTH, &value);
+ if (!ret && (value == 16 || value == 8)) {
+ *depth = value;
+ *bpp = value;
+ return;
+ }
+
+ *depth = 24;
+ mode_res = drmModeGetResources(drmmode->fd);
+ if (!mode_res)
+ return;
+
+ if (mode_res->min_width == 0)
+ mode_res->min_width = 1;
+ if (mode_res->min_height == 0)
+ mode_res->min_height = 1;
+ /*create a bo */
+ bo = dumb_bo_create(drmmode->fd, mode_res->min_width, mode_res->min_height, 32);
+ if (!bo) {
+ *bpp = 24;
+ goto out;
+ }
+
+ ret = drmModeAddFB(drmmode->fd, mode_res->min_width, mode_res->min_height,
+ 24, 32, bo->pitch, bo->handle, &fb_id);
+
+ if (ret) {
+ *bpp = 24;
+ dumb_bo_destroy(drmmode->fd, bo);
+ goto out;
+ }
+
+ drmModeRmFB(drmmode->fd, fb_id);
+ *bpp = 32;
+
+ dumb_bo_destroy(drmmode->fd, bo);
+out:
+ drmModeFreeResources(mode_res);
+ return;
+}
diff --git a/xorg-server/hw/xfree86/drivers/modesetting/drmmode_display.h b/xorg-server/hw/xfree86/drivers/modesetting/drmmode_display.h
new file mode 100644
index 000000000..7bfe885f5
--- /dev/null
+++ b/xorg-server/hw/xfree86/drivers/modesetting/drmmode_display.h
@@ -0,0 +1,136 @@
+/*
+ * Copyright © 2007 Red Hat, Inc.
+ *
+ * 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:
+ * Dave Airlie <airlied@redhat.com>
+ *
+ */
+#ifndef DRMMODE_DISPLAY_H
+#define DRMMODE_DISPLAY_H
+
+#include "xf86drmMode.h"
+#ifdef HAVE_UDEV
+#include "libudev.h"
+#endif
+
+struct dumb_bo {
+ uint32_t handle;
+ uint32_t size;
+ void *ptr;
+ int map_count;
+ uint32_t pitch;
+};
+
+typedef struct {
+ int fd;
+ unsigned fb_id;
+ drmModeResPtr mode_res;
+ drmModeFBPtr mode_fb;
+ int cpp;
+ ScrnInfoPtr scrn;
+#ifdef HAVE_UDEV
+ struct udev_monitor *uevent_monitor;
+ InputHandlerProc uevent_handler;
+#endif
+ drmEventContext event_context;
+ struct dumb_bo *front_bo;
+ Bool sw_cursor;
+
+ Bool shadow_enable;
+ void *shadow_fb;
+
+ DevPrivateKeyRec pixmapPrivateKeyRec;
+} drmmode_rec, *drmmode_ptr;
+
+typedef struct {
+ drmmode_ptr drmmode;
+ drmModeCrtcPtr mode_crtc;
+ int hw_id;
+ struct dumb_bo *cursor_bo;
+ unsigned rotate_fb_id;
+ uint16_t lut_r[256], lut_g[256], lut_b[256];
+ DamagePtr slave_damage;
+} drmmode_crtc_private_rec, *drmmode_crtc_private_ptr;
+
+typedef struct {
+ drmModePropertyPtr mode_prop;
+ uint64_t value;
+ int num_atoms; /* if range prop, num_atoms == 1; if enum prop, num_atoms == num_enums + 1 */
+ Atom *atoms;
+} drmmode_prop_rec, *drmmode_prop_ptr;
+
+
+typedef struct {
+ drmmode_ptr drmmode;
+ int output_id;
+ drmModeConnectorPtr mode_output;
+ drmModeEncoderPtr *mode_encoders;
+ drmModePropertyBlobPtr edid_blob;
+ int dpms_enum_id;
+ int num_props;
+ drmmode_prop_ptr props;
+ int enc_mask;
+ int enc_clone_mask;
+} drmmode_output_private_rec, *drmmode_output_private_ptr;
+
+typedef struct _msPixmapPriv {
+ uint32_t fb_id;
+ struct dumb_bo *backing_bo; /* if this pixmap is backed by a dumb bo */
+} msPixmapPrivRec, *msPixmapPrivPtr;
+
+
+extern DevPrivateKeyRec msPixmapPrivateKeyRec;
+#define msPixmapPrivateKey (&msPixmapPrivateKeyRec)
+
+#define msGetPixmapPriv(drmmode, p) ((msPixmapPrivPtr)dixGetPrivateAddr(&(p)->devPrivates, &(drmmode)->pixmapPrivateKeyRec))
+
+void *drmmode_map_slave_bo(drmmode_ptr drmmode, msPixmapPrivPtr ppriv);
+Bool drmmode_SetSlaveBO(PixmapPtr ppix,
+ drmmode_ptr drmmode,
+ int fd_handle, int pitch, int size);
+
+extern Bool drmmode_pre_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int cpp);
+void drmmode_adjust_frame(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int x, int y);
+extern Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode);
+extern Bool drmmode_setup_colormap(ScreenPtr pScreen, ScrnInfoPtr pScrn);
+
+extern void drmmode_uevent_init(ScrnInfoPtr scrn, drmmode_ptr drmmode);
+extern void drmmode_uevent_fini(ScrnInfoPtr scrn, drmmode_ptr drmmode);
+
+Bool drmmode_create_initial_bos(ScrnInfoPtr pScrn, drmmode_ptr drmmode);
+void *drmmode_map_front_bo(drmmode_ptr drmmode);
+Bool drmmode_map_cursor_bos(ScrnInfoPtr pScrn, drmmode_ptr drmmode);
+void drmmode_free_bos(ScrnInfoPtr pScrn, drmmode_ptr drmmode);
+void drmmode_get_default_bpp(ScrnInfoPtr pScrn, drmmode_ptr drmmmode, int *depth, int *bpp);
+
+
+#ifndef DRM_CAP_DUMB_PREFERRED_DEPTH
+#define DRM_CAP_DUMB_PREFERRED_DEPTH 3
+#endif
+#ifndef DRM_CAP_DUMB_PREFER_SHADOW
+#define DRM_CAP_DUMB_PREFER_SHADOW 4
+#endif
+
+#define MS_ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
+
+
+#endif
diff --git a/xorg-server/hw/xfree86/drivers/modesetting/modesetting.man b/xorg-server/hw/xfree86/drivers/modesetting/modesetting.man
new file mode 100644
index 000000000..34baa9c53
--- /dev/null
+++ b/xorg-server/hw/xfree86/drivers/modesetting/modesetting.man
@@ -0,0 +1,54 @@
+.\" shorthand for double quote that works everywhere.
+.ds q \N'34'
+.TH MODESETTING __drivermansuffix__ __vendorversion__
+.SH NAME
+modesetting \- video driver for framebuffer device
+.SH SYNOPSIS
+.nf
+.B "Section \*qDevice\*q"
+.BI " Identifier \*q" devname \*q
+.B " Driver \*qmodesetting\*q"
+.BI " BusID \*qpci:" bus : dev : func \*q
+\ \ ...
+.B EndSection
+.fi
+.SH DESCRIPTION
+.B modesetting
+is an __xservername__ driver for KMS devices. This is a non-accelerated
+driver, the following framebuffer depths are supported: 8, 15, 16, 24.
+All visual types are supported for depth 8, and TrueColor visual is
+supported for the other depths. RandR 1.2 is supported.
+.SH SUPPORTED HARDWARE
+The
+.B modesetting
+driver supports all hardware where a KMS driver is available.
+modesetting uses the Linux DRM KMS ioctls and dumb object create/map.
+.SH CONFIGURATION DETAILS
+Please refer to __xconfigfile__(__filemansuffix__) for general configuration
+details. This section only covers configuration details specific to
+this driver.
+.PP
+For this driver it is not required to specify modes in the screen
+section of the config file. The
+.B modesetting
+driver can pick up the currently used video mode from the kernel
+driver and will use it if there are no video modes configured.
+.PP
+For PCI boards you might have to add a BusID line to the Device
+section. See above for a sample line.
+.PP
+The following driver
+.B Options
+are supported:
+.TP
+.BI "Option \*qkmsdev\*q \*q" string \*q
+The framebuffer device to use. Default: /dev/dri/card0.
+.TP
+.BI "Option \*qShadowFB\*q \*q" boolean \*q
+Enable or disable use of the shadow framebuffer layer. Default: on.
+.TP
+.SH "SEE ALSO"
+__xservername__(__appmansuffix__), __xconfigfile__(__filemansuffix__), Xserver(__appmansuffix__),
+X(__miscmansuffix__)
+.SH AUTHORS
+Authors include: Dave Airlie
diff --git a/xorg-server/hw/xfree86/int10/generic.c b/xorg-server/hw/xfree86/int10/generic.c
index 73a1e5e49..012d1941a 100644
--- a/xorg-server/hw/xfree86/int10/generic.c
+++ b/xorg-server/hw/xfree86/int10/generic.c
@@ -99,6 +99,20 @@ static void UnmapVRam(xf86Int10InfoPtr pInt);
static void *sysMem = NULL;
+static Bool
+readIntVec(struct pci_device *dev, unsigned char *buf, int len)
+{
+ void *map;
+
+ if (!pci_device_map_legacy(dev, 0, len, 0, &map))
+ return FALSE;
+
+ memcpy(buf, map, len);
+ pci_device_unmap_legacy(dev, map, len);
+
+ return TRUE;
+}
+
xf86Int10InfoPtr
xf86ExtendedInitInt10(int entityIndex, int Flags)
{
@@ -144,7 +158,7 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
PCI_DEV_MAP_FLAG_WRITABLE, &sysMem);
INTPriv(pInt)->sysMem = sysMem;
- if (xf86ReadBIOS(0, 0, base, LOW_PAGE_SIZE) < 0) {
+ if (!readIntVec(pInt->dev, base, LOW_PAGE_SIZE)) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Cannot read int vect\n");
goto error1;
}
diff --git a/xorg-server/hw/xfree86/loader/loadmod.c b/xorg-server/hw/xfree86/loader/loadmod.c
index f1f7c224f..21ccb1bf9 100644
--- a/xorg-server/hw/xfree86/loader/loadmod.c
+++ b/xorg-server/hw/xfree86/loader/loadmod.c
@@ -584,7 +584,6 @@ CheckVersion(const char *module, XF86ModuleVersionInfo * data,
const XF86ModReqInfo * req)
{
int vercode[4];
- char verstr[4];
long ver = data->xf86version;
MessageType errtype;
@@ -592,42 +591,15 @@ CheckVersion(const char *module, XF86ModuleVersionInfo * data,
data->modname ? data->modname : "UNKNOWN!",
data->vendor ? data->vendor : "UNKNOWN!");
- /* Check for the different scheme used in XFree86 4.0.x releases:
- * ((((((((major << 7) | minor) << 7) | subminor) << 5) | beta) << 5) | alpha)
- * Since it wasn't used in 4.1.0 or later, limit to versions in the 4.0.x
- * range, which limits the overlap with the new version scheme to conflicts
- * with 6.71.8.764 through 6.72.39.934.
- */
- if ((ver > (4 << 24)) && (ver < ((4 << 24) + (1 << 17)))) {
- /* 4.0.x and earlier */
- verstr[1] = verstr[3] = 0;
- verstr[2] = (ver & 0x1f) ? (ver & 0x1f) + 'a' - 1 : 0;
- ver >>= 5;
- verstr[0] = (ver & 0x1f) ? (ver & 0x1f) + 'A' - 1 : 0;
- ver >>= 5;
- vercode[2] = ver & 0x7f;
- ver >>= 7;
- vercode[1] = ver & 0x7f;
- ver >>= 7;
- vercode[0] = ver;
- xf86ErrorF("\tcompiled for %d.%d", vercode[0], vercode[1]);
- if (vercode[2] != 0)
- xf86ErrorF(".%d", vercode[2]);
- xf86ErrorF("%s%s, module version = %d.%d.%d\n", verstr, verstr + 2,
- data->majorversion, data->minorversion, data->patchlevel);
- }
- else {
- vercode[0] = ver / 10000000;
- vercode[1] = (ver / 100000) % 100;
- vercode[2] = (ver / 1000) % 100;
- vercode[3] = ver % 1000;
- xf86ErrorF("\tcompiled for %d.%d.%d", vercode[0], vercode[1],
- vercode[2]);
- if (vercode[3] != 0)
- xf86ErrorF(".%d", vercode[3]);
- xf86ErrorF(", module version = %d.%d.%d\n", data->majorversion,
- data->minorversion, data->patchlevel);
- }
+ vercode[0] = ver / 10000000;
+ vercode[1] = (ver / 100000) % 100;
+ vercode[2] = (ver / 1000) % 100;
+ vercode[3] = ver % 1000;
+ xf86ErrorF("\tcompiled for %d.%d.%d", vercode[0], vercode[1], vercode[2]);
+ if (vercode[3] != 0)
+ xf86ErrorF(".%d", vercode[3]);
+ xf86ErrorF(", module version = %d.%d.%d\n", data->majorversion,
+ data->minorversion, data->patchlevel);
if (data->moduleclass)
xf86ErrorFVerb(2, "\tModule class: %s\n", data->moduleclass);
diff --git a/xorg-server/hw/xfree86/man/xorg.conf.man b/xorg-server/hw/xfree86/man/xorg.conf.man
index 16312124d..378f26b59 100644
--- a/xorg-server/hw/xfree86/man/xorg.conf.man
+++ b/xorg-server/hw/xfree86/man/xorg.conf.man
@@ -2023,12 +2023,6 @@ Default: false.
Disables the Int10 module, a module that uses the int10 call to the BIOS
of the graphics card to initialize it.
Default: false.
-.TP 7
-.BI "Option \*qNoMTRR\*q"
-Disables MTRR (Memory Type Range Register) support, a feature of modern
-processors which can improve video performance by a factor of up to 2.5.
-Some hardware has buggy MTRR support, and some video drivers have been
-known to exhibit problems when MTRR's are used.
.PP
Each
.B Screen
diff --git a/xorg-server/hw/xfree86/os-support/bsd/Makefile.am b/xorg-server/hw/xfree86/os-support/bsd/Makefile.am
index 7133c0f21..b01ea5bca 100644
--- a/xorg-server/hw/xfree86/os-support/bsd/Makefile.am
+++ b/xorg-server/hw/xfree86/os-support/bsd/Makefile.am
@@ -27,9 +27,7 @@ if ALPHA_VIDEO
# Cheat here and piggyback other alpha bits on ALPHA_VIDEO.
ARCH_SOURCES = \
alpha_video.c \
- bsd_ev56.c \
- bsd_axp.c \
- $(srcdir)/../shared/xf86Axp.c
+ bsd_ev56.c
endif
if ARM_VIDEO
diff --git a/xorg-server/hw/xfree86/os-support/bsd/alpha_video.c b/xorg-server/hw/xfree86/os-support/bsd/alpha_video.c
index f656f5595..236def6ff 100644
--- a/xorg-server/hw/xfree86/os-support/bsd/alpha_video.c
+++ b/xorg-server/hw/xfree86/os-support/bsd/alpha_video.c
@@ -35,11 +35,6 @@
#ifndef __NetBSD__
#include <sys/sysctl.h>
#endif
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__)
-#include <machine/sysarch.h>
-#endif
-
-#include "xf86Axp.h"
#include "xf86_OSlib.h"
#include "xf86OSpriv.h"
@@ -50,69 +45,9 @@
#define MAP_FLAGS (MAP_FILE | MAP_SHARED)
#endif
-axpDevice bsdGetAXP(void);
-
#ifndef __NetBSD__
extern unsigned long dense_base(void);
-
-static int axpSystem = -1;
-static unsigned long hae_thresh;
-static unsigned long hae_mask;
-
-static unsigned long
-memory_base(void)
-{
- static unsigned long base = 0;
-
- if (base == 0) {
- size_t len = sizeof(base);
- int error;
-
-#ifdef __OpenBSD__
- int mib[3];
-
- mib[0] = CTL_MACHDEP;
- mib[1] = CPU_CHIPSET;
- mib[2] = CPU_CHIPSET_MEM;
-
- if ((error = sysctl(mib, 3, &base, &len, NULL, 0)) < 0)
-#else
- if ((error = sysctlbyname("hw.chipset.memory", &base, &len, 0, 0)) < 0)
-#endif
- FatalError("xf86MapVidMem: can't find memory\n");
- }
-
- return base;
-}
-
-static int
-has_bwx(void)
-{
- static int bwx = 0;
- size_t len = sizeof(bwx);
- int error;
-
-#ifdef __OpenBSD__
- int mib[3];
-
- mib[0] = CTL_MACHDEP;
- mib[1] = CPU_CHIPSET;
- mib[2] = CPU_CHIPSET_BWX;
-
- if ((error = sysctl(mib, 3, &bwx, &len, NULL, 0)) < 0)
- return FALSE;
- else
- return bwx;
-#else
- if ((error = sysctlbyname("hw.chipset.bwx", &bwx, &len, 0, 0)) < 0)
- return FALSE;
- else
- return bwx;
-#endif
-}
#else /* __NetBSD__ */
-static unsigned long hae_thresh = (1UL << 24);
-static unsigned long hae_mask = 0xf8000000UL; /* XXX - should use xf86AXP.c */
static struct alpha_bus_window *abw;
static int abw_count = -1;
@@ -126,16 +61,6 @@ init_abw(void)
}
}
-static int
-has_bwx(void)
-{
- if (abw_count < 0)
- init_abw();
-
- xf86Msg(X_INFO, "has_bwx = %d\n", abw[0].abw_abst.abst_flags & ABST_BWX ? 1 : 0); /* XXXX */
- return abw[0].abw_abst.abst_flags & ABST_BWX;
-}
-
static unsigned long
dense_base(void)
{
@@ -147,30 +72,9 @@ dense_base(void)
return abw[0].abw_abst.abst_sys_start;
}
-static unsigned long
-memory_base(void)
-{
- if (abw_count < 0)
- init_abw();
-
- if (abw_count > 1) {
- xf86Msg(X_INFO, "memory base = %#lx\n", abw[1].abw_abst.abst_sys_start); /* XXXX */
- return abw[1].abw_abst.abst_sys_start;
- }
- else if (abw_count == 1) {
- /* assume memory_base == dense_base */
- xf86Msg(X_INFO, "memory base = %#lx\n", abw[0].abw_abst.abst_sys_start); /* XXXX */
- return abw[0].abw_abst.abst_sys_start;
- }
- else {
- xf86Msg(X_INFO, "no memory base\n"); /* XXXX */
- return 0;
- }
-}
#endif /* __NetBSD__ */
#define BUS_BASE dense_base()
-#define BUS_BASE_BWX memory_base()
/***************************************************************************/
/* Video Memory Mapping section */
@@ -182,18 +86,12 @@ memory_base(void)
"\trefer to xf86(4) for details"
#endif
-static Bool useDevMem = FALSE;
static int devMemFd = -1;
#ifdef HAS_APERTURE_DRV
#define DEV_APERTURE "/dev/xf86"
#endif
-static void *mapVidMem(int, unsigned long, unsigned long, int);
-static void unmapVidMem(int, void *, unsigned long);
-static void *mapVidMemSparse(int, unsigned long, unsigned long, int);
-static void unmapVidMemSparse(int, void *, unsigned long);
-
/*
* Check if /dev/mem can be mmap'd. If it can't print a warning when
* "warn" is TRUE.
@@ -219,7 +117,6 @@ checkDevMem(Bool warn)
if (base != MAP_FAILED) {
munmap((caddr_t) base, 4096);
devMemFd = fd;
- useDevMem = TRUE;
xf86Msg(X_INFO, "checkDevMem: using aperture driver %s\n",
DEV_APERTURE);
return;
@@ -240,7 +137,6 @@ checkDevMem(Bool warn)
if (base != MAP_FAILED) {
munmap((caddr_t) base, 4096);
devMemFd = fd;
- useDevMem = TRUE;
return;
}
else {
@@ -266,7 +162,6 @@ checkDevMem(Bool warn)
#endif
xf86ErrorF("\tlinear framebuffer access unavailable\n");
}
- useDevMem = FALSE;
return;
}
@@ -274,117 +169,10 @@ void
xf86OSInitVidMem(VidMemInfoPtr pVidMem)
{
checkDevMem(TRUE);
- pVidMem->linearSupported = useDevMem;
- if (has_bwx()) {
- xf86Msg(X_PROBED, "Machine type has 8/16 bit access\n");
- pVidMem->mapMem = mapVidMem;
- pVidMem->unmapMem = unmapVidMem;
- }
- else {
- xf86Msg(X_PROBED, "Machine needs sparse mapping\n");
- pVidMem->mapMem = mapVidMemSparse;
- pVidMem->unmapMem = unmapVidMemSparse;
-#ifndef __NetBSD__
- if (axpSystem == -1)
- axpSystem = bsdGetAXP();
- hae_thresh = xf86AXPParams[axpSystem].hae_thresh;
- hae_mask = xf86AXPParams[axpSystem].hae_mask;
-#endif /* __NetBSD__ */
- }
pVidMem->initialised = TRUE;
}
-static void *
-mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
-{
- void *base;
-
- checkDevMem(FALSE);
- Base = Base & ((1L << 32) - 1);
-
- if (useDevMem) {
- if (devMemFd < 0) {
- FatalError("xf86MapVidMem: failed to open %s (%s)\n",
- DEV_MEM, strerror(errno));
- }
- base = mmap((caddr_t) 0, Size,
- (flags & VIDMEM_READONLY) ?
- PROT_READ : (PROT_READ | PROT_WRITE),
- MAP_FLAGS, devMemFd, (off_t) Base + BUS_BASE_BWX);
- if (base == MAP_FAILED) {
- FatalError("%s: could not mmap %s [s=%lx,a=%lx] (%s)\n",
- "xf86MapVidMem", DEV_MEM, Size, Base, strerror(errno));
- }
- return base;
- }
-
- /* else, mmap /dev/vga */
- if ((unsigned long) Base < 0xA0000 || (unsigned long) Base >= 0xC0000) {
- FatalError("%s: Address 0x%lx outside allowable range\n",
- "xf86MapVidMem", Base);
- }
- base = mmap(0, Size,
- (flags & VIDMEM_READONLY) ?
- PROT_READ : (PROT_READ | PROT_WRITE),
- MAP_FLAGS, xf86Info.consoleFd, (unsigned long) Base + BUS_BASE);
- if (base == MAP_FAILED) {
- FatalError("xf86MapVidMem: Could not mmap /dev/vga (%s)\n",
- strerror(errno));
- }
- return base;
-}
-
-static void
-unmapVidMem(int ScreenNum, void *Base, unsigned long Size)
-{
- munmap((caddr_t) Base, Size);
-}
-
-/*
- * Read BIOS via mmap()ing DEV_MEM
- */
-
-int
-xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
- int Len)
-{
- unsigned char *ptr;
- int psize;
- int mlen;
-
- checkDevMem(TRUE);
- if (devMemFd == -1) {
- return -1;
- }
-
- psize = getpagesize();
- Offset += Base & (psize - 1);
- Base &= ~(psize - 1);
- mlen = (Offset + Len + psize - 1) & ~(psize - 1);
- ptr = (unsigned char *) mmap((caddr_t) 0, mlen, PROT_READ,
- MAP_SHARED, devMemFd, (off_t) Base + BUS_BASE);
- if ((long) ptr == -1) {
- xf86Msg(X_WARNING,
- "xf86ReadBIOS: %s mmap[s=%x,a=%lx,o=%lx] failed (%s)\n",
- DEV_MEM, Len, Base, Offset, strerror(errno));
- return -1;
- }
-#ifdef DEBUG
- xf86MsgVerb(X_INFO, 3,
- "xf86ReadBIOS: BIOS at 0x%08x has signature 0x%04x\n", Base,
- ptr[0] | (ptr[1] << 8));
-#endif
- (void) memcpy(Buf, (void *) (ptr + Offset), Len);
- (void) munmap((caddr_t) ptr, mlen);
-#ifdef DEBUG
- xf86MsgVerb(X_INFO, 3, "xf86ReadBIOS(%x, %x, Buf, %x)"
- "-> %02x %02x %02x %02x...\n",
- Base, Offset, Len, Buf[0], Buf[1], Buf[2], Buf[3]);
-#endif
- return Len;
-}
-
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__)
extern int ioperm(unsigned long from, unsigned long num, int on);
@@ -422,11 +210,6 @@ xf86DisableIO()
#endif /* USE_ALPHA_PIO */
-#define vuip volatile unsigned int *
-
-static void *memSBase = 0;
-static void *memBase = 0;
-
extern int readDense8(void *Base, register unsigned long Offset);
extern int readDense16(void *Base, register unsigned long Offset);
extern int readDense32(void *Base, register unsigned long Offset);
@@ -437,223 +220,6 @@ extern void
extern void
writeDense32(int Value, void *Base, register unsigned long Offset);
-static int readSparse8(void *Base, register unsigned long Offset);
-static int readSparse16(void *Base, register unsigned long Offset);
-static int readSparse32(void *Base, register unsigned long Offset);
-static void
- writeSparseNB8(int Value, void *Base, register unsigned long Offset);
-static void
- writeSparseNB16(int Value, void *Base, register unsigned long Offset);
-static void
- writeSparseNB32(int Value, void *Base, register unsigned long Offset);
-static void
- writeSparse8(int Value, void *Base, register unsigned long Offset);
-static void
- writeSparse16(int Value, void *Base, register unsigned long Offset);
-static void
- writeSparse32(int Value, void *Base, register unsigned long Offset);
-
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
-extern int sysarch(int, void *);
-
-struct parms {
- u_int64_t hae;
-};
-
-static void
-sethae(u_int64_t hae)
-{
-#ifndef ALPHA_SETHAE
-#define ALPHA_SETHAE 0
-#endif
- static struct parms p;
-
- if (p.hae != hae) {
- p.hae = hae;
- sysarch(ALPHA_SETHAE, (char *) &p);
- }
-}
-#endif
-
-static void *
-mapVidMemSparse(int ScreenNum, unsigned long Base, unsigned long Size,
- int flags)
-{
- static Bool was_here = FALSE;
-
- if (!was_here) {
- was_here = TRUE;
-
- checkDevMem(FALSE);
-
- xf86WriteMmio8 = writeSparse8;
- xf86WriteMmio16 = writeSparse16;
- xf86WriteMmio32 = writeSparse32;
- xf86WriteMmioNB8 = writeSparseNB8;
- xf86WriteMmioNB16 = writeSparseNB16;
- xf86WriteMmioNB32 = writeSparseNB32;
- xf86ReadMmio8 = readSparse8;
- xf86ReadMmio16 = readSparse16;
- xf86ReadMmio32 = readSparse32;
-
- memBase = mmap((caddr_t) 0, 0x100000000,
- PROT_READ | PROT_WRITE,
- MAP_SHARED, devMemFd, (off_t) BUS_BASE);
- memSBase = mmap((caddr_t) 0, 0x100000000,
- PROT_READ | PROT_WRITE,
- MAP_SHARED, devMemFd, (off_t) BUS_BASE_BWX);
-
- if (memSBase == MAP_FAILED || memBase == MAP_FAILED) {
- FatalError("xf86MapVidMem: Could not mmap framebuffer (%s)\n",
- strerror(errno));
- }
- }
- return (void *) ((unsigned long) memBase + Base);
-}
-
-static void
-unmapVidMemSparse(int ScreenNum, void *Base, unsigned long Size)
-{
-}
-
-static int
-readSparse8(void *Base, register unsigned long Offset)
-{
- register unsigned long result, shift;
- register unsigned long msb;
-
- mem_barrier();
- Offset += (unsigned long) Base - (unsigned long) memBase;
- shift = (Offset & 0x3) << 3;
- if (Offset >= (hae_thresh)) {
- msb = Offset & hae_mask;
- Offset -= msb;
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- sethae(msb);
-#endif
- }
- result = *(vuip) ((unsigned long) memSBase + (Offset << 5));
- result >>= shift;
- return 0xffUL & result;
-}
-
-static int
-readSparse16(void *Base, register unsigned long Offset)
-{
- register unsigned long result, shift;
- register unsigned long msb;
-
- mem_barrier();
- Offset += (unsigned long) Base - (unsigned long) memBase;
- shift = (Offset & 0x2) << 3;
- if (Offset >= (hae_thresh)) {
- msb = Offset & hae_mask;
- Offset -= msb;
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- sethae(msb);
-#endif
- }
- result =
- *(vuip) ((unsigned long) memSBase + (Offset << 5) + (1 << (5 - 2)));
- result >>= shift;
- return 0xffffUL & result;
-}
-
-static int
-readSparse32(void *Base, register unsigned long Offset)
-{
- mem_barrier();
- return *(vuip) ((unsigned long) Base + (Offset));
-}
-
-static void
-writeSparse8(int Value, void *Base, register unsigned long Offset)
-{
- register unsigned long msb;
- register unsigned int b = Value & 0xffU;
-
- write_mem_barrier();
- Offset += (unsigned long) Base - (unsigned long) memBase;
- if (Offset >= (hae_thresh)) {
- msb = Offset & hae_mask;
- Offset -= msb;
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- sethae(msb);
-#endif
- }
- *(vuip) ((unsigned long) memSBase + (Offset << 5)) = b * 0x01010101;
-}
-
-static void
-writeSparse16(int Value, void *Base, register unsigned long Offset)
-{
- register unsigned long msb;
- register unsigned int w = Value & 0xffffU;
-
- write_mem_barrier();
- Offset += (unsigned long) Base - (unsigned long) memBase;
- if (Offset >= (hae_thresh)) {
- msb = Offset & hae_mask;
- Offset -= msb;
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- sethae(msb);
-#endif
- }
- *(vuip) ((unsigned long) memSBase + (Offset << 5) + (1 << (5 - 2))) =
- w * 0x00010001;
-
-}
-
-static void
-writeSparse32(int Value, void *Base, register unsigned long Offset)
-{
- write_mem_barrier();
- *(vuip) ((unsigned long) Base + (Offset)) = Value;
- return;
-}
-
-static void
-writeSparseNB8(int Value, void *Base, register unsigned long Offset)
-{
- register unsigned long msb;
- register unsigned int b = Value & 0xffU;
-
- Offset += (unsigned long) Base - (unsigned long) memBase;
- if (Offset >= (hae_thresh)) {
- msb = Offset & hae_mask;
- Offset -= msb;
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- sethae(msb);
-#endif
- }
- *(vuip) ((unsigned long) memSBase + (Offset << 5)) = b * 0x01010101;
-}
-
-static void
-writeSparseNB16(int Value, void *Base, register unsigned long Offset)
-{
- register unsigned long msb;
- register unsigned int w = Value & 0xffffU;
-
- Offset += (unsigned long) Base - (unsigned long) memBase;
- if (Offset >= (hae_thresh)) {
- msb = Offset & hae_mask;
- Offset -= msb;
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- sethae(msb);
-#endif
- }
- *(vuip) ((unsigned long) memSBase + (Offset << 5) + (1 << (5 - 2))) =
- w * 0x00010001;
-}
-
-static void
-writeSparseNB32(int Value, void *Base, register unsigned long Offset)
-{
- *(vuip) ((unsigned long) Base + (Offset)) = Value;
- return;
-}
-
void (*xf86WriteMmio8) (int Value, void *Base, unsigned long Offset)
= writeDense8;
void (*xf86WriteMmio16) (int Value, void *Base, unsigned long Offset)
diff --git a/xorg-server/hw/xfree86/os-support/bsd/arm_video.c b/xorg-server/hw/xfree86/os-support/bsd/arm_video.c
index e295c9244..3a639b8c6 100644
--- a/xorg-server/hw/xfree86/os-support/bsd/arm_video.c
+++ b/xorg-server/hw/xfree86/os-support/bsd/arm_video.c
@@ -66,35 +66,6 @@
#include "xf86_OSlib.h"
#include "xf86OSpriv.h"
-#ifdef __arm32__
-#include "machine/devmap.h"
-struct memAccess {
- int ioctl;
- struct map_info memInfo;
- void *regionVirtBase;
- Bool Checked;
- Bool OK;
-};
-
-static void *xf86MapInfoMap();
-static void xf86MapInfoUnmap();
-static struct memAccess *checkMapInfo();
-extern int vgaPhysLinearBase;
-
-/* A memAccess structure is needed for each possible region */
-struct memAccess vgaMemInfo = { CONSOLE_GET_MEM_INFO, NULL, NULL,
- FALSE, FALSE
-};
-
-struct memAccess linearMemInfo = { CONSOLE_GET_LINEAR_INFO, NULL, NULL,
- FALSE, FALSE
-};
-
-struct memAccess ioMemInfo = { CONSOLE_GET_IO_INFO, NULL, NULL,
- FALSE, FALSE
-};
-#endif /* __arm32__ */
-
#if defined(__NetBSD__) && !defined(MAP_FILE)
#define MAP_FLAGS MAP_SHARED
#else
@@ -108,12 +79,8 @@ struct memAccess ioMemInfo = { CONSOLE_GET_IO_INFO, NULL, NULL,
/* Video Memory Mapping section */
/***************************************************************************/
-static Bool useDevMem = FALSE;
static int devMemFd = -1;
-static void *mapVidMem(int, unsigned long, unsigned long, int);
-static void unmapVidMem(int, void *, unsigned long);
-
/*
* Check if /dev/mem can be mmap'd. If it can't print a warning when
* "warn" is TRUE.
@@ -137,7 +104,6 @@ checkDevMem(Bool warn)
if (base != MAP_FAILED) {
munmap((caddr_t) base, 4096);
devMemFd = fd;
- useDevMem = TRUE;
return;
}
else {
@@ -146,7 +112,6 @@ checkDevMem(Bool warn)
xf86Msg(X_WARNING, "checkDevMem: failed to mmap %s (%s)\n",
DEV_MEM, strerror(errno));
}
- useDevMem = FALSE;
return;
}
}
@@ -154,266 +119,17 @@ checkDevMem(Bool warn)
xf86Msg(X_WARNING, "checkDevMem: failed to open %s (%s)\n",
DEV_MEM, strerror(errno));
}
- useDevMem = FALSE;
return;
}
void
xf86OSInitVidMem(VidMemInfoPtr pVidMem)
{
-
checkDevMem(TRUE);
- pVidMem->linearSupported = useDevMem;
- pVidMem->mapMem = armMapVidMem;
- pVidMem->unmapVidMem = armUnmapVidMem;
pVidMem->initialised = TRUE;
}
-static void *
-mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
-{
- void *base;
-
- checkDevMem(FALSE);
-
- if (useDevMem) {
- if (devMemFd < 0) {
- FatalError("xf86MapVidMem: failed to open %s (%s)\n",
- DEV_MEM, strerror(errno));
- }
- base = mmap((caddr_t) 0, Size,
- (flags & VIDMEM_READONLY) ?
- PROT_READ : (PROT_READ | PROT_WRITE),
- MAP_FLAGS, devMemFd, (off_t) Base + BUS_BASE_BWX);
- if (base == MAP_FAILED) {
- FatalError("%s: could not mmap %s [s=%x,a=%x] (%s)\n",
- "xf86MapVidMem", DEV_MEM, Size, Base, strerror(errno));
- }
- return base;
- }
-
- /* else, mmap /dev/vga */
- if ((unsigned long) Base < 0xA0000 || (unsigned long) Base >= 0xC0000) {
- FatalError("%s: Address 0x%x outside allowable range\n",
- "xf86MapVidMem", Base);
- }
- base = mmap(0, Size,
- (flags & VIDMEM_READONLY) ?
- PROT_READ : (PROT_READ | PROT_WRITE),
- MAP_FLAGS, xf86Info.consoleFd, (unsigned long) Base - 0xA0000);
- if (base == MAP_FAILED) {
- FatalError("xf86MapVidMem: Could not mmap /dev/vga (%s)\n",
- strerror(errno));
- }
- return base;
-}
-
-static void
-unmapVidMem(int ScreenNum, void *Base, unsigned long Size)
-{
- munmap((caddr_t) Base, Size);
-}
-
-/*
- * Read BIOS via mmap()ing DEV_MEM
- */
-
-int
-xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
- int Len)
-{
- unsigned char *ptr;
- int psize;
- int mlen;
-
- checkDevMem(TRUE);
- if (devMemFd == -1) {
- return -1;
- }
-
- psize = getpagesize();
- Offset += Base & (psize - 1);
- Base &= ~(psize - 1);
- mlen = (Offset + Len + psize - 1) & ~(psize - 1);
- ptr = (unsigned char *) mmap((caddr_t) 0, mlen, PROT_READ,
- MAP_SHARED, devMemFd, (off_t) Base + BUS_BASE);
- if ((long) ptr == -1) {
- xf86Msg(X_WARNING,
- "xf86ReadBIOS: %s mmap[s=%x,a=%x,o=%x] failed (%s)\n",
- DEV_MEM, Len, Base, Offset, strerror(errno));
- return -1;
- }
-#ifdef DEBUG
- ErrorF("xf86ReadBIOS: BIOS at 0x%08x has signature 0x%04x\n",
- Base, ptr[0] | (ptr[1] << 8));
-#endif
- (void) memcpy(Buf, (void *) (ptr + Offset), Len);
- (void) munmap((caddr_t) ptr, mlen);
-#ifdef DEBUG
- xf86MsgVerb(X_INFO, 3, "xf86ReadBIOS(%x, %x, Buf, %x)"
- "-> %02x %02x %02x %02x...\n",
- Base, Offset, Len, Buf[0], Buf[1], Buf[2], Buf[3]);
-#endif
- return Len;
-}
-
-/* XXX This needs to be updated for the ND */
-
-/*
-** Find out whether the console driver provides memory mapping information
-** for the specified region and return the map_info pointer. Print a warning if required.
-*/
-static struct memAccess *
-checkMapInfo(Bool warn, int Region)
-{
- struct memAccess *memAccP;
-
- switch (Region) {
- case VGA_REGION:
- memAccP = &vgaMemInfo;
- break;
-
- case LINEAR_REGION:
- memAccP = &linearMemInfo;
- break;
-
- case MMIO_REGION:
- memAccP = &ioMemInfo;
- break;
-
- default:
- return NULL;
- break;
- }
-
- if (!memAccP->Checked) {
- if (ioctl(xf86Info.consoleFd, memAccP->ioctl, &(memAccP->memInfo)) ==
- -1) {
- if (warn) {
- xf86Msg(X_WARNING,
- "checkMapInfo: failed to get map info for region %d\n\t(%s)\n",
- Region, strerror(errno));
- }
- }
- else {
- if (memAccP->memInfo.u.map_info_mmap.map_offset != MAP_INFO_UNKNOWN)
- memAccP->OK = TRUE;
- }
- memAccP->Checked = TRUE;
- }
- if (memAccP->OK) {
- return memAccP;
- }
- else {
- return NULL;
- }
-}
-
-static void *
-xf86MapInfoMap(struct memAccess *memInfoP, void *Base, unsigned long Size)
-{
- struct map_info *mapInfoP = &(memInfoP->memInfo);
-
- if (mapInfoP->u.map_info_mmap.map_size == MAP_INFO_UNKNOWN) {
- Size = (unsigned long) Base + Size;
- }
- else {
- Size = mapInfoP->u.map_info_mmap.map_size;
- }
-
- switch (mapInfoP->method) {
- case MAP_MMAP:
- /* Need to remap if size is unknown because we may not have
- mapped the whole region initially */
- if (memInfoP->regionVirtBase == NULL ||
- mapInfoP->u.map_info_mmap.map_size == MAP_INFO_UNKNOWN) {
- if ((memInfoP->regionVirtBase =
- mmap((caddr_t) 0,
- Size,
- PROT_READ | PROT_WRITE,
- MAP_SHARED,
- xf86Info.consoleFd,
- (unsigned long) mapInfoP->u.map_info_mmap.map_offset))
- == (void *) -1) {
- FatalError
- ("xf86MapInfoMap: Failed to map memory at 0x%x\n\t%s\n",
- mapInfoP->u.map_info_mmap.map_offset, strerror(errno));
- }
- if (mapInfoP->u.map_info_mmap.internal_offset > 0)
- memInfoP->regionVirtBase +=
- mapInfoP->u.map_info_mmap.internal_offset;
- }
- break;
-
- default:
- FatalError("xf86MapInfoMap: Unsuported mapping method\n");
- break;
- }
-
- return (void *) ((int) memInfoP->regionVirtBase + (int) Base);
-}
-
-static void
-xf86MapInfoUnmap(struct memAccess *memInfoP, unsigned long Size)
-{
- struct map_info *mapInfoP = &(memInfoP->memInfo);
-
- switch (mapInfoP->method) {
- case MAP_MMAP:
- if (memInfoP->regionVirtBase != NULL) {
- if (mapInfoP->u.map_info_mmap.map_size != MAP_INFO_UNKNOWN)
- Size = mapInfoP->u.map_info_mmap.map_size;
- munmap((caddr_t) memInfoP->regionVirtBase, Size);
- memInfoP->regionVirtBase = NULL;
- }
- break;
- default:
- FatalError("xf86MapInfoMap: Unsuported mapping method\n");
- break;
- }
-}
-
-static void *
-armMapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
-{
- struct memAccess *memInfoP;
-
- if ((memInfoP = checkMapInfo(FALSE, Region)) != NULL) {
- /*
- ** xf86 passes in a physical address offset from the start
- ** of physical memory, but xf86MapInfoMap expects an
- ** offset from the start of the specified region - it gets
- ** the physical address of the region from the display driver.
- */
- switch (Region) {
- case LINEAR_REGION:
- if (vgaPhysLinearBase) {
- Base -= vgaPhysLinearBase;
- }
- break;
- case VGA_REGION:
- Base -= 0xA0000;
- break;
- }
-
- base = xf86MapInfoMap(memInfoP, Base, Size);
- return base;
- }
- return mapVidMem(ScreenNum, Base, Size, flags);
-}
-
-static void
-armUnmapVidMem(int ScreenNum, void *Base, unsigned long Size)
-{
- struct memAccess *memInfoP;
-
- if ((memInfoP = checkMapInfo(FALSE, Region)) != NULL) {
- xf86MapInfoUnmap(memInfoP, Base, Size);
- }
- unmapVidMem(ScreenNum, Base, Size);
-}
-
#ifdef USE_DEV_IO
static int IoFd = -1;
diff --git a/xorg-server/hw/xfree86/os-support/bsd/bsd_axp.c b/xorg-server/hw/xfree86/os-support/bsd/bsd_axp.c
deleted file mode 100644
index e7a36f8bf..000000000
--- a/xorg-server/hw/xfree86/os-support/bsd/bsd_axp.c
+++ /dev/null
@@ -1,71 +0,0 @@
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-#include "os.h"
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "shared/xf86Axp.h"
-#include <sys/param.h>
-#include "xf86_OSlib.h"
-#include <stdio.h>
-#include <sys/sysctl.h>
-
-axpDevice bsdGetAXP(void);
-
-/*
- * BSD does a very nice job providing system information to
- * user space programs. Unfortunately it doesn't provide all
- * the information required. Therefore we just obtain the
- * system type and look up the rest from a list we maintain
- * ourselves.
- */
-
-typedef struct {
- char *name;
- int type;
-} _AXP;
-
-static _AXP axpList[] = {
- {"apecs", APECS},
- {"pyxis", PYXIS},
- {"cia", CIA},
- {"irongate", IRONGATE},
- {"lca", LCA},
- {"t2", T2},
- {"tsunami", TSUNAMI},
- {NULL, SYS_NONE}
-};
-
-axpDevice
-bsdGetAXP(void)
-{
- int i;
- char sysname[64];
- size_t len = sizeof(sysname);
-
-#ifdef __OpenBSD__
- int mib[3];
- int error;
-
- mib[0] = CTL_MACHDEP;
- mib[1] = CPU_CHIPSET;
- mib[2] = CPU_CHIPSET_TYPE;
-
- if ((error = sysctl(mib, 3, &sysname, &len, NULL, 0)) < 0)
-#else
- if ((sysctlbyname("hw.chipset.type", &sysname, &len, 0, 0)) < 0)
-#endif
- FatalError("bsdGetAXP: can't find machine type\n");
-#ifdef DEBUG
- xf86Msg(X_INFO, "AXP is a: %s\n", sysname);
-#endif
- for (i = 0;; i++) {
- if (axpList[i].name == NULL)
- return SYS_NONE;
- if (!strcmp(sysname, axpList[i].name))
- return axpList[i].type;
- }
-}
diff --git a/xorg-server/hw/xfree86/os-support/bsd/i386_video.c b/xorg-server/hw/xfree86/os-support/bsd/i386_video.c
index 745319054..6c3bbcb48 100644
--- a/xorg-server/hw/xfree86/os-support/bsd/i386_video.c
+++ b/xorg-server/hw/xfree86/os-support/bsd/i386_video.c
@@ -34,27 +34,6 @@
#include <errno.h>
#include <sys/mman.h>
-#ifdef HAS_MTRR_SUPPORT
-#ifndef __NetBSD__
-#include <sys/types.h>
-#include <sys/memrange.h>
-#else
-#include "memrange.h"
-#endif
-#define X_MTRR_ID "XFree86"
-#endif
-
-#if defined(HAS_MTRR_BUILTIN) && defined(__NetBSD__)
-#include <machine/mtrr.h>
-#include <machine/sysarch.h>
-#include <sys/queue.h>
-#ifdef __x86_64__
-#define i386_set_mtrr x86_64_set_mtrr
-#define i386_get_mtrr x86_64_get_mtrr
-#define i386_iopl x86_64_iopl
-#endif
-#endif
-
#include "xf86_OSlib.h"
#include "xf86OSpriv.h"
@@ -85,20 +64,6 @@ static int devMemFd = -1;
#define DEV_APERTURE "/dev/xf86"
#endif
-static void *mapVidMem(int, unsigned long, unsigned long, int);
-static void unmapVidMem(int, void *, unsigned long);
-
-#ifdef HAS_MTRR_SUPPORT
-static void *setWC(int, unsigned long, unsigned long, Bool, MessageType);
-static void undoWC(int, void *);
-static Bool cleanMTRR(void);
-#endif
-#if defined(HAS_MTRR_BUILTIN) && defined(__NetBSD__)
-static void *NetBSDsetWC(int, unsigned long, unsigned long, Bool,
- MessageType);
-static void NetBSDundoWC(int, void *);
-#endif
-
/*
* Check if /dev/mem can be mmap'd. If it can't print a warning when
* "warn" is TRUE.
@@ -188,119 +153,10 @@ void
xf86OSInitVidMem(VidMemInfoPtr pVidMem)
{
checkDevMem(TRUE);
- pVidMem->linearSupported = useDevMem;
- pVidMem->mapMem = mapVidMem;
- pVidMem->unmapMem = unmapVidMem;
-
- if (useDevMem)
- pci_system_init_dev_mem(devMemFd);
-
-#ifdef HAS_MTRR_SUPPORT
- if (useDevMem) {
- if (cleanMTRR()) {
- pVidMem->setWC = setWC;
- pVidMem->undoWC = undoWC;
- }
- }
-#endif
-#if defined(HAS_MTRR_BUILTIN) && defined(__NetBSD__)
- pVidMem->setWC = NetBSDsetWC;
- pVidMem->undoWC = NetBSDundoWC;
-#endif
- pVidMem->initialised = TRUE;
-}
-static void *
-mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
-{
- void *base;
+ pci_system_init_dev_mem(devMemFd);
- checkDevMem(FALSE);
-
- if (useDevMem) {
- if (devMemFd < 0) {
- FatalError("xf86MapVidMem: failed to open %s (%s)",
- DEV_MEM, strerror(errno));
- }
- base = mmap((caddr_t) 0, Size,
- (flags & VIDMEM_READONLY) ?
- PROT_READ : (PROT_READ | PROT_WRITE),
- MAP_FLAGS, devMemFd, (off_t) Base);
- if (base == MAP_FAILED) {
- FatalError("%s: could not mmap %s [s=%lx,a=%lx] (%s)",
- "xf86MapVidMem", DEV_MEM, Size, Base, strerror(errno));
- }
- return base;
- }
-
- /* else, mmap /dev/vga */
- if ((unsigned long) Base < 0xA0000 || (unsigned long) Base >= 0xC0000) {
- FatalError("%s: Address 0x%lx outside allowable range",
- "xf86MapVidMem", Base);
- }
- base = mmap(0, Size,
- (flags & VIDMEM_READONLY) ?
- PROT_READ : (PROT_READ | PROT_WRITE),
- MAP_FLAGS, xf86Info.consoleFd, (unsigned long) Base - 0xA0000);
- if (base == MAP_FAILED) {
- FatalError("xf86MapVidMem: Could not mmap /dev/vga (%s)",
- strerror(errno));
- }
- return base;
-}
-
-static void
-unmapVidMem(int ScreenNum, void *Base, unsigned long Size)
-{
- munmap((caddr_t) Base, Size);
-}
-
-/*
- * Read BIOS via mmap()ing DEV_MEM
- */
-
-int
-xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
- int Len)
-{
- unsigned char *ptr;
- int psize;
- int mlen;
-
- checkDevMem(TRUE);
- if (devMemFd == -1) {
- return -1;
- }
-
- psize = getpagesize();
- Offset += Base & (psize - 1);
- Base &= ~(psize - 1);
- mlen = (Offset + Len + psize - 1) & ~(psize - 1);
- ptr = (unsigned char *) mmap((caddr_t) 0, mlen, PROT_READ,
- MAP_SHARED, devMemFd, (off_t) Base);
- if ((long) ptr == -1) {
- xf86Msg(X_WARNING,
- "xf86ReadBIOS: %s mmap[s=%x,a=%lx,o=%lx] failed (%s)\n",
- DEV_MEM, Len, Base, Offset, strerror(errno));
-#ifdef __OpenBSD__
- if (Base < 0xa0000) {
- xf86Msg(X_WARNING, SYSCTL_MSG2);
- }
-#endif
- return -1;
- }
-#ifdef DEBUG
- ErrorF("xf86ReadBIOS: BIOS at 0x%08x has signature 0x%04x\n",
- Base, ptr[0] | (ptr[1] << 8));
-#endif
- (void) memcpy(Buf, (void *) (ptr + Offset), Len);
- (void) munmap((caddr_t) ptr, mlen);
-#ifdef DEBUG
- xf86MsgVerb(X_INFO, 3, "xf86ReadBIOS(%x, %x, Buf, %x)"
- "-> %02x %02x %02x %02x...\n",
- Base, Offset, Len, Buf[0], Buf[1], Buf[2], Buf[3]);
-#endif
- return Len;
+ pVidMem->initialised = TRUE;
}
#ifdef USE_I386_IOPL
@@ -470,417 +326,3 @@ xf86SetRGBOut()
return;
}
#endif
-
-#ifdef HAS_MTRR_SUPPORT
-/* memory range (MTRR) support for FreeBSD */
-
-/*
- * This code is experimental. Some parts may be overkill, and other parts
- * may be incomplete.
- */
-
-/*
- * getAllRanges returns the full list of memory ranges with attributes set.
- */
-
-static struct mem_range_desc *
-getAllRanges(int *nmr)
-{
- struct mem_range_desc *mrd;
- struct mem_range_op mro;
-
- /*
- * Find how many ranges there are. If this fails, then the kernel
- * probably doesn't have MTRR support.
- */
- mro.mo_arg[0] = 0;
- if (ioctl(devMemFd, MEMRANGE_GET, &mro))
- return NULL;
- *nmr = mro.mo_arg[0];
- mrd = xnfalloc(*nmr * sizeof(struct mem_range_desc));
- mro.mo_arg[0] = *nmr;
- mro.mo_desc = mrd;
- if (ioctl(devMemFd, MEMRANGE_GET, &mro)) {
- free(mrd);
- return NULL;
- }
- return mrd;
-}
-
-/*
- * cleanMTRR removes any memory attribute that may be left by a previous
- * X server. Normally there won't be any, but this takes care of the
- * case where a server crashed without being able finish cleaning up.
- */
-
-static Bool
-cleanMTRR()
-{
- struct mem_range_desc *mrd;
- struct mem_range_op mro;
- int nmr, i;
-
- /* This shouldn't happen */
- if (devMemFd < 0)
- return FALSE;
-
- if (!(mrd = getAllRanges(&nmr)))
- return FALSE;
-
- for (i = 0; i < nmr; i++) {
- if (strcmp(mrd[i].mr_owner, X_MTRR_ID) == 0 &&
- (mrd[i].mr_flags & MDF_ACTIVE)) {
-#ifdef DEBUG
- ErrorF("Clean for (0x%lx,0x%lx)\n",
- (unsigned long) mrd[i].mr_base,
- (unsigned long) mrd[i].mr_len);
-#endif
- if (mrd[i].mr_flags & MDF_FIXACTIVE) {
- mro.mo_arg[0] = MEMRANGE_SET_UPDATE;
- mrd[i].mr_flags = MDF_UNCACHEABLE;
- }
- else {
- mro.mo_arg[0] = MEMRANGE_SET_REMOVE;
- }
- mro.mo_desc = mrd + i;
- ioctl(devMemFd, MEMRANGE_SET, &mro);
- }
- }
-#ifdef DEBUG
- sleep(10);
-#endif
- free(mrd);
- return TRUE;
-}
-
-typedef struct x_RangeRec {
- struct mem_range_desc mrd;
- Bool wasWC;
- struct x_RangeRec *next;
-} RangeRec, *RangePtr;
-
-static void
-freeRangeList(RangePtr range)
-{
- RangePtr rp;
-
- while (range) {
- rp = range;
- range = rp->next;
- free(rp);
- }
-}
-
-static RangePtr
-dupRangeList(RangePtr list)
-{
- RangePtr new = NULL, rp, p;
-
- rp = list;
- while (rp) {
- p = xnfalloc(sizeof(RangeRec));
- *p = *rp;
- p->next = new;
- new = p;
- rp = rp->next;
- }
- return new;
-}
-
-static RangePtr
-sortRangeList(RangePtr list)
-{
- RangePtr rp1, rp2, copy, sorted = NULL, minp, prev, minprev;
- unsigned long minBase;
-
- /* Sort by base address */
- rp1 = copy = dupRangeList(list);
- while (rp1) {
- minBase = rp1->mrd.mr_base;
- minp = rp1;
- minprev = NULL;
- prev = rp1;
- rp2 = rp1->next;
- while (rp2) {
- if (rp2->mrd.mr_base < minBase) {
- minBase = rp2->mrd.mr_base;
- minp = rp2;
- minprev = prev;
- }
- prev = rp2;
- rp2 = rp2->next;
- }
- if (minprev) {
- minprev->next = minp->next;
- rp1 = copy;
- }
- else {
- rp1 = minp->next;
- }
- minp->next = sorted;
- sorted = minp;
- }
- return sorted;
-}
-
-/*
- * findRanges returns a list of ranges that overlap the specified range.
- */
-
-static void
-findRanges(unsigned long base, unsigned long size, RangePtr * ucp,
- RangePtr * wcp)
-{
- struct mem_range_desc *mrd;
- int nmr, i;
- RangePtr rp, *p;
-
- if (!(mrd = getAllRanges(&nmr)))
- return;
-
- for (i = 0; i < nmr; i++) {
- if ((mrd[i].mr_flags & MDF_ACTIVE) &&
- mrd[i].mr_base < base + size &&
- mrd[i].mr_base + mrd[i].mr_len > base) {
- if (mrd[i].mr_flags & MDF_WRITECOMBINE)
- p = wcp;
- else if (mrd[i].mr_flags & MDF_UNCACHEABLE)
- p = ucp;
- else
- continue;
- rp = xnfalloc(sizeof(RangeRec));
- rp->mrd = mrd[i];
- rp->next = *p;
- *p = rp;
- }
- }
- free(mrd);
-}
-
-/*
- * This checks if the existing overlapping ranges fully cover the requested
- * range. Is this overkill?
- */
-
-static Bool
-fullCoverage(unsigned long base, unsigned long size, RangePtr overlap)
-{
- RangePtr rp1, sorted = NULL;
- unsigned long end;
-
- sorted = sortRangeList(overlap);
- /* Look for gaps */
- rp1 = sorted;
- end = base + size;
- while (rp1) {
- if (rp1->mrd.mr_base > base) {
- freeRangeList(sorted);
- return FALSE;
- }
- else {
- base = rp1->mrd.mr_base + rp1->mrd.mr_len;
- }
- if (base >= end) {
- freeRangeList(sorted);
- return TRUE;
- }
- rp1 = rp1->next;
- }
- freeRangeList(sorted);
- return FALSE;
-}
-
-static void *
-addWC(int screenNum, unsigned long base, unsigned long size, MessageType from)
-{
- RangePtr uc = NULL, wc = NULL, retlist = NULL;
- struct mem_range_desc mrd;
- struct mem_range_op mro;
-
- findRanges(base, size, &uc, &wc);
-
- /* See of the full range is already WC */
- if (!uc && fullCoverage(base, size, wc)) {
- xf86DrvMsg(screenNum, from,
- "Write-combining range (0x%lx,0x%lx) was already set\n",
- base, size);
- return NULL;
- }
-
- /* Otherwise, try to add the new range */
- mrd.mr_base = base;
- mrd.mr_len = size;
- strcpy(mrd.mr_owner, X_MTRR_ID);
- mrd.mr_flags = MDF_WRITECOMBINE;
- mro.mo_desc = &mrd;
- mro.mo_arg[0] = MEMRANGE_SET_UPDATE;
- if (ioctl(devMemFd, MEMRANGE_SET, &mro)) {
- xf86DrvMsg(screenNum, X_WARNING,
- "Failed to set write-combining range "
- "(0x%lx,0x%lx)\n", base, size);
- return NULL;
- }
- else {
- xf86DrvMsg(screenNum, from,
- "Write-combining range (0x%lx,0x%lx)\n", base, size);
- retlist = xnfalloc(sizeof(RangeRec));
- retlist->mrd = mrd;
- retlist->wasWC = FALSE;
- retlist->next = NULL;
- return retlist;
- }
-}
-
-static void *
-delWC(int screenNum, unsigned long base, unsigned long size, MessageType from)
-{
- RangePtr uc = NULL, wc = NULL, retlist = NULL;
- struct mem_range_desc mrd;
- struct mem_range_op mro;
-
- findRanges(base, size, &uc, &wc);
-
- /*
- * See of the full range is already not WC, or if there is full
- * coverage from UC ranges.
- */
- if (!wc || fullCoverage(base, size, uc)) {
- xf86DrvMsg(screenNum, from,
- "Write-combining range (0x%lx,0x%lx) was already clear\n",
- base, size);
- return NULL;
- }
-
- /* Otherwise, try to add the new range */
- mrd.mr_base = base;
- mrd.mr_len = size;
- strcpy(mrd.mr_owner, X_MTRR_ID);
- mrd.mr_flags = MDF_UNCACHEABLE;
- mro.mo_desc = &mrd;
- mro.mo_arg[0] = MEMRANGE_SET_UPDATE;
- if (ioctl(devMemFd, MEMRANGE_SET, &mro)) {
- xf86DrvMsg(screenNum, X_WARNING,
- "Failed to remove write-combining range "
- "(0x%lx,0x%lx)\n", base, size);
- /* XXX Should then remove all of the overlapping WC ranges */
- return NULL;
- }
- else {
- xf86DrvMsg(screenNum, from,
- "Removed Write-combining range (0x%lx,0x%lx)\n", base, size);
- retlist = xnfalloc(sizeof(RangeRec));
- retlist->mrd = mrd;
- retlist->wasWC = TRUE;
- retlist->next = NULL;
- return retlist;
- }
-}
-
-static void *
-setWC(int screenNum, unsigned long base, unsigned long size, Bool enable,
- MessageType from)
-{
- if (enable)
- return addWC(screenNum, base, size, from);
- else
- return delWC(screenNum, base, size, from);
-}
-
-static void
-undoWC(int screenNum, void *list)
-{
- RangePtr rp;
- struct mem_range_op mro;
- Bool failed;
-
- rp = list;
- while (rp) {
-#ifdef DEBUG
- ErrorF("Undo for (0x%lx,0x%lx), %d\n",
- (unsigned long) rp->mrd.mr_base,
- (unsigned long) rp->mrd.mr_len, rp->wasWC);
-#endif
- failed = FALSE;
- if (rp->wasWC) {
- mro.mo_arg[0] = MEMRANGE_SET_UPDATE;
- rp->mrd.mr_flags = MDF_WRITECOMBINE;
- strcpy(rp->mrd.mr_owner, "unknown");
- }
- else {
- mro.mo_arg[0] = MEMRANGE_SET_REMOVE;
- }
- mro.mo_desc = &rp->mrd;
-
- if (ioctl(devMemFd, MEMRANGE_SET, &mro)) {
- if (!rp->wasWC) {
- mro.mo_arg[0] = MEMRANGE_SET_UPDATE;
- rp->mrd.mr_flags = MDF_UNCACHEABLE;
- strcpy(rp->mrd.mr_owner, "unknown");
- if (ioctl(devMemFd, MEMRANGE_SET, &mro))
- failed = TRUE;
- }
- else
- failed = TRUE;
- }
- if (failed) {
- xf86DrvMsg(screenNum, X_WARNING,
- "Failed to restore MTRR range (0x%lx,0x%lx)\n",
- (unsigned long) rp->mrd.mr_base,
- (unsigned long) rp->mrd.mr_len);
- }
- rp = rp->next;
- }
-}
-
-#endif /* HAS_MTRR_SUPPORT */
-
-#if defined(HAS_MTRR_BUILTIN) && defined(__NetBSD__)
-static void *
-NetBSDsetWC(int screenNum, unsigned long base, unsigned long size, Bool enable,
- MessageType from)
-{
- struct mtrr *mtrrp;
- int n;
-
- xf86DrvMsg(screenNum, X_WARNING,
- "%s MTRR %lx - %lx\n", enable ? "set" : "remove",
- base, (base + size));
-
- mtrrp = xnfalloc(sizeof(struct mtrr));
- mtrrp->base = base;
- mtrrp->len = size;
- mtrrp->type = MTRR_TYPE_WC;
-
- /*
- * MTRR_PRIVATE will make this MTRR get reset automatically
- * if this process exits, so we have no need for an explicit
- * cleanup operation when starting a new server.
- */
-
- if (enable)
- mtrrp->flags = MTRR_VALID | MTRR_PRIVATE;
- else
- mtrrp->flags = 0;
- n = 1;
-
- if (i386_set_mtrr(mtrrp, &n) < 0) {
- free(mtrrp);
- return NULL;
- }
- return mtrrp;
-}
-
-static void
-NetBSDundoWC(int screenNum, void *list)
-{
- struct mtrr *mtrrp = (struct mtrr *) list;
- int n;
-
- if (mtrrp == NULL)
- return;
- n = 1;
- mtrrp->flags &= ~MTRR_VALID;
- i386_set_mtrr(mtrrp, &n);
- free(mtrrp);
-}
-#endif
diff --git a/xorg-server/hw/xfree86/os-support/bsd/ppc_video.c b/xorg-server/hw/xfree86/os-support/bsd/ppc_video.c
index 3fd28c3b5..b1cf7eb1b 100644
--- a/xorg-server/hw/xfree86/os-support/bsd/ppc_video.c
+++ b/xorg-server/hw/xfree86/os-support/bsd/ppc_video.c
@@ -44,74 +44,18 @@
#define DEV_MEM "/dev/xf86"
#endif
-static void *ppcMapVidMem(int, unsigned long, unsigned long, int flags);
-static void ppcUnmapVidMem(int, void *, unsigned long);
-
Bool xf86EnableIO(void);
void xf86DisableIO(void);
void
xf86OSInitVidMem(VidMemInfoPtr pVidMem)
{
- pVidMem->linearSupported = TRUE;
- pVidMem->mapMem = ppcMapVidMem;
- pVidMem->unmapMem = ppcUnmapVidMem;
pVidMem->initialised = TRUE;
xf86EnableIO();
}
volatile unsigned char *ioBase = MAP_FAILED;
-static void *
-ppcMapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
-{
- int fd = xf86Info.consoleFd;
- void *base;
-
-#ifdef DEBUG
- xf86MsgVerb(X_INFO, 3, "mapVidMem %lx, %lx, fd = %d", Base, Size, fd);
-#endif
-
- base = mmap(0, Size,
- (flags & VIDMEM_READONLY) ?
- PROT_READ : (PROT_READ | PROT_WRITE), MAP_SHARED, fd, Base);
- if (base == MAP_FAILED)
- FatalError("%s: could not mmap screen [s=%lx,a=%lx] (%s)",
- "xf86MapVidMem", Size, Base, strerror(errno));
-
- return base;
-}
-
-static void
-ppcUnmapVidMem(int ScreenNum, void *Base, unsigned long Size)
-{
- munmap(Base, Size);
-}
-
-int
-xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
- int Len)
-{
- int rv;
- static int kmem = -1;
-
- if (kmem == -1) {
- kmem = open(DEV_MEM, 2);
- if (kmem == -1) {
- FatalError("xf86ReadBIOS: open %s", DEV_MEM);
- }
- }
-
-#ifdef DEBUG
- xf86MsgVerb(X_INFO, 3, "xf86ReadBIOS() %lx %lx, %x\n", Base, Offset, Len);
-#endif
-
- lseek(kmem, Base + Offset, 0);
- rv = read(kmem, Buf, Len);
-
- return rv;
-}
-
Bool
xf86EnableIO()
{
diff --git a/xorg-server/hw/xfree86/os-support/bsd/sparc64_video.c b/xorg-server/hw/xfree86/os-support/bsd/sparc64_video.c
index 02951d602..5bed01790 100644
--- a/xorg-server/hw/xfree86/os-support/bsd/sparc64_video.c
+++ b/xorg-server/hw/xfree86/os-support/bsd/sparc64_video.c
@@ -38,48 +38,8 @@
/* Video Memory Mapping section */
/***************************************************************************/
-static void *sparc64MapVidMem(int, unsigned long, unsigned long, int);
-static void sparc64UnmapVidMem(int, void *, unsigned long);
-
void
xf86OSInitVidMem(VidMemInfoPtr pVidMem)
{
- pVidMem->linearSupported = TRUE;
- pVidMem->mapMem = sparc64MapVidMem;
- pVidMem->unmapMem = sparc64UnmapVidMem;
pVidMem->initialised = TRUE;
}
-
-static void *
-sparc64MapVidMem(int ScreenNum, unsigned long Base, unsigned long Size,
- int flags)
-{
- int fd = xf86Info.consoleFd;
- void *base;
-
-#ifdef DEBUG
- xf86MsgVerb(X_INFO, 3, "mapVidMem %lx, %lx, fd = %d", Base, Size, fd);
-#endif
-
- base = mmap(0, Size,
- (flags & VIDMEM_READONLY) ?
- PROT_READ : (PROT_READ | PROT_WRITE), MAP_SHARED, fd, Base);
- if (base == MAP_FAILED)
- FatalError("%s: could not mmap screen [s=%x,a=%x] (%s)",
- "xf86MapVidMem", Size, Base, strerror(errno));
- return base;
-}
-
-static void
-sparc64UnmapVidMem(int ScreenNum, void *Base, unsigned long Size)
-{
- munmap(Base, Size);
-}
-
-int
-xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
- int Len)
-{
-
- return 0;
-}
diff --git a/xorg-server/hw/xfree86/os-support/hurd/Makefile.am b/xorg-server/hw/xfree86/os-support/hurd/Makefile.am
index f228c1ce4..38660544a 100644
--- a/xorg-server/hw/xfree86/os-support/hurd/Makefile.am
+++ b/xorg-server/hw/xfree86/os-support/hurd/Makefile.am
@@ -1,6 +1,6 @@
noinst_LTLIBRARIES = libhurd.la
-libhurd_la_SOURCES = hurd_bell.c hurd_init.c hurd_mmap.c \
+libhurd_la_SOURCES = hurd_bell.c hurd_init.c \
hurd_video.c \
$(srcdir)/../shared/VTsw_noop.c \
$(srcdir)/../shared/posix_tty.c \
diff --git a/xorg-server/hw/xfree86/os-support/hurd/hurd_mmap.c b/xorg-server/hw/xfree86/os-support/hurd/hurd_mmap.c
deleted file mode 100644
index 8e089cadb..000000000
--- a/xorg-server/hw/xfree86/os-support/hurd/hurd_mmap.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright 1997 by UCHIYAMA Yasushi
- *
- * 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 UCHIYAMA Yasushi not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. UCHIYAMA Yasushi makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * UCHIYAMA YASUSHI DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL UCHIYAMA YASUSHI 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.
- *
- */
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include<mach.h>
-#include<device/device.h>
-#include<mach/machine/mach_i386.h>
-#include <hurd.h>
-
-#include <X11/X.h>
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-
-#define BIOS_SIZE 0x20000
-
-int
-xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
- int Len)
-{
- mach_port_t device, mem_dev;
- memory_object_t mem_obj;
- vm_address_t addr = (vm_address_t) 0; /* serach starting address */
- kern_return_t err;
-
- err = get_privileged_ports(NULL, &device);
- if (err) {
- errno = err;
- FatalError("xf86ReadBIOS() can't get_privileged_ports. (%s)\n",
- strerror(errno));
- }
- err = device_open(device, D_READ | D_WRITE, "mem", &mem_dev);
- mach_port_deallocate(mach_task_self(), device);
- if (err) {
- errno = err;
- FatalError("xf86ReadBIOS() can't device_open. (%s)\n", strerror(errno));
- }
- err =
- device_map(mem_dev, VM_PROT_READ | VM_PROT_WRITE, Base, BIOS_SIZE,
- &mem_obj, 0);
- if (err) {
- errno = err;
- FatalError("xf86ReadBIOS() can't device_map. (%s)\n", strerror(errno));
- }
- err = vm_map(mach_task_self(),
- &addr,
- BIOS_SIZE,
- 0,
- TRUE,
- mem_obj,
- Base,
- FALSE,
- VM_PROT_READ | VM_PROT_WRITE,
- VM_PROT_READ | VM_PROT_WRITE, VM_INHERIT_SHARE);
- mach_port_deallocate(mach_task_self(), mem_obj);
- if (err) {
- errno = err;
- FatalError("xf86ReadBIOS() can't vm_map. (%s)\n", strerror(errno));
- }
-
- memcpy(Buf, (void *) ((int) addr + Offset), Len);
-
- err = vm_deallocate(mach_task_self(), addr, BIOS_SIZE);
- if (err) {
- errno = err;
- FatalError("xf86ReadBIOS() can't vm_deallocate. (%s)\n",
- strerror(errno));
- }
-
- return Len;
-}
diff --git a/xorg-server/hw/xfree86/os-support/hurd/hurd_video.c b/xorg-server/hw/xfree86/os-support/hurd/hurd_video.c
index dc1a8e670..2a96393b0 100644
--- a/xorg-server/hw/xfree86/os-support/hurd/hurd_video.c
+++ b/xorg-server/hw/xfree86/os-support/hurd/hurd_video.c
@@ -42,68 +42,6 @@
/**************************************************************************
* Video Memory Mapping section
***************************************************************************/
-static void *
-mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int Flags)
-{
- mach_port_t device, mem_dev;
- memory_object_t mem_obj;
- kern_return_t err;
- vm_address_t addr = (vm_address_t) 0;
-
- err = get_privileged_ports(NULL, &device);
- if (err) {
- errno = err;
- FatalError("xf86MapVidMem() can't get_privileged_ports. (%s)\n",
- strerror(errno));
- }
- err = device_open(device, D_READ | D_WRITE, "mem", &mem_dev);
- mach_port_deallocate(mach_task_self(), device);
- if (err) {
- errno = err;
- FatalError("xf86MapVidMem() can't device_open. (%s)\n",
- strerror(errno));
- }
-
- err =
- device_map(mem_dev, VM_PROT_READ | VM_PROT_WRITE, Base, Size, &mem_obj,
- 0);
- if (err) {
- errno = err;
- FatalError("xf86MapVidMem() can't device_map. (%s)\n", strerror(errno));
- }
- err = vm_map(mach_task_self(), &addr, Size, 0, /* mask */
- TRUE, /* anywhere */
- mem_obj, (vm_offset_t) Base, FALSE, /* copy on write */
- VM_PROT_READ | VM_PROT_WRITE,
- VM_PROT_READ | VM_PROT_WRITE, VM_INHERIT_SHARE);
- mach_port_deallocate(mach_task_self(), mem_obj);
- if (err) {
- errno = err;
- FatalError("xf86MapVidMem() can't vm_map.(mem_obj) (%s)\n",
- strerror(errno));
- }
- mach_port_deallocate(mach_task_self(), mem_dev);
- if (err) {
- errno = err;
- FatalError
- ("xf86MapVidMem() can't mach_port_deallocate.(mem_dev) (%s)\n",
- strerror(errno));
- }
- return (void *) addr;
-}
-
-static void
-unmapVidMem(int ScreenNum, void *Base, unsigned long Size)
-{
- kern_return_t err = vm_deallocate(mach_task_self(), (int) Base, Size);
-
- if (err) {
- errno = err;
- ErrorF("xf86UnMapVidMem: can't dealloc framebuffer space (%s)\n",
- strerror(errno));
- }
- return;
-}
/**************************************************************************
* I/O Permissions section
@@ -146,8 +84,5 @@ xf86DisableIO()
void
xf86OSInitVidMem(VidMemInfoPtr pVidMem)
{
- pVidMem->linearSupported = TRUE;
- pVidMem->mapMem = mapVidMem;
- pVidMem->unmapMem = unmapVidMem;
pVidMem->initialised = TRUE;
}
diff --git a/xorg-server/hw/xfree86/os-support/linux/Makefile.am b/xorg-server/hw/xfree86/os-support/linux/Makefile.am
index 1686dc2c1..50fcd1f28 100644
--- a/xorg-server/hw/xfree86/os-support/linux/Makefile.am
+++ b/xorg-server/hw/xfree86/os-support/linux/Makefile.am
@@ -2,9 +2,6 @@ noinst_LTLIBRARIES = liblinux.la
if LINUX_ALPHA
noinst_LTLIBRARIES += liblinuxev56.la
-PLATFORM_PCI_SUPPORT = \
- $(srcdir)/lnx_axp.c \
- $(srcdir)/../shared/xf86Axp.c
liblinuxev56_la_CFLAGS = $(AM_CFLAGS) -mcpu=ev56
@@ -28,23 +25,18 @@ endif
liblinux_la_SOURCES = lnx_init.c lnx_video.c \
lnx_agp.c lnx_kmod.c lnx_bell.c lnx_platform.c \
- $(srcdir)/../shared/bios_mmap.c \
$(srcdir)/../shared/VTsw_usl.c \
$(srcdir)/../shared/posix_tty.c \
$(srcdir)/../shared/vidmem.c \
$(srcdir)/../shared/sigio.c \
$(ACPI_SRCS) \
$(APM_SRCS) \
- $(LOGIND_SRCS) \
- $(PLATFORM_PCI_SUPPORT)
+ $(LOGIND_SRCS)
AM_CFLAGS = -DUSESTDRES -DHAVE_SYSV_IPC $(DIX_CFLAGS) $(XORG_CFLAGS) $(PLATFORM_DEFINES)
AM_CPPFLAGS = $(XORG_INCS) $(PLATFORM_INCLUDES) $(LIBDRM_CFLAGS)
-EXTRA_DIST = \
- $(srcdir)/../shared/xf86Axp.h
-
if LINUX_ALPHA
liblinux_la_LIBADD = liblinuxev56.la
endif
diff --git a/xorg-server/hw/xfree86/os-support/linux/int10/linux.c b/xorg-server/hw/xfree86/os-support/linux/int10/linux.c
index 6181eb9c5..79b9a8858 100644
--- a/xorg-server/hw/xfree86/os-support/linux/int10/linux.c
+++ b/xorg-server/hw/xfree86/os-support/linux/int10/linux.c
@@ -70,6 +70,20 @@ static Int10LinuxSubModuleState int10LinuxLoadSubModule(ScrnInfoPtr pScrn);
#endif /* DoSubModules */
+static Bool
+readLegacy(struct pci_device *dev, unsigned char *buf, int base, int len)
+{
+ void *map;
+
+ if (!pci_device_map_legacy(dev, base, len, 0, &map))
+ return FALSE;
+
+ memcpy(buf, map, len);
+ pci_device_unmap_legacy(dev, man, len);
+
+ return TRUE;
+}
+
xf86Int10InfoPtr
xf86ExtendedInitInt10(int entityIndex, int Flags)
{
@@ -222,7 +236,8 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
Int10Current = pInt;
DebugF("Mapping int area\n");
- if (xf86ReadBIOS(0, 0, (unsigned char *) 0, LOW_PAGE_SIZE) < 0) {
+ /* note: yes, we really are writing the 0 page here */
+ if (!readLegacy(pInt->dev, (unsigned char *) 0, 0, LOW_PAGE_SIZE)) {
xf86DrvMsg(screen, X_ERROR, "Cannot read int vect\n");
goto error3;
}
@@ -236,7 +251,7 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
memset((void *) V_BIOS, 0, SYS_BIOS - V_BIOS);
DebugF("Reading BIOS\n");
for (cs = V_BIOS; cs < SYS_BIOS; cs += V_BIOS_SIZE)
- if (xf86ReadBIOS(cs, 0, (void *) cs, V_BIOS_SIZE) < V_BIOS_SIZE)
+ if (!readLegacy(pInt->dev, (void *)cs, cs, V_BIOS_SIZE))
xf86DrvMsg(screen, X_WARNING,
"Unable to retrieve all of segment 0x%06lX.\n",
(long) cs);
diff --git a/xorg-server/hw/xfree86/os-support/linux/lnx_axp.c b/xorg-server/hw/xfree86/os-support/linux/lnx_axp.c
deleted file mode 100644
index d65a3a487..000000000
--- a/xorg-server/hw/xfree86/os-support/linux/lnx_axp.c
+++ /dev/null
@@ -1,103 +0,0 @@
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <stdio.h>
-#include "xf86.h"
-#include "shared/xf86Axp.h"
-
-axpDevice lnxGetAXP(void);
-
-typedef struct {
- char *sysName;
- char *sysVari;
- char *cpu;
- axpDevice sys;
-} AXP;
-
-static AXP axpList[] = {
- {"Tsunami", NULL, NULL, TSUNAMI},
- {"Eiger", NULL, NULL, TSUNAMI},
- {"Noname", NULL, NULL, LCA},
- {"AlphaBook1", NULL, NULL, LCA},
- {"EB66", NULL, NULL, LCA},
- {"EB64+", NULL, NULL, APECS},
- {"Noritake", NULL, "EV5", CIA},
- {"Noritake", NULL, "EV56", CIA},
- {"Noritake", NULL, NULL, APECS},
- {"XL", NULL, NULL, APECS},
- {"Avanti", NULL, NULL, APECS},
- {"Mikasa", NULL, "EV5", CIA},
- {"Mikasa", NULL, "EV56", CIA},
- {"Mikasa", NULL, NULL, APECS},
- {"EB164", "EB164", NULL, CIA},
- {"EB164", "PC164", NULL, CIA},
- {"EB164", "LX164", NULL, PYXIS},
- {"EB164", "SX164", NULL, PYXIS},
- {"EB164", "RX164", NULL, POLARIS},
- {"Alcor", NULL, NULL, CIA},
- {"Takara", NULL, NULL, CIA},
- {"Sable", NULL, "EV5", T2_GAMMA},
- {"Sable", NULL, "EV56", T2_GAMMA},
- {"Sable", NULL, NULL, T2},
- {"Rawhide", NULL, NULL, MCPCIA},
- {"Jensen", NULL, NULL, JENSEN},
- {"Miata", NULL, NULL, PYXIS_CIA},
- {"Ruffian", NULL, NULL, PYXIS_CIA},
- {"Nautilus", NULL, NULL, IRONGATE},
- {NULL, NULL, NULL, SYS_NONE}
-};
-
-axpDevice
-lnxGetAXP(void)
-{
- FILE *file;
- int count = 0;
- char res[256];
- char cpu[255];
- char systype[255];
- char sysvari[255];
-
- if (!(file = fopen("/proc/cpuinfo", "r")))
- return SYS_NONE;
- do {
- if (!fgets(res, 0xff, file))
- return SYS_NONE;
- switch (count) {
- case 1:
- sscanf(res, "cpu model : %s", cpu);
- DebugF("CPU %s\n", cpu);
- break;
- case 5:
- sscanf(res, "system type : %s", systype);
- DebugF("system type : %s\n", systype);
- break;
- case 6:
- sscanf(res, "system variation : %s", sysvari);
- DebugF("system variation: %s\n", sysvari);
- break;
- }
- count++;
- } while (count < 8);
-
- fclose(file);
-
- count = 0;
-
- do {
- if (!axpList[count].sysName || !strcmp(axpList[count].sysName, systype)) {
- if (axpList[count].sysVari &&
- strcmp(axpList[count].sysVari, sysvari)) {
- count++;
- continue;
- };
- if (axpList[count].cpu && strcmp(axpList[count].cpu, cpu)) {
- count++;
- continue;
- }
- return axpList[count].sys;
- }
- count++;
- } while (1);
-}
diff --git a/xorg-server/hw/xfree86/os-support/linux/lnx_init.c b/xorg-server/hw/xfree86/os-support/linux/lnx_init.c
index 85709c629..94853070d 100644
--- a/xorg-server/hw/xfree86/os-support/linux/lnx_init.c
+++ b/xorg-server/hw/xfree86/os-support/linux/lnx_init.c
@@ -76,6 +76,9 @@ switch_to(int vt, const char *from)
FatalError("%s: VT_WAITACTIVE failed: %s\n", from, strerror(errno));
}
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+
void
xf86OpenConsole(void)
{
@@ -166,7 +169,6 @@ xf86OpenConsole(void)
i = 0;
while (vcs[i] != NULL) {
-#pragma GCC diagnostic ignored "-Wformat-nonliteral"
snprintf(vtname, sizeof(vtname), vcs[i], xf86Info.vtno); /* /dev/tty1-64 */
if ((xf86Info.consoleFd = open(vtname, O_RDWR | O_NDELAY, 0)) >= 0)
break;
@@ -272,6 +274,8 @@ xf86OpenConsole(void)
}
}
+#pragma GCC diagnostic pop
+
void
xf86CloseConsole(void)
{
diff --git a/xorg-server/hw/xfree86/os-support/linux/lnx_video.c b/xorg-server/hw/xfree86/os-support/linux/lnx_video.c
index ffffc81c5..c09d71947 100644
--- a/xorg-server/hw/xfree86/os-support/linux/lnx_video.c
+++ b/xorg-server/hw/xfree86/os-support/linux/lnx_video.c
@@ -38,13 +38,6 @@
#include "xf86Priv.h"
#include "xf86_OSlib.h"
#include "xf86OSpriv.h"
-#ifdef __alpha__
-#include "shared/xf86Axp.h"
-#endif
-
-#ifdef HAS_MTRR_SUPPORT
-#include <asm/mtrr.h>
-#endif
static Bool ExtendedEnabled = FALSE;
@@ -72,405 +65,16 @@ extern int iopl(int __level);
#endif
-#ifdef __alpha__
-#define BUS_BASE bus_base
-#else
-#define BUS_BASE (0)
-#endif /* __alpha__ */
-
/***************************************************************************/
/* Video Memory Mapping section */
/***************************************************************************/
-static void *mapVidMem(int, unsigned long, unsigned long, int);
-static void unmapVidMem(int, void *, unsigned long);
-
-#if defined (__alpha__)
-extern void sethae(unsigned long hae);
-extern unsigned long _bus_base __P((void)) __attribute__ ((const));
-extern unsigned long _bus_base_sparse __P((void)) __attribute__ ((const));
-
-static void *mapVidMemSparse(int, unsigned long, unsigned long, int);
-extern axpDevice lnxGetAXP(void);
-static void unmapVidMemSparse(int, void *, unsigned long);
-static axpDevice axpSystem = -1;
-static Bool needSparse;
-static unsigned long hae_thresh;
-static unsigned long hae_mask;
-static unsigned long bus_base;
-#endif
-
-#ifdef HAS_MTRR_SUPPORT
-
-#define SPLIT_WC_REGIONS 1
-
-static void *setWC(int, unsigned long, unsigned long, Bool, MessageType);
-static void undoWC(int, void *);
-
-/* The file desc for /proc/mtrr. Once opened, left opened, and the mtrr
- driver will clean up when we exit. */
-#define MTRR_FD_UNOPENED (-1) /* We have yet to open /proc/mtrr */
-#define MTRR_FD_PROBLEM (-2) /* We tried to open /proc/mtrr, but had
- a problem. */
-static int mtrr_fd = MTRR_FD_UNOPENED;
-
-/* Open /proc/mtrr. FALSE on failure. Will always fail on Linux 2.0,
- and will fail on Linux 2.2 with MTRR support configured out,
- so verbosity should be chosen appropriately. */
-static Bool
-mtrr_open(int verbosity)
-{
- /* Only report absence of /proc/mtrr once. */
- static Bool warned = FALSE;
-
- if (mtrr_fd == MTRR_FD_UNOPENED) {
- mtrr_fd = open("/proc/mtrr", O_WRONLY);
-
- if (mtrr_fd < 0)
- mtrr_fd = MTRR_FD_PROBLEM;
- }
-
- if (mtrr_fd == MTRR_FD_PROBLEM) {
- /* To make sure we only ever warn once, need to check
- verbosity outside xf86MsgVerb */
- if (!warned && verbosity <= xf86GetVerbosity()) {
- xf86MsgVerb(X_WARNING, verbosity,
- "System lacks support for changing MTRRs\n");
- warned = TRUE;
- }
-
- return FALSE;
- }
- else
- return TRUE;
-}
-
-/*
- * We maintain a list of WC regions for each physical mapping so they can
- * be undone when unmapping.
- */
-
-struct mtrr_wc_region {
- struct mtrr_sentry sentry;
- Bool added; /* added WC or removed it */
- struct mtrr_wc_region *next;
-};
-
-static struct mtrr_wc_region *
-mtrr_cull_wc_region(int screenNum, unsigned long base, unsigned long size,
- MessageType from)
-{
- /* Some BIOS writers thought that setting wc over the mmio
- region of a graphics devices was a good idea. Try to fix
- it. */
-
- struct mtrr_gentry gent;
- struct mtrr_wc_region *wcreturn = NULL, *wcr;
- int count, ret = 0;
-
- /* Linux 2.0 users should not get a warning without -verbose */
- if (!mtrr_open(2))
- return NULL;
-
- for (gent.regnum = 0;
- ioctl(mtrr_fd, MTRRIOC_GET_ENTRY, &gent) >= 0; gent.regnum++) {
- if (gent.type != MTRR_TYPE_WRCOMB
- || gent.base + gent.size <= base || base + size <= gent.base)
- continue;
-
- /* Found an overlapping region. Delete it. */
-
- wcr = malloc(sizeof(*wcr));
- if (!wcr)
- return NULL;
- wcr->sentry.base = gent.base;
- wcr->sentry.size = gent.size;
- wcr->sentry.type = MTRR_TYPE_WRCOMB;
- wcr->added = FALSE;
-
- count = 3;
- while (count-- &&
- (ret = ioctl(mtrr_fd, MTRRIOC_KILL_ENTRY, &(wcr->sentry))) < 0);
-
- if (ret >= 0) {
- xf86DrvMsg(screenNum, from,
- "Removed MMIO write-combining range "
- "(0x%lx,0x%lx)\n",
- (unsigned long) gent.base, (unsigned long) gent.size);
- wcr->next = wcreturn;
- wcreturn = wcr;
- gent.regnum--;
- }
- else {
- free(wcr);
- xf86DrvMsgVerb(screenNum, X_WARNING, 0,
- "Failed to remove MMIO "
- "write-combining range (0x%lx,0x%lx)\n",
- (unsigned long)gent.base, (unsigned long) gent.size);
- }
- }
- return wcreturn;
-}
-
-static struct mtrr_wc_region *
-mtrr_remove_offending(int screenNum, unsigned long base, unsigned long size,
- MessageType from)
-{
- struct mtrr_gentry gent;
- struct mtrr_wc_region *wcreturn = NULL, **wcr;
-
- if (!mtrr_open(2))
- return NULL;
-
- wcr = &wcreturn;
- for (gent.regnum = 0;
- ioctl(mtrr_fd, MTRRIOC_GET_ENTRY, &gent) >= 0; gent.regnum++) {
- if (gent.type == MTRR_TYPE_WRCOMB
- && ((gent.base >= base && gent.base + gent.size < base + size) ||
- (gent.base > base && gent.base + gent.size <= base + size))) {
- *wcr = mtrr_cull_wc_region(screenNum, gent.base, gent.size, from);
- if (*wcr)
- gent.regnum--;
- while (*wcr) {
- wcr = &((*wcr)->next);
- }
- }
- }
- return wcreturn;
-}
-
-static struct mtrr_wc_region *
-mtrr_add_wc_region(int screenNum, unsigned long base, unsigned long size,
- MessageType from)
-{
- struct mtrr_wc_region **wcr, *wcreturn, *curwcr;
-
- /*
- * There can be only one....
- */
-
- wcreturn = mtrr_remove_offending(screenNum, base, size, from);
- wcr = &wcreturn;
- while (*wcr) {
- wcr = &((*wcr)->next);
- }
-
- /* Linux 2.0 should not warn, unless the user explicitly asks for
- WC. */
-
- if (!mtrr_open(from == X_CONFIG ? 0 : 2))
- return wcreturn;
-
- *wcr = curwcr = malloc(sizeof(**wcr));
- if (!curwcr)
- return wcreturn;
-
- curwcr->sentry.base = base;
- curwcr->sentry.size = size;
- curwcr->sentry.type = MTRR_TYPE_WRCOMB;
- curwcr->added = TRUE;
- curwcr->next = NULL;
-
-#if SPLIT_WC_REGIONS
- /*
- * Splits up the write-combining region if it is not aligned on a
- * size boundary.
- */
-
- {
- unsigned long lbase, d_size = 1;
- unsigned long n_size = size;
- unsigned long n_base = base;
-
- for (lbase = n_base, d_size = 1; !(lbase & 1);
- lbase = lbase >> 1, d_size <<= 1);
- while (d_size > n_size)
- d_size = d_size >> 1;
- DebugF("WC_BASE: 0x%lx WC_END: 0x%lx\n", base, base + d_size - 1);
- n_base += d_size;
- n_size -= d_size;
- if (n_size) {
- xf86DrvMsgVerb(screenNum, X_INFO, 3, "Splitting WC range: "
- "base: 0x%lx, size: 0x%lx\n", base, size);
- curwcr->next = mtrr_add_wc_region(screenNum, n_base, n_size, from);
- }
- curwcr->sentry.size = d_size;
- }
-
- /*****************************************************************/
-#endif /* SPLIT_WC_REGIONS */
-
- if (ioctl(mtrr_fd, MTRRIOC_ADD_ENTRY, &curwcr->sentry) >= 0) {
- /* Avoid printing on every VT switch */
- if (xf86ServerIsInitialising()) {
- xf86DrvMsg(screenNum, from,
- "Write-combining range (0x%lx,0x%lx)\n", base, size);
- }
- return wcreturn;
- }
- else {
- *wcr = curwcr->next;
- free(curwcr);
-
- /* Don't complain about the VGA region: MTRR fixed
- regions aren't currently supported, but might be in
- the future. */
- if ((unsigned long) base >= 0x100000) {
- xf86DrvMsgVerb(screenNum, X_WARNING, 0,
- "Failed to set up write-combining range "
- "(0x%lx,0x%lx)\n", base, size);
- }
- return wcreturn;
- }
-}
-
-static void
-mtrr_undo_wc_region(int screenNum, struct mtrr_wc_region *wcr)
-{
- struct mtrr_wc_region *p, *prev;
-
- if (mtrr_fd >= 0) {
- p = wcr;
- while (p) {
- if (p->added)
- ioctl(mtrr_fd, MTRRIOC_DEL_ENTRY, &p->sentry);
- prev = p;
- p = p->next;
- free(prev);
- }
- }
-}
-
-static void *
-setWC(int screenNum, unsigned long base, unsigned long size, Bool enable,
- MessageType from)
-{
- if (enable)
- return mtrr_add_wc_region(screenNum, base, size, from);
- else
- return mtrr_cull_wc_region(screenNum, base, size, from);
-}
-
-static void
-undoWC(int screenNum, void *regioninfo)
-{
- mtrr_undo_wc_region(screenNum, regioninfo);
-}
-
-#endif /* HAS_MTRR_SUPPORT */
-
void
xf86OSInitVidMem(VidMemInfoPtr pVidMem)
{
- pVidMem->linearSupported = TRUE;
-#ifdef __alpha__
- if (axpSystem == -1) {
- axpSystem = lnxGetAXP();
- if ((needSparse = (_bus_base_sparse() > 0))) {
- hae_thresh = xf86AXPParams[axpSystem].hae_thresh;
- hae_mask = xf86AXPParams[axpSystem].hae_mask;
- }
- bus_base = _bus_base();
- }
- if (needSparse) {
- xf86Msg(X_INFO, "Machine needs sparse mapping\n");
- pVidMem->mapMem = mapVidMemSparse;
- pVidMem->unmapMem = unmapVidMemSparse;
- }
- else {
- xf86Msg(X_INFO, "Machine type has 8/16 bit access\n");
- pVidMem->mapMem = mapVidMem;
- pVidMem->unmapMem = unmapVidMem;
- }
-#else
- pVidMem->mapMem = mapVidMem;
- pVidMem->unmapMem = unmapVidMem;
-#endif /* __alpha__ */
-
-#ifdef HAS_MTRR_SUPPORT
- pVidMem->setWC = setWC;
- pVidMem->undoWC = undoWC;
-#endif
pVidMem->initialised = TRUE;
}
-#ifdef __sparc__
-/* Basically, you simply cannot do this on Sparc. You have to do something portable
- * like use /dev/fb* or mmap() on /proc/bus/pci/X/Y nodes. -DaveM
- */
-static void *
-mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
-{
- return NULL;
-}
-#else
-static void *
-mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
-{
- void *base;
- int fd;
- int mapflags = MAP_SHARED;
- int prot;
- memType realBase, alignOff;
-
- realBase = Base & ~(getpagesize() - 1);
- alignOff = Base - realBase;
- DebugF("base: %lx, realBase: %lx, alignOff: %lx \n",
- Base, realBase, alignOff);
-
-#if defined(__ia64__) || defined(__arm__) || defined(__s390__)
-#ifndef MAP_WRITECOMBINED
-#define MAP_WRITECOMBINED 0x00010000
-#endif
-#ifndef MAP_NONCACHED
-#define MAP_NONCACHED 0x00020000
-#endif
- if (flags & VIDMEM_FRAMEBUFFER)
- mapflags |= MAP_WRITECOMBINED;
- else
- mapflags |= MAP_NONCACHED;
-#endif
-
-#if 0
- /* this will disappear when people upgrade their kernels */
- fd = open(DEV_MEM,
- ((flags & VIDMEM_READONLY) ? O_RDONLY : O_RDWR) | O_SYNC);
-#else
- fd = open(DEV_MEM, (flags & VIDMEM_READONLY) ? O_RDONLY : O_RDWR);
-#endif
- if (fd < 0) {
- FatalError("xf86MapVidMem: failed to open " DEV_MEM " (%s)\n",
- strerror(errno));
- }
-
- if (flags & VIDMEM_READONLY)
- prot = PROT_READ;
- else
- prot = PROT_READ | PROT_WRITE;
-
- /* This requires linux-0.99.pl10 or above */
- base = mmap((caddr_t) 0, Size + alignOff, prot, mapflags, fd,
- (off_t) realBase + BUS_BASE);
- close(fd);
- if (base == MAP_FAILED) {
- FatalError("xf86MapVidMem: Could not mmap framebuffer"
- " (0x%08lx,0x%lx) (%s)\n", Base, Size, strerror(errno));
- }
- DebugF("base: %lx aligned base: %lx\n", base, (char *) base + alignOff);
- return (char *) base + alignOff;
-}
-#endif /* !(__sparc__) */
-
-static void
-unmapVidMem(int ScreenNum, void *Base, unsigned long Size)
-{
- uintptr_t alignOff = (uintptr_t) Base
- - ((uintptr_t) Base & ~(getpagesize() - 1));
-
- DebugF("alignment offset: %lx\n", (unsigned long) alignOff);
- munmap((void *) ((uintptr_t) Base - alignOff), (Size + alignOff));
-}
-
/***************************************************************************/
/* I/O Permissions section */
/***************************************************************************/
@@ -565,8 +169,6 @@ xf86DisableIO(void)
#if defined (__alpha__)
-#define vuip volatile unsigned int *
-
extern int readDense8(void *Base, register unsigned long Offset);
extern int readDense16(void *Base, register unsigned long Offset);
extern int readDense32(void *Base, register unsigned long Offset);
@@ -577,284 +179,6 @@ extern void
extern void
writeDense32(int Value, void *Base, register unsigned long Offset);
-static int readSparse8(void *Base, register unsigned long Offset);
-static int readSparse16(void *Base, register unsigned long Offset);
-static int readSparse32(void *Base, register unsigned long Offset);
-static void
- writeSparseNB8(int Value, void *Base, register unsigned long Offset);
-static void
- writeSparseNB16(int Value, void *Base, register unsigned long Offset);
-static void
- writeSparseNB32(int Value, void *Base, register unsigned long Offset);
-static void
- writeSparse8(int Value, void *Base, register unsigned long Offset);
-static void
- writeSparse16(int Value, void *Base, register unsigned long Offset);
-static void
- writeSparse32(int Value, void *Base, register unsigned long Offset);
-
-#define DENSE_BASE 0x2ff00000000UL
-#define SPARSE_BASE 0x30000000000UL
-
-static unsigned long msb_set = 0;
-
-static void *
-mapVidMemSparse(int ScreenNum, unsigned long Base, unsigned long Size,
- int flags)
-{
- int fd, prot;
- unsigned long ret, rets = 0;
-
- static Bool was_here = FALSE;
-
- if (!was_here) {
- was_here = TRUE;
-
- xf86WriteMmio8 = writeSparse8;
- xf86WriteMmio16 = writeSparse16;
- xf86WriteMmio32 = writeSparse32;
- xf86WriteMmioNB8 = writeSparseNB8;
- xf86WriteMmioNB16 = writeSparseNB16;
- xf86WriteMmioNB32 = writeSparseNB32;
- xf86ReadMmio8 = readSparse8;
- xf86ReadMmio16 = readSparse16;
- xf86ReadMmio32 = readSparse32;
- }
-
- fd = open(DEV_MEM, (flags & VIDMEM_READONLY) ? O_RDONLY : O_RDWR);
- if (fd < 0) {
- FatalError("xf86MapVidMem: failed to open " DEV_MEM " (%s)\n",
- strerror(errno));
- }
-
-#if 0
- xf86Msg(X_INFO, "mapVidMemSparse: try Base 0x%lx size 0x%lx flags 0x%x\n",
- Base, Size, flags);
-#endif
-
- if (flags & VIDMEM_READONLY)
- prot = PROT_READ;
- else
- prot = PROT_READ | PROT_WRITE;
-
- /* This requirers linux-0.99.pl10 or above */
-
- /*
- * Always do DENSE mmap, since read32/write32 currently require it.
- */
- ret = (unsigned long) mmap((caddr_t) (DENSE_BASE + Base), Size,
- prot, MAP_SHARED, fd, (off_t) (bus_base + Base));
-
- /*
- * Do SPARSE mmap only when MMIO and not MMIO_32BIT, or FRAMEBUFFER
- * and SPARSE (which should require the use of read/write macros).
- *
- * By not SPARSE mmapping an 8MB framebuffer, we can save approx. 256K
- * bytes worth of pagetable (32 pages).
- */
- if (((flags & VIDMEM_MMIO) && !(flags & VIDMEM_MMIO_32BIT)) ||
- ((flags & VIDMEM_FRAMEBUFFER) && (flags & VIDMEM_SPARSE))) {
- rets = (unsigned long) mmap((caddr_t) (SPARSE_BASE + (Base << 5)),
- Size << 5, prot, MAP_SHARED, fd,
- (off_t) _bus_base_sparse() + (Base << 5));
- }
-
- close(fd);
-
- if (ret == (unsigned long) MAP_FAILED) {
- FatalError("xf86MapVidMemSparse: Could not (dense) mmap fb (%s)\n",
- strerror(errno));
- }
-
- if (((flags & VIDMEM_MMIO) && !(flags & VIDMEM_MMIO_32BIT)) ||
- ((flags & VIDMEM_FRAMEBUFFER) && (flags & VIDMEM_SPARSE))) {
- if (rets == (unsigned long) MAP_FAILED ||
- rets != (SPARSE_BASE + (Base << 5))) {
- FatalError("mapVidMemSparse: Could not (sparse) mmap fb (%s)\n",
- strerror(errno));
- }
- }
-
-#if 1
- if (rets)
- xf86Msg(X_INFO, "mapVidMemSparse: mapped Base 0x%lx size 0x%lx"
- " to DENSE at 0x%lx and SPARSE at 0x%lx\n",
- Base, Size, ret, rets);
- else
- xf86Msg(X_INFO, "mapVidMemSparse: mapped Base 0x%lx size 0x%lx"
- " to DENSE only at 0x%lx\n", Base, Size, ret);
-
-#endif
- return (void *) ret;
-}
-
-static void
-unmapVidMemSparse(int ScreenNum, void *Base, unsigned long Size)
-{
- unsigned long Offset = (unsigned long) Base - DENSE_BASE;
-
-#if 1
- xf86Msg(X_INFO, "unmapVidMemSparse: unmapping Base 0x%lx Size 0x%lx\n",
- Base, Size);
-#endif
- /* Unmap DENSE always. */
- munmap((caddr_t) Base, Size);
-
- /* Unmap SPARSE always, and ignore error in case we did not map it. */
- munmap((caddr_t) (SPARSE_BASE + (Offset << 5)), Size << 5);
-}
-
-static int
-readSparse8(void *Base, register unsigned long Offset)
-{
- register unsigned long result, shift;
- register unsigned long msb;
-
- mem_barrier();
- Offset += (unsigned long) Base - DENSE_BASE;
- shift = (Offset & 0x3) << 3;
- if (Offset >= (hae_thresh)) {
- msb = Offset & hae_mask;
- Offset -= msb;
- if (msb_set != msb) {
- sethae(msb);
- msb_set = msb;
- }
- }
-
- mem_barrier();
- result = *(vuip) (SPARSE_BASE + (Offset << 5));
- result >>= shift;
- return 0xffUL & result;
-}
-
-static int
-readSparse16(void *Base, register unsigned long Offset)
-{
- register unsigned long result, shift;
- register unsigned long msb;
-
- mem_barrier();
- Offset += (unsigned long) Base - DENSE_BASE;
- shift = (Offset & 0x2) << 3;
- if (Offset >= hae_thresh) {
- msb = Offset & hae_mask;
- Offset -= msb;
- if (msb_set != msb) {
- sethae(msb);
- msb_set = msb;
- }
- }
-
- mem_barrier();
- result = *(vuip) (SPARSE_BASE + (Offset << 5) + (1 << (5 - 2)));
- result >>= shift;
- return 0xffffUL & result;
-}
-
-static int
-readSparse32(void *Base, register unsigned long Offset)
-{
- /* NOTE: this is really using DENSE. */
- mem_barrier();
- return *(vuip) ((unsigned long) Base + (Offset));
-}
-
-static void
-writeSparse8(int Value, void *Base, register unsigned long Offset)
-{
- register unsigned long msb;
- register unsigned int b = Value & 0xffU;
-
- write_mem_barrier();
- Offset += (unsigned long) Base - DENSE_BASE;
- if (Offset >= hae_thresh) {
- msb = Offset & hae_mask;
- Offset -= msb;
- if (msb_set != msb) {
- sethae(msb);
- msb_set = msb;
- }
- }
-
- write_mem_barrier();
- *(vuip) (SPARSE_BASE + (Offset << 5)) = b * 0x01010101;
-}
-
-static void
-writeSparse16(int Value, void *Base, register unsigned long Offset)
-{
- register unsigned long msb;
- register unsigned int w = Value & 0xffffU;
-
- write_mem_barrier();
- Offset += (unsigned long) Base - DENSE_BASE;
- if (Offset >= hae_thresh) {
- msb = Offset & hae_mask;
- Offset -= msb;
- if (msb_set != msb) {
- sethae(msb);
- msb_set = msb;
- }
- }
-
- write_mem_barrier();
- *(vuip) (SPARSE_BASE + (Offset << 5) + (1 << (5 - 2))) = w * 0x00010001;
-}
-
-static void
-writeSparse32(int Value, void *Base, register unsigned long Offset)
-{
- /* NOTE: this is really using DENSE. */
- write_mem_barrier();
- *(vuip) ((unsigned long) Base + (Offset)) = Value;
- return;
-}
-
-static void
-writeSparseNB8(int Value, void *Base, register unsigned long Offset)
-{
- register unsigned long msb;
- register unsigned int b = Value & 0xffU;
-
- Offset += (unsigned long) Base - DENSE_BASE;
- if (Offset >= hae_thresh) {
- msb = Offset & hae_mask;
- Offset -= msb;
- if (msb_set != msb) {
- sethae(msb);
- msb_set = msb;
- }
- }
- *(vuip) (SPARSE_BASE + (Offset << 5)) = b * 0x01010101;
-}
-
-static void
-writeSparseNB16(int Value, void *Base, register unsigned long Offset)
-{
- register unsigned long msb;
- register unsigned int w = Value & 0xffffU;
-
- Offset += (unsigned long) Base - DENSE_BASE;
- if (Offset >= hae_thresh) {
- msb = Offset & hae_mask;
- Offset -= msb;
- if (msb_set != msb) {
- sethae(msb);
- msb_set = msb;
- }
- }
- *(vuip) (SPARSE_BASE + (Offset << 5) + (1 << (5 - 2))) = w * 0x00010001;
-}
-
-static void
-writeSparseNB32(int Value, void *Base, register unsigned long Offset)
-{
- /* NOTE: this is really using DENSE. */
- *(vuip) ((unsigned long) Base + (Offset)) = Value;
- return;
-}
-
void (*xf86WriteMmio8) (int Value, void *Base, unsigned long Offset)
= writeDense8;
void (*xf86WriteMmio16) (int Value, void *Base, unsigned long Offset)
diff --git a/xorg-server/hw/xfree86/os-support/shared/bios_mmap.c b/xorg-server/hw/xfree86/os-support/shared/bios_mmap.c
deleted file mode 100644
index e000dc9c8..000000000
--- a/xorg-server/hw/xfree86/os-support/shared/bios_mmap.c
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Copyright 1993 by David Wexelblat <dwex@goblin.org>
- *
- * 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 David Wexelblat not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. David Wexelblat makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL DAVID WEXELBLAT 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.
- *
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-
-/*
- * Read BIOS via mmap()ing DEV_MEM
- */
-
-#ifndef __alpha__
-int
-xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
- int Len)
-{
- int fd;
- unsigned char *ptr;
- int psize;
- int mlen;
-
- if ((fd = open(DEV_MEM, O_RDONLY)) < 0) {
- xf86Msg(X_WARNING, "xf86ReadBIOS: Failed to open %s (%s)\n",
- DEV_MEM, strerror(errno));
- return -1;
- }
- psize = getpagesize();
- Offset += Base & (psize - 1);
- Base &= ~(psize - 1);
- mlen = (Offset + Len + psize - 1) & ~(psize - 1);
- ptr = (unsigned char *) mmap((caddr_t) 0, mlen, PROT_READ,
- MAP_SHARED, fd, (off_t) Base);
- if (ptr == MAP_FAILED) {
- xf86Msg(X_WARNING, "xf86ReadBIOS: %s mmap failed (%s)\n",
- DEV_MEM, strerror(errno));
- close(fd);
- return -1;
- }
- DebugF("xf86ReadBIOS: BIOS at 0x%08x has signature 0x%04x\n",
- Base, ptr[0] | (ptr[1] << 8));
- (void) memcpy(Buf, (void *) (ptr + Offset), Len);
- (void) munmap((caddr_t) ptr, mlen);
- (void) close(fd);
- return Len;
-}
-
-#else /* __alpha__ */
-
- /*
- * We trick "mmap" into mapping BUS memory for us via BUS_BASE,
- * which is the KSEG address of the start of the DENSE memory
- * area.
- */
-
- /*
- * NOTE: there prolly ought to be more validity checks and all
- * re: boundaries and sizes and such...
- */
-
-#ifdef linux
-
-extern unsigned long _bus_base(void);
-
-#define BUS_BASE _bus_base()
-
-#else
-
-extern u_int64_t dense_base(void);
-
-#define BUS_BASE dense_base()
-
-#endif
-
-int
-xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
- int Len)
-{
- caddr_t base;
- int fd;
- int psize;
- int mlen;
-
- if ((fd = open(DEV_MEM, O_RDONLY)) < 0) {
- xf86Msg(X_WARNING, "xf86ReadBIOS: Failed to open %s (%s)\n",
- DEV_MEM, strerror(errno));
- return -1;
- }
-
- psize = getpagesize();
- Offset += Base & (psize - 1);
- Base &= ~(psize - 1);
- mlen = (Offset + Len + psize - 1) & ~(psize - 1);
- base = mmap((caddr_t) 0, mlen, PROT_READ,
- MAP_SHARED, fd, (off_t) (Base + BUS_BASE));
-
- if (base == MAP_FAILED) {
- xf86Msg(X_WARNING, "xf86ReadBIOS: Failed to mmap %s (%s)\n",
- DEV_MEM, strerror(errno));
- return -1;
- }
-
- xf86SlowBCopyFromBus((unsigned char *) (base + Offset), Buf, Len);
-
- munmap((caddr_t) base, mlen);
- close(fd);
- return Len;
-}
-
-#endif /* __alpha__ */
diff --git a/xorg-server/hw/xfree86/os-support/shared/vidmem.c b/xorg-server/hw/xfree86/os-support/shared/vidmem.c
index f473293c7..a6bf677f5 100644
--- a/xorg-server/hw/xfree86/os-support/shared/vidmem.c
+++ b/xorg-server/hw/xfree86/os-support/shared/vidmem.c
@@ -42,119 +42,7 @@
* This file contains the common part of the video memory mapping functions
*/
-/*
- * Get a piece of the ScrnInfoRec. At the moment, this is only used to hold
- * the MTRR option information, but it is likely to be expanded if we do
- * auto unmapping of memory at VT switch.
- *
- */
-
-typedef struct {
- unsigned long size;
- void *virtBase;
- void *mtrrInfo;
-} MappingRec, *MappingPtr;
-
-typedef struct {
- int numMappings;
- MappingPtr *mappings;
- Bool mtrrEnabled;
- MessageType mtrrFrom;
- Bool mtrrOptChecked;
- ScrnInfoPtr pScrn;
-} VidMapRec, *VidMapPtr;
-
-static int vidMapIndex = -1;
-
-#define VIDMAPPTR(p) ((VidMapPtr)((p)->privates[vidMapIndex].ptr))
-
static VidMemInfo vidMemInfo = { FALSE, };
-static VidMapRec vidMapRec = { 0, NULL, TRUE, X_DEFAULT, FALSE, NULL };
-
-static VidMapPtr
-getVidMapRec(int scrnIndex)
-{
- VidMapPtr vp;
- ScrnInfoPtr pScrn;
-
- if ((scrnIndex < 0) || !(pScrn = xf86Screens[scrnIndex]))
- return &vidMapRec;
-
- if (vidMapIndex < 0)
- vidMapIndex = xf86AllocateScrnInfoPrivateIndex();
-
- if (VIDMAPPTR(pScrn) != NULL)
- return VIDMAPPTR(pScrn);
-
- vp = pScrn->privates[vidMapIndex].ptr = xnfcalloc(sizeof(VidMapRec), 1);
- vp->mtrrEnabled = TRUE; /* default to enabled */
- vp->mtrrFrom = X_DEFAULT;
- vp->mtrrOptChecked = FALSE;
- vp->pScrn = pScrn;
- return vp;
-}
-
-static MappingPtr
-newMapping(VidMapPtr vp)
-{
- vp->mappings = xnfrealloc(vp->mappings, sizeof(MappingPtr) *
- (vp->numMappings + 1));
- vp->mappings[vp->numMappings] = xnfcalloc(sizeof(MappingRec), 1);
- return vp->mappings[vp->numMappings++];
-}
-
-static MappingPtr
-findMapping(VidMapPtr vp, void *vbase, unsigned long size)
-{
- int i;
-
- for (i = 0; i < vp->numMappings; i++) {
- if (vp->mappings[i]->virtBase == vbase && vp->mappings[i]->size == size)
- return vp->mappings[i];
- }
- return NULL;
-}
-
-static void
-removeMapping(VidMapPtr vp, MappingPtr mp)
-{
- int i, found = 0;
-
- for (i = 0; i < vp->numMappings; i++) {
- if (vp->mappings[i] == mp) {
- found = 1;
- free(vp->mappings[i]);
- }
- else if (found) {
- vp->mappings[i - 1] = vp->mappings[i];
- }
- }
- vp->numMappings--;
- vp->mappings[vp->numMappings] = NULL;
-}
-
-enum { OPTION_MTRR };
-
-static const OptionInfoRec opts[] = {
- {OPTION_MTRR, "mtrr", OPTV_BOOLEAN, {0}, FALSE},
- {-1, NULL, OPTV_NONE, {0}, FALSE}
-};
-
-static void
-checkMtrrOption(VidMapPtr vp)
-{
- if (!vp->mtrrOptChecked && vp->pScrn && vp->pScrn->options != NULL) {
- OptionInfoPtr options;
-
- options = xnfalloc(sizeof(opts));
- (void) memcpy(options, opts, sizeof(opts));
- xf86ProcessOptions(vp->pScrn->scrnIndex, vp->pScrn->options, options);
- if (xf86GetOptValBool(options, OPTION_MTRR, &vp->mtrrEnabled))
- vp->mtrrFrom = X_CONFIG;
- free(options);
- vp->mtrrOptChecked = TRUE;
- }
-}
void
xf86InitVidMem(void)
@@ -164,96 +52,3 @@ xf86InitVidMem(void)
xf86OSInitVidMem(&vidMemInfo);
}
}
-
-void *
-xf86MapVidMem(int ScreenNum, int Flags, unsigned long Base, unsigned long Size)
-{
- void *vbase = NULL;
- VidMapPtr vp;
- MappingPtr mp;
-
- if (((Flags & VIDMEM_FRAMEBUFFER) &&
- (Flags & (VIDMEM_MMIO | VIDMEM_MMIO_32BIT))))
- FatalError("Mapping memory with more than one type\n");
-
- xf86InitVidMem();
- if (!vidMemInfo.initialised || !vidMemInfo.mapMem)
- return NULL;
-
- vbase = vidMemInfo.mapMem(ScreenNum, Base, Size, Flags);
-
- if (!vbase || vbase == (void *) -1)
- return NULL;
-
- vp = getVidMapRec(ScreenNum);
- mp = newMapping(vp);
- mp->size = Size;
- mp->virtBase = vbase;
-
- /*
- * Check the "mtrr" option even when MTRR isn't supported to avoid
- * warnings about unrecognised options.
- */
- checkMtrrOption(vp);
-
- if (vp->mtrrEnabled && vidMemInfo.setWC) {
- if (Flags & (VIDMEM_MMIO | VIDMEM_MMIO_32BIT))
- mp->mtrrInfo =
- vidMemInfo.setWC(ScreenNum, Base, Size, FALSE, vp->mtrrFrom);
- else if (Flags & VIDMEM_FRAMEBUFFER)
- mp->mtrrInfo =
- vidMemInfo.setWC(ScreenNum, Base, Size, TRUE, vp->mtrrFrom);
- }
- return vbase;
-}
-
-void
-xf86UnMapVidMem(int ScreenNum, void *Base, unsigned long Size)
-{
- VidMapPtr vp;
- MappingPtr mp;
-
- if (!vidMemInfo.initialised || !vidMemInfo.unmapMem) {
- xf86DrvMsg(ScreenNum, X_WARNING,
- "xf86UnMapVidMem() called before xf86MapVidMem()\n");
- return;
- }
-
- vp = getVidMapRec(ScreenNum);
- mp = findMapping(vp, Base, Size);
- if (!mp) {
- xf86DrvMsg(ScreenNum, X_WARNING,
- "xf86UnMapVidMem: cannot find region for [%p,0x%lx]\n",
- Base, Size);
- return;
- }
- if (vp->mtrrEnabled && vidMemInfo.undoWC && mp)
- vidMemInfo.undoWC(ScreenNum, mp->mtrrInfo);
-
- vidMemInfo.unmapMem(ScreenNum, Base, Size);
- removeMapping(vp, mp);
-}
-
-Bool
-xf86CheckMTRR(int ScreenNum)
-{
- VidMapPtr vp = getVidMapRec(ScreenNum);
-
- /*
- * Check the "mtrr" option even when MTRR isn't supported to avoid
- * warnings about unrecognised options.
- */
- checkMtrrOption(vp);
-
- if (vp->mtrrEnabled && vidMemInfo.setWC)
- return TRUE;
-
- return FALSE;
-}
-
-Bool
-xf86LinearVidMem(void)
-{
- xf86InitVidMem();
- return vidMemInfo.linearSupported;
-}
diff --git a/xorg-server/hw/xfree86/os-support/shared/xf86Axp.c b/xorg-server/hw/xfree86/os-support/shared/xf86Axp.c
deleted file mode 100644
index 5f2f3985e..000000000
--- a/xorg-server/hw/xfree86/os-support/shared/xf86Axp.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2000 by The XFree86 Project, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) 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.
- *
- * Except as contained in this notice, the name of the copyright holder(s)
- * and author(s) shall not be used in advertising or otherwise to promote
- * the sale, use or other dealings in this Software without prior written
- * authorization from the copyright holder(s) and author(s).
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86Axp.h"
-
-axpParams xf86AXPParams[] = {
- {SYS_NONE, 0, 0, 0}
- ,
- {TSUNAMI, 0, 0, 0}
- ,
- {LCA, 1 << 24, 0xf8000000, 1UL << 32}
- ,
- {APECS, 1 << 24, 0xf8000000, 1UL << 32}
- ,
- {T2, 0, 0xFC000000, 1UL << 31}
- ,
- {T2_GAMMA, 0, 0xFC000000, 1UL << 31}
- ,
- {CIA, 0, 0xE0000000, 1UL << 34}
- ,
- {MCPCIA, 0, 0xf8000000, 1UL << 31}
- ,
- {JENSEN, 0, 0xE000000, 1UL << 32}
- ,
- {POLARIS, 0, 0, 0}
- ,
- {PYXIS, 0, 0, 0}
- ,
- {PYXIS_CIA, 0, 0xE0000000, 1UL << 34}
- ,
- {IRONGATE, 0, 0, 0}
-};
diff --git a/xorg-server/hw/xfree86/os-support/shared/xf86Axp.h b/xorg-server/hw/xfree86/os-support/shared/xf86Axp.h
deleted file mode 100644
index fded9d8c9..000000000
--- a/xorg-server/hw/xfree86/os-support/shared/xf86Axp.h
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#ifndef _XF86_AXP_H_
-#define _XF86_AXP_H_
-
-typedef enum {
- SYS_NONE,
- TSUNAMI,
- LCA,
- APECS,
- T2,
- T2_GAMMA,
- CIA,
- MCPCIA,
- JENSEN,
- POLARIS,
- PYXIS,
- PYXIS_CIA,
- IRONGATE
-} axpDevice;
-
-typedef struct {
- axpDevice id;
- unsigned long hae_thresh;
- unsigned long hae_mask;
- unsigned long size;
-} axpParams;
-
-extern axpParams xf86AXPParams[];
-
-#endif
diff --git a/xorg-server/hw/xfree86/os-support/solaris/sun_vid.c b/xorg-server/hw/xfree86/os-support/solaris/sun_vid.c
index fc464871d..25f76181c 100644
--- a/xorg-server/hw/xfree86/os-support/solaris/sun_vid.c
+++ b/xorg-server/hw/xfree86/os-support/solaris/sun_vid.c
@@ -63,152 +63,12 @@
/* Video Memory Mapping section */
/***************************************************************************/
-static char *apertureDevName = NULL;
-static int apertureDevFD_ro = -1;
-static int apertureDevFD_rw = -1;
-
-static Bool
-solOpenAperture(void)
-{
- if (apertureDevName == NULL) {
- apertureDevName = "/dev/xsvc";
- if ((apertureDevFD_rw = open(apertureDevName, O_RDWR)) < 0) {
- xf86MsgVerb(X_WARNING, 0,
- "solOpenAperture: failed to open %s (%s)\n",
- apertureDevName, strerror(errno));
- apertureDevName = "/dev/fbs/aperture";
- apertureDevFD_rw = open(apertureDevName, O_RDWR);
- }
- apertureDevFD_ro = open(apertureDevName, O_RDONLY);
-
- if ((apertureDevFD_rw < 0) || (apertureDevFD_ro < 0)) {
- xf86MsgVerb(X_WARNING, 0,
- "solOpenAperture: failed to open %s (%s)\n",
- apertureDevName, strerror(errno));
- xf86MsgVerb(X_WARNING, 0,
- "solOpenAperture: either /dev/fbs/aperture"
- " or /dev/xsvc required\n");
-
- apertureDevName = NULL;
-
- if (apertureDevFD_rw >= 0) {
- close(apertureDevFD_rw);
- }
- apertureDevFD_rw = -1;
-
- if (apertureDevFD_ro >= 0) {
- close(apertureDevFD_ro);
- }
- apertureDevFD_ro = -1;
-
- return FALSE;
- }
- }
- return TRUE;
-}
-
-static void *
-solMapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int Flags)
-{
- void *base;
- int fd;
- int prot;
-
- if (Flags & VIDMEM_READONLY) {
- fd = apertureDevFD_ro;
- prot = PROT_READ;
- }
- else {
- fd = apertureDevFD_rw;
- prot = PROT_READ | PROT_WRITE;
- }
-
- if (fd < 0) {
- xf86DrvMsg(ScreenNum, X_ERROR,
- "solMapVidMem: failed to open %s (%s)\n",
- apertureDevName, strerror(errno));
- return NULL;
- }
-
- base = mmap(NULL, Size, prot, MAP_SHARED, fd, (off_t) Base);
-
- if (base == MAP_FAILED) {
- xf86DrvMsg(ScreenNum, X_ERROR,
- "solMapVidMem: failed to mmap %s (0x%08lx,0x%lx) (%s)\n",
- apertureDevName, Base, Size, strerror(errno));
- return NULL;
- }
-
- return base;
-}
-
-/* ARGSUSED */
-static void
-solUnMapVidMem(int ScreenNum, void *Base, unsigned long Size)
-{
- if (munmap(Base, Size) != 0) {
- xf86DrvMsgVerb(ScreenNum, X_WARNING, 0,
- "solUnMapVidMem: failed to unmap %s"
- " (0x%p,0x%lx) (%s)\n",
- apertureDevName, Base, Size, strerror(errno));
- }
-}
-
_X_HIDDEN void
xf86OSInitVidMem(VidMemInfoPtr pVidMem)
{
- pVidMem->linearSupported = solOpenAperture();
- if (pVidMem->linearSupported) {
- pVidMem->mapMem = solMapVidMem;
- pVidMem->unmapMem = solUnMapVidMem;
- }
- else {
- xf86MsgVerb(X_WARNING, 0,
- "xf86OSInitVidMem: linear memory access disabled\n");
- }
pVidMem->initialised = TRUE;
}
-/*
- * Read BIOS via mmap()ing physical memory.
- */
-int
-xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
- int Len)
-{
- unsigned char *ptr;
- int psize;
- int mlen;
-
- psize = getpagesize();
- Offset += Base & (psize - 1);
- Base &= ~(psize - 1);
- mlen = (Offset + Len + psize - 1) & ~(psize - 1);
-
- if (solOpenAperture() == FALSE) {
- xf86Msg(X_WARNING,
- "xf86ReadBIOS: Failed to open aperture to read BIOS\n");
- return -1;
- }
-
- ptr = (unsigned char *) mmap(NULL, mlen, PROT_READ,
- MAP_SHARED, apertureDevFD_ro, (off_t) Base);
- if (ptr == MAP_FAILED) {
- xf86Msg(X_WARNING, "xf86ReadBIOS: %s mmap failed [0x%08lx, 0x%04x]\n",
- apertureDevName, Base, mlen);
- return -1;
- }
-
- (void) memcpy(Buf, (void *) (ptr + Offset), Len);
- if (munmap((caddr_t) ptr, mlen) != 0) {
- xf86MsgVerb(X_WARNING, 0,
- "xf86ReadBIOS: failed to unmap %s (0x%p,0x%x) (%s)\n",
- apertureDevName, ptr, mlen, strerror(errno));
- }
-
- return Len;
-}
-
/***************************************************************************/
/* I/O Permissions section */
/***************************************************************************/
diff --git a/xorg-server/hw/xfree86/os-support/stub/Makefile.am b/xorg-server/hw/xfree86/os-support/stub/Makefile.am
index a39e17d55..19468c6de 100644
--- a/xorg-server/hw/xfree86/os-support/stub/Makefile.am
+++ b/xorg-server/hw/xfree86/os-support/stub/Makefile.am
@@ -14,6 +14,5 @@ libstub_la_SOURCES = \
$(srcdir)/../shared/posix_tty.c \
$(srcdir)/../shared/sigio.c \
stub_bell.c \
- stub_bios.c \
stub_init.c \
stub_video.c
diff --git a/xorg-server/hw/xfree86/os-support/stub/stub_bios.c b/xorg-server/hw/xfree86/os-support/stub/stub_bios.c
deleted file mode 100644
index dbc92fcdb..000000000
--- a/xorg-server/hw/xfree86/os-support/stub/stub_bios.c
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86_OSlib.h"
-
-int
-xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
- int Len)
-{
- return -1;
-}
diff --git a/xorg-server/hw/xfree86/os-support/xf86OSpriv.h b/xorg-server/hw/xfree86/os-support/xf86OSpriv.h
index b56f45a3e..ce1ec33a1 100644
--- a/xorg-server/hw/xfree86/os-support/xf86OSpriv.h
+++ b/xorg-server/hw/xfree86/os-support/xf86OSpriv.h
@@ -32,19 +32,8 @@
#ifndef _XF86OSPRIV_H
#define _XF86OSPRIV_H
-typedef void *(*MapMemProcPtr) (int, unsigned long, unsigned long, int);
-typedef void (*UnmapMemProcPtr) (int, void *, unsigned long);
-typedef void *(*SetWCProcPtr) (int, unsigned long, unsigned long, Bool,
- MessageType);
-typedef void (*UndoWCProcPtr) (int, void *);
-
typedef struct {
Bool initialised;
- MapMemProcPtr mapMem;
- UnmapMemProcPtr unmapMem;
- SetWCProcPtr setWC;
- UndoWCProcPtr undoWC;
- Bool linearSupported;
} VidMemInfo, *VidMemInfoPtr;
void xf86OSInitVidMem(VidMemInfoPtr);
diff --git a/xorg-server/hw/xfree86/os-support/xf86_OSproc.h b/xorg-server/hw/xfree86/os-support/xf86_OSproc.h
index 8d27e8b7b..822bab2ca 100644
--- a/xorg-server/hw/xfree86/os-support/xf86_OSproc.h
+++ b/xorg-server/hw/xfree86/os-support/xf86_OSproc.h
@@ -74,24 +74,6 @@
*/
/*
- * Flags for xf86MapVidMem(). Multiple flags can be or'd together. The
- * flags may be used as hints. For example it would be permissible to
- * enable write combining for memory marked only for framebuffer use.
- */
-
-#define VIDMEM_FRAMEBUFFER 0x01 /* memory for framebuffer use */
-#define VIDMEM_MMIO 0x02 /* memory for I/O use */
-#define VIDMEM_MMIO_32BIT 0x04 /* memory accesses >= 32bit */
-#define VIDMEM_READSIDEEFFECT 0x08 /* reads can have side-effects */
-#define VIDMEM_SPARSE 0x10 /* sparse mapping required
- * assumed when VIDMEM_MMIO is
- * set. May be used with
- * VIDMEM_FRAMEBUFFER) */
-#define VIDMEM_READONLY 0x20 /* read-only mapping
- * used when reading BIOS images
- * through xf86MapVidMem() */
-
-/*
* OS-independent modem state flags for xf86SetSerialModemState() and
* xf86GetSerialModemState().
*/
@@ -130,14 +112,6 @@
_XFUNCPROTOBEGIN
/* public functions */
-extern _X_EXPORT Bool xf86LinearVidMem(void);
-extern _X_EXPORT _X_DEPRECATED Bool xf86CheckMTRR(int);
-extern _X_EXPORT _X_DEPRECATED void *xf86MapVidMem(int, int, unsigned long,
- unsigned long);
-extern _X_EXPORT _X_DEPRECATED void xf86UnMapVidMem(int, void *,
- unsigned long);
-extern _X_EXPORT int xf86ReadBIOS(unsigned long, unsigned long, unsigned char *,
- int);
extern _X_EXPORT Bool xf86EnableIO(void);
extern _X_EXPORT void xf86DisableIO(void);
diff --git a/xorg-server/hw/xwayland/Makefile.am b/xorg-server/hw/xwayland/Makefile.am
index dc16b8bbe..4e0e1bb00 100644
--- a/xorg-server/hw/xwayland/Makefile.am
+++ b/xorg-server/hw/xwayland/Makefile.am
@@ -39,8 +39,6 @@ nodist_Xwayland_SOURCES = \
CLEANFILES = $(nodist_Xwayland_SOURCES)
-EXTRA_DIST = drm.xml
-
xwayland-glamor.c : $(nodist_Xwayland_SOURCES)
glamor_lib = $(top_builddir)/glamor/libglamor.la
@@ -48,6 +46,8 @@ glamor_lib = $(top_builddir)/glamor/libglamor.la
Xwayland_LDADD += $(GLAMOR_LIBS) $(GBM_LIBS) -lEGL -lGL
endif
+EXTRA_DIST = drm.xml
+
relink:
$(AM_V_at)rm -f Xwayland$(EXEEXT) && $(MAKE) Xwayland$(EXEEXT)
diff --git a/xorg-server/hw/xwayland/xwayland-input.c b/xorg-server/hw/xwayland/xwayland-input.c
index cc5f7df05..b8c543ce4 100644
--- a/xorg-server/hw/xwayland/xwayland-input.c
+++ b/xorg-server/hw/xwayland/xwayland-input.c
@@ -152,6 +152,15 @@ pointer_handle_enter(void *data, struct wl_pointer *pointer,
ScreenPtr pScreen = xwl_seat->xwl_screen->screen;
ValuatorMask mask;
+ /* There's a race here where if we create and then immediately
+ * destroy a surface, we might end up in a state where the Wayland
+ * compositor sends us an event for a surface that doesn't exist.
+ *
+ * Don't process enter events in this case.
+ */
+ if (surface == NULL)
+ return;
+
xwl_seat->xwl_screen->serial = serial;
xwl_seat->pointer_enter_serial = serial;
diff --git a/xorg-server/hw/xwayland/xwayland.c b/xorg-server/hw/xwayland/xwayland.c
index 17b7bf7fd..913296947 100644
--- a/xorg-server/hw/xwayland/xwayland.c
+++ b/xorg-server/hw/xwayland/xwayland.c
@@ -308,6 +308,9 @@ xwl_unrealize_window(WindowPtr window)
xorg_list_del(&xwl_window->link_damage);
DamageUnregister(xwl_window->damage);
DamageDestroy(xwl_window->damage);
+ if (xwl_window->frame_callback)
+ wl_callback_destroy(xwl_window->frame_callback);
+
free(xwl_window);
dixSetPrivate(&window->devPrivates, &xwl_window_private_key, NULL);
@@ -321,20 +324,35 @@ xwl_save_screen(ScreenPtr pScreen, int on)
}
static void
+frame_callback(void *data,
+ struct wl_callback *callback,
+ uint32_t time)
+{
+ struct xwl_window *xwl_window = data;
+ xwl_window->frame_callback = NULL;
+}
+
+static const struct wl_callback_listener frame_listener = {
+ frame_callback
+};
+
+static void
xwl_screen_post_damage(struct xwl_screen *xwl_screen)
{
- struct xwl_window *xwl_window;
+ struct xwl_window *xwl_window, *next_xwl_window;
RegionPtr region;
BoxPtr box;
- int count, i;
struct wl_buffer *buffer;
PixmapPtr pixmap;
- xorg_list_for_each_entry(xwl_window, &xwl_screen->damage_window_list,
- link_damage) {
- region = DamageRegion(xwl_window->damage);
- count = RegionNumRects(region);
+ xorg_list_for_each_entry_safe(xwl_window, next_xwl_window,
+ &xwl_screen->damage_window_list, link_damage) {
+ /* If we're waiting on a frame callback from the server,
+ * don't attach a new buffer. */
+ if (xwl_window->frame_callback)
+ continue;
+ region = DamageRegion(xwl_window->damage);
pixmap = (*xwl_screen->screen->GetWindowPixmap) (xwl_window->window);
#if GLAMOR_HAS_GBM
@@ -345,17 +363,19 @@ xwl_screen_post_damage(struct xwl_screen *xwl_screen)
buffer = xwl_shm_pixmap_get_wl_buffer(pixmap);
wl_surface_attach(xwl_window->surface, buffer, 0, 0);
- for (i = 0; i < count; i++) {
- box = &RegionRects(region)[i];
- wl_surface_damage(xwl_window->surface,
- box->x1, box->y1,
- box->x2 - box->x1, box->y2 - box->y1);
- }
+
+ box = RegionExtents(region);
+ wl_surface_damage(xwl_window->surface, box->x1, box->y1,
+ box->x2 - box->x1, box->y2 - box->y1);
+
+ xwl_window->frame_callback = wl_surface_frame(xwl_window->surface);
+ wl_callback_add_listener(xwl_window->frame_callback, &frame_listener, xwl_window);
+
wl_surface_commit(xwl_window->surface);
DamageEmpty(xwl_window->damage);
- }
- xorg_list_init(&xwl_screen->damage_window_list);
+ xorg_list_del(&xwl_window->link_damage);
+ }
}
static void
diff --git a/xorg-server/hw/xwayland/xwayland.h b/xorg-server/hw/xwayland/xwayland.h
index 60b0c2964..bfffa712f 100644
--- a/xorg-server/hw/xwayland/xwayland.h
+++ b/xorg-server/hw/xwayland/xwayland.h
@@ -102,6 +102,7 @@ struct xwl_window {
WindowPtr window;
DamagePtr damage;
struct xorg_list link_damage;
+ struct wl_callback *frame_callback;
};
#define MODIFIER_META 0x01
diff --git a/xorg-server/hw/xwin/Makefile.am b/xorg-server/hw/xwin/Makefile.am
index c53f6098a..326ffa03d 100644..100755
--- a/xorg-server/hw/xwin/Makefile.am
+++ b/xorg-server/hw/xwin/Makefile.am
@@ -15,7 +15,7 @@ if XWIN_GLX_WINDOWS
GLX_DIR = glx
DEFS_GLX_WINDOWS = -DXWIN_GLX_WINDOWS
XWIN_GLX_LIBS = $(top_builddir)/hw/xwin/glx/libXwinGLX.la
-XWIN_GLX_LINK_FLAGS = -lopengl32
+XWIN_GLX_SYS_LIBS = -lopengl32
endif
if XWIN_MULTIWINDOW
@@ -27,7 +27,7 @@ SRCS_MULTIWINDOW = \
propertystore.h \
winSetAppUserModelID.c
DEFS_MULTIWINDOW = -DXWIN_MULTIWINDOW
-MULTIWINDOW_LIBS = -lshlwapi -lole32
+MULTIWINDOW_SYS_LIBS = -lshlwapi -lole32
endif
if XWIN_MULTIWINDOWEXTWM
@@ -127,6 +127,7 @@ SRCS = InitInput.c \
winresource.h \
winwindow.h \
windisplay.c \
+ windisplay.h \
XWin.rc \
$(top_srcdir)/mi/miinitext.c \
$(SRCS_CLIPBOARD) \
@@ -151,11 +152,28 @@ XWin_SOURCES = $(SRCS)
AM_CPPFLAGS = -I$(top_srcdir)/miext/rootless
XWIN_SYS_LIBS += -ldxguid
-XWIN_LIBS += $(top_builddir)/pseudoramiX/libPseudoramiX.la \
- $(top_builddir)/Xext/libXextdpmsstubs.la \
- $(top_builddir)/Xi/libXistubs.la
-XWin_DEPENDENCIES = $(MULTIWINDOWEXTWM_LIBS) $(XWIN_GLX_LIBS) $(XWIN_LIBS) $(XSERVER_LIBS)
-XWin_LDADD = $(MULTIWINDOW_LIBS) $(MULTIWINDOWEXTWM_LIBS) $(XWIN_GLX_LIBS) $(XWIN_GLX_LINK_FLAGS) $(XWIN_LIBS) $(MAIN_LIB) $(XSERVER_LIBS) $(XSERVER_SYS_LIBS) $(XWIN_SYS_LIBS)
+
+XWIN_LIBS += \
+ $(top_builddir)/pseudoramiX/libPseudoramiX.la \
+ $(top_builddir)/Xext/libXextdpmsstubs.la \
+ $(top_builddir)/Xi/libXistubs.la
+
+XWin_DEPENDENCIES = \
+ $(MULTIWINDOWEXTWM_LIBS) \
+ $(XWIN_GLX_LIBS) \
+ $(XWIN_LIBS) \
+ $(XSERVER_LIBS)
+
+XWin_LDADD = \
+ $(MULTIWINDOWEXTWM_LIBS) \
+ $(XWIN_GLX_LIBS) \
+ $(XWIN_LIBS) \
+ $(XSERVER_LIBS) \
+ $(XWIN_GLX_SYS_LIBS) \
+ $(XSERVER_SYS_LIBS) \
+ $(XWIN_SYS_LIBS) \
+ $(MULTIWINDOW_SYS_LIBS)
+
XWin_LDFLAGS = -mwindows -Wl,--disable-stdcall-fixup $(LD_EXPORT_SYMBOLS_FLAG)
diff --git a/xorg-server/hw/xwin/glx/.gitignore b/xorg-server/hw/xwin/glx/.gitignore
index 70c5283ce..70c5283ce 100644..100755
--- a/xorg-server/hw/xwin/glx/.gitignore
+++ b/xorg-server/hw/xwin/glx/.gitignore
diff --git a/xorg-server/hw/xwin/glx/glwindows.h b/xorg-server/hw/xwin/glx/glwindows.h
index 42adc5b60..1430bef2b 100644
--- a/xorg-server/hw/xwin/glx/glwindows.h
+++ b/xorg-server/hw/xwin/glx/glwindows.h
@@ -28,6 +28,9 @@
* DEALINGS IN THE SOFTWARE.
*/
+#ifndef GLWINDOWS_H
+#define GLWINDOWS_H
+
#include <GL/gl.h>
typedef struct {
@@ -62,3 +65,5 @@ void glWinSetupDispatchTable(void);
#define GLWIN_TRACE_MSG(a, ...)
#define GLWIN_DEBUG_MSG(a, ...)
#endif
+
+#endif
diff --git a/xorg-server/hw/xwin/glx/indirect.c b/xorg-server/hw/xwin/glx/indirect.c
index b12fa7d68..ada61561b 100755
--- a/xorg-server/hw/xwin/glx/indirect.c
+++ b/xorg-server/hw/xwin/glx/indirect.c
@@ -788,9 +788,6 @@ glxWinScreenProbe(ScreenPtr pScreen)
__glXScreenInit(&screen->base, pScreen);
- // Override the GL extensions string set by __glXScreenInit()
- screen->base.GLextensions = strdup(gl_extensions);
-
// Generate the GLX extensions string (overrides that set by __glXScreenInit())
{
unsigned int buffer_size =
@@ -1016,13 +1013,6 @@ glxWinDrawableSwapBuffers(ClientPtr client, __GLXdrawable * base)
("glxWinSwapBuffers on drawable %p, last context %p (native ctx %p)",
base, draw->drawContext, draw->drawContext->ctx);
- /*
- draw->drawContext->base.drawPriv will not be set if the context is not current anymore,
- but if it is, it should point to this drawable....
- */
- assert((draw->drawContext->base.drawPriv == NULL) ||
- (draw->drawContext->base.drawPriv == base));
-
ret = SwapBuffers(draw->drawContext->hDC);
if (!ret) {
@@ -1458,7 +1448,7 @@ glxWinDeferredCreateContext(__GLXWinContext * gc, __GLXWinDrawable * draw)
glxWinScreen *winScreen;
int pixelFormat;
- // XXX: which DC are supposed to use???
+ // XXX: which DC are we supposed to use???
ScreenPtr pScreen = pWin->drawable.pScreen;
winPrivScreenPtr pWinScreen = winGetScreenPriv(pScreen);
HDC screenDC=pWinScreen->hdcScreen;
@@ -1475,8 +1465,6 @@ glxWinDeferredCreateContext(__GLXWinContext * gc, __GLXWinDrawable * draw)
fbConfigToPixelFormatIndex(screenDC, gc->base.config,
GLX_PBUFFER_BIT, winScreen);
if (pixelFormat == 0) {
- ErrorF("wglChoosePixelFormat error: %s\n",
- glxWinErrorMessage());
return;
}
@@ -1937,7 +1925,7 @@ fbConfigToPixelFormatIndex(HDC hdc, __GLXconfig * mode,
SET_ATTR_VALUE(WGL_SWAP_METHOD_ARB, WGL_SWAP_EXCHANGE_ARB);
if (mode->swapMethod == GLX_SWAP_COPY_OML)
- SET_ATTR_VALUE(WGL_SWAP_COPY_ARB, TRUE);
+ SET_ATTR_VALUE(WGL_SWAP_METHOD_ARB, WGL_SWAP_COPY_ARB);
// XXX: this should probably be the other way around, but that messes up drawableTypeOverride
if (mode->visualRating == GLX_SLOW_VISUAL_EXT)
diff --git a/xorg-server/hw/xwin/glx/winpriv.c b/xorg-server/hw/xwin/glx/winpriv.c
index 1b8ec5a4a..1b8ec5a4a 100644..100755
--- a/xorg-server/hw/xwin/glx/winpriv.c
+++ b/xorg-server/hw/xwin/glx/winpriv.c
diff --git a/xorg-server/hw/xwin/winclipboardthread.c b/xorg-server/hw/xwin/winclipboardthread.c
index 488a00fcc..735025eb2 100644..100755
--- a/xorg-server/hw/xwin/winclipboardthread.c
+++ b/xorg-server/hw/xwin/winclipboardthread.c
@@ -38,6 +38,7 @@
#include <sys/types.h>
#include <signal.h>
#include "winclipboard.h"
+#include "windisplay.h"
#ifdef __CYGWIN__
#include <errno.h>
#endif
@@ -157,7 +158,7 @@ winClipboardProc(void *pvNotUsed)
* for all screens on the display. That is why there is only
* one clipboard client thread.
*/
- winGetDisplayName(szDisplay,0);
+ winGetDisplayName(szDisplay, 0);
/* Print the display connection string */
winDebug ("winClipboardProc - DISPLAY=%s\n", szDisplay);
diff --git a/xorg-server/hw/xwin/windisplay.c b/xorg-server/hw/xwin/windisplay.c
index db7b2f4d8..d92369850 100644..100755
--- a/xorg-server/hw/xwin/windisplay.c
+++ b/xorg-server/hw/xwin/windisplay.c
@@ -1,4 +1,7 @@
/*
+ * File: windisplay.c
+ * Purpose: Retrieve server display name
+ *
* Copyright (C) Jon TURNEY 2009
*
* Permission is hereby granted, free of charge, to any person obtaining a
@@ -25,9 +28,14 @@
#ifdef HAVE_XWIN_CONFIG_H
#include <xwin-config.h>
#endif
-#include "win.h"
-#include <X11/Xwindows.h>
+#include <opaque.h> // for display
+#include "windisplay.h"
+#include "winmsg.h"
+
+#define XSERV_t
+#define TRANS_SERVER
+#include <X11/Xtrans/Xtrans.h>
/*
Generate a display name string referring to the display of this server,
@@ -37,24 +45,20 @@
void
winGetDisplayName(char *szDisplay, unsigned int screen)
{
- if (TransIsListening("local"))
- {
- snprintf(szDisplay, 512, ":%s.%d", display, screen);
+ if (_XSERVTransIsListening("local")) {
+ snprintf(szDisplay, 512, ":%s.%d", display, screen);
}
- else if (TransIsListening("inet"))
- {
- snprintf(szDisplay, 512, "127.0.0.1:%s.%d", display, screen);
+ else if (_XSERVTransIsListening("inet")) {
+ snprintf(szDisplay, 512, "127.0.0.1:%s.%d", display, screen);
}
- else if (TransIsListening("inet6"))
- {
- snprintf(szDisplay, 512, "[::1]:%s.%d", display, screen);
+ else if (_XSERVTransIsListening("inet6")) {
+ snprintf(szDisplay, 512, "[::1]:%s.%d", display, screen);
}
- else
- {
- // this can't happen!
- winDebug ("winGetDisplay: Don't know what to use for DISPLAY\n");
- snprintf(szDisplay, 512, "localhost:%s.%d", display, screen);
+ else {
+ // this can't happen!
+ winDebug("winGetDisplay: Don't know what to use for DISPLAY\n");
+ snprintf(szDisplay, 512, "localhost:%s.%d", display, screen);
}
- winDebug ("winGetDisplay: DISPLAY=%s\n", szDisplay);
+ winDebug("winGetDisplay: DISPLAY=%s\n", szDisplay);
}
diff --git a/xorg-server/hw/xwin/windisplay.h b/xorg-server/hw/xwin/windisplay.h
new file mode 100644
index 000000000..d1d4549bf
--- /dev/null
+++ b/xorg-server/hw/xwin/windisplay.h
@@ -0,0 +1,34 @@
+/*
+ * File: windisplay.h
+ * Purpose: Interface to retrieve server display name
+ *
+ * Copyright (C) Jon TURNEY 2009
+ *
+ * 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.
+ *
+ */
+
+#ifndef WINDISPLAY_H
+#define WINDISPLAY_H
+
+void
+winGetDisplayName(char *szDisplay, unsigned int screen);
+
+#endif /* !WINDISPLAY_H */
diff --git a/xorg-server/hw/xwin/winmsg.h b/xorg-server/hw/xwin/winmsg.h
index beb6683ed..b3c5d7054 100644
--- a/xorg-server/hw/xwin/winmsg.h
+++ b/xorg-server/hw/xwin/winmsg.h
@@ -30,6 +30,8 @@
* Authors: Alexander Gottwald
*/
+#include <X11/Xwindows.h>
+
/*
* Function prototypes
*/
diff --git a/xorg-server/hw/xwin/winmultiwindowwm.c b/xorg-server/hw/xwin/winmultiwindowwm.c
index 45aa93016..d35f048e3 100755
--- a/xorg-server/hw/xwin/winmultiwindowwm.c
+++ b/xorg-server/hw/xwin/winmultiwindowwm.c
@@ -65,6 +65,7 @@ typedef int pid_t;
#include "windowstr.h"
#include "winmultiwindowclass.h"
#include "winglobals.h"
+#include "windisplay.h"
#ifdef XWIN_MULTIWINDOWEXTWM
#define _WINDOWSWM_SERVER_
@@ -983,7 +984,7 @@ winMultiWindowXMsgProc(void *pArg)
}
/* Setup the display connection string x */
- winGetDisplayName(pszDisplay, (int)pProcArg->dwScreen);
+ winGetDisplayName(pszDisplay, (int) pProcArg->dwScreen);
/* Print the display connection string */
winDebug("winMultiWindowXMsgProc - DISPLAY=%s\n", pszDisplay);
@@ -1382,7 +1383,7 @@ winInitMultiWindowWM(WMInfoPtr pWMInfo, WMProcArgPtr pProcArg)
}
/* Setup the display connection string x */
- winGetDisplayName(pszDisplay, (int)pProcArg->dwScreen);
+ winGetDisplayName(pszDisplay, (int) pProcArg->dwScreen);
/* Print the display connection string */
winDebug("winInitMultiWindowWM - DISPLAY=%s\n", pszDisplay);
diff --git a/xorg-server/hw/xwin/winprefs.c b/xorg-server/hw/xwin/winprefs.c
index 3d21066f4..533230ed0 100644..100755
--- a/xorg-server/hw/xwin/winprefs.c
+++ b/xorg-server/hw/xwin/winprefs.c
@@ -44,6 +44,7 @@
#include <shellapi.h>
#include "winprefs.h"
+#include "windisplay.h"
#include "winmultiwindowclass.h"
/* Where will the custom menu commands start counting from? */
diff --git a/xorg-server/hw/xwin/winshadddnl.c b/xorg-server/hw/xwin/winshadddnl.c
index 047482e09..c7db77bac 100644
--- a/xorg-server/hw/xwin/winshadddnl.c
+++ b/xorg-server/hw/xwin/winshadddnl.c
@@ -983,6 +983,10 @@ winRedrawScreenShadowDDNL(ScreenPtr pScreen)
RECT rcSrc, rcDest;
POINT ptOrigin;
+ /* Return immediately if we didn't get needed surfaces */
+ if (!pScreenPriv->pddsPrimary4 || !pScreenPriv->pddsShadow4)
+ return;
+
/* Get the origin of the window in the screen coords */
ptOrigin.x = pScreenInfo->dwXOffset;
ptOrigin.y = pScreenInfo->dwYOffset;
diff --git a/xorg-server/include/dix-config.h.in b/xorg-server/include/dix-config.h.in
index 2203f82b4..4268b8f2e 100644
--- a/xorg-server/include/dix-config.h.in
+++ b/xorg-server/include/dix-config.h.in
@@ -57,9 +57,6 @@
/* Support SHM */
#undef HAS_SHM
-/* Define to 1 if you have the <asm/mtrr.h> header file. */
-#undef HAVE_ASM_MTRR_H
-
/* Has backtrace support */
#undef HAVE_BACKTRACE
diff --git a/xorg-server/include/pixmap.h b/xorg-server/include/pixmap.h
index f3c2c60c0..4b8fc244d 100755
--- a/xorg-server/include/pixmap.h
+++ b/xorg-server/include/pixmap.h
@@ -120,6 +120,12 @@ PixmapStartDirtyTracking(PixmapPtr src,
PixmapPtr slave_dst,
int x, int y);
+#define HAS_DIRTYTRACKING2 1
+extern _X_EXPORT Bool
+PixmapStartDirtyTracking2(PixmapPtr src,
+ PixmapPtr slave_dst,
+ int x, int y, int dst_x, int dst_y);
+
extern _X_EXPORT Bool
PixmapStopDirtyTracking(PixmapPtr src, PixmapPtr slave_dst);
diff --git a/xorg-server/include/pixmapstr.h b/xorg-server/include/pixmapstr.h
index d933a5916..1c0da7162 100644
--- a/xorg-server/include/pixmapstr.h
+++ b/xorg-server/include/pixmapstr.h
@@ -88,6 +88,7 @@ typedef struct _PixmapDirtyUpdate {
int x, y;
DamagePtr damage;
struct xorg_list ent;
+ int dst_x, dst_y;
} PixmapDirtyUpdateRec;
static inline void
diff --git a/xorg-server/include/registry.h b/xorg-server/include/registry.h
index 96be87aad..43c3db339 100644
--- a/xorg-server/include/registry.h
+++ b/xorg-server/include/registry.h
@@ -17,18 +17,26 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#define XREGISTRY_UNKNOWN "<unknown>"
-#ifdef XREGISTRY
-
#include "resource.h"
#include "extnsionst.h"
+#if defined(XSELINUX) || defined(RES)
+#define X_REGISTRY_RESOURCE 1
+#endif
+
+#if defined(XSELINUX) || defined(XCSECURITY)
+#define X_REGISTRY_REQUEST 1
+#endif
+
/* Internal string registry - for auditing, debugging, security, etc. */
-/*
- * Registration functions. The name string is not copied, so it must
- * not be a stack variable.
- */
+#ifdef X_REGISTRY_RESOURCE
+/* Functions used by the X-Resource extension */
extern _X_EXPORT void RegisterResourceName(RESTYPE type, const char *name);
+extern _X_EXPORT const char *LookupResourceName(RESTYPE rtype);
+#endif
+
+#ifdef X_REGISTRY_REQUEST
extern _X_EXPORT void RegisterExtensionNames(ExtensionEntry * ext);
/*
@@ -38,29 +46,13 @@ extern _X_EXPORT const char *LookupMajorName(int major);
extern _X_EXPORT const char *LookupRequestName(int major, int minor);
extern _X_EXPORT const char *LookupEventName(int event);
extern _X_EXPORT const char *LookupErrorName(int error);
-extern _X_EXPORT const char *LookupResourceName(RESTYPE rtype);
+#endif
/*
* Setup and teardown
*/
extern _X_EXPORT void dixResetRegistry(void);
extern _X_EXPORT void dixFreeRegistry(void);
+extern _X_EXPORT void dixCloseRegistry(void);
-#else /* XREGISTRY */
-
-/* Define calls away when the registry is not being built. */
-
-#define RegisterResourceName(a, b) { ; }
-#define RegisterExtensionNames(a) { ; }
-
-#define LookupMajorName(a) XREGISTRY_UNKNOWN
-#define LookupRequestName(a, b) XREGISTRY_UNKNOWN
-#define LookupEventName(a) XREGISTRY_UNKNOWN
-#define LookupErrorName(a) XREGISTRY_UNKNOWN
-#define LookupResourceName(a) XREGISTRY_UNKNOWN
-
-#define dixResetRegistry() { ; }
-#define dixFreeRegistry() { ; }
-
-#endif /* XREGISTRY */
#endif /* DIX_REGISTRY_H */
diff --git a/xorg-server/include/xorg-config.h.in b/xorg-server/include/xorg-config.h.in
index 629ae4057..7c03126e1 100644
--- a/xorg-server/include/xorg-config.h.in
+++ b/xorg-server/include/xorg-config.h.in
@@ -82,12 +82,6 @@
/* Building vgahw module */
#undef WITH_VGAHW
-/* Define to 1 if NetBSD built-in MTRR support is available */
-#undef HAS_MTRR_BUILTIN
-
-/* Define to 1 if BSD MTRR support is available */
-#undef HAS_MTRR_SUPPORT
-
/* NetBSD PIO alpha IO */
#undef USE_ALPHA_PIO
diff --git a/xorg-server/os/log.c b/xorg-server/os/log.c
index 1ecea13e9..af6c285af 100644
--- a/xorg-server/os/log.c
+++ b/xorg-server/os/log.c
@@ -195,15 +195,15 @@ strlen_sigsafe(const char *s)
* string.
*/
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+
const char *
LogInit(const char *fname, const char *backup)
{
char *logFileName = NULL;
if (fname && *fname) {
-#if __GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ > 2
-#pragma GCC diagnostic ignored "-Wformat-nonliteral"
-#endif
if (asprintf(&logFileName, fname, display) == -1)
FatalError("Cannot allocate space for the log file name\n");
@@ -214,9 +214,6 @@ LogInit(const char *fname, const char *backup)
char *suffix;
char *oldLog;
-#if __GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ > 2
-#pragma GCC diagnostic ignored "-Wformat-nonliteral"
-#endif
if ((asprintf(&suffix, backup, display) == -1) ||
(asprintf(&oldLog, "%s%s", logFileName, suffix) == -1))
FatalError("Cannot allocate space for the log file name\n");
@@ -260,6 +257,7 @@ LogInit(const char *fname, const char *backup)
return logFileName;
}
+#pragma GCC diagnostic pop
void
LogClose(enum ExitCode error)
diff --git a/xorg-server/os/utils.c b/xorg-server/os/utils.c
index 0e231537a..ce70a9422 100755
--- a/xorg-server/os/utils.c
+++ b/xorg-server/os/utils.c
@@ -197,7 +197,7 @@ Bool noGEExtension = FALSE;
Bool CoreDump;
-Bool enableIndirectGLX = TRUE;
+Bool enableIndirectGLX = FALSE;
#ifdef PANORAMIX
Bool PanoramiXExtensionDisabledHack = FALSE;
@@ -567,8 +567,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("+iglx Allow creating indirect GLX contexts\n");
+ ErrorF("-iglx Prohibit creating indirect GLX contexts (default)\n");
ErrorF("-I ignore all remaining arguments\n");
#ifdef RLIMIT_DATA
ErrorF("-ld int limit data space to N Kb\n");
diff --git a/xorg-server/present/present.c b/xorg-server/present/present.c
index c0b83f705..e82cfe656 100644
--- a/xorg-server/present/present.c
+++ b/xorg-server/present/present.c
@@ -837,7 +837,10 @@ present_pixmap(WindowPtr window,
if (!screen_priv->info || !(screen_priv->info->capabilities & PresentCapabilityAsync))
vblank->sync_flip = TRUE;
- if (pixmap && present_check_flip (target_crtc, window, pixmap, vblank->sync_flip, valid, x_off, y_off)) {
+ if (!(options & PresentOptionCopy) &&
+ pixmap != NULL &&
+ present_check_flip (target_crtc, window, pixmap, vblank->sync_flip, valid, x_off, y_off))
+ {
vblank->flip = TRUE;
if (vblank->sync_flip)
target_msc--;
@@ -935,11 +938,12 @@ present_flip_destroy(ScreenPtr screen)
{
present_screen_priv_ptr screen_priv = present_screen_priv(screen);
- /* XXX this needs to be synchronous for server reset */
-
- /* Do the actual cleanup once the flip has been performed by the hardware */
+ /* Reset window pixmaps back to the screen pixmap */
if (screen_priv->flip_pending)
present_set_abort_flip(screen);
+
+ /* Drop reference to any pending flip or unflip pixmaps. */
+ present_flip_idle(screen);
}
void
diff --git a/xorg-server/present/present.h b/xorg-server/present/present.h
index 0e3bdc08e..aab2e168a 100644
--- a/xorg-server/present/present.h
+++ b/xorg-server/present/present.h
@@ -116,6 +116,7 @@ extern _X_EXPORT Bool
present_screen_init(ScreenPtr screen, present_screen_info_ptr info);
typedef void (*present_complete_notify_proc)(WindowPtr window,
+ CARD8 kind,
CARD8 mode,
CARD32 serial,
uint64_t ust,
diff --git a/xorg-server/present/present_event.c b/xorg-server/present/present_event.c
index 5582e51a6..8457a877c 100644
--- a/xorg-server/present/present_event.c
+++ b/xorg-server/present/present_event.c
@@ -172,7 +172,7 @@ present_send_complete_notify(WindowPtr window, CARD8 kind, CARD8 mode, CARD32 se
}
}
if (complete_notify)
- (*complete_notify)(window, mode, serial, ust, msc);
+ (*complete_notify)(window, kind, mode, serial, ust, msc);
}
void
diff --git a/xorg-server/test/Makefile.am b/xorg-server/test/Makefile.am
index 32edc7a3b..83442767a 100644
--- a/xorg-server/test/Makefile.am
+++ b/xorg-server/test/Makefile.am
@@ -5,7 +5,10 @@ if XORG
# Tests that require at least some DDX functions in order to fully link
# For now, requires xf86 ddx, could be adjusted to use another
SUBDIRS += xi2
-noinst_PROGRAMS += xkb input xtest misc fixes xfree86 hashtabletest os signal-logging touch
+noinst_PROGRAMS += xkb input xtest misc fixes xfree86 os signal-logging touch
+if RES
+noinst_PROGRAMS += hashtabletest
+endif
endif
check_LTLIBRARIES = libxservertest.la
diff --git a/xorg-server/test/list.c b/xorg-server/test/list.c
index f9f54ee4e..28d9609ef 100644
--- a/xorg-server/test/list.c
+++ b/xorg-server/test/list.c
@@ -249,15 +249,15 @@ test_nt_list_append(void)
/* Test using nt_list_next */
for (item = foo, i = 1; i <= 10; i++, item = nt_list_next(item, next)) {
- assert(item->a = i);
- assert(item->b = i * 2);
+ assert(item->a == i);
+ assert(item->b == i * 2);
}
/* Test using nt_list_for_each_entry */
i = 1;
nt_list_for_each_entry(item, foo, next) {
- assert(item->a = i);
- assert(item->b = i * 2);
+ assert(item->a == i);
+ assert(item->b == i * 2);
i++;
}
assert(i == 11);
@@ -270,11 +270,11 @@ test_nt_list_insert(void)
struct foo *foo = calloc(10, sizeof(struct foo));
struct foo *item;
- foo->a = 10;
- foo->b = 20;
+ foo->a = 1;
+ foo->b = 2;
nt_list_init(foo, next);
- for (item = &foo[1], i = 9; i > 0; i--, item++) {
+ for (item = &foo[1], i = 10; i > 1; i--, item++) {
item->a = i;
item->b = i * 2;
nt_list_init(item, next);
@@ -282,16 +282,16 @@ test_nt_list_insert(void)
}
/* Test using nt_list_next */
- for (item = foo, i = 10; i > 0; i--, item = nt_list_next(item, next)) {
- assert(item->a = i);
- assert(item->b = i * 2);
+ for (item = foo, i = 1; i <= 10; i++, item = nt_list_next(item, next)) {
+ assert(item->a == i);
+ assert(item->b == i * 2);
}
/* Test using nt_list_for_each_entry */
i = 1;
nt_list_for_each_entry(item, foo, next) {
- assert(item->a = i);
- assert(item->b = i * 2);
+ assert(item->a == i);
+ assert(item->b == i * 2);
i++;
}
assert(i == 11);
diff --git a/xorg-server/test/signal-logging.c b/xorg-server/test/signal-logging.c
index 432012195..3d2d04801 100644
--- a/xorg-server/test/signal-logging.c
+++ b/xorg-server/test/signal-logging.c
@@ -113,12 +113,13 @@ double float_tests[] = { 0, 5, 0.1, 0.01, 5.2342, 10.2301,
-1, -2.00, -0.6023, -1203.30
};
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Woverflow"
+
static void
number_formatting(void)
{
int i;
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Woverflow"
long unsigned int unsigned_tests[] = { 0,/* Zero */
5, /* Single digit number */
12, /* Two digit decimal number */
@@ -141,7 +142,6 @@ number_formatting(void)
-0x15D027BF211B37A, /* Large > 32 bit number */
-0x7FFFFFFFFFFFFFFF, /* Maximum 64-bit signed number */
} ;
-#pragma GCC diagnostic pop
for (i = 0; i < sizeof(unsigned_tests) / sizeof(unsigned_tests[0]); i++)
assert(check_number_format_test(unsigned_tests[i]));
@@ -152,6 +152,7 @@ number_formatting(void)
for (i = 0; i < sizeof(float_tests) / sizeof(float_tests[0]); i++)
assert(check_float_format_test(float_tests[i]));
}
+#pragma GCC diagnostic pop
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-security"
diff --git a/xorg-server/xkeyboard-config/rules/base.extras.xml.in b/xorg-server/xkeyboard-config/rules/base.extras.xml.in
index 2bda88ba7..2e1e89d6b 100644
--- a/xorg-server/xkeyboard-config/rules/base.extras.xml.in
+++ b/xorg-server/xkeyboard-config/rules/base.extras.xml.in
@@ -8,7 +8,9 @@
<name>apl</name>
<_shortDescription>apl</_shortDescription>
<_description>APL keyboard symbols</_description>
- <languageList><iso639Id>eng</iso639Id></languageList>
+ <languageList>
+ <iso639Id>eng</iso639Id>
+ </languageList>
</configItem>
<variantList>
<variant>
@@ -60,7 +62,9 @@
<name>ca</name>
<_shortDescription>fr</_shortDescription>
<_description>French (Canada)</_description>
- <languageList><iso639Id>fra</iso639Id></languageList>
+ <languageList>
+ <iso639Id>fra</iso639Id>
+ </languageList>
</configItem>
<variantList>
<variant>
@@ -133,14 +137,18 @@
<name>ir</name>
<_shortDescription>fa</_shortDescription>
<_description>Persian</_description>
- <languageList><iso639Id>per</iso639Id></languageList>
+ <languageList>
+ <iso639Id>per</iso639Id>
+ </languageList>
</configItem>
<variantList>
<variant>
<configItem>
<name>ave</name>
<_description>Avestan</_description>
- <languageList><iso639Id>ave</iso639Id></languageList>
+ <languageList>
+ <iso639Id>ave</iso639Id>
+ </languageList>
</configItem>
</variant>
</variantList>
@@ -150,7 +158,9 @@
<name>lt</name>
<_shortDescription>lt</_shortDescription>
<_description>Lithuanian</_description>
- <languageList><iso639Id>lit</iso639Id></languageList>
+ <languageList>
+ <iso639Id>lit</iso639Id>
+ </languageList>
</configItem>
<variantList>
<variant>
@@ -210,7 +220,7 @@
<variant>
<configItem>
<name>minuskeydvorakprogr</name>
- <_description>Latvian (programmer US Dvorak, minus variant)</_description>
+ <_description>Latvian (programmer US Dvorak, minus variant)</_description>
</configItem>
</variant>
<variant>
@@ -238,7 +248,9 @@
<name>us</name>
<_shortDescription>en</_shortDescription>
<_description>English (US)</_description>
- <languageList><iso639Id>eng</iso639Id></languageList>
+ <languageList>
+ <iso639Id>eng</iso639Id>
+ </languageList>
</configItem>
<variantList>
<variant>
@@ -264,17 +276,21 @@
<configItem>
<name>crd</name>
<_description>Coeur d'Alene Salish</_description>
- <languageList><iso639Id>crd</iso639Id></languageList>
+ <languageList>
+ <iso639Id>crd</iso639Id>
+ </languageList>
</configItem>
</variant>
<variant>
<configItem>
<name>cz_sk_de</name>
<_description>Czech Slovak and German (US)</_description>
- <languageList><iso639Id>eng</iso639Id>
- <iso639Id>cze</iso639Id>
- <iso639Id>slo</iso639Id>
- <iso639Id>ger</iso639Id> </languageList>
+ <languageList>
+ <iso639Id>eng</iso639Id>
+ <iso639Id>cze</iso639Id>
+ <iso639Id>slo</iso639Id>
+ <iso639Id>ger</iso639Id>
+ </languageList>
</configItem>
</variant>
<variant>
@@ -296,7 +312,9 @@
<name>pl</name>
<_shortDescription>pl</_shortDescription>
<_description>Polish</_description>
- <languageList><iso639Id>pol</iso639Id></languageList>
+ <languageList>
+ <iso639Id>pol</iso639Id>
+ </languageList>
</configItem>
<variantList>
<variant>
@@ -324,7 +342,9 @@
<name>ro</name>
<_shortDescription>ro</_shortDescription>
<_description>Romanian</_description>
- <languageList><iso639Id>rum</iso639Id></languageList>
+ <languageList>
+ <iso639Id>rum</iso639Id>
+ </languageList>
</configItem>
<variantList>
<variant>
@@ -356,7 +376,9 @@
<name>rs</name>
<_shortDescription>sr</_shortDescription>
<_description>Serbian</_description>
- <languageList><iso639Id>srp</iso639Id></languageList>
+ <languageList>
+ <iso639Id>srp</iso639Id>
+ </languageList>
</configItem>
<variantList>
<variant>
@@ -378,7 +400,9 @@
<configItem>
<name>chu</name>
<_description>Church Slavonic</_description>
- <languageList><iso639Id>chu</iso639Id></languageList>
+ <languageList>
+ <iso639Id>chu</iso639Id>
+ </languageList>
</configItem>
</variant>
<variant>
@@ -386,9 +410,11 @@
<name>ruu</name>
<_shortDescription>ru</_shortDescription>
<_description>Russian (with Ukrainian-Belorussian layout)</_description>
- <languageList><iso639Id>rus</iso639Id>
- <iso639Id>ukr</iso639Id>
- <iso639Id>bel</iso639Id></languageList>
+ <languageList>
+ <iso639Id>rus</iso639Id>
+ <iso639Id>ukr</iso639Id>
+ <iso639Id>bel</iso639Id>
+ </languageList>
</configItem>
</variant>
<variant>
@@ -417,19 +443,23 @@
</variant>
</variantList>
</layout>
- <layout>
+ <layout>
<configItem>
<name>il</name>
<_shortDescription>he</_shortDescription>
<_description>Hebrew</_description>
- <languageList><iso639Id>heb</iso639Id></languageList>
+ <languageList>
+ <iso639Id>heb</iso639Id>
+ </languageList>
</configItem>
<variantList>
<variant>
<configItem>
<name>biblicalSIL</name>
<_description>Hebrew (Biblical, SIL phonetic)</_description>
- <languageList><iso639Id>heb</iso639Id></languageList>
+ <languageList>
+ <iso639Id>heb</iso639Id>
+ </languageList>
</configItem>
</variant>
</variantList>
@@ -439,173 +469,173 @@
<name>ara</name>
<_shortDescription>ar</_shortDescription>
<_description>Arabic</_description>
- </configItem>
- <variantList>
+ </configItem>
+ <variantList>
<variant>
<configItem>
<name>sun_type6</name>
<_description>Arabic (Sun Type 6/7)</_description>
</configItem>
</variant>
- </variantList>
- </layout>
+ </variantList>
+ </layout>
<layout>
<configItem>
<name>be</name>
<_shortDescription>be</_shortDescription>
<_description>Belgian</_description>
- </configItem>
- <variantList>
+ </configItem>
+ <variantList>
<variant>
<configItem>
<name>sun_type6</name>
<_description>Belgian (Sun Type 6/7)</_description>
</configItem>
</variant>
- </variantList>
- </layout>
+ </variantList>
+ </layout>
<layout>
<configItem>
<name>br</name>
<_shortDescription>pt</_shortDescription>
<_description>Portuguese (Brazil)</_description>
- </configItem>
- <variantList>
+ </configItem>
+ <variantList>
<variant>
<configItem>
<name>sun_type6</name>
<_description>Portuguese (Brazil, Sun Type 6/7)</_description>
</configItem>
</variant>
- </variantList>
- </layout>
+ </variantList>
+ </layout>
<layout>
<configItem>
<name>cz</name>
<_shortDescription>cs</_shortDescription>
<_description>Czech</_description>
- </configItem>
- <variantList>
+ </configItem>
+ <variantList>
<variant>
<configItem>
<name>sun_type6</name>
<_description>Czech (Sun Type 6/7)</_description>
</configItem>
</variant>
- </variantList>
- </layout>
+ </variantList>
+ </layout>
<layout>
<configItem>
<name>dk</name>
<_shortDescription>da</_shortDescription>
<_description>Danish</_description>
- </configItem>
- <variantList>
+ </configItem>
+ <variantList>
<variant>
<configItem>
<name>sun_type6</name>
<_description>Danish (Sun Type 6/7)</_description>
</configItem>
</variant>
- </variantList>
- </layout>
+ </variantList>
+ </layout>
<layout>
<configItem>
<name>nl</name>
<_shortDescription>nl</_shortDescription>
<_description>Dutch</_description>
- </configItem>
- <variantList>
+ </configItem>
+ <variantList>
<variant>
<configItem>
<name>sun_type6</name>
<_description>Dutch (Sun Type 6/7)</_description>
</configItem>
</variant>
- </variantList>
- </layout>
+ </variantList>
+ </layout>
<layout>
<configItem>
<name>ee</name>
<_shortDescription>et</_shortDescription>
<_description>Estonian</_description>
- </configItem>
- <variantList>
+ </configItem>
+ <variantList>
<variant>
<configItem>
<name>sun_type6</name>
<_description>Estonian (Sun Type 6/7)</_description>
</configItem>
</variant>
- </variantList>
- </layout>
+ </variantList>
+ </layout>
<layout>
<configItem>
<name>fi</name>
<_shortDescription>fi</_shortDescription>
<_description>Finnish</_description>
- </configItem>
- <variantList>
+ </configItem>
+ <variantList>
<variant>
<configItem>
<name>sun_type6</name>
<_description>Finnish (Sun Type 6/7)</_description>
</configItem>
</variant>
- </variantList>
- </layout>
+ </variantList>
+ </layout>
<layout>
<configItem>
<name>fr</name>
<_shortDescription>fr</_shortDescription>
<_description>French</_description>
- </configItem>
- <variantList>
+ </configItem>
+ <variantList>
<variant>
<configItem>
<name>sun_type6</name>
<_description>French (Sun Type 6/7)</_description>
</configItem>
</variant>
- </variantList>
- </layout>
+ </variantList>
+ </layout>
<layout>
<configItem>
<name>gr</name>
<_shortDescription>gr</_shortDescription>
<_description>Greek</_description>
- </configItem>
- <variantList>
+ </configItem>
+ <variantList>
<variant>
<configItem>
<name>sun_type6</name>
<_description>Greek (Sun Type 6/7)</_description>
</configItem>
</variant>
- </variantList>
- </layout>
+ </variantList>
+ </layout>
<layout>
<configItem>
<name>it</name>
<_shortDescription>it</_shortDescription>
<_description>Italian</_description>
- </configItem>
- <variantList>
+ </configItem>
+ <variantList>
<variant>
<configItem>
<name>sun_type6</name>
<_description>Italian (Sun Type 6/7)</_description>
</configItem>
</variant>
- </variantList>
- </layout>
+ </variantList>
+ </layout>
<layout>
<configItem>
<name>jp</name>
<_shortDescription>ja</_shortDescription>
<_description>Japanese</_description>
- </configItem>
- <variantList>
+ </configItem>
+ <variantList>
<variant>
<configItem>
<name>sun_type6</name>
@@ -624,68 +654,68 @@
<_description>Japanese (Sun Type 7 - sun compatible)</_description>
</configItem>
</variant>
- </variantList>
- </layout>
+ </variantList>
+ </layout>
<layout>
<configItem>
<name>no</name>
<_shortDescription>no</_shortDescription>
<_description>Norwegian</_description>
- </configItem>
- <variantList>
+ </configItem>
+ <variantList>
<variant>
<configItem>
<name>sun_type6</name>
<_description>Norwegian (Sun Type 6/7)</_description>
</configItem>
</variant>
- </variantList>
- </layout>
+ </variantList>
+ </layout>
<layout>
<configItem>
<name>pt</name>
<_shortDescription>pt</_shortDescription>
<_description>Portuguese</_description>
- </configItem>
- <variantList>
+ </configItem>
+ <variantList>
<variant>
<configItem>
<name>sun_type6</name>
<_description>Portuguese (Sun Type 6/7)</_description>
</configItem>
</variant>
- </variantList>
- </layout>
+ </variantList>
+ </layout>
<layout>
<configItem>
<name>sk</name>
<_shortDescription>sk</_shortDescription>
<_description>Slovak</_description>
- </configItem>
- <variantList>
+ </configItem>
+ <variantList>
<variant>
<configItem>
<name>sun_type6</name>
<_description>Slovak (Sun Type 6/7)</_description>
</configItem>
</variant>
- </variantList>
- </layout>
+ </variantList>
+ </layout>
<layout>
<configItem>
<name>es</name>
<_shortDescription>es</_shortDescription>
<_description>Spanish</_description>
- </configItem>
- <variantList>
+ </configItem>
+ <variantList>
<variant>
<configItem>
<name>sun_type6</name>
<_description>Spanish (Sun Type 6/7)</_description>
</configItem>
</variant>
- </variantList>
- </layout>
+ </variantList>
+ </layout>
<layout>
<configItem>
<name>se</name>
@@ -712,8 +742,8 @@
<name>ch</name>
<_shortDescription>de</_shortDescription>
<_description>German (Switzerland)</_description>
- </configItem>
- <variantList>
+ </configItem>
+ <variantList>
<variant>
<configItem>
<name>sun_type6_de</name>
@@ -726,93 +756,93 @@
<_description>French (Switzerland, Sun Type 6/7)</_description>
</configItem>
</variant>
- </variantList>
- </layout>
+ </variantList>
+ </layout>
<layout>
<configItem>
<name>tr</name>
<_shortDescription>tr</_shortDescription>
<_description>Turkish</_description>
- </configItem>
- <variantList>
+ </configItem>
+ <variantList>
<variant>
<configItem>
<name>sun_type6</name>
<_description>Turkish (Sun Type 6/7)</_description>
</configItem>
</variant>
- </variantList>
- </layout>
+ </variantList>
+ </layout>
<layout>
<configItem>
<name>ua</name>
<_shortDescription>uk</_shortDescription>
<_description>Ukrainian</_description>
- </configItem>
- <variantList>
+ </configItem>
+ <variantList>
<variant>
<configItem>
<name>sun_type6</name>
<_description>Ukrainian (Sun Type 6/7)</_description>
</configItem>
</variant>
- </variantList>
- </layout>
+ </variantList>
+ </layout>
<layout>
<configItem>
<name>gb</name>
<_shortDescription>en</_shortDescription>
<_description>English (UK)</_description>
- </configItem>
- <variantList>
+ </configItem>
+ <variantList>
<variant>
<configItem>
<name>sun_type6</name>
<_description>English (UK, Sun Type 6/7)</_description>
</configItem>
</variant>
- </variantList>
- </layout>
+ </variantList>
+ </layout>
<layout>
<configItem>
<name>kr</name>
<_shortDescription>ko</_shortDescription>
<_description>Korean</_description>
- </configItem>
- <variantList>
+ </configItem>
+ <variantList>
<variant>
<configItem>
<name>sun_type6</name>
<_description>Korean (Sun Type 6/7)</_description>
</configItem>
</variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>eu</name>
- <!-- Keyboard indicator for European layouts -->
- <_shortDescription>eu</_shortDescription>
- <_description>EurKEY (US based layout with european letters)</_description>
- <languageList>
- <iso639Id>cat</iso639Id>
- <iso639Id>dan</iso639Id>
- <iso639Id>eng</iso639Id>
- <iso639Id>est</iso639Id>
- <iso639Id>fao</iso639Id>
- <iso639Id>fin</iso639Id>
- <iso639Id>ger</iso639Id>
- <iso639Id>gre</iso639Id>
- <iso639Id>gsw</iso639Id>
- <iso639Id>ita</iso639Id>
- <iso639Id>lav</iso639Id>
- <iso639Id>lit</iso639Id>
- <iso639Id>nld</iso639Id>
- <iso639Id>nor</iso639Id>
- <iso639Id>por</iso639Id>
- <iso639Id>spa</iso639Id>
- <iso639Id>swe</iso639Id>
- </languageList>
+ </variantList>
+ </layout>
+ <layout>
+ <configItem>
+ <name>eu</name>
+ <!-- Keyboard indicator for European layouts -->
+ <_shortDescription>eu</_shortDescription>
+ <_description>EurKEY (US based layout with european letters)</_description>
+ <languageList>
+ <iso639Id>cat</iso639Id>
+ <iso639Id>dan</iso639Id>
+ <iso639Id>eng</iso639Id>
+ <iso639Id>est</iso639Id>
+ <iso639Id>fao</iso639Id>
+ <iso639Id>fin</iso639Id>
+ <iso639Id>ger</iso639Id>
+ <iso639Id>gre</iso639Id>
+ <iso639Id>gsw</iso639Id>
+ <iso639Id>ita</iso639Id>
+ <iso639Id>lav</iso639Id>
+ <iso639Id>lit</iso639Id>
+ <iso639Id>nld</iso639Id>
+ <iso639Id>nor</iso639Id>
+ <iso639Id>por</iso639Id>
+ <iso639Id>spa</iso639Id>
+ <iso639Id>swe</iso639Id>
+ </languageList>
</configItem>
</layout>
<layout>
diff --git a/xorg-server/xkeyboard-config/rules/base.xml.in b/xorg-server/xkeyboard-config/rules/base.xml.in
index a7aa5de29..3fd0ce427 100644
--- a/xorg-server/xkeyboard-config/rules/base.xml.in
+++ b/xorg-server/xkeyboard-config/rules/base.xml.in
@@ -856,21 +856,21 @@
</model>
<model>
<configItem>
- <name>microsoftmult</name>
+ <name>microsoftmult</name>
<_description>Microsoft Wireless Multimedia Keyboard 1.0A</_description>
<vendor>Microsoft Inc.</vendor>
</configItem>
</model>
<model>
<configItem>
- <name>microsoftelite</name>
+ <name>microsoftelite</name>
<_description>Microsoft Natural Keyboard Elite</_description>
<vendor>Microsoft Inc.</vendor>
</configItem>
</model>
<model>
<configItem>
- <name>microsoftccurve2k</name>
+ <name>microsoftccurve2k</name>
<_description>Microsoft Comfort Curve Keyboard 2000</_description>
<vendor>Microsoft Inc.</vendor>
</configItem>
@@ -1406,9 +1406,11 @@
<configItem>
<name>altgr-intl</name>
<_description>English (international AltGr dead keys)</_description>
- <languageList><iso639Id>eng</iso639Id>
- <iso639Id>fra</iso639Id>
- <iso639Id>ger</iso639Id></languageList>
+ <languageList>
+ <iso639Id>eng</iso639Id>
+ <iso639Id>fra</iso639Id>
+ <iso639Id>ger</iso639Id>
+ </languageList>
</configItem>
</variant>
<variant>
@@ -1421,11 +1423,13 @@
<configItem>
<name>hbs</name>
<_description>Serbo-Croatian (US)</_description>
- <languageList><iso639Id>eng</iso639Id>
- <iso639Id>bos</iso639Id>
- <iso639Id>hbs</iso639Id>
- <iso639Id>hrv</iso639Id>
- <iso639Id>srp</iso639Id> </languageList>
+ <languageList>
+ <iso639Id>eng</iso639Id>
+ <iso639Id>bos</iso639Id>
+ <iso639Id>hbs</iso639Id>
+ <iso639Id>hrv</iso639Id>
+ <iso639Id>srp</iso639Id>
+ </languageList>
</configItem>
</variant>
<variant>
@@ -1717,9 +1721,11 @@
<!-- Keyboard indicator for Belgian layouts -->
<_shortDescription>be</_shortDescription>
<_description>Belgian</_description>
- <languageList><iso639Id>ger</iso639Id>
- <iso639Id>nld</iso639Id>
- <iso639Id>fra</iso639Id></languageList>
+ <languageList>
+ <iso639Id>ger</iso639Id>
+ <iso639Id>nld</iso639Id>
+ <iso639Id>fra</iso639Id>
+ </languageList>
</configItem>
<variantList>
<variant>
@@ -1819,35 +1825,45 @@
<configItem>
<name>ben_baishakhi</name>
<_description>Bangla (India, Baishakhi)</_description>
- <languageList><iso639Id>ben</iso639Id></languageList>
+ <languageList>
+ <iso639Id>ben</iso639Id>
+ </languageList>
</configItem>
</variant>
<variant>
<configItem>
<name>ben_bornona</name>
<_description>Bangla (India, Bornona)</_description>
- <languageList><iso639Id>ben</iso639Id></languageList>
- </configItem>
+ <languageList>
+ <iso639Id>ben</iso639Id>
+ </languageList>
+ </configItem>
</variant>
<variant>
<configItem>
<name>ben_gitanjali</name>
<_description>Bangla (India, Uni Gitanjali)</_description>
- <languageList><iso639Id>ben</iso639Id></languageList>
+ <languageList>
+ <iso639Id>ben</iso639Id>
+ </languageList>
</configItem>
</variant>
<variant>
<configItem>
<name>ben_inscript</name>
<_description>Bangla (India, Baishakhi Inscript)</_description>
- <languageList><iso639Id>ben</iso639Id></languageList>
+ <languageList>
+ <iso639Id>ben</iso639Id>
+ </languageList>
</configItem>
</variant>
<variant>
<configItem>
<name>eeyek</name>
<_description>Manipuri (Eeyek)</_description>
- <languageList><iso639Id>mni</iso639Id></languageList>
+ <languageList>
+ <iso639Id>mni</iso639Id>
+ </languageList>
</configItem>
</variant>
<variant>
@@ -1933,7 +1949,9 @@
<!-- Keyboard indicator for Malayalam layouts -->
<_shortDescription>ml</_shortDescription>
<_description>Malayalam (enhanced Inscript, with rupee sign)</_description>
- <languageList><iso639Id>mal</iso639Id></languageList>
+ <languageList>
+ <iso639Id>mal</iso639Id>
+ </languageList>
</configItem>
</variant>
<variant>
@@ -2326,14 +2344,18 @@
<!-- Keyboard indicator for Cameroon layouts -->
<_shortDescription>cm</_shortDescription>
<_description>English (Cameroon)</_description>
- <languageList><iso639Id>eng</iso639Id></languageList>
+ <languageList>
+ <iso639Id>eng</iso639Id>
+ </languageList>
</configItem>
<variantList>
<variant>
<configItem>
<name>french</name>
<_description>French (Cameroon)</_description>
- <languageList><iso639Id>fra</iso639Id></languageList>
+ <languageList>
+ <iso639Id>fra</iso639Id>
+ </languageList>
</configItem>
</variant>
<variant>
@@ -2817,8 +2839,10 @@
<!-- Keyboard indicator for Iraqi layouts -->
<_shortDescription>ar</_shortDescription>
<_description>Iraqi</_description>
- <languageList><iso639Id>ara</iso639Id>
- <iso639Id>kur</iso639Id></languageList>
+ <languageList>
+ <iso639Id>ara</iso639Id>
+ <iso639Id>kur</iso639Id>
+ </languageList>
</configItem>
<variantList>
<variant>
@@ -2919,7 +2943,9 @@
<configItem>
<name>smi</name>
<_description>Northern Saami (Finland)</_description>
- <languageList><iso639Id>sme</iso639Id></languageList>
+ <languageList>
+ <iso639Id>sme</iso639Id>
+ </languageList>
</configItem>
</variant>
<variant>
@@ -3232,14 +3258,18 @@
<configItem>
<name>ro</name>
<_description>Romanian (Germany)</_description>
- <languageList><iso639Id>rum</iso639Id></languageList>
+ <languageList>
+ <iso639Id>rum</iso639Id>
+ </languageList>
</configItem>
</variant>
<variant>
<configItem>
<name>ro_nodeadkeys</name>
<_description>Romanian (Germany, eliminate dead keys)</_description>
- <languageList><iso639Id>rum</iso639Id></languageList>
+ <languageList>
+ <iso639Id>rum</iso639Id>
+ </languageList>
</configItem>
</variant>
<variant>
@@ -3705,16 +3735,20 @@
<!-- Keyboard indicator for Russian layouts -->
<_shortDescription>ru</_shortDescription>
<_description>Russian (Kazakhstan, with Kazakh)</_description>
- <languageList><iso639Id>kaz</iso639Id>
- <iso639Id>rus</iso639Id></languageList>
+ <languageList>
+ <iso639Id>kaz</iso639Id>
+ <iso639Id>rus</iso639Id>
+ </languageList>
</configItem>
</variant>
<variant>
<configItem>
<name>kazrus</name>
<_description>Kazakh (with Russian)</_description>
- <languageList><iso639Id>kaz</iso639Id>
- <iso639Id>rus</iso639Id></languageList>
+ <languageList>
+ <iso639Id>kaz</iso639Id>
+ <iso639Id>rus</iso639Id>
+ </languageList>
</configItem>
</variant>
</variantList>
@@ -3734,7 +3768,8 @@
<configItem>
<name>stea</name>
<_description>Lao (STEA proposed standard layout)</_description>
- <languageList><iso639Id>lao</iso639Id>
+ <languageList>
+ <iso639Id>lao</iso639Id>
</languageList>
</configItem>
</variant>
@@ -4064,7 +4099,7 @@
<_description>Norwegian (Macintosh, eliminate dead keys)</_description>
</configItem>
</variant>
- <variant>
+ <variant>
<configItem>
<name>colemak</name>
<_description>Norwegian (Colemak)</_description>
@@ -4126,7 +4161,9 @@
<configItem>
<name>szl</name>
<_description>Silesian</_description>
- <languageList><iso639Id>szl</iso639Id></languageList>
+ <languageList>
+ <iso639Id>szl</iso639Id>
+ </languageList>
</configItem>
</variant>
<variant>
@@ -4387,8 +4424,10 @@
<configItem>
<name>srp</name>
<_description>Serbian (Russia)</_description>
- <languageList><iso639Id>rus</iso639Id>
- <iso639Id>srp</iso639Id></languageList>
+ <languageList>
+ <iso639Id>rus</iso639Id>
+ <iso639Id>srp</iso639Id>
+ </languageList>
</configItem>
</variant>
<variant>
@@ -4668,7 +4707,9 @@
<configItem>
<name>swl</name>
<_description>Swedish Sign Language</_description>
- <languageList><iso639Id>swl</iso639Id></languageList>
+ <languageList>
+ <iso639Id>swl</iso639Id>
+ </languageList>
</configItem>
</variant>
</variantList>
@@ -4679,8 +4720,10 @@
<!-- Keyboard indicator for German layouts -->
<_shortDescription>de</_shortDescription>
<_description>German (Switzerland)</_description>
- <languageList><iso639Id>ger</iso639Id>
- <iso639Id>gsw</iso639Id></languageList>
+ <languageList>
+ <iso639Id>ger</iso639Id>
+ <iso639Id>gsw</iso639Id>
+ </languageList>
</configItem>
<variantList>
<variant>
@@ -5578,33 +5621,37 @@
<!-- Keyboard indicator for Filipino layouts -->
<_shortDescription>ph</_shortDescription>
<_description>Filipino</_description>
- <languageList><iso639Id>eng</iso639Id>
- <iso639Id>bik</iso639Id>
- <iso639Id>ceb</iso639Id>
- <iso639Id>fil</iso639Id>
- <iso639Id>hil</iso639Id>
- <iso639Id>ilo</iso639Id>
- <iso639Id>pam</iso639Id>
- <iso639Id>pag</iso639Id>
- <iso639Id>phi</iso639Id>
- <iso639Id>tgl</iso639Id>
- <iso639Id>war</iso639Id></languageList>
+ <languageList>
+ <iso639Id>eng</iso639Id>
+ <iso639Id>bik</iso639Id>
+ <iso639Id>ceb</iso639Id>
+ <iso639Id>fil</iso639Id>
+ <iso639Id>hil</iso639Id>
+ <iso639Id>ilo</iso639Id>
+ <iso639Id>pam</iso639Id>
+ <iso639Id>pag</iso639Id>
+ <iso639Id>phi</iso639Id>
+ <iso639Id>tgl</iso639Id>
+ <iso639Id>war</iso639Id>
+ </languageList>
</configItem>
<variantList>
<variant>
<configItem>
<name>qwerty-bay</name>
<_description>Filipino (QWERTY Baybayin)</_description>
- <languageList><iso639Id>bik</iso639Id>
- <iso639Id>ceb</iso639Id>
- <iso639Id>fil</iso639Id>
- <iso639Id>hil</iso639Id>
- <iso639Id>ilo</iso639Id>
- <iso639Id>pam</iso639Id>
- <iso639Id>pag</iso639Id>
- <iso639Id>phi</iso639Id>
- <iso639Id>tgl</iso639Id>
- <iso639Id>war</iso639Id></languageList>
+ <languageList>
+ <iso639Id>bik</iso639Id>
+ <iso639Id>ceb</iso639Id>
+ <iso639Id>fil</iso639Id>
+ <iso639Id>hil</iso639Id>
+ <iso639Id>ilo</iso639Id>
+ <iso639Id>pam</iso639Id>
+ <iso639Id>pag</iso639Id>
+ <iso639Id>phi</iso639Id>
+ <iso639Id>tgl</iso639Id>
+ <iso639Id>war</iso639Id>
+ </languageList>
</configItem>
</variant>
<variant>
@@ -5617,16 +5664,18 @@
<configItem>
<name>capewell-dvorak-bay</name>
<_description>Filipino (Capewell-Dvorak Baybayin)</_description>
- <languageList><iso639Id>bik</iso639Id>
- <iso639Id>ceb</iso639Id>
- <iso639Id>fil</iso639Id>
- <iso639Id>hil</iso639Id>
- <iso639Id>ilo</iso639Id>
- <iso639Id>pam</iso639Id>
- <iso639Id>pag</iso639Id>
- <iso639Id>phi</iso639Id>
- <iso639Id>tgl</iso639Id>
- <iso639Id>war</iso639Id></languageList>
+ <languageList>
+ <iso639Id>bik</iso639Id>
+ <iso639Id>ceb</iso639Id>
+ <iso639Id>fil</iso639Id>
+ <iso639Id>hil</iso639Id>
+ <iso639Id>ilo</iso639Id>
+ <iso639Id>pam</iso639Id>
+ <iso639Id>pag</iso639Id>
+ <iso639Id>phi</iso639Id>
+ <iso639Id>tgl</iso639Id>
+ <iso639Id>war</iso639Id>
+ </languageList>
</configItem>
</variant>
<variant>
@@ -5639,16 +5688,18 @@
<configItem>
<name>capewell-qwerf2k6-bay</name>
<_description>Filipino (Capewell-QWERF 2006 Baybayin)</_description>
- <languageList><iso639Id>bik</iso639Id>
- <iso639Id>ceb</iso639Id>
- <iso639Id>fil</iso639Id>
- <iso639Id>hil</iso639Id>
- <iso639Id>ilo</iso639Id>
- <iso639Id>pam</iso639Id>
- <iso639Id>pag</iso639Id>
- <iso639Id>phi</iso639Id>
- <iso639Id>tgl</iso639Id>
- <iso639Id>war</iso639Id></languageList>
+ <languageList>
+ <iso639Id>bik</iso639Id>
+ <iso639Id>ceb</iso639Id>
+ <iso639Id>fil</iso639Id>
+ <iso639Id>hil</iso639Id>
+ <iso639Id>ilo</iso639Id>
+ <iso639Id>pam</iso639Id>
+ <iso639Id>pag</iso639Id>
+ <iso639Id>phi</iso639Id>
+ <iso639Id>tgl</iso639Id>
+ <iso639Id>war</iso639Id>
+ </languageList>
</configItem>
</variant>
<variant>
@@ -5661,16 +5712,18 @@
<configItem>
<name>colemak-bay</name>
<_description>Filipino (Colemak Baybayin)</_description>
- <languageList><iso639Id>bik</iso639Id>
- <iso639Id>ceb</iso639Id>
- <iso639Id>fil</iso639Id>
- <iso639Id>hil</iso639Id>
- <iso639Id>ilo</iso639Id>
- <iso639Id>pam</iso639Id>
- <iso639Id>pag</iso639Id>
- <iso639Id>phi</iso639Id>
- <iso639Id>tgl</iso639Id>
- <iso639Id>war</iso639Id></languageList>
+ <languageList>
+ <iso639Id>bik</iso639Id>
+ <iso639Id>ceb</iso639Id>
+ <iso639Id>fil</iso639Id>
+ <iso639Id>hil</iso639Id>
+ <iso639Id>ilo</iso639Id>
+ <iso639Id>pam</iso639Id>
+ <iso639Id>pag</iso639Id>
+ <iso639Id>phi</iso639Id>
+ <iso639Id>tgl</iso639Id>
+ <iso639Id>war</iso639Id>
+ </languageList>
</configItem>
</variant>
<variant>
@@ -5683,16 +5736,18 @@
<configItem>
<name>dvorak-bay</name>
<_description>Filipino (Dvorak Baybayin)</_description>
- <languageList><iso639Id>bik</iso639Id>
- <iso639Id>ceb</iso639Id>
- <iso639Id>fil</iso639Id>
- <iso639Id>hil</iso639Id>
- <iso639Id>ilo</iso639Id>
- <iso639Id>pam</iso639Id>
- <iso639Id>pag</iso639Id>
- <iso639Id>phi</iso639Id>
- <iso639Id>tgl</iso639Id>
- <iso639Id>war</iso639Id></languageList>
+ <languageList>
+ <iso639Id>bik</iso639Id>
+ <iso639Id>ceb</iso639Id>
+ <iso639Id>fil</iso639Id>
+ <iso639Id>hil</iso639Id>
+ <iso639Id>ilo</iso639Id>
+ <iso639Id>pam</iso639Id>
+ <iso639Id>pag</iso639Id>
+ <iso639Id>phi</iso639Id>
+ <iso639Id>tgl</iso639Id>
+ <iso639Id>war</iso639Id>
+ </languageList>
</configItem>
</variant>
</variantList>
@@ -5702,7 +5757,9 @@
<name>md</name>
<_shortDescription>md</_shortDescription>
<_description>Moldavian</_description>
- <languageList><iso639Id>rum</iso639Id></languageList>
+ <languageList>
+ <iso639Id>rum</iso639Id>
+ </languageList>
</configItem>
<variantList>
<variant>
@@ -5710,7 +5767,9 @@
<name>gag</name>
<_shortDescription>gag</_shortDescription>
<_description>Moldavian (Gagauz)</_description>
- <languageList><iso639Id>gag</iso639Id></languageList>
+ <languageList>
+ <iso639Id>gag</iso639Id>
+ </languageList>
</configItem>
</variant>
</variantList>
@@ -5848,7 +5907,7 @@
<name>grp:rctrl_rshift_toggle</name>
<_description>Right Ctrl+Right Shift</_description>
</configItem>
- </option>
+ </option>
<option>
<configItem>
<name>grp:ctrl_alt_toggle</name>
@@ -6263,7 +6322,7 @@
</option>
</group>
<group allowMultipleSelection="false">
- <!-- Caps Lock tweaks.
+ <!-- Caps Lock tweaks.
"Internal" capitalization means capitalization using some internal tables.
Otherwise "as Shift" - means using next group. -->
<configItem>
diff --git a/xorg-server/xkeyboard-config/symbols/altwin b/xorg-server/xkeyboard-config/symbols/altwin
index 239d4878c..76a289ad1 100644
--- a/xorg-server/xkeyboard-config/symbols/altwin
+++ b/xorg-server/xkeyboard-config/symbols/altwin
@@ -93,7 +93,7 @@ xkb_symbols "swap_alt_win" {
};
// Swap the left Alt and Win keys.
-partial hidden modifier_keys
+hidden partial modifier_keys
xkb_symbols "swap_lalt_lwin" {
key <LALT> { type[Group1] = "ONE_LEVEL",
symbols[Group1] = [ Super_L ] };
@@ -101,7 +101,7 @@ xkb_symbols "swap_lalt_lwin" {
};
// Swap the right Alt and Win keys.
-partial hidden modifier_keys
+hidden partial modifier_keys
xkb_symbols "swap_ralt_rwin" {
key <RALT> { type[Group1] = "ONE_LEVEL",
symbols[Group1] = [ Super_R ] };
diff --git a/xorg-server/xkeyboard-config/symbols/am b/xorg-server/xkeyboard-config/symbols/am
index dbe6e96d8..21ff1e872 100644
--- a/xorg-server/xkeyboard-config/symbols/am
+++ b/xorg-server/xkeyboard-config/symbols/am
@@ -63,8 +63,6 @@ xkb_symbols "basic" {
partial alphanumeric_keys
xkb_symbols "olpc" {
include "am(basic)"
- name[Group1]= "Armenian";
-
include "group(olpc)"
};
diff --git a/xorg-server/xkeyboard-config/symbols/apl b/xorg-server/xkeyboard-config/symbols/apl
index c60f11723..4d81ac295 100644
--- a/xorg-server/xkeyboard-config/symbols/apl
+++ b/xorg-server/xkeyboard-config/symbols/apl
@@ -62,9 +62,9 @@ xkb_symbols "basic" {
// ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃
// ┗━━━━━━━┻━━━━━━━┻━━━━━━━┹───────────────────────────────────┺━━━━━━━┻━━━━━━━┻━━━━━━━┛
-partial hidden alphanumeric_keys
+hidden partial alphanumeric_keys
xkb_symbols "common" {
- name[Group1]= "APL";
+ name[Group1]= "APL keyboard symbols";
key <AB01> { [ U2282 ] }; // Z: ⊂ -- Subset Of
key <AB02> { [ U2283 ] }; // X: ⊃ -- Superset Of
@@ -129,7 +129,7 @@ xkb_symbols "common" {
partial alphanumeric_keys
xkb_symbols "unified" {
- name[Group1]= "APL Keyboard Symbols: Unified Layout";
+ name[Group1]= "APL keyboard symbols (unified)";
include "apl(common)"
@@ -162,7 +162,7 @@ xkb_symbols "unified" {
partial alphanumeric_keys
xkb_symbols "sax" {
- name[Group1]= "APL Keyboard Symbols";
+ name[Group1]= "APL keyboard symbols (sax)";
include "apl(unified)"
@@ -224,7 +224,7 @@ xkb_symbols "sax" {
partial alphanumeric_keys
xkb_symbols "apl2" {
- name[Group1]= "APL Keyboard Symbols: IBM APL2";
+ name[Group1]= "APL keyboard symbols (IBM APL2)";
include "apl(common)"
@@ -284,7 +284,7 @@ xkb_symbols "apl2" {
partial alphanumeric_keys
xkb_symbols "aplplusII" {
- name[Group1]= "APL Keyboard Symbols: Manugistics APL*PLUS II";
+ name[Group1]= "APL keyboard symbols (Manugistics APL*PLUS II)";
// AFS - short for APL Functional Symbol
include "apl(apl2)"
@@ -321,7 +321,7 @@ xkb_symbols "aplplusII" {
partial alphanumeric_keys
xkb_symbols "aplx" {
- name[Group1]= "APL Keyboard Symbols: APLX Unified APL Layout";
+ name[Group1]= "APL keyboard symbols (APLX unified)";
include "apl(unified)"
@@ -372,9 +372,8 @@ xkb_symbols "aplx" {
// the alphabet and similar. If this keyboard is placed as the 2nd layout then it can
// be reached with a latching shift to increase group by one.
-partial alphanumeric_keys
+hidden partial alphanumeric_keys
xkb_symbols "dyalog_base" {
- name[Group1]="APL";
// ┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┲━━━━━━━━━┓
@@ -445,9 +444,8 @@ xkb_symbols "dyalog_base" {
key <TLDE> { [ U22c4, currency] }; // diamond
};
-partial keypad_keys
+hidden partial keypad_keys
xkb_symbols "dyalog_box" {
- name[Group1]="Dyalog box";
// ┌───┬───┬───┬───┐
// │ │ │ │ │
@@ -473,10 +471,9 @@ xkb_symbols "dyalog_box" {
key <KP9> { [ U2510 ] }; // box drawing light down and left
key <KPDL> { [ U2502 ] }; // box drawing light vertical
-};
+};
-xkb_symbols "dyalog_codes" {
- name[Group1]="Dyalog Codes";
+hidden xkb_symbols "dyalog_codes" {
// Layout of private use area for this. In the style of the Unicode book
//
@@ -613,6 +610,6 @@ xkb_symbols "dyalog" {
include "apl(dyalog_base)"
include "apl(dyalog_box)"
include "apl(dyalog_codes)"
- name[Group1] = "Dyalog APL complete";
+ name[Group1] = "APL keyboard symbols (Dyalog)";
};
diff --git a/xorg-server/xkeyboard-config/symbols/ara b/xorg-server/xkeyboard-config/symbols/ara
index d048b0090..9c1d57e09 100644
--- a/xorg-server/xkeyboard-config/symbols/ara
+++ b/xorg-server/xkeyboard-config/symbols/ara
@@ -96,7 +96,6 @@ xkb_symbols "azerty" {
partial hidden alphanumeric_keys
xkb_symbols "digits_KP" {
- name[Group1]= "Arabic (digits_KP)";
// Use Arabic-script digits on the keypad.
@@ -120,7 +119,7 @@ xkb_symbols "digits" {
include "ara(basic)"
name[Group1]= "Arabic (digits)";
- // Use Arabic-script digits on the numberic row.
+ // Use Arabic-script digits on the numeric row.
key <AE01> { [ 0x1000661, exclam ] };
key <AE02> { [ 0x1000662, at ] };
diff --git a/xorg-server/xkeyboard-config/symbols/bg b/xorg-server/xkeyboard-config/symbols/bg
index f44b5c60d..1de6c3065 100644
--- a/xorg-server/xkeyboard-config/symbols/bg
+++ b/xorg-server/xkeyboard-config/symbols/bg
@@ -190,7 +190,7 @@ xkb_symbols "bas_phonetic" {
// This is an extended variant of the standard Latin QWERTY layout with
// additional symbols in levels 3 and 4.
-partial hidden alphanumeric_keys
+hidden partial alphanumeric_keys
xkb_symbols "latin" {
key <TLDE> {[ grave, asciitilde, U2248, U2245 ]};
diff --git a/xorg-server/xkeyboard-config/symbols/br b/xorg-server/xkeyboard-config/symbols/br
index 85f5f5522..f65d13aa1 100644
--- a/xorg-server/xkeyboard-config/symbols/br
+++ b/xorg-server/xkeyboard-config/symbols/br
@@ -64,7 +64,6 @@ partial alphanumeric_keys
xkb_symbols "thinkpad" {
include "br(abnt2)"
- name[Group1]="Portuguese (Brazil)";
key <RCTL> { [ slash, question, degree, questiondown ] };
};
diff --git a/xorg-server/xkeyboard-config/symbols/brai b/xorg-server/xkeyboard-config/symbols/brai
index 66364e60e..46bc2c6b6 100644
--- a/xorg-server/xkeyboard-config/symbols/brai
+++ b/xorg-server/xkeyboard-config/symbols/brai
@@ -48,7 +48,7 @@ xkb_symbols "right_hand" {
};
// 6-dot patterns on the keypad
-partial hidden keypad_keys
+hidden partial keypad_keys
xkb_symbols "keypad" {
key <KP4> { [ braille_dot_1 ] };
key <KP1> { [ braille_dot_2 ] };
diff --git a/xorg-server/xkeyboard-config/symbols/capslock b/xorg-server/xkeyboard-config/symbols/capslock
index 928d79a3e..3f4a0cd70 100644
--- a/xorg-server/xkeyboard-config/symbols/capslock
+++ b/xorg-server/xkeyboard-config/symbols/capslock
@@ -1,27 +1,27 @@
-default partial hidden modifier_keys
+default hidden partial modifier_keys
xkb_symbols "capslock" {
replace key <CAPS> { [ Caps_Lock ] };
modifier_map Lock { Caps_Lock };
};
-partial hidden modifier_keys
+hidden partial modifier_keys
xkb_symbols "shiftlock" {
replace key <CAPS> { [ Shift_Lock ] };
modifier_map Shift { Shift_Lock };
};
-partial hidden modifier_keys
+hidden partial modifier_keys
xkb_symbols "grouplock" {
replace key <CAPS> { [ ISO_Next_Group, Caps_Lock ] };
};
-partial hidden modifier_keys
+hidden partial modifier_keys
xkb_symbols "swapescape" {
key <CAPS> { [ Escape ] };
key <ESC> { [ Caps_Lock ] };
};
-partial hidden modifier_keys
+hidden partial modifier_keys
xkb_symbols "groupshift" {
key <CAPS> {
type[Group1] = "PC_ALT_LEVEL2",
@@ -29,41 +29,41 @@ xkb_symbols "groupshift" {
};
};
-partial hidden modifier_keys
+hidden partial modifier_keys
xkb_symbols "escape" {
key <CAPS> { [ Escape ] };
};
-partial hidden modifier_keys
+hidden partial modifier_keys
xkb_symbols "backspace" {
key <CAPS> { [ BackSpace ] };
};
-partial hidden modifier_keys
+hidden partial modifier_keys
xkb_symbols "super" {
key <CAPS> { [ Super_L ] };
modifier_map Mod4 { <CAPS> };
};
-partial hidden modifier_keys
+hidden partial modifier_keys
xkb_symbols "hyper" {
key <CAPS> { [ Hyper_L ] };
modifier_map Mod4 { <CAPS> };
};
-partial hidden modifier_keys
+hidden partial modifier_keys
xkb_symbols "none" {
key <CAPS> { [ VoidSymbol ] };
};
-partial hidden modifier_keys
+hidden partial modifier_keys
xkb_symbols "numlock" {
key <CAPS> { [ Num_Lock ] };
};
// This changes the <CAPS> key to become a Control modifier,
// but it will still produce the Caps_Lock keysym.
-partial hidden modifier_keys
+hidden partial modifier_keys
xkb_symbols "ctrl_modifier" {
replace key <CAPS> {
type[Group1] = "ONE_LEVEL",
diff --git a/xorg-server/xkeyboard-config/symbols/epo b/xorg-server/xkeyboard-config/symbols/epo
index 1f7f3fc7c..1d4000948 100644
--- a/xorg-server/xkeyboard-config/symbols/epo
+++ b/xorg-server/xkeyboard-config/symbols/epo
@@ -10,9 +10,8 @@
default partial alphanumeric_keys
xkb_symbols "basic" {
- name[Group1]= "Esperanto";
-
include "us(basic)"
+ name[Group1]= "Esperanto";
key.type[Group1] = "FOUR_LEVEL_ALPHABETIC";
diff --git a/xorg-server/xkeyboard-config/symbols/fi b/xorg-server/xkeyboard-config/symbols/fi
index 1bf9ff074..6afed2106 100644
--- a/xorg-server/xkeyboard-config/symbols/fi
+++ b/xorg-server/xkeyboard-config/symbols/fi
@@ -98,7 +98,7 @@ xkb_symbols "classic" {
name[Group1]="Finnish (classic)";
};
-partial alphanumeric_keys hidden
+hidden partial alphanumeric_keys
xkb_symbols "fi" {
// Classic Finnish keyboard layout with dead keys
diff --git a/xorg-server/xkeyboard-config/symbols/group b/xorg-server/xkeyboard-config/symbols/group
index 91be4863f..8b00dff6e 100644
--- a/xorg-server/xkeyboard-config/symbols/group
+++ b/xorg-server/xkeyboard-config/symbols/group
@@ -410,7 +410,7 @@ xkb_symbols "alt_caps_toggle" {
};
};
-partial hidden modifier_keys
+hidden partial modifier_keys
xkb_symbols "olpc" {
key <I219> { [ ISO_Next_Group, ISO_Prev_Group ] };
};
diff --git a/xorg-server/xkeyboard-config/symbols/inet b/xorg-server/xkeyboard-config/symbols/inet
index 613488f05..33b058397 100644
--- a/xorg-server/xkeyboard-config/symbols/inet
+++ b/xorg-server/xkeyboard-config/symbols/inet
@@ -14,7 +14,7 @@
// setxkbmap 'my_kb_layout' -variant 'my_kb_variant' -model 'my_eak_type'
// Very common set of media keys.
-partial hidden alphanumeric_keys
+hidden partial alphanumeric_keys
xkb_symbols "media_common" {
key <I01> { [ XF86AudioMedia ] };
key <I10> { [ XF86AudioPrev ] };
@@ -29,7 +29,7 @@ xkb_symbols "media_common" {
};
// Popular web navigation keys.
-partial hidden alphanumeric_keys
+hidden partial alphanumeric_keys
xkb_symbols "nav_common" {
key <I21> { [ XF86Calculator ] };
key <I32> { [ XF86WWW ] };
@@ -45,7 +45,7 @@ xkb_symbols "nav_common" {
};
// ACPI Standard
-partial hidden alphanumeric_keys
+hidden partial alphanumeric_keys
xkb_symbols "acpi_common" {
key <I5E> { [ XF86PowerOff ] };
key <I5F> { [ XF86Standby ] };
@@ -56,26 +56,26 @@ xkb_symbols "acpi_common" {
};
// Combined sections, for simplicity.
-partial hidden alphanumeric_keys
+hidden partial alphanumeric_keys
xkb_symbols "media_nav_common" {
include "inet(media_common)"
include "inet(nav_common)"
};
-partial hidden alphanumeric_keys
+hidden partial alphanumeric_keys
xkb_symbols "media_nav_acpi_common" {
include "inet(media_common)"
include "inet(nav_common)"
include "inet(acpi_common)"
};
-partial hidden alphanumeric_keys
+hidden partial alphanumeric_keys
xkb_symbols "nav_acpi_common" {
include "inet(nav_common)"
include "inet(acpi_common)"
};
-partial hidden alphanumeric_keys
+hidden partial alphanumeric_keys
xkb_symbols "media_acpi_common" {
include "inet(media_common)"
include "inet(acpi_common)"
@@ -1001,7 +1001,7 @@ xkb_symbols "ibm_spacesaver" {
// Logitech
// Logitech common definitions
-partial hidden alphanumeric_keys
+hidden partial alphanumeric_keys
xkb_symbols "logitech_base" {
include "inet(media_nav_acpi_common)"
key <I02> { [ XF86HomePage ] };
@@ -1017,7 +1017,7 @@ xkb_symbols "logitech_base" {
};
// Logitech second set of common keys
-partial hidden alphanumeric_keys
+hidden partial alphanumeric_keys
xkb_symbols "logitech_set3" {
key <I17> { [ XF86AudioStop ] };
key <I1E> { [ XF86AudioRaiseVolume ] };
diff --git a/xorg-server/xkeyboard-config/symbols/ir b/xorg-server/xkeyboard-config/symbols/ir
index 1be5e7a22..2305049a8 100644
--- a/xorg-server/xkeyboard-config/symbols/ir
+++ b/xorg-server/xkeyboard-config/symbols/ir
@@ -29,13 +29,14 @@ xkb_symbols "pes_keypad" {
name[Group1]= "Persian (with Persian keypad)";
include "ir(pes_part_basic)"
+ include "ir(pes_part_ext)"
include "ir(pes_part_keypad)"
include "nbsp(zwnj2nb3nnb4)"
include "level3(ralt_switch)"
};
-partial hidden alphanumeric_keys
+hidden partial alphanumeric_keys
xkb_symbols "pes_part_basic" {
// Persian digits
@@ -93,23 +94,23 @@ xkb_symbols "pes_part_basic" {
key <BKSL> { [ backslash, bar, 0x1002010 ] };
};
-partial hidden alphanumeric_keys
+hidden partial alphanumeric_keys
xkb_symbols "pes_part_ext" {
// Persian and ASCII digits
- key <AE01> { [ 0x10006f1, exclam, grave, 1 ] };
- key <AE02> { [ 0x10006f2, 0x100066c, at, 2 ] };
- key <AE03> { [ 0x10006f3, 0x100066b, numbersign, 3 ] };
- key <AE04> { [ 0x10006f4, 0x100fdfc, dollar, 4 ] };
- key <AE05> { [ 0x10006f5, 0x100066a, percent, 5 ] };
- key <AE06> { [ 0x10006f6, multiply, asciicircum, 6 ] };
- key <AE07> { [ 0x10006f7, Arabic_comma, ampersand, 7 ] };
- key <AE08> { [ 0x10006f8, asterisk, enfilledcircbullet, 8 ] };
- key <AE09> { [ 0x10006f9, parenright, 0x100200e, 9 ] };
- key <AE10> { [ 0x10006f0, parenleft, 0x100200f, 0 ] };
+ key <AE01> { [ Farsi_1, exclam, grave, 1 ] };
+ key <AE02> { [ Farsi_2, 0x100066c, at, 2 ] };
+ key <AE03> { [ Farsi_3, 0x100066b, numbersign, 3 ] };
+ key <AE04> { [ Farsi_4, 0x100fdfc, dollar, 4 ] };
+ key <AE05> { [ Farsi_5, 0x100066a, percent, 5 ] };
+ key <AE06> { [ Farsi_6, multiply, asciicircum, 6 ] };
+ key <AE07> { [ Farsi_7, Arabic_comma, ampersand, 7 ] };
+ key <AE08> { [ Farsi_8, asterisk, enfilledcircbullet, 8 ] };
+ key <AE09> { [ Farsi_9, parenright, 0x100200e, 9 ] };
+ key <AE10> { [ Farsi_0, parenleft, 0x100200f, 0 ] };
};
-partial hidden alphanumeric_keys
+hidden partial alphanumeric_keys
xkb_symbols "pes_part_keypad" {
// Persian digits and Mathematical operators
@@ -121,19 +122,19 @@ xkb_symbols "pes_part_keypad" {
key <KPEN> { [ KP_Enter ] };
key <KPEQ> { [ equal ] };
- key <KP7> { [ KP_Home, 0x10006f7 ] };
- key <KP8> { [ KP_Up, 0x10006f8 ] };
- key <KP9> { [ KP_Prior, 0x10006f9 ] };
+ key <KP7> { [ KP_Home, Farsi_7 ] };
+ key <KP8> { [ KP_Up, Farsi_8 ] };
+ key <KP9> { [ KP_Prior, Farsi_9 ] };
- key <KP4> { [ KP_Left, 0x10006f4 ] };
- key <KP5> { [ KP_Begin, 0x10006f5 ] };
- key <KP6> { [ KP_Right, 0x10006f6 ] };
+ key <KP4> { [ KP_Left, Farsi_4 ] };
+ key <KP5> { [ KP_Begin, Farsi_5 ] };
+ key <KP6> { [ KP_Right, Farsi_6 ] };
- key <KP1> { [ KP_End, 0x10006f1 ] };
- key <KP2> { [ KP_Down, 0x10006f2 ] };
- key <KP3> { [ KP_Next, 0x10006f3 ] };
+ key <KP1> { [ KP_End, Farsi_1 ] };
+ key <KP2> { [ KP_Down, Farsi_2 ] };
+ key <KP3> { [ KP_Next, Farsi_3 ] };
- key <KP0> { [ KP_Insert, 0x10006f0 ] };
+ key <KP0> { [ KP_Insert, Farsi_0 ] };
key <KPDL> { [ KP_Delete, 0x100066b ] };
};
@@ -184,16 +185,16 @@ xkb_symbols "ku_ara" {
key <BKSL> { [ backslash, bar, ccedilla, Ccedilla ] };
// Digits
- key <AE01> { [ 1, exclam, 0x10006f1, grave ] };
- key <AE02> { [ 2, at, 0x10006f2, at ] };
- key <AE03> { [ 3, numbersign, 0x10006f3, 0x100066b ] };
- key <AE04> { [ 4, dollar, 0x10006f4, 0x100fdfc ] };
- key <AE05> { [ 5, percent, 0x10006f5, 0x100066a ] };
- key <AE06> { [ 6, asciicircum, 0x10006f6, multiply ] };
- key <AE07> { [ 7, ampersand, 0x10006f7, Arabic_comma ] };
- key <AE08> { [ 8, asterisk, 0x10006f8, enfilledcircbullet ] };
- key <AE09> { [ 9, parenright, 0x10006f9, 0x100200e ] };
- key <AE10> { [ 0, parenleft, 0x10006f0, 0x100200f ] };
+ key <AE01> { [ 1, exclam, Farsi_1, grave ] };
+ key <AE02> { [ 2, at, Farsi_2, at ] };
+ key <AE03> { [ 3, numbersign, Farsi_3, 0x100066b ] };
+ key <AE04> { [ 4, dollar, Farsi_4, 0x100fdfc ] };
+ key <AE05> { [ 5, percent, Farsi_5, 0x100066a ] };
+ key <AE06> { [ 6, asciicircum, Farsi_6, multiply ] };
+ key <AE07> { [ 7, ampersand, Farsi_7, Arabic_comma ] };
+ key <AE08> { [ 8, asterisk, Farsi_8, enfilledcircbullet ] };
+ key <AE09> { [ 9, parenright, Farsi_9, 0x100200e ] };
+ key <AE10> { [ 0, parenleft, Farsi_0, 0x100200f ] };
key <AE11> { [ minus, Arabic_tatweel, underscore ] };
key <AE12> { [ equal, plus, 0x1002212 ] };
diff --git a/xorg-server/xkeyboard-config/symbols/jp b/xorg-server/xkeyboard-config/symbols/jp
index 26dfdf9bd..3d2d03bff 100644
--- a/xorg-server/xkeyboard-config/symbols/jp
+++ b/xorg-server/xkeyboard-config/symbols/jp
@@ -10,7 +10,7 @@ xkb_symbols "106" {
key <AE13> { [ backslash, bar ] };
};
-partial hidden alphanumeric_keys
+hidden partial alphanumeric_keys
xkb_symbols "common" {
// "Common" keys for jp 106/109A layouts.
diff --git a/xorg-server/xkeyboard-config/symbols/keypad b/xorg-server/xkeyboard-config/symbols/keypad
index 0187ecbeb..1efc02b48 100644
--- a/xorg-server/xkeyboard-config/symbols/keypad
+++ b/xorg-server/xkeyboard-config/symbols/keypad
@@ -1,9 +1,9 @@
-partial hidden keypad_keys
+hidden partial keypad_keys
xkb_symbols "overlay" {
include "keypad(overlay1)"
};
-partial hidden keypad_keys
+hidden partial keypad_keys
xkb_symbols "overlay1" {
key <KP7> { [ KP_Home ], overlay1=<KO7> };
@@ -37,7 +37,7 @@ xkb_symbols "overlay1" {
key <KODL> { [ KP_Decimal ] };
};
-partial hidden keypad_keys
+hidden partial keypad_keys
xkb_symbols "overlay2" {
key <KP7> { [ KP_Home ], overlay2=<KO7> };
@@ -71,7 +71,7 @@ xkb_symbols "overlay2" {
key <KODL> { [ KP_Decimal ] };
};
-partial hidden keypad_keys
+hidden partial keypad_keys
xkb_symbols "operators" {
// Puts some commands to control the X server on
// the fifth level of the keypad's operator keys.
@@ -93,7 +93,7 @@ xkb_symbols "operators" {
};
};
-default partial hidden keypad_keys
+default hidden partial keypad_keys
xkb_symbols "x11" {
include "keypad(operators)"
diff --git a/xorg-server/xkeyboard-config/symbols/kr b/xorg-server/xkeyboard-config/symbols/kr
index 84c0effca..1ee560bf8 100644
--- a/xorg-server/xkeyboard-config/symbols/kr
+++ b/xorg-server/xkeyboard-config/symbols/kr
@@ -13,13 +13,13 @@ xkb_symbols "kr104" {
include "kr(koreankeys_raltctl)"
};
-partial hidden function_keys
+hidden partial function_keys
xkb_symbols "koreankeys" {
key <K71> { [ Hangul ] };
key <K72> { [ Hangul_Hanja ] };
};
-partial hidden function_keys
+hidden partial function_keys
xkb_symbols "koreankeys_raltctl" {
key <RALT> { [ Hangul ] };
key <RCTL> { [ Hangul_Hanja ] };
diff --git a/xorg-server/xkeyboard-config/symbols/kz b/xorg-server/xkeyboard-config/symbols/kz
index 4f807d182..db118a0d2 100644
--- a/xorg-server/xkeyboard-config/symbols/kz
+++ b/xorg-server/xkeyboard-config/symbols/kz
@@ -204,8 +204,6 @@ xkb_symbols "olpc" {
include "kz(basic)"
- name[Group1] = "Kazakh";
-
key <TLDE> { [ parenleft, parenright ] };
key <BKSL> { [ Cyrillic_io, Cyrillic_IO ] };
diff --git a/xorg-server/xkeyboard-config/symbols/level3 b/xorg-server/xkeyboard-config/symbols/level3
index b15e24d53..1aef97056 100755
--- a/xorg-server/xkeyboard-config/symbols/level3
+++ b/xorg-server/xkeyboard-config/symbols/level3
@@ -53,7 +53,7 @@ xkb_symbols "ralt_switch_multikey" {
};
// A special case of the right-Alt switch -- for use with grp:alts_toggle.
-partial hidden modifier_keys
+hidden partial modifier_keys
xkb_symbols "ralt_switch_for_alts_toggle" {
virtual_modifiers LAlt, AltGr;
key <LALT> {
diff --git a/xorg-server/xkeyboard-config/symbols/pc b/xorg-server/xkeyboard-config/symbols/pc
index 996324d2c..019971323 100644
--- a/xorg-server/xkeyboard-config/symbols/pc
+++ b/xorg-server/xkeyboard-config/symbols/pc
@@ -62,7 +62,7 @@ xkb_symbols "pc105" {
key <KIUP> { [ XF86KbdBrightnessUp ] };
};
-partial hidden alphanumeric_keys
+hidden partial alphanumeric_keys
xkb_symbols "editing" {
key <PRSC> {
type= "PC_ALT_LEVEL2",
diff --git a/xorg-server/xkeyboard-config/symbols/rs b/xorg-server/xkeyboard-config/symbols/rs
index c39f4ed49..e164f2eee 100644
--- a/xorg-server/xkeyboard-config/symbols/rs
+++ b/xorg-server/xkeyboard-config/symbols/rs
@@ -45,7 +45,7 @@ xkb_symbols "yz" {
key <AB01> { [ Cyrillic_ze, Cyrillic_ZE, any, any ] }; // z
};
-partial hidden alphanumeric_keys
+hidden partial alphanumeric_keys
xkb_symbols "common" {
// "Common" keys: keys that are the same
// for both latin and cyrillic keyboards.
@@ -73,7 +73,7 @@ xkb_symbols "common" {
include "kpdl(comma)"
};
-partial hidden alphanumeric_keys
+hidden partial alphanumeric_keys
xkb_symbols "cyralpha" {
key.type[Group1] = "FOUR_LEVEL_ALPHABETIC";
@@ -114,7 +114,7 @@ xkb_symbols "cyralpha" {
};
-partial hidden alphanumeric_keys
+hidden partial alphanumeric_keys
xkb_symbols "latalpha" {
key.type[Group1] = "FOUR_LEVEL_ALPHABETIC";
@@ -127,7 +127,7 @@ xkb_symbols "latalpha" {
key <BKSL> { [ zcaron, Zcaron, any, any ] }; // \ |
};
-partial hidden alphanumeric_keys
+hidden partial alphanumeric_keys
xkb_symbols "twoletter" {
// Letters which are written in latin transcription with two characters.
@@ -142,7 +142,7 @@ xkb_symbols "twoletter" {
key <AB01> { [ zcaron, Zcaron, any, any ] }; // z
};
-partial hidden alphanumeric_keys
+hidden partial alphanumeric_keys
xkb_symbols "latlevel3" {
key <TLDE> { [ any, any, notsign, notsign ] }; // ` ~
key <AE01> { [ any, any, dead_tilde, asciitilde ] }; // 1 !
@@ -196,7 +196,7 @@ xkb_symbols "latlevel3" {
key <AB10> { [ any, any, emdash, endash ] }; // / ?
};
-partial hidden alphanumeric_keys
+hidden partial alphanumeric_keys
xkb_symbols "cyrlevel3" {
key <TLDE> { [ any, any, degree, notsign ] }; // ` ~
key <AE03> { [ any, any, dead_circumflex, NoSymbol ] }; // 3 #
diff --git a/xorg-server/xkeyboard-config/symbols/ru b/xorg-server/xkeyboard-config/symbols/ru
index 64c862b26..c4f48186f 100644
--- a/xorg-server/xkeyboard-config/symbols/ru
+++ b/xorg-server/xkeyboard-config/symbols/ru
@@ -21,7 +21,7 @@ xkb_symbols "winkeys" {
key <BKSL> { [ backslash, slash ] };
};
-partial hidden alphanumeric_keys
+hidden partial alphanumeric_keys
xkb_symbols "common" {
key <AE01> { [ 1, exclam ] };