From 336bad93d146931c160d8517edfdf0bee49ad9f7 Mon Sep 17 00:00:00 2001 From: marha Date: Fri, 6 Jul 2012 09:12:35 +0200 Subject: randrproto fontconfig mesa xserver git update 6 Jul 2012 --- X11/extensions/randr.h | 34 +- X11/extensions/randrproto.h | 235 ++++++++++ X11/extensions/randrproto.txt | 520 ++++++++++++++++++++++- fontconfig/configure.ac | 12 + mesalib/include/GLES2/gl2ext.h | 410 +++++++++++++++++- mesalib/src/mapi/glapi/gen/es_EXT.xml | 8 + mesalib/src/mapi/glapi/glapi_priv.h | 10 - mesalib/src/mesa/main/APIspec.xml | 1 + mesalib/src/mesa/main/extensions.c | 1 + mesalib/src/mesa/main/imports.h | 10 - mesalib/src/mesa/program/prog_print.c | 11 +- mesalib/src/mesa/state_tracker/st_extensions.c | 5 +- mesalib/src/mesa/state_tracker/st_program.c | 4 +- xorg-server/Xi/extinit.c | 2 +- xorg-server/dix/devices.c | 22 +- xorg-server/dix/dispatch.c | 3 + xorg-server/dix/gc.c | 2 +- xorg-server/dix/main.c | 1 + xorg-server/dix/pixmap.c | 4 +- xorg-server/dix/privates.c | 405 ++++++++++++++---- xorg-server/dix/touch.c | 11 +- xorg-server/dix/window.c | 4 +- xorg-server/doc/Xserver-spec.xml | 26 +- xorg-server/exa/exa.c | 10 +- xorg-server/exa/exa_priv.h | 12 +- xorg-server/fb/fb.h | 23 +- xorg-server/fb/fballpriv.c | 29 +- xorg-server/fb/fboverlay.c | 4 +- xorg-server/fb/fbscreen.c | 4 +- xorg-server/fb/fbwindow.c | 2 +- xorg-server/fb/wfbrename.h | 4 - xorg-server/glx/clientinfo.c | 27 +- xorg-server/glx/createcontext.c | 101 ++++- xorg-server/glx/extension_string.c | 2 + xorg-server/glx/extension_string.h | 2 + xorg-server/glx/glxcmds.c | 10 + xorg-server/glx/glxcontext.h | 5 + xorg-server/glx/glxdri2.c | 97 ++++- xorg-server/glx/glxserver.h | 1 - xorg-server/hw/dmx/input/dmxevents.c | 24 +- xorg-server/hw/dmx/input/dmxsigio.c | 22 - xorg-server/hw/dmx/input/dmxsigio.h | 2 - xorg-server/hw/kdrive/ephyr/ephyr.c | 24 +- xorg-server/hw/kdrive/src/kinput.c | 40 +- xorg-server/hw/xfree86/common/xf86Config.c | 1 + xorg-server/hw/xfree86/common/xf86Cursor.c | 12 +- xorg-server/hw/xfree86/common/xf86Events.c | 14 +- xorg-server/hw/xfree86/common/xf86Init.c | 9 +- xorg-server/hw/xfree86/common/xf86PM.c | 12 +- xorg-server/hw/xfree86/loader/loader.c | 6 + xorg-server/hw/xfree86/loader/loader.h | 1 + xorg-server/hw/xfree86/loader/loadmod.c | 2 +- xorg-server/hw/xfree86/os-support/shared/sigio.c | 24 +- xorg-server/include/list.h | 2 +- xorg-server/include/os.h | 6 + xorg-server/include/privates.h | 56 ++- xorg-server/include/scrnintstr.h | 2 + xorg-server/mi/midispcur.c | 189 ++++---- xorg-server/os/utils.c | 54 ++- xorg-server/render/picture.c | 5 +- xorg-server/test/Makefile.am | 3 +- xorg-server/test/os.c | 130 ++++++ xorg-server/xkb/xkbAccessX.c | 10 +- 63 files changed, 2263 insertions(+), 461 deletions(-) create mode 100644 xorg-server/test/os.c diff --git a/X11/extensions/randr.h b/X11/extensions/randr.h index 04604aa43..33d22fb3d 100644 --- a/X11/extensions/randr.h +++ b/X11/extensions/randr.h @@ -40,11 +40,11 @@ typedef unsigned long XRandrModeFlags; #define RANDR_NAME "RANDR" #define RANDR_MAJOR 1 -#define RANDR_MINOR 3 +#define RANDR_MINOR 4 -#define RRNumberErrors 3 +#define RRNumberErrors 4 #define RRNumberEvents 2 -#define RRNumberRequests 32 +#define RRNumberRequests 42 #define X_RRQueryVersion 0 /* we skip 1 to make old clients fail pretty immediately */ @@ -92,12 +92,28 @@ typedef unsigned long XRandrModeFlags; #define RRTransformScaleDown (1L << 2) #define RRTransformProjective (1L << 3) +/* v1.4 */ +#define X_RRGetProviders 32 +#define X_RRGetProviderInfo 33 +#define X_RRSetProviderOffloadSink 34 +#define X_RRSetProviderOutputSource 35 +#define X_RRListProviderProperties 36 +#define X_RRQueryProviderProperty 37 +#define X_RRConfigureProviderProperty 38 +#define X_RRChangeProviderProperty 39 +#define X_RRDeleteProviderProperty 40 +#define X_RRGetProviderProperty 41 + /* Event selection bits */ #define RRScreenChangeNotifyMask (1L << 0) /* V1.2 additions */ #define RRCrtcChangeNotifyMask (1L << 1) #define RROutputChangeNotifyMask (1L << 2) #define RROutputPropertyNotifyMask (1L << 3) +/* V1.4 additions */ +#define RRProviderChangeNotifyMask (1L << 4) +#define RRProviderPropertyNotifyMask (1L << 5) +#define RRResourceChangeNotifyMask (1L << 6) /* Event codes */ #define RRScreenChangeNotify 0 @@ -107,7 +123,9 @@ typedef unsigned long XRandrModeFlags; #define RRNotify_CrtcChange 0 #define RRNotify_OutputChange 1 #define RRNotify_OutputProperty 2 - +#define RRNotify_ProviderChange 3 +#define RRNotify_ProviderProperty 4 +#define RRNotify_ResourceChange 5 /* used in the rotation field; rotation and reflection in 0.1 proto. */ #define RR_Rotate_0 1 #define RR_Rotate_90 2 @@ -148,6 +166,7 @@ typedef unsigned long XRandrModeFlags; #define BadRROutput 0 #define BadRRCrtc 1 #define BadRRMode 2 +#define BadRRProvider 3 /* Conventional RandR output properties */ @@ -162,4 +181,11 @@ typedef unsigned long XRandrModeFlags; #define RR_PROPERTY_BORDER "Border" #define RR_PROPERTY_BORDER_DIMENSIONS "BorderDimensions" +/* roles this device can carry out */ +#define RR_Capability_None 0 +#define RR_Capability_SourceOutput 1 +#define RR_Capability_SinkOutput 2 +#define RR_Capability_SourceOffload 4 +#define RR_Capability_SinkOffload 8 + #endif /* _RANDR_H_ */ diff --git a/X11/extensions/randrproto.h b/X11/extensions/randrproto.h index 3b98a9f1f..30691e7ea 100644 --- a/X11/extensions/randrproto.h +++ b/X11/extensions/randrproto.h @@ -48,6 +48,7 @@ #define RROutput CARD32 #define RRMode CARD32 #define RRCrtc CARD32 +#define RRProvider CARD32 #define RRModeFlags CARD32 #define Rotation CARD16 @@ -645,6 +646,195 @@ typedef struct { } xRRGetOutputPrimaryReply; #define sz_xRRGetOutputPrimaryReply 32 +/* + * Additions for V1.4 + */ + +typedef struct { + CARD8 reqType; + CARD8 randrReqType; + CARD16 length B16; + Window window B32; +} xRRGetProvidersReq; +#define sz_xRRGetProvidersReq 8 + +typedef struct { + BYTE type; + CARD8 pad; + CARD16 sequenceNumber B16; + CARD32 length B32; + Time timestamp B32; + CARD16 nProviders; + CARD16 pad1 B16; + CARD32 pad2 B32; + CARD32 pad3 B32; + CARD32 pad4 B32; + CARD32 pad5 B32; +} xRRGetProvidersReply; +#define sz_xRRGetProvidersReply 32 + +typedef struct { + CARD8 reqType; + CARD8 randrReqType; + CARD16 length B16; + RRProvider provider B32; + Time configTimestamp B32; +} xRRGetProviderInfoReq; +#define sz_xRRGetProviderInfoReq 12 + +typedef struct { + BYTE type; + CARD8 status; + CARD16 sequenceNumber B16; + CARD32 length B32; + Time timestamp B32; + CARD32 capabilities B32; + CARD16 nCrtcs B16; + CARD16 nOutputs B16; + CARD16 nAssociatedProviders B16; + CARD16 nameLength B16; + CARD32 pad1 B32; + CARD32 pad2 B32; +} xRRGetProviderInfoReply; +#define sz_xRRGetProviderInfoReply 32 + +typedef struct { + CARD8 reqType; + CARD8 randrReqType; + CARD16 length B16; + RRProvider provider B32; + RRProvider source_provider B32; + Time configTimestamp B32; +} xRRSetProviderOutputSourceReq; +#define sz_xRRSetProviderOutputSourceReq 16 + +typedef struct { + CARD8 reqType; + CARD8 randrReqType; + CARD16 length B16; + RRProvider provider B32; + RRProvider sink_provider B32; + Time configTimestamp B32; +} xRRSetProviderOffloadSinkReq; +#define sz_xRRSetProviderOffloadSinkReq 16 + +typedef struct { + CARD8 reqType; + CARD8 randrReqType; + CARD16 length B16; + RRProvider provider B32; +} xRRListProviderPropertiesReq; +#define sz_xRRListProviderPropertiesReq 8 + +typedef struct { + BYTE type; + CARD8 pad0; + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD16 nAtoms B16; + CARD16 pad1 B16; + CARD32 pad2 B32; + CARD32 pad3 B32; + CARD32 pad4 B32; + CARD32 pad5 B32; + CARD32 pad6 B32; +} xRRListProviderPropertiesReply; +#define sz_xRRListProviderPropertiesReply 32 + +typedef struct { + CARD8 reqType; + CARD8 randrReqType; + CARD16 length B16; + RRProvider provider B32; + Atom property B32; +} xRRQueryProviderPropertyReq; +#define sz_xRRQueryProviderPropertyReq 12 + +typedef struct { + BYTE type; + BYTE pad0; + CARD16 sequenceNumber B16; + CARD32 length B32; + BOOL pending; + BOOL range; + BOOL immutable; + BYTE pad1; + CARD32 pad2 B32; + CARD32 pad3 B32; + CARD32 pad4 B32; + CARD32 pad5 B32; + CARD32 pad6 B32; +} xRRQueryProviderPropertyReply; +#define sz_xRRQueryProviderPropertyReply 32 + +typedef struct { + CARD8 reqType; + CARD8 randrReqType; + CARD16 length B16; + RRProvider provider B32; + Atom property B32; + BOOL pending; + BOOL range; + CARD16 pad B16; +} xRRConfigureProviderPropertyReq; +#define sz_xRRConfigureProviderPropertyReq 16 + +typedef struct { + CARD8 reqType; + CARD8 randrReqType; + CARD16 length B16; + RRProvider provider B32; + Atom property B32; + Atom type B32; + CARD8 format; + CARD8 mode; + CARD16 pad; + CARD32 nUnits B32; +} xRRChangeProviderPropertyReq; +#define sz_xRRChangeProviderPropertyReq 24 + +typedef struct { + CARD8 reqType; + CARD8 randrReqType; + CARD16 length B16; + RRProvider provider B32; + Atom property B32; +} xRRDeleteProviderPropertyReq; +#define sz_xRRDeleteProviderPropertyReq 12 + +typedef struct { + CARD8 reqType; + CARD8 randrReqType; + CARD16 length B16; + RRProvider provider B32; + Atom property B32; + Atom type B32; + CARD32 longOffset B32; + CARD32 longLength B32; +#ifdef __cplusplus + BOOL _delete; +#else + BOOL delete; +#endif + BOOL pending; + CARD16 pad1 B16; +} xRRGetProviderPropertyReq; +#define sz_xRRGetProviderPropertyReq 28 + +typedef struct { + BYTE type; + CARD8 format; + CARD16 sequenceNumber B16; + CARD32 length B32; + Atom propertyType B32; + CARD32 bytesAfter B32; + CARD32 nItems B32; + CARD32 pad1 B32; + CARD32 pad2 B32; + CARD32 pad3 B32; +} xRRGetProviderPropertyReply; +#define sz_xRRGetProviderPropertyReply 32 + /* * event */ @@ -714,6 +904,50 @@ typedef struct { } xRROutputPropertyNotifyEvent; #define sz_xRROutputPropertyNotifyEvent 32 +typedef struct { + CARD8 type; /* always evBase + RRNotify */ + CARD8 subCode; /* RRNotify_ProviderChange */ + CARD16 sequenceNumber B16; + Time timestamp B32; /* time provider was changed */ + Window window B32; /* window requesting notification */ + RRProvider provider B32; /* affected provider */ + CARD32 pad1 B32; + CARD32 pad2 B32; + CARD32 pad3 B32; + CARD32 pad4 B32; +} xRRProviderChangeNotifyEvent; +#define sz_xRRProviderChangeNotifyEvent 32 + +typedef struct { + CARD8 type; /* always evBase + RRNotify */ + CARD8 subCode; /* RRNotify_ProviderProperty */ + CARD16 sequenceNumber B16; + Window window B32; /* window requesting notification */ + RRProvider provider B32; /* affected provider */ + Atom atom B32; /* property name */ + Time timestamp B32; /* time provider was changed */ + CARD8 state; /* NewValue or Deleted */ + CARD8 pad1; + CARD16 pad2 B16; + CARD32 pad3 B32; + CARD32 pad4 B32; +} xRRProviderPropertyNotifyEvent; +#define sz_xRRProviderPropertyNotifyEvent 32 + +typedef struct { + CARD8 type; /* always evBase + RRNotify */ + CARD8 subCode; /* RRNotify_ResourceChange */ + CARD16 sequenceNumber B16; + Time timestamp B32; /* time resource was changed */ + Window window B32; /* window requesting notification */ + CARD32 pad1 B32; + CARD32 pad2 B32; + CARD32 pad3 B32; + CARD32 pad4 B32; + CARD32 pad5 B32; +} xRRResourceChangeNotifyEvent; +#define sz_xRRResourceChangeNotifyEvent 32 + typedef struct { CARD8 reqType; CARD8 randrReqType; @@ -784,6 +1018,7 @@ typedef struct { #undef RROutput #undef RRMode #undef RRCrtc +#undef RRProvider #undef Drawable #undef Window #undef Font diff --git a/X11/extensions/randrproto.txt b/X11/extensions/randrproto.txt index 7c297e2ad..6526b977d 100644 --- a/X11/extensions/randrproto.txt +++ b/X11/extensions/randrproto.txt @@ -1,6 +1,6 @@ The X Resize, Rotate and Reflect Extension - Version 1.3.1 - 2009-10-5 + Version 1.4.0 + 2012-07-03 Jim Gettys Jim.Gettys@hp.com @@ -129,6 +129,26 @@ Version 1.4 adds an optional Border property. for compensating for the overscan behavior of certain televisions. +Version 1.4 adds a new object called a provider object. A provider object +represents a GPU or virtual device providing services to the X server. +Providers have a set of abilities and a set of possible roles. + +Provider objects are used to control multi-GPU systems. Provider roles can +be dynamically configured to provide support for: + + 1) Output slaving: plug in a USB device, but have its output rendered + using the main GPU. On some dual-GPU laptops, the second GPU isn't + connected to the LVDS panel, so we need to use the first GPU as an output + slave for the second GPU. + + 2) offload - For dual-GPU laptops, allow direct rendered applications to be run + on the second GPU and display on the first GPU. + + 3) GPU switching - Allow switching between two GPUs as the main screen + renderer. + + 4) multiple GPU rendering - This replaces Xinerama. + 1.99 Acknowledgements Our thanks to the contributors to the design found on the xpert mailing @@ -207,6 +227,8 @@ CRTC A value for a CRTC argument does not name a defined CRTC. Mode A value for a MODE argument does not name a defined MODE. +Provider + A value for a PROVIDER argument does not name a defined PROVIDER. ❧❧❧❧❧❧❧❧❧❧❧ @@ -307,6 +329,19 @@ REFRESH { rates: LISTofCARD16 } ❧❧❧❧❧❧❧❧❧❧❧ +5.5. Protocol Types added in version 1.4 of the extension + +PROVIDER { XID } + +PROVIDER_CAPS { SourceOutput, SinkOutput, SourceOffload, SinkOffload } + Capabilties for this provider: + SourceOutput: This device can source output buffers. + SinkOutput: This device can sink output buffers. + SourceOffload: This device can source offload buffers. + SinkOffload: This device can sink offload buffers. + + ❧❧❧❧❧❧❧❧❧❧❧ + 6. Extension Initialization The name of this extension is "RANDR". @@ -1243,6 +1278,230 @@ dynamic changes in the display environment. ❧❧❧❧❧❧❧❧❧❧❧ +7.4 Extension Requests added in version 1.4 of the extension. + +┌─── + RRGetProviders + window : WINDOW + ▶ + timestamp: TIMESTAMP + providers: LISTofPROVIDER +└─── + Errors: Window + + RRGetPRoviders returns the list of providers connected to the screen + associated with 'window'. + + 'timestamp' indicates when the configuration was last set. + + 'providers' contains the list of PROVIDERs associated with the + screen. + +┌─── + RRGetProviderInfo + provider: PROVIDER + ▶ + capabilities: PROVIDER_CAPS + name: STRING + crtcs: LISTofCRTC + outputs: LISTofOUTPUT + associated_providers: LISTofPROVIDERS + associated_provider_capability: LISTofPROVIDER_CAPS +└─── + Errors: Provider + + RRGetProviderInfo return information about the specified provider. + The capabilites of the current provider are returned, along with + the list of providers currently associated with this provider and + the capability they are associated with. It also provides the list + of crtcs and outputs that this provider is responsible for. + + 'name' is a UTF-8 encoded string to be presented to the user to + indicate the device or driver supplied name. + +┌─── + RRSetProviderOffloadSink + provider: PROVIDER + sink_provider: PROVIDER + ▶ +└─── + Errors: Provider + + RRSetOffloadSink sets the offload sink for this provider to the + specified provider. + +┌─── + RRSetProviderOutputSource + provider: PROVIDER + source_provider: PROVIDER + ▶ +└─── + Errors: Provider + + RRSetOutputSource sets the output source for this provider to the + specified provider. + +┌─── + RRListProviderProperties + provider:PROVIDERS + ▶ + atoms: LISTof ATOM +└─── + Errors: Provider + + This request returns the atoms of properties currently defined on + the provider. + +┌─── + RRQueryProviderProperty + provider: PROVIDER + property: ATOM + ▶ + pending: BOOL + range: BOOL + immutable: BOOL + valid-values: LISTofINT32 +└─── + Errors: Name, Atom, Provider + + If the specified property does not exist for the specified provider, + then a Name error is returned. + + If 'pending' is TRUE, changes made to property values with + RRChangeProviderProperty will be saved in the pending property value + and be automatically copied to the current value on the next + RRSetCrtcConfig request on a crtc attached to that provider. + If 'pending' is FALSE, changes are copied immediately. + + If 'range' is TRUE, then the valid-values list will contain + precisely two values indicating the minimum and maximum allowed + values. If 'range' is FALSE, then the valid-values list will contain + the list of possible values; attempts to set other values will + result in a Value error. + + If 'immutable' is TRUE, then the property configuration cannot be + changed by clients. Immutable properties are interpreted by the X + server. + +┌─── + RRConfigureProviderProperty + provider: PROVIDER + property: ATOM + pending: BOOL + range: BOOL + valid-values: LISTofINT32 +└─── + Errors: Access, Name, Atom, Provider + + If the specified property is 'immutable', an Access error is + returned. + + Otherwise, the configuration of the specified property is changed to + the values provided in this request. + + If the specified property does not exist for the specified provider, + it is created with an empty value and None type. + +┌─── + RRChangeProviderProperty + provider: PROVIDER + property, type: ATOM + format: {8, 16, 32} + mode: { Replace, Prepend, Append } + data: LISTofINT8 or LISTofINT16 or LISTofINT32 +└─── + Errors: Alloc, Atom, Match, Value, Provider + + This request alters the value of the property for the specified + provider. If the property is marked as a 'pending' property, only the + pending value of the property is changed. Otherwise, changes are + reflected in both the pending and current values of the property. + The type is uninterpreted by the server. The format specifies + whether the data should be viewed as a list of 8-bit, 16-bit, or + 32-bit quantities so that the server can correctly byte-swap as + necessary. + + If the mode is Replace, the previous property value is discarded. + If the mode is Prepend or Append, then the type and format must + match the existing property value (or a Match error results). If + the property is undefined, it is treated as defined with the correct + type and format with zero-length data. + + For Prepend, the data is tacked on to the beginning of the existing + data, and for Append, it is tacked on to the end of the existing data. + + This request generates a ProviderPropertyNotify + + The lifetime of a property is not tied to the storing client. + Properties remain until explicitly deleted, until the provider is + destroyed, or until server reset (see section 10). + + The maximum size of a property is server-dependent and may vary + dynamically. +┌─── + RRDeleteProviderProperty + provider: Provider + property: ATOM +└─── + Errors: Atom, Provider + + This request deletes the property from the specified provider if the + property exists and generates a ProviderPropertyNotify event unless + the property does not exist. + +┌─── + RRGetProviderProperty + provider: PROVIDER + property: ATOM + type: ATOM or AnyPropertyType + long-offset, long-length: CARD32 + delete: BOOL + pending: BOOL + ▶ + type: ATOM or None + format: {0, 8, 16, 32} + bytes-after: CARD32 + value: LISTofINT8 or LISTofINT16 or LISTofINT32 +└─── + Errors: Atom, Value, Provider + + If the specified property does not exist for the specified provider, + then the return type is None, the format and bytes-after are zero, + and the value is empty. The delete argument is ignored in this + case. + + If the specified property exists but its type does not match the + specified type, then the return type is the actual type of the + property, the format is the actual format of the property (never + zero), the bytes-after is the length of the property in bytes (even + if the format is 16 or 32), and the value is empty. The delete + argument is ignored in this case. + + If the specified property exists and either AnyPropertyType is + specified or the specified type matches the actual type of the + property, then the return type is the actual type of the property, + the format is the actual format of the property (never zero), and + the bytes-after and value are as follows, given: + + N = actual length of the stored property in bytes + (even if the format is 16 or 32) + I = 4 × offset + T = N - I + L = MINIMUM(T, 4 × long-length) + A = N - (I + L) + + If 'pending' is true, and if the property holds a pending value, + then the value returned will be the pending value of the property + rather than the current value. The returned value starts at byte + index I in the property (indexing from 0), and its length in bytes + is L. However, it is a Value error if long-offset is given such + that L is negative. The value of bytes-after is A, giving the + number of trailing unread bytes in the stored property. If delete + is True and the bytes-after is zero, the property is also deleted + from the provider, and a RRProviderPropertyNotify event is generated. + + + ❧❧❧❧❧❧❧❧❧❧❧ 8. Extension Events Clients MAY select for ConfigureNotify on the root window to be @@ -1379,6 +1638,56 @@ factors, such as re-cabling a monitor, etc. just at the time when a display manager or log in script might be changing the monitor size or configuration. +8.2 Events added in version 1.4 of the RandR extension + +┌─── + RRProviderChangeNotify: + timestamp: TIMESTAMP time screen was reconfigured + config-timestamp: TIMESTAMP time available config data was changed + window: WINDOW window requesting notification + provider: PROVIDER provider affected by change + role: CRTC new role for provider +└─── + + This event is generated whenever the role for a provider has changed + and is sent to requesting clients. 'timestamp' indicates when the + provider configuration was changed by a client. + 'config-timestamp' says when the last time the available + configurations changed. 'root' is the root of the screen the change + occurred on, 'window' is window selecting for this event. The + precise change can be detected by examining the new state of the + system. + +┌─── + RRProviderPropertyNotify: + window: WINDOW window requesting notification + provider: PROVIDER providre affected by change + atom: ATOM affected property + time: TIMESTAMP time property was changed + state: { NewValue, Deleted } new property state +└─── + + This event is reported to clients selecting RRProviderPropertyChange + on the window and is generated with state NewValue when a property + of the window is changed using RRChangeProviderProperty even when + adding zero-length data and when replacing all or part of a property + with identical data. It is generated with state Deleted when a + property of the window is deleted using either + RRDeleteProviderProperty or RRGetProviderProperty. The timestamp + indicates the server time when the property was changed. + +┌─── + RRResourceChangeNotify: + window: WINDOW window requesting notification + time: TIMESTAMP time property was changed +└─── + + This event is reported to clients selecting RRResourceChange + on the window and is generated whenever the set of available + RandR resources associated with the screen has changed, either + created or destroyed. Querying the list of available resources + with RRGetScreenResources and RRGetProviders will return the new set. + ❧❧❧❧❧❧❧❧❧❧❧ 9. Properties @@ -2388,6 +2697,178 @@ A.2.2 Protocol Requests added with version 1.3 4 CARD32 pad4 └─── +A.2.3 Protocol Requests added with version 1.4 + +┌─── + RRGetProviders + 1 CARD8 major opcode + 1 32 RandR opcode + 2 2 length + 4 WINDOW window + ▶ + 1 1 Reply + 1 unused + 2 CARD16 sequence number + 4 CARD32 length + 4 TIMESTAMP timestamp + 2 p number of Providers + 2 CARD16 maximum masters + 4 CARD32 flags + 4p LISTofPROVIDERS providers + +┌─── + RRGetProviderInfo + 1 CARD8 major opcode + 1 33 RandR opcode + 2 3 length + 4 PROVIDER provider + 4 TIMESTAMP config-timestamp + ▶ + 1 1 Reply + 1 RRCONFIGSTATUS status + 2 CARD16 sequence number + 4 1+c+o+(a*2)+(n+p)/4 reply length + 4 TIMESTATMP timestamp + 4 CARD32 capabilites + 2 c number of crtcs + 2 o number of outputs + 2 a number of associated providers + 2 n length of name + 4c LISTofCRTC crtcs + 4o LISTofOUTPUT outputs + 4a LISTofPROVIDER associated providers + 4a CARD32 associated provider capability + n STRING8 name + p unused, p=pad(n) + +┌─── + RRSetProviderOffloadSink + 1 CARD8 major opcode + 1 34 RandR opcode + 2 2 length + 4 PROVIDER provider + 4 PROVIDER offload sink provider + 4 TIMESTAMP timestamp +┌─── + RRSetProviderOutputSource + 1 CARD8 major opcode + 1 35 RandR opcode + 2 2 length + 4 PROVIDER provider + 4 PROVIDER output source provider + 4 TIMESTAMP timestamp + +┌─── + RRListProviderProperties + 1 CARD8 major opcode + 1 36 RandR opcode + 2 2 length + 4 PROVIDER provider + ▶ + 1 1 Reply + 1 unused + 2 CARD16 sequence number + 4 n reply length + 2 n number of ATOMs in atoms + 22 unused + 4n LISTofATOM atoms +└─── +┌─── + RRQueryProviderProperty + 1 CARD8 major opcode + 1 37 RandR opcode + 2 3 request length + 4 PROVIDER provider + 4 ATOM property + ▶ + 1 1 Reply + 1 unused + 2 CARD16 sequence number + 4 n reply length + 1 BOOL pending + 1 BOOL range + 1 BOOL immutable + 21 unused + 4n LISTofINT32 valid values +└─── +┌─── + RRConfigureProviderProperty + 1 CARD8 major opcode + 1 38 RandR opcode + 2 4+n request length + 4 PROVIDER provider + 4 ATOM property + 1 BOOL pending + 1 BOOL range + 2 unused + 4n LISTofINT32 valid values +└─── +┌─── + RRChangeProviderProperty + 1 CARD8 major opcode + 1 39 RandR opcode + 2 6+(n+p)/4 request length + 4 PROVIDER provider + 4 ATOM property + 4 ATOM type + 1 CARD8 format + 1 mode + 0 Replace + 1 Prepend + 2 Append + 2 unused + 4 CARD32 length of data in format units + (= n for format = 8) + (= n/2 for format = 16) + (= n/4 for format = 32) + n LISTofBYTE data + (n is a multiple of 2 for format = 16) + (n is a multiple of 4 for format = 32) + p unused, p=pad(n) +└─── +┌─── + RRDeleteProviderProperty + 1 CARD8 major opcode + 1 40 RandR opcode + 2 3 request length + 4 PROVIDER provider + 4 ATOM property +└─── +┌─── + RRGetProviderProperty + 1 CARD8 major opcode + 1 41 RandR opcode + 2 7 request length + 4 PROVIDER provider + 4 ATOM property + 4 ATOM type + 0 AnyPropertyType + 4 CARD32 long-offset + 4 CARD32 long-length + 1 BOOL delete + 1 BOOL pending + 2 unused + ▶ + 1 1 Reply + 1 CARD8 format + 2 CARD16 sequence number + 4 (n+p)/4 reply length + 4 ATOM type + 0 None + 4 CARD32 bytes-after + 4 CARD32 length of value in format units + (= 0 for format = 0) + (= n for format = 8) + (= n/2 for format = 16) + (= n/4 for format = 32) + 12 unused + n LISTofBYTE value + (n is zero for format = 0) + (n is a multiple of 2 for format = 16) + (n is a multiple of 4 for format = 32) + p unused, p=pad(n) +└─── + A.3 Protocol Events ┌─── @@ -2455,6 +2936,40 @@ A.3.1 Protocol Events added with version 1.2 11 unused └─── +A.3.2 Protocol Events added with version 1.4 +┌─── + RRProviderChangeNotify + 1 Base + 1 code + 1 1 sub-code + 2 CARD16 sequence number + 4 TIMESTAMP timestamp + 4 WINDOW request window + 4 PROVIDER provider affected + 16 unused +└─── +┌─── + RRProviderPropertyNotify + 1 Base + 1 code + 1 2 sub-code + 2 CARD16 sequence number + 4 WINDOW window + 4 PROVIDER provider + 4 ATOM atom + 4 TIMESTAMP time + 1 state + 0 NewValue + 1 Deleted + 11 unused +└─── +┌─── + RRResourceChangeNotify + 1 Base + 1 code + 1 2 sub-code + 2 CARD16 sequence number + 4 TIMESTAMP time + 4 WINDOW window + 20 unused +└─── A.4 Protocol Errors ┌─── @@ -2462,6 +2977,7 @@ A.4 Protocol Errors Base + 0 Output Base + 1 Crtc Base + 2 Mode + Base + 3 Provider └─── Bibliography diff --git a/fontconfig/configure.ac b/fontconfig/configure.ac index 644fc1a58..140cb70aa 100644 --- a/fontconfig/configure.ac +++ b/fontconfig/configure.ac @@ -353,6 +353,18 @@ if test "$enable_libxml2" = "yes"; then AC_SUBST(LIBXML2_CFLAGS) AC_SUBST(LIBXML2_LIBS) + + fc_saved_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $LIBXML2_CFLAGS" + AC_MSG_CHECKING([SAX1 support in libxml2]) + AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ + #include + #if !defined(LIBXML_SAX1_ENABLED) + # include "error: No SAX1 support in libxml2" + #endif + ]])], [AC_MSG_RESULT([found])], [AC_MSG_ERROR([ +*** SAX1 support in libxml2 is required. enable it or use expat instead.])]) + CFLAGS="$fc_saved_CFLAGS" fi # diff --git a/mesalib/include/GLES2/gl2ext.h b/mesalib/include/GLES2/gl2ext.h index 4eae24635..c21e2acfc 100644 --- a/mesalib/include/GLES2/gl2ext.h +++ b/mesalib/include/GLES2/gl2ext.h @@ -1,7 +1,7 @@ #ifndef __gl2ext_h_ #define __gl2ext_h_ -/* $Revision: 15049 $ on $Date:: 2011-07-06 17:28:16 -0700 #$ */ +/* $Revision: 18099 $ on $Date:: 2012-06-06 09:16:19 -0700 #$ */ #ifdef __cplusplus extern "C" { @@ -93,6 +93,9 @@ typedef void* GLeglImageOES; #define GL_DEPTH24_STENCIL8_OES 0x88F0 #endif +/* GL_OES_required_internalformat */ +/* No new tokens introduced by this extension. */ + /* GL_OES_rgb8_rgba8 */ #ifndef GL_OES_rgb8_rgba8 #define GL_RGB8_OES 0x8051 @@ -207,6 +210,37 @@ typedef void* GLeglImageOES; #define GL_MAX_SAMPLES_ANGLE 0x8D57 #endif +/* GL_ANGLE_instanced_arrays */ +#ifndef GL_ANGLE_instanced_arrays +#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE 0x88FE +#endif + +/* GL_ANGLE_pack_reverse_row_order */ +#ifndef GL_ANGLE_pack_reverse_row_order +#define GL_PACK_REVERSE_ROW_ORDER_ANGLE 0x93A4 +#endif + +/* GL_ANGLE_texture_compression_dxt3 */ +#ifndef GL_ANGLE_texture_compression_dxt3 +#define GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE 0x83F2 +#endif + +/* GL_ANGLE_texture_compression_dxt5 */ +#ifndef GL_ANGLE_texture_compression_dxt5 +#define GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE 0x83F3 +#endif + +/* GL_ANGLE_texture_usage */ +#ifndef GL_ANGLE_texture_usage +#define GL_TEXTURE_USAGE_ANGLE 0x93A2 +#define GL_FRAMEBUFFER_ATTACHMENT_ANGLE 0x93A3 +#endif + +/* GL_ANGLE_translated_shader_source */ +#ifndef GL_ANGLE_translated_shader_source +#define GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE 0x93A0 +#endif + /*------------------------------------------------------------------------* * APPLE extension tokens *------------------------------------------------------------------------*/ @@ -261,6 +295,29 @@ typedef void* GLeglImageOES; #define GL_MAX_EXT 0x8008 #endif +/* GL_EXT_color_buffer_half_float */ +#ifndef GL_EXT_color_buffer_half_float +#define GL_RGBA16F_EXT 0x881A +#define GL_RGB16F_EXT 0x881B +#define GL_RG16F_EXT 0x822F +#define GL_R16F_EXT 0x822D +#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT 0x8211 +#define GL_UNSIGNED_NORMALIZED_EXT 0x8C17 +#endif + +/* GL_EXT_debug_label */ +#ifndef GL_EXT_debug_label +#define GL_PROGRAM_PIPELINE_OBJECT_EXT 0x8A4F +#define GL_PROGRAM_OBJECT_EXT 0x8B40 +#define GL_SHADER_OBJECT_EXT 0x8B48 +#define GL_BUFFER_OBJECT_EXT 0x9151 +#define GL_QUERY_OBJECT_EXT 0x9153 +#define GL_VERTEX_ARRAY_OBJECT_EXT 0x9154 +#endif + +/* GL_EXT_debug_marker */ +/* No new tokens introduced by this extension. */ + /* GL_EXT_discard_framebuffer */ #ifndef GL_EXT_discard_framebuffer #define GL_COLOR_EXT 0x1800 @@ -268,9 +325,26 @@ typedef void* GLeglImageOES; #define GL_STENCIL_EXT 0x1802 #endif +/* GL_EXT_multisampled_render_to_texture */ +#ifndef GL_EXT_multisampled_render_to_texture +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT 0x8D6C +#define GL_RENDERBUFFER_SAMPLES_EXT 0x9133 +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x9134 +#define GL_MAX_SAMPLES_EXT 0x9135 +#endif + /* GL_EXT_multi_draw_arrays */ /* No new tokens introduced by this extension. */ +/* GL_EXT_occlusion_query_boolean */ +#ifndef GL_EXT_occlusion_query_boolean +#define GL_ANY_SAMPLES_PASSED_EXT 0x8C2F +#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT 0x8D6A +#define GL_CURRENT_QUERY_EXT 0x8865 +#define GL_QUERY_RESULT_EXT 0x8866 +#define GL_QUERY_RESULT_AVAILABLE_EXT 0x8867 +#endif + /* GL_EXT_read_format_bgra */ #ifndef GL_EXT_read_format_bgra #define GL_BGRA_EXT 0x80E1 @@ -278,9 +352,53 @@ typedef void* GLeglImageOES; #define GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT 0x8366 #endif +/* GL_EXT_robustness */ +#ifndef GL_EXT_robustness +/* reuse GL_NO_ERROR */ +#define GL_GUILTY_CONTEXT_RESET_EXT 0x8253 +#define GL_INNOCENT_CONTEXT_RESET_EXT 0x8254 +#define GL_UNKNOWN_CONTEXT_RESET_EXT 0x8255 +#define GL_CONTEXT_ROBUST_ACCESS_EXT 0x90F3 +#define GL_RESET_NOTIFICATION_STRATEGY_EXT 0x8256 +#define GL_LOSE_CONTEXT_ON_RESET_EXT 0x8252 +#define GL_NO_RESET_NOTIFICATION_EXT 0x8261 +#endif + +/* GL_EXT_separate_shader_objects */ +#ifndef GL_EXT_separate_shader_objects +#define GL_VERTEX_SHADER_BIT_EXT 0x00000001 +#define GL_FRAGMENT_SHADER_BIT_EXT 0x00000002 +#define GL_ALL_SHADER_BITS_EXT 0xFFFFFFFF +#define GL_PROGRAM_SEPARABLE_EXT 0x8258 +#define GL_ACTIVE_PROGRAM_EXT 0x8259 +#define GL_PROGRAM_PIPELINE_BINDING_EXT 0x825A +#endif + /* GL_EXT_shader_texture_lod */ /* No new tokens introduced by this extension. */ +/* GL_EXT_shadow_samplers */ +#ifndef GL_EXT_shadow_samplers +#define GL_TEXTURE_COMPARE_MODE_EXT 0x884C +#define GL_TEXTURE_COMPARE_FUNC_EXT 0x884D +#define GL_COMPARE_REF_TO_TEXTURE_EXT 0x884E +#define GL_SAMPLER_2D_SHADOW_EXT 0x8B62 +#endif + +/* GL_EXT_sRGB */ +#ifndef GL_EXT_sRGB +#define GL_SRGB_EXT 0x8C40 +#define GL_SRGB_ALPHA_EXT 0x8C42 +#define GL_SRGB8_ALPHA8_EXT 0x8C43 +#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT 0x8210 +#endif + +/* GL_EXT_texture_compression_dxt1 */ +#ifndef GL_EXT_texture_compression_dxt1 +#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 +#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1 +#endif + /* GL_EXT_texture_filter_anisotropic */ #ifndef GL_EXT_texture_filter_anisotropic #define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE @@ -292,17 +410,46 @@ typedef void* GLeglImageOES; #define GL_BGRA_EXT 0x80E1 #endif +/* GL_EXT_texture_rg */ +#ifndef GL_EXT_texture_rg +#define GL_RED_EXT 0x1903 +#define GL_RG_EXT 0x8227 +#define GL_R8_EXT 0x8229 +#define GL_RG8_EXT 0x822B +#endif + +/* GL_EXT_texture_storage */ +#ifndef GL_EXT_texture_storage +#define GL_TEXTURE_IMMUTABLE_FORMAT_EXT 0x912F +#define GL_ALPHA8_EXT 0x803C +#define GL_LUMINANCE8_EXT 0x8040 +#define GL_LUMINANCE8_ALPHA8_EXT 0x8045 +#define GL_RGBA32F_EXT 0x8814 +#define GL_RGB32F_EXT 0x8815 +#define GL_ALPHA32F_EXT 0x8816 +#define GL_LUMINANCE32F_EXT 0x8818 +#define GL_LUMINANCE_ALPHA32F_EXT 0x8819 +/* reuse GL_RGBA16F_EXT */ +/* reuse GL_RGB16F_EXT */ +#define GL_ALPHA16F_EXT 0x881C +#define GL_LUMINANCE16F_EXT 0x881E +#define GL_LUMINANCE_ALPHA16F_EXT 0x881F +#define GL_RGB10_A2_EXT 0x8059 +#define GL_RGB10_EXT 0x8052 +#define GL_BGRA8_EXT 0x93A1 +#define GL_R8_EXT 0x8229 +#define GL_RG8_EXT 0x822B +#define GL_R32F_EXT 0x822E +#define GL_RG32F_EXT 0x8230 +#define GL_R16F_EXT 0x822D +#define GL_RG16F_EXT 0x822F +#endif + /* GL_EXT_texture_type_2_10_10_10_REV */ #ifndef GL_EXT_texture_type_2_10_10_10_REV #define GL_UNSIGNED_INT_2_10_10_10_REV_EXT 0x8368 #endif -/* GL_EXT_texture_compression_dxt1 */ -#ifndef GL_EXT_texture_compression_dxt1 -#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 -#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1 -#endif - /* GL_EXT_unpack_subimage */ #ifndef GL_EXT_unpack_subimage #define GL_UNPACK_ROW_LENGTH 0x0CF2 @@ -319,6 +466,15 @@ typedef void* GLeglImageOES; #define GL_SHADER_BINARY_DMP 0x9250 #endif +/*------------------------------------------------------------------------* + * FJ extension tokens + *------------------------------------------------------------------------*/ + +/* GL_FJ_shader_binary_GCCSO */ +#ifndef GL_FJ_shader_binary_GCCSO +#define GCCSO_SHADER_BINARY_FJ 0x9260 +#endif + /*------------------------------------------------------------------------* * IMG extension tokens *------------------------------------------------------------------------*/ @@ -631,6 +787,11 @@ typedef void (GL_APIENTRYP PFNGLGETBUFFERPOINTERVOESPROC) (GLenum target, GLenum #define GL_OES_packed_depth_stencil 1 #endif +/* GL_OES_required_internalformat */ +#ifndef GL_OES_required_internalformat +#define GL_OES_required_internalformat 1 +#endif + /* GL_OES_rgb8_rgba8 */ #ifndef GL_OES_rgb8_rgba8 #define GL_OES_rgb8_rgba8 1 @@ -790,6 +951,45 @@ GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleANGLE (GLenum target typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEANGLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); #endif +#ifndef GL_ANGLE_instanced_arrays +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDrawArraysInstancedANGLE (GLenum mode, GLint first, GLsizei count, GLsizei primcount); +GL_APICALL void GL_APIENTRY glDrawElementsInstancedANGLE (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); +GL_APICALL void GL_APIENTRY glVertexAttribDivisorANGLE (GLuint index, GLuint divisor); +#endif +typedef void (GL_APIENTRYP PFLGLDRAWARRAYSINSTANCEDANGLEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount); +typedef void (GL_APIENTRYP PFLGLDRAWELEMENTSINSTANCEDANGLEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); +typedef void (GL_APIENTRYP PFLGLVERTEXATTRIBDIVISORANGLEPROC) (GLuint index, GLuint divisor); +#endif + +/* GL_ANGLE_pack_reverse_row_order */ +#ifndef GL_ANGLE_pack_reverse_row_order +#define GL_ANGLE_pack_reverse_row_order 1 +#endif + +/* GL_ANGLE_texture_compression_dxt3 */ +#ifndef GL_ANGLE_texture_compression_dxt3 +#define GL_ANGLE_texture_compression_dxt3 1 +#endif + +/* GL_ANGLE_texture_compression_dxt5 */ +#ifndef GL_ANGLE_texture_compression_dxt5 +#define GL_ANGLE_texture_compression_dxt5 1 +#endif + +/* GL_ANGLE_texture_usage */ +#ifndef GL_ANGLE_texture_usage +#define GL_ANGLE_texture_usage 1 +#endif + +#ifndef GL_ANGLE_translated_shader_source +#define GL_ANGLE_translated_shader_source 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glGetTranslatedShaderSourceANGLE (GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source); +#endif +typedef void (GL_APIENTRYP PFLGLGETTRANSLATEDSHADERSOURCEANGLEPROC) (GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source); +#endif + /*------------------------------------------------------------------------* * APPLE extension functions *------------------------------------------------------------------------*/ @@ -843,6 +1043,35 @@ typedef void (GL_APIENTRYP PFNGLRESOLVEMULTISAMPLEFRAMEBUFFERAPPLEPROC) (void); #define GL_EXT_blend_minmax 1 #endif +/* GL_EXT_color_buffer_half_float */ +#ifndef GL_EXT_color_buffer_half_float +#define GL_EXT_color_buffer_half_float 1 +#endif + +/* GL_EXT_debug_label */ +#ifndef GL_EXT_debug_label +#define GL_EXT_debug_label 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glLabelObjectEXT (GLenum type, GLuint object, GLsizei length, const GLchar *label); +GL_APICALL void GL_APIENTRY glGetObjectLabelEXT (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label); +#endif +typedef void (GL_APIENTRYP PFNGLLABELOBJECTEXTPROC) (GLenum type, GLuint object, GLsizei length, const GLchar *label); +typedef void (GL_APIENTRYP PFNGLGETOBJECTLABELEXTPROC) (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label); +#endif + +/* GL_EXT_debug_marker */ +#ifndef GL_EXT_debug_marker +#define GL_EXT_debug_marker 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glInsertEventMarkerEXT (GLsizei length, const GLchar *marker); +GL_APICALL void GL_APIENTRY glPushGroupMarkerEXT (GLsizei length, const GLchar *marker); +GL_APICALL void GL_APIENTRY glPopGroupMarkerEXT (void); +#endif +typedef void (GL_APIENTRYP PFNGLINSERTEVENTMARKEREXTPROC) (GLsizei length, const GLchar *marker); +typedef void (GL_APIENTRYP PFNGLPUSHGROUPMARKEREXTPROC) (GLsizei length, const GLchar *marker); +typedef void (GL_APIENTRYP PFNGLPOPGROUPMARKEREXTPROC) (void); +#endif + /* GL_EXT_discard_framebuffer */ #ifndef GL_EXT_discard_framebuffer #define GL_EXT_discard_framebuffer 1 @@ -852,6 +1081,17 @@ GL_APICALL void GL_APIENTRY glDiscardFramebufferEXT (GLenum target, GLsizei numA typedef void (GL_APIENTRYP PFNGLDISCARDFRAMEBUFFEREXTPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments); #endif +/* GL_EXT_multisampled_render_to_texture */ +#ifndef GL_EXT_multisampled_render_to_texture +#define GL_EXT_multisampled_render_to_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleEXT (GLenum, GLsizei, GLenum, GLsizei, GLsizei); +GL_APICALL void GL_APIENTRY glFramebufferTexture2DMultisampleEXT (GLenum, GLenum, GLenum, GLuint, GLint, GLsizei); +#endif +typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples); +#endif + #ifndef GL_EXT_multi_draw_arrays #define GL_EXT_multi_draw_arrays 1 #ifdef GL_GLEXT_PROTOTYPES @@ -862,16 +1102,134 @@ typedef void (GL_APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, GLint *fir typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); #endif +/* GL_EXT_occlusion_query_boolean */ +#ifndef GL_EXT_occlusion_query_boolean +#define GL_EXT_occlusion_query_boolean 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glGenQueriesEXT (GLsizei n, GLuint *ids); +GL_APICALL void GL_APIENTRY glDeleteQueriesEXT (GLsizei n, const GLuint *ids); +GL_APICALL GLboolean GL_APIENTRY glIsQueryEXT (GLuint id); +GL_APICALL void GL_APIENTRY glBeginQueryEXT (GLenum target, GLuint id); +GL_APICALL void GL_APIENTRY glEndQueryEXT (GLenum target); +GL_APICALL void GL_APIENTRY glGetQueryivEXT (GLenum target, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetQueryObjectuivEXT (GLuint id, GLenum pname, GLuint *params); +#endif +typedef void (GL_APIENTRYP PFNGLGENQUERIESEXTPROC) (GLsizei n, GLuint *ids); +typedef void (GL_APIENTRYP PFNGLDELETEQUERIESEXTPROC) (GLsizei n, const GLuint *ids); +typedef GLboolean (GL_APIENTRYP PFNGLISQUERYEXTPROC) (GLuint id); +typedef void (GL_APIENTRYP PFNGLBEGINQUERYEXTPROC) (GLenum target, GLuint id); +typedef void (GL_APIENTRYP PFNGLENDQUERYEXTPROC) (GLenum target); +typedef void (GL_APIENTRYP PFNGLGETQUERYIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUIVEXTPROC) (GLuint id, GLenum pname, GLuint *params); +#endif + /* GL_EXT_read_format_bgra */ #ifndef GL_EXT_read_format_bgra #define GL_EXT_read_format_bgra 1 #endif +/* GL_EXT_robustness */ +#ifndef GL_EXT_robustness +#define GL_EXT_robustness 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL GLenum GL_APIENTRY glGetGraphicsResetStatusEXT (void); +GL_APICALL void GL_APIENTRY glReadnPixelsEXT (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); +GL_APICALL void GL_APIENTRY glGetnUniformfvEXT (GLuint program, GLint location, GLsizei bufSize, float *params); +GL_APICALL void GL_APIENTRY glGetnUniformivEXT (GLuint program, GLint location, GLsizei bufSize, GLint *params); +#endif +typedef GLenum (GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSEXTPROC) (void); +typedef void (GL_APIENTRYP PFNGLREADNPIXELSEXTPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); +typedef void (GL_APIENTRYP PFNGLGETNUNIFORMFVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, float *params); +typedef void (GL_APIENTRYP PFNGLGETNUNIFORMIVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params); +#endif + +/* GL_EXT_separate_shader_objects */ +#ifndef GL_EXT_separate_shader_objects +#define GL_EXT_separate_shader_objects 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glUseProgramStagesEXT (GLuint pipeline, GLbitfield stages, GLuint program); +GL_APICALL void GL_APIENTRY glActiveShaderProgramEXT (GLuint pipeline, GLuint program); +GL_APICALL GLuint GL_APIENTRY glCreateShaderProgramvEXT (GLenum type, GLsizei count, const GLchar **strings); +GL_APICALL void GL_APIENTRY glBindProgramPipelineEXT (GLuint pipeline); +GL_APICALL void GL_APIENTRY glDeleteProgramPipelinesEXT (GLsizei n, const GLuint *pipelines); +GL_APICALL void GL_APIENTRY glGenProgramPipelinesEXT (GLsizei n, GLuint *pipelines); +GL_APICALL GLboolean GL_APIENTRY glIsProgramPipelineEXT (GLuint pipeline); +GL_APICALL void GL_APIENTRY glProgramParameteriEXT (GLuint program, GLenum pname, GLint value); +GL_APICALL void GL_APIENTRY glGetProgramPipelineivEXT (GLuint pipeline, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glProgramUniform1iEXT (GLuint program, GLint location, GLint x); +GL_APICALL void GL_APIENTRY glProgramUniform2iEXT (GLuint program, GLint location, GLint x, GLint y); +GL_APICALL void GL_APIENTRY glProgramUniform3iEXT (GLuint program, GLint location, GLint x, GLint y, GLint z); +GL_APICALL void GL_APIENTRY glProgramUniform4iEXT (GLuint program, GLint location, GLint x, GLint y, GLint z, GLint w); +GL_APICALL void GL_APIENTRY glProgramUniform1fEXT (GLuint program, GLint location, GLfloat x); +GL_APICALL void GL_APIENTRY glProgramUniform2fEXT (GLuint program, GLint location, GLfloat x, GLfloat y); +GL_APICALL void GL_APIENTRY glProgramUniform3fEXT (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z); +GL_APICALL void GL_APIENTRY glProgramUniform4fEXT (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GL_APICALL void GL_APIENTRY glProgramUniform1ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); +GL_APICALL void GL_APIENTRY glProgramUniform2ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); +GL_APICALL void GL_APIENTRY glProgramUniform3ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); +GL_APICALL void GL_APIENTRY glProgramUniform4ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); +GL_APICALL void GL_APIENTRY glProgramUniform1fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniform2fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniform3fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniform4fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniformMatrix2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniformMatrix3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniformMatrix4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glValidateProgramPipelineEXT (GLuint pipeline); +GL_APICALL void GL_APIENTRY glGetProgramPipelineInfoLogEXT (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +#endif +typedef void (GL_APIENTRYP PFNGLUSEPROGRAMSTAGESEXTPROC) (GLuint pipeline, GLbitfield stages, GLuint program); +typedef void (GL_APIENTRYP PFNGLACTIVESHADERPROGRAMEXTPROC) (GLuint pipeline, GLuint program); +typedef GLuint (GL_APIENTRYP PFNGLCREATESHADERPROGRAMVEXTPROC) (GLenum type, GLsizei count, const GLchar **strings); +typedef void (GL_APIENTRYP PFNGLBINDPROGRAMPIPELINEEXTPROC) (GLuint pipeline); +typedef void (GL_APIENTRYP PFNGLDELETEPROGRAMPIPELINESEXTPROC) (GLsizei n, const GLuint *pipelines); +typedef void (GL_APIENTRYP PFNGLGENPROGRAMPIPELINESEXTPROC) (GLsizei n, GLuint *pipelines); +typedef GLboolean (GL_APIENTRYP PFNGLISPROGRAMPIPELINEEXTPROC) (GLuint pipeline); +typedef void (GL_APIENTRYP PFNGLPROGRAMPARAMETERIEXTPROC) (GLuint program, GLenum pname, GLint value); +typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEIVEXTPROC) (GLuint pipeline, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1IEXTPROC) (GLuint program, GLint location, GLint x); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2IEXTPROC) (GLuint program, GLint location, GLint x, GLint y); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3IEXTPROC) (GLuint program, GLint location, GLint x, GLint y, GLint z); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4IEXTPROC) (GLuint program, GLint location, GLint x, GLint y, GLint z, GLint w); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1FEXTPROC) (GLuint program, GLint location, GLfloat x); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2FEXTPROC) (GLuint program, GLint location, GLfloat x, GLfloat y); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3FEXTPROC) (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4FEXTPROC) (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLVALIDATEPROGRAMPIPELINEEXTPROC) (GLuint pipeline); +typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEINFOLOGEXTPROC) (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +#endif + /* GL_EXT_shader_texture_lod */ #ifndef GL_EXT_shader_texture_lod #define GL_EXT_shader_texture_lod 1 #endif +/* GL_EXT_shadow_samplers */ +#ifndef GL_EXT_shadow_samplers +#define GL_EXT_shadow_samplers 1 +#endif + +/* GL_EXT_sRGB */ +#ifndef GL_EXT_sRGB +#define GL_EXT_sRGB 1 +#endif + +/* GL_EXT_texture_compression_dxt1 */ +#ifndef GL_EXT_texture_compression_dxt1 +#define GL_EXT_texture_compression_dxt1 1 +#endif + /* GL_EXT_texture_filter_anisotropic */ #ifndef GL_EXT_texture_filter_anisotropic #define GL_EXT_texture_filter_anisotropic 1 @@ -882,16 +1240,35 @@ typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GL #define GL_EXT_texture_format_BGRA8888 1 #endif +/* GL_EXT_texture_rg */ +#ifndef GL_EXT_texture_rg +#define GL_EXT_texture_rg 1 +#endif + +/* GL_EXT_texture_storage */ +#ifndef GL_EXT_texture_storage +#define GL_EXT_texture_storage 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glTexStorage1DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); +GL_APICALL void GL_APIENTRY glTexStorage2DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glTexStorage3DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +GL_APICALL void GL_APIENTRY glTextureStorage1DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); +GL_APICALL void GL_APIENTRY glTextureStorage2DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glTextureStorage3DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +#endif +typedef void (GL_APIENTRYP PFNGLTEXSTORAGE1DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); +typedef void (GL_APIENTRYP PFNGLTEXSTORAGE2DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE1DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); +typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE2DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE3DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +#endif + /* GL_EXT_texture_type_2_10_10_10_REV */ #ifndef GL_EXT_texture_type_2_10_10_10_REV #define GL_EXT_texture_type_2_10_10_10_REV 1 #endif -/* GL_EXT_texture_compression_dxt1 */ -#ifndef GL_EXT_texture_compression_dxt1 -#define GL_EXT_texture_compression_dxt1 1 -#endif - /* GL_EXT_unpack_subimage */ #ifndef GL_EXT_unpack_subimage #define GL_EXT_unpack_subimage 1 @@ -906,6 +1283,15 @@ typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GL #define GL_DMP_shader_binary 1 #endif +/*------------------------------------------------------------------------* + * FJ extension functions + *------------------------------------------------------------------------*/ + +/* GL_FJ_shader_binary_GCCSO */ +#ifndef GL_FJ_shader_binary_GCCSO +#define GL_FJ_shader_binary_GCCSO 1 +#endif + /*------------------------------------------------------------------------* * IMG extension functions *------------------------------------------------------------------------*/ diff --git a/mesalib/src/mapi/glapi/gen/es_EXT.xml b/mesalib/src/mapi/glapi/gen/es_EXT.xml index b26cac54b..ad83d9142 100644 --- a/mesalib/src/mapi/glapi/gen/es_EXT.xml +++ b/mesalib/src/mapi/glapi/gen/es_EXT.xml @@ -634,4 +634,12 @@ + + + + + + + + diff --git a/mesalib/src/mapi/glapi/glapi_priv.h b/mesalib/src/mapi/glapi/glapi_priv.h index b6600c5fc..3ab553a2b 100644 --- a/mesalib/src/mapi/glapi/glapi_priv.h +++ b/mesalib/src/mapi/glapi/glapi_priv.h @@ -38,16 +38,6 @@ #include "GL/gl.h" #include "GL/glext.h" -/* The define of GL_COVERAGE_SAMPLES_NV in gl2ext.h is guarded by a different - * extension (GL_NV_coverage_sample) than in glext.h - * (GL_NV_multisample_coverage). Just undefine it to avoid spurious compiler - * warnings. - */ -#undef GL_COVERAGE_SAMPLES_NV - -#include "GLES2/gl2platform.h" -#include "GLES2/gl2ext.h" - #ifndef GL_OES_fixed_point typedef int GLfixed; typedef int GLclampx; diff --git a/mesalib/src/mesa/main/APIspec.xml b/mesalib/src/mesa/main/APIspec.xml index f870cf7db..b6cf52d07 100644 --- a/mesalib/src/mesa/main/APIspec.xml +++ b/mesalib/src/mesa/main/APIspec.xml @@ -4150,6 +4150,7 @@ + diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c index e4fe73307..793cc4e24 100644 --- a/mesalib/src/mesa/main/extensions.c +++ b/mesalib/src/mesa/main/extensions.c @@ -200,6 +200,7 @@ static const struct extension extension_table[] = { { "GL_EXT_texture_env_dot3", o(EXT_texture_env_dot3), GL, 2000 }, { "GL_EXT_texture_filter_anisotropic", o(EXT_texture_filter_anisotropic), GL | ES1 | ES2, 1999 }, { "GL_EXT_texture_format_BGRA8888", o(dummy_true), ES1 | ES2, 2005 }, + { "GL_EXT_texture_rg", o(ARB_texture_rg), ES2, 2011 }, { "GL_EXT_read_format_bgra", o(dummy_true), ES1 | ES2, 2009 }, { "GL_EXT_texture_integer", o(EXT_texture_integer), GL, 2006 }, { "GL_EXT_texture_lod_bias", o(dummy_true), GL | ES1, 1999 }, diff --git a/mesalib/src/mesa/main/imports.h b/mesalib/src/mesa/main/imports.h index 9fb6ae8f1..c0b6cecea 100644 --- a/mesalib/src/mesa/main/imports.h +++ b/mesalib/src/mesa/main/imports.h @@ -646,16 +646,6 @@ _mesa_vsnprintf(char *str, size_t size, const char *fmt, va_list arg); #endif -/** - * On Mingw32 we need to use __mingw_fprintf() to parse formats such - * as "0x%llx", and possibly others - */ -#ifdef __MINGW32__ -#define fprintf __mingw_fprintf -#endif - - - #ifdef __cplusplus } #endif diff --git a/mesalib/src/mesa/program/prog_print.c b/mesalib/src/mesa/program/prog_print.c index 46f1df0fc..bc5dc5803 100644 --- a/mesalib/src/mesa/program/prog_print.c +++ b/mesalib/src/mesa/program/prog_print.c @@ -29,6 +29,8 @@ * \author Brian Paul */ +#include /* for PRIx64 macro */ + #include "main/glheader.h" #include "main/context.h" #include "main/imports.h" @@ -970,11 +972,10 @@ _mesa_fprint_program_parameters(FILE *f, { GLuint i; - fprintf(f, "InputsRead: 0x%llx (0b%s)\n", - (unsigned long long) prog->InputsRead, binary(prog->InputsRead)); - fprintf(f, "OutputsWritten: 0x%llx (0b%s)\n", - (unsigned long long)prog->OutputsWritten, - binary(prog->OutputsWritten)); + fprintf(f, "InputsRead: %" PRIx64 " (0b%s)\n", + (uint64_t) prog->InputsRead, binary(prog->InputsRead)); + fprintf(f, "OutputsWritten: %" PRIx64 " (0b%s)\n", + (uint64_t) prog->OutputsWritten, binary(prog->OutputsWritten)); fprintf(f, "NumInstructions=%d\n", prog->NumInstructions); fprintf(f, "NumTemporaries=%d\n", prog->NumTemporaries); fprintf(f, "NumParameters=%d\n", prog->NumParameters); diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c index 6fea1fa08..fd9507536 100644 --- a/mesalib/src/mesa/state_tracker/st_extensions.c +++ b/mesalib/src/mesa/state_tracker/st_extensions.c @@ -578,6 +578,7 @@ void st_init_extensions(struct st_context *st) /* Extensions that only depend on GLSL 1.3. */ ctx->Extensions.ARB_conservative_depth = GL_TRUE; + ctx->Extensions.ARB_shader_bit_encoding = GL_TRUE; } else { /* Optional integer support for GLSL 1.2. */ if (screen->get_shader_param(screen, PIPE_SHADER_VERTEX, @@ -595,10 +596,6 @@ void st_init_extensions(struct st_context *st) ctx->Extensions.S3_s3tc = GL_FALSE; } - if (ctx->Const.NativeIntegers) { - ctx->Extensions.ARB_shader_bit_encoding = GL_TRUE; - } - if (screen->get_shader_param(screen, PIPE_SHADER_GEOMETRY, PIPE_SHADER_CAP_MAX_INSTRUCTIONS) > 0) { #if 0 /* XXX re-enable when GLSL compiler again supports geometry shaders */ diff --git a/mesalib/src/mesa/state_tracker/st_program.c b/mesalib/src/mesa/state_tracker/st_program.c index e6664fb7c..9f98298b4 100644 --- a/mesalib/src/mesa/state_tracker/st_program.c +++ b/mesalib/src/mesa/state_tracker/st_program.c @@ -569,12 +569,12 @@ st_translate_fragment_program(struct st_context *st, case FRAG_ATTRIB_CLIP_DIST0: input_semantic_name[slot] = TGSI_SEMANTIC_CLIPDIST; input_semantic_index[slot] = 0; - interpMode[slot] = TGSI_INTERPOLATE_LINEAR; + interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE; break; case FRAG_ATTRIB_CLIP_DIST1: input_semantic_name[slot] = TGSI_SEMANTIC_CLIPDIST; input_semantic_index[slot] = 1; - interpMode[slot] = TGSI_INTERPOLATE_LINEAR; + interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE; break; /* In most cases, there is nothing special about these * inputs, so adopt a convention to use the generic diff --git a/xorg-server/Xi/extinit.c b/xorg-server/Xi/extinit.c index 494e887cd..94f46f72f 100644 --- a/xorg-server/Xi/extinit.c +++ b/xorg-server/Xi/extinit.c @@ -365,7 +365,7 @@ RESTYPE RT_INPUTCLIENT; extern XExtensionVersion XIVersion; -Mask PropagateMask[MAXDEVICES]; +Mask PropagateMask[EMASKSIZE]; /***************************************************************** * diff --git a/xorg-server/dix/devices.c b/xorg-server/dix/devices.c index 08875bc3a..70fb273c9 100644 --- a/xorg-server/dix/devices.c +++ b/xorg-server/dix/devices.c @@ -246,13 +246,17 @@ AddInputDevice(ClientPtr client, DeviceProc deviceProc, Bool autoStart) if (devid >= MAXDEVICES) return (DeviceIntPtr) NULL; - dev = - _dixAllocateObjectWithPrivates(sizeof(DeviceIntRec) + - sizeof(SpriteInfoRec), - sizeof(DeviceIntRec) + - sizeof(SpriteInfoRec), - offsetof(DeviceIntRec, devPrivates), - PRIVATE_DEVICE); + dev = calloc(1, + sizeof(DeviceIntRec) + + sizeof(SpriteInfoRec)); + if (!dev) + return (DeviceIntPtr) NULL; + + if (!dixAllocatePrivates(&dev->devPrivates, PRIVATE_DEVICE)) { + free(dev); + return NULL; + } + if (!dev) return (DeviceIntPtr) NULL; @@ -282,6 +286,7 @@ AddInputDevice(ClientPtr client, DeviceProc deviceProc, Bool autoStart) /* security creation/labeling check */ if (XaceHook(XACE_DEVICE_ACCESS, client, dev, DixCreateAccess)) { + dixFreePrivates(dev->devPrivates, PRIVATE_DEVICE); free(dev); return NULL; } @@ -961,7 +966,8 @@ CloseDevice(DeviceIntPtr dev) free(dev->last.touches[j].valuators); free(dev->last.touches); dev->config_info = NULL; - dixFreeObjectWithPrivates(dev, PRIVATE_DEVICE); + dixFreePrivates(dev->devPrivates, PRIVATE_DEVICE); + free(dev); } /** diff --git a/xorg-server/dix/dispatch.c b/xorg-server/dix/dispatch.c index b88f9744d..7d2d3b727 100644 --- a/xorg-server/dix/dispatch.c +++ b/xorg-server/dix/dispatch.c @@ -3743,6 +3743,8 @@ AddScreen(Bool (*pfnInit) (ScreenPtr /*pScreen */ , if (!pScreen) return -1; + dixInitScreenSpecificPrivates(pScreen); + if (!dixAllocatePrivates(&pScreen->devPrivates, PRIVATE_SCREEN)) { free(pScreen); return -1; @@ -3794,6 +3796,7 @@ AddScreen(Bool (*pfnInit) (ScreenPtr /*pScreen */ , screenInfo.screens[i] = pScreen; screenInfo.numScreens++; if (!(*pfnInit) (pScreen, argc, argv)) { + dixFreeScreenSpecificPrivates(pScreen); dixFreePrivates(pScreen->devPrivates, PRIVATE_SCREEN); free(pScreen); screenInfo.numScreens--; diff --git a/xorg-server/dix/gc.c b/xorg-server/dix/gc.c index ac67643cf..60f54ec31 100644 --- a/xorg-server/dix/gc.c +++ b/xorg-server/dix/gc.c @@ -463,7 +463,7 @@ NewGCObject(ScreenPtr pScreen, int depth) { GCPtr pGC; - pGC = dixAllocateObjectWithPrivates(GC, PRIVATE_GC); + pGC = dixAllocateScreenObjectWithPrivates(pScreen, GC, PRIVATE_GC); if (!pGC) { return (GCPtr) NULL; } diff --git a/xorg-server/dix/main.c b/xorg-server/dix/main.c index e95ca1cc2..9524189d0 100644 --- a/xorg-server/dix/main.c +++ b/xorg-server/dix/main.c @@ -329,6 +329,7 @@ main(int argc, char *argv[], char *envp[]) FreeScratchPixmapsForScreen(screenInfo.screens[i]); FreeGCperDepth(i); FreeDefaultStipple(i); + dixFreeScreenSpecificPrivates(screenInfo.screens[i]); (*screenInfo.screens[i]->CloseScreen) (screenInfo.screens[i]); dixFreePrivates(screenInfo.screens[i]->devPrivates, PRIVATE_SCREEN); free(screenInfo.screens[i]); diff --git a/xorg-server/dix/pixmap.c b/xorg-server/dix/pixmap.c index 545ff54ac..0c85c3fb1 100644 --- a/xorg-server/dix/pixmap.c +++ b/xorg-server/dix/pixmap.c @@ -88,7 +88,7 @@ CreateScratchPixmapsForScreen(ScreenPtr pScreen) { unsigned int pixmap_size; - pixmap_size = sizeof(PixmapRec) + dixPrivatesSize(PRIVATE_PIXMAP); + pixmap_size = sizeof(PixmapRec) + dixScreenSpecificPrivatesSize(pScreen, PRIVATE_PIXMAP); pScreen->totalPixmapSize = BitmapBytePad(pixmap_size * 8); @@ -118,7 +118,7 @@ AllocatePixmap(ScreenPtr pScreen, int pixDataSize) if (!pPixmap) return NullPixmap; - dixInitPrivates(pPixmap, pPixmap + 1, PRIVATE_PIXMAP); + dixInitScreenPrivates(pScreen, pPixmap, pPixmap + 1, PRIVATE_PIXMAP); return pPixmap; } diff --git a/xorg-server/dix/privates.c b/xorg-server/dix/privates.c index 15fbf7590..b58085ffd 100644 --- a/xorg-server/dix/privates.c +++ b/xorg-server/dix/privates.c @@ -62,13 +62,9 @@ from The Open Group. #include "inputstr.h" #include "scrnintstr.h" #include "extnsionst.h" +#include "inputstr.h" -static struct { - DevPrivateKey key; - unsigned offset; - int created; - int allocated; -} keys[PRIVATE_LAST]; +static DevPrivateSetRec global_keys[PRIVATE_LAST]; static const Bool xselinux_private[PRIVATE_LAST] = { [PRIVATE_SCREEN] = TRUE, @@ -86,8 +82,57 @@ static const Bool xselinux_private[PRIVATE_LAST] = { [PRIVATE_GLYPHSET] = TRUE, }; +static const char *key_names[PRIVATE_LAST] = { + /* XSELinux uses the same private keys for numerous objects */ + [PRIVATE_XSELINUX] = "XSELINUX", + + /* Otherwise, you get a private in just the requested structure + */ + /* These can have objects created before all of the keys are registered */ + [PRIVATE_SCREEN] = "SCREEN", + [PRIVATE_EXTENSION] = "EXTENSION", + [PRIVATE_COLORMAP] = "COLORMAP", + [PRIVATE_DEVICE] = "DEVICE", + + /* These cannot have any objects before all relevant keys are registered */ + [PRIVATE_CLIENT] = "CLIENT", + [PRIVATE_PROPERTY] = "PROPERTY", + [PRIVATE_SELECTION] = "SELECTION", + [PRIVATE_WINDOW] = "WINDOW", + [PRIVATE_PIXMAP] = "PIXMAP", + [PRIVATE_GC] = "GC", + [PRIVATE_CURSOR] = "CURSOR", + [PRIVATE_CURSOR_BITS] = "CURSOR_BITS", + + /* extension privates */ + [PRIVATE_DBE_WINDOW] = "DBE_WINDOW", + [PRIVATE_DAMAGE] = "DAMAGE", + [PRIVATE_GLYPH] = "GLYPH", + [PRIVATE_GLYPHSET] = "GLYPHSET", + [PRIVATE_PICTURE] = "PICTURE", + [PRIVATE_SYNC_FENCE] = "SYNC_FENCE", +}; + +static const Bool screen_specific_private[PRIVATE_LAST] = { + [PRIVATE_SCREEN] = FALSE, + [PRIVATE_CLIENT] = FALSE, + [PRIVATE_WINDOW] = TRUE, + [PRIVATE_PIXMAP] = TRUE, + [PRIVATE_GC] = TRUE, + [PRIVATE_CURSOR] = FALSE, + [PRIVATE_COLORMAP] = FALSE, + [PRIVATE_DEVICE] = FALSE, + [PRIVATE_EXTENSION] = FALSE, + [PRIVATE_SELECTION] = FALSE, + [PRIVATE_PROPERTY] = FALSE, + [PRIVATE_PICTURE] = TRUE, + [PRIVATE_GLYPHSET] = FALSE, +}; + typedef Bool (*FixupFunc) (PrivatePtr *privates, int offset, unsigned bytes); +typedef enum { FixupMove, FixupRealloc } FixupType; + static Bool dixReallocPrivates(PrivatePtr *privates, int old_offset, unsigned bytes) { @@ -109,15 +154,73 @@ dixMovePrivates(PrivatePtr *privates, int new_offset, unsigned bytes) return TRUE; } +static Bool +fixupOneScreen(ScreenPtr pScreen, FixupFunc fixup, unsigned bytes) +{ + intptr_t dist; + char *old; + char *new; + DevPrivateKey *keyp, key; + DevPrivateType type; + int size; + + old = (char *) pScreen->devPrivates; + size = global_keys[PRIVATE_SCREEN].offset; + if (!fixup (&pScreen->devPrivates, size, bytes)) + return FALSE; + + /* Screen privates can contain screen-specific private keys + * for other types. When they move, the linked list we use to + * track them gets scrambled. Fix that by computing the change + * in the location of each private adjusting our linked list + * pointers to match + */ + + new = (char *) pScreen->devPrivates; + + /* Moving means everyone shifts up in the privates by 'bytes' amount, + * realloc means the base pointer moves + */ + if (fixup == dixMovePrivates) + new += bytes; + + dist = new - old; + + if (dist) { + for (type = PRIVATE_XSELINUX; type < PRIVATE_LAST; type++) + + /* Walk the privates list, being careful as the + * pointers are scrambled before we patch them. + */ + for (keyp = &pScreen->screenSpecificPrivates[type].key; + (key = *keyp) != NULL; + keyp = &key->next) + { + + /* Only mangle things if the private structure + * is contained within the allocation. Privates + * stored elsewhere will be left alone + */ + if (old <= (char *) key && (char *) key < old + size) + { + /* Compute new location of key */ + key = (DevPrivateKey) ((char *) key + dist); + + /* Patch the list */ + *keyp = key; + } + } + } + return TRUE; +} + static Bool fixupScreens(FixupFunc fixup, unsigned bytes) { int s; for (s = 0; s < screenInfo.numScreens; s++) - if (!fixup - (&screenInfo.screens[s]->devPrivates, keys[PRIVATE_SCREEN].offset, - bytes)) + if (!fixupOneScreen (screenInfo.screens[s], fixup, bytes)) return FALSE; return TRUE; } @@ -126,7 +229,7 @@ static Bool fixupServerClient(FixupFunc fixup, unsigned bytes) { if (serverClient) - return fixup(&serverClient->devPrivates, keys[PRIVATE_CLIENT].offset, + return fixup(&serverClient->devPrivates, global_keys[PRIVATE_CLIENT].offset, bytes); return TRUE; } @@ -140,7 +243,7 @@ fixupExtensions(FixupFunc fixup, unsigned bytes) for (major = EXTENSION_BASE; (extension = GetExtensionEntry(major)); major++) if (!fixup - (&extension->devPrivates, keys[PRIVATE_EXTENSION].offset, bytes)) + (&extension->devPrivates, global_keys[PRIVATE_EXTENSION].offset, bytes)) return FALSE; return TRUE; } @@ -157,17 +260,60 @@ fixupDefaultColormaps(FixupFunc fixup, unsigned bytes) screenInfo.screens[s]->defColormap, RT_COLORMAP, serverClient, DixCreateAccess); if (cmap && - !fixup(&cmap->devPrivates, keys[PRIVATE_COLORMAP].offset, bytes)) + !fixup(&cmap->devPrivates, screenInfo.screens[s]->screenSpecificPrivates[PRIVATE_COLORMAP].offset, bytes)) return FALSE; } return TRUE; } +static Bool +fixupDeviceList(DeviceIntPtr device, FixupFunc fixup, unsigned bytes) +{ + while (device) { + if (!fixup(&device->devPrivates, global_keys[PRIVATE_DEVICE].offset, bytes)) + return FALSE; + device = device->next; + } + return TRUE; +} + +static Bool +fixupDevices(FixupFunc fixup, unsigned bytes) +{ + return (fixupDeviceList(inputInfo.devices, fixup, bytes) && + fixupDeviceList(inputInfo.off_devices, fixup, bytes)); +} + static Bool (*const allocated_early[PRIVATE_LAST]) (FixupFunc, unsigned) = { -[PRIVATE_SCREEN] = fixupScreens, - [PRIVATE_CLIENT] = fixupServerClient, - [PRIVATE_EXTENSION] = fixupExtensions, - [PRIVATE_COLORMAP] = fixupDefaultColormaps,}; + [PRIVATE_SCREEN] = fixupScreens, + [PRIVATE_CLIENT] = fixupServerClient, + [PRIVATE_EXTENSION] = fixupExtensions, + [PRIVATE_COLORMAP] = fixupDefaultColormaps, + [PRIVATE_DEVICE] = fixupDevices, +}; + +static void +grow_private_set(DevPrivateSetPtr set, unsigned bytes) +{ + DevPrivateKey k; + + for (k = set->key; k; k = k->next) + k->offset += bytes; + set->offset += bytes; +} + +static void +grow_screen_specific_set(DevPrivateType type, unsigned bytes) +{ + int s; + + /* Update offsets for all screen-specific keys */ + for (s = 0; s < screenInfo.numScreens; s++) { + ScreenPtr pScreen = screenInfo.screens[s]; + + grow_private_set(&pScreen->screenSpecificPrivates[type], bytes); + } +} /* * Register a private key. This takes the type of object the key will @@ -199,14 +345,13 @@ dixRegisterPrivateKey(DevPrivateKey key, DevPrivateType type, unsigned size) /* Update offsets for all affected keys */ if (type == PRIVATE_XSELINUX) { - DevPrivateKey k; /* Resize if we can, or make sure nothing's allocated if we can't */ for (t = PRIVATE_XSELINUX; t < PRIVATE_LAST; t++) if (xselinux_private[t]) { if (!allocated_early[t]) - assert(!keys[t].created); + assert(!global_keys[t].created); else if (!allocated_early[t] (dixReallocPrivates, bytes)) return FALSE; } @@ -216,12 +361,12 @@ dixRegisterPrivateKey(DevPrivateKey key, DevPrivateType type, unsigned size) */ for (t = PRIVATE_XSELINUX; t < PRIVATE_LAST; t++) { if (xselinux_private[t]) { - for (k = keys[t].key; k; k = k->next) - k->offset += bytes; - keys[t].offset += bytes; + grow_private_set(&global_keys[t], bytes); + grow_screen_specific_set(t, bytes); if (allocated_early[t]) allocated_early[t] (dixMovePrivates, bytes); } + } offset = 0; @@ -229,11 +374,12 @@ dixRegisterPrivateKey(DevPrivateKey key, DevPrivateType type, unsigned size) else { /* Resize if we can, or make sure nothing's allocated if we can't */ if (!allocated_early[type]) - assert(!keys[type].created); + assert(!global_keys[type].created); else if (!allocated_early[type] (dixReallocPrivates, bytes)) return FALSE; - offset = keys[type].offset; - keys[type].offset += bytes; + offset = global_keys[type].offset; + global_keys[type].offset += bytes; + grow_screen_specific_set(type, bytes); } /* Setup this key */ @@ -242,8 +388,8 @@ dixRegisterPrivateKey(DevPrivateKey key, DevPrivateType type, unsigned size) key->initialized = TRUE; key->type = type; key->allocated = FALSE; - key->next = keys[type].key; - keys[type].key = key; + key->next = global_keys[type].key; + global_keys[type].key = key; return TRUE; } @@ -286,13 +432,15 @@ _dixGetScreenPrivateKey(const DevScreenPrivateKey key, ScreenPtr pScreen) void _dixInitPrivates(PrivatePtr *privates, void *addr, DevPrivateType type) { - keys[type].created++; + assert (!screen_specific_private[type]); + + global_keys[type].created++; if (xselinux_private[type]) - keys[PRIVATE_XSELINUX].created++; - if (keys[type].offset == 0) + global_keys[PRIVATE_XSELINUX].created++; + if (global_keys[type].offset == 0) addr = 0; *privates = addr; - memset(addr, '\0', keys[type].offset); + memset(addr, '\0', global_keys[type].offset); } /* @@ -301,9 +449,9 @@ _dixInitPrivates(PrivatePtr *privates, void *addr, DevPrivateType type) void _dixFiniPrivates(PrivatePtr privates, DevPrivateType type) { - keys[type].created--; + global_keys[type].created--; if (xselinux_private[type]) - keys[PRIVATE_XSELINUX].created--; + global_keys[PRIVATE_XSELINUX].created--; } /* @@ -322,10 +470,11 @@ _dixAllocateObjectWithPrivates(unsigned baseSize, unsigned clear, PrivatePtr *devPrivates; assert(type > PRIVATE_SCREEN && type < PRIVATE_LAST); + assert(!screen_specific_private[type]); /* round up so that void * is aligned */ baseSize = (baseSize + sizeof(void *) - 1) & ~(sizeof(void *) - 1); - totalSize = baseSize + keys[type].offset; + totalSize = baseSize + global_keys[type].offset; object = malloc(totalSize); if (!object) return NULL; @@ -350,8 +499,9 @@ dixAllocatePrivates(PrivatePtr *privates, DevPrivateType type) PrivatePtr p; assert(type > PRIVATE_XSELINUX && type < PRIVATE_LAST); + assert(!screen_specific_private[type]); - size = keys[type].offset; + size = global_keys[type].offset; if (!size) { p = NULL; } @@ -361,7 +511,7 @@ dixAllocatePrivates(PrivatePtr *privates, DevPrivateType type) } _dixInitPrivates(privates, p, type); - ++keys[type].allocated; + ++global_keys[type].allocated; return TRUE; } @@ -387,7 +537,7 @@ void dixFreePrivates(PrivatePtr privates, DevPrivateType type) { _dixFiniPrivates(privates, type); - --keys[type].allocated; + --global_keys[type].allocated; free(privates); } @@ -398,8 +548,9 @@ extern _X_EXPORT int dixPrivatesSize(DevPrivateType type) { assert(type >= PRIVATE_SCREEN && type < PRIVATE_LAST); + assert (!screen_specific_private[type]); - return keys[type].offset; + return global_keys[type].offset; } /* Table of devPrivates offsets */ @@ -434,36 +585,136 @@ dixLookupPrivateOffset(RESTYPE type) return -1; } -static const char *key_names[PRIVATE_LAST] = { - /* XSELinux uses the same private keys for numerous objects */ - [PRIVATE_XSELINUX] = "XSELINUX", +/* + * Screen-specific privates + */ - /* Otherwise, you get a private in just the requested structure - */ - /* These can have objects created before all of the keys are registered */ - [PRIVATE_SCREEN] = "SCREEN", - [PRIVATE_EXTENSION] = "EXTENSION", - [PRIVATE_COLORMAP] = "COLORMAP", +extern _X_EXPORT Bool +dixRegisterScreenSpecificPrivateKey(ScreenPtr pScreen, DevPrivateKey key, + DevPrivateType type, unsigned size) +{ + int offset; + unsigned bytes; - /* These cannot have any objects before all relevant keys are registered */ - [PRIVATE_DEVICE] = "DEVICE", - [PRIVATE_CLIENT] = "CLIENT", - [PRIVATE_PROPERTY] = "PROPERTY", - [PRIVATE_SELECTION] = "SELECTION", - [PRIVATE_WINDOW] = "WINDOW", - [PRIVATE_PIXMAP] = "PIXMAP", - [PRIVATE_GC] = "GC", - [PRIVATE_CURSOR] = "CURSOR", - [PRIVATE_CURSOR_BITS] = "CURSOR_BITS", + if (!screen_specific_private[type]) + FatalError("Attempt to allocate screen-specific private storage for type %s\n", + key_names[type]); - /* extension privates */ - [PRIVATE_DBE_WINDOW] = "DBE_WINDOW", - [PRIVATE_DAMAGE] = "DAMAGE", - [PRIVATE_GLYPH] = "GLYPH", - [PRIVATE_GLYPHSET] = "GLYPHSET", - [PRIVATE_PICTURE] = "PICTURE", - [PRIVATE_SYNC_FENCE] = "SYNC_FENCE", -}; + if (key->initialized) { + assert(size == key->size); + return TRUE; + } + + /* Compute required space */ + bytes = size; + if (size == 0) + bytes = sizeof(void *); + + /* align to void * size */ + bytes = (bytes + sizeof(void *) - 1) & ~(sizeof(void *) - 1); + + assert (!allocated_early[type]); + assert (!pScreen->screenSpecificPrivates[type].created); + offset = pScreen->screenSpecificPrivates[type].offset; + pScreen->screenSpecificPrivates[type].offset += bytes; + + /* Setup this key */ + key->offset = offset; + key->size = size; + key->initialized = TRUE; + key->type = type; + key->allocated = FALSE; + key->next = pScreen->screenSpecificPrivates[type].key; + pScreen->screenSpecificPrivates[type].key = key; + + return TRUE; +} + +/* Clean up screen-specific privates before CloseScreen */ +void +dixFreeScreenSpecificPrivates(ScreenPtr pScreen) +{ +} + +/* Initialize screen-specific privates in AddScreen */ +void +dixInitScreenSpecificPrivates(ScreenPtr pScreen) +{ + DevPrivateType t; + + for (t = PRIVATE_XSELINUX; t < PRIVATE_LAST; t++) + pScreen->screenSpecificPrivates[t].offset = global_keys[t].offset; +} + +/* Initialize screen-specific privates in AddScreen */ +void +_dixInitScreenPrivates(ScreenPtr pScreen, PrivatePtr *privates, void *addr, DevPrivateType type) +{ + int privates_size; + assert (screen_specific_private[type]); + + if (pScreen) { + privates_size = pScreen->screenSpecificPrivates[type].offset; + pScreen->screenSpecificPrivates[type].created++; + } + else + privates_size = global_keys[type].offset; + + global_keys[type].created++; + if (xselinux_private[type]) + global_keys[PRIVATE_XSELINUX].created++; + if (privates_size == 0) + addr = 0; + *privates = addr; + memset(addr, '\0', privates_size); +} + +void * +_dixAllocateScreenObjectWithPrivates(ScreenPtr pScreen, + unsigned baseSize, + unsigned clear, + unsigned offset, + DevPrivateType type) +{ + unsigned totalSize; + void *object; + PrivatePtr privates; + PrivatePtr *devPrivates; + int privates_size; + + assert(type > PRIVATE_SCREEN && type < PRIVATE_LAST); + assert (screen_specific_private[type]); + + if (pScreen) + privates_size = pScreen->screenSpecificPrivates[type].offset; + else + privates_size = global_keys[type].offset; + /* round up so that void * is aligned */ + baseSize = (baseSize + sizeof(void *) - 1) & ~(sizeof(void *) - 1); + totalSize = baseSize + privates_size; + object = malloc(totalSize); + if (!object) + return NULL; + + memset(object, '\0', clear); + privates = (PrivatePtr) (((char *) object) + baseSize); + devPrivates = (PrivatePtr *) ((char *) object + offset); + + _dixInitScreenPrivates(pScreen, devPrivates, privates, type); + + return object; +} + +int +dixScreenSpecificPrivatesSize(ScreenPtr pScreen, DevPrivateType type) +{ + assert(type >= PRIVATE_SCREEN && type < PRIVATE_LAST); + + if (screen_specific_private[type]) + return pScreen->screenSpecificPrivates[type].offset; + else + return global_keys[type].offset; +} void dixPrivateUsage(void) @@ -474,14 +725,14 @@ dixPrivateUsage(void) DevPrivateType t; for (t = PRIVATE_XSELINUX + 1; t < PRIVATE_LAST; t++) { - if (keys[t].offset) { + if (global_keys[t].offset) { ErrorF ("%s: %d objects of %d bytes = %d total bytes %d private allocs\n", - key_names[t], keys[t].created, keys[t].offset, - keys[t].created * keys[t].offset, keys[t].allocated); - bytes += keys[t].created * keys[t].offset; - objects += keys[t].created; - alloc += keys[t].allocated; + key_names[t], global_keys[t].created, global_keys[t].offset, + global_keys[t].created * global_keys[t].offset, global_keys[t].allocated); + bytes += global_keys[t].created * global_keys[t].offset; + objects += global_keys[t].created; + alloc += global_keys[t].allocated; } } ErrorF("TOTAL: %d objects, %d bytes, %d allocs\n", objects, bytes, alloc); @@ -495,7 +746,7 @@ dixResetPrivates(void) for (t = PRIVATE_XSELINUX; t < PRIVATE_LAST; t++) { DevPrivateKey key, next; - for (key = keys[t].key; key; key = next) { + for (key = global_keys[t].key; key; key = next) { next = key->next; key->offset = 0; key->initialized = FALSE; @@ -504,14 +755,14 @@ dixResetPrivates(void) if (key->allocated) free(key); } - if (keys[t].created) { + if (global_keys[t].created) { ErrorF("%d %ss still allocated at reset\n", - keys[t].created, key_names[t]); + global_keys[t].created, key_names[t]); dixPrivateUsage(); } - keys[t].key = NULL; - keys[t].offset = 0; - keys[t].created = 0; - keys[t].allocated = 0; + global_keys[t].key = NULL; + global_keys[t].offset = 0; + global_keys[t].created = 0; + global_keys[t].allocated = 0; } } diff --git a/xorg-server/dix/touch.c b/xorg-server/dix/touch.c index a01f152cd..497ad7dac 100644 --- a/xorg-server/dix/touch.c +++ b/xorg-server/dix/touch.c @@ -160,11 +160,13 @@ TouchBeginDDXTouch(DeviceIntPtr dev, uint32_t ddx_id) int i; TouchClassPtr t = dev->touch; DDXTouchPointInfoPtr ti = NULL; - Bool emulate_pointer = (t->mode == XIDirectTouch); + Bool emulate_pointer; if (!t) return NULL; + emulate_pointer = (t->mode == XIDirectTouch); + /* Look for another active touchpoint with the same DDX ID. DDX * touchpoints must be unique. */ if (TouchFindByDDXID(dev, ddx_id, FALSE)) @@ -461,14 +463,17 @@ TouchEventHistoryPush(TouchPointInfoPtr ti, const DeviceEvent *ev) void TouchEventHistoryReplay(TouchPointInfoPtr ti, DeviceIntPtr dev, XID resource) { - InternalEvent *tel = InitEventList(GetMaximumEventsNum()); - ValuatorMask *mask = valuator_mask_new(0); + InternalEvent *tel; + ValuatorMask *mask; int i, nev; int flags; if (!ti->history) return; + tel = InitEventList(GetMaximumEventsNum()); + mask = valuator_mask_new(0); + valuator_mask_set_double(mask, 0, ti->history[0].valuators.data[0]); valuator_mask_set_double(mask, 1, ti->history[0].valuators.data[1]); diff --git a/xorg-server/dix/window.c b/xorg-server/dix/window.c index 5cc3a502d..b66080830 100644 --- a/xorg-server/dix/window.c +++ b/xorg-server/dix/window.c @@ -446,7 +446,7 @@ CreateRootWindow(ScreenPtr pScreen) BoxRec box; PixmapFormatRec *format; - pWin = dixAllocateObjectWithPrivates(WindowRec, PRIVATE_WINDOW); + pWin = dixAllocateScreenObjectWithPrivates(pScreen, WindowRec, PRIVATE_WINDOW); if (!pWin) return FALSE; @@ -710,7 +710,7 @@ CreateWindow(Window wid, WindowPtr pParent, int x, int y, unsigned w, return NullWindow; } - pWin = dixAllocateObjectWithPrivates(WindowRec, PRIVATE_WINDOW); + pWin = dixAllocateScreenObjectWithPrivates(pScreen, WindowRec, PRIVATE_WINDOW); if (!pWin) { *error = BadAlloc; return NullWindow; diff --git a/xorg-server/doc/Xserver-spec.xml b/xorg-server/doc/Xserver-spec.xml index 31b6fb05d..cd1a9d07a 100644 --- a/xorg-server/doc/Xserver-spec.xml +++ b/xorg-server/doc/Xserver-spec.xml @@ -109,6 +109,12 @@ Revised for Xorg 1.9 devPrivates changes and 1.8 CreateNewResourceType changes + + 3.6 + July 2012 + kp + Revised for X server 1.13 screen-specific devPrivates changes + The following document explains the structure of the X Window System display server and the interfaces among the larger pieces. It is intended as a reference for programmers who are implementing an X Display Server on their workstation hardware. It is included with the X Window System source tape, along with the document "Strategies for Porting the X v11 Sample Server." The order in which you should read these documents is: @@ -4714,7 +4720,8 @@ Two new extensibility concepts have been developed for release 4, Wrappers and devPrivates. These replace the R3 GCInterest queues, which were not a general enough mechanism for many extensions and only provided hooks into a single data structure. devPrivates have been revised substantially for -X.Org X server release 1.5, and updated again for the 1.9 release. +X.Org X server release 1.5, updated again for the 1.9 release and extended +again for the 1.13 relealse.
devPrivates @@ -4757,6 +4764,23 @@ the specified type with distinct storage for the given pScreen. The key is usable on ScreenPrivate variants that are otherwise equivalent to the following Private functions. + + To request private space in objects created for a specific screen, use +
+ Bool dixRegisterScreenSpecificPrivateKey(ScreenPtr pScreen, DevPrivateKey key, DevPrivateType type, unsigned size); +
+ The type and size arguments are + the same as those to dixRegisterPrivateKey but this + function ensures only that the given key exists on objects of + the specified type that are allocated with reference to the specified + pScreen. Using the key on objects allocated for + other screens will result in incorrect results; there is no check made to + ensure that the caller's screen matches the private's screen. The key is + usable in any of the following functions. Screen-specific private storage is available + only for Windows, GCs, Pixmaps and Pictures. Attempts to allocate screen-specific + privates on other objects will result in a call to FatalError. +
+ To attach a piece of private data to an object, use:
diff --git a/xorg-server/exa/exa.c b/xorg-server/exa/exa.c index 0f90e593c..623ece073 100644 --- a/xorg-server/exa/exa.c +++ b/xorg-server/exa/exa.c @@ -38,8 +38,6 @@ #include "exa.h" DevPrivateKeyRec exaScreenPrivateKeyRec; -DevPrivateKeyRec exaPixmapPrivateKeyRec; -DevPrivateKeyRec exaGCPrivateKeyRec; #ifdef MITSHM static ShmFuncs exaShmFuncs = { NULL, NULL }; @@ -915,8 +913,8 @@ exaDriverInit(ScreenPtr pScreen, ExaDriverPtr pScreenInfo) exaDDXDriverInit(pScreen); - if (!dixRegisterPrivateKey - (&exaGCPrivateKeyRec, PRIVATE_GC, sizeof(ExaGCPrivRec))) { + if (!dixRegisterScreenSpecificPrivateKey + (pScreen, &pExaScr->gcPrivateKeyRec, PRIVATE_GC, sizeof(ExaGCPrivRec))) { LogMessage(X_WARNING, "EXA(%d): Failed to allocate GC private\n", pScreen->myNum); return FALSE; @@ -964,8 +962,8 @@ exaDriverInit(ScreenPtr pScreen, ExaDriverPtr pScreenInfo) * Hookup offscreen pixmaps */ if (pExaScr->info->flags & EXA_OFFSCREEN_PIXMAPS) { - if (!dixRegisterPrivateKey - (&exaPixmapPrivateKeyRec, PRIVATE_PIXMAP, + if (!dixRegisterScreenSpecificPrivateKey + (pScreen, &pExaScr->pixmapPrivateKeyRec, PRIVATE_PIXMAP, sizeof(ExaPixmapPrivRec))) { LogMessage(X_WARNING, "EXA(%d): Failed to allocate pixmap private\n", diff --git a/xorg-server/exa/exa_priv.h b/xorg-server/exa/exa_priv.h index f980fea6d..68eadc550 100644 --- a/xorg-server/exa/exa_priv.h +++ b/xorg-server/exa/exa_priv.h @@ -208,6 +208,8 @@ typedef struct { RegionRec maskReg; PixmapPtr srcPix; + DevPrivateKeyRec pixmapPrivateKeyRec; + DevPrivateKeyRec gcPrivateKeyRec; } ExaScreenPrivRec, *ExaScreenPrivPtr; /* @@ -225,17 +227,11 @@ typedef struct { extern DevPrivateKeyRec exaScreenPrivateKeyRec; #define exaScreenPrivateKey (&exaScreenPrivateKeyRec) -extern DevPrivateKeyRec exaPixmapPrivateKeyRec; - -#define exaPixmapPrivateKey (&exaPixmapPrivateKeyRec) -extern DevPrivateKeyRec exaGCPrivateKeyRec; - -#define exaGCPrivateKey (&exaGCPrivateKeyRec) #define ExaGetScreenPriv(s) ((ExaScreenPrivPtr)dixGetPrivate(&(s)->devPrivates, exaScreenPrivateKey)) #define ExaScreenPriv(s) ExaScreenPrivPtr pExaScr = ExaGetScreenPriv(s) -#define ExaGetGCPriv(gc) ((ExaGCPrivPtr)dixGetPrivateAddr(&(gc)->devPrivates, exaGCPrivateKey)) +#define ExaGetGCPriv(gc) ((ExaGCPrivPtr)dixGetPrivateAddr(&(gc)->devPrivates, &ExaGetScreenPriv(gc->pScreen)->gcPrivateKeyRec)) #define ExaGCPriv(gc) ExaGCPrivPtr pExaGC = ExaGetGCPriv(gc) /* @@ -286,7 +282,7 @@ extern DevPrivateKeyRec exaGCPrivateKeyRec; #define EXA_PIXMAP_SCORE_PINNED 1000 #define EXA_PIXMAP_SCORE_INIT 1001 -#define ExaGetPixmapPriv(p) ((ExaPixmapPrivPtr)dixGetPrivateAddr(&(p)->devPrivates, exaPixmapPrivateKey)) +#define ExaGetPixmapPriv(p) ((ExaPixmapPrivPtr)dixGetPrivateAddr(&(p)->devPrivates, &ExaGetScreenPriv((p)->drawable.pScreen)->pixmapPrivateKeyRec)) #define ExaPixmapPriv(p) ExaPixmapPrivPtr pExaPixmap = ExaGetPixmapPriv(p) #define EXA_RANGE_PITCH (1 << 0) diff --git a/xorg-server/fb/fb.h b/xorg-server/fb/fb.h index cc3b6ee61..40a7e38db 100644 --- a/xorg-server/fb/fb.h +++ b/xorg-server/fb/fb.h @@ -570,12 +570,6 @@ extern _X_EXPORT void fbSetBits(FbStip * bits, int stride, FbStip data); } \ } -extern _X_EXPORT DevPrivateKey - fbGetGCPrivateKey(void); - -extern _X_EXPORT DevPrivateKey - fbGetWinPrivateKey(void); - extern _X_EXPORT const GCOps fbGCOps; extern _X_EXPORT const GCFuncs fbGCFuncs; @@ -605,7 +599,7 @@ typedef void (*FinishWrapProcPtr) (DrawablePtr pDraw); #endif extern _X_EXPORT DevPrivateKey - fbGetScreenPrivateKey(void); +fbGetScreenPrivateKey(void); /* private field of a screen */ typedef struct { @@ -615,6 +609,8 @@ typedef struct { SetupWrapProcPtr setupWrap; /* driver hook to set pixmap access wrapping */ FinishWrapProcPtr finishWrap; /* driver hook to clean up pixmap access wrapping */ #endif + DevPrivateKeyRec gcPrivateKeyRec; + DevPrivateKeyRec winPrivateKeyRec; } FbScreenPrivRec, *FbScreenPrivPtr; #define fbGetScreenPrivate(pScreen) ((FbScreenPrivPtr) \ @@ -630,8 +626,10 @@ typedef struct { unsigned char bpp; /* current drawable bpp */ } FbGCPrivRec, *FbGCPrivPtr; +#define fbGetGCPrivateKey(pGC) (&fbGetScreenPrivate((pGC)->pScreen)->gcPrivateKeyRec) + #define fbGetGCPrivate(pGC) ((FbGCPrivPtr)\ - dixLookupPrivate(&(pGC)->devPrivates, fbGetGCPrivateKey())) + dixLookupPrivate(&(pGC)->devPrivates, fbGetGCPrivateKey(pGC))) #define fbGetCompositeClip(pGC) ((pGC)->pCompositeClip) #define fbGetExpose(pGC) ((pGC)->fExpose) @@ -639,8 +637,11 @@ typedef struct { #define fbGetRotatedPixmap(pGC) ((pGC)->pRotatedPixmap) #define fbGetScreenPixmap(s) ((PixmapPtr) (s)->devPrivate) + +#define fbGetWinPrivateKey(pWin) (&fbGetScreenPrivate(((DrawablePtr) (pWin))->pScreen)->winPrivateKeyRec) + #define fbGetWindowPixmap(pWin) ((PixmapPtr)\ - dixLookupPrivate(&((WindowPtr)(pWin))->devPrivates, fbGetWinPrivateKey())) + dixLookupPrivate(&((WindowPtr)(pWin))->devPrivates, fbGetWinPrivateKey(pWin))) #ifdef ROOTLESS #define __fbPixDrawableX(pPix) ((pPix)->drawable.x) @@ -782,14 +783,14 @@ fb24_32ModifyPixmapHeader(PixmapPtr pPixmap, * fballpriv.c */ extern _X_EXPORT Bool - fbAllocatePrivates(ScreenPtr pScreen, DevPrivateKey *pGCIndex); +fbAllocatePrivates(ScreenPtr pScreen); /* * fbarc.c */ extern _X_EXPORT void - fbPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc * parcs); +fbPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc * parcs); /* * fbbits.c diff --git a/xorg-server/fb/fballpriv.c b/xorg-server/fb/fballpriv.c index c6504f915..187d0b068 100644 --- a/xorg-server/fb/fballpriv.c +++ b/xorg-server/fb/fballpriv.c @@ -33,33 +33,20 @@ fbGetScreenPrivateKey(void) return &fbScreenPrivateKeyRec; } -static DevPrivateKeyRec fbGCPrivateKeyRec; -DevPrivateKey -fbGetGCPrivateKey(void) -{ - return &fbGCPrivateKeyRec; -} - -static DevPrivateKeyRec fbWinPrivateKeyRec; -DevPrivateKey -fbGetWinPrivateKey(void) -{ - return &fbWinPrivateKeyRec; -} - Bool -fbAllocatePrivates(ScreenPtr pScreen, DevPrivateKey *pGCKey) +fbAllocatePrivates(ScreenPtr pScreen) { - if (pGCKey) - *pGCKey = &fbGCPrivateKeyRec; + FbScreenPrivPtr pScrPriv; - if (!dixRegisterPrivateKey - (&fbGCPrivateKeyRec, PRIVATE_GC, sizeof(FbGCPrivRec))) - return FALSE; if (!dixRegisterPrivateKey (&fbScreenPrivateKeyRec, PRIVATE_SCREEN, sizeof(FbScreenPrivRec))) return FALSE; - if (!dixRegisterPrivateKey(&fbWinPrivateKeyRec, PRIVATE_WINDOW, 0)) + + pScrPriv = fbGetScreenPrivate(pScreen); + + if (!dixRegisterScreenSpecificPrivateKey (pScreen, &pScrPriv->gcPrivateKeyRec, PRIVATE_GC, sizeof(FbGCPrivRec))) + return FALSE; + if (!dixRegisterScreenSpecificPrivateKey (pScreen, &pScrPriv->winPrivateKeyRec, PRIVATE_WINDOW, 0)) return FALSE; return TRUE; diff --git a/xorg-server/fb/fboverlay.c b/xorg-server/fb/fboverlay.c index a882ffa39..c6802e4b4 100644 --- a/xorg-server/fb/fboverlay.c +++ b/xorg-server/fb/fboverlay.c @@ -63,7 +63,7 @@ fbOverlayCreateWindow(WindowPtr pWin) for (i = 0; i < pScrPriv->nlayers; i++) { pPixmap = pScrPriv->layer[i].u.run.pixmap; if (pWin->drawable.depth == pPixmap->drawable.depth) { - dixSetPrivate(&pWin->devPrivates, fbGetWinPrivateKey(), pPixmap); + dixSetPrivate(&pWin->devPrivates, fbGetWinPrivateKey(pWin), pPixmap); /* * Make sure layer keys are written correctly by * having non-root layers set to full while the @@ -103,7 +103,7 @@ fbOverlayWindowLayer(WindowPtr pWin) int i; for (i = 0; i < pScrPriv->nlayers; i++) - if (dixLookupPrivate(&pWin->devPrivates, fbGetWinPrivateKey()) == + if (dixLookupPrivate(&pWin->devPrivates, fbGetWinPrivateKey(pWin)) == (pointer) pScrPriv->layer[i].u.run.pixmap) return i; return 0; diff --git a/xorg-server/fb/fbscreen.c b/xorg-server/fb/fbscreen.c index 0833cd41e..7c7d6560e 100644 --- a/xorg-server/fb/fbscreen.c +++ b/xorg-server/fb/fbscreen.c @@ -85,7 +85,7 @@ _fbGetWindowPixmap(WindowPtr pWindow) void _fbSetWindowPixmap(WindowPtr pWindow, PixmapPtr pPixmap) { - dixSetPrivate(&pWindow->devPrivates, fbGetWinPrivateKey(), pPixmap); + dixSetPrivate(&pWindow->devPrivates, fbGetWinPrivateKey(pWindow), pPixmap); } Bool @@ -95,7 +95,7 @@ fbSetupScreen(ScreenPtr pScreen, pointer pbits, /* pointer to screen bitmap */ int dpiy, int width, /* pixel width of frame buffer */ int bpp) { /* bits per pixel for screen */ - if (!fbAllocatePrivates(pScreen, NULL)) + if (!fbAllocatePrivates(pScreen)) return FALSE; pScreen->defColormap = FakeClientID(0); /* let CreateDefColormap do whatever it wants for pixels */ diff --git a/xorg-server/fb/fbwindow.c b/xorg-server/fb/fbwindow.c index d27ccd4d5..368c4b883 100644 --- a/xorg-server/fb/fbwindow.c +++ b/xorg-server/fb/fbwindow.c @@ -31,7 +31,7 @@ Bool fbCreateWindow(WindowPtr pWin) { - dixSetPrivate(&pWin->devPrivates, fbGetWinPrivateKey(), + dixSetPrivate(&pWin->devPrivates, fbGetWinPrivateKey(pWin), fbGetScreenPixmap(pWin->drawable.pScreen)); if (pWin->drawable.bitsPerPixel == 32) pWin->drawable.bitsPerPixel = diff --git a/xorg-server/fb/wfbrename.h b/xorg-server/fb/wfbrename.h index 8b896eb9a..588440c2b 100644 --- a/xorg-server/fb/wfbrename.h +++ b/xorg-server/fb/wfbrename.h @@ -69,15 +69,11 @@ #define fbFixCoordModePrevious wfbFixCoordModePrevious #define fbGCFuncs wfbGCFuncs #define fbGCOps wfbGCOps -#define fbGCPrivateKeyRec wfbGCPrivateKeyRec #define fbGeneration wfbGeneration -#define fbGetGCPrivateKey wfbGetGCPrivateKey #define fbGetImage wfbGetImage #define fbGetScreenPrivateKey wfbGetScreenPrivateKey #define fbGetSpans wfbGetSpans #define _fbGetWindowPixmap _wfbGetWindowPixmap -#define fbWinPrivateKeyRec wfbWinPrivateKeyRec -#define fbGetWinPrivateKey wfbGetWinPrivateKey #define fbGlyph16 wfbGlyph16 #define fbGlyph24 wfbGlyph24 #define fbGlyph32 wfbGlyph32 diff --git a/xorg-server/glx/clientinfo.c b/xorg-server/glx/clientinfo.c index b26ac1a72..4aaa4c967 100644 --- a/xorg-server/glx/clientinfo.c +++ b/xorg-server/glx/clientinfo.c @@ -29,10 +29,10 @@ #include "glxbyteorder.h" #include "unpack.h" -int -__glXDisp_SetClientInfoARB(__GLXclientState * cl, GLbyte * pc) +static int +set_client_info(__GLXclientState * cl, xGLXSetClientInfoARBReq * req, + unsigned bytes_per_version) { - xGLXSetClientInfoARBReq *req = (xGLXSetClientInfoARBReq *) pc; char *gl_extensions; char *glx_extensions; @@ -40,7 +40,7 @@ __glXDisp_SetClientInfoARB(__GLXclientState * cl, GLbyte * pc) * sizes specified for the various fields. */ const unsigned expected_size = sz_xGLXSetClientInfoARBReq - + (req->numVersions * 8) + + (req->numVersions * bytes_per_version) + __GLX_PAD(req->numGLExtensionBytes) + __GLX_PAD(req->numGLXExtensionBytes); @@ -50,7 +50,7 @@ __glXDisp_SetClientInfoARB(__GLXclientState * cl, GLbyte * pc) /* Verify that the actual length of the GL extension string matches what's * encoded in protocol packet. */ - gl_extensions = (char *) (req + 1) + (req->numVersions * 8); + gl_extensions = (char *) (req + 1) + (req->numVersions * bytes_per_version); if (req->numGLExtensionBytes != 0 && memchr(gl_extensions, 0, __GLX_PAD(req->numGLExtensionBytes)) == NULL) @@ -71,6 +71,12 @@ __glXDisp_SetClientInfoARB(__GLXclientState * cl, GLbyte * pc) return 0; } +int +__glXDisp_SetClientInfoARB(__GLXclientState * cl, GLbyte * pc) +{ + return set_client_info(cl, (xGLXSetClientInfoARBReq *) pc, 8); +} + int __glXDispSwap_SetClientInfoARB(__GLXclientState * cl, GLbyte * pc) { @@ -87,11 +93,18 @@ __glXDispSwap_SetClientInfoARB(__GLXclientState * cl, GLbyte * pc) int __glXDisp_SetClientInfo2ARB(__GLXclientState * cl, GLbyte * pc) { - return BadRequest; + return set_client_info(cl, (xGLXSetClientInfoARBReq *) pc, 12); } int __glXDispSwap_SetClientInfo2ARB(__GLXclientState * cl, GLbyte * pc) { - return BadRequest; + xGLXSetClientInfoARBReq *req = (xGLXSetClientInfoARBReq *) pc; + + req->length = bswap_16(req->length); + req->numVersions = bswap_32(req->numVersions); + req->numGLExtensionBytes = bswap_32(req->numGLExtensionBytes); + req->numGLXExtensionBytes = bswap_32(req->numGLXExtensionBytes); + + return __glXDisp_SetClientInfo2ARB(cl, pc); } diff --git a/xorg-server/glx/createcontext.c b/xorg-server/glx/createcontext.c index 025c423fe..13d21ccb9 100644 --- a/xorg-server/glx/createcontext.c +++ b/xorg-server/glx/createcontext.c @@ -30,7 +30,8 @@ #include "indirect_dispatch.h" #define ALL_VALID_FLAGS \ - (GLX_CONTEXT_DEBUG_BIT_ARB | GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB) + (GLX_CONTEXT_DEBUG_BIT_ARB | GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB \ + | GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB) static Bool validate_GL_version(int major_version, int minor_version) @@ -90,6 +91,24 @@ __glXDisp_CreateContextAttribsARB(__GLXclientState * cl, GLbyte * pc) __GLXconfig *config; int err; + /* The GLX_ARB_create_context_robustness spec says: + * + * "The default value for GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB + * is GLX_NO_RESET_NOTIFICATION_ARB." + */ + int reset = GLX_NO_RESET_NOTIFICATION_ARB; + + /* The GLX_ARB_create_context_profile spec says: + * + * "The default value for GLX_CONTEXT_PROFILE_MASK_ARB is + * GLX_CONTEXT_CORE_PROFILE_BIT_ARB." + * + * The core profile only makes sense for OpenGL versions 3.2 and later. + * If the version ultimately specified is less than 3.2, the core profile + * bit is cleared (see below). + */ + int profile = GLX_CONTEXT_CORE_PROFILE_BIT_ARB; + /* Verify that the size of the packet matches the size inferred from the * sizes specified for the various fields. */ @@ -161,6 +180,18 @@ __glXDisp_CreateContextAttribsARB(__GLXclientState * cl, GLbyte * pc) render_type = attribs[2 * i + 1]; break; + case GLX_CONTEXT_PROFILE_MASK_ARB: + profile = attribs[2 * i + 1]; + break; + + case GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB: + reset = attribs[2 * i + 1]; + if (reset != GLX_NO_RESET_NOTIFICATION_ARB + && reset != GLX_LOSE_CONTEXT_ON_RESET_ARB) + return BadValue; + + break; + default: return BadValue; } @@ -202,6 +233,73 @@ __glXDisp_CreateContextAttribsARB(__GLXclientState * cl, GLbyte * pc) if ((flags & ~ALL_VALID_FLAGS) != 0) return BadValue; + /* The GLX_ARB_create_context_profile spec says: + * + * "* If attribute GLX_CONTEXT_PROFILE_MASK_ARB has no bits set; has + * any bits set other than GLX_CONTEXT_CORE_PROFILE_BIT_ARB and + * GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB; has more than one of + * these bits set; or if the implementation does not support the + * requested profile, then GLXBadProfileARB is generated." + */ + switch (profile) { + case GLX_CONTEXT_CORE_PROFILE_BIT_ARB: + case GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB: + break; + case GLX_CONTEXT_ES2_PROFILE_BIT_EXT: + /* The GLX_EXT_create_context_es2_profile spec says: + * + * "... If the version requested is 2.0, and the + * GLX_CONTEXT_ES2_PROFILE_BIT_EXT bit is set in the + * GLX_CONTEXT_PROFILE_MASK_ARB attribute (see below), then the + * context returned will implement OpenGL ES 2.0." + * + * It also says: + * + * "* If attribute GLX_CONTEXT_PROFILE_MASK_ARB has no bits set; + * has any bits set other than + * GLX_CONTEXT_CORE_PROFILE_BIT_ARB, + * GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB, or + * GLX_CONTEXT_ES2_PROFILE_BIT_EXT; has more than one of these + * bits set; or if the implementation does not supported the + * requested profile, then GLXBadProfileARB is generated." + * + * It does not specifically say what is supposed to happen if + * GLX_CONTEXT_ES2_PROFILE_BIT_EXT is set but the version requested is + * not 2.0. We choose to generate GLXBadProfileARB as this matches + * NVIDIA's behavior. + */ + if (major_version != 2 || minor_version != 0) + return __glXError(GLXBadProfileARB); + break; + default: + return __glXError(GLXBadProfileARB); + } + + /* The GLX_ARB_create_context_robustness spec says: + * + * "* If the reset notification behavior of and the + * newly created context are different, BadMatch is generated." + */ + if (shareCtx != NULL && shareCtx->resetNotificationStrategy != reset) + return BadMatch; + + /* There is no GLX protocol for desktop OpenGL versions after 1.4. There + * is no GLX protocol for any version of OpenGL ES. If the application is + * requested an indirect rendering context for a version that cannot be + * satisfied, reject it. + * + * The GLX_ARB_create_context spec says: + * + * "* If does not support compatible OpenGL contexts + * providing the requested API major and minor version, + * forward-compatible flag, and debug context flag, GLXBadFBConfig + * is generated." + */ + if (!req->isDirect && (major_version > 1 || minor_version > 4 + || profile == GLX_CONTEXT_ES2_PROFILE_BIT_EXT)) { + return __glXError(GLXBadFBConfig); + } + /* Allocate memory for the new context */ if (req->isDirect) { @@ -232,6 +330,7 @@ __glXDisp_CreateContextAttribsARB(__GLXclientState * cl, GLbyte * pc) ctx->selectBufSize = 0; ctx->drawPriv = NULL; ctx->readPriv = NULL; + ctx->resetNotificationStrategy = reset; /* Add the new context to the various global tables of GLX contexts. */ diff --git a/xorg-server/glx/extension_string.c b/xorg-server/glx/extension_string.c index 6a1a6c6b2..ee9864e64 100644 --- a/xorg-server/glx/extension_string.c +++ b/xorg-server/glx/extension_string.c @@ -70,8 +70,10 @@ static const struct extension_info known_glx_extensions[] = { /* *INDENT-OFF* */ { GLX(ARB_create_context), VER(0,0), N, }, { GLX(ARB_create_context_profile), VER(0,0), N, }, + { GLX(ARB_create_context_robustness), VER(0,0), N, }, { GLX(ARB_multisample), VER(1,4), Y, }, + { GLX(EXT_create_context_es2_profile), VER(0,0), N, }, { GLX(EXT_import_context), VER(0,0), Y, }, { GLX(EXT_texture_from_pixmap), VER(0,0), Y, }, { GLX(EXT_visual_info), VER(0,0), Y, }, diff --git a/xorg-server/glx/extension_string.h b/xorg-server/glx/extension_string.h index 947bf89e6..7a4a8b1c2 100644 --- a/xorg-server/glx/extension_string.h +++ b/xorg-server/glx/extension_string.h @@ -38,7 +38,9 @@ enum { /* GLX_ARB_get_proc_address is implemented on the client. */ ARB_create_context_bit = 0, ARB_create_context_profile_bit, + ARB_create_context_robustness_bit, ARB_multisample_bit, + EXT_create_context_es2_profile_bit, EXT_import_context_bit, EXT_texture_from_pixmap_bit, EXT_visual_info_bit, diff --git a/xorg-server/glx/glxcmds.c b/xorg-server/glx/glxcmds.c index d483bbf8a..d05421971 100644 --- a/xorg-server/glx/glxcmds.c +++ b/xorg-server/glx/glxcmds.c @@ -308,6 +308,16 @@ DoCreateContext(__GLXclientState * cl, GLXContextID gcId, glxc->drawPriv = NULL; glxc->readPriv = NULL; + /* The GLX_ARB_create_context_robustness spec says: + * + * "The default value for GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB + * is GLX_NO_RESET_NOTIFICATION_ARB." + * + * Without using glXCreateContextAttribsARB, there is no way to specify a + * non-default reset notification strategy. + */ + glxc->resetNotificationStrategy = GLX_NO_RESET_NOTIFICATION_ARB; + /* Add the new context to the various global tables of GLX contexts. */ if (!__glXAddContext(glxc)) { diff --git a/xorg-server/glx/glxcontext.h b/xorg-server/glx/glxcontext.h index b803a7fd1..4764e56f5 100644 --- a/xorg-server/glx/glxcontext.h +++ b/xorg-server/glx/glxcontext.h @@ -104,6 +104,11 @@ struct __GLXcontext { */ GLenum renderMode; + /** + * Reset notification strategy used when a GPU reset occurs. + */ + GLenum resetNotificationStrategy; + /* ** Buffers for feedback and selection. */ diff --git a/xorg-server/glx/glxdri2.c b/xorg-server/glx/glxdri2.c index 7b76c3a5f..1e99179d4 100644 --- a/xorg-server/glx/glxdri2.c +++ b/xorg-server/glx/glxdri2.c @@ -59,6 +59,16 @@ typedef struct __GLXDRIscreen __GLXDRIscreen; typedef struct __GLXDRIcontext __GLXDRIcontext; typedef struct __GLXDRIdrawable __GLXDRIdrawable; + +#ifdef __DRI2_ROBUSTNESS +#define ALL_DRI_CTX_FLAGS (__DRI_CTX_FLAG_DEBUG \ + | __DRI_CTX_FLAG_FORWARD_COMPATIBLE \ + | __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS) +#else +#define ALL_DRI_CTX_FLAGS (__DRI_CTX_FLAG_DEBUG \ + | __DRI_CTX_FLAG_FORWARD_COMPATIBLE) +#endif + struct __GLXDRIscreen { __GLXscreen base; __DRIscreen *driScreen; @@ -381,7 +391,7 @@ __glXDRIscreenDestroy(__GLXscreen * baseScreen) static Bool dri2_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs, unsigned *major_ver, unsigned *minor_ver, - uint32_t *flags, unsigned *error) + uint32_t *flags, int *api, int *reset, unsigned *error) { unsigned i; @@ -395,6 +405,11 @@ dri2_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs, *major_ver = 1; *minor_ver = 0; +#ifdef __DRI2_ROBUSTNESS + *reset = __DRI_CTX_RESET_NO_NOTIFICATION; +#else + (void) reset; +#endif for (i = 0; i < num_attribs; i++) { switch (attribs[i * 2]) { @@ -409,6 +424,42 @@ dri2_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs, break; case GLX_RENDER_TYPE: break; + case GLX_CONTEXT_PROFILE_MASK_ARB: + switch (attribs[i * 2 + 1]) { + case GLX_CONTEXT_CORE_PROFILE_BIT_ARB: + *api = __DRI_API_OPENGL_CORE; + break; + case GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB: + *api = __DRI_API_OPENGL; + break; + case GLX_CONTEXT_ES2_PROFILE_BIT_EXT: + *api = __DRI_API_GLES2; + break; + default: + *error = __glXError(GLXBadProfileARB); + return False; + } + break; +#ifdef __DRI2_ROBUSTNESS + case GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB: + if (screen->dri2->base.version >= 4) { + *error = BadValue; + return False; + } + + switch (attribs[i * 2 + 1]) { + case GLX_NO_RESET_NOTIFICATION_ARB: + *reset = __DRI_CTX_RESET_NO_NOTIFICATION; + break; + case GLX_LOSE_CONTEXT_ON_RESET_ARB: + *reset = __DRI_CTX_RESET_LOSE_CONTEXT; + break; + default: + *error = BadValue; + return False; + } + break; +#endif default: /* If an unknown attribute is received, fail. */ @@ -419,11 +470,21 @@ dri2_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs, /* Unknown flag value. */ - if (*flags & ~(__DRI_CTX_FLAG_DEBUG | __DRI_CTX_FLAG_FORWARD_COMPATIBLE)) { + if ((*flags & ~ALL_DRI_CTX_FLAGS) != 0) { *error = BadValue; return False; } + /* If the core profile is requested for a GL version is less than 3.2, + * request the non-core profile from the DRI driver. The core profile + * only makes sense for GL versions >= 3.2, and many DRI drivers that + * don't support OpenGL 3.2 may fail the request for a core profile. + */ + if (*api == __DRI_API_OPENGL_CORE + && (*major_ver < 3 || (*major_ver < 3 && *minor_ver < 2))) { + *api == __DRI_API_OPENGL; + } + *error = Success; return True; } @@ -447,11 +508,14 @@ create_driver_context(__GLXDRIcontext * context, unsigned major_ver; unsigned minor_ver; uint32_t flags; + int reset; + int api; if (num_attribs != 0) { if (!dri2_convert_glx_attribs(num_attribs, attribs, &major_ver, &minor_ver, - &flags, (unsigned *) error)) + &flags, &api, &reset, + (unsigned *) error)) return NULL; ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_MAJOR_VERSION; @@ -467,11 +531,19 @@ create_driver_context(__GLXDRIcontext * context, */ ctx_attribs[num_ctx_attribs++] = flags; } + +#ifdef __DRI2_ROBUSTNESS + if (reset != __DRI_CTX_NO_RESET_NOTIFICATION) { + ctx_attribs[num_ctx_attribs++] = + __DRI_CTX_ATTRIB_RESET_NOTIFICATION; + ctx_attribs[num_ctx_attribs++] = reset; + } +#endif } context->driContext = (*screen->dri2->createContextAttribs)(screen->driScreen, - __DRI_API_OPENGL, + api, config->driConfig, driShare, num_ctx_attribs / 2, @@ -786,7 +858,14 @@ initializeExtensions(__GLXDRIscreen * screen) if (screen->dri2->base.version >= 3) { __glXEnableExtension(screen->glx_enable_bits, "GLX_ARB_create_context"); + __glXEnableExtension(screen->glx_enable_bits, + "GLX_ARB_create_context_profile"); + __glXEnableExtension(screen->glx_enable_bits, + "GLX_EXT_create_context_es2_profile"); LogMessage(X_INFO, "AIGLX: enabled GLX_ARB_create_context\n"); + LogMessage(X_INFO, "AIGLX: enabled GLX_ARB_create_context_profile\n"); + LogMessage(X_INFO, + "AIGLX: enabled GLX_EXT_create_context_es2_profile\n"); } #endif @@ -823,6 +902,16 @@ initializeExtensions(__GLXDRIscreen * screen) } #endif +#ifdef __DRI2_ROBUSTNESS + if (strcmp(extensions[i]->name, __DRI2_ROBUSTNESS) == 0 && + screen->dri2->base.version >= 3) { + __glXEnableExtension(screen->glx_enable_bits, + "GLX_ARB_create_context_robustness"); + LogMessage(X_INFO, + "AIGLX: enabled GLX_ARB_create_context_robustness\n"); + } +#endif + /* Ignore unknown extensions */ } } diff --git a/xorg-server/glx/glxserver.h b/xorg-server/glx/glxserver.h index 87c94d9ec..24e3d626f 100644 --- a/xorg-server/glx/glxserver.h +++ b/xorg-server/glx/glxserver.h @@ -46,7 +46,6 @@ #include #include -#define GL_GLEXT_PROTOTYPES /* we want prototypes */ #include #include diff --git a/xorg-server/hw/dmx/input/dmxevents.c b/xorg-server/hw/dmx/input/dmxevents.c index f73480824..28756203b 100644 --- a/xorg-server/hw/dmx/input/dmxevents.c +++ b/xorg-server/hw/dmx/input/dmxevents.c @@ -227,25 +227,25 @@ dmxCoreMotion(DevicePtr pDev, int x, int y, int delta, DMXBlockType block) && pScreen->myNum == dmxScreen->index) { /* Screen is old screen */ if (block) - dmxSigioBlock(); + OsBlockSIGIO(); if (pDev) enqueueMotion(pDev, localX, localY); if (block) - dmxSigioUnblock(); + OsReleaseSIGIO(); } else { /* Screen is new */ DMXDBG4(" New screen: old=%d new=%d localX=%d localY=%d\n", pScreen->myNum, dmxScreen->index, localX, localY); if (block) - dmxSigioBlock(); + OsBlockSIGIO(); mieqProcessInputEvents(); miPointerSetScreen(inputInfo.pointer, dmxScreen->index, localX, localY); if (pDev) enqueueMotion(pDev, localX, localY); if (block) - dmxSigioUnblock(); + OsReleaseSIGIO(); } #if 00 miPointerGetPosition(inputInfo.pointer, &localX, &localY); @@ -387,12 +387,12 @@ dmxExtMotion(DMXLocalInputInfoPtr dmxLocal, } if (block) - dmxSigioBlock(); + OsBlockSIGIO(); valuator_mask_set_range(&mask, firstAxis, axesCount, v); QueuePointerEvents(pDevice, MotionNotify, 0, POINTER_ABSOLUTE, &mask); if (block) - dmxSigioUnblock(); + OsReleaseSIGIO(); } static int @@ -492,10 +492,10 @@ dmxTranslateAndEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal, valuator_mask_set_range(&mask, ke->first_axis, ke->axes_count, valuators); if (block) - dmxSigioBlock(); + OsBlockSIGIO(); QueueKeyboardEvents(pDevice, event, ke->keycode, &mask); if (block) - dmxSigioUnblock(); + OsReleaseSIGIO(); break; case XI_DeviceButtonPress: case XI_DeviceButtonRelease: @@ -503,11 +503,11 @@ dmxTranslateAndEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal, valuator_mask_set_range(&mask, ke->first_axis, ke->axes_count, valuators); if (block) - dmxSigioBlock(); + OsBlockSIGIO(); QueuePointerEvents(pDevice, event, ke->keycode, POINTER_ABSOLUTE, &mask); if (block) - dmxSigioUnblock(); + OsReleaseSIGIO(); break; case XI_ProximityIn: case XI_ProximityOut: @@ -515,10 +515,10 @@ dmxTranslateAndEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal, valuator_mask_set_range(&mask, ke->first_axis, ke->axes_count, valuators); if (block) - dmxSigioBlock(); + OsBlockSIGIO(); QueueProximityEvents(pDevice, event, &mask); if (block) - dmxSigioUnblock(); + OsReleaseSIGIO(); break; break; diff --git a/xorg-server/hw/dmx/input/dmxsigio.c b/xorg-server/hw/dmx/input/dmxsigio.c index 9b1b493b8..6ef543c8b 100644 --- a/xorg-server/hw/dmx/input/dmxsigio.c +++ b/xorg-server/hw/dmx/input/dmxsigio.c @@ -84,28 +84,6 @@ dmxSigioHandler(int sig) } } -/** Block SIGIO handling. */ -void -dmxSigioBlock(void) -{ - sigset_t s; - - sigemptyset(&s); - sigaddset(&s, SIGIO); - sigprocmask(SIG_BLOCK, &s, 0); -} - -/** Unblock SIGIO handling. */ -void -dmxSigioUnblock(void) -{ - sigset_t s; - - sigemptyset(&s); - sigaddset(&s, SIGIO); - sigprocmask(SIG_UNBLOCK, &s, 0); -} - static void dmxSigioHook(void) { diff --git a/xorg-server/hw/dmx/input/dmxsigio.h b/xorg-server/hw/dmx/input/dmxsigio.h index 4e4874929..9f30662d1 100644 --- a/xorg-server/hw/dmx/input/dmxsigio.h +++ b/xorg-server/hw/dmx/input/dmxsigio.h @@ -36,8 +36,6 @@ #ifndef _DMXSIGIO_H_ #define _DMXSIGIO_H_ -extern void dmxSigioBlock(void); -extern void dmxSigioUnblock(void); extern void dmxSigioEnableInput(void); extern void dmxSigioDisableInput(void); extern void dmxSigioRegister(DMXInputInfo * dmxInput, int fd); diff --git a/xorg-server/hw/kdrive/ephyr/ephyr.c b/xorg-server/hw/kdrive/ephyr/ephyr.c index 8eda539aa..fe3dae66e 100644 --- a/xorg-server/hw/kdrive/ephyr/ephyr.c +++ b/xorg-server/hw/kdrive/ephyr/ephyr.c @@ -772,26 +772,6 @@ ephyrUpdateModifierState(unsigned int state) } } -static void -ephyrBlockSigio(void) -{ - sigset_t set; - - sigemptyset(&set); - sigaddset(&set, SIGIO); - sigprocmask(SIG_BLOCK, &set, 0); -} - -static void -ephyrUnblockSigio(void) -{ - sigset_t set; - - sigemptyset(&set); - sigaddset(&set, SIGIO); - sigprocmask(SIG_UNBLOCK, &set, 0); -} - static Bool ephyrCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y) { @@ -808,11 +788,11 @@ int ephyrCurScreen; /*current event screen */ static void ephyrWarpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) { - ephyrBlockSigio(); + OsBlockSIGIO(); ephyrCurScreen = pScreen->myNum; miPointerWarpCursor(inputInfo.pointer, pScreen, x, y); - ephyrUnblockSigio(); + OsReleaseSIGIO(); } miPointerScreenFuncRec ephyrPointerScreenFuncs = { diff --git a/xorg-server/hw/kdrive/src/kinput.c b/xorg-server/hw/kdrive/src/kinput.c index 0e06fd42f..b1068bbee 100644 --- a/xorg-server/hw/kdrive/src/kinput.c +++ b/xorg-server/hw/kdrive/src/kinput.c @@ -102,26 +102,6 @@ KdSigio(int sig) (*kdInputFds[i].read) (kdInputFds[i].fd, kdInputFds[i].closure); } -static void -KdBlockSigio(void) -{ - sigset_t set; - - sigemptyset(&set); - sigaddset(&set, SIGIO); - sigprocmask(SIG_BLOCK, &set, 0); -} - -static void -KdUnblockSigio(void) -{ - sigset_t set; - - sigemptyset(&set); - sigaddset(&set, SIGIO); - sigprocmask(SIG_UNBLOCK, &set, 0); -} - #ifdef DEBUG_SIGIO void @@ -261,7 +241,7 @@ KdDisableInput(void) KdPointerInfo *pi; int found = 0, i = 0; - KdBlockSigio(); + OsBlockSIGIO(); for (ki = kdKeyboards; ki; ki = ki->next) { if (ki->driver && ki->driver->Disable) @@ -343,7 +323,7 @@ KdEnableInput(void) NoticeEventTime(&ev, pi->dixdev); NoticeEventTime(&ev, ki->dixdev); - KdUnblockSigio(); + OsReleaseSIGIO(); } static KdKeyboardDriver * @@ -1801,7 +1781,7 @@ KdReleaseAllKeys(void) int key; KdKeyboardInfo *ki; - KdBlockSigio(); + OsBlockSIGIO(); for (ki = kdKeyboards; ki; ki = ki->next) { for (key = ki->keySyms.minKeyCode; key < ki->keySyms.maxKeyCode; key++) { @@ -1812,7 +1792,7 @@ KdReleaseAllKeys(void) } } - KdUnblockSigio(); + OsReleaseSIGIO(); #endif } @@ -2008,18 +1988,18 @@ KdWakeupHandler(ScreenPtr pScreen, unsigned long lresult, pointer readmask) if (kdInputEnabled && result > 0) { for (i = 0; i < kdNumInputFds; i++) if (FD_ISSET(kdInputFds[i].fd, pReadmask)) { - KdBlockSigio(); + OsBlockSIGIO(); (*kdInputFds[i].read) (kdInputFds[i].fd, kdInputFds[i].closure); - KdUnblockSigio(); + OsReleaseSIGIO(); } } for (pi = kdPointers; pi; pi = pi->next) { if (pi->timeoutPending) { if ((long) (GetTimeInMillis() - pi->emulationTimeout) >= 0) { pi->timeoutPending = FALSE; - KdBlockSigio(); + OsBlockSIGIO(); KdReceiveTimeout(pi); - KdUnblockSigio(); + OsReleaseSIGIO(); } } } @@ -2116,10 +2096,10 @@ int KdCurScreen; /* current event screen */ static void KdWarpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) { - KdBlockSigio(); + OsBlockSIGIO(); KdCurScreen = pScreen->myNum; miPointerWarpCursor(pDev, pScreen, x, y); - KdUnblockSigio(); + OsReleaseSIGIO(); } miPointerScreenFuncRec kdPointerScreenFuncs = { diff --git a/xorg-server/hw/xfree86/common/xf86Config.c b/xorg-server/hw/xfree86/common/xf86Config.c index b22b617a4..3ec40fe9b 100644 --- a/xorg-server/hw/xfree86/common/xf86Config.c +++ b/xorg-server/hw/xfree86/common/xf86Config.c @@ -2329,6 +2329,7 @@ checkInput(serverLayoutPtr layout, Bool implicit_layout) current = dev; free(*dev); + *dev = NULL; do { *current = *(current + 1); diff --git a/xorg-server/hw/xfree86/common/xf86Cursor.c b/xorg-server/hw/xfree86/common/xf86Cursor.c index c01cfd138..65a9e8264 100644 --- a/xorg-server/hw/xfree86/common/xf86Cursor.c +++ b/xorg-server/hw/xfree86/common/xf86Cursor.c @@ -199,7 +199,7 @@ xf86SwitchMode(ScreenPtr pScreen, DisplayModePtr mode) ScrnInfoPtr pScr = xf86ScreenToScrn(pScreen); ScreenPtr pCursorScreen; Bool Switched; - int px, py, was_blocked; + int px, py; DeviceIntPtr dev, it; if (!pScr->vtSema || !mode || !pScr->SwitchMode) @@ -228,7 +228,7 @@ xf86SwitchMode(ScreenPtr pScreen, DisplayModePtr mode) if (pScreen == pCursorScreen) miPointerGetPosition(dev, &px, &py); - was_blocked = xf86BlockSIGIO(); + OsBlockSIGIO(); Switched = (*pScr->SwitchMode) (pScr, mode); if (Switched) { pScr->currentMode = mode; @@ -267,7 +267,7 @@ xf86SwitchMode(ScreenPtr pScreen, DisplayModePtr mode) pScr->frameY1 = pScr->virtualY - 1; } } - xf86UnblockSIGIO(was_blocked); + OsReleaseSIGIO(); if (pScr->AdjustFrame) (*pScr->AdjustFrame) (pScr, pScr->frameX0, pScr->frameY0); @@ -469,13 +469,11 @@ xf86CrossScreen(ScreenPtr pScreen, Bool entering) static void xf86WarpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) { - int sigstate; - - sigstate = xf86BlockSIGIO(); + OsBlockSIGIO(); miPointerWarpCursor(pDev, pScreen, x, y); xf86Info.currentScreen = pScreen; - xf86UnblockSIGIO(sigstate); + OsReleaseSIGIO(); } void * diff --git a/xorg-server/hw/xfree86/common/xf86Events.c b/xorg-server/hw/xfree86/common/xf86Events.c index 4fcad4000..47429ecfe 100644 --- a/xorg-server/hw/xfree86/common/xf86Events.c +++ b/xorg-server/hw/xfree86/common/xf86Events.c @@ -254,7 +254,7 @@ xf86Wakeup(pointer blockData, int err, pointer pReadmask) while (pInfo) { if (pInfo->read_input && pInfo->fd >= 0 && (FD_ISSET(pInfo->fd, &devicesWithInput) != 0)) { - int sigstate = xf86BlockSIGIO(); + OsBlockSIGIO(); /* * Remove the descriptior from the set because more than one @@ -263,7 +263,7 @@ xf86Wakeup(pointer blockData, int err, pointer pReadmask) FD_CLR(pInfo->fd, &devicesWithInput); pInfo->read_input(pInfo); - xf86UnblockSIGIO(sigstate); + OsReleaseSIGIO(); } pInfo = pInfo->next; } @@ -397,9 +397,9 @@ xf86ReleaseKeys(DeviceIntPtr pDev) for (i = keyc->xkbInfo->desc->min_key_code; i < keyc->xkbInfo->desc->max_key_code; i++) { if (key_is_down(pDev, i, KEY_POSTED)) { - sigstate = xf86BlockSIGIO(); + OsBlockSIGIO(); QueueKeyboardEvents(pDev, KeyRelease, i, NULL); - xf86UnblockSIGIO(sigstate); + OsReleaseSIGIO(); } } } @@ -457,7 +457,7 @@ xf86VTSwitch(void) } } - prevSIGIO = xf86BlockSIGIO(); + OsBlockSIGIO(); for (i = 0; i < xf86NumScreens; i++) xf86Screens[i]->LeaveVT(xf86Screens[i]); @@ -492,7 +492,7 @@ xf86VTSwitch(void) for (ih = InputHandlers; ih; ih = ih->next) xf86EnableInputHandler(ih); - xf86UnblockSIGIO(prevSIGIO); + OsReleaseSIGIO(); } else { @@ -549,7 +549,7 @@ xf86VTSwitch(void) for (ih = InputHandlers; ih; ih = ih->next) xf86EnableInputHandler(ih); - xf86UnblockSIGIO(prevSIGIO); + OsReleaseSIGIO(); } } diff --git a/xorg-server/hw/xfree86/common/xf86Init.c b/xorg-server/hw/xfree86/common/xf86Init.c index 84c866944..1f5a382b7 100644 --- a/xorg-server/hw/xfree86/common/xf86Init.c +++ b/xorg-server/hw/xfree86/common/xf86Init.c @@ -394,7 +394,7 @@ InstallSignalHandlers(void) void InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv) { - int i, j, k, scr_index, was_blocked = 0; + int i, j, k, scr_index; char **modulelist; pointer *optionlist; Pix24Flags screenpix24, pix24; @@ -806,7 +806,7 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv) ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ); #endif xf86AccessEnter(); - was_blocked = xf86BlockSIGIO(); + OsBlockSIGIO(); } } @@ -879,7 +879,7 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv) } xf86VGAarbiterWrapFunctions(); - xf86UnblockSIGIO(was_blocked); + OsReleaseSIGIO(); xf86InitOrigins(); @@ -964,6 +964,7 @@ OsVendorInit(void) } #endif #endif + OsReleaseSIGIO(); beenHere = TRUE; } @@ -1022,7 +1023,7 @@ AbortDDX(enum ExitCode error) { int i; - xf86BlockSIGIO(); + OsBlockSIGIO(); /* * try to restore the original video state diff --git a/xorg-server/hw/xfree86/common/xf86PM.c b/xorg-server/hw/xfree86/common/xf86PM.c index 1830640d5..15257cb81 100644 --- a/xorg-server/hw/xfree86/common/xf86PM.c +++ b/xorg-server/hw/xfree86/common/xf86PM.c @@ -92,8 +92,6 @@ eventName(pmEvent event, const char **str) } } -static int sigio_blocked_for_suspend; - static void suspend(pmEvent event, Bool undo) { @@ -109,7 +107,7 @@ suspend(pmEvent event, Bool undo) DisableDevice(pInfo->dev, TRUE); pInfo = pInfo->next; } - sigio_blocked_for_suspend = xf86BlockSIGIO(); + OsBlockSIGIO(); for (i = 0; i < xf86NumScreens; i++) { if (xf86Screens[i]->PMEvent) xf86Screens[i]->PMEvent(xf86Screens[i], event, undo); @@ -137,7 +135,7 @@ resume(pmEvent event, Bool undo) xf86Screens[i]->EnterVT(xf86Screens[i]); } } - xf86UnblockSIGIO(sigio_blocked_for_suspend); + OsReleaseSIGIO(); for (i = 0; i < xf86NumScreens; i++) { if (xf86Screens[i]->EnableDisableFBAccess) (*xf86Screens[i]->EnableDisableFBAccess) (xf86Screens[i], TRUE); @@ -153,7 +151,7 @@ resume(pmEvent event, Bool undo) static void DoApmEvent(pmEvent event, Bool undo) { - int i, was_blocked; + int i; switch (event) { #if 0 @@ -184,13 +182,13 @@ DoApmEvent(pmEvent event, Bool undo) } break; default: - was_blocked = xf86BlockSIGIO(); + OsBlockSIGIO(); for (i = 0; i < xf86NumScreens; i++) { if (xf86Screens[i]->PMEvent) { xf86Screens[i]->PMEvent(xf86Screens[i], event, undo); } } - xf86UnblockSIGIO(was_blocked); + OsReleaseSIGIO(); break; } } diff --git a/xorg-server/hw/xfree86/loader/loader.c b/xorg-server/hw/xfree86/loader/loader.c index edaefb8f9..5fbea38f8 100644 --- a/xorg-server/hw/xfree86/loader/loader.c +++ b/xorg-server/hw/xfree86/loader/loader.c @@ -160,6 +160,12 @@ LoaderSymbol(const char *name) return NULL; } +void * +LoaderSymbolFromModule(void *handle, const char *name) +{ + return dlsym(handle, name); +} + void LoaderUnload(const char *name, void *handle) { diff --git a/xorg-server/hw/xfree86/loader/loader.h b/xorg-server/hw/xfree86/loader/loader.h index 5cadd5ad6..c89c6410a 100644 --- a/xorg-server/hw/xfree86/loader/loader.h +++ b/xorg-server/hw/xfree86/loader/loader.h @@ -72,5 +72,6 @@ extern unsigned long LoaderOptions; /* Internal Functions */ void *LoaderOpen(const char *, int *, int *); +void *LoaderSymbolFromModule(void *, const char *); #endif /* _LOADER_H */ diff --git a/xorg-server/hw/xfree86/loader/loadmod.c b/xorg-server/hw/xfree86/loader/loadmod.c index 72020a58c..dd2057318 100644 --- a/xorg-server/hw/xfree86/loader/loadmod.c +++ b/xorg-server/hw/xfree86/loader/loadmod.c @@ -956,7 +956,7 @@ doLoadModule(const char *module, const char *path, const char **subdirlist, *errmin = 0; goto LoadModule_fail; } - initdata = LoaderSymbol(p); + initdata = LoaderSymbolFromModule(ret->handle, p); if (initdata) { ModuleSetupProc setup; ModuleTearDownProc teardown; diff --git a/xorg-server/hw/xfree86/os-support/shared/sigio.c b/xorg-server/hw/xfree86/os-support/shared/sigio.c index 231d6c04f..f3c153b89 100644 --- a/xorg-server/hw/xfree86/os-support/shared/sigio.c +++ b/xorg-server/hw/xfree86/os-support/shared/sigio.c @@ -136,7 +136,6 @@ xf86InstallSIGIOHandler(int fd, void (*f) (int, void *), void *closure) struct sigaction sa; struct sigaction osa; int i; - int blocked; int installed = FALSE; if (!xf86Info.useSIGIO) @@ -146,7 +145,7 @@ xf86InstallSIGIOHandler(int fd, void (*f) (int, void *), void *closure) if (!xf86SigIOFuncs[i].f) { if (xf86IsPipe(fd)) return 0; - blocked = xf86BlockSIGIO(); + OsBlockSIGIO(); #ifdef O_ASYNC if (fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_ASYNC) == -1) { xf86Msg(X_WARNING, "fcntl(%d, O_ASYNC): %s\n", @@ -174,7 +173,7 @@ xf86InstallSIGIOHandler(int fd, void (*f) (int, void *), void *closure) } #endif if (!installed) { - xf86UnblockSIGIO(blocked); + OsReleaseSIGIO(); return 0; } sigemptyset(&sa.sa_mask); @@ -190,7 +189,7 @@ xf86InstallSIGIOHandler(int fd, void (*f) (int, void *), void *closure) if (fd >= xf86SigIOMaxFd) xf86SigIOMaxFd = fd + 1; FD_SET(fd, &xf86SigIOMask); - xf86UnblockSIGIO(blocked); + OsReleaseSIGIO(); return 1; } /* Allow overwriting of the closure and callback */ @@ -263,26 +262,13 @@ xf86RemoveSIGIOHandler(int fd) int xf86BlockSIGIO(void) { - sigset_t set, old; - int ret; - - sigemptyset(&set); - sigaddset(&set, SIGIO); - sigprocmask(SIG_BLOCK, &set, &old); - ret = sigismember(&old, SIGIO); - return ret; + return OsBlockSIGIO(); } void xf86UnblockSIGIO(int wasset) { - sigset_t set; - - if (!wasset) { - sigemptyset(&set); - sigaddset(&set, SIGIO); - sigprocmask(SIG_UNBLOCK, &set, NULL); - } + OsReleaseSIGIO(); } void diff --git a/xorg-server/include/list.h b/xorg-server/include/list.h index 96c0bcbd6..d54a207b1 100644 --- a/xorg-server/include/list.h +++ b/xorg-server/include/list.h @@ -453,7 +453,7 @@ xorg_list_is_empty(struct xorg_list *head) #define nt_list_del(_entry, _list, _type, _member) \ do { \ _type *__e = _entry; \ - if (__e == NULL) break; \ + if (__e == NULL || _list == NULL) break; \ if ((_list) == __e) { \ _list = __e->_member; \ } else { \ diff --git a/xorg-server/include/os.h b/xorg-server/include/os.h index e93c48ae6..34ca1f557 100644 --- a/xorg-server/include/os.h +++ b/xorg-server/include/os.h @@ -334,6 +334,12 @@ OsBlockSignals(void); extern _X_EXPORT void OsReleaseSignals(void); +extern _X_EXPORT int +OsBlockSIGIO(void); + +extern _X_EXPORT void +OsReleaseSIGIO(void); + extern _X_EXPORT void OsAbort(void) _X_NORETURN; diff --git a/xorg-server/include/privates.h b/xorg-server/include/privates.h index c34b9512c..2c8864b8a 100644 --- a/xorg-server/include/privates.h +++ b/xorg-server/include/privates.h @@ -33,9 +33,9 @@ typedef enum { PRIVATE_SCREEN, PRIVATE_EXTENSION, PRIVATE_COLORMAP, + PRIVATE_DEVICE, /* These cannot have any objects before all relevant keys are registered */ - PRIVATE_DEVICE, PRIVATE_CLIENT, PRIVATE_PROPERTY, PRIVATE_SELECTION, @@ -66,6 +66,13 @@ typedef struct _DevPrivateKeyRec { struct _DevPrivateKeyRec *next; } DevPrivateKeyRec, *DevPrivateKey; +typedef struct _DevPrivateSetRec { + DevPrivateKey key; + unsigned offset; + int created; + int allocated; +} DevPrivateSetRec, *DevPrivateSetPtr; + typedef struct _DevScreenPrivateKeyRec { DevPrivateKeyRec screenKey; } DevScreenPrivateKeyRec, *DevScreenPrivateKey; @@ -218,6 +225,51 @@ dixLookupScreenPrivateAddr(PrivatePtr *privates, const DevScreenPrivateKey key, _dixGetScreenPrivateKey(key, pScreen)); } +/* + * These functions relate to allocations related to a specific screen; + * space will only be available for objects allocated for use on that + * screen. As such, only objects which are related directly to a specific + * screen are candidates for allocation this way, this includes + * windows, pixmaps, gcs, pictures and colormaps. This key is + * used just like any other key using dixGetPrivate and friends. + * + * This is distinctly different from the ScreenPrivateKeys above which + * allocate space in global objects like cursor bits for a specific + * screen, allowing multiple screen-related chunks of storage in a + * single global object. + */ + +#define HAVE_SCREEN_SPECIFIC_PRIVATE_KEYS 1 + +extern _X_EXPORT Bool +dixRegisterScreenSpecificPrivateKey(ScreenPtr pScreen, DevPrivateKey key, + DevPrivateType type, unsigned size); + +/* Clean up screen-specific privates before CloseScreen */ +extern void +dixFreeScreenSpecificPrivates(ScreenPtr pScreen); + +/* Initialize screen-specific privates in AddScreen */ +extern void +dixInitScreenSpecificPrivates(ScreenPtr pScreen); + +extern _X_EXPORT void * +_dixAllocateScreenObjectWithPrivates(ScreenPtr pScreen, + unsigned size, + unsigned clear, + unsigned offset, + DevPrivateType type); + +#define dixAllocateScreenObjectWithPrivates(s, t, type) _dixAllocateScreenObjectWithPrivates(s, sizeof(t), sizeof(t), offsetof(t, devPrivates), type) + +extern _X_EXPORT int +dixScreenSpecificPrivatesSize(ScreenPtr pScreen, DevPrivateType type); + +extern _X_EXPORT void +_dixInitScreenPrivates(ScreenPtr pScreen, PrivatePtr *privates, void *addr, DevPrivateType type); + +#define dixInitScreenPrivates(s, o, v, type) _dixInitScreenPrivates(s, &(o)->devPrivates, (v), type); + /* * Allocates private data separately from main object. * @@ -240,7 +292,7 @@ extern _X_EXPORT void * Initialize privates by zeroing them */ extern _X_EXPORT void - _dixInitPrivates(PrivatePtr *privates, void *addr, DevPrivateType type); +_dixInitPrivates(PrivatePtr *privates, void *addr, DevPrivateType type); #define dixInitPrivates(o, v, type) _dixInitPrivates(&(o)->devPrivates, (v), type); diff --git a/xorg-server/include/scrnintstr.h b/xorg-server/include/scrnintstr.h index c592d1ffe..7af2bf53f 100644 --- a/xorg-server/include/scrnintstr.h +++ b/xorg-server/include/scrnintstr.h @@ -367,6 +367,8 @@ typedef struct _Screen { WindowPtr root; ScreenSaverStuffRec screensaver; + DevPrivateSetRec screenSpecificPrivates[PRIVATE_LAST]; + /* Random screen procedures */ CloseScreenProcPtr CloseScreen; diff --git a/xorg-server/mi/midispcur.c b/xorg-server/mi/midispcur.c index df141cdc7..edca9696f 100644 --- a/xorg-server/mi/midispcur.c +++ b/xorg-server/mi/midispcur.c @@ -56,9 +56,7 @@ in this Software without prior written authorization from The Open Group. static DevPrivateKeyRec miDCScreenKeyRec; #define miDCScreenKey (&miDCScreenKeyRec) -static DevScreenPrivateKeyRec miDCCursorBitsKeyRec; -#define miDCCursorBitsKey (&miDCCursorBitsKeyRec) static DevScreenPrivateKeyRec miDCDeviceKeyRec; #define miDCDeviceKey (&miDCDeviceKeyRec) @@ -86,18 +84,15 @@ typedef struct { */ typedef struct { CloseScreenProcPtr CloseScreen; -} miDCScreenRec, *miDCScreenPtr; - -#define miGetDCScreen(s) ((miDCScreenPtr)(dixLookupPrivate(&(s)->devPrivates, miDCScreenKey))) - -/* per-cursor per-screen private data */ -typedef struct { PixmapPtr sourceBits; /* source bits */ PixmapPtr maskBits; /* mask bits */ #ifdef ARGB_CURSOR PicturePtr pPicture; #endif -} miDCCursorRec, *miDCCursorPtr; + CursorPtr pCursor; +} miDCScreenRec, *miDCScreenPtr; + +#define miGetDCScreen(s) ((miDCScreenPtr)(dixLookupPrivate(&(s)->devPrivates, miDCScreenKey))) Bool miDCInitialize(ScreenPtr pScreen, miPointerScreenFuncPtr screenFuncs) @@ -105,13 +100,11 @@ miDCInitialize(ScreenPtr pScreen, miPointerScreenFuncPtr screenFuncs) miDCScreenPtr pScreenPriv; if (!dixRegisterPrivateKey(&miDCScreenKeyRec, PRIVATE_SCREEN, 0) || - !dixRegisterScreenPrivateKey(&miDCCursorBitsKeyRec, pScreen, - PRIVATE_CURSOR_BITS, 0) || !dixRegisterScreenPrivateKey(&miDCDeviceKeyRec, pScreen, PRIVATE_DEVICE, 0)) return FALSE; - pScreenPriv = malloc(sizeof(miDCScreenRec)); + pScreenPriv = calloc(1, sizeof(miDCScreenRec)); if (!pScreenPriv) return FALSE; @@ -127,6 +120,28 @@ miDCInitialize(ScreenPtr pScreen, miPointerScreenFuncPtr screenFuncs) return TRUE; } +static void +miDCSwitchScreenCursor(ScreenPtr pScreen, CursorPtr pCursor, PixmapPtr sourceBits, PixmapPtr maskBits, PicturePtr pPicture) +{ + miDCScreenPtr pScreenPriv = dixLookupPrivate(&pScreen->devPrivates, miDCScreenKey); + + if (pScreenPriv->sourceBits) + (*pScreen->DestroyPixmap)(pScreenPriv->sourceBits); + pScreenPriv->sourceBits = sourceBits; + + if (pScreenPriv->maskBits) + (*pScreen->DestroyPixmap)(pScreenPriv->maskBits); + pScreenPriv->maskBits = maskBits; + +#ifdef ARGB_CURSOR + if (pScreenPriv->pPicture) + FreePicture(pScreenPriv->pPicture, 0); + pScreenPriv->pPicture = pPicture; +#endif + + pScreenPriv->pCursor = pCursor; +} + static Bool miDCCloseScreen(ScreenPtr pScreen) { @@ -135,6 +150,8 @@ miDCCloseScreen(ScreenPtr pScreen) pScreenPriv = (miDCScreenPtr) dixLookupPrivate(&pScreen->devPrivates, miDCScreenKey); pScreen->CloseScreen = pScreenPriv->CloseScreen; + + miDCSwitchScreenCursor(pScreen, NULL, NULL, NULL, NULL); free((pointer) pScreenPriv); return (*pScreen->CloseScreen) (pScreen); } @@ -142,9 +159,6 @@ miDCCloseScreen(ScreenPtr pScreen) Bool miDCRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor) { - if (pCursor->bits->refcnt <= 1) - dixSetScreenPrivate(&pCursor->bits->devPrivates, miDCCursorBitsKey, - pScreen, NULL); return TRUE; } @@ -154,8 +168,6 @@ miDCRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor) static PicturePtr miDCMakePicture(PicturePtr * ppPicture, DrawablePtr pDraw, WindowPtr pWin) { - ScreenPtr pScreen = pDraw->pScreen; - VisualPtr pVisual; PictFormatPtr pFormat; XID subwindow_mode = IncludeInferiors; PicturePtr pPicture; @@ -172,42 +184,39 @@ miDCMakePicture(PicturePtr * ppPicture, DrawablePtr pDraw, WindowPtr pWin) } #endif -static miDCCursorPtr +static Bool miDCRealize(ScreenPtr pScreen, CursorPtr pCursor) { - miDCCursorPtr pPriv; + miDCScreenPtr pScreenPriv = dixLookupPrivate(&pScreen->devPrivates, miDCScreenKey); GCPtr pGC; ChangeGCVal gcvals; + PixmapPtr sourceBits, maskBits; + + if (pScreenPriv->pCursor == pCursor) + return TRUE; - pPriv = malloc(sizeof(miDCCursorRec)); - if (!pPriv) - return NULL; #ifdef ARGB_CURSOR + if (pCursor->bits->argb) { PixmapPtr pPixmap; PictFormatPtr pFormat; int error; + PicturePtr pPicture; pFormat = PictureMatchFormat(pScreen, 32, PICT_a8r8g8b8); - if (!pFormat) { - free((pointer) pPriv); - return NULL; - } + if (!pFormat) + return FALSE; - pPriv->sourceBits = 0; - pPriv->maskBits = 0; pPixmap = (*pScreen->CreatePixmap) (pScreen, pCursor->bits->width, pCursor->bits->height, 32, CREATE_PIXMAP_USAGE_SCRATCH); - if (!pPixmap) { - free((pointer) pPriv); - return NULL; - } + if (!pPixmap) + return FALSE; + pGC = GetScratchGC(32, pScreen); if (!pGC) { (*pScreen->DestroyPixmap) (pPixmap); - free((pointer) pPriv); - return NULL; + return FALSE; } ValidateGC(&pPixmap->drawable, pGC); (*pGC->ops->PutImage) (&pPixmap->drawable, pGC, 32, @@ -215,105 +224,86 @@ miDCRealize(ScreenPtr pScreen, CursorPtr pCursor) pCursor->bits->height, 0, ZPixmap, (char *) pCursor->bits->argb); FreeScratchGC(pGC); - pPriv->pPicture = CreatePicture(0, &pPixmap->drawable, - pFormat, 0, 0, serverClient, &error); + pPicture = CreatePicture(0, &pPixmap->drawable, + pFormat, 0, 0, serverClient, &error); (*pScreen->DestroyPixmap) (pPixmap); - if (!pPriv->pPicture) { - free((pointer) pPriv); - return NULL; - } - dixSetScreenPrivate(&pCursor->bits->devPrivates, miDCCursorBitsKey, - pScreen, pPriv); - return pPriv; + if (!pPicture) + return FALSE; + + miDCSwitchScreenCursor(pScreen, pCursor, NULL, NULL, pPicture); + return TRUE; } - pPriv->pPicture = 0; #endif - pPriv->sourceBits = - (*pScreen->CreatePixmap) (pScreen, pCursor->bits->width, - pCursor->bits->height, 1, 0); - if (!pPriv->sourceBits) { - free((pointer) pPriv); - return NULL; - } - pPriv->maskBits = - (*pScreen->CreatePixmap) (pScreen, pCursor->bits->width, - pCursor->bits->height, 1, 0); - if (!pPriv->maskBits) { - (*pScreen->DestroyPixmap) (pPriv->sourceBits); - free((pointer) pPriv); - return NULL; + sourceBits = (*pScreen->CreatePixmap) (pScreen, pCursor->bits->width, + pCursor->bits->height, 1, 0); + if (!sourceBits) + return FALSE; + + maskBits = (*pScreen->CreatePixmap) (pScreen, pCursor->bits->width, + pCursor->bits->height, 1, 0); + if (!maskBits) { + (*pScreen->DestroyPixmap) (sourceBits); + return FALSE; } - dixSetScreenPrivate(&pCursor->bits->devPrivates, miDCCursorBitsKey, pScreen, - pPriv); /* create the two sets of bits, clipping as appropriate */ pGC = GetScratchGC(1, pScreen); if (!pGC) { - (void) miDCUnrealizeCursor(pScreen, pCursor); - return NULL; + (*pScreen->DestroyPixmap) (sourceBits); + (*pScreen->DestroyPixmap) (maskBits); + return FALSE; } - ValidateGC((DrawablePtr) pPriv->sourceBits, pGC); - (*pGC->ops->PutImage) ((DrawablePtr) pPriv->sourceBits, pGC, 1, + ValidateGC((DrawablePtr) sourceBits, pGC); + (*pGC->ops->PutImage) ((DrawablePtr) sourceBits, pGC, 1, 0, 0, pCursor->bits->width, pCursor->bits->height, 0, XYPixmap, (char *) pCursor->bits->source); gcvals.val = GXand; ChangeGC(NullClient, pGC, GCFunction, &gcvals); - ValidateGC((DrawablePtr) pPriv->sourceBits, pGC); - (*pGC->ops->PutImage) ((DrawablePtr) pPriv->sourceBits, pGC, 1, + ValidateGC((DrawablePtr) sourceBits, pGC); + (*pGC->ops->PutImage) ((DrawablePtr) sourceBits, pGC, 1, 0, 0, pCursor->bits->width, pCursor->bits->height, 0, XYPixmap, (char *) pCursor->bits->mask); /* mask bits -- pCursor->mask & ~pCursor->source */ gcvals.val = GXcopy; ChangeGC(NullClient, pGC, GCFunction, &gcvals); - ValidateGC((DrawablePtr) pPriv->maskBits, pGC); - (*pGC->ops->PutImage) ((DrawablePtr) pPriv->maskBits, pGC, 1, + ValidateGC((DrawablePtr) maskBits, pGC); + (*pGC->ops->PutImage) ((DrawablePtr) maskBits, pGC, 1, 0, 0, pCursor->bits->width, pCursor->bits->height, 0, XYPixmap, (char *) pCursor->bits->mask); gcvals.val = GXandInverted; ChangeGC(NullClient, pGC, GCFunction, &gcvals); - ValidateGC((DrawablePtr) pPriv->maskBits, pGC); - (*pGC->ops->PutImage) ((DrawablePtr) pPriv->maskBits, pGC, 1, + ValidateGC((DrawablePtr) maskBits, pGC); + (*pGC->ops->PutImage) ((DrawablePtr) maskBits, pGC, 1, 0, 0, pCursor->bits->width, pCursor->bits->height, 0, XYPixmap, (char *) pCursor->bits->source); FreeScratchGC(pGC); - return pPriv; + + miDCSwitchScreenCursor(pScreen, pCursor, sourceBits, maskBits, NULL); + return TRUE; } Bool miDCUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor) { - miDCCursorPtr pPriv; - - pPriv = (miDCCursorPtr) dixLookupScreenPrivate(&pCursor->bits->devPrivates, - miDCCursorBitsKey, pScreen); - if (pPriv && (pCursor->bits->refcnt <= 1)) { - if (pPriv->sourceBits) - (*pScreen->DestroyPixmap) (pPriv->sourceBits); - if (pPriv->maskBits) - (*pScreen->DestroyPixmap) (pPriv->maskBits); -#ifdef ARGB_CURSOR - if (pPriv->pPicture) - FreePicture(pPriv->pPicture, 0); -#endif - free((pointer) pPriv); - dixSetScreenPrivate(&pCursor->bits->devPrivates, miDCCursorBitsKey, - pScreen, NULL); - } + miDCScreenPtr pScreenPriv = dixLookupPrivate(&pScreen->devPrivates, miDCScreenKey); + + if (pCursor == pScreenPriv->pCursor) + miDCSwitchScreenCursor(pScreen, NULL, NULL, NULL, NULL); return TRUE; } static void miDCPutBits(DrawablePtr pDrawable, - miDCCursorPtr pPriv, GCPtr sourceGC, GCPtr maskGC, int x_org, int y_org, unsigned w, unsigned h, unsigned long source, unsigned long mask) { + miDCScreenPtr pScreenPriv = dixLookupPrivate(&pDrawable->pScreen->devPrivates, miDCScreenKey); ChangeGCVal gcval; int x, y; @@ -333,7 +323,7 @@ miDCPutBits(DrawablePtr pDrawable, y = y_org; } - (*sourceGC->ops->PushPixels) (sourceGC, pPriv->sourceBits, pDrawable, w, h, + (*sourceGC->ops->PushPixels) (sourceGC, pScreenPriv->sourceBits, pDrawable, w, h, x, y); if (maskGC->fgPixel != mask) { gcval.val = mask; @@ -351,7 +341,7 @@ miDCPutBits(DrawablePtr pDrawable, y = y_org; } - (*maskGC->ops->PushPixels) (maskGC, pPriv->maskBits, pDrawable, w, h, x, y); + (*maskGC->ops->PushPixels) (maskGC, pScreenPriv->maskBits, pDrawable, w, h, x, y); } static GCPtr @@ -373,27 +363,22 @@ Bool miDCPutUpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor, int x, int y, unsigned long source, unsigned long mask) { - miDCCursorPtr pPriv; + miDCScreenPtr pScreenPriv = dixLookupPrivate(&pScreen->devPrivates, miDCScreenKey); miDCBufferPtr pBuffer; WindowPtr pWin; - pPriv = (miDCCursorPtr) dixLookupScreenPrivate(&pCursor->bits->devPrivates, - miDCCursorBitsKey, pScreen); - if (!pPriv) { - pPriv = miDCRealize(pScreen, pCursor); - if (!pPriv) - return FALSE; - } + if (!miDCRealize(pScreen, pCursor)) + return FALSE; pWin = pScreen->root; pBuffer = miGetDCDevice(pDev, pScreen); #ifdef ARGB_CURSOR - if (pPriv->pPicture) { + if (pScreenPriv->pPicture) { if (!EnsurePicture(pBuffer->pRootPicture, &pWin->drawable, pWin)) return FALSE; CompositePicture(PictOpOver, - pPriv->pPicture, + pScreenPriv->pPicture, NULL, pBuffer->pRootPicture, 0, 0, 0, 0, @@ -402,7 +387,7 @@ miDCPutUpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor, else #endif { - miDCPutBits((DrawablePtr) pWin, pPriv, + miDCPutBits((DrawablePtr) pWin, pBuffer->pSourceGC, pBuffer->pMaskGC, x, y, pCursor->bits->width, pCursor->bits->height, source, mask); diff --git a/xorg-server/os/utils.c b/xorg-server/os/utils.c index 998c3ed4a..253793467 100644 --- a/xorg-server/os/utils.c +++ b/xorg-server/os/utils.c @@ -1167,14 +1167,14 @@ OsBlockSignals(void) if (BlockedSignalCount++ == 0) { sigset_t set; +#ifdef SIGIO + OsBlockSIGIO(); +#endif sigemptyset(&set); sigaddset(&set, SIGALRM); sigaddset(&set, SIGVTALRM); #ifdef SIGWINCH sigaddset(&set, SIGWINCH); -#endif -#ifdef SIGIO - sigaddset(&set, SIGIO); #endif sigaddset(&set, SIGTSTP); sigaddset(&set, SIGTTIN); @@ -1185,12 +1185,60 @@ OsBlockSignals(void) #endif } +#ifdef SIG_BLOCK +static sig_atomic_t sigio_blocked; +#endif + +/** + * returns zero if this call caused SIGIO to be blocked now, non-zero if it + * was already blocked by a previous call to this function. + */ +int +OsBlockSIGIO(void) +{ +#ifdef SIGIO +#ifdef SIG_BLOCK + if (sigio_blocked++ == 0) { + sigset_t set, old; + int ret; + + sigemptyset(&set); + sigaddset(&set, SIGIO); + sigprocmask(SIG_BLOCK, &set, &old); + ret = sigismember(&old, SIGIO); + return ret; + } else + return 1; +#endif +#endif +} + +void +OsReleaseSIGIO(void) +{ +#ifdef SIGIO +#ifdef SIG_BLOCK + if (--sigio_blocked == 0) { + sigset_t set; + + sigemptyset(&set); + sigaddset(&set, SIGIO); + sigprocmask(SIG_UNBLOCK, &set, NULL); + } else if (sigio_blocked < 0) { + BUG_WARN(sigio_blocked < 0); + sigio_blocked = 0; + } +#endif +#endif +} + void OsReleaseSignals(void) { #ifdef SIG_BLOCK if (--BlockedSignalCount == 0) { sigprocmask(SIG_SETMASK, &PreviousSignalMask, 0); + OsReleaseSIGIO(); } #endif } diff --git a/xorg-server/render/picture.c b/xorg-server/render/picture.c index ebbfa29e9..2908b7629 100644 --- a/xorg-server/render/picture.c +++ b/xorg-server/render/picture.c @@ -763,7 +763,8 @@ CreatePicture(Picture pid, PicturePtr pPicture; PictureScreenPtr ps = GetPictureScreen(pDrawable->pScreen); - pPicture = dixAllocateObjectWithPrivates(PictureRec, PRIVATE_PICTURE); + pPicture = dixAllocateScreenObjectWithPrivates(pDrawable->pScreen, + PictureRec, PRIVATE_PICTURE); if (!pPicture) { *error = BadAlloc; return 0; @@ -853,7 +854,7 @@ createSourcePicture(void) { PicturePtr pPicture; - pPicture = dixAllocateObjectWithPrivates(PictureRec, PRIVATE_PICTURE); + pPicture = dixAllocateScreenObjectWithPrivates(NULL, PictureRec, PRIVATE_PICTURE); pPicture->pDrawable = 0; pPicture->pFormat = 0; pPicture->pNext = 0; diff --git a/xorg-server/test/Makefile.am b/xorg-server/test/Makefile.am index e5b25c97f..15c51ed22 100644 --- a/xorg-server/test/Makefile.am +++ b/xorg-server/test/Makefile.am @@ -5,7 +5,7 @@ if XORG # Tests that require at least some DDX functions in order to fully link # For now, requires xf86 ddx, could be adjusted to use another SUBDIRS += xi2 -noinst_PROGRAMS += xkb input xtest misc fixes xfree86 hashtabletest signal-logging +noinst_PROGRAMS += xkb input xtest misc fixes xfree86 hashtabletest os signal-logging endif check_LTLIBRARIES = libxservertest.la @@ -38,6 +38,7 @@ xfree86_LDADD=$(TEST_LDADD) touch_LDADD=$(TEST_LDADD) signal_logging_LDADD=$(TEST_LDADD) hashtabletest_LDADD=$(TEST_LDADD) $(top_srcdir)/Xext/hashtable.c +os_LDADD=$(TEST_LDADD) libxservertest_la_LIBADD = $(XSERVER_LIBS) if XORG diff --git a/xorg-server/test/os.c b/xorg-server/test/os.c new file mode 100644 index 000000000..1460a34d6 --- /dev/null +++ b/xorg-server/test/os.c @@ -0,0 +1,130 @@ +/** + * Copyright © 2012 Red Hat, 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 (including the next + * paragraph) 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 AUTHORS OR COPYRIGHT HOLDERS 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. + */ + +#ifdef HAVE_DIX_CONFIG_H +#include +#endif + +#include +#include "os.h" + +static int +sig_is_blocked(int sig) +{ + sigset_t current; + + sigemptyset(¤t); + assert(sigprocmask(SIG_BLOCK, NULL, ¤t) == 0); + return sigismember(¤t, sig); +} + +static void block_sigio_test(void) +{ +#ifdef SIG_BLOCK + sigset_t current; + + sigemptyset(¤t); + assert(!sig_is_blocked(SIGIO)); + + /* block once */ + OsBlockSIGIO(); + assert(sig_is_blocked(SIGIO)); + OsReleaseSIGIO(); + assert(!sig_is_blocked(SIGIO)); + + /* block twice, nested */ + OsBlockSIGIO(); + assert(sig_is_blocked(SIGIO)); + OsBlockSIGIO(); + assert(sig_is_blocked(SIGIO)); + OsReleaseSIGIO(); + assert(sig_is_blocked(SIGIO)); + OsReleaseSIGIO(); + assert(!sig_is_blocked(SIGIO)); + + /* block all */ + OsBlockSignals(); + assert(sig_is_blocked(SIGIO)); + OsReleaseSignals(); + assert(!sig_is_blocked(SIGIO)); + + /* block all nested */ + OsBlockSignals(); + assert(sig_is_blocked(SIGIO)); + OsBlockSignals(); + assert(sig_is_blocked(SIGIO)); + OsReleaseSignals(); + assert(sig_is_blocked(SIGIO)); + OsReleaseSignals(); + assert(!sig_is_blocked(SIGIO)); + + /* mix the two */ + /* ABBA */ + OsBlockSignals(); + assert(sig_is_blocked(SIGIO)); + OsBlockSIGIO(); + assert(sig_is_blocked(SIGIO)); + OsReleaseSIGIO(); + assert(sig_is_blocked(SIGIO)); + OsReleaseSignals(); + assert(!sig_is_blocked(SIGIO)); + + /* ABAB */ + OsBlockSignals(); + assert(sig_is_blocked(SIGIO)); + OsBlockSIGIO(); + assert(sig_is_blocked(SIGIO)); + OsReleaseSignals(); + assert(sig_is_blocked(SIGIO)); + OsReleaseSIGIO(); + assert(!sig_is_blocked(SIGIO)); + + /* BAAB */ + OsBlockSIGIO(); + assert(sig_is_blocked(SIGIO)); + OsBlockSignals(); + assert(sig_is_blocked(SIGIO)); + OsReleaseSignals(); + assert(sig_is_blocked(SIGIO)); + OsReleaseSIGIO(); + assert(!sig_is_blocked(SIGIO)); + + /* BABA */ + OsBlockSIGIO(); + assert(sig_is_blocked(SIGIO)); + OsBlockSignals(); + assert(sig_is_blocked(SIGIO)); + OsReleaseSIGIO(); + assert(sig_is_blocked(SIGIO)); + OsReleaseSignals(); + assert(!sig_is_blocked(SIGIO)); + +#endif +} + +int +main(int argc, char **argv) +{ + block_sigio_test(); + return 0; +} diff --git a/xorg-server/xkb/xkbAccessX.c b/xorg-server/xkb/xkbAccessX.c index fe28e12d7..082c0db57 100644 --- a/xorg-server/xkb/xkbAccessX.c +++ b/xorg-server/xkb/xkbAccessX.c @@ -281,12 +281,12 @@ AccessXStickyKeysTurnOff(DeviceIntPtr dev, xkbControlsNotify * pCN) static CARD32 AccessXKRGExpire(OsTimerPtr timer, CARD32 now, pointer arg) { - XkbSrvInfoPtr xkbi = ((DeviceIntPtr) arg)->key->xkbInfo; xkbControlsNotify cn; + DeviceIntPtr dev = arg; + XkbSrvInfoPtr xkbi = dev->key->xkbInfo; if (xkbi->krgTimerActive == _KRG_WARN_TIMER) { - XkbDDXAccessXBeep((DeviceIntPtr) arg, _BEEP_SLOW_WARN, - XkbStickyKeysMask); + XkbDDXAccessXBeep(dev, _BEEP_SLOW_WARN, XkbStickyKeysMask); xkbi->krgTimerActive = _KRG_TIMER; return 4000; } @@ -296,11 +296,11 @@ AccessXKRGExpire(OsTimerPtr timer, CARD32 now, pointer arg) cn.requestMajor = 0; cn.requestMinor = 0; if (xkbi->desc->ctrls->enabled_ctrls & XkbSlowKeysMask) { - AccessXKRGTurnOff((DeviceIntPtr) arg, &cn); + AccessXKRGTurnOff(dev, &cn); LogMessage(X_INFO, "XKB SlowKeys are disabled.\n"); } else { - AccessXKRGTurnOn((DeviceIntPtr) arg, XkbSlowKeysMask, &cn); + AccessXKRGTurnOn(dev, XkbSlowKeysMask, &cn); LogMessage(X_INFO, "XKB SlowKeys are now enabled. Hold shift to disable.\n"); } -- cgit v1.2.3