miSpriteBlockHandler was leaving the BlockHandler wrapped until just
before calling any nested block handler. If any code executed before
that added or removed block handlers, the wrapping chain would have
been broken.
Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Even though -Wcomment doesn't mind it (in gcc or clang), the appearance
of */* confuses the syntax highlighter of some editors (eg. vim), and
causes warnings in MSVC.
Signed-off-by: Peter Harris <pharris@opentext.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
miZeroLine allocates enough space to draw a line spanning the entire
width/height of the target drawable. When drawing multiple shorter
lines, this leaves most of the space in that buffer unfilled. Let
multiple lines be drawn into the buffer if there is plenty of space.
Speeds up glamor fallback zero-width lines:
Before
6000000 trep @ 0.0020 msec (508000.0/sec): 1-pixel line
6000000 trep @ 0.0020 msec (492000.0/sec): 10-pixel line
6000000 trep @ 0.0023 msec (427000.0/sec): 100-pixel line
4000000 trep @ 0.0035 msec (282000.0/sec): 500-pixel line
After:
600000000 trep @ 0.0000 msec (43400000.0/sec): 1-pixel line
140000000 trep @ 0.0001 msec (13000000.0/sec): 10-pixel line
16000000 trep @ 0.0008 msec (1300000.0/sec): 100-pixel line
4000000 trep @ 0.0038 msec (261000.0/sec): 500-pixel line
(500 pixel lines do not change in performance because the buffer can
only one one of them.)
Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
This allocates span data for multiple arcs and draws the
whole set in one call, rather than doing them one at a time. For
modern hardware, this is a significant performance improvement.
v2: Limit the number of spans per buffer to 4M to avoid
integer overflow in computing the malloc size.
Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Instead of forcing drivers to figure out when to call miZeroPolyArc,
have miPolyArc call that when possible.
This involved renaming the existing miPolyArc call to miWideArc and
creating a new miPolyArc wrapper function as miZeroPolyArc falls back
to miWideArc when the arc is too large to be drawn with the zero-width
code (ellipses larger than 800x800).
Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Instead of requiring all drivers to figure out which mi function to
call for each of the four cases, create a single wrapper in mi that
handles them correctly. Now drivers can simply use miPolylines in all
cases.
Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
mieq.c:520:9: error: void function 'mieqProcessDeviceEvent' should not return a value [-Wreturn-type,Semantic Issue]
return 0;
^ ~
1 error generated.
Regression-from: 9fb08310b5
Found-by: Tinderbox
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Once a device is disabled, it doesn't have a sprite pointer anymore. If an
event is still in the queue and processed after DisableDevice finished, a
dereference causes a crash. Example backtrace (crash forced by injecting an
event at the right time):
(EE) 0: /opt/xorg/bin/Xorg (OsSigHandler+0x3c) [0x48d334]
(EE) 1: /lib64/libpthread.so.0 (__restore_rt+0x0) [0x37fcc0f74f]
(EE) 2: /opt/xorg/bin/Xorg (mieqMoveToNewScreen+0x38) [0x609240]
(EE) 3: /opt/xorg/bin/Xorg (mieqProcessDeviceEvent+0xd4) [0x609389]
(EE) 4: /opt/xorg/bin/Xorg (mieqProcessInputEvents+0x206) [0x609720]
(EE) 5: /opt/xorg/bin/Xorg (ProcessInputEvents+0xd) [0x4aeb58]
(EE) 6: /opt/xorg/bin/Xorg (xf86VTSwitch+0x1a6) [0x4af457]
(EE) 7: /opt/xorg/bin/Xorg (xf86Wakeup+0x2bf) [0x4af0a7]
(EE) 8: /opt/xorg/bin/Xorg (WakeupHandler+0x83) [0x4445cb]
(EE) 9: /opt/xorg/bin/Xorg (WaitForSomething+0x3fe) [0x491bf6]
(EE) 10: /opt/xorg/bin/Xorg (Dispatch+0x97) [0x435748]
(EE) 11: /opt/xorg/bin/Xorg (dix_main+0x61d) [0x4438a9]
(EE) 12: /opt/xorg/bin/Xorg (main+0x28) [0x49ba28]
(EE) 13: /lib64/libc.so.6 (__libc_start_main+0xf5) [0x37fc821d65]
(EE) 14: /opt/xorg/bin/Xorg (_start+0x29) [0x425e69]
(EE) 15: ? (?+0x29) [0x29]
xf86VTSwitch() calls ProcessInputEvents() before disabling a device, and
DisableDevice() calls mieqProcessInputEvents() again when flushing touches and
button events. Between that and disabling the device (which causes new events
to be refused) there is a window where events may be triggered and enqueued.
On the next call to PIE that event is processed on a now defunct device,
causing the crash.
The simplest fix to this is to discard events from disabled devices. We flush
the queue often enough before disabling that when we get here, we really don't
care about the events from this device.
X.Org Bug 77884 <http://bugs.freedesktop.org/show_bug.cgi?id=77884>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reported-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Tested-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
Introduced in
73698d41e4 "Make XYToWindow a screen function"
Moving the code into miwindow.c changed the start of the loop from
RootWindow()->firstChild to DeepestSpriteWindow(). This function is only
supposed to be called from miXYToWindow which resets spriteTraceGood to 1,
thus DeepestSpriteWindow() is always the root window anyway.
What got dropped was the firstChild as the first window to handle, so we may
end up with the root window twice in the sprite trace.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
This allows DDXen to override the window picking to account for
native windows not seen by the X server. The bulk of the picking logic
is exposed as a new helper function, miSpriteTrace(). This function
completes the sprite trace filled out by the caller, and can be set up
to start the search from a given toplevel window.
v2: Leave existing XYToWindow API in place for API compatibility
Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Printing these as ErrorF is fairly obnoxious, since it means the
non-hardware servers now spew stuff to the console for entirely routine
events. And actually, printing these at all is fairly obnoxious, since
a) we're printing a line for every extension, whether it's enabled or
not, and b) we're not actually initializing the extension at this point.
Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Keith Packard <keithp@keithp.com>
The X server still has 'unsigned long' in a few places to hold 32 bit
values. One of those is in miPutImage where it's holding the temporary
planemask for XYPixmap format images.
It computed the highest plane in the source image with 1 << (depth -
1). On 64-bit machines, taking that value and storing it in an
unsigned long promotes it to a signed 64-bit value
(0xffffffff80000000).
Then, it loops over that value, shifting one bit right each time,
waiting for it to go to zero.. That takes 64 iterations, and ends up
with some mystic planemask values *and* walking off the end of the
source image data and out into space.
A simple cast is all that is required to compute the correct initial
plane mask (0x0000000080000000), at which point the loop operates
correctly once again.
Checking the fbPutImage code, I note that this same bug was fixed
in 2006 by Aaron Plattner in commit
f39fd42429
Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Aaron Plattner <aplattner@nvidia.com>
Looping around LoadExtension() meant that ExtensionModuleList was reallocated
on every extension. Using LoadExtensionList() we pass an array thus the
function can do the reallocation in one go, and then loop and setup the
ExtensionModuleList.
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
v2: Update ephyr [Keith Packard]
v3: Eliminate const warnings in LoadExtensionList [Keith Packard]
Signed-off-by: Keith Packard <keithp@keithp.com>
With all the logic now in place there is no need to allocate a separate
ExtensionModule to be used as a sentinel.
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
The array is readonly and should not be tampered with.
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
All the sentinels from the extension lists were removed, thus the only
case were this would trigger is when the code is broken badly.
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Separate the function from NewExtensionModule() as the former does
only memory reallocation. No functional change.
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
mieq.c:290:26: warning: format '%u' expects argument of type 'unsigned int',
but argument 2 has type 'size_t' [-Wformat=]
pnprintf supports size_t since 5ea21560dd
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
This just removes the comment markers from around the formals in
several function prototypes near where pointer -> void * changes were
made. There are plenty more of these to fix.
Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
This lets us stop using the 'pointer' typedef in Xdefs.h as 'pointer'
is used throughout the X server for other things, and having duplicate
names generates compiler warnings.
Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
A coupel of unused variables, and some debug code with mis-matching
printf format and variable types.
Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Based on some bugzilla scraping I did around November 2012. Of xserver
bugs in Red Hat bugzilla with an EQ size message in the log, the
distribution looked like:
String | Matches
-------------------------------------
Increasing EQ size to 512 | 460
Increasing EQ size to 1024 | 52
Increasing EQ size to 2048 | 6
Increasing EQ size to 4096 | 0
Most of the "512" ones appear to be mostly harmless, some relatively
expensive path in either rendering or resource destruction simply taking
too long due to external pressures like paging or CPU contention. So
let's raise the initial queue size, both to reduce the number of
spurious abrt reports and to drop fewer events in all but the most
pathological cases.
Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
There's a --disable-present, so it'd be nice if it worked.
Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
Signed-off-by: Keith Packard <keithp@keithp.com>
Provides both a software implementation using timers and driver hooks
to base everything on vblank intervals.
Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Adds DRM compatible fences using futexes.
Uses FD passing to get pixmaps from DRM applications.
Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
You can only register one drawable on a given damage, so there's no
reason to require the caller to specify the drawable, the damage is
enough. The implementation would do something fairly horrible if you
_did_ pass mismatched drawable and damage, so let's avoid the problem
entirely.
v2: Simplify xf86RotateDestroy even more [anholt]
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
The only remaining use was in some debugging code in DMX.
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
Signed-off-by: Adam Jackson <ajax@redhat.com>
It's already not optional at configure time, this just makes it so at
build time too.
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
No DDX overrode this, and we never actually called through that slot
anyway.
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
Code to recognize these in extension enable/disable options was wrapped
in #ifdef XorgLoader, but that's not defined when building miinitext.c
since the great module merge of 1.13. Change to an #ifdef that is defined.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Robert Hooker <robert.hooker@canonical.com>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Keith Packard <keithp@keithp.com>
Different miPointerSpriteFuncRec implementations do a varying
business at ultimately calling miPointerUpdateSprite(), this
particularly fails when using the plain mi sprite on touch events,
where the sprite is just moved/updated on cursor changes.
So, ensure miPointerUpdateSprite() is called generically for
pointer emulating touch events as with regular motion events.
Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
d785368e0e converted the other miinitext functions to use ARRAY_SIZE,
and removed the sentinel, but missed EnableDisableExtensionError so
passing an invalid extension name could cause the server to walk off
the end off the list looking for a sentinel that wasn't there.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Avoid name shadowing warnings, change the event list to a more specific
name.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
x/y for barrier events should contain the actual pointer position.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
Instead of having the pointer barrier code enqueue events separately from
GetPointerEvents, pass the event list through and let it add to it.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
This adds support for clients that would like to get a notification
every time a barrier is hit, and allows clients to temporarily release
a barrier so that pointers can go through them, without having to
destroy and recreate barriers.
Based on work by Chris Halse Rogers <chris.halse.rogers@canonical.com>
Signed-off-by: Jasper St. Pierre <jstpierre@mecheye.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Rather than riding on the ConstrainCursorHarder hook, which has
several issues, move to an explicit hook, which will help us with
some RANDR interaction issues.
Signed-off-by: Jasper St. Pierre <jstpierre@mecheye.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
mibitblt.c: In function 'miGetImage':
mibitblt.c:617:20: warning: declaration of 'pt' shadows a previous local
mibitblt.c:609:17: warning: shadowed declaration is here
mispans.c: In function 'miFillUniqueSpanGroup':
mispans.c:456:33: warning: declaration of 'i' shadows a previous local
mispans.c:382:9: warning: shadowed declaration is here
mispans.c:488:17: warning: declaration of 'i' shadows a previous local
mispans.c:382:9: warning: shadowed declaration is here
Signed-off-by: Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
pDev cannot be NULL here since fill_pointer_events is the only caller.
And if the screen is NULL, then the device tries to send events before it is
fully initialised. That certainly shouldn't happen and would be a bug
elsewhere.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Since Nov 2010 (commit c4c4676) the only purpose of mibstore.h was to
define an empty function (miInitializeBackingStore()) for backward
compatibility. Time to say goodbye.
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
The only reference to mibstore.c was removed with commit c4c4676. Remove the
file itself too.
Reviewed-by: Aaron Plattner <aplattner@nvidia.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
As of 81cfe44b1e, miPointerSetPosition now
returns the screen pointer of the device. This broke floating slave devices,
as soon as a motion event was submitted, miPointerSetPosition returned NULL,
crashing the server.
dev->coreEvents is only false if the device is a floating slave, in which
case it has a sprite.
X.Org Bug 53568 <http://bugs.freedesktop.org/show_bug.cgi?id=53568>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
* GLX is now loaded
* PseudoramiX loading is back in miinitext. It needs to be loaded
before RandR.
Regression-from: 27a624bee6
Regression-from: 5f5bbbe543
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>