Commit Graph

356 Commits

Author SHA1 Message Date
Yaakov Selkowitz
ea1d76d1b6 Fix formatting of address operators
The formatter confused address operators preceded by casts with
bitwise-and expressions, placing spaces on either side of both.
That syntax isn't used by ordinary address operators, however,
so fix them for consistency.

Signed-off-by: Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-12-05 18:09:48 -06:00
Paul Berry
16d8da5ca9 glx: Skip multisampled configs when matching pre-existing X visuals.
In __glXScreenInit() we generate the set of GLX visuals in two steps:
first we match each pre-existing X visual with a corresponding
FBConfig, then we generate a new X visual to correspond to all the
remaining FBConfigs.

The first step is used for the two default 24-bit visuals (true color
and direct color) and for the 32-bit visual.  If windowsystem
multisampling is enabled in Mesa, we need to ensure that none of these
three visuals gets matched to a multisampled config.

Fixes a bug with windowsystem multisampling in gnome-shell.  If the X
server happens to match up a multisampled FBConfig to the 32-bit
visual, gnome-shell will try to use it to read pixels from
alpha-blended windows (such as gnome-terminal), resulting in no window
appearing on screen.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2012-08-15 13:25:08 -07:00
Keith Packard
7d87545ba7 Merge remote-tracking branch 'jturney/master' 2012-08-06 15:11:13 -07:00
Jon TURNEY
988d7ace19 glx: Do not report the GLX_INTEL_swap_event extension for indirect swrast
Commit 84956ca4 bogusly adds GLX_INTEL_swap_event to the extensions reported
by swrast.

"DRI2 supports this now - and already enables it explicitly - but drisw does
not and should not. Otherwise toolkits like clutter will only ever SwapBuffers
once and wait forever for an event that's not coming."

(A similar bug for direct swrast is already fixed in mesa commit 25620eb1)

(Note that this may be papering over the cracks somewhat, as if we do report
GLX_INTEL_swap_event, some clutter apps fail with GLXBadDrawable calling
GLXChangeDrawableAttributes to change the setting of GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK
in the GLX_EVENT_MASK, apparently after the drawable is destroyed, which suggests
a bug with GLXDrawable lifetimes)

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2012-08-03 22:58:17 +01:00
Jon TURNEY
fd3d45c137 glx: Don't note GLX_INTEL_swap_event as being required by GLX 1.4, it isn't.
Don't note GLX_INTEL_swap_event as being required by GLX 1.4, it isn't.
(This data is not currently used in the server)

(A similar change is made in mesa commit d3f7597bc9f6d5)

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2012-08-03 22:58:11 +01:00
Dave Airlie
aad428b8e2 glx: drop GLX_LIBS from X server and workaround sdksyms.
We've had reports of two copies of the GLX bits, one in the server
and one in libglx.so causing problems, I didn't understand why the
X server needed a copy so drop it, however then we have to fix a missing
GlxExtensionInit that comes from sdksyms, so work around it by moving
that one declaration into a header that sdksyms doesn't scan.

Thanks to Jon Turney for debugging the actual problem.
(copyright header from extinit.h that seems most appropriate put on top).

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=52402
Tested-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Tested-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2012-07-25 23:30:53 -07:00
Bartosz Brachaczek
afa3b9ccd2 glx: Fix checking GL version
Signed-off-by: Bartosz Brachaczek <b.brachaczek@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Dave Airlie <airlied@gmail.com>
2012-07-13 11:25:04 +10:00
Dave Airlie
743ccf6fa0 glx/dri2: don't return NULL in a function with no return.
Reported by gcc.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-07-13 11:21:01 +10:00
Dave Airlie
d1a00c26be glx/dri2: use correct define from dri attribs.
Looks like idr renamed this and pushed the wrong one.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-07-13 11:20:48 +10:00
Dave Airlie
c62205adcd glx/dri2: fix incorrect == vs =
glxdri2.c:486: warning: statement with no effect

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-07-13 11:20:28 +10:00
Dave Airlie
defca4c192 glx/dri2: fix typo in the notification reset for robustness.
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-07-13 11:20:03 +10:00
Dave Airlie
d1cae6bb80 glx: pass screen into the convert function
when robustness is enabled, this is required.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-07-13 11:19:25 +10:00
Keith Packard
746193a7f1 Merge remote-tracking branch 'jturney/xwin-extmod-removal-fixes' 2012-07-12 15:10:51 -07:00
Michel Dänzer
a2d0829531 glx: Free DRI2 drawable reference to destroyed GLX drawable.
Otherwise the reference can lead to use after free in
__glXDRIinvalidateBuffers().

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=50019

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
2012-07-12 15:08:55 -07:00
Jon TURNEY
06ac7937fc Restore extern to the declaration of __glXDRISWRastProvider
b86aa74 dropped the 'extern' from the declaration of __glXDRISWRastProvider

This turns out to be important to me, as without it, the final link only gets
the tentative definition of __glXDRISWRastProvider implied by the declaration,
and not the proper one from glxdriswrast.c, presumably because nothing else
references anything in the object that file generates.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2012-07-12 13:25:57 +01:00
Jon TURNEY
bcbf95b1ba Revert bogus GlxPushProvider() in commit a1d41e3
a1d41e3 "Move extension initialisation prototypes into extinit.h"
also includes a change to GlxExtensionInit to install the swrast GLX
provider.

Since b86aa74 "GLX: Insert swrast provider from GlxExtensionInit"
already does this (correctly, by installing the swrast provider
at the end of the chain, rather than at the beginning), and since this
would seem to have the effect of making the swrast provider the most
preferred provider, I'm guessing this wasn't intended.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2012-07-12 13:24:49 +01:00
Daniel Stone
459c6da0f9 Move DRI1 from external module to built-in
Rather than building the tiny amount of code required for XFree86-DRI as
an external module, build it in if it's enabled at configure time.

v2: Fix test/Makefile.am to only link libdri.la if DRI is set

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Keith Packard <keithp@keithp.com>

fixup for DRI1 move

Signed-off-by: Keith Packard <keithp@keithp.com>
2012-07-10 00:30:40 -07:00
Daniel Stone
a1d41e311c Move extension initialisation prototypes into extinit.h
Create extinit.h (and xf86Extensions.h, for Xorg-specific extensions) to
hold all our extension initialisation prototypes, rather than
duplicating them everywhere.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
2012-07-09 23:06:41 -07:00
Daniel Stone
b86aa74caf GLX: Insert swrast provider from GlxExtensionInit
Rather than making poor old miinitext.c do it, including making DMX
have fake symbols just to keep it happy.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Stéphane Marchesin <stephane.marchesin@gmail.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2012-07-09 23:06:41 -07:00
Daniel Stone
854c1fa4a1 Add a common ARRAY_SIZE macro to dix.h
Does what it says on the box, replacing those from Xi/ and glx/.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Cyril Brulebois <kibi@debian.org>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
2012-07-09 23:06:41 -07:00
Alan Coopersmith
9805cedf7b Use C99 designated initializers in extension Events
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Tested-by: Daniel Stone <daniel@fooishbar.org>
2012-07-09 22:52:30 -07:00
Alan Coopersmith
26efa09d0c Use C99 designated initializers in glx Replies
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Tested-by: Daniel Stone <daniel@fooishbar.org>
2012-07-09 19:58:30 -07:00
Alan Coopersmith
cdf5bcd420 Use calloc to zero fill buffers being allocated for replies & events
Ensures padding bytes are zero-filled

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Tested-by: Daniel Stone <daniel@fooishbar.org>
2012-07-09 19:58:29 -07:00
Alan Coopersmith
789d64e19a Remove unneccesary casts from WriteToClient calls
Casting return to (void) was used to tell lint that you intended
to ignore the return value, so it didn't warn you about it.

