When a present flip operation is still in process during server reset,
the call to present_set_abort_flip may not happen until the screen is
being closed, at which point there is no root window to set pixmaps
for. Check to make sure there's a window before resetting window pixmaps.
Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
The MSC offset used by a window is adjusted as the window moves
between screens, and between shown/unshown. The value shouldn't
matter, but it's helpful for debugging to have window MSC values be
the same as the CRTC MSC at first.
This patch introduces a unique CRTC value so that Present can detect
the first time a window is a PresentPixmap destination and set the MSC
offset to zero, rather than using the fake MSC value as the previous
window MSC.
Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
If we present several pixmaps in advance for different msc, the later one
shouldn't cancel the previous ones.
This reverts a change made by commit
e6f5d9d7b7
Without this fix, vblank_mode=0 glxgears doesn't update
with the present fallback.
Signed-off-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
If a 2D application is started on top of a fullscreen 3D application, which
is flipping, then we need to stop flipping and restore the root window, and
possibly the flip window, to using the screen pixmap. Normally this would
be done as part of an unflip. However, in the case that there is a pending
flip there is no mechanism to abort so the unflip is deferred until the
pending flip completes. This provides a window of opportunity for the 2D
application to draw to the wrong pixmap.
Restore the screen pixmap at the point a pending flip is marked as aborted,
thus avoiding this issue.
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Frank Binns <frank.binns@imgtec.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
Once the vblank is actually getting executed, it's lifetime is no
longer tied to the window, and so it shouldn't be controlled by window
destruction. In particular, if the vblank is queued for flip, it will
get stored in the flip_pending field, and will be correctly destroyed
when the flip completes.
Signed-off-by: Keith Packard <keithp@keithp.com>
When a flip (or unflip) is pending and a flip request comes in, leave
it queued until the pending flip completes and then execute it.
This fixes a bug where an application submitting back-to-back
present_pixmap requests for sequential frames would alternate between
flipping and copying as the pending flip would cause the new
present_pixmap request to not use a flip.
Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Tested-by: Frank Binns <frank.binns@imgtec.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>
Skipped present pixmap calls were not setting the mode to
PresentCompleteModeSkip for skipped operations.
Signed-off-by: Keith Packard <keithp@keithp.com>
Presents which are not marked 'queued' and are in the window present
list are waiting for the flip event; discarding those won't work very
well (it'll end up trashing displayed content for the next frame), so
skip over those when looking for duplicate frame presents
Signed-off-by: Keith Packard <keithp@keithp.com>
Check for Async flag and execute immediately if set, otherwise wait
for the next appropriate vblank before copying.
Signed-off-by: Keith Packard <keithp@keithp.com>
We want to advertise the version we implement, not the version the
protocol headers happen to describe.
Reviewed-by: Jasper St. Pierre <<jstpierre@mecheye.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
Newly created windows inherit the pixmap of their parent, similarly,
reparenting a tree inherits the pixmap of the destination tree.
Making present preserve the invariant that unredirected windows always
have the same pixmap as their parent ensures that the above cases work
correctly.
v2: name the recursive function to 'set_tree_pixmap' instead of 'set_window_pixmap'
Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Among much else Present depends on RANDR types, and RANDR isn't properly
Xinerama-aware yet anyway.
Reviewed-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Adam Jackson <ajax@redhat.com>
This makes sure that things like software cursors continue to work
while the screen is flipped.
Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
If the driver doesn't have the necessary hooks for Present, then the
target_crtc needs to be set to NULL to make sure the extension uses
the present_fake code.
Signed-off-by: Keith Packard <keithp@keithp.com>
Tested-by: Fredrik Höglund <fredrik@kde.org>
Reviewed-by: Adam Jackson <ajax@redhat.com>
This allows GL to support the GLX_INTEL_swap_event extension.
v2: Return GLX_BLIT_COMPLETE_INTEL for unknown swap types
Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
This makes other drawing to the window appear on the screen.
Note that no child windows can be affected because only full-screen
windows are eligible for flipping, and so we only need to set pixmap
for the window itself.
Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
If the window is destroyed, then we've got cleanup work to do, even if
the vblank has already been executed -- we need to clear the window
pointer so that we don't try to deliver events to it.
Leaving it on the window list meant that when walking that list, we
need to know whether the vblank is waiting to be executed or waiting
for the flip to complete, so a new 'queued' flag was added to the
vblank to distinguish between the two states.
Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
When an application provides two pixmaps for the same MSC, the
previous one is skipped. This just dumps out some information at that point
Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
unflip happens after the clip lists have been updated, so instead of
smashing the whole screen and drawing over other windows, just draw to
the original flip window; it'll have the right clip list and so the
copy will work just fine.
Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Pend presentation until wait_fence is also triggered by having the
SyncFence trigger invoke present_execute once triggered.
Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
This eliminates dereferencing freed window pointers when there is a
flip for that window in progress. The flip will complete, and then
immediately get undone (as we can't stop an in-progress flip).
Remove the vblank->window_destroyed field as we can signal this with
vblank->window == NULL instead.
Change check to vblank->window == NULL in:
present_flip_notify
Add check for vblank->window == NULL in:
present_vblank_notify
present_execute
present_flip_notify was also using vblank->window->drawable.pScreen,
so stop doing that and use vblank->screen instead.
Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
We use event_id 0 to mean 'no such event'; if a driver sends us that
event_id, make sure we don't accidentally match it.
Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
If the timer fired too early, we'd sometimes mis-compute the MSC for
fake vblanks. Rounding the computation to the nearest MSC fixes this nicely.
Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
A client destroying objects in the middle of an unflip can end up
having the screen flip window or fence set to NULL in the unflip
notify path. Check for these and don't try to use those objects.
Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.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>