...
 
Commits (228)
noinst_LTLIBRARIES = libXext.la libXextdpmsstubs.la
noinst_LTLIBRARIES = libXext.la libXextdpmsstubs.la libXvidmode.la
AM_CFLAGS = $(DIX_CFLAGS)
......@@ -6,7 +6,7 @@ if XORG
sdk_HEADERS = xvdix.h xvmcext.h geext.h geint.h shmint.h syncsdk.h
endif
# Sources always included in libXextbuiltin.la & libXext.la
# Sources always included in libXextbuiltin.la, libXext.la
BUILTIN_SRCS = \
bigreq.c \
geext.c \
......@@ -98,6 +98,9 @@ libXext_la_LIBADD = $(BUILTIN_LIBS)
libXextdpmsstubs_la_SOURCES = dpmsstubs.c
# XVidMode extension
libXvidmode_la_SOURCES = vidmode.c
EXTRA_DIST = \
$(MITSHM_SRCS) \
$(XV_SRCS) \
......
......@@ -106,7 +106,7 @@ PanoramiXCreateWindow(ClientPtr client)
if ((Mask) stuff->mask & CWColormap) {
cmap_offset = Ones((Mask) stuff->mask & (CWColormap - 1));
tmp = *((CARD32 *) &stuff[1] + cmap_offset);
if ((tmp != CopyFromParent) && (tmp != None)) {
if (tmp != CopyFromParent) {
result = dixLookupResourceByType((void **) &cmap, tmp,
XRT_COLORMAP, client,
DixReadAccess);
......@@ -210,7 +210,7 @@ PanoramiXChangeWindowAttributes(ClientPtr client)
if ((Mask) stuff->valueMask & CWColormap) {
cmap_offset = Ones((Mask) stuff->valueMask & (CWColormap - 1));
tmp = *((CARD32 *) &stuff[1] + cmap_offset);
if ((tmp != CopyFromParent) && (tmp != None)) {
if (tmp != CopyFromParent) {
result = dixLookupResourceByType((void **) &cmap, tmp,
XRT_COLORMAP, client,
DixReadAccess);
......
......@@ -1143,7 +1143,7 @@ ProcScreenSaverSetAttributes(ClientPtr client)
if ((Mask) stuff->mask & CWColormap) {
cmap_offset = Ones((Mask) stuff->mask & (CWColormap - 1));
tmp = *((CARD32 *) &stuff[1] + cmap_offset);
if ((tmp != CopyFromParent) && (tmp != None)) {
if (tmp != CopyFromParent) {
status = dixLookupResourceByType((void **) &cmap, tmp,
XRT_COLORMAP, client,
DixReadAccess);
......
......@@ -619,6 +619,7 @@ ProcShmGetImage(ClientPtr client)
xShmGetImageReply xgi;
ShmDescPtr shmdesc;
VisualID visual = None;
RegionPtr pVisibleRegion = NULL;
int rc;
REQUEST(xShmGetImageReq);
......@@ -650,6 +651,9 @@ ProcShmGetImage(ClientPtr client)
wBorderWidth((WindowPtr) pDraw) + (int) pDraw->height)
return BadMatch;
visual = wVisual(((WindowPtr) pDraw));
pVisibleRegion = NotClippedByChildren((WindowPtr) pDraw);
if (pVisibleRegion)
RegionTranslate(pVisibleRegion, -pDraw->x, -pDraw->y);
}
else {
if (stuff->x < 0 ||
......@@ -686,6 +690,11 @@ ProcShmGetImage(ClientPtr client)
stuff->width, stuff->height,
stuff->format, stuff->planeMask,
shmdesc->addr + stuff->offset);
if (pVisibleRegion)
XaceCensorImage(client, pVisibleRegion,
PixmapBytePad(stuff->width, pDraw->depth), pDraw,
stuff->x, stuff->y, stuff->width, stuff->height,
stuff->format, shmdesc->addr + stuff->offset);
}
else {
......@@ -697,11 +706,19 @@ ProcShmGetImage(ClientPtr client)
stuff->width, stuff->height,
stuff->format, plane,
shmdesc->addr + length);
if (pVisibleRegion)
XaceCensorImage(client, pVisibleRegion,
BitmapBytePad(stuff->width), pDraw,
stuff->x, stuff->y, stuff->width, stuff->height,
stuff->format, shmdesc->addr + length);
length += lenPer;
}
}
}
if (pVisibleRegion)
RegionDestroy(pVisibleRegion);
if (client->swapped) {
swaps(&xgi.sequenceNumber);
swapl(&xgi.length);
......
......@@ -800,10 +800,9 @@ XvdiSelectVideoNotify(ClientPtr client, DrawablePtr pDraw, BOOL onoff)
if (!(tpn = malloc(sizeof(XvVideoNotifyRec))))
return BadAlloc;
tpn->next = NULL;
if (!AddResource(pDraw->id, XvRTVideoNotifyList, tpn)) {
free(tpn);
tpn->client = NULL;
if (!AddResource(pDraw->id, XvRTVideoNotifyList, tpn))
return BadAlloc;
}
}
else {
/* LOOK TO SEE IF ENTRY ALREADY EXISTS */
......@@ -844,7 +843,8 @@ XvdiSelectVideoNotify(ClientPtr client, DrawablePtr pDraw, BOOL onoff)
tpn->client = NULL;
tpn->id = FakeClientID(client->index);
AddResource(tpn->id, XvRTVideoNotify, tpn);
if (!AddResource(tpn->id, XvRTVideoNotify, tpn))
return BadAlloc;
tpn->client = client;
return Success;
......@@ -893,7 +893,8 @@ XvdiSelectPortNotify(ClientPtr client, XvPortPtr pPort, BOOL onoff)
tpn->client = client;
tpn->id = FakeClientID(client->index);
AddResource(tpn->id, XvRTPortNotify, tpn);
if (!AddResource(tpn->id, XvRTPortNotify, tpn))
return BadAlloc;
return Success;
......
......@@ -253,6 +253,10 @@ ProcXvMCCreateContext(ClientPtr client)
free(pContext);
return result;
}
if (!AddResource(pContext->context_id, XvMCRTContext, pContext)) {
free(data);
return BadAlloc;
}
rep = (xvmcCreateContextReply) {
.type = X_Reply,
......@@ -266,7 +270,6 @@ ProcXvMCCreateContext(ClientPtr client)
WriteToClient(client, sizeof(xvmcCreateContextReply), &rep);
if (dwords)
WriteToClient(client, dwords << 2, data);
AddResource(pContext->context_id, XvMCRTContext, pContext);
free(data);
......@@ -329,6 +332,11 @@ ProcXvMCCreateSurface(ClientPtr client)
free(pSurface);
return result;
}
if (!AddResource(pSurface->surface_id, XvMCRTSurface, pSurface)) {
free(data);
return BadAlloc;
}
rep = (xvmcCreateSurfaceReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
......@@ -338,7 +346,6 @@ ProcXvMCCreateSurface(ClientPtr client)
WriteToClient(client, sizeof(xvmcCreateSurfaceReply), &rep);
if (dwords)
WriteToClient(client, dwords << 2, data);
AddResource(pSurface->surface_id, XvMCRTSurface, pSurface);
free(data);
......@@ -445,6 +452,11 @@ ProcXvMCCreateSubpicture(ClientPtr client)
free(pSubpicture);
return result;
}
if (!AddResource(pSubpicture->subpicture_id, XvMCRTSubpicture, pSubpicture)) {
free(data);
return BadAlloc;
}
rep = (xvmcCreateSubpictureReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
......@@ -462,7 +474,6 @@ ProcXvMCCreateSubpicture(ClientPtr client)
WriteToClient(client, sizeof(xvmcCreateSubpictureReply), &rep);
if (dwords)
WriteToClient(client, dwords << 2, data);
AddResource(pSubpicture->subpicture_id, XvMCRTSubpicture, pSubpicture);
free(data);
......
......@@ -1379,6 +1379,9 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
if (!TouchResourceIsOwner(ti, listener->listener))
return !Success;
if (!ti->emulate_pointer)
return !Success;
nevents = TouchConvertToPointerEvent(ev, &motion, &button);
BUG_RETURN_VAL(nevents == 0, BadValue);
......
......@@ -9,6 +9,9 @@ cd "$srcdir"
autoreconf --force -v --install || exit 1
cd "$ORIGDIR" || exit $?
git config --local --get format.subjectPrefix ||
git config --local format.subjectPrefix "PATCH xserver"
if test -z "$NOCONFIGURE"; then
exec "$srcdir"/configure "$@"
fi
......@@ -26,9 +26,9 @@ dnl
dnl Process this file with autoconf to create configure.
AC_PREREQ(2.60)
AC_INIT([xorg-server], 1.18.0, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
RELEASE_DATE="2015-11-09"
RELEASE_NAME="Moussaka"
AC_INIT([xorg-server], 1.18.4, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
RELEASE_DATE="2016-07-19"
RELEASE_NAME="Skordalia"
AC_CONFIG_SRCDIR([Makefile.am])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([foreign dist-bzip2])
......@@ -218,7 +218,8 @@ AC_SUBST(DLOPEN_LIBS)
dnl Checks for library functions.
AC_CHECK_FUNCS([backtrace ffs geteuid getuid issetugid getresuid \
getdtablesize getifaddrs getpeereid getpeerucred getprogname getzoneid \
mmap seteuid shmctl64 strncasecmp vasprintf vsnprintf walkcontext])
mmap posix_fallocate seteuid shmctl64 strncasecmp vasprintf vsnprintf \
walkcontext])
AC_REPLACE_FUNCS([reallocarray strcasecmp strcasestr strlcat strlcpy strndup])
AC_CHECK_DECLS([program_invocation_short_name], [], [], [[#include <errno.h>]])
......@@ -492,6 +493,25 @@ AC_ARG_ENABLE(listen-local, AS_HELP_STRING([--disable-listen-local],
[Listen on local by default (default:enabled)]),
[LISTEN_LOCAL=$enableval], [LISTEN_LOCAL=yes])
case $host_os in
linux*)
FALLBACK_INPUT_DRIVER="libinput"
;;
*)
FALLBACK_INPUT_DRIVER=""
;;
esac
AC_ARG_WITH(fallback-input-driver,
AC_HELP_STRING([--with-fallback-input-driver=$FALLBACK_INPUT_DRIVER],
[Input driver fallback if the requested driver for a device is unavailable]),
[ FALLBACK_INPUT_DRIVER=$withval ], [])
if test "x$FALLBACK_INPUT_DRIVER" = "xno"; then
FALLBACK_INPUT_DRIVER=""
fi
AC_MSG_CHECKING([for fallback input driver])
AC_MSG_RESULT([$FALLBACK_INPUT_DRIVER])
AC_DEFINE_UNQUOTED(FALLBACK_INPUT_DRIVER, ["$FALLBACK_INPUT_DRIVER"], [ Fallback input driver ])
dnl Determine font path
XORG_FONTROOTDIR
XORG_FONTSUBDIR(FONTMISCDIR, fontmiscdir, misc)
......@@ -554,17 +574,27 @@ AC_ARG_WITH(apple-application-name,AS_HELP_STRING([--with-apple-application-name
[ APPLE_APPLICATION_NAME="${withval}" ],
[ APPLE_APPLICATION_NAME="X11" ])
AC_SUBST([APPLE_APPLICATION_NAME])
AC_ARG_WITH(launchd-id-prefix, AS_HELP_STRING([--with-launchd-id-prefix=PATH], [Deprecated: Use --with-bundle-id-prefix.]),
[ BUNDLE_ID_PREFIX="${withval}" ],
[ BUNDLE_ID_PREFIX="org.x" ])
AC_ARG_WITH(bundle-id-prefix, AS_HELP_STRING([--with-bundle-id-prefix=PATH], [Prefix to use for bundle identifiers (default: org.x)]),
AC_ARG_WITH(bundle-id-prefix, AS_HELP_STRING([--with-bundle-id-prefix=RDNS_PREFIX], [Prefix to use for bundle identifiers (default: org.x)]),
[ BUNDLE_ID_PREFIX="${withval}" ])
AC_SUBST([BUNDLE_ID_PREFIX])
AC_DEFINE_UNQUOTED(BUNDLE_ID_PREFIX, "$BUNDLE_ID_PREFIX", [Prefix to use for bundle identifiers])
m4_define(DEFAULT_BUNDLE_VERSION, m4_esyscmd([echo ]AC_PACKAGE_VERSION[ | cut -f1-3 -d. | tr -d '\n']))
AC_ARG_WITH(bundle-version, AS_HELP_STRING([--with-bundle-version=VERSION], [Version to use for X11.app's CFBundleVersion (default: ]DEFAULT_BUNDLE_VERSION[)]),
[ BUNDLE_VERSION="${withval}" ],
[ BUNDLE_VERSION="DEFAULT_BUNDLE_VERSION" ])
AC_SUBST([BUNDLE_VERSION])
AC_ARG_WITH(bundle-version-string, AS_HELP_STRING([--with-bundle-version-string=VERSION], [Version to use for X11.app's CFBundleShortVersionString (default: ]AC_PACKAGE_VERSION[)]),
[ BUNDLE_VERSION_STRING="${withval}" ],
[ BUNDLE_VERSION_STRING="${PACKAGE_VERSION}" ])
AC_SUBST([BUNDLE_VERSION_STRING])
AC_ARG_ENABLE(sparkle,AS_HELP_STRING([--enable-sparkle], [Enable updating of X11.app using the Sparkle Framework (default: disabled)]),
[ XQUARTZ_SPARKLE="${enableval}" ],
[ XQUARTZ_SPARKLE="no" ])
AC_SUBST([XQUARTZ_SPARKLE])
AC_ARG_WITH(sparkle-feed-url, AS_HELP_STRING([--with-sparkle-feed-url=URL], [URL for the Sparkle feed (default: https://www.xquartz.org/releases/sparkle/release.xml)]),
[ XQUARTZ_SPARKLE_FEED_URL="${withval}" ],
[ XQUARTZ_SPARKLE_FEED_URL="https://www.xquartz.org/releases/sparkle/release.xml" ])
AC_SUBST([XQUARTZ_SPARKLE_FEED_URL])
AC_ARG_ENABLE(visibility, AS_HELP_STRING([--enable-visibility], [Enable symbol visibility (default: auto)]),
[SYMBOL_VISIBILITY=$enableval],
[SYMBOL_VISIBILITY=auto])
......@@ -832,23 +862,26 @@ REQUIRED_MODULES="$FIXESPROTO $DAMAGEPROTO $XCMISCPROTO $XTRANS $BIGREQSPROTO $S
dnl systemd socket activation
dnl activate the code in libxtrans that grabs systemd's socket fds
dnl libsystemd-daemon was moved into libsystemd in version 209
LIBSYSTEMD="libsystemd >= 209"
AC_ARG_WITH([systemd-daemon],
AS_HELP_STRING([--with-systemd-daemon],
[support systemd socket activation (default: auto)]),
[WITH_SYSTEMD_DAEMON=$withval], [WITH_SYSTEMD_DAEMON=auto])
PKG_CHECK_MODULES([SYSTEMD_DAEMON], [libsystemd-daemon],
[HAVE_SYSTEMD_DAEMON=yes],
[PKG_CHECK_MODULES([SYSTEMD_DAEMON], [libsystemd],
[HAVE_SYSTEMD_DAEMON=yes], [HAVE_SYSTEMD_DAEMON=no])])
if test "x$WITH_SYSTEMD_DAEMON" = xauto; then
WITH_SYSTEMD_DAEMON="$HAVE_SYSTEMD_DAEMON"
fi
if test "x$WITH_SYSTEMD_DAEMON" = xyes; then
if test "x$HAVE_SYSTEMD_DAEMON" = xno; then
if test "x$WITH_SYSTEMD_DAEMON" = "xyes" -o "x$WITH_SYSTEMD_DAEMON" = "xauto" ; then
PKG_CHECK_MODULES([SYSTEMD_DAEMON], [$LIBSYSTEMD],
[HAVE_SYSTEMD_DAEMON=yes;
LIBSYSTEMD_DAEMON="$LIBSYSTEMD"],
[PKG_CHECK_MODULES([SYSTEMD_DAEMON], [libsystemd-daemon],
[HAVE_SYSTEMD_DAEMON=yes;
LIBSYSTEMD_DAEMON=libsystemd-daemon],
[HAVE_SYSTEMD_DAEMON=no])])
if test "x$HAVE_SYSTEMD_DAEMON" = xyes; then
AC_DEFINE(HAVE_SYSTEMD_DAEMON, 1, [Define to 1 if libsystemd-daemon is available])
REQUIRED_LIBS="$REQUIRED_LIBS $LIBSYSTEMD_DAEMON"
elif test "x$WITH_SYSTEMD_DAEMON" = xyes; then
AC_MSG_ERROR([systemd support requested but no library has been found])
fi
AC_DEFINE(HAVE_SYSTEMD_DAEMON, 1, [Define to 1 if libsystemd-daemon is available])
REQUIRED_LIBS="$REQUIRED_LIBS libsystemd-daemon"
fi
AM_CONDITIONAL([HAVE_SYSTEMD_DAEMON], [test "x$HAVE_SYSTEMD_DAEMON" = "xyes"])
......@@ -876,7 +909,7 @@ if test "x$CONFIG_UDEV" = xyes; then
fi
SAVE_LIBS=$LIBS
SAVE_CFLAGS=$CFLAGS
CFLAGS=$UDEV_CFLAGS
CFLAGS="$CFLAGS $UDEV_CFLAGS"
LIBS=$UDEV_LIBS
AC_CHECK_FUNCS([udev_monitor_filter_add_match_tag])
AC_CHECK_FUNCS([udev_enumerate_add_match_tag])
......@@ -1289,7 +1322,7 @@ fi
if test "x$DRI2" = xyes; then
save_CFLAGS=$CFLAGS
CFLAGS="$GL_CFLAGS $LIBDRM_CFLAGS"
CFLAGS="$CFLAGS $GL_CFLAGS $LIBDRM_CFLAGS"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <GL/gl.h>
#include <GL/internal/dri_interface.h>
#ifndef __DRI_DRI2
......@@ -1506,6 +1539,14 @@ if test "x$XDMAUTH" = xyes; then
fi
fi
if test "x$XF86VIDMODE" = xauto; then
PKG_CHECK_EXISTS($VIDMODEPROTO, [XF86VIDMODE=yes], [XF86VIDMODE=no])
fi
if test "x$XF86VIDMODE" = xyes; then
AC_DEFINE(XF86VIDMODE, 1, [Support XFree86 Video Mode extension])
fi
AM_CONDITIONAL([XF86VIDMODE], [test "x$XF86VIDMODE" = xyes])
AC_DEFINE_DIR(COMPILEDDEFAULTFONTPATH, FONTPATH, [Default font path])
AC_DEFINE_DIR(SERVER_MISC_CONFIG_PATH, SERVERCONFIG, [Server miscellaneous config path])
AC_DEFINE_DIR(BASE_FONT_PATH, FONTROOTDIR, [Default base font path])
......@@ -2015,13 +2056,8 @@ if test "x$XORG" = xyes; then
AC_DEFINE(XFreeXDGA, 1, [Build XDGA support])
fi
if test "x$XF86VIDMODE" = xauto; then
PKG_CHECK_MODULES(XF86VIDMODE, $VIDMODEPROTO, [XF86VIDMODE=yes], [XF86VIDMODE=no])
fi
if test "x$XF86VIDMODE" = xyes; then
XORG_MODULES="$XORG_MODULES $VIDMODEPROTO"
PKG_CHECK_MODULES(XF86VIDMODE, $VIDMODEPROTO)
AC_DEFINE(XF86VIDMODE, 1, [Support XFree86 Video Mode extension])
fi
if test -n "$XORG_MODULES"; then
......@@ -2032,8 +2068,7 @@ if test "x$XORG" = xyes; then
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
PKG_CHECK_EXISTS(libdrm >= 2.4.46, XORG_DRIVER_MODESETTING=yes, XORG_DRIVER_MODESETTING=no)
fi
AC_SUBST([XORG_LIBS])
......@@ -2104,7 +2139,6 @@ AM_CONDITIONAL([LNXACPI], [test "x$linux_acpi" = xyes])
AM_CONDITIONAL([LNXAPM], [test "x$linux_apm" = xyes])
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])
......@@ -2450,7 +2484,11 @@ AM_CONDITIONAL(XFAKESERVER, [test "x$KDRIVE" = xyes && test "x$XFAKE" = xyes])
dnl Xwayland DDX
PKG_CHECK_MODULES(XWAYLANDMODULES, [wayland-client >= 1.3.0 libdrm epoxy], [have_xwayland=yes], [have_xwayland=no])
XWAYLANDMODULES="wayland-client >= 1.3.0 libdrm epoxy"
if test "x$XF86VIDMODE" = xyes; then
XWAYLANDMODULES="$XWAYLANDMODULES $VIDMODEPROTO"
fi
PKG_CHECK_MODULES(XWAYLANDMODULES, [$XWAYLANDMODULES], [have_xwayland=yes], [have_xwayland=no])
AC_MSG_CHECKING([whether to build Xwayland DDX])
if test "x$XWAYLAND" = xauto; then
XWAYLAND="$have_xwayland"
......
......@@ -288,6 +288,29 @@ AllocARGBCursor(unsigned char *psrcbits, unsigned char *pmaskbits,
goto error;
*ppCurs = pCurs;
if (argb) {
size_t i, size = bits->width * bits->height;
for (i = 0; i < size; i++) {
if ((argb[i] & 0xff000000) == 0 && (argb[i] & 0xffffff) != 0) {
/* ARGB data doesn't seem pre-multiplied, fix it */
for (i = 0; i < size; i++) {
CARD32 a, ar, ag, ab;
a = argb[i] >> 24;
ar = a * ((argb[i] >> 16) & 0xff) / 0xff;
ag = a * ((argb[i] >> 8) & 0xff) / 0xff;
ab = a * (argb[i] & 0xff) / 0xff;
argb[i] = a << 24 | ar << 16 | ag << 8 | ab;
}
break;
}
}
}
return Success;
error:
......
......@@ -1682,8 +1682,7 @@ ProcSetModifierMapping(ClientPtr client)
stuff->numKeyPerModifier);
if (rc == MappingFailed || rc == -1)
return BadValue;
if (rc != Success && rc != MappingSuccess && rc != MappingFailed &&
rc != MappingBusy)
if (rc != MappingSuccess && rc != MappingFailed && rc != MappingBusy)
return rc;
rep.success = rc;
......
......@@ -620,6 +620,28 @@ ClientSignal(ClientPtr client)
return FALSE;
}
int
ClientSignalAll(ClientPtr client, ClientSleepProcPtr function, void *closure)
{
SleepQueuePtr q;
int count = 0;
for (q = sleepQueue; q; q = q->next) {
if (!(client == CLIENT_SIGNAL_ANY || q->client == client))
continue;
if (!(function == CLIENT_SIGNAL_ANY || q->function == function))
continue;
if (!(closure == CLIENT_SIGNAL_ANY || q->closure == closure))
continue;
count += QueueWorkProc(q->function, q->client, q->closure);
}
return count;
}
void
ClientWakeup(ClientPtr client)
{
......
......@@ -1446,19 +1446,25 @@ DeviceFocusEvents(DeviceIntPtr dev, WindowPtr from, WindowPtr to, int mode)
if ((to == NullWindow) || (to == PointerRootWin)) {
if ((from == NullWindow) || (from == PointerRootWin)) {
if (from == PointerRootWin)
if (from == PointerRootWin) {
DeviceFocusEvent(dev, XI_FocusOut, mode, NotifyPointer,
sprite->win);
DeviceFocusOutEvents(dev, sprite->win,
GetCurrentRootWindow(dev), mode,
NotifyPointer);
}
/* Notify all the roots */
for (i = 0; i < nscreens; i++)
DeviceFocusEvent(dev, XI_FocusOut, mode, out,
screenInfo.screens[i]->root);
}
else {
if (IsParent(from, sprite->win))
if (IsParent(from, sprite->win)) {
DeviceFocusEvent(dev, XI_FocusOut, mode, NotifyPointer,
sprite->win);
DeviceFocusOutEvents(dev, sprite->win, from, mode,
NotifyPointer);
}
DeviceFocusEvent(dev, XI_FocusOut, mode, NotifyNonlinear, from);
/* next call catches the root too, if the screen changed */
DeviceFocusOutEvents(dev, from, NullWindow, mode,
......@@ -1476,10 +1482,13 @@ DeviceFocusEvents(DeviceIntPtr dev, WindowPtr from, WindowPtr to, int mode)
}
else {
if ((from == NullWindow) || (from == PointerRootWin)) {
if (from == PointerRootWin)
if (from == PointerRootWin) {
DeviceFocusEvent(dev, XI_FocusOut, mode, NotifyPointer,
sprite->win);
DeviceFocusOutEvents(dev, sprite->win,
GetCurrentRootWindow(dev), mode,
NotifyPointer);
}
for (i = 0; i < nscreens; i++)
DeviceFocusEvent(dev, XI_FocusOut, mode, out,
screenInfo.screens[i]->root);
......@@ -1506,9 +1515,12 @@ DeviceFocusEvents(DeviceIntPtr dev, WindowPtr from, WindowPtr to, int mode)
if ((IsParent(from, sprite->win)) &&
(sprite->win != from) &&
(!IsParent(to, sprite->win)) &&
(!IsParent(sprite->win, to)))
(!IsParent(sprite->win, to))) {
DeviceFocusEvent(dev, XI_FocusOut, mode, NotifyPointer,
sprite->win);
DeviceFocusOutEvents(dev, sprite->win, from, mode,
NotifyPointer);
}
DeviceFocusEvent(dev, XI_FocusOut, mode, NotifyInferior, from);
DeviceFocusInEvents(dev, from, to, mode, NotifyVirtual);
DeviceFocusEvent(dev, XI_FocusIn, mode, NotifyAncestor, to);
......
......@@ -173,6 +173,9 @@ PixmapStartDirtyTracking(PixmapPtr src,
{
ScreenPtr screen = src->drawable.pScreen;
PixmapDirtyUpdatePtr dirty_update;
RegionPtr damageregion;
RegionRec dstregion;
BoxRec box;
dirty_update = calloc(1, sizeof(PixmapDirtyUpdateRec));
if (!dirty_update)
......@@ -205,6 +208,24 @@ PixmapStartDirtyTracking(PixmapPtr src,
return FALSE;
}
/* Damage destination rectangle so that the destination pixmap contents
* will get fully initialized
*/
box.x1 = dirty_update->x;
box.y1 = dirty_update->y;
if (dirty_update->rotation == RR_Rotate_90 ||
dirty_update->rotation == RR_Rotate_270) {
box.x2 = dirty_update->x + slave_dst->drawable.height;
box.y2 = dirty_update->y + slave_dst->drawable.width;
} else {
box.x2 = dirty_update->x + slave_dst->drawable.width;
box.y2 = dirty_update->y + slave_dst->drawable.height;
}
RegionInit(&dstregion, &box, 1);
damageregion = DamageRegion(dirty_update->damage);
RegionUnion(damageregion, damageregion, &dstregion);
RegionUninit(&dstregion);
DamageRegister(&src->drawable, dirty_update->damage);
xorg_list_add(&dirty_update->ent, &screen->pixmap_dirty_list);
return TRUE;
......
......@@ -134,13 +134,19 @@ InitPredictableAccelerationScheme(DeviceIntPtr dev,
scheme = *protoScheme;
vel = calloc(1, sizeof(DeviceVelocityRec));
schemeData = calloc(1, sizeof(PredictableAccelSchemeRec));
if (!vel || !schemeData)
if (!vel || !schemeData) {
free(vel);
free(schemeData);
return FALSE;
}
InitVelocityData(vel);
schemeData->vel = vel;
scheme.accelData = schemeData;
if (!InitializePredictableAccelerationProperties(dev, vel, schemeData))
if (!InitializePredictableAccelerationProperties(dev, vel, schemeData)) {
free(vel);
free(schemeData);
return FALSE;
}
/* all fine, assign scheme to device */
dev->valuator->accelScheme = scheme;
return TRUE;
......
......@@ -127,6 +127,7 @@ Equipment Corporation.
#include "compint.h"
#endif
#include "selection.h"
#include "inpututils.h"
#include "privates.h"
#include "xace.h"
......@@ -272,6 +273,131 @@ log_window_info(WindowPtr pWin, int depth)
ErrorF("\n");
}
static const char*
grab_grabtype_to_text(GrabPtr pGrab)
{
switch (pGrab->grabtype) {
case XI2:
return "xi2";
case CORE:
return "core";
default:
return "xi1";
}
}
static const char*
grab_type_to_text(GrabPtr pGrab)
{
switch (pGrab->type) {
case ButtonPress:
return "ButtonPress";
case KeyPress:
return "KeyPress";
case XI_Enter:
return "XI_Enter";
case XI_FocusIn:
return "XI_FocusIn";
default:
return "unknown?!";
}
}
static void
log_grab_info(void *value, XID id, void *cdata)
{
int i, j;
GrabPtr pGrab = (GrabPtr)value;
ErrorF(" grab 0x%lx (%s), type '%s' on window 0x%lx\n",
(unsigned long) pGrab->resource,
grab_grabtype_to_text(pGrab),
grab_type_to_text(pGrab),
(unsigned long) pGrab->window->drawable.id);
ErrorF(" detail %d (mask %lu), modifiersDetail %d (mask %lu)\n",
pGrab->detail.exact,
pGrab->detail.pMask ? (unsigned long) *(pGrab->detail.pMask) : 0,
pGrab->modifiersDetail.exact,
pGrab->modifiersDetail.pMask ?
(unsigned long) *(pGrab->modifiersDetail.pMask) :
(unsigned long) 0);
ErrorF(" device '%s' (%d), modifierDevice '%s' (%d)\n",
pGrab->device->name, pGrab->device->id,
pGrab->modifierDevice->name, pGrab->modifierDevice->id);
if (pGrab->grabtype == CORE) {
ErrorF(" core event mask 0x%lx\n",
(unsigned long) pGrab->eventMask);
}
else if (pGrab->grabtype == XI) {
ErrorF(" xi1 event mask 0x%lx\n",
(unsigned long) pGrab->eventMask);
}
else if (pGrab->grabtype == XI2) {
for (i = 0; i < xi2mask_num_masks(pGrab->xi2mask); i++) {
const unsigned char *mask;
int print;
print = 0;
for (j = 0; j < XI2MASKSIZE; j++) {
mask = xi2mask_get_one_mask(pGrab->xi2mask, i);
if (mask[j]) {
print = 1;
break;
}
}
if (!print)
continue;
ErrorF(" xi2 event mask 0x");
for (j = 0; j < xi2mask_mask_size(pGrab->xi2mask); j++)
ErrorF("%x ", mask[j]);
ErrorF("\n");
}
}
ErrorF(" owner-events %s, kb %d ptr %d, confine 0x%lx, cursor 0x%lx\n",
pGrab->ownerEvents ? "true" : "false",
pGrab->keyboardMode, pGrab->pointerMode,
pGrab->confineTo ? (unsigned long) pGrab->confineTo->drawable.id : 0,
pGrab->cursor ? (unsigned long) pGrab->cursor->id : 0);
}
void
PrintPassiveGrabs(void)
{
int i;
LocalClientCredRec *lcc;
pid_t clientpid;
const char *cmdname;
const char *cmdargs;
ErrorF("Printing all currently registered grabs\n");
for (i = 1; i < currentMaxClients; i++) {
if (!clients[i] || clients[i]->clientState != ClientStateRunning)
continue;
clientpid = GetClientPid(clients[i]);
cmdname = GetClientCmdName(clients[i]);
cmdargs = GetClientCmdArgs(clients[i]);
if ((clientpid > 0) && (cmdname != NULL)) {
ErrorF(" Printing all registered grabs of client pid %ld %s %s\n",
(long) clientpid, cmdname, cmdargs ? cmdargs : "");
} else {
if (GetLocalClientCreds(clients[i], &lcc) == -1) {
ErrorF(" GetLocalClientCreds() failed\n");
continue;
}
ErrorF(" Printing all registered grabs of client pid %ld uid %ld gid %ld\n",
(lcc->fieldsSet & LCC_PID_SET) ? (long) lcc->pid : 0,
(lcc->fieldsSet & LCC_UID_SET) ? (long) lcc->euid : 0,
(lcc->fieldsSet & LCC_GID_SET) ? (long) lcc->egid : 0);
FreeLocalClientCreds(lcc);
}
FindClientResourcesByType(clients[i], RT_PASSIVEGRAB, log_grab_info, NULL);
}
ErrorF("End list of registered passive grabs\n");
}
void
PrintWindowTree(void)
{
......@@ -3521,7 +3647,7 @@ WindowParentHasDeviceCursor(WindowPtr pWin,
* all of the windows
*/
void
SetRootClip(ScreenPtr pScreen, Bool enable)
SetRootClip(ScreenPtr pScreen, int enable)
{
WindowPtr pWin = pScreen->root;
WindowPtr pChild;
......@@ -3529,6 +3655,7 @@ SetRootClip(ScreenPtr pScreen, Bool enable)
Bool anyMarked = FALSE;
WindowPtr pLayerWin;
BoxRec box;
enum RootClipMode mode = enable;
if (!pWin)
return;
......@@ -3553,23 +3680,32 @@ SetRootClip(ScreenPtr pScreen, Bool enable)
}
}
/*
* Use REGION_BREAK to avoid optimizations in ValidateTree
* that assume the root borderClip can't change well, normally
* it doesn't...)
*/
if (enable) {
if (mode != ROOT_CLIP_NONE) {
pWin->drawable.width = pScreen->width;
pWin->drawable.height = pScreen->height;
box.x1 = 0;
box.y1 = 0;
box.x2 = pScreen->width;
box.y2 = pScreen->height;
RegionInit(&pWin->winSize, &box, 1);
RegionInit(&pWin->borderSize, &box, 1);
if (WasViewable)
RegionReset(&pWin->borderClip, &box);
pWin->drawable.width = pScreen->width;
pWin->drawable.height = pScreen->height;
/*
* Use REGION_BREAK to avoid optimizations in ValidateTree
* that assume the root borderClip can't change well, normally
* it doesn't...)
*/
RegionBreak(&pWin->clipList);
/* For INPUT_ONLY, empty the borderClip so no rendering will ever
* be attempted to the screen pixmap (only redirected windows),
* but we keep borderSize as full regardless. */
if (WasViewable && mode == ROOT_CLIP_FULL)
RegionReset(&pWin->borderClip, &box);
else
RegionEmpty(&pWin->borderClip);
}
else {
RegionEmpty(&pWin->borderClip);
......
......@@ -312,6 +312,8 @@ int
proc_dri3_dispatch(ClientPtr client)
{
REQUEST(xReq);
if (!client->local)
return BadMatch;
if (stuff->data >= DRI3NumberRequests || !proc_dri3_vector[stuff->data])
return BadRequest;
return (*proc_dri3_vector[stuff->data]) (client);
......@@ -405,6 +407,8 @@ int
sproc_dri3_dispatch(ClientPtr client)
{
REQUEST(xReq);
if (!client->local)
return BadMatch;
if (stuff->data >= DRI3NumberRequests || !sproc_dri3_vector[stuff->data])
return BadRequest;
return (*sproc_dri3_vector[stuff->data]) (client);
......
......@@ -618,9 +618,9 @@ exaGlyphsToMask(PicturePtr pMask, ExaGlyphBufferPtr buffer)
}
static void
exaGlyphsToDst(PicturePtr pSrc, PicturePtr pDst, ExaGlyphBufferPtr buffer)
exaGlyphsToDst(CARD8 op, PicturePtr pSrc, PicturePtr pDst, ExaGlyphBufferPtr buffer)
{
exaCompositeRects(PictOpOver, pSrc, buffer->mask, pDst, buffer->count,
exaCompositeRects(op, pSrc, buffer->mask, pDst, buffer->count,
buffer->rects);
buffer->count = 0;
......@@ -801,7 +801,7 @@ exaGlyphs(CARD8 op,
0, 0, x - glyph->info.x,
y - glyph->info.y)
== ExaGlyphNeedFlush) {
exaGlyphsToDst(pSrc, pDst, &buffer);
exaGlyphsToDst(op, pSrc, pDst, &buffer);
exaBufferGlyph(pScreen, &buffer, glyph, pSrc, pDst,
xSrc + (x - glyph->info.x) - first_xOff,
ySrc + (y - glyph->info.y) - first_yOff,
......@@ -821,7 +821,7 @@ exaGlyphs(CARD8 op,
if (maskFormat)
exaGlyphsToMask(pMask, &buffer);
else
exaGlyphsToDst(pSrc, pDst, &buffer);
exaGlyphsToDst(op, pSrc, pDst, &buffer);
}
if (maskFormat) {
......
......@@ -1141,7 +1141,8 @@ exaTrapezoids(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
exaPrepareAccess(pPicture->pDrawable, EXA_PREPARE_DEST);
for (; ntrap; ntrap--, traps++)
(*ps->RasterizeTrapezoid) (pPicture, traps, -bounds.x1, -bounds.y1);
if (xTrapezoidValid(traps))
(*ps->RasterizeTrapezoid) (pPicture, traps, -bounds.x1, -bounds.y1);
exaFinishAccess(pPicture->pDrawable, EXA_PREPARE_DEST);
xRel = bounds.x1 + xSrc - xDst;
......
......@@ -46,10 +46,14 @@ libglamor_la_SOURCES = \
glamor_compositerects.c\
glamor_utils.c\
glamor_utils.h\
glamor_xv.c \
glamor_sync.c \
glamor.h
if XV
libglamor_la_SOURCES += \
glamor_xv.c
endif
libglamor_egl_stubs_la_SOURCES = glamor_egl_stubs.c
sdk_HEADERS = glamor.h
......@@ -140,6 +140,42 @@ glamor_get_pixmap_texture(PixmapPtr pixmap)
return pixmap_priv->fbo->tex;
}
void
glamor_bind_texture(glamor_screen_private *glamor_priv, GLenum texture,
glamor_pixmap_fbo *fbo, Bool destination_red)
{
glActiveTexture(texture);
glBindTexture(GL_TEXTURE_2D, fbo->tex);
/* If we're pulling data from a GL_RED texture, then whether we
* want to make it an A,0,0,0 result or a 0,0,0,R result depends
* on whether the destination is also a GL_RED texture.
*
* For GL_RED destinations, we need to leave the bits in the R
* channel. For all other destinations, we need to clear out the R
* channel so that it returns zero for R, G and B.
*
* Note that we're leaving the SWIZZLE_A value alone; for GL_RED
* destinations, that means we'll actually be returning R,0,0,R,
* but it doesn't matter as the bits in the alpha channel aren't
* going anywhere.
*/
/* Is the operand a GL_RED fbo?
*/
if (glamor_fbo_red_is_alpha(glamor_priv, fbo)) {
/* If destination is also GL_RED, then preserve the bits in
* the R channel */
if (destination_red)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_R, GL_RED);
else
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_R, GL_ZERO);
}
}
PixmapPtr
glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
unsigned int usage)
......@@ -379,6 +415,13 @@ glamor_debug_output_callback(GLenum source,
const void *userParam)
{
ScreenPtr screen = (void *)userParam;
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
if (glamor_priv->suppress_gl_out_of_memory_logging &&
source == GL_DEBUG_SOURCE_API && type == GL_DEBUG_TYPE_ERROR) {
return;
}
LogMessageVerb(X_ERROR, 0, "glamor%d: GL error: %*s\n",
screen->myNum, length, message);
}
......@@ -394,6 +437,9 @@ glamor_setup_debug_output(ScreenPtr screen)
return;
glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
/* Disable debugging messages other than GL API errors */
glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, NULL,
GL_FALSE);
glDebugMessageControl(GL_DEBUG_SOURCE_API,
GL_DEBUG_TYPE_ERROR,
GL_DONT_CARE,
......@@ -569,10 +615,20 @@ glamor_init(ScreenPtr screen, unsigned int flags)
glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP ||
epoxy_gl_version() >= 30 ||
epoxy_has_gl_extension("GL_NV_pack_subimage");
glamor_priv->has_vertex_array_object =
epoxy_has_gl_extension("GL_ARB_vertex_array_object");
glamor_priv->has_dual_blend =
epoxy_has_gl_extension("GL_ARB_blend_func_extended");
/* assume a core profile if we are GL 3.1 and don't have ARB_compatibility */
glamor_priv->is_core_profile =
gl_version >= 31 && !epoxy_has_gl_extension("GL_ARB_compatibility");
glamor_setup_debug_output(screen);
glamor_priv->use_quads = (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP);
glamor_priv->use_quads = (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) &&
!glamor_priv->is_core_profile;
/* Driver-specific hack: Avoid using GL_QUADS on VC4, where
* they'll be emulated more expensively than we can with our
* cached IB.
......@@ -590,6 +646,10 @@ glamor_init(ScreenPtr screen, unsigned int flags)
glamor_priv->max_fbo_size = MAX_FBO_SIZE;
#endif
glamor_priv->one_channel_format = GL_ALPHA;
if (epoxy_has_gl_extension("GL_ARB_texture_rg") && epoxy_has_gl_extension("GL_ARB_texture_swizzle"))
glamor_priv->one_channel_format = GL_RED;
glamor_set_debug_level(&glamor_debug_level);
glamor_priv->saved_procs.create_screen_resources =
......@@ -792,3 +852,12 @@ glamor_name_from_pixmap(PixmapPtr pixmap, CARD16 *stride, CARD32 *size)
}
return -1;
}
void
glamor_finish(ScreenPtr screen)
{
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
glamor_make_current(glamor_priv);
glFinish();
}
......@@ -64,6 +64,10 @@ typedef enum glamor_pixmap_type {
#define GLAMOR_VALID_FLAGS (GLAMOR_USE_EGL_SCREEN \
| GLAMOR_NO_DRI3)
/* until we need geometry shaders GL3.1 should suffice. */
#define GLAMOR_GL_CORE_VER_MAJOR 3
#define GLAMOR_GL_CORE_VER_MINOR 1
/* @glamor_init: Initialize glamor internal data structure.
*
* @screen: Current screen pointer.
......@@ -338,6 +342,7 @@ extern _X_EXPORT void glamor_destroy_gc(GCPtr gc);
extern Bool _X_EXPORT glamor_change_window_attributes(WindowPtr pWin, unsigned long mask);
extern void _X_EXPORT glamor_copy_window(WindowPtr window, DDXPointRec old_origin, RegionPtr src_region);
extern _X_EXPORT void glamor_finish(ScreenPtr screen);
#define HAS_GLAMOR_TEXT 1
#ifdef GLAMOR_FOR_XORG
......
......@@ -127,6 +127,10 @@ glamor_glyph_atlas_init(ScreenPtr screen, struct glamor_glyph_atlas *atlas)
atlas->atlas = glamor_create_pixmap(screen, glamor_priv->glyph_atlas_dim,
glamor_priv->glyph_atlas_dim, format->depth,
GLAMOR_CREATE_FBO_NO_FBO);
if (!glamor_pixmap_has_fbo(atlas->atlas)) {
glamor_destroy_pixmap(atlas->atlas);
atlas->atlas = NULL;
}
atlas->x = 0;
atlas->y = 0;
atlas->row_height = 0;
......@@ -182,7 +186,9 @@ static const glamor_facet glamor_facet_composite_glyphs_130 = {
.vs_exec = (" vec2 pos = primitive.zw * vec2(gl_VertexID&1, (gl_VertexID&2)>>1);\n"
GLAMOR_POS(gl_Position, (primitive.xy + pos))
" glyph_pos = (source + pos) * ATLAS_DIM_INV;\n"),
.fs_vars = ("varying vec2 glyph_pos;\n"),
.fs_vars = ("varying vec2 glyph_pos;\n"
"out vec4 color0;\n"
"out vec4 color1;\n"),
.fs_exec = (" vec4 mask = texture2D(atlas, glyph_pos);\n"),
.source_name = "source",
.locations = glamor_program_location_atlas,
......@@ -231,17 +237,16 @@ glamor_glyphs_flush(CARD8 op, PicturePtr src, PicturePtr dst,
glamor_screen_private *glamor_priv = glamor_get_screen_private(drawable->pScreen);
PixmapPtr atlas_pixmap = atlas->atlas;
glamor_pixmap_private *atlas_priv = glamor_get_pixmap_private(atlas_pixmap);
glamor_pixmap_fbo *atlas_fbo = glamor_pixmap_fbo_at(atlas_priv, 0, 0);
glamor_pixmap_fbo *atlas_fbo = glamor_pixmap_fbo_at(atlas_priv, 0);
PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
int box_x, box_y;
int box_index;
int off_x, off_y;
glamor_put_vbo_space(drawable->pScreen);
glEnable(GL_SCISSOR_TEST);
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, atlas_fbo->tex);
glamor_bind_texture(glamor_priv, GL_TEXTURE1, atlas_fbo, FALSE);
for (;;) {
if (!glamor_use_program_render(prog, op, src, dst))
......@@ -249,11 +254,13 @@ glamor_glyphs_flush(CARD8 op, PicturePtr src, PicturePtr dst,
glUniform1i(prog->atlas_uniform, 1);
glamor_pixmap_loop(pixmap_priv, box_x, box_y) {
glamor_pixmap_loop(pixmap_priv, box_index) {
BoxPtr box = RegionRects(dst->pCompositeClip);
int nbox = RegionNumRects(dst->pCompositeClip);
glamor_set_destination_drawable(drawable, box_x, box_y, TRUE, FALSE, prog->matrix_uniform, &off_x, &off_y);
glamor_set_destination_drawable(drawable, box_index, TRUE, FALSE,
prog->matrix_uniform,
&off_x, &off_y);
/* Run over the clip list, drawing the glyphs
* in each box
......@@ -420,8 +427,11 @@ glamor_composite_glyphs(CARD8 op,
glyph_atlas->atlas = NULL;
}
}
if (!glyph_atlas->atlas)
if (!glyph_atlas->atlas) {
glamor_glyph_atlas_init(screen, glyph_atlas);
if (!glyph_atlas->atlas)
goto bail_one;
}
glamor_glyph_add(glyph_atlas, glyph_draw);
}
......@@ -547,7 +557,7 @@ glamor_free_glyph_atlas(struct glamor_glyph_atlas *atlas)
if (!atlas)
return;
if (atlas->atlas)
FreePicture(atlas->atlas, 0);
(*atlas->atlas->drawable.pScreen->DestroyPixmap)(atlas->atlas);
free (atlas);
}
......
......@@ -107,7 +107,6 @@ glamor_composite_rectangles(CARD8 op,
struct glamor_pixmap_private *priv;
pixman_region16_t region;
pixman_box16_t *boxes;
int dst_x, dst_y;
int num_boxes;
PicturePtr source = NULL;
Bool need_free_region = FALSE;
......@@ -225,17 +224,18 @@ glamor_composite_rectangles(CARD8 op,
RegionExtents(&region)->x2, RegionExtents(&region)->y2,
RegionNumRects(&region));
glamor_get_drawable_deltas(dst->pDrawable, pixmap, &dst_x, &dst_y);
pixman_region_translate(&region, dst_x, dst_y);
DEBUGF("%s: pixmap +(%d, %d) extents (%d, %d),(%d, %d)\n",
__FUNCTION__, dst_x, dst_y,
RegionExtents(&region)->x1, RegionExtents(&region)->y1,
RegionExtents(&region)->x2, RegionExtents(&region)->y2);
boxes = pixman_region_rectangles(&region, &num_boxes);
if (op == PictOpSrc || op == PictOpClear) {
CARD32 pixel;
int dst_x, dst_y;
glamor_get_drawable_deltas(dst->pDrawable, pixmap, &dst_x, &dst_y);
pixman_region_translate(&region, dst_x, dst_y);
DEBUGF("%s: pixmap +(%d, %d) extents (%d, %d),(%d, %d)\n",
__FUNCTION__, dst_x, dst_y,
RegionExtents(&region)->x1, RegionExtents(&region)->y1,
RegionExtents(&region)->x2, RegionExtents(&region)->y2);
if (op == PictOpClear)
pixel = 0;
......
......@@ -38,8 +38,8 @@ use_copyarea(PixmapPtr dst, GCPtr gc, glamor_program *prog, void *arg)
struct copy_args *args = arg;
glamor_pixmap_fbo *src = args->src;
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, src->tex);
glamor_bind_texture(glamor_get_screen_private(dst->drawable.pScreen),
GL_TEXTURE0, src, TRUE);
glUniform2f(prog->fill_offset_uniform, args->dx, args->dy);
glUniform2f(prog->fill_size_inv_uniform, 1.0f/src->width, 1.0f/src->height);
......@@ -67,8 +67,8 @@ use_copyplane(PixmapPtr dst, GCPtr gc, glamor_program *prog, void *arg)
struct copy_args *args = arg;
glamor_pixmap_fbo *src = args->src;
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, src->tex);
glamor_bind_texture(glamor_get_screen_private(dst->drawable.pScreen),
GL_TEXTURE0, src, TRUE);
glUniform2f(prog->fill_offset_uniform, args->dx, args->dy);
glUniform2f(prog->fill_size_inv_uniform, 1.0f/src->width, 1.0f/src->height);
......@@ -307,7 +307,7 @@ glamor_copy_fbo_fbo_draw(DrawablePtr src,
PixmapPtr dst_pixmap = glamor_get_drawable_pixmap(dst);
glamor_pixmap_private *src_priv = glamor_get_pixmap_private(src_pixmap);
glamor_pixmap_private *dst_priv = glamor_get_pixmap_private(dst_pixmap);
int src_box_x, src_box_y, dst_box_x, dst_box_y;
int src_box_index, dst_box_index;
int dst_off_x, dst_off_y;
int src_off_x, src_off_y;
GLshort *v;
......@@ -368,19 +368,20 @@ glamor_copy_fbo_fbo_draw(DrawablePtr src,
glEnable(GL_SCISSOR_TEST);
glamor_pixmap_loop(src_priv, src_box_x, src_box_y) {
BoxPtr src_box = glamor_pixmap_box_at(src_priv, src_box_x, src_box_y);
glamor_pixmap_loop(src_priv, src_box_index) {
BoxPtr src_box = glamor_pixmap_box_at(src_priv, src_box_index);
args.dx = dx + src_off_x - src_box->x1;
args.dy = dy + src_off_y - src_box->y1;
args.src = glamor_pixmap_fbo_at(src_priv, src_box_x, src_box_y);
args.src = glamor_pixmap_fbo_at(src_priv, src_box_index);
if (!glamor_use_program(dst_pixmap, gc, prog, &args))
goto bail_ctx;
glamor_pixmap_loop(dst_priv, dst_box_x, dst_box_y) {
glamor_set_destination_drawable(dst, dst_box_x, dst_box_y, FALSE, FALSE,
prog->matrix_uniform, &dst_off_x, &dst_off_y);
glamor_pixmap_loop(dst_priv, dst_box_index) {
glamor_set_destination_drawable(dst, dst_box_index, FALSE, FALSE,
prog->matrix_uniform,
&dst_off_x, &dst_off_y);
glScissor(dst_off_x - args.dx,
dst_off_y - args.dy,
......@@ -640,6 +641,9 @@ glamor_copy(DrawablePtr src,
Pixel bitplane,
void *closure)
{
if (nbox == 0)
return;
if (glamor_copy_gl(src, dst, gc, box, nbox, dx, dy, reverse, upsidedown, bitplane, closure))
return;
glamor_copy_bail(src, dst, gc, box, nbox, dx, dy, reverse, upsidedown, bitplane, closure);
......
......@@ -87,6 +87,17 @@ glamor_link_glsl_prog(ScreenPtr screen, GLint prog, const char *format, ...)
GLint ok;
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
if (glamor_priv->has_khr_debug) {
char *label;
va_list va;
va_start(va, format);
XNFvasprintf(&label, format, va);
glObjectLabel(GL_PROGRAM, prog, -1, label);
free(label);
va_end(va);
}
glLinkProgram(prog);
glGetProgramiv(prog, GL_LINK_STATUS, &ok);
if (!ok) {
......@@ -100,17 +111,6 @@ glamor_link_glsl_prog(ScreenPtr screen, GLint prog, const char *format, ...)
ErrorF("Failed to link: %s\n", info);
FatalError("GLSL link failure\n");
}
if (glamor_priv->has_khr_debug) {
char *label;
va_list va;
va_start(va, format);
XNFvasprintf(&label, format, va);
glObjectLabel(GL_PROGRAM, prog, -1, label);
free(label);
va_end(va);
}
}
/*
......
......@@ -188,8 +188,7 @@ glamor_dash_setup(DrawablePtr drawable, GCPtr gc)
/* Set the dash pattern as texture 1 */
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, dash_priv->fbo->tex);
glamor_bind_texture(glamor_priv, GL_TEXTURE1, dash_priv->fbo, FALSE);
glUniform1i(prog->dash_uniform, 1);
glUniform1f(prog->dash_length_uniform, dash_pixmap->drawable.width);
......@@ -205,16 +204,16 @@ glamor_dash_loop(DrawablePtr drawable, GCPtr gc, glamor_program *prog,
{
PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
int box_x, box_y;
int box_index;
int off_x, off_y;
glEnable(GL_SCISSOR_TEST);
glamor_pixmap_loop(pixmap_priv, box_x, box_y) {
glamor_pixmap_loop(pixmap_priv, box_index) {
int nbox = RegionNumRects(gc->pCompositeClip);
BoxPtr box = RegionRects(gc->pCompositeClip);
glamor_set_destination_drawable(drawable, box_x, box_y, TRUE, TRUE,
glamor_set_destination_drawable(drawable, box_index, TRUE, TRUE,
prog->matrix_uniform, &off_x, &off_y);
while (nbox--) {
......
This diff is collapsed.
......@@ -48,9 +48,3 @@ glamor_egl_dri3_fd_name_from_tex(ScreenPtr screen,
{
return 0;
}
unsigned int
glamor_egl_create_argb8888_based_texture(ScreenPtr screen, int w, int h, Bool linear)
{
return 0;
}
......@@ -75,6 +75,8 @@ cache_format(GLenum format)
{
switch (format) {
case GL_ALPHA:
case GL_LUMINANCE:
case GL_RED:
return 2;
case GL_RGB:
return 1;
......@@ -329,27 +331,34 @@ glamor_destroy_fbo(glamor_screen_private *glamor_priv,