Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xserver: Present extension backport from X.org #423

Open
wants to merge 76 commits into
base: 3.6.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
60c9870
present: Add Present extension
keith-packard Jul 11, 2013
97d956c
Present: Check for window/fence destroyed when idling pixmaps
keith-packard Nov 7, 2013
6a12b3b
present: Change debug output a bit to help diagnose missing vblank si…
keith-packard Nov 7, 2013
727ee98
present: Round fake MSC computations intead of truncating
keith-packard Nov 7, 2013
17e57d2
present: Ignore event_id 0 from driver vblank notify
keith-packard Nov 9, 2013
2b5dc6f
present: Signal destroyed flip window with vblank->window == NULL
keith-packard Nov 9, 2013
3807711
present: Block for wait_fence in present_execute
keith-packard Nov 12, 2013
6dfb1ed
present: When unflipping, copy to flip window rather than screen
keith-packard Nov 20, 2013
9508f53
present: Add a debug output line when skipping a pending present
keith-packard Nov 26, 2013
a654d32
present: Leave vblank on window list until flip complete
keith-packard Nov 26, 2013
2f1bab0
present: Set window pixmap to flipped pixmap
keith-packard Nov 26, 2013
e497169
present: Send GLX_BufferSwapComplete events from present extension
keith-packard Nov 22, 2013
e1d43f5
present: Clear target_crtc if driver lacks Present support
keith-packard Nov 26, 2013
8d250d5
present: Also set the root window pixmap when flipping
keith-packard Nov 26, 2013
539f0b6
present: Report damage when flipping
keith-packard Nov 26, 2013
9242988
present: Disable when Xinerama is active
nwnk Nov 8, 2013
855e3e3
present: recursively set window pixmaps on flip
keith-packard Dec 10, 2013
08c6385
present: Don't use the major/minor version from the protocol headers
nwnk Dec 13, 2013
1ff4b36
present: Handle PresentOptionAsync for copy mode
keith-packard Dec 12, 2013
9d5ff23
present: Don't abandon presents which are already queued for flip
keith-packard Dec 12, 2013
2033c29
present: Set complete notify mode to Skip as needed
keith-packard Dec 12, 2013
6fbe97d
Replace 'pointer' type with 'void *'
keith-packard Dec 15, 2013
c01d507
present: Queue flips for later execution
keith-packard Jan 27, 2014
c82a467
present: Remove executing vblank from window list. Bug# 79709.
keith-packard Jun 17, 2014
837bc50
present: restore screen pixmap when aborting a flip
frankbinns Jun 10, 2014
f40f1d5
present: fix bad logic in cancelling scheduled operations.
Jun 19, 2014
dc059fe
present: Make window MSC offset 0 initially
keith-packard Jul 21, 2014
0032a71
present: Avoid crash at server shutdown
keith-packard Jul 21, 2014
29f4c13
glx/present: Only send GLX_BufferSwapComplete for PresentCompleteKind…
keith-packard Sep 4, 2014
0ba3ebb
present: Support PresentOptionCopy
keith-packard Sep 10, 2014
3cb43a9
present: Clear pending flip pixmaps at CloseScreen
keith-packard Sep 10, 2014
1296684
Fix present_pixmap when using present_notify_msc
Sep 27, 2014
ff4526c
Fix present_notify to return right away when querying current or past…
Oct 29, 2014
1e727b4
Drop trailing whitespaces
whot Oct 30, 2014
59774fe
present: Avoid crashes in DebugPresent(), a bit more info.
kleinerm Dec 6, 2014
bcc7de7
present: Fix use of vsynced pageflips and honor PresentOptionAsync. (v4)
kleinerm Dec 6, 2014
23b6ac5
present: unvalidated lengths in Present extension procs [CVE-2014-810…
alanc Jan 27, 2014
5c33ce0
present: If present_queue_vblank() fails, do present_execute().
kaydenl Dec 19, 2014
314115e
present: Copy unflip contents back to the Screen Pixmap
ickle Feb 6, 2015
f02f29e
present: static cleanup
nwnk Oct 22, 2014
33c1d62
present: Don't stash the MSC value when present_get_ust_msc fails
Sep 10, 2015
0f2b6ab
present: Fix missed notify MSC computation
ickle Feb 16, 2015
26f9a9c
present: Execute right away if target_msc equals current_msc
Oct 28, 2015
e937aa8
present: Fix Async swap logic
Nov 4, 2015
2a3b076
present: Requery pending flips with the right sync_flip mode
ickle Feb 8, 2015
66933d0
present: When cancelling a pending synchronous flip, requeue it
ickle Feb 8, 2015
9727a19
present: Do not replace Pixmaps on redirected Window on unflip
ickle Feb 8, 2015
e9dd837
present: Handle wraparound when comparing MSC values
Jan 15, 2016
1592417
present: Move msc_is_(equal_or_)after to the top of present.c
Feb 24, 2016
d2e4259
present: Requeue if flip driver hook fails and target MSC not reached
Feb 24, 2016
ad5b389
present: Only requeue if target MSC is not reached after an unflip
Feb 24, 2016
33b593f
present: Only update screen pixmap from flip pixmap once per unflip
Feb 18, 2016
8f67145
present: Factor code for restoring screen pixmap out of present_unfli…
Feb 18, 2016
718a01d
present: Call present_restore_screen_pixmap from present_set_abort_flip
Feb 18, 2016
ca26ebb
present: fail flipping if we have any slave outputs
airlied Feb 9, 2016
07b952d
present: Only requeue for next MSC after flip failure
Mar 24, 2016
61832d8
present: Improve scaling of vblank handler
ickle Feb 14, 2015
0b39411
present: Fix presentation of flips out of order
ickle Feb 14, 2015
ec7ace9
xrandrprovider: Do not use separate lists for unbound / source / offl…
jwrdegoede May 13, 2016
a71a16c
present: Only call restore_screen_pixmap once from set_abort_flip
Jul 26, 2016
c524176
present: Handle event mask updates as specified v2
Jul 29, 2016
c3f27bb
present: Make present_restore_screen_pixmap handle screen->root == NULL
Aug 3, 2016
8ac0b53
present: Call set_abort_flip / restore_screen_pixmap in clear_window_…
Aug 3, 2016
73bca41
present: Free the fake_present OsTimerPtr
ofourdan Aug 8, 2016
2440993
present: Only call present_flip_notify if vblank->queued == FALSE
Nov 25, 2016
e47e29e
present: disable page flip only when a slave crtc is active
yuq Jan 26, 2017
dd60cdf
present: Allow flipping with PRIME slave outputs
Feb 1, 2017
0688d8b
Initial Present protocol specification
keith-packard Jul 11, 2013
c809284
Add NotifyMSC. Add serial numbers to Complete and MSC events
keith-packard Jul 13, 2013
21fe0f5
Remove SBC, use CompleteNotify for both Region and NotifyMSC
keith-packard Jul 15, 2013
aa63d2c
Start reworking for present redirection.
keith-packard Jul 25, 2013
38ce813
PresentRegion->PresentPixmap, define options, add UST mode
keith-packard Oct 18, 2013
9d94b05
Update to version 1.0
keith-packard Nov 1, 2013
83465e0
Force Window and Pixmap to be CARD32 on the wire
nwnk Dec 11, 2013
11be6fc
Don't define 'redirect' stuff in header files
keith-packard Dec 13, 2013
9d604f9
Present Xserver extension: Enable build via imake in nx-libs.
sunweaver Feb 24, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions nx-X11/config/cf/X11.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,9 @@ XORGRELSTRING = XorgManVersionString
#ifndef BuildRender
#define BuildRender YES
#endif
#ifndef BuildPresent
#define BuildPresent YES
#endif

#ifndef BuildRandR
#define BuildRandR YES
Expand Down
5 changes: 5 additions & 0 deletions nx-X11/config/cf/xorg.cf
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,11 @@ IPLAN2P8_DEFS = -DUSE_IPLAN2P8
# define BuildRender YES
#endif

/* Build Present extension */
#ifndef BuildPresent
# define BuildPresent YES
#endif

#if 0
#ifndef JoystickSupport
# define JoystickSupport NO
Expand Down
4 changes: 4 additions & 0 deletions nx-X11/include/extensions/Imakefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ RANDRHEADERS = randr.h randrproto.h
#if BuildRender
RENDERHEADERS = render.h renderproto.h
#endif
#if BuildPresent
PRESENTHEADERS = presentproto.h presenttokens.h
#endif
#if BuildXfixes
XFIXESHEADERS = xfixeswire.h xfixesproto.h
#endif
Expand All @@ -43,6 +46,7 @@ EXTRAHEADERS = \
$(XVMCHEADERS) \
$(RANDRHEADERS) \
$(RENDERHEADERS) \
$(PRESENTHEADERS) \
$(XFIXESHEADERS) \
$(COMPOSITEHEADERS) \
$(DAMAGEHEADERS) \
Expand Down
248 changes: 248 additions & 0 deletions nx-X11/include/extensions/presentproto.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,248 @@
/*
* Copyright © 2013 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/

#ifndef _PRESENT_PROTO_H_
#define _PRESENT_PROTO_H_

#include <nx-X11/extensions/presenttokens.h>

#define Window CARD32
#define Pixmap CARD32
#define Region CARD32
#define XSyncFence CARD32
#define EventID CARD32

typedef struct {
Window window B32;
CARD32 serial B32;
} xPresentNotify;
#define sz_xPresentNotify 8

typedef struct {
CARD8 reqType;
CARD8 presentReqType;
CARD16 length B16;
CARD32 majorVersion B32;
CARD32 minorVersion B32;
} xPresentQueryVersionReq;
#define sz_xPresentQueryVersionReq 12

typedef struct {
BYTE type; /* X_Reply */
BYTE pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 majorVersion B32;
CARD32 minorVersion B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
} xPresentQueryVersionReply;
#define sz_xPresentQueryVersionReply 32

