From 4218fd3a8c41e4d9715cbcd6d855736028835fb8 Mon Sep 17 00:00:00 2001 From: marha Date: Mon, 6 Dec 2010 08:03:07 +0000 Subject: libXext xserver pixman git update 6-12-2010 --- libXext/configure.ac | 4 +- libXext/include/X11/extensions/sync.h | 33 + libXext/specs/Makefile.am | 2 +- libXext/specs/xtest1.xml | 954 +++++++++++++++++++++++ libXext/src/XSync.c | 258 +++++- pixman/pixman/pixman-arm-common.h | 15 +- pixman/pixman/pixman-arm-neon-asm.S | 473 ++++++++--- pixman/pixman/pixman-arm-neon-asm.h | 5 + pixman/pixman/pixman-arm-neon.c | 42 +- pixman/pixman/pixman-arm-simd.c | 4 +- xorg-server/configure.ac | 4 +- xorg-server/hw/dmx/glxProxy/glxcmds.c | 6 +- xorg-server/hw/dmx/glxProxy/glxcmdsswap.c | 2 +- xorg-server/hw/kdrive/ephyr/ephyrdriext.c | 2 +- xorg-server/hw/xfree86/common/xf86str.h | 4 +- xorg-server/hw/xfree86/common/xf86xv.c | 258 +++--- xorg-server/hw/xfree86/common/xf86xv.h | 566 +++++++------- xorg-server/hw/xfree86/common/xf86xvpriv.h | 176 ++--- xorg-server/hw/xfree86/dixmods/extmod/xf86dga2.c | 46 +- xorg-server/hw/xfree86/modes/xf86Crtc.c | 8 + xorg-server/render/render.c | 4 +- 21 files changed, 2223 insertions(+), 643 deletions(-) create mode 100644 libXext/specs/xtest1.xml diff --git a/libXext/configure.ac b/libXext/configure.ac index 631b774cc..ea1d6ca92 100644 --- a/libXext/configure.ac +++ b/libXext/configure.ac @@ -3,7 +3,7 @@ AC_PREREQ([2.60]) AC_INIT([libXext], - [1.2.0], + [1.2.99.0], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [libXext]) @@ -40,7 +40,7 @@ AC_PROG_LIBTOOL AC_PROG_CC # Checks for pkg-config packages -PKG_CHECK_MODULES(XEXT, [xproto >= 7.0.13] [x11 >= 1.1.99.1] [xextproto >= 7.0.99.2]) +PKG_CHECK_MODULES(XEXT, [xproto >= 7.0.13] [x11 >= 1.1.99.1] [xextproto >= 7.1.99]) AC_SUBST(XEXT_CFLAGS) AC_SUBST(XEXT_LIBS) diff --git a/libXext/include/X11/extensions/sync.h b/libXext/include/X11/extensions/sync.h index 460bf56ca..0ed5b728d 100644 --- a/libXext/include/X11/extensions/sync.h +++ b/libXext/include/X11/extensions/sync.h @@ -335,6 +335,39 @@ extern Status XSyncGetPriority( int* /*return_priority*/ ); +extern XSyncFence XSyncCreateFence( + Display* /*dpy*/, + Drawable /*d*/, + Bool /*initially_triggered*/ +); + +extern Bool XSyncTriggerFence( + Display* /*dpy*/, + XSyncFence /*fence*/ +); + +extern Bool XSyncResetFence( + Display* /*dpy*/, + XSyncFence /*fence*/ +); + +extern Bool XSyncDestroyFence( + Display* /*dpy*/, + XSyncFence /*fence*/ +); + +extern Bool XSyncQueryFence( + Display* /*dpy*/, + XSyncFence /*fence*/, + Bool* /*triggered*/ +); + +extern Bool XSyncAwaitFence( + Display* /*dpy*/, + const XSyncFence* /*fence_list*/, + int /*n_fences*/ +); + _XFUNCPROTOEND #endif /* _SYNC_SERVER */ diff --git a/libXext/specs/Makefile.am b/libXext/specs/Makefile.am index 0d6379223..10dbed24f 100644 --- a/libXext/specs/Makefile.am +++ b/libXext/specs/Makefile.am @@ -22,7 +22,7 @@ # if ENABLE_SPECS -doc_sources = dbelib.xml dpmslib.xml shapelib.xml synclib.xml +doc_sources = dbelib.xml dpmslib.xml shapelib.xml synclib.xml xtest1.xml dist_doc_DATA = $(doc_sources) if HAVE_XMLTO diff --git a/libXext/specs/xtest1.xml b/libXext/specs/xtest1.xml new file mode 100644 index 000000000..4652de72a --- /dev/null +++ b/libXext/specs/xtest1.xml @@ -0,0 +1,954 @@ + + + + + + + + X11 INPUT SYNTHESIS EXTENSION PROPOSAL + X Consortium Standard + Version 1.0 + + + LarryWoestman + Hewlett Packard, Member of Technical Staff + + + X Consortium Standard + 1993X Consortium + X Consortium + X Version 11, Release 7 + + + +This is a proposal for an extension to the X11 server and Xlib. + + + + + + +TITLE + +Introduction + +This is a proposal for an extension to the X11 server and Xlib. +It provides two capabilities: + + + + + +It allows a client to generate user input actions in the server without +requiring a user to be present. + + + + +It also allows a client to control the +handling of user input actions by the server. + + + + + +The capability +to allow a client to generate user input actions in the server +will be used by some of the X Testing Consortium Xlib tests. +Both capabilities will be used by the X Testing Consortium client exerciser +program. +These capabilities may also be useful in other programs. + + + +This extension requires modification to device-dependent code in the +server. Therefore it is not a 'portable' extension as defined by the +X11 Server Extensions document. However, the majority of the code +and functionality of this extension will be implementation-independent. + + + + + +Conventions Used In This Document + + +The naming conventions used in the Xlib documentation are followed +with these additions: + + + + + +The names of all functions defined in this extension begin with 'XTest', +with the first letter of each additional word capitalized. + + + + +The names of the protocol request structures follow the Xlib convention +of 'x<name>Req'. + + + + +The names of the protocol request minor type codes follow the Xlib convention +of 'X_<name>'. + + + + +The names of all other constants defined in this extension begin with 'XTest', +with the rest of the name in upper case letters. + + + + +All constants and structures defined in this extension will have their +values specified in the 'xtestext1.h' file (listed in section 5). + + + + + + +Definition Of Terms + + +Input Actions + +Input actions are pointer movements, button presses and releases, +and key presses and releases. They can be generated by a user or by a client +(using functions in this extension). + + + + +User Input Actions + +User input actions are input actions that are generated by the user +moving a pointing device (typically a mouse), pressing and releasing buttons on +the pointing device, and pressing and releasing keys on the keyboard. + + + + + + +What Does This Extension Do? + +Without this extension, user input actions are processed by the server, +and are converted into normal X events that are sent to the +appropriate client or clients. + + + +This extension adds the following capabilities: + + + + + +Input actions may be sent from a client to the server to be +processed just as if the user had physically performed them. +The input actions are provided to the server in the form of X protocol +requests defined by this extension. +The information provided to the server includes what action should be +performed, and how long to delay before processing the action in the server. + + + + +User input actions may be diverted to a client before being processed by the +server. +The effect on the server is as if the user had performed no input action. +The user input actions are provided to the client in the form of X events +defined by this extension. +The information provided to the client includes what user input action +occurred and the delay between this user input action and the previous user +input action. +The client may then do anything it wishes with this information. + + + + +User input actions may be copied, with one copy going to the server in the +normal way, and the other copy being sent to a client as described above. + + + + + + +Functions In This Extension + + +High Level Functions + + +These functions are built on top of the low level functions described later. + + + +XTestMovePointer + + + + int XTestMovePointer + Display *display + int device_id + unsigned long delay + int x + int y + unsigned int count + + + + + + display + + +Specifies the connection to the X server. + + + + + device_id + + +Specifies which pointer device was supposed to have caused the input action. +This is a provision for future support of multiple (distinguishable) pointer +devices, and should always be set to 0 for now. + + + + + delay + + +Specifies the time (in milliseconds) to wait before each movement +of the pointer. + + + + + x, y + + +Specifies the x and y coordinates to move the pointer to relative to the +root window for the specified display. + + + + + count + + +Specifies the number of 'delay, x, y' triplets contained in the +delay, +x and +y arrays. + + + + + + +The +XTestMovePointer +function creates input actions to be sent to the the server. +The input actions will be accumulated in a request defined by this extension +until the request is full or the XTestFlush function is called. +They will then be sent to the server. +When the input actions are sent to the server, the input actions will cause +the server to think that the pointer was moved to the specified position(s), +with the specified delay before each input action. + + +The +XTestMovePointer +function will return -1 if there is an error, and 0 otherwise. + + + + +XTestPressButton + + + + int XTestPressButton + Display *display + int device_id + unsigned long delay + unsigned int button_number + unsigned int button_action + + + + + + + + display + + +Specifies the connection to the X server. + + + + + device_id + + +Specifies which button device was supposed to have caused the input action. +This is a provision for future support of multiple (distinguishable) button +devices, and should always be set to 0 for now. + + + + + delay + + +Specifies the time (in milliseconds) to wait before the input action. + + + + + button_number + + +Specifies which button is being acted upon. + + + + + button_action + + +Specifies the action to be performed (one of +XTestPRESS, +XTestRELEASE, or +XTestSTROKE). + + + + + + +The +XTestPressButton +function creates input actions to be sent to the the server. +The input actions will be accumulated in a request defined by this extension +until the request is full or the XTestFlush function is called. +They will then be sent to the server. +When the input actions are sent to the server, the input actions will cause +the server to think that the specified button was moved as specified. + + +The +XTestPressButton +function will return -1 if there is an error, and 0 otherwise. + + + + +XTestPressKey + + + + int XTestPressKey + Display *display + int device_id + unsigned long delay + unsigned int keycode + unsigned int key_action + + + + + + + display + + +Specifies the connection to the X server. + + + + + device_id + + +Specifies which keyboard device was supposed to have caused the input action. +This is a provision for future support of multiple (distinguishable) keyboard +devices, and should always be set to 0 for now. + + + + + delay + + +Specifies the time (in milliseconds) to wait before the input action. + + + + + keycode + + +Specifies which keycode is being acted upon. + + + + + key_action + + +Specifies the action to be performed (one of +XTestPRESS, +XTestRELEASE, or +XTestSTROKE). + + + + + + + +The +XTestPressKey +function creates input actions to be sent to the the server. +The input actions will be accumulated in a request defined by this extension +until the request is full or the XTestFlush function is called. +They will then be sent to the server. +When the input actions are sent to the server, the input actions will cause +the server to think that the specified key on the keyboard was moved as +specified. + + + +The +XTestPressKey +function will return -1 if there is an error, and 0 otherwise. + + + + +XTestFlush + + + + int XTestFlush + Display *display + + + + + + + display + + +Specifies the connection to the X server. + + + + + + +The +XTestFlush +will send any remaining input actions to the server. + + + +The +XTestFlush +function will return -1 if there is an error, and 0 otherwise. + + + + + + + +Low Level Functions + + + +XTestGetInput + + + + int XTestGetInput + Display *display + int action_handling + + + + + + + display + + +Specifies the connection to the X server. + + + + + action_handling + + +Specifies to the server what to do with the user input actions. (one of +0, XTestPACKED_MOTION or +XTestPACKED_ACTIONS; optionally 'or'ed +with XTestEXCLUSIVE). + + + + + + + +The +XTestGetInput +function tells the server to begin putting information about user input actions +into events to be sent to the client that called this function. These events +can be read via the Xlib XNextEventfR function. + + + +The server assigns an event type of +XTestInputActionType to these events +to distinguish them from other events. +Since the actual value of the event type may vary depending on how many +extensions are included with an X11 implementation, +XTestInputActionType is a variable that will be +contained in the Xlib +part of this extension. It may be referenced as follows: + + + +extern int XTestInputActionType; + + + + + +An action_handling value of 0 causes the server +to send one user input action in each +XTestInputActionType event. +This can sometimes cause performance problems. + + + + +An action_handling value of +XTestPACKED_ACTIONS causes the server +to pack as many user input actions as possible into a +XTestInputActionType event. +This is needed if user input actions are happening rapidly (such as +when the user moves the pointer) to keep performance at a reasonable level. + + + + +An action_handling value of +XTestPACKED_MOTION causes the server +to pack only user input actions associated with moving the pointer. +This allows the +client to receive button and key motions as they happen without waiting for the +event to fill up, while still keeping performance at a reasonable level. + + + + +An action_handling value with +XTestEXCLUSIVE 'or'ed in +causes the server to send user input actions only to the client. +The effect on the server is as if the user had performed no input actions. + + + + +An action_handling value without +XTestEXCLUSIVE +causes the server to copy user input actions, sending one copy to the +client, and handling the other copy normally (as it would if this extension +were not installed). + + + + + +There are four types of input actions that are passed from the server +to the client. They are: + + + + + key/button~state~change + + +This type of input action contains the keycode of the key or button that +changed state; +whether the key or button is up or down, +and the time delay between this input action and the previous input action. + + + + + pointer~motions + + +This type of input action contains information about the motion of the +pointer when the pointer has only moved a short distance. +If the pointer has moved a long distance, +the pointer jump input action is used. + + + + + pointer~jumps + + +This type of input action contains information about the motion of the +pointer when the pointer has moved a long distance. + + + + + delays + + +This type of input action is used when the delay between input actions is too +large to be held in the other input actions. + + + + + + +The +XTestGetInput +function will return -1 if there is an error, and 0 otherwise. + + +An error code of BadAccess means that another client +has already requested that user input actions be sent to it. + + + + + + +XTestStopInput + + + + int XTestStopInput + Display *display + + + + + + + + display + + +Specifies the connection to the X server. + + + + + + +The +XTestStopInput +function tells the server to stop putting information about user input actions +into events. +The server will process user input actions normally (as it would +if this extension were not in the server). + + + +The +XTestStopInput +function will return -1 if there is an error, and 0 otherwise. + + + +An error code of BadAccess means that a request +was made to stop input when input has never been started. + + + + + + +XTestFakeInput + + + + int XTestFakeInput + Display *display + char *action_list_addr + int action_list_size + int ack_flag + + + + + + + + + display + + +Specifies the connection to the X server. + + + + + action_list_addr + + +Specifies the address of an list of input actions to be sent to the server. + + + + + action_list_size + + +Specifies the size (in bytes) of the list of input actions. +It may be no larger than XTestMAX_ACTION_LIST_SIZE bytes. + + + + + ack_flag + + +Specifies whether the server needs to send an event to indicate that its +input action buffer is empty (one of +XTestFAKE_ACK_NOT_NEEDED or +XTestFAKE_ACK_REQUEST). + + + + + + +The +XTestFakeInput +function tells the server to take the specified user input actions and process +them as if the user had physically performed them. + + + +The server can only accept a limited number of input actions at one +time. This limit can be determined by the +XTestQueryInputSize function +in this extension. + + + +The client should set ack_flag to +XTestFAKE_ACK_NOT_NEEDED +on calls to XTestFakeInput that do not reach this limit. + + + +The client should set ack_flag to +XTestFAKE_ACK_REQUEST +on the call to XTestFakeInput that reaches this limit. + + + +When the server sees an ack_flag value of +XTestFAKE_ACK_REQUEST +it finishes processing its input action buffer, then sends an event with +type XTestFakeAckType to the client. +When the client reads this event, it knows that it is safe to resume +sending input actions to the server. + + + +Since the actual value of the event type may vary depending on how many +extensions are included with an X11 implementation, +XTestFakeAckType is a variable that is contained +in the Xlib part of this extension. It may be referenced as follows: + + + +extern int XTestFakeAckType; + + + +There are four types of input actions that are passed from the client +to the server. They are: + + + + + key/button~state~change + + +This type of input action contains the keycode of the key or button that +is to change state; +whether the key or button is to be up or down, +and the time to delay before changing the state of the key or button. + + + + + pointer~motions + + +This type of input action contains information about the motion of the +pointer when the pointer is to be moved a short distance, +and the time to delay before moving the pointer. +If the pointer is to be moved a long distance, +the pointer jump input action must be used. + + + + + pointer~jumps + + +This type of input action contains information about the motion of the +pointer when the pointer is to be moved a long distance, +and the time to delay before moving the pointer. + + + + + delays + + +This type of input action is used when the delay between input actions is too +large to be held in the other input actions. + + + + + + + +The +XTestFakeInput +function will return -1 if there is an error, and 0 otherwise. + + + +An error code of \fIBadAccess\fR means that another client has already +sent user input actions to the server, and the server has not finished +processing the user input actions. + + + + + + +XTestQueryInputSize + + + + int XTestQueryInputSize + Display *display + unsigned long size_return + + + + + + + display + + +Specifies the connection to the X server. + + + + + size_return + + +Returns the number of input actions that the server's input action buffer can +hold. + + + + + + +The +XTestQueryInputSize +function asks the server to return the number of input actions that it can hold +in its input action buffer in the unsigned long pointed to by \fIsize_return\fR. + + +The +XTestQueryInputSize +function will return -1 if there is an error, and 0 otherwise. + + + + + +XTestReset + + + + int XTestReset + Display *display + + + + + + + display + + +Specifies the connection to the X server. + + + + + + +The +XTestReset +function tells the server to set everything having to do with this extension +back to its initial state. After this call the server will act as if this +extension were not installed until one of the extension functions is called by +a client. This function is not normally needed, but is included in case a +client wishes to clean up the server state, such as after a serious error. + + + +The +XTestReset +function will return -1 if there is an error, and 0 otherwise. + + + + + + + + + + + diff --git a/libXext/src/XSync.c b/libXext/src/XSync.c index 250d10cd3..9fdb47e2f 100644 --- a/libXext/src/XSync.c +++ b/libXext/src/XSync.c @@ -92,21 +92,107 @@ static XExtensionHooks sync_extension_hooks = { static char *sync_error_list[] = { "BadCounter", "BadAlarm", + "BadFence", }; +typedef struct _SyncVersionInfoRec { + short major; + short minor; + int num_errors; +} SyncVersionInfo; + +static /* const */ SyncVersionInfo supported_versions[] = { + { 3 /* major */, 0 /* minor */, 2 /* num_errors */ }, + { 3 /* major */, 1 /* minor */, 3 /* num_errors */ }, +}; + +#define NUM_VERSIONS (sizeof(supported_versions)/sizeof(supported_versions[0])) +#define GET_VERSION(info) ((info) ? (const SyncVersionInfo*)(info)->data : NULL) +#define IS_VERSION_SUPPORTED(info) (!!GET_VERSION(info)) + static -XEXT_GENERATE_FIND_DISPLAY(find_display, sync_info, - sync_extension_name, - &sync_extension_hooks, - XSyncNumberEvents, (XPointer) NULL) +const SyncVersionInfo* GetVersionInfo(Display *dpy) +{ + xSyncInitializeReply rep; + xSyncInitializeReq *req; + XExtCodes codes; + int i; + + if (!XQueryExtension(dpy, sync_extension_name, + &codes.major_opcode, + &codes.first_event, + &codes.first_error)) + return NULL; + + LockDisplay(dpy); + GetReq(SyncInitialize, req); + req->reqType = codes.major_opcode; + req->syncReqType = X_SyncInitialize; + req->majorVersion = SYNC_MAJOR_VERSION; + req->minorVersion = SYNC_MINOR_VERSION; + if (!_XReply(dpy, (xReply *) & rep, 0, xTrue)) + { + UnlockDisplay(dpy); + SyncHandle(); + return NULL; + } + UnlockDisplay(dpy); + SyncHandle(); + + for (i = 0; i < NUM_VERSIONS; i++) { + if (supported_versions[i].major == rep.majorVersion && + supported_versions[i].minor == rep.minorVersion) { + return &supported_versions[i]; + } + } + + return NULL; +} + +static +XExtDisplayInfo *find_display_create_optional(Display *dpy, Bool create) +{ + XExtDisplayInfo *dpyinfo; + + if (!sync_info) { + if (!(sync_info = XextCreateExtension())) return NULL; + } + + if (!(dpyinfo = XextFindDisplay (sync_info, dpy)) && create) { + dpyinfo = XextAddDisplay(sync_info, dpy, + sync_extension_name, + &sync_extension_hooks, + XSyncNumberEvents, + (XPointer)GetVersionInfo(dpy)); + } + + return dpyinfo; +} + +static +XExtDisplayInfo *find_display (Display *dpy) +{ + return find_display_create_optional(dpy, True); +} static XEXT_GENERATE_CLOSE_DISPLAY(close_display, sync_info) static -XEXT_GENERATE_ERROR_STRING(error_string, sync_extension_name, - XSyncNumberErrors, sync_error_list) +char *error_string(Display *dpy, int code, XExtCodes *codes, char *buf, int n) +{ + XExtDisplayInfo *info = find_display_create_optional(dpy, False); + int nerr = IS_VERSION_SUPPORTED(info) ? GET_VERSION(info)->num_errors : 0; + code -= codes->first_error; + if (code >= 0 && code < nerr) { + char tmp[256]; + sprintf (tmp, "%s.%d", sync_extension_name, code); + XGetErrorDatabaseText (dpy, "XProtoError", tmp, sync_error_list[code], buf, n); + return buf; + } + return (char *)0; +} static Bool wire_to_event(Display *dpy, XEvent *event, xEvent *wire) @@ -231,32 +317,17 @@ XSyncInitialize( int *major_version_return, int *minor_version_return) { XExtDisplayInfo *info = find_display(dpy); - xSyncInitializeReply rep; - xSyncInitializeReq *req; SyncCheckExtension(dpy, info, False); - LockDisplay(dpy); - GetReq(SyncInitialize, req); - req->reqType = info->codes->major_opcode; - req->syncReqType = X_SyncInitialize; - req->majorVersion = SYNC_MAJOR_VERSION; - req->minorVersion = SYNC_MINOR_VERSION; - if (!_XReply(dpy, (xReply *) & rep, 0, xTrue)) - { - UnlockDisplay(dpy); - SyncHandle(); + if (IS_VERSION_SUPPORTED(info)) { + *major_version_return = GET_VERSION(info)->major; + *minor_version_return = GET_VERSION(info)->minor; + + return True; + } else { return False; } - UnlockDisplay(dpy); - SyncHandle(); - *major_version_return = rep.majorVersion; - *minor_version_return = rep.minorVersion; - return ((rep.majorVersion == SYNC_MAJOR_VERSION) -#if SYNC_MINOR_VERSION > 0 /* avoid compiler warning */ - && (rep.minorVersion >= SYNC_MINOR_VERSION) -#endif - ); } XSyncSystemCounter * @@ -691,6 +762,139 @@ XSyncGetPriority(Display *dpy, XID client_resource_id, int *return_priority) return True; } +XSyncFence +XSyncCreateFence(Display *dpy, Drawable d, Bool initially_triggered) +{ + XExtDisplayInfo *info = find_display(dpy); + xSyncCreateFenceReq *req; + XSyncFence id; + + SyncCheckExtension(dpy, info, None); + + LockDisplay(dpy); + GetReq(SyncCreateFence, req); + req->reqType = info->codes->major_opcode; + req->syncReqType = X_SyncCreateFence; + + req->d = d; + id = req->fid = XAllocID(dpy); + req->initially_triggered = initially_triggered; + + UnlockDisplay(dpy); + SyncHandle(); + return id; +} + +Bool +XSyncTriggerFence(Display *dpy, XSyncFence fence) +{ + XExtDisplayInfo *info = find_display(dpy); + xSyncTriggerFenceReq *req; + + SyncCheckExtension(dpy, info, None); + + LockDisplay(dpy); + GetReq(SyncTriggerFence, req); + req->reqType = info->codes->major_opcode; + req->syncReqType = X_SyncTriggerFence; + + req->fid = fence; + + UnlockDisplay(dpy); + SyncHandle(); + return True; +} + +Bool +XSyncResetFence(Display *dpy, XSyncFence fence) +{ + XExtDisplayInfo *info = find_display(dpy); + xSyncResetFenceReq *req; + + SyncCheckExtension(dpy, info, None); + + LockDisplay(dpy); + GetReq(SyncResetFence, req); + req->reqType = info->codes->major_opcode; + req->syncReqType = X_SyncResetFence; + + req->fid = fence; + + UnlockDisplay(dpy); + SyncHandle(); + return True; +} + +Bool +XSyncDestroyFence(Display *dpy, XSyncFence fence) +{ + XExtDisplayInfo *info = find_display(dpy); + xSyncDestroyFenceReq *req; + + SyncCheckExtension(dpy, info, None); + + LockDisplay(dpy); + GetReq(SyncDestroyFence, req); + req->reqType = info->codes->major_opcode; + req->syncReqType = X_SyncDestroyFence; + + req->fid = fence; + + UnlockDisplay(dpy); + SyncHandle(); + return True; +} + +Bool +XSyncQueryFence(Display *dpy, XSyncFence fence, Bool *triggered) +{ + XExtDisplayInfo *info = find_display(dpy); + xSyncQueryFenceReply rep; + xSyncQueryFenceReq *req; + + SyncCheckExtension(dpy, info, None); + + LockDisplay(dpy); + GetReq(SyncQueryFence, req); + req->reqType = info->codes->major_opcode; + req->syncReqType = X_SyncQueryFence; + req->fid = fence; + + if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) + { + UnlockDisplay(dpy); + SyncHandle(); + return False; + } + if (triggered) + *triggered = rep.triggered; + + UnlockDisplay(dpy); + SyncHandle(); + return True; +} + +Bool +XSyncAwaitFence(Display *dpy, const XSyncFence *fence_list, int n_fences) +{ + XExtDisplayInfo *info = find_display(dpy); + xSyncAwaitFenceReq *req; + + SyncCheckExtension(dpy, info, False); + + LockDisplay(dpy); + GetReq(SyncAwaitFence, req); + req->reqType = info->codes->major_opcode; + req->syncReqType = X_SyncAwaitFence; + SetReqLen(req, n_fences, n_fences); + + Data32(dpy, (char *)fence_list, sizeof(CARD32) * n_fences); + + UnlockDisplay(dpy); + SyncHandle(); + return True; +} + /* * Functions corresponding to the macros for manipulating 64-bit values */ diff --git a/pixman/pixman/pixman-arm-common.h b/pixman/pixman/pixman-arm-common.h index 08f34cc20..ede63a629 100644 --- a/pixman/pixman/pixman-arm-common.h +++ b/pixman/pixman/pixman-arm-common.h @@ -47,6 +47,9 @@ * or mask), the corresponding stride argument is unused. */ +#define SKIP_ZERO_SRC 1 +#define SKIP_ZERO_MASK 2 + #define PIXMAN_ARM_BIND_FAST_PATH_SRC_DST(cputype, name, \ src_type, src_cnt, \ dst_type, dst_cnt) \ @@ -87,7 +90,7 @@ cputype##_composite_##name (pixman_implementation_t *imp, \ src_line, src_stride); \ } -#define PIXMAN_ARM_BIND_FAST_PATH_N_DST(cputype, name, \ +#define PIXMAN_ARM_BIND_FAST_PATH_N_DST(flags, cputype, name, \ dst_type, dst_cnt) \ void \ pixman_composite_##name##_asm_##cputype (int32_t w, \ @@ -117,7 +120,7 @@ cputype##_composite_##name (pixman_implementation_t *imp, \ \ src = _pixman_image_get_solid (src_image, dst_image->bits.format); \ \ - if (src == 0) \ + if ((flags & SKIP_ZERO_SRC) && src == 0) \ return; \ \ PIXMAN_IMAGE_GET_LINE (dst_image, dest_x, dest_y, dst_type, \ @@ -128,7 +131,7 @@ cputype##_composite_##name (pixman_implementation_t *imp, \ src); \ } -#define PIXMAN_ARM_BIND_FAST_PATH_N_MASK_DST(cputype, name, \ +#define PIXMAN_ARM_BIND_FAST_PATH_N_MASK_DST(flags, cputype, name, \ mask_type, mask_cnt, \ dst_type, dst_cnt) \ void \ @@ -163,7 +166,7 @@ cputype##_composite_##name (pixman_implementation_t *imp, \ \ src = _pixman_image_get_solid (src_image, dst_image->bits.format); \ \ - if (src == 0) \ + if ((flags & SKIP_ZERO_SRC) && src == 0) \ return; \ \ PIXMAN_IMAGE_GET_LINE (dst_image, dest_x, dest_y, dst_type, \ @@ -177,7 +180,7 @@ cputype##_composite_##name (pixman_implementation_t *imp, \ mask_line, mask_stride); \ } -#define PIXMAN_ARM_BIND_FAST_PATH_SRC_N_DST(cputype, name, \ +#define PIXMAN_ARM_BIND_FAST_PATH_SRC_N_DST(flags, cputype, name, \ src_type, src_cnt, \ dst_type, dst_cnt) \ void \ @@ -211,7 +214,7 @@ cputype##_composite_##name (pixman_implementation_t *imp, \ \ mask = _pixman_image_get_solid (mask_image, dst_image->bits.format);\ \ - if (mask == 0) \ + if ((flags & SKIP_ZERO_MASK) && mask == 0) \ return; \ \ PIXMAN_IMAGE_GET_LINE (dst_image, dest_x, dest_y, dst_type, \ diff --git a/pixman/pixman/pixman-arm-neon-asm.S b/pixman/pixman/pixman-arm-neon-asm.S index 0229bedfa..b6e7c366b 100644 --- a/pixman/pixman/pixman-arm-neon-asm.S +++ b/pixman/pixman/pixman-arm-neon-asm.S @@ -791,61 +791,112 @@ generate_composite_function \ /******************************************************************************/ -.macro pixman_composite_over_n_8_0565_process_pixblock_head - /* in */ - vmull.u8 q0, d24, d8 - vmull.u8 q1, d24, d9 - vmull.u8 q6, d24, d10 - vmull.u8 q7, d24, d11 - vrshr.u16 q10, q0, #8 - vrshr.u16 q11, q1, #8 - vrshr.u16 q12, q6, #8 - vrshr.u16 q13, q7, #8 - vraddhn.u16 d0, q0, q10 - vraddhn.u16 d1, q1, q11 - vraddhn.u16 d2, q6, q12 - vraddhn.u16 d3, q7, q13 - - vshrn.u16 d6, q2, #8 - vshrn.u16 d7, q2, #3 - vsli.u16 q2, q2, #5 - vsri.u8 d6, d6, #5 - vmvn.8 d3, d3 - vsri.u8 d7, d7, #6 - vshrn.u16 d30, q2, #2 - /* now do alpha blending */ - vmull.u8 q10, d3, d6 - vmull.u8 q11, d3, d7 - vmull.u8 q12, d3, d30 - vrshr.u16 q13, q10, #8 - vrshr.u16 q3, q11, #8 - vrshr.u16 q15, q12, #8 - vraddhn.u16 d20, q10, q13 - vraddhn.u16 d23, q11, q3 - vraddhn.u16 d22, q12, q15 -.endm - -.macro pixman_composite_over_n_8_0565_process_pixblock_tail - vqadd.u8 d16, d2, d20 - vqadd.u8 q9, q0, q11 - /* convert to r5g6b5 */ - vshll.u8 q14, d16, #8 - vshll.u8 q8, d19, #8 - vshll.u8 q9, d18, #8 - vsri.u16 q14, q8, #5 - vsri.u16 q14, q9, #11 +.macro pixman_composite_over_8888_8_0565_process_pixblock_head + vmull.u8 q0, d24, d8 /* IN for SRC pixels (part1) */ + vmull.u8 q1, d24, d9 + vmull.u8 q6, d24, d10 + vmull.u8 q7, d24, d11 + vshrn.u16 d6, q2, #8 /* convert DST_R data to 32-bpp (part1) */ + vshrn.u16 d7, q2, #3 + vsli.u16 q2, q2, #5 + vrshr.u16 q8, q0, #8 /* IN for SRC pixels (part2) */ + vrshr.u16 q9, q1, #8 + vrshr.u16 q10, q6, #8 + vrshr.u16 q11, q7, #8 + vraddhn.u16 d0, q0, q8 + vraddhn.u16 d1, q1, q9 + vraddhn.u16 d2, q6, q10 + vraddhn.u16 d3, q7, q11 + vsri.u8 d6, d6, #5 /* convert DST_R data to 32-bpp (part2) */ + vsri.u8 d7, d7, #6 + vmvn.8 d3, d3 + vshrn.u16 d30, q2, #2 + vmull.u8 q8, d3, d6 /* now do alpha blending */ + vmull.u8 q9, d3, d7 + vmull.u8 q10, d3, d30 +.endm + +.macro pixman_composite_over_8888_8_0565_process_pixblock_tail + /* 3 cycle bubble (after vmull.u8) */ + vrshr.u16 q13, q8, #8 + vrshr.u16 q11, q9, #8 + vrshr.u16 q15, q10, #8 + vraddhn.u16 d16, q8, q13 + vraddhn.u16 d27, q9, q11 + vraddhn.u16 d26, q10, q15 + vqadd.u8 d16, d2, d16 + /* 1 cycle bubble */ + vqadd.u8 q9, q0, q13 + vshll.u8 q14, d16, #8 /* convert to 16bpp */ + vshll.u8 q8, d19, #8 + vshll.u8 q9, d18, #8 + vsri.u16 q14, q8, #5 + /* 1 cycle bubble */ + vsri.u16 q14, q9, #11 .endm -/* TODO: expand macros and do better instructions scheduling */ -.macro pixman_composite_over_n_8_0565_process_pixblock_tail_head - pixman_composite_over_n_8_0565_process_pixblock_tail - vst1.16 {d28, d29}, [DST_W, :128]! +.macro pixman_composite_over_8888_8_0565_process_pixblock_tail_head vld1.16 {d4, d5}, [DST_R, :128]! - vld1.8 {d24}, [MASK]! + vshrn.u16 d6, q2, #8 + fetch_mask_pixblock + vshrn.u16 d7, q2, #3 + fetch_src_pixblock + vmull.u8 q6, d24, d10 + vrshr.u16 q13, q8, #8 + vrshr.u16 q11, q9, #8 + vrshr.u16 q15, q10, #8 + vraddhn.u16 d16, q8, q13 + vraddhn.u16 d27, q9, q11 + vraddhn.u16 d26, q10, q15 + vqadd.u8 d16, d2, d16 + vmull.u8 q1, d24, d9 + vqadd.u8 q9, q0, q13 + vshll.u8 q14, d16, #8 + vmull.u8 q0, d24, d8 + vshll.u8 q8, d19, #8 + vshll.u8 q9, d18, #8 + vsri.u16 q14, q8, #5 + vmull.u8 q7, d24, d11 + vsri.u16 q14, q9, #11 + cache_preload 8, 8 - pixman_composite_over_n_8_0565_process_pixblock_head + + vsli.u16 q2, q2, #5 + vrshr.u16 q8, q0, #8 + vrshr.u16 q9, q1, #8 + vrshr.u16 q10, q6, #8 + vrshr.u16 q11, q7, #8 + vraddhn.u16 d0, q0, q8 + vraddhn.u16 d1, q1, q9 + vraddhn.u16 d2, q6, q10 + vraddhn.u16 d3, q7, q11 + vsri.u8 d6, d6, #5 + vsri.u8 d7, d7, #6 + vmvn.8 d3, d3 + vshrn.u16 d30, q2, #2 + vst1.16 {d28, d29}, [DST_W, :128]! + vmull.u8 q8, d3, d6 + vmull.u8 q9, d3, d7 + vmull.u8 q10, d3, d30 .endm +generate_composite_function \ + pixman_composite_over_8888_8_0565_asm_neon, 32, 8, 16, \ + FLAG_DST_READWRITE | FLAG_DEINTERLEAVE_32BPP, \ + 8, /* number of pixels, processed in a single block */ \ + 5, /* prefetch distance */ \ + default_init_need_all_regs, \ + default_cleanup_need_all_regs, \ + pixman_composite_over_8888_8_0565_process_pixblock_head, \ + pixman_composite_over_8888_8_0565_process_pixblock_tail, \ + pixman_composite_over_8888_8_0565_process_pixblock_tail_head, \ + 28, /* dst_w_basereg */ \ + 4, /* dst_r_basereg */ \ + 8, /* src_basereg */ \ + 24 /* mask_basereg */ + +/******************************************************************************/ + /* * This function needs a special initialization of solid mask. * Solid source pixel data is fetched from stack at ARGS_STACK_OFFSET @@ -877,32 +928,32 @@ generate_composite_function \ 5, /* prefetch distance */ \ pixman_composite_over_n_8_0565_init, \ pixman_composite_over_n_8_0565_cleanup, \ - pixman_composite_over_n_8_0565_process_pixblock_head, \ - pixman_composite_over_n_8_0565_process_pixblock_tail, \ - pixman_composite_over_n_8_0565_process_pixblock_tail_head + pixman_composite_over_8888_8_0565_process_pixblock_head, \ + pixman_composite_over_8888_8_0565_process_pixblock_tail, \ + pixman_composite_over_8888_8_0565_process_pixblock_tail_head /******************************************************************************/ -/* TODO: expand macros and do better instructions scheduling */ -.macro pixman_composite_over_8888_8_0565_process_pixblock_tail_head - vld1.16 {d4, d5}, [DST_R, :128]! - pixman_composite_over_n_8_0565_process_pixblock_tail - fetch_src_pixblock - cache_preload 8, 8 - vld1.8 {d24}, [MASK]! - pixman_composite_over_n_8_0565_process_pixblock_head - vst1.16 {d28, d29}, [DST_W, :128]! +.macro pixman_composite_over_8888_n_0565_init + add DUMMY, sp, #(ARGS_STACK_OFFSET + 8) + vpush {d8-d15} + vld1.32 {d24[0]}, [DUMMY] + vdup.8 d24, d24[3] +.endm + +.macro pixman_composite_over_8888_n_0565_cleanup + vpop {d8-d15} .endm generate_composite_function \ - pixman_composite_over_8888_8_0565_asm_neon, 32, 8, 16, \ + pixman_composite_over_8888_n_0565_asm_neon, 32, 0, 16, \ FLAG_DST_READWRITE | FLAG_DEINTERLEAVE_32BPP, \ 8, /* number of pixels, processed in a single block */ \ 5, /* prefetch distance */ \ - default_init_need_all_regs, \ - default_cleanup_need_all_regs, \ - pixman_composite_over_n_8_0565_process_pixblock_head, \ - pixman_composite_over_n_8_0565_process_pixblock_tail, \ + pixman_composite_over_8888_n_0565_init, \ + pixman_composite_over_8888_n_0565_cleanup, \ + pixman_composite_over_8888_8_0565_process_pixblock_head, \ + pixman_composite_over_8888_8_0565_process_pixblock_tail, \ pixman_composite_over_8888_8_0565_process_pixblock_tail_head, \ 28, /* dst_w_basereg */ \ 4, /* dst_r_basereg */ \ @@ -1171,7 +1222,7 @@ generate_composite_function \ pixman_composite_over_n_8_8888_process_pixblock_tail vst4.8 {d28, d29, d30, d31}, [DST_W, :128]! vld4.8 {d4, d5, d6, d7}, [DST_R, :128]! - vld1.8 {d24}, [MASK]! + fetch_mask_pixblock cache_preload 8, 8 pixman_composite_over_n_8_8888_process_pixblock_head .endm @@ -1203,6 +1254,74 @@ generate_composite_function \ /******************************************************************************/ +.macro pixman_composite_over_n_8_8_process_pixblock_head + vmull.u8 q0, d24, d8 + vmull.u8 q1, d25, d8 + vmull.u8 q6, d26, d8 + vmull.u8 q7, d27, d8 + vrshr.u16 q10, q0, #8 + vrshr.u16 q11, q1, #8 + vrshr.u16 q12, q6, #8 + vrshr.u16 q13, q7, #8 + vraddhn.u16 d0, q0, q10 + vraddhn.u16 d1, q1, q11 + vraddhn.u16 d2, q6, q12 + vraddhn.u16 d3, q7, q13 + vmvn.8 q12, q0 + vmvn.8 q13, q1 + vmull.u8 q8, d24, d4 + vmull.u8 q9, d25, d5 + vmull.u8 q10, d26, d6 + vmull.u8 q11, d27, d7 +.endm + +.macro pixman_composite_over_n_8_8_process_pixblock_tail + vrshr.u16 q14, q8, #8 + vrshr.u16 q15, q9, #8 + vrshr.u16 q12, q10, #8 + vrshr.u16 q13, q11, #8 + vraddhn.u16 d28, q14, q8 + vraddhn.u16 d29, q15, q9 + vraddhn.u16 d30, q12, q10 + vraddhn.u16 d31, q13, q11 + vqadd.u8 q14, q0, q14 + vqadd.u8 q15, q1, q15 +.endm + +/* TODO: expand macros and do better instructions scheduling */ +.macro pixman_composite_over_n_8_8_process_pixblock_tail_head + vld1.8 {d4, d5, d6, d7}, [DST_R, :128]! + pixman_composite_over_n_8_8_process_pixblock_tail + fetch_mask_pixblock + cache_preload 32, 32 + vst1.8 {d28, d29, d30, d31}, [DST_W, :128]! + pixman_composite_over_n_8_8_process_pixblock_head +.endm + +.macro pixman_composite_over_n_8_8_init + add DUMMY, sp, #ARGS_STACK_OFFSET + vpush {d8-d15} + vld1.32 {d8[0]}, [DUMMY] + vdup.8 d8, d8[3] +.endm + +.macro pixman_composite_over_n_8_8_cleanup + vpop {d8-d15} +.endm + +generate_composite_function \ + pixman_composite_over_n_8_8_asm_neon, 0, 8, 8, \ + FLAG_DST_READWRITE, \ + 32, /* number of pixels, processed in a single block */ \ + 5, /* prefetch distance */ \ + pixman_composite_over_n_8_8_init, \ + pixman_composite_over_n_8_8_cleanup, \ + pixman_composite_over_n_8_8_process_pixblock_head, \ + pixman_composite_over_n_8_8_process_pixblock_tail, \ + pixman_composite_over_n_8_8_process_pixblock_tail_head + +/******************************************************************************/ + .macro pixman_composite_over_n_8888_8888_ca_process_pixblock_head /* * 'combine_mask_ca' replacement @@ -1273,7 +1392,7 @@ generate_composite_function \ vraddhn.u16 d29, q15, q9 vraddhn.u16 d30, q6, q10 vraddhn.u16 d31, q7, q11 - vld4.8 {d24, d25, d26, d27}, [MASK]! + fetch_mask_pixblock vqadd.u8 q14, q0, q14 vqadd.u8 q15, q1, q15 cache_preload 8, 8 @@ -1308,6 +1427,58 @@ generate_composite_function \ /******************************************************************************/ +.macro pixman_composite_in_n_8_process_pixblock_head + /* expecting source data in {d0, d1, d2, d3} */ + /* and destination data in {d4, d5, d6, d7} */ + vmull.u8 q8, d4, d3 + vmull.u8 q9, d5, d3 + vmull.u8 q10, d6, d3 + vmull.u8 q11, d7, d3 +.endm + +.macro pixman_composite_in_n_8_process_pixblock_tail + vrshr.u16 q14, q8, #8 + vrshr.u16 q15, q9, #8 + vrshr.u16 q12, q10, #8 + vrshr.u16 q13, q11, #8 + vraddhn.u16 d28, q8, q14 + vraddhn.u16 d29, q9, q15 + vraddhn.u16 d30, q10, q12 + vraddhn.u16 d31, q11, q13 +.endm + +.macro pixman_composite_in_n_8_process_pixblock_tail_head + pixman_composite_in_n_8_process_pixblock_tail + vld1.8 {d4, d5, d6, d7}, [DST_R, :128]! + cache_preload 32, 32 + pixman_composite_in_n_8_process_pixblock_head + vst1.8 {d28, d29, d30, d31}, [DST_W, :128]! +.endm + +.macro pixman_composite_in_n_8_init + add DUMMY, sp, #ARGS_STACK_OFFSET + vld1.32 {d3[0]}, [DUMMY] + vdup.8 d3, d3[3] +.endm + +.macro pixman_composite_in_n_8_cleanup +.endm + +generate_composite_function \ + pixman_composite_in_n_8_asm_neon, 0, 0, 8, \ + FLAG_DST_READWRITE, \ + 32, /* number of pixels, processed in a single block */ \ + 5, /* prefetch distance */ \ + pixman_composite_in_n_8_init, \ + pixman_composite_in_n_8_cleanup, \ + pixman_composite_in_n_8_process_pixblock_head, \ + pixman_composite_in_n_8_process_pixblock_tail, \ + pixman_composite_in_n_8_process_pixblock_tail_head, \ + 28, /* dst_w_basereg */ \ + 4, /* dst_r_basereg */ \ + 0, /* src_basereg */ \ + 24 /* mask_basereg */ + .macro pixman_composite_add_n_8_8_process_pixblock_head /* expecting source data in {d8, d9, d10, d11} */ /* d8 - blue, d9 - green, d10 - red, d11 - alpha */ @@ -1337,7 +1508,7 @@ generate_composite_function \ pixman_composite_add_n_8_8_process_pixblock_tail vst1.8 {d28, d29, d30, d31}, [DST_W, :128]! vld1.8 {d4, d5, d6, d7}, [DST_R, :128]! - vld1.8 {d24, d25, d26, d27}, [MASK]! + fetch_mask_pixblock cache_preload 32, 32 pixman_composite_add_n_8_8_process_pixblock_head .endm @@ -1394,7 +1565,7 @@ generate_composite_function \ pixman_composite_add_8_8_8_process_pixblock_tail vst1.8 {d28, d29, d30, d31}, [DST_W, :128]! vld1.8 {d4, d5, d6, d7}, [DST_R, :128]! - vld1.8 {d24, d25, d26, d27}, [MASK]! + fetch_mask_pixblock fetch_src_pixblock cache_preload 32, 32 pixman_composite_add_8_8_8_process_pixblock_head @@ -1423,34 +1594,50 @@ generate_composite_function \ /* expecting source data in {d0, d1, d2, d3} */ /* destination data in {d4, d5, d6, d7} */ /* mask in {d24, d25, d26, d27} */ - vmull.u8 q8, d27, d0 - vmull.u8 q9, d27, d1 + vmull.u8 q8, d27, d0 + vmull.u8 q9, d27, d1 vmull.u8 q10, d27, d2 vmull.u8 q11, d27, d3 - vrshr.u16 q0, q8, #8 - vrshr.u16 q1, q9, #8 - vrshr.u16 q12, q10, #8 - vrshr.u16 q13, q11, #8 - vraddhn.u16 d0, q0, q8 - vraddhn.u16 d1, q1, q9 - vraddhn.u16 d2, q12, q10 - vraddhn.u16 d3, q13, q11 - vqadd.u8 q14, q0, q2 - vqadd.u8 q15, q1, q3 + /* 1 cycle bubble */ + vrsra.u16 q8, q8, #8 + vrsra.u16 q9, q9, #8 + vrsra.u16 q10, q10, #8 + vrsra.u16 q11, q11, #8 .endm .macro pixman_composite_add_8888_8888_8888_process_pixblock_tail + /* 2 cycle bubble */ + vrshrn.u16 d28, q8, #8 + vrshrn.u16 d29, q9, #8 + vrshrn.u16 d30, q10, #8 + vrshrn.u16 d31, q11, #8 + vqadd.u8 q14, q2, q14 + /* 1 cycle bubble */ + vqadd.u8 q15, q3, q15 .endm -/* TODO: expand macros and do better instructions scheduling */ .macro pixman_composite_add_8888_8888_8888_process_pixblock_tail_head - pixman_composite_add_8888_8888_8888_process_pixblock_tail - vst4.8 {d28, d29, d30, d31}, [DST_W, :128]! - vld4.8 {d4, d5, d6, d7}, [DST_R, :128]! - vld4.8 {d24, d25, d26, d27}, [MASK]! fetch_src_pixblock + vrshrn.u16 d28, q8, #8 + fetch_mask_pixblock + vrshrn.u16 d29, q9, #8 + vmull.u8 q8, d27, d0 + vrshrn.u16 d30, q10, #8 + vmull.u8 q9, d27, d1 + vrshrn.u16 d31, q11, #8 + vmull.u8 q10, d27, d2 + vqadd.u8 q14, q2, q14 + vmull.u8 q11, d27, d3 + vqadd.u8 q15, q3, q15 + vrsra.u16 q8, q8, #8 + vld4.8 {d4, d5, d6, d7}, [DST_R, :128]! + vrsra.u16 q9, q9, #8 + vst4.8 {d28, d29, d30, d31}, [DST_W, :128]! + vrsra.u16 q10, q10, #8 + cache_preload 8, 8 - pixman_composite_add_8888_8888_8888_process_pixblock_head + + vrsra.u16 q11, q11, #8 .endm generate_composite_function \ @@ -1476,6 +1663,78 @@ generate_composite_function_single_scanline \ /******************************************************************************/ +generate_composite_function \ + pixman_composite_add_8888_8_8888_asm_neon, 32, 8, 32, \ + FLAG_DST_READWRITE | FLAG_DEINTERLEAVE_32BPP, \ + 8, /* number of pixels, processed in a single block */ \ + 5, /* prefetch distance */ \ + default_init, \ + default_cleanup, \ + pixman_composite_add_8888_8888_8888_process_pixblock_head, \ + pixman_composite_add_8888_8888_8888_process_pixblock_tail, \ + pixman_composite_add_8888_8888_8888_process_pixblock_tail_head, \ + 28, /* dst_w_basereg */ \ + 4, /* dst_r_basereg */ \ + 0, /* src_basereg */ \ + 27 /* mask_basereg */ + +/******************************************************************************/ + +.macro pixman_composite_add_n_8_8888_init + add DUMMY, sp, #ARGS_STACK_OFFSET + vld1.32 {d3[0]}, [DUMMY] + vdup.8 d0, d3[0] + vdup.8 d1, d3[1] + vdup.8 d2, d3[2] + vdup.8 d3, d3[3] +.endm + +.macro pixman_composite_add_n_8_8888_cleanup +.endm + +generate_composite_function \ + pixman_composite_add_n_8_8888_asm_neon, 0, 8, 32, \ + FLAG_DST_READWRITE | FLAG_DEINTERLEAVE_32BPP, \ + 8, /* number of pixels, processed in a single block */ \ + 5, /* prefetch distance */ \ + pixman_composite_add_n_8_8888_init, \ + pixman_composite_add_n_8_8888_cleanup, \ + pixman_composite_add_8888_8888_8888_process_pixblock_head, \ + pixman_composite_add_8888_8888_8888_process_pixblock_tail, \ + pixman_composite_add_8888_8888_8888_process_pixblock_tail_head, \ + 28, /* dst_w_basereg */ \ + 4, /* dst_r_basereg */ \ + 0, /* src_basereg */ \ + 27 /* mask_basereg */ + +/******************************************************************************/ + +.macro pixman_composite_add_8888_n_8888_init + add DUMMY, sp, #(ARGS_STACK_OFFSET + 8) + vld1.32 {d27[0]}, [DUMMY] + vdup.8 d27, d27[3] +.endm + +.macro pixman_composite_add_8888_n_8888_cleanup +.endm + +generate_composite_function \ + pixman_composite_add_8888_n_8888_asm_neon, 32, 0, 32, \ + FLAG_DST_READWRITE | FLAG_DEINTERLEAVE_32BPP, \ + 8, /* number of pixels, processed in a single block */ \ + 5, /* prefetch distance */ \ + pixman_composite_add_8888_n_8888_init, \ + pixman_composite_add_8888_n_8888_cleanup, \ + pixman_composite_add_8888_8888_8888_process_pixblock_head, \ + pixman_composite_add_8888_8888_8888_process_pixblock_tail, \ + pixman_composite_add_8888_8888_8888_process_pixblock_tail_head, \ + 28, /* dst_w_basereg */ \ + 4, /* dst_r_basereg */ \ + 0, /* src_basereg */ \ + 27 /* mask_basereg */ + +/******************************************************************************/ + .macro pixman_composite_out_reverse_8888_n_8888_process_pixblock_head /* expecting source data in {d0, d1, d2, d3} */ /* destination data in {d4, d5, d6, d7} */ @@ -1519,7 +1778,7 @@ generate_composite_function_single_scanline \ pixman_composite_out_reverse_8888_n_8888_process_pixblock_tail fetch_src_pixblock cache_preload 8, 8 - vld4.8 {d12, d13, d14, d15}, [MASK]! + fetch_mask_pixblock pixman_composite_out_reverse_8888_n_8888_process_pixblock_head vst4.8 {d28, d29, d30, d31}, [DST_W, :128]! .endm @@ -1590,7 +1849,7 @@ generate_composite_function \ pixman_composite_over_8888_n_8888_process_pixblock_tail fetch_src_pixblock cache_preload 8, 8 - vld4.8 {d12, d13, d14, d15}, [MASK]! + fetch_mask_pixblock pixman_composite_over_8888_n_8888_process_pixblock_head vst4.8 {d28, d29, d30, d31}, [DST_W, :128]! .endm @@ -1632,7 +1891,7 @@ generate_composite_function_single_scanline \ pixman_composite_over_8888_n_8888_process_pixblock_tail fetch_src_pixblock cache_preload 8, 8 - vld1.8 {d15}, [MASK]! + fetch_mask_pixblock pixman_composite_over_8888_n_8888_process_pixblock_head vst4.8 {d28, d29, d30, d31}, [DST_W, :128]! .endm @@ -1849,7 +2108,7 @@ generate_composite_function \ /* TODO: expand macros and do better instructions scheduling */ .macro pixman_composite_over_0565_8_0565_process_pixblock_tail_head - vld1.8 {d15}, [MASK]! + fetch_mask_pixblock pixman_composite_over_0565_8_0565_process_pixblock_tail fetch_src_pixblock vld1.16 {d10, d11}, [DST_R, :128]! @@ -1875,6 +2134,34 @@ generate_composite_function \ /******************************************************************************/ +.macro pixman_composite_over_0565_n_0565_init + add DUMMY, sp, #(ARGS_STACK_OFFSET + 8) + vpush {d8-d15} + vld1.32 {d15[0]}, [DUMMY] + vdup.8 d15, d15[3] +.endm + +.macro pixman_composite_over_0565_n_0565_cleanup + vpop {d8-d15} +.endm + +generate_composite_function \ + pixman_composite_over_0565_n_0565_asm_neon, 16, 0, 16, \ + FLAG_DST_READWRITE, \ + 8, /* number of pixels, processed in a single block */ \ + 5, /* prefetch distance */ \ + pixman_composite_over_0565_n_0565_init, \ + pixman_composite_over_0565_n_0565_cleanup, \ + pixman_composite_over_0565_8_0565_process_pixblock_head, \ + pixman_composite_over_0565_8_0565_process_pixblock_tail, \ + pixman_composite_over_0565_8_0565_process_pixblock_tail_head, \ + 28, /* dst_w_basereg */ \ + 10, /* dst_r_basereg */ \ + 8, /* src_basereg */ \ + 15 /* mask_basereg */ + +/******************************************************************************/ + .macro pixman_composite_add_0565_8_0565_process_pixblock_head /* mask is in d15 */ convert_0565_to_x888 q4, d2, d1, d0 @@ -1901,7 +2188,7 @@ generate_composite_function \ /* TODO: expand macros and do better instructions scheduling */ .macro pixman_composite_add_0565_8_0565_process_pixblock_tail_head - vld1.8 {d15}, [MASK]! + fetch_mask_pixblock pixman_composite_add_0565_8_0565_process_pixblock_tail fetch_src_pixblock vld1.16 {d10, d11}, [DST_R, :128]! diff --git a/pixman/pixman/pixman-arm-neon-asm.h b/pixman/pixman/pixman-arm-neon-asm.h index 1d8a31c1e..6e3d583f5 100644 --- a/pixman/pixman/pixman-arm-neon-asm.h +++ b/pixman/pixman/pixman-arm-neon-asm.h @@ -431,6 +431,11 @@ .endif .endm +.macro fetch_mask_pixblock + pixld pixblock_size, mask_bpp, \ + (mask_basereg - pixblock_size * mask_bpp / 64), MASK +.endm + /* * Macro which is used to process leading pixels until destination * pointer is properly aligned (at 16 bytes boundary). When destination diff --git a/pixman/pixman/pixman-arm-neon.c b/pixman/pixman/pixman-arm-neon.c index 858bb071e..9e879382b 100644 --- a/pixman/pixman/pixman-arm-neon.c +++ b/pixman/pixman/pixman-arm-neon.c @@ -63,29 +63,43 @@ PIXMAN_ARM_BIND_FAST_PATH_SRC_DST (neon, over_8888_8888, PIXMAN_ARM_BIND_FAST_PATH_SRC_DST (neon, out_reverse_8_0565, uint8_t, 1, uint16_t, 1) -PIXMAN_ARM_BIND_FAST_PATH_N_DST (neon, over_n_0565, +PIXMAN_ARM_BIND_FAST_PATH_N_DST (SKIP_ZERO_SRC, neon, over_n_0565, uint16_t, 1) -PIXMAN_ARM_BIND_FAST_PATH_N_DST (neon, over_n_8888, +PIXMAN_ARM_BIND_FAST_PATH_N_DST (SKIP_ZERO_SRC, neon, over_n_8888, uint32_t, 1) -PIXMAN_ARM_BIND_FAST_PATH_N_DST (neon, over_reverse_n_8888, +PIXMAN_ARM_BIND_FAST_PATH_N_DST (SKIP_ZERO_SRC, neon, over_reverse_n_8888, uint32_t, 1) +PIXMAN_ARM_BIND_FAST_PATH_N_DST (0, neon, in_n_8, + uint8_t, 1) -PIXMAN_ARM_BIND_FAST_PATH_N_MASK_DST (neon, over_n_8_0565, +PIXMAN_ARM_BIND_FAST_PATH_N_MASK_DST (SKIP_ZERO_SRC, neon, over_n_8_0565, uint8_t, 1, uint16_t, 1) -PIXMAN_ARM_BIND_FAST_PATH_N_MASK_DST (neon, over_n_8_8888, +PIXMAN_ARM_BIND_FAST_PATH_N_MASK_DST (SKIP_ZERO_SRC, neon, over_n_8_8888, uint8_t, 1, uint32_t, 1) -PIXMAN_ARM_BIND_FAST_PATH_N_MASK_DST (neon, over_n_8888_8888_ca, +PIXMAN_ARM_BIND_FAST_PATH_N_MASK_DST (SKIP_ZERO_SRC, neon, over_n_8888_8888_ca, uint32_t, 1, uint32_t, 1) -PIXMAN_ARM_BIND_FAST_PATH_N_MASK_DST (neon, add_n_8_8, +PIXMAN_ARM_BIND_FAST_PATH_N_MASK_DST (SKIP_ZERO_SRC, neon, over_n_8_8, uint8_t, 1, uint8_t, 1) +PIXMAN_ARM_BIND_FAST_PATH_N_MASK_DST (SKIP_ZERO_SRC, neon, add_n_8_8, + uint8_t, 1, uint8_t, 1) +PIXMAN_ARM_BIND_FAST_PATH_N_MASK_DST (SKIP_ZERO_SRC, neon, add_n_8_8888, + uint8_t, 1, uint32_t, 1) -PIXMAN_ARM_BIND_FAST_PATH_SRC_N_DST (neon, over_8888_n_8888, +PIXMAN_ARM_BIND_FAST_PATH_SRC_N_DST (SKIP_ZERO_MASK, neon, over_8888_n_8888, + uint32_t, 1, uint32_t, 1) +PIXMAN_ARM_BIND_FAST_PATH_SRC_N_DST (SKIP_ZERO_MASK, neon, over_8888_n_0565, + uint32_t, 1, uint16_t, 1) +PIXMAN_ARM_BIND_FAST_PATH_SRC_N_DST (SKIP_ZERO_MASK, neon, over_0565_n_0565, + uint16_t, 1, uint16_t, 1) +PIXMAN_ARM_BIND_FAST_PATH_SRC_N_DST (SKIP_ZERO_MASK, neon, add_8888_n_8888, uint32_t, 1, uint32_t, 1) PIXMAN_ARM_BIND_FAST_PATH_SRC_MASK_DST (neon, add_8_8_8, uint8_t, 1, uint8_t, 1, uint8_t, 1) PIXMAN_ARM_BIND_FAST_PATH_SRC_MASK_DST (neon, add_0565_8_0565, uint16_t, 1, uint8_t, 1, uint16_t, 1) +PIXMAN_ARM_BIND_FAST_PATH_SRC_MASK_DST (neon, add_8888_8_8888, + uint32_t, 1, uint8_t, 1, uint32_t, 1) PIXMAN_ARM_BIND_FAST_PATH_SRC_MASK_DST (neon, add_8888_8888_8888, uint32_t, 1, uint32_t, 1, uint32_t, 1) PIXMAN_ARM_BIND_FAST_PATH_SRC_MASK_DST (neon, over_8888_8_8888, @@ -235,6 +249,7 @@ static const pixman_fast_path_t arm_neon_fast_paths[] = PIXMAN_STD_FAST_PATH (SRC, b8g8r8, null, x8r8g8b8, neon_composite_src_0888_8888_rev), PIXMAN_STD_FAST_PATH (SRC, b8g8r8, null, r5g6b5, neon_composite_src_0888_0565_rev), PIXMAN_STD_FAST_PATH (SRC, pixbuf, pixbuf, a8r8g8b8, neon_composite_src_pixbuf_8888), + PIXMAN_STD_FAST_PATH (OVER, solid, a8, a8, neon_composite_over_n_8_8), PIXMAN_STD_FAST_PATH (OVER, solid, a8, r5g6b5, neon_composite_over_n_8_0565), PIXMAN_STD_FAST_PATH (OVER, solid, a8, b5g6r5, neon_composite_over_n_8_0565), PIXMAN_STD_FAST_PATH (OVER, solid, a8, a8r8g8b8, neon_composite_over_n_8_8888), @@ -250,6 +265,10 @@ static const pixman_fast_path_t arm_neon_fast_paths[] = PIXMAN_STD_FAST_PATH_CA (OVER, solid, a8b8g8r8, x8b8g8r8, neon_composite_over_n_8888_8888_ca), PIXMAN_STD_FAST_PATH (OVER, a8r8g8b8, solid, a8r8g8b8, neon_composite_over_8888_n_8888), PIXMAN_STD_FAST_PATH (OVER, a8r8g8b8, solid, x8r8g8b8, neon_composite_over_8888_n_8888), + PIXMAN_STD_FAST_PATH (OVER, a8r8g8b8, solid, r5g6b5, neon_composite_over_8888_n_0565), + PIXMAN_STD_FAST_PATH (OVER, a8b8g8r8, solid, b5g6r5, neon_composite_over_8888_n_0565), + PIXMAN_STD_FAST_PATH (OVER, r5g6b5, solid, r5g6b5, neon_composite_over_0565_n_0565), + PIXMAN_STD_FAST_PATH (OVER, b5g6r5, solid, b5g6r5, neon_composite_over_0565_n_0565), PIXMAN_STD_FAST_PATH (OVER, a8r8g8b8, a8, a8r8g8b8, neon_composite_over_8888_8_8888), PIXMAN_STD_FAST_PATH (OVER, a8r8g8b8, a8, x8r8g8b8, neon_composite_over_8888_8_8888), PIXMAN_STD_FAST_PATH (OVER, a8b8g8r8, a8, a8b8g8r8, neon_composite_over_8888_8_8888), @@ -268,13 +287,20 @@ static const pixman_fast_path_t arm_neon_fast_paths[] = PIXMAN_STD_FAST_PATH (OVER, x8r8g8b8, null, a8r8g8b8, neon_composite_src_x888_8888), PIXMAN_STD_FAST_PATH (OVER, x8b8g8r8, null, a8b8g8r8, neon_composite_src_x888_8888), PIXMAN_STD_FAST_PATH (ADD, solid, a8, a8, neon_composite_add_n_8_8), + PIXMAN_STD_FAST_PATH (ADD, solid, a8, a8r8g8b8, neon_composite_add_n_8_8888), + PIXMAN_STD_FAST_PATH (ADD, solid, a8, a8b8g8r8, neon_composite_add_n_8_8888), PIXMAN_STD_FAST_PATH (ADD, a8, a8, a8, neon_composite_add_8_8_8), PIXMAN_STD_FAST_PATH (ADD, r5g6b5, a8, r5g6b5, neon_composite_add_0565_8_0565), PIXMAN_STD_FAST_PATH (ADD, b5g6r5, a8, b5g6r5, neon_composite_add_0565_8_0565), + PIXMAN_STD_FAST_PATH (ADD, a8r8g8b8, a8, a8r8g8b8, neon_composite_add_8888_8_8888), + PIXMAN_STD_FAST_PATH (ADD, a8b8g8r8, a8, a8b8g8r8, neon_composite_add_8888_8_8888), PIXMAN_STD_FAST_PATH (ADD, a8r8g8b8, a8r8g8b8, a8r8g8b8, neon_composite_add_8888_8888_8888), + PIXMAN_STD_FAST_PATH (ADD, a8r8g8b8, solid, a8r8g8b8, neon_composite_add_8888_n_8888), + PIXMAN_STD_FAST_PATH (ADD, a8b8g8r8, solid, a8b8g8r8, neon_composite_add_8888_n_8888), PIXMAN_STD_FAST_PATH (ADD, a8, null, a8, neon_composite_add_8_8), PIXMAN_STD_FAST_PATH (ADD, a8r8g8b8, null, a8r8g8b8, neon_composite_add_8888_8888), PIXMAN_STD_FAST_PATH (ADD, a8b8g8r8, null, a8b8g8r8, neon_composite_add_8888_8888), + PIXMAN_STD_FAST_PATH (IN, solid, null, a8, neon_composite_in_n_8), PIXMAN_STD_FAST_PATH (OVER_REVERSE, solid, null, a8r8g8b8, neon_composite_over_reverse_n_8888), PIXMAN_STD_FAST_PATH (OVER_REVERSE, solid, null, a8b8g8r8, neon_composite_over_reverse_n_8888), PIXMAN_STD_FAST_PATH (OUT_REVERSE, a8, null, r5g6b5, neon_composite_out_reverse_8_0565), diff --git a/pixman/pixman/pixman-arm-simd.c b/pixman/pixman/pixman-arm-simd.c index 7f789ceab..e03dfe020 100644 --- a/pixman/pixman/pixman-arm-simd.c +++ b/pixman/pixman/pixman-arm-simd.c @@ -381,10 +381,10 @@ PIXMAN_ARM_BIND_FAST_PATH_SRC_DST (armv6, add_8_8, PIXMAN_ARM_BIND_FAST_PATH_SRC_DST (armv6, over_8888_8888, uint32_t, 1, uint32_t, 1) -PIXMAN_ARM_BIND_FAST_PATH_SRC_N_DST (armv6, over_8888_n_8888, +PIXMAN_ARM_BIND_FAST_PATH_SRC_N_DST (SKIP_ZERO_MASK, armv6, over_8888_n_8888, uint32_t, 1, uint32_t, 1) -PIXMAN_ARM_BIND_FAST_PATH_N_MASK_DST (armv6, over_n_8_8888, +PIXMAN_ARM_BIND_FAST_PATH_N_MASK_DST (SKIP_ZERO_SRC, armv6, over_n_8_8888, uint8_t, 1, uint32_t, 1) PIXMAN_ARM_BIND_SCALED_NEAREST_SRC_DST (armv6, 0565_0565, SRC, diff --git a/xorg-server/configure.ac b/xorg-server/configure.ac index 5546858cd..e3b9a865d 100644 --- a/xorg-server/configure.ac +++ b/xorg-server/configure.ac @@ -1335,7 +1335,7 @@ AC_DEFINE(BIGREQS, 1, [Support BigRequests extension]) if test "x$SPECIAL_DTRACE_OBJECTS" = "xyes" ; then DIX_LIB='$(top_builddir)/dix/dix.O' - OS_LIB='$(top_builddir)/os/os.O $(SHA1_LIBS)' + OS_LIB='$(top_builddir)/os/os.O $(SHA1_LIBS) $(DLOPEN_LIBS)' else DIX_LIB='$(top_builddir)/dix/libdix.la' OS_LIB='$(top_builddir)/os/libos.la' @@ -2122,7 +2122,7 @@ if test "$KDRIVE" = yes; then KDRIVE_STUB_LIB='$(top_builddir)/hw/kdrive/src/libkdrivestubs.la' KDRIVE_LOCAL_LIBS="$MAIN_LIB $DIX_LIB $KDRIVE_LIB $KDRIVE_STUB_LIB" KDRIVE_LOCAL_LIBS="$KDRIVE_LOCAL_LIBS $FB_LIB $MI_LIB $KDRIVE_PURE_LIBS" - KDRIVE_LOCAL_LIBS="$KDRIVE_LOCAL_LIBS $KDRIVE_OS_LIB $OS_LIB" + KDRIVE_LOCAL_LIBS="$KDRIVE_LOCAL_LIBS $KDRIVE_OS_LIB" KDRIVE_LIBS="$KDRIVE_LOCAL_LIBS $XSERVER_SYS_LIBS $GLX_SYS_LIBS $DLOPEN_LIBS $TSLIB_LIBS" AC_SUBST([XEPHYR_LIBS]) diff --git a/xorg-server/hw/dmx/glxProxy/glxcmds.c b/xorg-server/hw/dmx/glxProxy/glxcmds.c index 26ffad825..540fd00cd 100644 --- a/xorg-server/hw/dmx/glxProxy/glxcmds.c +++ b/xorg-server/hw/dmx/glxProxy/glxcmds.c @@ -1531,7 +1531,7 @@ int __glXGetVisualConfigs(__GLXclientState *cl, GLbyte *pc) int i, p; screen = req->screen; - if (screen > screenInfo.numScreens) { + if (screen >= screenInfo.numScreens) { /* The client library must send a valid screen number. */ client->errorValue = screen; return BadValue; @@ -2680,7 +2680,7 @@ int __glXGetFBConfigs(__GLXclientState *cl, GLbyte *pc) int numFBConfigs, i, p; __GLXscreenInfo *pGlxScreen; - if (screen > screenInfo.numScreens) { + if (screen >= screenInfo.numScreens) { /* The client library must send a valid screen number. */ client->errorValue = screen; return BadValue; @@ -3102,7 +3102,7 @@ int __glXCreatePbuffer(__GLXclientState *cl, GLbyte *pc) /* ** Look up screen and FBConfig. */ - if (screen > screenInfo.numScreens) { + if (screen >= screenInfo.numScreens) { /* The client library must send a valid screen number. */ client->errorValue = screen; return BadValue; diff --git a/xorg-server/hw/dmx/glxProxy/glxcmdsswap.c b/xorg-server/hw/dmx/glxProxy/glxcmdsswap.c index da5956952..ca41c1585 100644 --- a/xorg-server/hw/dmx/glxProxy/glxcmdsswap.c +++ b/xorg-server/hw/dmx/glxProxy/glxcmdsswap.c @@ -252,7 +252,7 @@ int __glXSwapGetVisualConfigs(__GLXclientState *cl, GLbyte *pc) __GLX_SWAP_INT(&req->screen); screen = req->screen; - if (screen > screenInfo.numScreens) { + if (screen >= screenInfo.numScreens) { /* The client library must send a valid screen number. */ client->errorValue = screen; return BadValue; diff --git a/xorg-server/hw/kdrive/ephyr/ephyrdriext.c b/xorg-server/hw/kdrive/ephyr/ephyrdriext.c index def7a39a8..6db06fca7 100644 --- a/xorg-server/hw/kdrive/ephyr/ephyrdriext.c +++ b/xorg-server/hw/kdrive/ephyr/ephyrdriext.c @@ -398,7 +398,7 @@ EphyrDuplicateVisual (unsigned int a_screen, int i=0 ; EPHYR_LOG ("enter\n") ; - if (a_screen > screenInfo.numScreens) { + if (a_screen >= screenInfo.numScreens) { EPHYR_LOG_ERROR ("bad screen number\n") ; goto out; } diff --git a/xorg-server/hw/xfree86/common/xf86str.h b/xorg-server/hw/xfree86/common/xf86str.h index 0b7685012..74ad759c5 100644 --- a/xorg-server/hw/xfree86/common/xf86str.h +++ b/xorg-server/hw/xfree86/common/xf86str.h @@ -498,7 +498,7 @@ typedef struct _confdrirec { /* These values should be adjusted when new fields are added to ScrnInfoRec */ #define NUM_RESERVED_INTS 16 #define NUM_RESERVED_POINTERS 14 -#define NUM_RESERVED_FUNCS 11 +#define NUM_RESERVED_FUNCS 10 typedef pointer (*funcPointer)(void); @@ -652,6 +652,7 @@ typedef Bool xf86PMEventProc (int, pmEvent, Bool); typedef void xf86DPMSSetProc (ScrnInfoPtr, int, int); typedef void xf86LoadPaletteProc (ScrnInfoPtr, int, int *, LOCO *, VisualPtr); typedef void xf86SetOverscanProc (ScrnInfoPtr, int); +typedef void xf86ModeSetProc (ScrnInfoPtr); /* @@ -802,6 +803,7 @@ typedef struct _ScrnInfoRec { xf86LoadPaletteProc *LoadPalette; xf86SetOverscanProc *SetOverscan; xorgDriverFuncProc *DriverFunc; + xf86ModeSetProc *ModeSet; /* * This can be used when the minor ABI version is incremented. diff --git a/xorg-server/hw/xfree86/common/xf86xv.c b/xorg-server/hw/xfree86/common/xf86xv.c index 74e76f923..9f62a8397 100644 --- a/xorg-server/hw/xfree86/common/xf86xv.c +++ b/xorg-server/hw/xfree86/common/xf86xv.c @@ -104,6 +104,7 @@ static void xf86XVClipNotify(WindowPtr pWin, int dx, int dy); static Bool xf86XVEnterVT(int, int); static void xf86XVLeaveVT(int, int); static void xf86XVAdjustFrame(int index, int x, int y, int flags); +static void xf86XVModeSet(ScrnInfoPtr pScrn); /* misc */ @@ -287,6 +288,7 @@ xf86XVScreenInit( ScreenPriv->EnterVT = pScrn->EnterVT; ScreenPriv->LeaveVT = pScrn->LeaveVT; ScreenPriv->AdjustFrame = pScrn->AdjustFrame; + ScreenPriv->ModeSet = pScrn->ModeSet; pScreen->DestroyWindow = xf86XVDestroyWindow; pScreen->WindowExposures = xf86XVWindowExposures; @@ -295,6 +297,7 @@ xf86XVScreenInit( pScrn->LeaveVT = xf86XVLeaveVT; if(pScrn->AdjustFrame) pScrn->AdjustFrame = xf86XVAdjustFrame; + pScrn->ModeSet = xf86XVModeSet; if(!xf86XVInitAdaptors(pScreen, adaptors, num)) return FALSE; @@ -556,7 +559,7 @@ xf86XVInitAdaptors( adaptorPriv->QueryBestSize = adaptorPtr->QueryBestSize; adaptorPriv->QueryImageAttributes = adaptorPtr->QueryImageAttributes; adaptorPriv->PutImage = adaptorPtr->PutImage; - adaptorPriv->ReputImage = adaptorPtr->ReputImage; + adaptorPriv->ReputImage = adaptorPtr->ReputImage; /* image/still */ pa->devPriv.ptr = (pointer)adaptorPriv; @@ -661,8 +664,7 @@ xf86XVUpdateCompositeClip(XvPortRecPrivatePtr portPriv) pCompositeClip = RegionCreate(NullBox, 1); RegionCopy(pCompositeClip, portPriv->clientClip); RegionTranslate(pCompositeClip, - portPriv->pDraw->x + portPriv->clipOrg.x, - portPriv->pDraw->y + portPriv->clipOrg.y); + portPriv->pDraw->x, portPriv->pDraw->y); RegionIntersect(pCompositeClip, pregWin, pCompositeClip); portPriv->pCompositeClip = pCompositeClip; @@ -687,6 +689,8 @@ xf86XVCopyClip( portPriv->clientClip = RegionCreate(NullBox, 1); /* Note: this is in window coordinates */ RegionCopy(portPriv->clientClip, pGC->clientClip); + RegionTranslate(portPriv->clientClip, + pGC->clipOrg.x, pGC->clipOrg.y); } else if(portPriv->clientClip) { /* free the old clientClip */ RegionDestroy(portPriv->clientClip); portPriv->clientClip = NULL; @@ -697,7 +701,27 @@ xf86XVCopyClip( RegionDestroy(portPriv->pCompositeClip); } - portPriv->clipOrg = pGC->clipOrg; + portPriv->pCompositeClip = pGC->pCompositeClip; + portPriv->FreeCompositeClip = FALSE; + portPriv->subWindowMode = pGC->subWindowMode; +} + +static void +xf86XVCopyCompositeClip(XvPortRecPrivatePtr portPriv, + GCPtr pGC, + DrawablePtr pDraw) +{ + if (!portPriv->clientClip) + portPriv->clientClip = RegionCreate(NullBox, 1); + /* Keep the original GC composite clip around for ReputImage */ + RegionCopy(portPriv->clientClip, pGC->pCompositeClip); + RegionTranslate(portPriv->clientClip, + -pDraw->x, -pDraw->y); + + /* get rid of the old clip list */ + if (portPriv->pCompositeClip && portPriv->FreeCompositeClip) + RegionDestroy(portPriv->pCompositeClip); + portPriv->pCompositeClip = pGC->pCompositeClip; portPriv->FreeCompositeClip = FALSE; portPriv->subWindowMode = pGC->subWindowMode; @@ -852,6 +876,7 @@ CLIP_VIDEO_BAILOUT: return ret; } +/* Reput image/still */ static int xf86XVReputImage(XvPortRecPrivatePtr portPriv) { @@ -863,6 +888,11 @@ xf86XVReputImage(XvPortRecPrivatePtr portPriv) xf86XVUpdateCompositeClip(portPriv); + /* the clip can get smaller over time */ + RegionCopy(portPriv->clientClip, portPriv->pCompositeClip); + RegionTranslate(portPriv->clientClip, + -portPriv->pDraw->x, -portPriv->pDraw->y); + /* translate the video region to the screen */ WinBox.x1 = portPriv->pDraw->x + portPriv->drw_x; WinBox.y1 = portPriv->pDraw->y + portPriv->drw_y; @@ -912,7 +942,10 @@ xf86XVReputImage(XvPortRecPrivatePtr portPriv) } ret = (*portPriv->AdaptorRec->ReputImage)(portPriv->pScrn, + portPriv->vid_x, portPriv->vid_y, WinBox.x1, WinBox.y1, + portPriv->vid_w, portPriv->vid_h, + portPriv->drw_w, portPriv->drw_h, &ClipRegion, portPriv->DevPriv.ptr, portPriv->pDraw); @@ -1004,6 +1037,71 @@ xf86XVRemovePortFromWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv) portPriv->pDraw = NULL; } +static void +xf86XVReputOrStopPort(XvPortRecPrivatePtr pPriv, + WindowPtr pWin, + Bool visible) +{ + if (!visible) { + if (pPriv->isOn == XV_ON) { + (*pPriv->AdaptorRec->StopVideo)(pPriv->pScrn, pPriv->DevPriv.ptr, FALSE); + pPriv->isOn = XV_PENDING; + } + + if (!pPriv->type) /* overlaid still/image*/ + xf86XVRemovePortFromWindow(pWin, pPriv); + + return; + } + + switch (pPriv->type) { + case XvInputMask: + xf86XVReputVideo(pPriv); + break; + case XvOutputMask: + xf86XVRegetVideo(pPriv); + break; + default: /* overlaid still/image*/ + if (pPriv->AdaptorRec->ReputImage) + xf86XVReputImage(pPriv); + break; + } +} + +static void +xf86XVReputOrStopAllPorts(ScrnInfoPtr pScrn) +{ + ScreenPtr pScreen = pScrn->pScreen; + XvScreenPtr pxvs = GET_XV_SCREEN(pScreen); + XvAdaptorPtr pa; + int c, i; + + for (c = pxvs->nAdaptors, pa = pxvs->pAdaptors; c > 0; c--, pa++) { + XvPortPtr pPort = pa->pPorts; + + for (i = pa->nPorts; i > 0; i--, pPort++) { + XvPortRecPrivatePtr pPriv = (XvPortRecPrivatePtr)pPort->devPriv.ptr; + WindowPtr pWin = (WindowPtr)pPriv->pDraw; + Bool visible; + + if (pPriv->isOn == XV_OFF || !pWin) + continue; + + visible = pWin->visibility == VisibilityUnobscured || + pWin->visibility == VisibilityPartiallyObscured; + + /* + * Stop and remove still/images if + * ReputImage isn't supported. + */ + if (!pPriv->type && !pPriv->AdaptorRec->ReputImage) + visible = FALSE; + + xf86XVReputOrStopPort(pPriv, pWin, visible); + } + } +} + /**** ScreenRec fields ****/ static Bool @@ -1048,7 +1146,6 @@ xf86XVWindowExposures(WindowPtr pWin, RegionPtr reg1, RegionPtr reg2) ScreenPtr pScreen = pWin->drawable.pScreen; XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen); XF86XVWindowPtr WinPriv = GET_XF86XV_WINDOW(pWin); - XF86XVWindowPtr pPrev; XvPortRecPrivatePtr pPriv; Bool AreasExposed; @@ -1061,47 +1158,20 @@ xf86XVWindowExposures(WindowPtr pWin, RegionPtr reg1, RegionPtr reg2) /* filter out XClearWindow/Area */ if (!pWin->valdata) return; - pPrev = NULL; - while(WinPriv) { - pPriv = WinPriv->PortRec; - - /* Reput anyone with a reput function */ + Bool visible = TRUE; - switch(pPriv->type) { - case XvInputMask: - xf86XVReputVideo(pPriv); - break; - case XvOutputMask: - xf86XVRegetVideo(pPriv); - break; - default: /* overlaid still/image*/ - if (pPriv->AdaptorRec->ReputImage) - xf86XVReputImage(pPriv); - else if(AreasExposed) { - XF86XVWindowPtr tmp; + pPriv = WinPriv->PortRec; - if (pPriv->isOn == XV_ON) { - (*pPriv->AdaptorRec->StopVideo)( - pPriv->pScrn, pPriv->DevPriv.ptr, FALSE); - pPriv->isOn = XV_PENDING; - } - pPriv->pDraw = NULL; + /* + * Stop and remove still/images if areas were exposed and + * ReputImage isn't supported. + */ + if (!pPriv->type && !pPriv->AdaptorRec->ReputImage) + visible = !AreasExposed; - if(!pPrev) - dixSetPrivate(&pWin->devPrivates, XF86XVWindowKey, - WinPriv->next); - else - pPrev->next = WinPriv->next; - tmp = WinPriv; - WinPriv = WinPriv->next; - free(tmp); - continue; - } - break; - } - pPrev = WinPriv; WinPriv = WinPriv->next; + xf86XVReputOrStopPort(pPriv, pWin, visible); } } @@ -1112,16 +1182,14 @@ xf86XVClipNotify(WindowPtr pWin, int dx, int dy) ScreenPtr pScreen = pWin->drawable.pScreen; XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen); XF86XVWindowPtr WinPriv = GET_XF86XV_WINDOW(pWin); - XF86XVWindowPtr tmp, pPrev = NULL; XvPortRecPrivatePtr pPriv; - Bool visible = (pWin->visibility == VisibilityUnobscured) || - (pWin->visibility == VisibilityPartiallyObscured); while(WinPriv) { + Bool visible = pWin->visibility == VisibilityUnobscured || + pWin->visibility == VisibilityPartiallyObscured; + pPriv = WinPriv->PortRec; - if(!pPriv) goto next; - if(pPriv->pCompositeClip && pPriv->FreeCompositeClip) RegionDestroy(pPriv->pCompositeClip); @@ -1131,34 +1199,15 @@ xf86XVClipNotify(WindowPtr pWin, int dx, int dy) (*pPriv->AdaptorRec->ClipNotify)(pPriv->pScrn, pPriv->DevPriv.ptr, pWin, dx, dy); - /* Stop everything except images, but stop them too if the - window isn't visible. But we only remove the images. */ - - if(pPriv->type || !visible) { - if(pPriv->isOn == XV_ON) { - (*pPriv->AdaptorRec->StopVideo)( - pPriv->pScrn, pPriv->DevPriv.ptr, FALSE); - pPriv->isOn = XV_PENDING; - } - - if(!pPriv->type) { /* overlaid still/image */ - pPriv->pDraw = NULL; - - if(!pPrev) - dixSetPrivate(&pWin->devPrivates, XF86XVWindowKey, - WinPriv->next); - else - pPrev->next = WinPriv->next; - tmp = WinPriv; - WinPriv = WinPriv->next; - free(tmp); - continue; - } - } + /* + * Stop and remove still/images if + * ReputImage isn't supported. + */ + if (!pPriv->type && !pPriv->AdaptorRec->ReputImage) + visible = FALSE; -next: - pPrev = WinPriv; WinPriv = WinPriv->next; + xf86XVReputOrStopPort(pPriv, pWin, visible); } if(ScreenPriv->ClipNotify) { @@ -1195,6 +1244,7 @@ xf86XVCloseScreen(int i, ScreenPtr pScreen) pScrn->EnterVT = ScreenPriv->EnterVT; pScrn->LeaveVT = ScreenPriv->LeaveVT; pScrn->AdjustFrame = ScreenPriv->AdjustFrame; + pScrn->ModeSet = ScreenPriv->ModeSet; for(c = 0, pa = pxvs->pAdaptors; c < pxvs->nAdaptors; c++, pa++) { xf86XVFreeAdaptor(pa); @@ -1287,11 +1337,7 @@ xf86XVAdjustFrame(int index, int x, int y, int flags) { ScrnInfoPtr pScrn = xf86Screens[index]; ScreenPtr pScreen = pScrn->pScreen; - XvScreenPtr pxvs = GET_XV_SCREEN(pScreen); XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen); - WindowPtr pWin; - XvAdaptorPtr pa; - int c, i; if(ScreenPriv->AdjustFrame) { pScrn->AdjustFrame = ScreenPriv->AdjustFrame; @@ -1299,40 +1345,30 @@ xf86XVAdjustFrame(int index, int x, int y, int flags) pScrn->AdjustFrame = xf86XVAdjustFrame; } - for(c = pxvs->nAdaptors, pa = pxvs->pAdaptors; c > 0; c--, pa++) { - XvPortPtr pPort = pa->pPorts; - XvPortRecPrivatePtr pPriv; - - for(i = pa->nPorts; i > 0; i--, pPort++) { - pPriv = (XvPortRecPrivatePtr)pPort->devPriv.ptr; + xf86XVReputOrStopAllPorts(pScrn); +} - if(!pPriv->type && (pPriv->isOn != XV_OFF)) { /* overlaid still/image */ +static void +xf86XVModeSet(ScrnInfoPtr pScrn) +{ + ScreenPtr pScreen = pScrn->pScreen; + XF86XVScreenPtr ScreenPriv; - if(pPriv->pCompositeClip && pPriv->FreeCompositeClip) - RegionDestroy(pPriv->pCompositeClip); + /* Can be called before pScrn->pScreen is set */ + if (!pScreen) + return; - pPriv->pCompositeClip = NULL; + ScreenPriv = GET_XF86XV_SCREEN(pScreen); - pWin = (WindowPtr)pPriv->pDraw; + if (ScreenPriv->ModeSet) { + pScrn->ModeSet = ScreenPriv->ModeSet; + (*pScrn->ModeSet)(pScrn); + pScrn->ModeSet = xf86XVModeSet; + } - if ((pPriv->AdaptorRec->ReputImage) && - ((pWin->visibility == VisibilityUnobscured) || - (pWin->visibility == VisibilityPartiallyObscured))) - { - xf86XVReputImage(pPriv); - } else if (pPriv->isOn == XV_ON) { - (*pPriv->AdaptorRec->StopVideo)( - pPriv->pScrn, pPriv->DevPriv.ptr, FALSE); - xf86XVRemovePortFromWindow(pWin, pPriv); - pPriv->isOn = XV_PENDING; - continue; - } - } - } - } + xf86XVReputOrStopAllPorts(pScrn); } - /**** XvAdaptorRec fields ****/ static int @@ -1429,6 +1465,8 @@ xf86XVPutStill( WinBox.x2 = WinBox.x1 + drw_w; WinBox.y2 = WinBox.y1 + drw_h; + xf86XVCopyCompositeClip(portPriv, pGC, pDraw); + RegionInit(&WinRegion, &WinBox, 1); RegionNull(&ClipRegion); RegionIntersect(&ClipRegion, &WinRegion, pGC->pCompositeClip); @@ -1482,6 +1520,8 @@ xf86XVPutStill( xf86XVEnlistPortInWindow((WindowPtr)pDraw, portPriv); portPriv->isOn = XV_ON; + portPriv->vid_x = vid_x; portPriv->vid_y = vid_y; + portPriv->vid_w = vid_w; portPriv->vid_h = vid_h; portPriv->drw_x = drw_x; portPriv->drw_y = drw_y; portPriv->drw_w = drw_w; portPriv->drw_h = drw_h; portPriv->type = 0; /* no mask means it's transient and should @@ -1497,6 +1537,10 @@ PUT_STILL_BAILOUT: portPriv->isOn = XV_PENDING; } + /* This clip was copied and only good for one shot */ + if(!portPriv->FreeCompositeClip) + portPriv->pCompositeClip = NULL; + RegionUninit(&WinRegion); RegionUninit(&ClipRegion); @@ -1718,6 +1762,8 @@ xf86XVPutImage( if(!portPriv->pScrn->vtSema) return Success; /* Success ? */ + xf86XVCopyCompositeClip(portPriv, pGC, pDraw); + WinBox.x1 = pDraw->x + drw_x; WinBox.y1 = pDraw->y + drw_y; WinBox.x2 = WinBox.x1 + drw_w; @@ -1779,6 +1825,8 @@ xf86XVPutImage( (portPriv->AdaptorRec->flags & VIDEO_OVERLAID_IMAGES)) { portPriv->isOn = XV_ON; + portPriv->vid_x = src_x; portPriv->vid_y = src_y; + portPriv->vid_w = src_w; portPriv->vid_h = src_h; portPriv->drw_x = drw_x; portPriv->drw_y = drw_y; portPriv->drw_w = drw_w; portPriv->drw_h = drw_h; portPriv->type = 0; /* no mask means it's transient and should @@ -1794,6 +1842,10 @@ PUT_IMAGE_BAILOUT: portPriv->isOn = XV_PENDING; } + /* This clip was copied and only good for one shot */ + if(!portPriv->FreeCompositeClip) + portPriv->pCompositeClip = NULL; + RegionUninit(&WinRegion); RegionUninit(&ClipRegion); diff --git a/xorg-server/hw/xfree86/common/xf86xv.h b/xorg-server/hw/xfree86/common/xf86xv.h index c3db6cc73..25f3e4ad3 100644 --- a/xorg-server/hw/xfree86/common/xf86xv.h +++ b/xorg-server/hw/xfree86/common/xf86xv.h @@ -1,280 +1,286 @@ - -/* - * Copyright (c) 1998-2003 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). - */ - -#ifndef _XF86XV_H_ -#define _XF86XV_H_ - -#include "xvdix.h" -#include "xf86str.h" - -#define VIDEO_NO_CLIPPING 0x00000001 -#define VIDEO_INVERT_CLIPLIST 0x00000002 -#define VIDEO_OVERLAID_IMAGES 0x00000004 -#define VIDEO_OVERLAID_STILLS 0x00000008 -#define VIDEO_CLIP_TO_VIEWPORT 0x00000010 - -typedef struct { - int id; - int type; - int byte_order; - unsigned char guid[16]; - int bits_per_pixel; - int format; - int num_planes; - - /* for RGB formats only */ - int depth; - unsigned int red_mask; - unsigned int green_mask; - unsigned int blue_mask; - - /* for YUV formats only */ - unsigned int y_sample_bits; - unsigned int u_sample_bits; - unsigned int v_sample_bits; - unsigned int horz_y_period; - unsigned int horz_u_period; - unsigned int horz_v_period; - unsigned int vert_y_period; - unsigned int vert_u_period; - unsigned int vert_v_period; - char component_order[32]; - int scanline_order; -} XF86ImageRec, *XF86ImagePtr; - - -typedef struct { - ScrnInfoPtr pScrn; - int id; - unsigned short width, height; - int *pitches; /* bytes */ - int *offsets; /* in bytes from start of framebuffer */ - DevUnion devPrivate; -} XF86SurfaceRec, *XF86SurfacePtr; - - -typedef int (* PutVideoFuncPtr)( ScrnInfoPtr pScrn, - short vid_x, short vid_y, short drw_x, short drw_y, - short vid_w, short vid_h, short drw_w, short drw_h, - RegionPtr clipBoxes, pointer data, DrawablePtr pDraw ); -typedef int (* PutStillFuncPtr)( ScrnInfoPtr pScrn, - short vid_x, short vid_y, short drw_x, short drw_y, - short vid_w, short vid_h, short drw_w, short drw_h, - RegionPtr clipBoxes, pointer data, DrawablePtr pDraw ); -typedef int (* GetVideoFuncPtr)( ScrnInfoPtr pScrn, - short vid_x, short vid_y, short drw_x, short drw_y, - short vid_w, short vid_h, short drw_w, short drw_h, - RegionPtr clipBoxes, pointer data, DrawablePtr pDraw ); -typedef int (* GetStillFuncPtr)( ScrnInfoPtr pScrn, - short vid_x, short vid_y, short drw_x, short drw_y, - short vid_w, short vid_h, short drw_w, short drw_h, - RegionPtr clipBoxes, pointer data, DrawablePtr pDraw ); -typedef void (* StopVideoFuncPtr)(ScrnInfoPtr pScrn, pointer data, Bool Exit); -typedef int (* SetPortAttributeFuncPtr)(ScrnInfoPtr pScrn, Atom attribute, - INT32 value, pointer data); -typedef int (* GetPortAttributeFuncPtr)(ScrnInfoPtr pScrn, Atom attribute, - INT32 *value, pointer data); -typedef void (* QueryBestSizeFuncPtr)(ScrnInfoPtr pScrn, Bool motion, - short vid_w, short vid_h, short drw_w, short drw_h, - unsigned int *p_w, unsigned int *p_h, pointer data); -typedef int (* PutImageFuncPtr)( ScrnInfoPtr pScrn, - short src_x, short src_y, short drw_x, short drw_y, - short src_w, short src_h, short drw_w, short drw_h, - int image, unsigned char* buf, short width, short height, Bool Sync, - RegionPtr clipBoxes, pointer data, DrawablePtr pDraw ); -typedef int (* ReputImageFuncPtr)( ScrnInfoPtr pScrn, short drw_x, short drw_y, - RegionPtr clipBoxes, pointer data, DrawablePtr pDraw ); -typedef int (*QueryImageAttributesFuncPtr)(ScrnInfoPtr pScrn, - int image, unsigned short *width, unsigned short *height, - int *pitches, int *offsets); -typedef void (*ClipNotifyFuncPtr)(ScrnInfoPtr pScrn, pointer data, - WindowPtr window, int dx, int dy); - -typedef enum { - XV_OFF, - XV_PENDING, - XV_ON -} XvStatus; - -/*** this is what the driver needs to fill out ***/ - -typedef struct { - int id; - char *name; - unsigned short width, height; - XvRationalRec rate; -} XF86VideoEncodingRec, *XF86VideoEncodingPtr; - -typedef struct { - char depth; - short class; -} XF86VideoFormatRec, *XF86VideoFormatPtr; - -typedef struct { - int flags; - int min_value; - int max_value; - char *name; -} XF86AttributeRec, *XF86AttributePtr; - -typedef struct { - unsigned int type; - int flags; - char *name; - int nEncodings; - XF86VideoEncodingPtr pEncodings; - int nFormats; - XF86VideoFormatPtr pFormats; - int nPorts; - DevUnion *pPortPrivates; - int nAttributes; - XF86AttributePtr pAttributes; - int nImages; - XF86ImagePtr pImages; - PutVideoFuncPtr PutVideo; - PutStillFuncPtr PutStill; - GetVideoFuncPtr GetVideo; - GetStillFuncPtr GetStill; - StopVideoFuncPtr StopVideo; - SetPortAttributeFuncPtr SetPortAttribute; - GetPortAttributeFuncPtr GetPortAttribute; - QueryBestSizeFuncPtr QueryBestSize; - PutImageFuncPtr PutImage; - ReputImageFuncPtr ReputImage; - QueryImageAttributesFuncPtr QueryImageAttributes; - ClipNotifyFuncPtr ClipNotify; -} XF86VideoAdaptorRec, *XF86VideoAdaptorPtr; - -typedef struct { - XF86ImagePtr image; - int flags; - int (*alloc_surface)(ScrnInfoPtr pScrn, - int id, - unsigned short width, - unsigned short height, - XF86SurfacePtr surface); - int (*free_surface)(XF86SurfacePtr surface); - int (*display) (XF86SurfacePtr surface, - short vid_x, short vid_y, - short drw_x, short drw_y, - short vid_w, short vid_h, - short drw_w, short drw_h, - RegionPtr clipBoxes); - int (*stop) (XF86SurfacePtr surface); - int (*getAttribute) (ScrnInfoPtr pScrn, Atom attr, INT32 *value); - int (*setAttribute) (ScrnInfoPtr pScrn, Atom attr, INT32 value); - int max_width; - int max_height; - int num_attributes; - XF86AttributePtr attributes; -} XF86OffscreenImageRec, *XF86OffscreenImagePtr; - -extern _X_EXPORT Bool -xf86XVScreenInit( - ScreenPtr pScreen, - XF86VideoAdaptorPtr *Adaptors, - int num -); - -typedef int (* xf86XVInitGenericAdaptorPtr)(ScrnInfoPtr pScrn, - XF86VideoAdaptorPtr **Adaptors); - -extern _X_EXPORT int -xf86XVRegisterGenericAdaptorDriver( - xf86XVInitGenericAdaptorPtr InitFunc -); - -extern _X_EXPORT int -xf86XVListGenericAdaptors( - ScrnInfoPtr pScrn, - XF86VideoAdaptorPtr **Adaptors -); - -extern _X_EXPORT Bool -xf86XVRegisterOffscreenImages( - ScreenPtr pScreen, - XF86OffscreenImagePtr images, - int num -); - -extern _X_EXPORT XF86OffscreenImagePtr -xf86XVQueryOffscreenImages( - ScreenPtr pScreen, - int *num -); - -extern _X_EXPORT XF86VideoAdaptorPtr xf86XVAllocateVideoAdaptorRec(ScrnInfoPtr pScrn); - -extern _X_EXPORT void xf86XVFreeVideoAdaptorRec(XF86VideoAdaptorPtr ptr); - -extern _X_EXPORT void -xf86XVFillKeyHelper (ScreenPtr pScreen, CARD32 key, RegionPtr clipboxes); - -extern _X_EXPORT void -xf86XVFillKeyHelperDrawable (DrawablePtr pDraw, CARD32 key, RegionPtr clipboxes); - -extern _X_EXPORT Bool -xf86XVClipVideoHelper( - BoxPtr dst, - INT32 *xa, - INT32 *xb, - INT32 *ya, - INT32 *yb, - RegionPtr reg, - INT32 width, - INT32 height -); - -extern _X_EXPORT void -xf86XVCopyYUV12ToPacked( - const void *srcy, - const void *srcv, - const void *srcu, - void *dst, - int srcPitchy, - int srcPitchuv, - int dstPitch, - int h, - int w -); - -extern _X_EXPORT void -xf86XVCopyPacked( - const void *src, - void *dst, - int srcPitch, - int dstPitch, - int h, - int w -); - -extern _X_EXPORT DevPrivateKey (*XvGetScreenKeyProc)(void); -extern _X_EXPORT unsigned long (*XvGetRTPortProc)(void); -extern _X_EXPORT int (*XvScreenInitProc)(ScreenPtr); - -#endif /* _XF86XV_H_ */ + +/* + * Copyright (c) 1998-2003 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). + */ + +#ifndef _XF86XV_H_ +#define _XF86XV_H_ + +#include "xvdix.h" +#include "xf86str.h" + +#define VIDEO_NO_CLIPPING 0x00000001 +#define VIDEO_INVERT_CLIPLIST 0x00000002 +#define VIDEO_OVERLAID_IMAGES 0x00000004 +#define VIDEO_OVERLAID_STILLS 0x00000008 +/* + * Usage of VIDEO_CLIP_TO_VIEWPORT is not recommended. + * It can make reput behaviour inconsistent. + */ +#define VIDEO_CLIP_TO_VIEWPORT 0x00000010 + +typedef struct { + int id; + int type; + int byte_order; + unsigned char guid[16]; + int bits_per_pixel; + int format; + int num_planes; + + /* for RGB formats only */ + int depth; + unsigned int red_mask; + unsigned int green_mask; + unsigned int blue_mask; + + /* for YUV formats only */ + unsigned int y_sample_bits; + unsigned int u_sample_bits; + unsigned int v_sample_bits; + unsigned int horz_y_period; + unsigned int horz_u_period; + unsigned int horz_v_period; + unsigned int vert_y_period; + unsigned int vert_u_period; + unsigned int vert_v_period; + char component_order[32]; + int scanline_order; +} XF86ImageRec, *XF86ImagePtr; + + +typedef struct { + ScrnInfoPtr pScrn; + int id; + unsigned short width, height; + int *pitches; /* bytes */ + int *offsets; /* in bytes from start of framebuffer */ + DevUnion devPrivate; +} XF86SurfaceRec, *XF86SurfacePtr; + + +typedef int (* PutVideoFuncPtr)( ScrnInfoPtr pScrn, + short vid_x, short vid_y, short drw_x, short drw_y, + short vid_w, short vid_h, short drw_w, short drw_h, + RegionPtr clipBoxes, pointer data, DrawablePtr pDraw ); +typedef int (* PutStillFuncPtr)( ScrnInfoPtr pScrn, + short vid_x, short vid_y, short drw_x, short drw_y, + short vid_w, short vid_h, short drw_w, short drw_h, + RegionPtr clipBoxes, pointer data, DrawablePtr pDraw ); +typedef int (* GetVideoFuncPtr)( ScrnInfoPtr pScrn, + short vid_x, short vid_y, short drw_x, short drw_y, + short vid_w, short vid_h, short drw_w, short drw_h, + RegionPtr clipBoxes, pointer data, DrawablePtr pDraw ); +typedef int (* GetStillFuncPtr)( ScrnInfoPtr pScrn, + short vid_x, short vid_y, short drw_x, short drw_y, + short vid_w, short vid_h, short drw_w, short drw_h, + RegionPtr clipBoxes, pointer data, DrawablePtr pDraw ); +typedef void (* StopVideoFuncPtr)(ScrnInfoPtr pScrn, pointer data, Bool Exit); +typedef int (* SetPortAttributeFuncPtr)(ScrnInfoPtr pScrn, Atom attribute, + INT32 value, pointer data); +typedef int (* GetPortAttributeFuncPtr)(ScrnInfoPtr pScrn, Atom attribute, + INT32 *value, pointer data); +typedef void (* QueryBestSizeFuncPtr)(ScrnInfoPtr pScrn, Bool motion, + short vid_w, short vid_h, short drw_w, short drw_h, + unsigned int *p_w, unsigned int *p_h, pointer data); +typedef int (* PutImageFuncPtr)( ScrnInfoPtr pScrn, + short src_x, short src_y, short drw_x, short drw_y, + short src_w, short src_h, short drw_w, short drw_h, + int image, unsigned char* buf, short width, short height, Bool Sync, + RegionPtr clipBoxes, pointer data, DrawablePtr pDraw ); +typedef int (* ReputImageFuncPtr)( ScrnInfoPtr pScrn, + short src_x, short src_y, short drw_x, short drw_y, + short src_w, short src_h, short drw_w, short drw_h, + RegionPtr clipBoxes, pointer data, DrawablePtr pDraw ); +typedef int (*QueryImageAttributesFuncPtr)(ScrnInfoPtr pScrn, + int image, unsigned short *width, unsigned short *height, + int *pitches, int *offsets); +typedef void (*ClipNotifyFuncPtr)(ScrnInfoPtr pScrn, pointer data, + WindowPtr window, int dx, int dy); + +typedef enum { + XV_OFF, + XV_PENDING, + XV_ON +} XvStatus; + +/*** this is what the driver needs to fill out ***/ + +typedef struct { + int id; + char *name; + unsigned short width, height; + XvRationalRec rate; +} XF86VideoEncodingRec, *XF86VideoEncodingPtr; + +typedef struct { + char depth; + short class; +} XF86VideoFormatRec, *XF86VideoFormatPtr; + +typedef struct { + int flags; + int min_value; + int max_value; + char *name; +} XF86AttributeRec, *XF86AttributePtr; + +typedef struct { + unsigned int type; + int flags; + char *name; + int nEncodings; + XF86VideoEncodingPtr pEncodings; + int nFormats; + XF86VideoFormatPtr pFormats; + int nPorts; + DevUnion *pPortPrivates; + int nAttributes; + XF86AttributePtr pAttributes; + int nImages; + XF86ImagePtr pImages; + PutVideoFuncPtr PutVideo; + PutStillFuncPtr PutStill; + GetVideoFuncPtr GetVideo; + GetStillFuncPtr GetStill; + StopVideoFuncPtr StopVideo; + SetPortAttributeFuncPtr SetPortAttribute; + GetPortAttributeFuncPtr GetPortAttribute; + QueryBestSizeFuncPtr QueryBestSize; + PutImageFuncPtr PutImage; + ReputImageFuncPtr ReputImage; /* image/still */ + QueryImageAttributesFuncPtr QueryImageAttributes; + ClipNotifyFuncPtr ClipNotify; +} XF86VideoAdaptorRec, *XF86VideoAdaptorPtr; + +typedef struct { + XF86ImagePtr image; + int flags; + int (*alloc_surface)(ScrnInfoPtr pScrn, + int id, + unsigned short width, + unsigned short height, + XF86SurfacePtr surface); + int (*free_surface)(XF86SurfacePtr surface); + int (*display) (XF86SurfacePtr surface, + short vid_x, short vid_y, + short drw_x, short drw_y, + short vid_w, short vid_h, + short drw_w, short drw_h, + RegionPtr clipBoxes); + int (*stop) (XF86SurfacePtr surface); + int (*getAttribute) (ScrnInfoPtr pScrn, Atom attr, INT32 *value); + int (*setAttribute) (ScrnInfoPtr pScrn, Atom attr, INT32 value); + int max_width; + int max_height; + int num_attributes; + XF86AttributePtr attributes; +} XF86OffscreenImageRec, *XF86OffscreenImagePtr; + +extern _X_EXPORT Bool +xf86XVScreenInit( + ScreenPtr pScreen, + XF86VideoAdaptorPtr *Adaptors, + int num +); + +typedef int (* xf86XVInitGenericAdaptorPtr)(ScrnInfoPtr pScrn, + XF86VideoAdaptorPtr **Adaptors); + +extern _X_EXPORT int +xf86XVRegisterGenericAdaptorDriver( + xf86XVInitGenericAdaptorPtr InitFunc +); + +extern _X_EXPORT int +xf86XVListGenericAdaptors( + ScrnInfoPtr pScrn, + XF86VideoAdaptorPtr **Adaptors +); + +extern _X_EXPORT Bool +xf86XVRegisterOffscreenImages( + ScreenPtr pScreen, + XF86OffscreenImagePtr images, + int num +); + +extern _X_EXPORT XF86OffscreenImagePtr +xf86XVQueryOffscreenImages( + ScreenPtr pScreen, + int *num +); + +extern _X_EXPORT XF86VideoAdaptorPtr xf86XVAllocateVideoAdaptorRec(ScrnInfoPtr pScrn); + +extern _X_EXPORT void xf86XVFreeVideoAdaptorRec(XF86VideoAdaptorPtr ptr); + +extern _X_EXPORT void +xf86XVFillKeyHelper (ScreenPtr pScreen, CARD32 key, RegionPtr clipboxes); + +extern _X_EXPORT void +xf86XVFillKeyHelperDrawable (DrawablePtr pDraw, CARD32 key, RegionPtr clipboxes); + +extern _X_EXPORT Bool +xf86XVClipVideoHelper( + BoxPtr dst, + INT32 *xa, + INT32 *xb, + INT32 *ya, + INT32 *yb, + RegionPtr reg, + INT32 width, + INT32 height +); + +extern _X_EXPORT void +xf86XVCopyYUV12ToPacked( + const void *srcy, + const void *srcv, + const void *srcu, + void *dst, + int srcPitchy, + int srcPitchuv, + int dstPitch, + int h, + int w +); + +extern _X_EXPORT void +xf86XVCopyPacked( + const void *src, + void *dst, + int srcPitch, + int dstPitch, + int h, + int w +); + +extern _X_EXPORT DevPrivateKey (*XvGetScreenKeyProc)(void); +extern _X_EXPORT unsigned long (*XvGetRTPortProc)(void); +extern _X_EXPORT int (*XvScreenInitProc)(ScreenPtr); + +#endif /* _XF86XV_H_ */ diff --git a/xorg-server/hw/xfree86/common/xf86xvpriv.h b/xorg-server/hw/xfree86/common/xf86xvpriv.h index 7623d297d..35d72ca9c 100644 --- a/xorg-server/hw/xfree86/common/xf86xvpriv.h +++ b/xorg-server/hw/xfree86/common/xf86xvpriv.h @@ -1,88 +1,88 @@ - -/* - * Copyright (c) 2003 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). - */ - -#ifndef _XF86XVPRIV_H_ -#define _XF86XVPRIV_H_ - -#include "xf86xv.h" -#include "privates.h" - -/*** These are DDX layer privates ***/ - -extern _X_EXPORT DevPrivateKey XF86XvScreenKey; - -typedef struct { - DestroyWindowProcPtr DestroyWindow; - ClipNotifyProcPtr ClipNotify; - WindowExposuresProcPtr WindowExposures; - void (*AdjustFrame)(int, int, int, int); - Bool (*EnterVT)(int, int); - void (*LeaveVT)(int, int); - GCPtr videoGC; -} XF86XVScreenRec, *XF86XVScreenPtr; - -typedef struct { - int flags; - PutVideoFuncPtr PutVideo; - PutStillFuncPtr PutStill; - GetVideoFuncPtr GetVideo; - GetStillFuncPtr GetStill; - StopVideoFuncPtr StopVideo; - SetPortAttributeFuncPtr SetPortAttribute; - GetPortAttributeFuncPtr GetPortAttribute; - QueryBestSizeFuncPtr QueryBestSize; - PutImageFuncPtr PutImage; - ReputImageFuncPtr ReputImage; - QueryImageAttributesFuncPtr QueryImageAttributes; - ClipNotifyFuncPtr ClipNotify; -} XvAdaptorRecPrivate, *XvAdaptorRecPrivatePtr; - -typedef struct { - ScrnInfoPtr pScrn; - DrawablePtr pDraw; - unsigned char type; - unsigned int subWindowMode; - DDXPointRec clipOrg; - RegionPtr clientClip; - RegionPtr pCompositeClip; - Bool FreeCompositeClip; - XvAdaptorRecPrivatePtr AdaptorRec; - XvStatus isOn; - Bool moved; - int vid_x, vid_y, vid_w, vid_h; - int drw_x, drw_y, drw_w, drw_h; - DevUnion DevPriv; -} XvPortRecPrivate, *XvPortRecPrivatePtr; - -typedef struct _XF86XVWindowRec{ - XvPortRecPrivatePtr PortRec; - struct _XF86XVWindowRec *next; - GCPtr pGC; -} XF86XVWindowRec, *XF86XVWindowPtr; - -#endif /* _XF86XVPRIV_H_ */ + +/* + * Copyright (c) 2003 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). + */ + +#ifndef _XF86XVPRIV_H_ +#define _XF86XVPRIV_H_ + +#include "xf86xv.h" +#include "privates.h" + +/*** These are DDX layer privates ***/ + +extern _X_EXPORT DevPrivateKey XF86XvScreenKey; + +typedef struct { + DestroyWindowProcPtr DestroyWindow; + ClipNotifyProcPtr ClipNotify; + WindowExposuresProcPtr WindowExposures; + void (*AdjustFrame)(int, int, int, int); + Bool (*EnterVT)(int, int); + void (*LeaveVT)(int, int); + GCPtr videoGC; + xf86ModeSetProc *ModeSet; +} XF86XVScreenRec, *XF86XVScreenPtr; + +typedef struct { + int flags; + PutVideoFuncPtr PutVideo; + PutStillFuncPtr PutStill; + GetVideoFuncPtr GetVideo; + GetStillFuncPtr GetStill; + StopVideoFuncPtr StopVideo; + SetPortAttributeFuncPtr SetPortAttribute; + GetPortAttributeFuncPtr GetPortAttribute; + QueryBestSizeFuncPtr QueryBestSize; + PutImageFuncPtr PutImage; + ReputImageFuncPtr ReputImage; + QueryImageAttributesFuncPtr QueryImageAttributes; + ClipNotifyFuncPtr ClipNotify; +} XvAdaptorRecPrivate, *XvAdaptorRecPrivatePtr; + +typedef struct { + ScrnInfoPtr pScrn; + DrawablePtr pDraw; + unsigned char type; + unsigned int subWindowMode; + RegionPtr clientClip; + RegionPtr pCompositeClip; + Bool FreeCompositeClip; + XvAdaptorRecPrivatePtr AdaptorRec; + XvStatus isOn; + Bool moved; + int vid_x, vid_y, vid_w, vid_h; + int drw_x, drw_y, drw_w, drw_h; + DevUnion DevPriv; +} XvPortRecPrivate, *XvPortRecPrivatePtr; + +typedef struct _XF86XVWindowRec{ + XvPortRecPrivatePtr PortRec; + struct _XF86XVWindowRec *next; + GCPtr pGC; +} XF86XVWindowRec, *XF86XVWindowPtr; + +#endif /* _XF86XVPRIV_H_ */ diff --git a/xorg-server/hw/xfree86/dixmods/extmod/xf86dga2.c b/xorg-server/hw/xfree86/dixmods/extmod/xf86dga2.c index 060e5a4d7..f1c740723 100644 --- a/xorg-server/hw/xfree86/dixmods/extmod/xf86dga2.c +++ b/xorg-server/hw/xfree86/dixmods/extmod/xf86dga2.c @@ -99,7 +99,7 @@ ProcXDGAOpenFramebuffer(ClientPtr client) char *deviceName; int nameSize; - if (stuff->screen > screenInfo.numScreens) + if (stuff->screen >= screenInfo.numScreens) return BadValue; if (!DGAAvailable(stuff->screen)) @@ -133,7 +133,7 @@ ProcXDGACloseFramebuffer(ClientPtr client) { REQUEST(xXDGACloseFramebufferReq); - if (stuff->screen > screenInfo.numScreens) + if (stuff->screen >= screenInfo.numScreens) return BadValue; if (!DGAAvailable(stuff->screen)) @@ -155,7 +155,7 @@ ProcXDGAQueryModes(ClientPtr client) xXDGAModeInfo info; XDGAModePtr mode; - if (stuff->screen > screenInfo.numScreens) + if (stuff->screen >= screenInfo.numScreens) return BadValue; REQUEST_SIZE_MATCH(xXDGAQueryModesReq); @@ -274,7 +274,7 @@ ProcXDGASetMode(ClientPtr client) ClientPtr owner; int size; - if (stuff->screen > screenInfo.numScreens) + if (stuff->screen >= screenInfo.numScreens) return BadValue; owner = DGA_GETCLIENT(stuff->screen); @@ -363,7 +363,7 @@ ProcXDGASetViewport(ClientPtr client) { REQUEST(xXDGASetViewportReq); - if (stuff->screen > screenInfo.numScreens) + if (stuff->screen >= screenInfo.numScreens) return BadValue; if(DGA_GETCLIENT(stuff->screen) != client) @@ -383,7 +383,7 @@ ProcXDGAInstallColormap(ClientPtr client) int rc; REQUEST(xXDGAInstallColormapReq); - if (stuff->screen > screenInfo.numScreens) + if (stuff->screen >= screenInfo.numScreens) return BadValue; if(DGA_GETCLIENT(stuff->screen) != client) @@ -405,7 +405,7 @@ ProcXDGASelectInput(ClientPtr client) { REQUEST(xXDGASelectInputReq); - if (stuff->screen > screenInfo.numScreens) + if (stuff->screen >= screenInfo.numScreens) return BadValue; if(DGA_GETCLIENT(stuff->screen) != client) @@ -425,7 +425,7 @@ ProcXDGAFillRectangle(ClientPtr client) { REQUEST(xXDGAFillRectangleReq); - if (stuff->screen > screenInfo.numScreens) + if (stuff->screen >= screenInfo.numScreens) return BadValue; if(DGA_GETCLIENT(stuff->screen) != client) @@ -445,7 +445,7 @@ ProcXDGACopyArea(ClientPtr client) { REQUEST(xXDGACopyAreaReq); - if (stuff->screen > screenInfo.numScreens) + if (stuff->screen >= screenInfo.numScreens) return BadValue; if(DGA_GETCLIENT(stuff->screen) != client) @@ -466,7 +466,7 @@ ProcXDGACopyTransparentArea(ClientPtr client) { REQUEST(xXDGACopyTransparentAreaReq); - if (stuff->screen > screenInfo.numScreens) + if (stuff->screen >= screenInfo.numScreens) return BadValue; if(DGA_GETCLIENT(stuff->screen) != client) @@ -488,7 +488,7 @@ ProcXDGAGetViewportStatus(ClientPtr client) REQUEST(xXDGAGetViewportStatusReq); xXDGAGetViewportStatusReply rep; - if (stuff->screen > screenInfo.numScreens) + if (stuff->screen >= screenInfo.numScreens) return BadValue; if(DGA_GETCLIENT(stuff->screen) != client) @@ -511,7 +511,7 @@ ProcXDGASync(ClientPtr client) REQUEST(xXDGASyncReq); xXDGASyncReply rep; - if (stuff->screen > screenInfo.numScreens) + if (stuff->screen >= screenInfo.numScreens) return BadValue; if(DGA_GETCLIENT(stuff->screen) != client) @@ -556,7 +556,7 @@ ProcXDGAChangePixmapMode(ClientPtr client) xXDGAChangePixmapModeReply rep; int x, y; - if (stuff->screen > screenInfo.numScreens) + if (stuff->screen >= screenInfo.numScreens) return BadValue; if(DGA_GETCLIENT(stuff->screen) != client) @@ -587,7 +587,7 @@ ProcXDGACreateColormap(ClientPtr client) REQUEST(xXDGACreateColormapReq); int result; - if (stuff->screen > screenInfo.numScreens) + if (stuff->screen >= screenInfo.numScreens) return BadValue; if(DGA_GETCLIENT(stuff->screen) != client) @@ -625,7 +625,7 @@ ProcXF86DGAGetVideoLL(ClientPtr client) int num, offset, flags; char *name; - if (stuff->screen > screenInfo.numScreens) + if (stuff->screen >= screenInfo.numScreens) return BadValue; REQUEST_SIZE_MATCH(xXF86DGAGetVideoLLReq); @@ -664,7 +664,7 @@ ProcXF86DGADirectVideo(ClientPtr client) ClientPtr owner; REQUEST(xXF86DGADirectVideoReq); - if (stuff->screen > screenInfo.numScreens) + if (stuff->screen >= screenInfo.numScreens) return BadValue; REQUEST_SIZE_MATCH(xXF86DGADirectVideoReq); @@ -718,7 +718,7 @@ ProcXF86DGAGetViewPortSize(ClientPtr client) REQUEST(xXF86DGAGetViewPortSizeReq); xXF86DGAGetViewPortSizeReply rep; - if (stuff->screen > screenInfo.numScreens) + if (stuff->screen >= screenInfo.numScreens) return BadValue; REQUEST_SIZE_MATCH(xXF86DGAGetViewPortSizeReq); @@ -746,7 +746,7 @@ ProcXF86DGASetViewPort(ClientPtr client) { REQUEST(xXF86DGASetViewPortReq); - if (stuff->screen > screenInfo.numScreens) + if (stuff->screen >= screenInfo.numScreens) return BadValue; if (DGA_GETCLIENT(stuff->screen) != client) @@ -773,7 +773,7 @@ ProcXF86DGAGetVidPage(ClientPtr client) REQUEST(xXF86DGAGetVidPageReq); xXF86DGAGetVidPageReply rep; - if (stuff->screen > screenInfo.numScreens) + if (stuff->screen >= screenInfo.numScreens) return BadValue; REQUEST_SIZE_MATCH(xXF86DGAGetVidPageReq); @@ -792,7 +792,7 @@ ProcXF86DGASetVidPage(ClientPtr client) { REQUEST(xXF86DGASetVidPageReq); - if (stuff->screen > screenInfo.numScreens) + if (stuff->screen >= screenInfo.numScreens) return BadValue; REQUEST_SIZE_MATCH(xXF86DGASetVidPageReq); @@ -810,7 +810,7 @@ ProcXF86DGAInstallColormap(ClientPtr client) int rc; REQUEST(xXF86DGAInstallColormapReq); - if (stuff->screen > screenInfo.numScreens) + if (stuff->screen >= screenInfo.numScreens) return BadValue; if (DGA_GETCLIENT(stuff->screen) != client) @@ -837,7 +837,7 @@ ProcXF86DGAQueryDirectVideo(ClientPtr client) REQUEST(xXF86DGAQueryDirectVideoReq); xXF86DGAQueryDirectVideoReply rep; - if (stuff->screen > screenInfo.numScreens) + if (stuff->screen >= screenInfo.numScreens) return BadValue; REQUEST_SIZE_MATCH(xXF86DGAQueryDirectVideoReq); @@ -859,7 +859,7 @@ ProcXF86DGAViewPortChanged(ClientPtr client) REQUEST(xXF86DGAViewPortChangedReq); xXF86DGAViewPortChangedReply rep; - if (stuff->screen > screenInfo.numScreens) + if (stuff->screen >= screenInfo.numScreens) return BadValue; if (DGA_GETCLIENT(stuff->screen) != client) diff --git a/xorg-server/hw/xfree86/modes/xf86Crtc.c b/xorg-server/hw/xfree86/modes/xf86Crtc.c index d421a942f..77f7375b1 100644 --- a/xorg-server/hw/xfree86/modes/xf86Crtc.c +++ b/xorg-server/hw/xfree86/modes/xf86Crtc.c @@ -371,6 +371,8 @@ done: crtc->active = TRUE; if (scrn->pScreen) xf86CrtcSetScreenSubpixelOrder (scrn->pScreen); + if (scrn->ModeSet) + scrn->ModeSet(scrn); } else { crtc->x = saved_x; crtc->y = saved_y; @@ -407,12 +409,16 @@ xf86CrtcSetMode (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation, void xf86CrtcSetOrigin (xf86CrtcPtr crtc, int x, int y) { + ScrnInfoPtr scrn = crtc->scrn; + crtc->x = x; crtc->y = y; if (crtc->funcs->set_origin) { if (!xf86CrtcRotate (crtc)) return; crtc->funcs->set_origin (crtc, x, y); + if (scrn->ModeSet) + scrn->ModeSet(scrn); } else xf86CrtcSetMode (crtc, &crtc->mode, crtc->rotation, x, y); @@ -2894,6 +2900,8 @@ xf86DisableUnusedFunctions(ScrnInfoPtr pScrn) } if (pScrn->pScreen) xf86_crtc_notify(pScrn->pScreen); + if (pScrn->ModeSet) + pScrn->ModeSet(pScrn); } #ifdef RANDR_12_INTERFACE diff --git a/xorg-server/render/render.c b/xorg-server/render/render.c index 623d5db33..a9cbfef8b 100644 --- a/xorg-server/render/render.c +++ b/xorg-server/render/render.c @@ -2552,8 +2552,8 @@ static void swapStops(void *stuff, int num) } colors = (CARD16 *)(stops); for (i = 0; i < 4*num; ++i) { - swaps(stops, n); - ++stops; + swaps(colors, n); + ++colors; } } -- cgit v1.2.3