Casting the third argument to (char *) was used as the most generic
pointer type in the days before compilers supported C89 (void *)
(except for a couple places it's used for byte-sized pointer math).

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Tested-by: Daniel Stone <daniel@fooishbar.org>
2012-07-09 19:12:56 -07:00
Dave Airlie
3029801216 dri2: add initial prime support. (v1.2)
This adds the initial prime support for dri2 offload. The main thing is
when we get a connection from a prime client, we stored the information
and mark all drawables from that client as prime. We then create all
buffers for that drawable on the prime device dri2screen.

Then DRI2UpdatePrime is provided which drivers can call to get a shared
pixmap which they can use as the front buffer. The driver is then
responsible for doing the back->front copy to the shared buffer.

prime requires a compositing manager be run, but it handles the case where
a window get un-redirected by allocating a new pixmap and pointing the crtc
at it while the client is in that state.

Currently prime can't handle pageflipping, so always does straight copy swap,

v1.1: renumber on top of master.
v1.2: fix auth on top of master.

Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-07-07 10:39:10 +01:00
Ian Romanick
ed6daa15a7 glx/dri2: Enable GLX_ARB_create_context_robustness
If the driver supports __DRI2_ROBUSTNESS, then enable
GLX_ARB_create_cotnext_robustness as well.  If robustness values are
passed to glXCreateContextAttribsARB and the driver doesn't support
__DRI2_ROBUSTNESS, existing drivers will already generate the correct
error values (so that the correct GLX errors are generated).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2012-07-05 11:45:44 -07:00
Ian Romanick
90aa2486e3 glx: Allow attributes and flags from GLX_ARB_create_context_robustness
The assumtion is that if the underlying provider (e.g., glxdri2.c) doesn't
support this extension, it will generate BadMatch for these flags and
attributes.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2012-07-05 11:45:32 -07:00
Ian Romanick
aef0b4593e glx: Track the reset notification strategy for a context
Also require that the reset notification for a new context and the other
context in the share group match.  There isn't yet any way to specify a
non-default reset notification strategy, but that will come.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2012-07-05 11:45:15 -07:00
Ian Romanick
f8198285cf glx: Add extension string tracking for GLX_ARB_create_context_robustness
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2012-07-05 11:44:42 -07:00
Ian Romanick
4ffbc984ea glx: Reject creations of indirect contexts with unsupportable versions.
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2012-07-05 11:44:20 -07:00
Ian Romanick
41d5120eaf glx: Implement GLX_EXT_create_context_es2_profile
This patch builds on the infrastucture put in place for
GLX_ARB_create_context_profile.  If GLX_CONTEXT_ES2_PROFILE_BIT_EXT is
specified and the requested version is 2.0, create a context with the
__DRI_API_GLES2 API.

This change assumes that any DRI2 driver can handle (possibly by saying "no
seeing an API setting other than __DRI_API_OPENGL or __DRI_API_OPENGL_CORE.
This allows enabling the extension any time GLX_ARB_create_context (and
GLX_ARB_create_context_profile) is enabled.

v2: Clean up some comments.  Note that our behavior for
GLX_CONTEXT_ES2_PROFILE_BIT_EXT w/version != 2.0 matches NVIDIA's.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2012-07-05 11:44:17 -07:00
Ian Romanick
cef0b808d3 glx: Implement GLX_ARB_create_context_profile
Most of the infrastructure was already in place.  This just adds:

    * Validate values specified with the GLX_CONTEXT_PROFILE_MASK_ARB
      attribute.

    * Select a DRI2 "api" based on the setting of
      GLX_CONTEXT_PROFILE_MASK_ARB.

    * Enable GLX_ARB_create_context_profile extension.

This change assumes that any DRI2 driver can handle (possibly by saying "no")
seeing an API setting other than __DRI_API_OPENGL.  This allows enabling this
extension any time GLX_ARB_create_context is enabled.

Also, the validation code in __glXDisp_CreateContextAttribsARB is structured
in a very verbose manner (using a switch-statement) to ease the addition of
GLX_EXT_create_context_es2_profile.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2012-07-05 11:44:13 -07:00
Ian Romanick
09a8a169d5 glx: Implement GLX SetClientInfo2ARB protocol
The protocol is almost identical to SetClientInfoARB.  The only
difference is the GL versions include an extra 4 bytes for the supported
profile.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2012-07-05 11:44:09 -07:00
Ian Romanick
8aa6d49d46 glx: Don't request prototypes for GL extension functions
The server does not want GL extension prototypes.  It never links with
anything that could possibly provide implementations of these functions.  It
*is* the provide, and it does not provde these symbols.  All this does is
create hundreds of warnings like:

incude/GL/glext.h:5570:45: warning: redundant redeclaration of 'glMultTransposeMatrixd' [-Wredundant-decls]
include/GL/gl.h:1940:45: note: previous declaration of 'glMultTransposeMatrixd' was here

I believe this was necessary back before the AIGLX days, but that was a long,
long time ago.  The warnings recently showed up with the addition of
-Wredundant-decls to the CWARNFLAGS.

v2: Update the commit message, no code changes.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Cc: Adam Jackson <ajax@redhat.com>
Cc: Dave Airlie <airlied@redhat.com>
Acked-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2012-07-05 10:08:04 -07:00
Keith Packard
ffb47a123d Merge remote-tracking branch 'idr/GLX_ARB_create_context' 2012-06-14 13:01:17 -07:00
Dave Airlie
1f0e8bd5eb api: rework the X server driver API to avoid global arrays.
This is a squash merge containing all the API changes, as
well as the video ABI bump.

Its been squashed to make bisection easier.

Full patch log below:

commit b202738bbf0c5a1c1172767119c2c71f1e7f8070
Author: Aaron Plattner <aplattner@nvidia.com>
Date:   Mon May 14 15:16:11 2012 -0700

    xfree86: Bump video ABI to 13.0

    The ABI was broken by changes to convert from screen index numbers to ScreenPtr
    / ScrnInfoPtr in various structures and function signatures.

    Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
    Reviewed-by: Dave Airlie <airlied@redhat.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit 3d5f7d9f8d408bcad3f83277d255f25d3b0edbf3
Author: Dave Airlie <airlied@redhat.com>
Date:   Thu May 24 10:56:57 2012 +0100

    xf86: xf86ClearEntityListForScreen should take a pScrn

    When adding GPU screens this make life easier.

    (also fix comment, as pointed out by Alan)

    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit afee8b5ab4501597ecc1ade34124d7ca227ab055
Author: Dave Airlie <airlied@redhat.com>
Date:   Thu May 24 07:07:32 2012 +0100

    xf86i2c: add pscrn for drivers to use

    This just adds a pScrn pointer into the struct for the drivers to use
    instead of scrnIndex. Mostly scrnIndex is used for logging, but some
    drivers use it to lookup xf86Screens, so let them stash a pScrn instead.

    Removing the scrnIndex is a bit more involved and I'm not sure its worth
    the effort. Doing i2c in the X server is legacy code as far as I'm concerned.

    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit ea5092f1f679691d187f1eee9427e6057beec56e
Author: Dave Airlie <airlied@redhat.com>
Date:   Wed May 23 19:25:20 2012 +0100

    dix/gc: consolidate GC object creation in one place

    The standard GC create and scratch GC create were 90% the same really,
    and I have a need in the future for creating GC objects without the
    other bits, so wanted to avoid a third copy.

    Reviewed-by: Keith Packard <keithp@keithp.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit 3d91482ea9b4883e64e496f2768168e0ffa21ba1
Author: Dave Airlie <airlied@redhat.com>
Date:   Wed May 23 10:24:06 2012 +0100

    xf86: add a define to denote the new non-index interfaces are being used

    This can be used by drivers to provide compatible APIs.

    Reviewed-by: Keith Packard <keithp@keithp.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit 37c3ae3e6cd4f3dedc72f371096d6743f8f99df3
Author: Dave Airlie <airlied@redhat.com>
Date:   Wed May 23 15:09:12 2012 +0100

    dix: make Create/Free scratch pixmaps take a ScreenPtr

    While technically an API/ABI change I doubt anyone uses it,
    but it helps in splitting screens up.

    Reviewed-by: Keith Packard <keithp@keithp.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit 75f2062a3fe94f04764ecc7d2ff2fbbeccb9da60
Author: Dave Airlie <airlied@redhat.com>
Date:   Wed May 23 14:57:55 2012 +0100

    xf86/xv: remove scrnIndexfrom xf86FindXvOptions.

    Move this interface to taking an ScrnInfoPtr.

    Reviewed-by: Keith Packard <keithp@keithp.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit f80c2374f40ea7b2ee0556e2e76cc07406f3d843
Author: Dave Airlie <airlied@redhat.com>
Date:   Wed May 23 14:53:59 2012 +0100

    xf86: make xf86DeleteScreen take a ScrnInfoPtr (v2)

    stop passing indices into this function.

    v2: drop flags argument.

    Reviewed-by: Keith Packard <keithp@keithp.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit 58824e414f35682435f15bfe6c4b656bd90b9235
Author: Dave Airlie <airlied@redhat.com>
Date:   Wed May 23 14:48:09 2012 +0100

    xf86: fix xf86IsScreenPrimary interface to take a pScrn (API/ABI)

    Reviewed-by: Keith Packard <keithp@keithp.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit 6b4fc1f9d391bcdf7ca288766e49bce60f4635cd
Author: Dave Airlie <airlied@gmail.com>
Date:   Tue Apr 10 14:18:59 2012 +0100

    xserver: convert block/wakeup handlers to passing ScreenPtr (ABI/API) (v2)

    Instead of passing an index, pass the actual ScreenPtr. This allows
    more moving towards not abusing xf86Screens + screenInfo.

    v2: drop the blockData/wakeupData args as per ajax's suggestion.,
    fix docs.

    Reviewed-by: Keith Packard <keithp@keithp.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit 790d003de20fb47674420a24dadd92412d78620d
Author: Dave Airlie <airlied@gmail.com>
Date:   Wed Apr 11 09:53:14 2012 +0100

    xf86/common: remove some more pScrn->pScreen uses

    remove some more conversions that appeared after api cleanups.

    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Acked-by: Aaron Plattner <aplattner@nvidia.com>
    Reviewed-by: Adam Jackson <ajax@redhat.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit aac85e18d1dd093f2cad6bd29375e40bd7af0b8f
Author: Dave Airlie <airlied@gmail.com>
Date:   Tue Apr 10 16:34:53 2012 +0100

    ddc: change API to take ScrnInfoPtr (v2)

    This removes all xf86Screens usage from ddc code,
    it modifies the API for some functions to avoid taking indices.

    v2: address Alan's comments about dropping DDC2Init parameter.

    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Acked-by: Aaron Plattner <aplattner@nvidia.com>
    Reviewed-by: Adam Jackson <ajax@redhat.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit fe3f57b6eaf6860a33876a54f9439f69578f03a5
Author: Dave Airlie <airlied@gmail.com>
Date:   Tue Apr 10 16:31:26 2012 +0100

    vbe: don't use index for VBEInterpretPanelID (API)

    Remove use of xf86screens from vbe module.

    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Acked-by: Aaron Plattner <aplattner@nvidia.com>
    Reviewed-by: Adam Jackson <ajax@redhat.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit abf1965f4ed91529036d3fdb470d6a3ce6f29675
Author: Dave Airlie <airlied@gmail.com>
Date:   Tue Apr 10 16:25:11 2012 +0100

    int10/vbe: don't use xf86Screens. (ABI) (v3)

    Pass the ScrnInfoPtr instead of the index in the int10 struct.

    This saves us using it to dereference xf86Screens.

    v2: address Alan's comment to fix struct alignment.

    v3: squash in all the int10 fixes, test the vm86 code builds,
    after comments by Keith.

    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Acked-by: Aaron Plattner <aplattner@nvidia.com>
    Reviewed-by: Adam Jackson <ajax@redhat.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit 23cca612b4fb5efc33683c7624b803b457387e3d
Author: Dave Airlie <airlied@gmail.com>
Date:   Tue Apr 10 15:30:18 2012 +0100

    xserver: drop index argument to ScreenInit (ABI/API) (v2)

    This drops the index argument, its the same as pScreen->myNum,
    and its the last major index abuse I can find.

    v2: address Alan's review - update docs, fix xwin/xnest/darwin

    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Acked-by: Aaron Plattner <aplattner@nvidia.com>
    Reviewed-by: Adam Jackson <ajax@redhat.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit 40d360e2d7e832407f3ed64e3a02c27ecc89a960
Author: Dave Airlie <airlied@gmail.com>
Date:   Tue Apr 10 15:23:01 2012 +0100

    xf86: migrate PointerMoved from index to ScrnInfoPtr (ABI/API)

    This migrates PointerMoved from an index to ScrnInfoPtr.

    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Acked-by: Aaron Plattner <aplattner@nvidia.com>
    Reviewed-by: Adam Jackson <ajax@redhat.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit aa60a2f38679d0eeb979a9c2648c9bc771409bf9
Author: Dave Airlie <airlied@gmail.com>
Date:   Tue Apr 10 15:20:46 2012 +0100

    xf86: migrate PMEvent to a ScrnInfoPtr (ABI/API)

    This migrates the PMEvent from index to ScrnInfoPtr.

    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Acked-by: Aaron Plattner <aplattner@nvidia.com>
    Reviewed-by: Adam Jackson <ajax@redhat.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit d3f28ef44371ed4a039ffc5dd7eb6408d1269ba2
Author: Dave Airlie <airlied@gmail.com>
Date:   Tue Apr 10 15:18:30 2012 +0100

    xf86: migrate SetDGAMode from index to ScrnInfoPtr (ABI/API)

    This migrates the SetDGAMode callback from an index to ScrnInfoPtr.

    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Acked-by: Aaron Plattner <aplattner@nvidia.com>
    Reviewed-by: Adam Jackson <ajax@redhat.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit baf5e4818a74f2b68c3dfdcc56f54322351039a0
Author: Dave Airlie <airlied@gmail.com>
Date:   Tue Apr 10 15:14:11 2012 +0100

    xf86: migrate ChangeGamma from index to ScrnInfoPtr (ABI/API) (v2)

    This migrates the ChangeGamma interface to avoid passing a index.

    v2: fix xf86RandR12.c + xf86cmap.c call

    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Acked-by: Aaron Plattner <aplattner@nvidia.com>
    Reviewed-by: Adam Jackson <ajax@redhat.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit 51e5f90ada929d6b23176090badbb42fdb3fa550
Author: Dave Airlie <airlied@gmail.com>
Date:   Tue Apr 10 15:11:09 2012 +0100

    xf86/exa: migrate index to screen types for EnableDisableFBAccess (ABI/API)

    The EXA interface migrates to ScreenPtr,
    and the xf86 interface migrated to ScrnInfoPtr.

    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Acked-by: Aaron Plattner <aplattner@nvidia.com>
    Reviewed-by: Adam Jackson <ajax@redhat.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit 94f1f21d17e86f96d4a54292a399160950087675
Author: Dave Airlie <airlied@gmail.com>
Date:   Tue Apr 10 15:02:11 2012 +0100

    xf86: migrate ValidMode callback to ScrnInfoPtr (ABI/API)

    This migrates the ValidMode to passing a ScrnInfoPtr instead
    of an index.

    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Acked-by: Aaron Plattner <aplattner@nvidia.com>
    Reviewed-by: Adam Jackson <ajax@redhat.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit 3f8f18198fed4f39ec805b508a3482e91eea26b2
Author: Dave Airlie <airlied@gmail.com>
Date:   Tue Apr 10 14:59:46 2012 +0100

    xf86: migrate SwitchMode to taking ScrnInfoPtr (ABI/API) (v2)

    This migrate the SwitchMode interface to take a ScrnInfoPtr
    instead of an index.

    v2: drop flags.

    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Acked-by: Aaron Plattner <aplattner@nvidia.com>
    Reviewed-by: Adam Jackson <ajax@redhat.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit d06a038a5c49328ab3a8d969d24f9fcd22c63202
Author: Dave Airlie <airlied@gmail.com>
Date:   Tue Apr 10 14:50:37 2012 +0100

    xf86: move AdjustFrame to passing ScrnInfoPtr (ABI/API) (v2)

    This converts AdjustFrame code paths to passing a ScrnInfoPtr
    instead of an integer index.

    v2: drop flags args.

    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Acked-by: Aaron Plattner <aplattner@nvidia.com>
    Reviewed-by: Adam Jackson <ajax@redhat.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit 53d2f8608ffd4090d08e7d5cf2e92fb954959b90
Author: Dave Airlie <airlied@gmail.com>
Date:   Tue Apr 10 14:41:27 2012 +0100

    xf86: modify FreeScreen callback to take pScrn instead of index. (ABI/API) (v2)

    Another index->pScrn conversion.

    v2: drop flags arg.

    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Acked-by: Aaron Plattner <aplattner@nvidia.com>
    Reviewed-by: Adam Jackson <ajax@redhat.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit 60db37c0b247052e0f5c54b1921fe58a3609c2e3
Author: Dave Airlie <airlied@gmail.com>
Date:   Tue Apr 10 14:35:41 2012 +0100

    xf86: change EnterVT/LeaveVT to take a ScrnInfoPtr (ABI/API break) (v2)

    This modifies the EnterVT/LeaveVT interfaces to take a ScrnInfoPtr
    instead of an index into xf86Screens. This allows dropping more
    public dereferences of the xf86Screens and screenInfo.

    v2: drop flags args as suggested by Keith, fix docs.

    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Acked-by: Aaron Plattner <aplattner@nvidia.com>
    Reviewed-by: Adam Jackson <ajax@redhat.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

commit 06729dbbc804a20242e6499f446acb5d94023c3c
Author: Dave Airlie <airlied@gmail.com>
Date:   Tue Apr 10 14:04:59 2012 +0100

    xserver: remove index from CloseScreen (API/ABI breakage)

    This drops the index from the CloseScreen callback,
    its always been useless really, since the pScreen contains it.

    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Acked-by: Aaron Plattner <aplattner@nvidia.com>
    Reviewed-by: Adam Jackson <ajax@redhat.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-06-05 13:22:18 +01:00
Ian Romanick
b840ba5f54 glx: Implement protocol for glXCreateContextAttribsARB
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
2012-05-23 13:08:12 -07:00
Ian Romanick
23612a63fc glx: Make several functions available outside the glxcmds.c compilation unit
validGlxScreen, validGlxFBConfig, validGlxContext, and
__glXdirectContextCreate will soon be used by createcontext.c.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
2012-05-23 13:08:12 -07:00
Ian Romanick
cd5689cac5 glx: Use one function to add a context to all global tables
Instead of having separate __glXAddContextToList and AddResource
functions, just have one function that does both steps.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Reviewed-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
2012-05-23 13:08:12 -07:00
Ian Romanick
c1d91ab370 glx: Initialize remaining context fields
There is no reason to assume the screen's context allocated
initialized these fields, so don't.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Reviewed-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
2012-05-23 13:08:12 -07:00
Ian Romanick
0db76e5f77 glx: Initialize all context fields together
v2: Fix whitespace error noticed by Christopher James Halse Rogers.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Reviewed-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
2012-05-23 13:08:12 -07:00
Ian Romanick
befa76d251 glx: Implement GLX SetClientInfoARB protocol
v2: Bump glproto version to 1.4.15.  This patch uses structure names
that only exist in that glproto version and later.  Noticed by
Christopher James Halse Rogers.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
2012-05-23 13:08:12 -07:00
Ian Romanick
8b8cd6f6f4 glx: Optionally call DRI2 createContextAttribs from __glXDRIscreenCreateContext
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
2012-05-23 13:08:12 -07:00
Ian Romanick
0a9226376c glx: Add tracking for GLX_ARB_create_context and GLX_ARB_create_context_profile
The formatting of the extension data table was mangled by indent.
This patch also undoes that and adds approripate control comments so
that indent won't do it again.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
2012-05-23 13:08:12 -07:00
Ian Romanick
96d74138b1 glx: Extend __GLXscreen::createContext to take attributes
The attributes will be used for glXCreateContextAttribsARB additions
in follow-on patches.

v2: Add missing 'int *error' parameters noticed by Christopher James
Halse Rogers.

v3: Remove redundant 'int err;' declaration noticed by Christopher
James Halse Rogers.  This was supposed to be in v2, but I missed it.

v4: Add comma missing from additions in v2.  Ugh.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Reviewed-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
2012-05-23 13:07:51 -07:00
Ian Romanick
62f06b0dcd glx: Don't track GLClientmajorVersion or GLClientminorVersion
Nothing uses these fields anywhere in the server.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Reviewed-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
2012-05-23 13:07:51 -07:00
Ian Romanick
724176a87a glx: Fix mishandling of shared contexts
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
2012-05-23 13:07:51 -07:00
Dave Airlie
41151f88a6 xf86: migrate to using xf86ScreenToScrn wrapper (v2)
migrate to new helper API.

This just wraps all the obvious uses of xf86Screens[pScreen->myNum],
and should be fairly simple to review.

v2: remove commented out lines.

Reviewed-by: Aaron Plattner <aplattner@nvidia.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-05-21 12:59:08 +01:00
Jonas Maebe
adcb48a29d glapi: Correct size of allocated _glapi_table struct
The __glapi_gentable_set_remaining_noop() routine treats the _glapi_struct
as an array of _glapi_get_dispatch_table_size() pointers, so we have to
allocate _glapi_get_dispatch_table_size()*sizeof(void*) bytes rather than
sizeof(struct _glapi_struct) bytes.

Signed-off-by: Jonas Maebe <jonas.maebe@elis.ugent.be>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2012-04-23 20:20:42 -07:00
Keith Packard
9838b7032e Introduce a consistent coding style
This is strictly the application of the script 'x-indent-all.sh'
from util/modular. Compared to the patch that Daniel posted in
January, I've added a few indent flags:

	-bap
	-psl
	-T PrivatePtr
	-T pmWait
	-T _XFUNCPROTOBEGIN
	-T _XFUNCPROTOEND
	-T _X_EXPORT

The typedefs were needed to make the output of sdksyms.sh match the
previous output, otherwise, the code is formatted badly enough that
sdksyms.sh generates incorrect output.

The generated code was compared with the previous version and found to
be essentially identical -- "assert" line numbers and BUILD_TIME were
the only differences found.

The comparison was done with this script:

dir1=$1
dir2=$2

for dir in $dir1 $dir2; do
	(cd $dir && find . -name '*.o' | while read file; do
		dir=`dirname $file`
		base=`basename $file .o`
		dump=$dir/$base.dump
		objdump -d $file > $dump
	done)
done

find $dir1 -name '*.dump' | while read dump; do
	otherdump=`echo $dump | sed "s;$dir1;$dir2;"`
	diff -u $dump $otherdump
done

Signed-off-by: Keith Packard <keithp@keithp.com>
Acked-by: Daniel Stone <daniel@fooishbar.org>
Acked-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-03-21 13:54:42 -07:00
Jeremy Huddleston
78d39b3222 Revert "glx: don't leak fbconfigs"
This reverts commit d26fae246d.

This patch free()s memory in __glXScreenDestroy which was allocated in
glxdricommon (which isn't in every DDX).  That breaks abstraction and
causes a crash when XQuartz quits, because it results in freeing a pointer
that was never allocated.

The correct fix is to do this cleanup in __glXDRIscreenDestroy.

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
2012-01-15 02:28:07 -08:00
Keith Packard
5037c9af78 glx/glapioffsets.h is no longer part of the build, remove it
Signed-off-by: Keith Packard <keithp@keithp.com>
2011-12-27 14:02:39 -08:00
Keith Packard
e4b4d83fad Merge remote-tracking branch 'idr/glx-fixes' 2011-12-19 22:36:31 -08:00
Ville Syrjälä
4df65d247b dri2: Invalidate window pixmaps
While a redirected window is flipped, its pixmap may still be used as
and EGL image and should also get invalidated. When sending invalidate
events for a window, also send the events for its pixmap.

Signed-off-by: Ville Syrjälä <syrjala@sci.fi>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2011-12-19 22:32:33 -08:00
Ian Romanick
d26cb70272 glx: use dispatch.h instead of glapioffsets.h
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2011-12-19 13:38:50 -08:00
Ian Romanick
66e6037c33 glx: Regenerate GL API files from Mesa
Adam reviewed the underlying changes in the Mesa generated scripts.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2011-12-19 13:38:50 -08:00
Ian Romanick
e8485768c1 glx: Add stub implementations of next GLX extension functions
Generated code from Mesa contains dispatch for GLX_ARB_create_context
and GLX_ARB_create_context_profile.  Provide stub implementations of
these functions so that the GLX extension will link.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2011-12-19 13:38:49 -08:00
Ian Romanick
2df539c0bc glx: Only declare GlxExtensionInit in one header file
This silences the GCC warning:

In file included from singlepixswap.c:36:0:
glxext.h:47:13: warning: redundant redeclaration of 'GlxExtensionInit' [-Wredundant-decls]
glxserver.h:80:6: note: previous declaration of 'GlxExtensionInit' was here

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2011-12-19 13:38:46 -08:00
Paulo Zanoni
0ae087e131 glx: don't leak driConfigs
For dri, dri2 and driswrast.

12,968 (584 direct, 12,384 indirect) bytes in 1 blocks are definitely lost in loss record 569 of 570
   at 0x4C2779D: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x7821E3B: driConcatConfigs (utils.c:560)
   by 0x7827CF2: dri_fill_in_modes (dri_screen.c:224)
   by 0x782831E: dri_init_screen_helper (dri_screen.c:405)
   by 0x7826C03: drisw_init_screen (drisw.c:266)
   by 0x782225F: driCreateNewScreen (drisw_util.c:69)
   by 0x4826E2: __glXDRIscreenProbe (glxdriswrast.c:451)
   by 0x4812FA: GlxExtensionInit (glxext.c:327)
   by 0x41FB14: InitExtensions (miinitext.c:471)
   by 0x568622: main (main.c:208)

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-24 17:40:01 -02:00
Paulo Zanoni
d26fae246d glx: don't leak fbconfigs
29,952 (208 direct, 29,744 indirect) bytes in 1 blocks are definitely lost in loss record 573 of 573
   at 0x4C2779D: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x4829BC: createModeFromConfig (glxdricommon.c:131)
   by 0x482C09: glxConvertConfigs (glxdricommon.c:185)
   by 0x482788: __glXDRIscreenProbe (glxdriswrast.c:468)
   by 0x4812FA: GlxExtensionInit (glxext.c:327)
   by 0x41FB14: InitExtensions (miinitext.c:471)
   by 0x568636: main (main.c:208)

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-24 17:40:01 -02:00
Paulo Zanoni
305a8bcb2f glx: fix memory leak when destroying screen
1,152 bytes in 1 blocks are definitely lost in loss record 536 of 575
   at 0x4C25E84: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x483820: __glXScreenInit (glxscreens.c:357)
   by 0x48271C: __glXDRIscreenProbe (glxdriswrast.c:469)
   by 0x4812BE: GlxExtensionInit (glxext.c:327)
   by 0x41FB14: InitExtensions (miinitext.c:471)
   by 0x5685AE: main (main.c:208)

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-24 17:40:01 -02:00
Alan Coopersmith
71a89d9733 Convert glx/single2.c:DoGetString() to use asprintf()
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-23 12:15:06 -08:00
Matt Turner
40a47bd628 Remove unnecessary #undefs of [f]abs and old comments
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Tested-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Matt Turner <mattst88@gmail.com>
2011-09-21 17:12:04 -04:00
Jon TURNEY
42bc198775 glx: Remove a few lingering traces of __GLXscreen.GLXVersion
The GLXversion member of the __GLXscreen struct
is just cruft since commit ad5c0d9efa,
when we started returning the minimum GLX version supported by all
of the screens on the display, rather than the maximum version supported
by the server.

Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2011-07-07 18:09:21 +01:00
Keith Packard
61f87a75f2 Merge remote-tracking branch 'jturney/master' 2011-06-29 20:14:51 -07:00
Keith Packard
0d2153a46c Merge remote-tracking branch 'jbarnes/master' 2011-06-29 20:08:32 -07:00
Jon TURNEY
1d7f3a0031 glx: Move GLX extension string utility functions
Move GLX extension string utility functions from the DRI1 convenience library
into the GLX extension convenience library, so other DDX which don't have DRI
can use them.

This is probably also needed if anyone actually tries to build an Xorg DDX
with only DRI2 support...

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
2011-06-29 19:09:23 +01:00
Jesse Barnes
932513e23b DRI2/GLX: use new swap event types
Use the new event types so we can pass a valid SBC value to clients.
Fix up the completion calls to use CARD32 instead of CARD64 to match
the new field size.

Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2011-06-29 11:05:36 -07:00
Jesse Barnes
a3cb7d097a GLX/DRI2: pass drawable correctly for indirect swap events
Pass the right drawable pointer as data to the swap complete function.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2011-06-29 10:56:43 -07:00
Adam Jackson
3e8270b869 glx: Fix fbconfigs with no corresponding visual
There are, in general, more fbconfig depths than visual depths.
fbconfigs need not support Window rendering, however any that do must
have an associated visual ID (which we got right), and any that do not
must not claim GLX_WINDOW_BIT in GLX_DRAWABLE_TYPE (which we got
wrong).

Fixes piglit/glx-fbconfig-sanity, assuming you have a sufficiently
recent piglit, as that test formerly wrongly required pixmap-capable
fbconfigs to have a visual.

v2: Additional check for fbconfigs that didn't have GLX_WINDOW_BIT in
    the first place, from previous patch by Jon TURNEY; also, also clear
    ->visualID.

Reviewed-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2011-06-29 18:22:18 +01:00
Jon TURNEY
38d55f06cf Guard use of backtrace() with HAVE_BACKTRACE
Guard the use of backtrace() with HAVE_BACKTRACE, since we already
have the autoconf machinery for setting that.

For the moment, assume dladdr() is available when backtrace() is

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-06-28 13:07:20 -07:00
Jeremy Huddleston
ecec578e35 glx: Add _glapi_create_table_from_handle
_glapi_create_table_from_handle was recently added to mesa to ease creation of
a _glapi_table.  This commit brings this API over to xserver for use in
XQuartz (next commit).

The API was generated with scripts from current mesa followed by various
script-foo to remove entries that are not in the server and add those which
are still in the server but not in mesa (CullParameterdvEXT and
CullParameterfvEXT)

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2011-06-15 14:00:35 -07:00
Keith Packard
5cb31cd0cb Merge remote-tracking branch 'jturney/remove-opengl-spec-download' 2011-04-29 09:59:49 -07:00
Keith Packard
ec9ea40178 Merge remote-tracking branch 'jeremyhu/master' 2011-04-27 12:01:56 -07:00
Jon TURNEY
c5a612fc18 configure: Let configure --enable/disable-aiglx control building of AIGLX for all DDXs
Let configure --enable/disable-aiglx control building of AIGLX for all DDXs. Currently
we can't use --enable/disable-aiglx to control if Xwin DDX is built with AIGLX enabled,
as at the moment it's forced off if we aren't building the X.Org DDX DRI or DRI2 loader

Rearrange things a bit, introducing a new automake conditional, AIGLX_DRI_LOADER to
specifically indicate if the X.Org DDX DRI/DRI2 loader convenience library should be
built, and replace the previous X.Org DDX-specific uses of the AIGLX conditional with that

As before, AIGLX_DRI_LOADER is only enabled if --enable-glx, --enable-aiglx and at least one
of --enable-dri or --enable-dri2 are enabled

This allows the general conditional AIGLX to control if AIGLX is built for the XWin DDX as
well

The C #define AIGLX set by AC_DEFINE(AIGLX) seems to be obsolete, I can't find anything
which checks it

Updated for ajax's "glx: Make --disable-dri not disable AIGLX" patch, which allows DRI2
to be enabled independently of DRI1

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2011-04-26 10:40:56 +01:00
Jeremy Huddleston
bb4d145bd2 glx: Silence warnings when building with clang
This replaces AX_TLS (GPL3) with XORG_TLS (MIT)

In file included from glapi.c:46:
In file included from ./glapi.h:51:
./glthread.h:237:20: error: unknown attribute 'tls_model' ignored [-Werror,-Wunknown-attributes]
    __attribute__((tls_model("initial-exec")));
                   ^
In file included from glapi.c:46:
./glapi.h:92:20: error: unknown attribute 'tls_model' ignored [-Werror,-Wunknown-attributes]
    __attribute__((tls_model("initial-exec")));
                   ^
glapi.c:82:20: error: unknown attribute 'tls_model' ignored [-Werror,-Wunknown-attributes]
    __attribute__((tls_model("initial-exec"))) = NULL;
                   ^
glapi.c:85:20: error: unknown attribute 'tls_model' ignored [-Werror,-Wunknown-attributes]
    __attribute__((tls_model("initial-exec")));
                   ^
4 errors generated.

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
Tested-by: Jamey Sharp <jamey@minilop.net>
Acked-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2011-04-25 18:56:56 -07:00
Søren Sandmann Pedersen
61a92a78cd Add RegionInitBoxes(), and fix some buggy callers of RegionInit().
The interface to RegionInit():

    RegionInit (RegionPtr pReg, BoxPtr rect, int size);

is very confusing because it doesn't take a list of boxes, it takes
*one* box, but if that box is NULL, it initializes an empty region
with 'size' rectangles preallocated.

Most callers of this function were correctly passing either NULL or
just one box, but there were three confused cases, where the code
seems to expect a region to be created from a list of boxes.

This patch adds a new function RegionInitBoxes() and fixes those
instances to call that instead.

And yes, the pixman function to initialize a region from a list of
boxes is called init_rects() because pixman is also awesome.

V2: Make RegionInitBoxes() return a Bool indicating whether the call
    succeeded, and fix the callers to check this return value.

Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Søren Sandmann <ssp@redhat.com>
2011-04-22 21:39:31 -04:00
Adam Jackson
001b6b8b70 glx: Make --disable-dri not disable AIGLX
Either the DRI1 or DRI2 loaders are sufficient.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2011-04-15 17:47:20 -04:00
Adam Jackson
f8540b9dcc glx: Use 0 rather than garbage for unknown INTEL_swap_event types
Otherwise the garbage you return could well be numerically identical to
one of the swap type tokens, and apps which rely on us to tell the truth
would be in trouble.

Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2011-04-15 12:57:05 -04:00
Adam Jackson
6a433b67ca glx: Fix lifetime tracking for pixmaps
GLX pixmaps take a reference on the underlying pixmap; X and GLX pixmap
IDs can be destroyed in either order with no error.  Only windows need
to be tracked under both XIDs.

Fixes piglit/glx-pixmap-life.

Reviewed-by: Michel Dänzer <michel@daenzer.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2011-04-15 12:55:47 -04:00
Adam Jackson
3e0b311aba glx: minor cast cleanup
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2011-03-28 12:46:38 -04:00
Adam Jackson
501506cf9d glx: dead variable removal
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2011-03-28 12:46:38 -04:00
Adam Jackson
10317682e2 glx: Remove some obfuscatory macros
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2011-03-28 12:46:38 -04:00
Adam Jackson
c327d07cc6 glx: Remove ->forceCurrent from the context vtable
All the implementations of makeCurrent and forceCurrent are identical,
so just use makeCurrent everywhere.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2011-03-28 12:46:38 -04:00
Adam Jackson
a48dadc98a glx: Reimplement context tags
This would let you do a constant-time context lookup, but if that's your
performance problem you have two problems.  Just use the context's XID
as the tag value instead.

In order to do this, we have to defer destroying a context until it
actually goes unreferenced, as you're allowed to mention a context tag
after you've (ostensibly) destroyed the context, as long as it's still
your current context.  Thus, change DestroyContext to merely mark the
context as dead if it's a current context, and call down to actual
resource destruction (and XID reclamation) in StopUsingContext.

Also, stop trying to delete context state from DrawableGone.  This was
always broken, as GLX does not say that contexts are destroyed when
their drawables are destroyed.  But with the above change to defer
context destruction, this would trigger a server crash on client exit as
we'd free the context state twice.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2011-03-28 12:46:38 -04:00
Adam Jackson
30d6947cee glx: Fix _glapi_add_dispatch
We never need to generate stubs, because those conditions can't happen
in the server.  Yank that code out, but keep the bookkeeping for which
extension functions are registered so the DRI driver doesn't get
confused.

As a pleasant bonus, we're now friendlier for environments like selinux
that make runtime code generation difficult, and we're portable to more
arches since we don't have to port the assembly stubs.

Fixes the following clutter conformance tests (indirect rendering,
llvmpipe driver):

    test-cogl-backface-culling
    test-cogl-materials
    test-cogl-readpixels
    test-cogl-texture-mipmaps
    test-cogl-texture-get-set-data
    test-cogl-viewport
    test-cogl-offscreen

Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2011-03-28 12:46:38 -04:00
Adam Jackson
0cb44cec7b glx: Flatten -DXFree86Server
Always defined by the makefile, so, just get rid of it.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2011-03-28 12:46:38 -04:00
Adam Jackson
ed6c13c01e glx: Update some glapi comments
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2011-03-28 12:46:38 -04:00
Adam Jackson
17d9e37472 glx: Lobotomize _glapi_get_proc_address
This isn't a meaningful thing in the indirect glx loader, so just warn
if it ever happens and move on.

But also, mark it PUBLIC, so if the driver does ever call it we merely
warn instead of aborting because ld.so can't find the symbol.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2011-03-28 12:46:38 -04:00
Adam Jackson
b0c665ac0f glx: Remove noop dispatch table
We can never hit this, because the indirect GLX dispatch code always
forces a current context and checks that it's non-NULL before calling
into the dispatch table.  If it's _not_ null, then _glapi_set_context
will call into the driver, which is responsible for calling
_glapi_set_dispatch to make sure the dispatch table is non-NULL.

Also remove _glapi_set_warning_func and friends, since we can no longer
call them even from dead code.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2011-03-28 12:46:38 -04:00
Jeremy Huddleston
c55baebf4e GLX: Support TLS with better portability
AX_TLS detects when toolchains support __thread or __declspec(thread),
but existing code assumed __thread.

This also adds a check to configure.ac to error out if TLS is requested
but unsupported.

Found-by: Tinderbox
http://tinderbox.x.org/builds/2011-03-22-0007

Regression-from: 82b1eaa6ca

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Tom Fogal <tfogal@alumni.unh.edu>
Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
2011-03-23 09:11:33 -07:00
Christopher James Halse Rogers
7ca75abbbd glx: Use PATH_MAX as size of filename buffer
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
2011-03-14 13:42:55 -04:00
Christopher James Halse Rogers
021393d1b8 glx: Factor out glxProbeDriver function.
DRI, DRI2 and swrast all had near-identical driver probing logic.
Pull it into glxdricommon.

[ajax: warning fix]
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
2011-03-14 13:42:32 -04:00
Adam Jackson
1ad9f01c31 glx: Add texbuffer2 support to swrast
Reviewed-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2011-03-14 13:13:58 -04:00
Adam Jackson
b73ebe65cd glx: Remove unused _glapi_get_proc_name
Reviewed-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2011-03-08 13:25:15 -05:00
Adam Jackson
4377288abd glx: Simplify _glapi_check_multithread
We can guarantee that the X server does not call DRI driver services
from multiple threads, so _glapi_check_multithread need never do
anything special.  As a result, ThreadSafe is always false, so remove it
and simplify expressions where it appeared to match.

Reviewed-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2011-03-08 13:25:04 -05:00
Adam Jackson
d5e8bb2150 glx: unifdef BEOS_THREADS
We don't support BeOS, so, no.

Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2011-03-08 13:24:38 -05:00
Adam Jackson
3692ff0b35 glx: unifdef USE_XTHREADS
xthreads is an ancient wrapper around a half dozen or so common thread
APIs, including pthreads.  Just use pthreads directly if you have it; if
you don't, get with the times.

Reviewed-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2011-03-08 13:22:09 -05:00
Adam Jackson
2371b44f9e glx: unifdef SOLARIS_THREADS
Solaris 7 and older are not supported; Solaris 8 and later have (and
use) pthreads.

Acked-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2011-03-08 13:22:01 -05:00
Adam Jackson
a5fdd1aa06 glx: Remove unused _glapi_get_proc_offset and friends
Reviewed-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2011-03-08 13:21:56 -05:00
Julien Cristau
402b329c3a glx: Work around wrong request lengths sent by mesa
mesa used to send too long requests for GLXDestroyPixmap,
GLXDestroyWindow, GLXChangeDrawableAttributes, GLXGetDrawableAttributes
and GLXGetFBConfigsSGIX.

Fixes a regression introduced in ec9c97c6bf
X.Org bug#33324 <https://bugs.freedesktop.org/show_bug.cgi?id=33324>

Reported-by: xunx.fang@intel.com
Signed-off-by: Julien Cristau <jcristau@debian.org>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2011-02-15 12:19:59 +01:00
Julien Cristau
1137c11be0 glx: fix BindTexImageEXT length check
The request is followed by a list of attributes.

X.Org bug#33449

Reported-and-tested-by: meng <mengmeng.meng@intel.com>
Signed-off-by: Julien Cristau <jcristau@debian.org>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2011-02-15 12:19:59 +01:00
Julien Cristau
a883cf1545 glx: fix request length check for CreateGLXPbufferSGIX
The request is followed by an attribute list.

Signed-off-by: Julien Cristau <jcristau@debian.org>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2011-02-15 12:19:59 +01:00
Julien Cristau
d9225b9602 glx: validate numAttribs field before using it
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Julien Cristau <jcristau@debian.org>
2011-01-10 15:36:09 +01:00
Julien Cristau
62319e8381 glx: swap the request arrays entirely, not just half of them
Various glx requests include a list of pairs of attributes.  We were
only swapping the first half.

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Julien Cristau <jcristau@debian.org>
2011-01-10 15:36:01 +01:00
Julien Cristau
6c69235a9d glx: check request length before swapping
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Julien Cristau <jcristau@debian.org>
2011-01-10 15:31:40 +01:00
Julien Cristau
ec9c97c6bf glx: validate request lengths
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Julien Cristau <jcristau@debian.org>
2011-01-10 15:31:30 +01:00
Julien Cristau
3f0d3f4d97 glx: make sure screen is non-negative in validGlxScreen
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Julien Cristau <jcristau@debian.org>
2011-01-10 15:31:12 +01:00
Adam Jackson
63ccaec2c3 glx: warning fixes
render2.c: In function ‘__glXDisp_Map2d’:
render2.c:127: warning: ‘u1’ may be used uninitialized in this function
render2.c: In function ‘__glXDisp_Map1d’:
render2.c:90: warning: ‘u1’ may be used uninitialized in this function

Remove unnecessary test, and change memcpy to memmove as all users were
doing overlapping copies.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2010-12-31 12:52:24 +00:00
Daniel Stone
32c85ad4b8 GLX: DRI2: Fix mismatched-types warning
All the DRI extension types have a base extension type as their first
member to avoid exactly these types of warning.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
Reviewed-by: Cyril Brulebois <kibi@debian.org>
2010-12-31 12:36:44 +00:00
Adam Jackson
a80780a763 glx: Remove swap barrier and hyperpipe support
Never implemented in any open source driver.  The implementation
assumed explicit DDX driver knowledge of how the client-side driver
worked, since at the time the server's GL renderer was not a DRI driver.
But now, it is, so any implementation of these should be done with
additional DRI driver API, like the swap control extension.

Reviewed-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2010-11-30 12:54:47 -05:00
Keith Packard
4ed4915bc0 Merge remote branch 'whot/for-keith' 2010-11-10 16:58:21 -08:00
Eric Anholt
f36153e3ef Replace usage of DamageRegionAppend with DamageDamageRegion to fix reportAfter.
In all these cases, any rendering implied by this damage has already
occurred, and we want to get the damage out to the client.  Some of
the DamageRegionAppend calls were explicitly telling damage to flush
the reportAfter damage out, but not all.

Bug #30260. Fixes the compiz wallpaper plugin with client damage
changed to reportAfter.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-11-10 15:51:03 -08:00
Cyril Brulebois
68e4a628d6 Remove more superfluous if(p!=NULL) checks around free(p).
This patch has been generated by the following Coccinelle semantic patch:

@@
expression E;
@@
- if (E != NULL) {
-   free(E);
- }
+ free(E);

Signed-off-by: Cyril Brulebois <kibi@debian.org>
Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-11-11 08:30:26 +10:00
Cyril Brulebois
b142b0d274 Remove more superfluous if(p!=NULL) checks around free(p).
This patch has been generated by the following Coccinelle semantic patch:

@@
expression E;
@@
- if (E != NULL)
-   free(E);
+ free(E);

Signed-off-by: Cyril Brulebois <kibi@debian.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-11-11 08:29:54 +10:00
Kristian Høgsberg
2f0abd7d69 glx: Fix use after free in DrawableGone
(note that nearly identical patches were proposed by Kristian and Chris)

Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reported-by: Julien Cristau <jcristau@debian.org>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Tested-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-09-28 08:01:28 -07:00
Jamey Sharp
0f48e362c5 glxdriswrast: Use CreateGC, not CreateScratchGC.
Since this code was using CreateScratchGC and not GetScratchGC,
FreeScratchGC would always call FreeGC, so just call it directly.

As long as the drawable provided to CreateGC has the same screen and
depth as were passed to CreateScratchGC, these functions are basically
identical. There are two differences:

- CreateGC gives you a non-null stipple. You probably don't care.

- CreateGC passes the gcid and client to XACE. There are several
  internal GCs allocated in the server, and they all pass 0 and
  serverClient. I expect XACE will never reject that combination.

The callers of createDrawable all verify that pDraw has the same screen
that driScreen does. In short, this should have no behavioral change.

Signed-off-by: Jamey Sharp <jamey@minilop.net>
Cc: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2010-09-13 15:58:08 -07:00
Chris Wilson
7e58178060 glx: Prevent NULL context deref in __glXGetDrawable() (bug 29184)
During a SwapBuffers request, we may end up querying an unknown drawable
outside of an active context, and so need to report this error prior to
attempting to dereference the NULL context.

Also fixes:

  [Bug 29184] glXSwapBuffers with no GLX context crashes X.
  https://bugs.freedesktop.org/show_bug.cgi?id=29184

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-08-19 18:03:11 -07:00
Keith Packard
d75e8146c4 Unwrap/rewrap EnterVT/LeaveVT completely, Fixes 28998
Because some EnterVT code needs to remove it self from the
call chain, we need to fix all of the wrappers to correctly
unwrap/rewrap during the call chain. This is a follow-on to the fix
for bug 27114 in commit 68a9ee8370.

Signed-off-by: Keith Packard <keithp@keithp.com>
Tested-by: Jesse Barnes <jesse.barnes@intel.com>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Tiago Vignatti <tiago.vignatti@nokia.com>
2010-07-13 09:58:04 -07:00
Dave Airlie
c6bc52cb66 dri2: avoid crash with old dri drivers.
I built latest server and copied over a mesa 7.8 dri2 driver to use with it,
and it crashed in here starting compiz. Looks like we need to validate the
flush extension is registered before calling invalidate.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Michel Dänzer <michel@daenzer.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-06-22 11:40:15 -07:00
Mikhail Gusarov
6592db6bb5 Get rid of xstrdup when argument is definitely non-NULL
Replace xstrdup with strdup when either constant string is
being duplicated or argument is guarded by conditionals and
obviously can't be NULL

Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2010-06-11 19:04:23 +07:00
Jamey Sharp
353e32d371 glxdriswrast bugfix: configure swapgc, not gc.
I got this wrong in e2929db7b7.

Signed-off-by: Jamey Sharp <jamey@minilop.net>
Cc: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-06-10 06:50:47 -07:00
Mikhail Gusarov
7287ef9e6c Remove unnecessary parentheses around return values in functions
This patch was generated by the following Perl code:

perl -i -pe 's/([^_])return\s*\(\s*([^(]+?)\s*\)s*;(\s+(\n))?/$1return $2;$4/g;'

Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-06-10 06:42:42 -07:00
Mikhail Gusarov
0a4d8cbdcd Remove more superfluous if(p) checks around free(p)
This patch has been generated by the following Coccinelle semantic patch:

@@
expression E;
@@

-if(E) { free(E); }
+free(E);

Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Reviewed-by: Julien Cristau <jcristau@debian.org>
Reviewed-by: Fernando Carrijo <fcarrijo@yahoo.com.br>
Reviewed-by: Matt Turner <mattst88@gmail.com>
2010-06-06 20:27:18 +07:00
Keith Packard
faeebead7b Change the devPrivates API to require dixRegisterPrivateKey
This patch only changes the API, not the implementation of the
devPrivates infrastructure. This will permit a new devPrivates
implementation to be layed into the server without requiring
simultaneous changes in every devPrivates user.

Signed-off-by: Keith Packard <keithp@keithp.com>
Tested-by: Tiago Vignatti <tiago.vignatti@nokia.com>
2010-06-05 19:23:03 -07:00
Keith Packard
2dc138922b Rename region macros to eliminate screen argument
This is a combination of a huge mechanical patch and a few small
fixups required to finish the job. They were reviewed separately, but
because the server does not build without both pieces, I've merged
them together at this time.

The mechanical changes were performed by running the included
'fix-region' script over the whole tree:

$ git ls-files | grep -v '^fix-' | xargs ./fix-region

And then, the white space errors in the resulting patch were fixed
using the provided fix-patch-whitespace script.

$ sh ./fix-patch-whitespace

Thanks to Jamey Sharp for the mighty fine sed-generating sed script.

The hand-done changes involve removing functions from dix/region.c
that duplicate inline functions in include/regionstr.h, along with
their declarations in regionstr.h, mi.h and mispans.h.

Reviewed-by: Jamey Sharp <jamey@minilop.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-06-05 18:59:00 -07:00
Jamey Sharp
8033fb6c97 Set event sequence number in WriteEventsToClient instead of at callers.
TryClientEvents already did this; this commit just moves the assignment
one level down so that no event source has to worry about sequence
numbers.

...No event source, that is, except XKB, which inexplicably calls
WriteToClient directly for several events.

Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Julien Cristau <jcristau@debian.org>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2010-05-19 12:32:34 -07:00
Jamey Sharp
92ed75ac59 Eliminate boilerplate around client->noClientException.
Just let Dispatch() check for a noClientException, rather than making
every single dispatch procedure take care of it.

Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2010-05-13 17:14:07 -07:00
Jamey Sharp
a3d948ddbb clientErrorValue is never used outside dix. Stop importing it.
Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2010-05-13 17:14:07 -07:00
Jamey Sharp
6a84cd9434 Replace dixChangeGC with calls directly to the right variant.
Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2010-05-13 17:14:07 -07:00
Jamey Sharp
e2929db7b7 dixChangeGC callers: Use ChangeGCVal instead of XID almost everywhere.
The exceptions are ProcChangeGC and CreateGC.

Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2010-05-13 17:13:48 -07:00
Kristian Høgsberg
421606a8ef dri2: Send out event when auxillary buffers are invalidated
This lets the DRI2 clients rely on the server to notify them when they
need to get new buffers.  Without this, OpenGL clients poll the server
in glViewport() which can be a performance problems and also isn't
completely correct behaviour.

We bump the DRI2 protocol minor to indicate the availability of the
event, which the DRI2 clients can use to avoid polling.  This speeds up
various piglit and oglc test cases as well as real applications.

Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-05-13 06:32:04 -07:00
Mikhail Gusarov
3f3ff971ec Replace X-allocation functions with their C89 counterparts
The only remaining X-functions used in server are XNF*, the rest is converted to
plain alloc/calloc/realloc/free/strdup.

X* functions are still exported from server and x* macros are still defined in
header file, so both ABI and API are not affected by this change.

Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-05-13 00:22:37 +07:00
Kristian Høgsberg
9de0e31746 dri2: Take an XID for tracking the DRI2 drawable
Some pixmaps (window pixmaps and scratch pixmaps) don't have the
drawable->id set and thus DRI2 gets confused when using that field
for looking up the DRI2 drawable.  Go back to using privates for getting
at the DRI2 drawable from a DrawablePtr.  We need to keep the resource
tracking in place so we can remove the DRI2 drawable when the X resource
it was created for goes away.  Additionally, we also now track the DRI2
drawable using a client XID so we can reclaim the DRI2 drawable even if
the client goes before the drawable and doesn't destroy the DRI2 drawable.

Tested-by: Owen W. Taylor <otaylor@fishsoup.net>
Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
2010-05-11 11:01:35 -04:00
Kristian Høgsberg
4a8a615d01 glxdri2: Hard-code the extension version we need
If we use the #define'd version from dri_interface.h, the server will
require at least that version of the extension.  If we're compiling against
a dri_interface.h with a newer version we don't really require, glxdri2
will require a too high version of the extension.

The right approach is to just hard-code the version we need instead of
using the #defines.

Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2010-05-11 11:01:35 -04:00
Jamey Sharp
35761d5f81 Introduce dixLookupFontable for "FONT or GC" parameters.
Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Julien Cristau <jcristau@debian.org>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-05-07 21:56:36 -07:00
Kristian Høgsberg
a92b2c2c8d glx: Drop DestroyWindow hook
Now that glx doesn't call DRI2DestroyDrawable anymore, we don't need to
force a specific resource destruction order in the DestroyWindow hook.

Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Michel Dänzer <michel@daenzer.net>

https://bugs.freedesktop.org/show_bug.cgi?id=26394
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-04-16 14:53:35 -07:00
Kristian Høgsberg
1da1f33f2d DRI2: Track DRI2 drawables as resources, not privates
The main motivation here is to have the resource system clean up the
DRI2 drawable automatically so glx doesn't have to.  Right now, the
glx drawable resource must be destroyed before the X drawable, so that
calling DRI2DestroyDrawable doesn't crash.  By making the DRI2
drawable a resource, GLX doesn't have to worry about that and the
resource destruction order becomes irrelevant.

https://bugs.freedesktop.org/show_bug.cgi?id=26394

Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-04-16 14:53:31 -07:00
Kristian Høgsberg
22da7aa9d7 glx: Let the resource system destroy pixmaps
GLX pbuffers are implemented using a pixmap allocated by the server.
With the change to DRI2 to track DRI2 drawables as resources, we need to make
sure that every drawable we create a DRI2 drawable for has an XID.  By
using the XID of the pbuffer, the resource system will automatically
reclaim the hidden pixmap and the DRI2 drawable when the pbuffer is
destroyed or the client exits.

Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-04-16 14:53:25 -07:00
Kristian Høgsberg
f0006aa58f glx: Track GLX 1.3 style GLX drawables under their X drawable ID as well
This ensures that the DrawableGone callback gets called as necessary
when the X drawable goes away.  Otherwise, using a GLX drawable
(say, glXSwapBuffers) in indirect mode after the X drawable has been
destroyed will crash the server.

Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Michel Dänzer <michel@daenzer.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-04-16 14:53:17 -07:00
Kristian Høgsberg
1760d2bef9 glx: Set the pbuffer bit for dri2 fbconfigs
They've been implemented for a while, but we never advertised them.  All we
need to do is set the GLX_PBUFFER_BIT in the drawable type fbconfig
field when we're using DRI2.

https://bugs.freedesktop.org/show_bug.cgi?id=26581

Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-04-12 21:42:14 -07:00
Keith Packard
a7698a6776 Merge remote branch 'jbarnes/master' 2010-04-06 12:36:15 -07:00
Jesse Barnes
165a4a9c7d GLX/DRI2: expose swap control extensions if DDX support is present
Export DDX swap control status from the DRI2 module and check for it in
GLX when initializing extensions.

Reviewed-by: Mario Kleiner <mario.kleiner@tuebingen.mpg.de>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2010-03-29 10:03:12 -07:00
Jeremy Huddleston
73b3b67aac GLX: Remove a redundant initialization
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
Acked-by: Adam Jackson <ajax@redhat.com>
2010-03-29 09:37:14 -07:00
Tomas Carnecky
0c2fde5c8a Fix typos in the swap functions
This should fix bug #3539.

Signed-off-by: Tomas Carnecky <tom@dbservice.com>
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-03-23 03:52:14 +01:00
Kristian Høgsberg
018b177591 glx: Compile fix to let server compile with new and old mesa
We broke the __DRI2_FLUSH API since it was never released, but since it's
taking a little longer than expected to get the X server side of the changes
ready, fix things up so it compiles.

Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-02-24 09:16:46 -08:00
Rami Ylimaki
5b9a52be7e os: Prevent core dump from being truncated.
The problem fixed by this patch can be reproduced on Linux with the
following steps.
- Access NULL pointer intentionally in ProcessOtherEvent on key press.
- Instead of saving core dump to a file, write it into a pipe.
  echo "|/usr/sbin/my-core-dumper" > /proc/sys/kernel/core_pattern
- Dump the core by pressing a key.

While the core is being dumped into the pipe, the smart schedule timer
will cause a pending SIGALRM. Linux kernel stops writing data to the
pipe when there are pending signals. This causes the core dump to be
truncated. On my system I'm expecting a 6 MB dump but the size will be
60 kB instead. The problem is solved if we block the SIGALRM caused by
expired smart schedule timer.

I haven't been able to reproduce this problem in the following cases.
- Save core dump to a file instead of a pipe.
- kill -SEGV `pidof Xorg`
- Press a key to dump core while gdb is attached to Xorg.
- Give option -dumbSched to Xorg.

Also note that the fix works only when NoTrapSignals has the default
value FALSE. The problem can still be reproduced if error signals
aren't trapped. In addition to pending SIGALRM, there is a similar
problem with pending SIGIO from the keyboard driver during core dump.

Signed-off-by: Rami Ylimaki <ext-rami.ylimaki@nokia.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-02-17 23:20:52 -08:00
Keith Packard
0b21a0416b Merge remote branch 'alanc/master' 2010-01-27 14:14:15 -08:00
Eric Anholt
0688dca044 dri2: Fix order of operations issue in __glXdriSwapEvent test.
Clients would have received swap events regardless of asking for it.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-01-27 14:06:59 -08:00
Alan Coopersmith
138d4c1670 glx: Sun compilers now support some gcc __attribute__ values
Sun cc 5.9 and later (__SUNPRO_C >= 0x590) support __attribute__
calls for aligned, always_inline, noinline, pure, const, and malloc.

This commit consists of the related updates to files that were
regenerated by gl_XML.py in mesa after adding the __SUNPRO_C checks to it

Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
Signed-off-by: Brian Paul <brianp@vmware.com>
2010-01-25 11:10:00 -08:00