typedef struct {
CARD8 reqType;
CARD8 presentReqType;
CARD16 length B16;
Window window B32;

Pixmap pixmap B32;
CARD32 serial B32;

Region valid B32;
Region update B32;

INT16 x_off B16;
INT16 y_off B16;
CARD32 target_crtc B32;

XSyncFence wait_fence B32;
XSyncFence idle_fence B32;

CARD32 options B32;
CARD32 pad1 B32;

CARD64 target_msc;
CARD64 divisor;
CARD64 remainder;
/* followed by a LISTofPRESENTNOTIFY */
} xPresentPixmapReq;
#define sz_xPresentPixmapReq 72

typedef struct {
CARD8 reqType;
CARD8 presentReqType;
CARD16 length B16;
Window window B32;

CARD32 serial B32;
CARD32 pad0 B32;

CARD64 target_msc;
CARD64 divisor;
CARD64 remainder;
} xPresentNotifyMSCReq;
#define sz_xPresentNotifyMSCReq 40

typedef struct {
CARD8 reqType;
CARD8 presentReqType;
CARD16 length B16;
CARD32 eid B32;
CARD32 window B32;
CARD32 eventMask B32;
} xPresentSelectInputReq;
#define sz_xPresentSelectInputReq 16

typedef struct {
CARD8 reqType;
CARD8 presentReqType;
CARD16 length B16;
CARD32 target B32;
} xPresentQueryCapabilitiesReq;
#define sz_xPresentQueryCapabilitiesReq 8

typedef struct {
BYTE type; /* X_Reply */
BYTE pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 capabilities B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
CARD32 pad6 B32;
CARD32 pad7 B32;
} xPresentQueryCapabilitiesReply;
#define sz_xPresentQueryCapabilitiesReply 32

/*
* Events
*
* All Present events are X Generic Events
*/

typedef struct {
CARD8 type;
CARD8 extension;
CARD16 sequenceNumber B16;
CARD32 length;
CARD16 evtype B16;
CARD16 pad2;
CARD32 eid B32;
CARD32 window B32;
INT16 x B16;
INT16 y B16;
CARD16 width B16;
CARD16 height B16;
INT16 off_x B16;
INT16 off_y B16;

CARD16 pixmap_width B16;
CARD16 pixmap_height B16;
CARD32 pixmap_flags B32;
} xPresentConfigureNotify;
#define sz_xPresentConfigureNotify 40

typedef struct {
CARD8 type;
CARD8 extension;
CARD16 sequenceNumber B16;
CARD32 length;
CARD16 evtype B16;
CARD8 kind;
CARD8 mode;
CARD32 eid B32;
Window window B32;
CARD32 serial B32;
CARD64 ust;

CARD64 msc;
} xPresentCompleteNotify;
#define sz_xPresentCompleteNotify 40

typedef struct {
CARD8 type;
CARD8 extension;
CARD16 sequenceNumber B16;
CARD32 length;
CARD16 evtype B16;
CARD16 pad2 B16;
CARD32 eid B32;
Window window B32;
CARD32 serial B32;
Pixmap pixmap B32;
CARD32 idle_fence B32;
} xPresentIdleNotify;
#define sz_xPresentIdleNotify 32

#if PRESENT_FUTURE_VERSION
typedef struct {
CARD8 type;
CARD8 extension;
CARD16 sequenceNumber B16;
CARD32 length;
CARD16 evtype B16;
CARD8 update_window;
CARD8 pad1;
CARD32 eid B32;
Window event_window B32;
Window window B32;
Pixmap pixmap B32;
CARD32 serial B32;

/* 32-byte boundary */

Region valid_region B32;
Region update_region B32;

xRectangle valid_rect;

xRectangle update_rect;

INT16 x_off B16;
INT16 y_off B16;
CARD32 target_crtc B32;

XSyncFence wait_fence B32;
XSyncFence idle_fence B32;

CARD32 options B32;
CARD32 pad2 B32;

CARD64 target_msc;
CARD64 divisor;
CARD64 remainder;

} xPresentRedirectNotify;

#define sz_xPresentRedirectNotify 104
#endif

#undef Window
#undef Pixmap
#undef Region
#undef XSyncFence
#undef EventID

#endif
101 changes: 101 additions & 0 deletions nx-X11/include/extensions/presenttokens.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
/*
* Copyright © 2013 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/

#ifndef _PRESENT_TOKENS_H_
#define _PRESENT_TOKENS_H_

#define PRESENT_NAME "Present"
#define PRESENT_MAJOR 1
#define PRESENT_MINOR 0

#define PresentNumberErrors 0
#define PresentNumberEvents 0

/* Requests */
#define X_PresentQueryVersion 0
#define X_PresentPixmap 1
#define X_PresentNotifyMSC 2
#define X_PresentSelectInput 3
#define X_PresentQueryCapabilities 4

#define PresentNumberRequests 5

/* Present operation options */
#define PresentOptionNone 0
#define PresentOptionAsync (1 << 0)
#define PresentOptionCopy (1 << 1)
#define PresentOptionUST (1 << 2)

#define PresentAllOptions (PresentOptionAsync | \
PresentOptionCopy | \
PresentOptionUST)

/* Present capabilities */

#define PresentCapabilityNone 0
#define PresentCapabilityAsync 1
#define PresentCapabilityFence 2
#define PresentCapabilityUST 4

#define PresentAllCapabilities (PresentCapabilityAsync | \
PresentCapabilityFence | \
PresentCapabilityUST)

/* Events */
#define PresentConfigureNotify 0
#define PresentCompleteNotify 1
#define PresentIdleNotify 2
#if PRESENT_FUTURE_VERSION
#define PresentRedirectNotify 3
#endif

/* Event Masks */
#define PresentConfigureNotifyMask 1
#define PresentCompleteNotifyMask 2
#define PresentIdleNotifyMask 4
#if PRESENT_FUTURE_VERSION
#define PresentRedirectNotifyMask 8
#endif

#if PRESENT_FUTURE_VERSION
#define PRESENT_REDIRECT_NOTIFY_MASK PresentRedirectNotifyMask
#else
#define PRESENT_REDIRECT_NOTIFY_MASK 0
#endif

#define PresentAllEvents (PresentConfigureNotifyMask | \
PresentCompleteNotifyMask | \
PresentIdleNotifyMask | \
PRESENT_REDIRECT_NOTIFY_MASK)

/* Complete Kinds */

#define PresentCompleteKindPixmap 0
#define PresentCompleteKindNotifyMSC 1

/* Complete Modes */

#define PresentCompleteModeCopy 0
#define PresentCompleteModeFlip 1
#define PresentCompleteModeSkip 2

#endif
Loading