History log of /external/mesa3d/src/glx/dri3_glx.c
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
e4bb5be7b27cd3a5c8b6d98a1e1b5f9a55815103 02-Feb-2017 Nicolai Hähnle <nicolai.haehnle@amd.com> glx: guard swap-interval functions against destroyed drawables

The GLX specification says about glXDestroyPixmap:

"The storage for the GLX pixmap will be freed when it is not current
to any client."

So arguably, functions like glXSwapIntervalMESA can be called after
glXDestroyPixmap has been called for the currently bound GLXPixmap.
In that case, the GLXDRIDrawable no longer exists, and so we just skip
those calls.

Cc: 17.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit f446f3fb33528eebe9b120340fca3ac5c5ba518d)
/external/mesa3d/src/glx/dri3_glx.c
48d5cf36a1cfd548e6a98d96828273f035066b5b 02-Feb-2017 Nicolai Hähnle <nicolai.haehnle@amd.com> glx/dri3: guard in_current_context against a disappeared drawable

Cc: 17.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
(cherry picked from commit 21ec35566be2c1aca07083a67f462618ae15fa86)
/external/mesa3d/src/glx/dri3_glx.c
b3bc9b4b526157356931d76ecb1b389316514212 27-Jan-2017 Nicolai Hähnle <nicolai.haehnle@amd.com> glx/dri3: handle NULL pointers in loader-to-DRI3 drawable conversion

With a subsequent patch, we might see NULL loaderPrivates, e.g. when
a DRIdrawable is flushed whose corresponding GLXDRIdrawable was destroyed.
This resulted in a crash, since the loader vs. DRI3 drawable structures
have a non-zero offset.

Fixes glx-visuals-{depth,stencil} -pixmap

Cc: 17.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit 40c304fc065259c07c0f4f7a35efedd205e4f250)
/external/mesa3d/src/glx/dri3_glx.c
b6670157d742548e7f2430614786c733eb4c20e9 01-Jan-2017 Fredrik Höglund <fredrik@kde.org> dri3: Fix MakeCurrent without a default framebuffer

In OpenGL 3.0 and later it is legal to make a context current without
a default framebuffer.

This has been broken since DRI3 support was introduced.

Cc: "13.0 12.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
/external/mesa3d/src/glx/dri3_glx.c
af7abc512c422183a761ce3d687086abe282fa74 12-Sep-2016 Emil Velikov <emil.velikov@collabora.com> loader: remove loader_get_driver_for_fd() driver_type

Reminiscent from the pre-loader days, were we had multiple instances of
the loader logic in separate places and one could build a "GALLIUM_ONLY"
version.

Since that is no longer the case and the loaders (glx/egl/gbm) do not
(and should not) require to know any classic/gallium specific we can
drop the argument and the related code.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
/external/mesa3d/src/glx/dri3_glx.c
9caacb39b9f27919a7c986ad0c5d671a81b1f1e0 25-Aug-2016 Emil Velikov <emil.veliikov@collabora.com> loader/dri3: constify the loader_dri3_vtable

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
/external/mesa3d/src/glx/dri3_glx.c
0247e5ee3edd546b8598082d5b45d110f61853d0 06-Oct-2016 Martin Peres <martin.peres@linux.intel.com> loader/dri3: add get_dri_screen() to the vtable

This allows querying the current active screen from the
loader's common code.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Martin Peres <martin.peres@linux.intel.com>
/external/mesa3d/src/glx/dri3_glx.c
7d25ed70362ee9362aeeadb00f5a4e2bea690827 25-Apr-2016 Stefan Dirsch <sndirsch@suse.de> dri3: Check for dummyContext to see if the glx_context is valid

According to the comments in src/glx/glxcurrent.c __glXGetCurrentContext()
always returns a valid pointer. If no context is made current, it will
contain dummyContext. Thus a test for NULL will always fail.

https://lists.freedesktop.org/archives/mesa-dev/2016-April/113962.html

Signed-off-by: Stefan Dirsch <sndirsch@suse.de>
Reviewed-by: Egbert Eich <eich@freedesktop.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
/external/mesa3d/src/glx/dri3_glx.c
37d3a26bd620703f63673101f4093d13fb97ddef 03-Mar-2016 Marek Olšák <marek.olsak@amd.com> glx: implement GLX part of interop interface (v2)

v2: - use const
/external/mesa3d/src/glx/dri3_glx.c
5ac7f0433b17acc6587b87ce25adb6975c04eb27 19-Jan-2016 Ilia Mirkin <imirkin@alum.mit.edu> glx: update to updated version of EXT_create_context_es2_profile

The EXT spec has been updated to:
- logically combine the es2_profile and es_profile exts
- allow any legal version to be requested

dEQP tests request a specific ES version when using GLX, so this allows
dEQP upstream to run against GLX with the appropriate X server patch
(which had similar disabling logic).

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Matt Turner <mattst88@gmail.com> (v1)
Reviewed-by: Adam Jackson <ajax@redhat.com> (v3)

v1 -> v2:
- distinguish between DRI_API_GLES{,2,3}
- add GLX_EXT_create_context_es_profile client-side support
v2 -> v3:
- fix error in computing mask
/external/mesa3d/src/glx/dri3_glx.c
f7b71451231c75c36771e8b7b0d78f05e0d50f65 19-Dec-2015 Ilia Mirkin <imirkin@alum.mit.edu> glx/dri3: a drawable might not be bound at wait time

A trace of Alien Isolation hit this on nouveau.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-and-Tested-by: Michel Dänzer <michel.daenzer@amd.com>
Cc: "11.0 11.1" <mesa-stable@lists.freedesktop.org>
/external/mesa3d/src/glx/dri3_glx.c
fdacbc439edc1d26865a99524d1a9efc9edb4c0d 21-Jul-2015 Boyan Ding <boyan.j.ding@gmail.com> glx/dri3: Convert to use dri3 helper in loader library

v2: From Martin Peres
- convert to the new drawable interface
- delete dead code after the dropping of some vfuncs
- delete the width and height attributes since they are found in the helper

Signed-off-by: Boyan Ding <boyan.j.ding@gmail.com>
Signed-off-by: Martin Peres <martin.peres@linux.intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Emil Velikov <emil.velikov@collabora.co.uk>
/external/mesa3d/src/glx/dri3_glx.c
f7008ebcdc4d936e8b2b1a317d870e907e4d369f 17-Apr-2015 Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> dri3_open: don't leak the reply

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90073
Signed-off-by: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
/external/mesa3d/src/glx/dri3_glx.c
c4ff6d00cd7dde4646ff96733f68d3ddbf540c2c 01-May-2015 Axel Davy <axel.davy@ens.fr> glx/dri3: Add additional check for gpu offloading case

Checks blitImage is implemented.
Initially having the __DRIimageExtension extension
at version 9 at least meant blitImage was supported.
However some implementation do advertise version >= 9
without implementing it.

CC: 10.5 <mesa-stable@lists.freedesktop.org>

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>

Signed-off-by: Axel Davy <axel.davy@ens.fr>
/external/mesa3d/src/glx/dri3_glx.c
cedd5008dad7750835cc4a4a318afc82fe351eac 06-May-2015 Martin Peres <martin.peres@linux.intel.com> glx: report which DRI version is used when in verbose debug mode

This should make it more obvious in bug reports while also removing
any sort of guesswork for developers.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Martin Peres <martin.peres@linux.intel.com>
/external/mesa3d/src/glx/dri3_glx.c
0d7f4c8658e00d30a1b0c3f2d803378eaa0717c7 05-Dec-2014 Mario Kleiner <mario.kleiner.de@gmail.com> glx/dri3: Don't fail on glXSwapBuffersMscOML(dpy, window, 0, 0, 0) (v2)

glXSwapBuffersMscOML() with target_msc=divisor=remainder=0 gets
translated into target_msc=divisor=0 but remainder=1 by the mesa
api. This is done for server DRI2 where there needs to be a way
to tell the server-side DRI2ScheduleSwap implementation if a call
to glXSwapBuffers() or glXSwapBuffersMscOML(dpy,window,0,0,0) was
done. remainder = 1 was (ab)used as a flag to tell the server to
select proper semantic. The DRI3/Present backend ignored this
signalling, treated any target_msc=0 as glXSwapBuffers() request,
and called xcb_present_pixmap with invalid divisor=0, remainder=1
combo. The present extension responded kindly to this with a
BadValue error and dropped the request, but mesa's DRI3/Present
backend doesn't check for error codes. From there on stuff went
downhill quickly for the calling OpenGL client...

This patch fixes the problem.

v2: Change comments to be more clear, with reference to
relevant spec, as suggested by Eric Anholt.

Cc: "10.3 10.4" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: Eric Anholt <eric@anholt.net>
/external/mesa3d/src/glx/dri3_glx.c
455d3036fab2c5da7e589644f12435fb104a69fc 05-Dec-2014 Mario Kleiner <mario.kleiner.de@gmail.com> glx/dri3: Request non-vsynced Present for swapinterval zero. (v3)

Restores proper immediate tearing swap behaviour for
OpenGL bufferswap under DRI3/Present.

Cc: "10.3 10.4" <mesa-stable@lists.freedesktop.org>

v2: Add Frank Binns signed off by for his original earlier
patch from April 2014, which is identical to this one, and
Chris Wilsons reviewed tag from May 2014 for that patch, ergo
also for this one.

v3: Incorporate comment about triple buffering as suggested
by Axel Davy, and reference to relevant spec provided by
Eric Anholt.

Signed-off-by: Frank Binns <frank.binns@imgtec.com>
Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: Eric Anholt <eric@anholt.net>
/external/mesa3d/src/glx/dri3_glx.c
ad8b0e8bf68850a57daba0b47629ca14807ea3ad 05-Dec-2014 Mario Kleiner <mario.kleiner.de@gmail.com> glx/dri3: Track separate (ust, msc) for PresentPixmap vs. PresentNotifyMsc (v2)

Prevent calls to glXGetSyncValuesOML() and glXWaitForMscOML()
from overwriting the (ust,msc) values of the last successfull
swapbuffers call (PresentPixmapCompleteNotify event), as
glXWaitForSbcOML() relies on those values corresponding to
the most recent completed swap, not to whatever was last
returned from the server.

Problematic call sequence without this patch would have been, e.g.,

glXSwapBuffers()
... wait ...
swap completes -> PresentPixmapComplete event -> (ust,msc)
updated to reflect swap completion time and count.
... wait for at least 1 video refresh cycle/vblank increment.

glXGetSyncValuesOML()
-> PresentNotifyMsc event overwrites (ust,msc) of swap
completion with (ust,msc) of most recent vblank

glXWaitForSbcOML()
-> Returns sbc of last completed swap but (ust,msc) of last
completed vblank, not of last completed swap.
-> Client is confused.

Do this by tracking a separate set of (ust, msc) for the
dri3_wait_for_msc() call than for the dri3_wait_for_sbc()
call.

This makes the glXWaitForSbcOML() call robust again and restores
consistent behaviour with the DRI2 implementation.

Fixes applications originally written and tested against
DRI2 which also rely on this not regressing under DRI3/Present,
e.g., Neuro-Science software like Psychtoolbox-3.

This patch fixes the problem.

v2: Rename vblank_msc/ust to notify_msc/ust as suggested by
Axel Davy for better clarity.

Cc: "10.3 10.4" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
/external/mesa3d/src/glx/dri3_glx.c
8cab54de16f4691672533967daa79c9cfa2e24cc 05-Dec-2014 Mario Kleiner <mario.kleiner.de@gmail.com> glx/dri3: Fix glXWaitForSbcOML() to handle targetSBC==0 correctly. (v2)

targetSBC == 0 is a special case, which asks the function
to block until all pending OpenGL bufferswap requests have
completed.

Currently the function just falls through for targetSBC == 0,
returning bogus results.

This breaks applications originally written and tested against
DRI2 which also rely on this not regressing under DRI3/Present,
e.g., Neuro-Science software like Psychtoolbox-3.

This patch fixes the problem.

v2: Simplify as suggested by Axel Davy. Add comments proposed
by Eric Anholt.

Cc: "10.3 10.4" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: Eric Anholt <eric@anholt.net>
/external/mesa3d/src/glx/dri3_glx.c
26122e09a304061e46690e1b9da2e36a527b3e2e 15-Mar-2014 Kenneth Graunke <kenneth@whitecape.org> glx/dri3: Implement LIBGL_SHOW_FPS=1 for DRI3/Present.

v2: Use the UST value provided in the PRESENT_COMPLETE_NOTIFY event
rather than gettimeofday(), which gives us the presentation time
instead of the time when SwapBuffers was called. Suggested by
Keith Packard. This relies on the fact that the X DRI3/Present
implementations use microseconds for UST.

v3: Properly ignore PresentCompleteKindMSCNotify; multiply in 64 bits
(caught by Keith Packard).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Keith Packard <keithp@keithp.com> [v3]
Reviewed-by: Marek Olšák <marek.olsak@amd.com> [v1]
/external/mesa3d/src/glx/dri3_glx.c
3202926746298468805f54ac5b39d62f9585dabf 01-Oct-2014 Keith Packard <keithp@keithp.com> glx/dri3: Provide error diagnostics when DRI3 allocation fails

Instead of just segfaulting in the driver when a buffer allocation fails,
report error messages indicating what went wrong so that we can debug things.

As a simple example, chromium wraps Mesa in a sandbox which doesn't allow
access to most syscalls, including the ability to create shared memory
segments for fences. Before, you'd get a simple segfault in mesa and your 3D
acceleration would fail. Now you get:

$ chromium --disable-gpu-blacklist
[10618:10643:0930/200525:ERROR:nss_util.cc(856)] After loading Root Certs, loaded==false: NSS error code: -8018
libGL: pci id for fd 12: 8086:0a16, driver i965
libGL: OpenDriver: trying /local-miki/src/mesa/mesa/lib/i965_dri.so
libGL: Can't open configuration file /home/keithp/.drirc: Operation not permitted.
libGL: Can't open configuration file /home/keithp/.drirc: Operation not permitted.
libGL error: DRI3 Fence object allocation failure Operation not permitted
[10618:10618:0930/200525:ERROR:command_buffer_proxy_impl.cc(153)] Could not send GpuCommandBufferMsg_Initialize.
[10618:10618:0930/200525:ERROR:webgraphicscontext3d_command_buffer_impl.cc(236)] CommandBufferProxy::Initialize failed.
[10618:10618:0930/200525:ERROR:webgraphicscontext3d_command_buffer_impl.cc(256)] Failed to initialize command buffer.

This made it pretty easy to diagnose the problem in the referenced bug report.

Bugzilla: https://code.google.com/p/chromium/issues/detail?id=415681
Signed-off-by: Keith Packard <keithp@keithp.com>
Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Matt Turner <mattst88@gmail.com>
/external/mesa3d/src/glx/dri3_glx.c
f7a355556ef5fe23056299a77414f9ad8b5e5a1d 02-Jul-2014 Keith Packard <keithp@keithp.com> glx/dri3: Use four buffers until X driver supports async flips

A driver which doesn't have async flip support will queue up flips without any
way to replace them afterwards. This means we've got a scanout buffer pinned
as soon as we schedule a flip and so we need another buffer to keep from
stalling.

When vblank_mode=0, if there are only three buffers we do:

current scanout buffer = 0 at MSC 0

Render frame 1 to buffer 1
PresentPixmap for buffer 1 at MSC 1

This is sitting down in the kernel waiting for vblank to
become the next scanout buffer

Render frame 2 to buffer 2
PresentPixmap for buffer 2 at MSC 1

This cannot be displayed at MSC 1 because the
kernel doesn't have any way to replace buffer 1 as the pending
scanout buffer. So, best case this will get displayed at MSC 2.

Now we block after this, waiting for one of the three buffers to become idle.
We can't use buffer 0 because it is the scanout buffer. We can't use buffer 1
because it's sitting in the kernel waiting to become the next scanout buffer
and we can't use buffer 2 because that's the most recent frame which will
become the next scanout buffer if the application doesn't manage to generate
another complete frame by MSC 2.

With four buffers, we get:

current scanout buffer = 0 at MSC 0

Render frame 1 to buffer 1
PresentPixmap for buffer 1 at MSC 1

This is sitting down in the kernel waiting for vblank to
become the next scanout buffer

Render frame 2 to buffer 2
PresentPixmap for buffer 2 at MSC 1

This cannot be displayed at MSC 1 because the
kernel doesn't have any way to replace buffer 1 as the pending
scanout buffer. So, best case this will get displayed at MSC
2. The X server will queue this swap until buffer 1 becomes
the scanout buffer.

Render frame 3 to buffer 3
PresentPixmap for buffer 3 at MSC 1

As soon as the X server sees this, it will replace the pending
buffer 2 swap with this swap and release buffer 2 back to the
application

Render frame 4 to buffer 2
PresentPixmap for buffer 2 at MSC 1

Now we're in a steady state, flipping between buffer 2 and 3
waiting for one of them to be queued to the kernel.

...

current scanout buffer = 1 at MSC 1

Now buffer 0 is free and (e.g.) buffer 2 is queued in
the kernel to be the scanout buffer at MSC 2

Render frames, flipping between buffer 0 and 3

When the system can replace a queued buffer, and we update Present to take
advantage of that, we can use three buffers and get:

current scanout buffer = 0 at MSC 0

Render frame 1 to buffer 1
PresentPixmap for buffer 1 at MSC 1

This is sitting waiting for vblank to become the next scanout
buffer

Render frame 2 to buffer 2
PresentPixmap for buffer 2 at MSC 1

Queue this for display at MSC 1
1. There are three possible results:

1) We're still before MSC 1. Buffer 1 is released,
buffer 2 is queued waiting for MSC 1.

2) We're now after MSC 1. Buffer 0 was released at MSC 1.
Buffer 1 is the current scanout buffer.

a) If the user asked for a tearing update, we swap
scanout from buffer 1 to buffer 2 and release buffer
1.

b) If the user asked for non-tearing update, we
queue buffer 2 for the MSC 2.

In all three cases, we have a buffer released (call it 'n'),
ready to receive the next frame.

Render frame 3 to buffer n
PresentPixmap for buffer n

If we're still before MSC 1, then we'll ask to present at MSC
1. Otherwise, we'll ask to present at MSC 2.

Present already does this if the driver offers async flips, however it does
this by waiting for the right vblank event and sending an async flip right at
that point.

I've hacked the intel driver to offer this, but I get tearing at the top of
the screen. I think this is because flips are always done from within the
ring, and so the latency between the vblank event and the async flip happening
can cause tearing at the top of the screen.

That's why I'm keying the need for the extra buffer on the lack of 2D
driver support for async flips.

Signed-off-by: Keith Packard <keithp@keithp.com>
Acked-by: Jason Ekstrand <jason.ekstrand@intel.com>
Tested-by: Dylan Baker <baker.dylan.c@gmail.com>
/external/mesa3d/src/glx/dri3_glx.c
9320c8fea947fd0f6eb723c67f0bdb947e45c4c3 17-May-2014 Axel Davy <axel.davy@ens.fr> glx/dri3: add GPU offloading support.

The differences with DRI2 GPU offloading are:
a) There's no logic for GPU offloading needed in the Xserver

b) for DRI2, the card would render to a back buffer, and
the content would be copied to the front buffer (the same buffers
everytime). Here we can potentially use several back buffers and copy
to buffers with no tiling to share with X. We send them with the
Present extension.

That means than the DRI2 solution is forced to have tearings with GPU
offloading. In the ideal scenario, this DRI3 solution doesn't have this
problem.

However without dma-buf fences, a race can appear (if the card is slow
and the rendering hasn't finished before the server card reads the buffer),
and then old content is displayed. If a user hits this, he should probably
revert to the DRI2 solution (LIBGL_DRI3_DISABLE). Users with cards fast
enough seem to not hit this in practice (I have an Amd hd 7730m, and I
don't hit this, except if I force a low dpm mode)

c) for non-fullscreen apps, the DRI2 GPU offloading solution requires
compositing. This DRI3 solution doesn't have this requirement. Rendering
to a pixmap also works.

d) There is no need to have a DDX loaded for the secondary card.

V4: Fixes some piglit tests

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Signed-off-by: Dave Airlie <airlied@redhat.com>
/external/mesa3d/src/glx/dri3_glx.c
b94dc944df12bdb2bef385d2ac10c2ec66f7e4d6 27-Jun-2014 Dave Airlie <airlied@gmail.com> dri3: cache pointer to back instead of looking up.

This is just prep work for the dri3 prime patches.

Signed-off-by: Dave Airlie <airlied@redhat.com>
/external/mesa3d/src/glx/dri3_glx.c
e40cf256f4cb4105c760060e43ab19a4f1524ed3 19-Jun-2014 Axel Davy <axel.davy@ens.fr> dri3: use invalidate.

This doesn't change anything to the intel DRI3 implementation,
but enables the gallium implementation to use dri2.stamp instead
of relying on the stamp shared with the st backend.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
/external/mesa3d/src/glx/dri3_glx.c
e4419913bf0b12e33e91f1947295b67eff0d341e 27-Jun-2014 Dave Airlie <airlied@gmail.com> dri3: fix image extension checking.

Move the image extension setup in with all the others in
bind_extensions, and improve the check to both version
and function pointer.

Reviewed-by: Axel Davy <axel.davy@ens.fr>
Signed-off-by: Dave Airlie <airlied@redhat.com>
/external/mesa3d/src/glx/dri3_glx.c
83821ece79011d21303058e30694dd3796d072f2 10-May-2014 Jon TURNEY <jon.turney@dronecode.org.uk> glx: Add an error message when a direct renderer's createScreen() routine fails
because no matching fbConfigs or visuals could be found.

Nearly all the error cases in *createScreen() issue an error message to diagnose
the failure to initialize before branching to handle_error. The few remaining
error cases which don't should probably do the same.

(At the moment, it seems this can be triggered in drisw with an X server which
reports definite values for MAX_PBUFFFER_(WIDTH|HEIGHT|SIZE), because those
attributes are checked for an exact match against 0.)

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
/external/mesa3d/src/glx/dri3_glx.c
625bdd64e5ea3327d4459b1ccccff8dab89129d0 20-Feb-2014 Ian Romanick <ian.d.romanick@intel.com> dri3: Enable GLX_MESA_query_renderer on DRI3 too

This should have happend around the time of commit 4680d23, but Keith's
DRI3 patches and my GLX_MESA_query_renderer patches crossed in the mail.

I don't have a working DRI3 setup, so I haven't been able to actually
verify this. I'm hoping that someone can piglit this for me on DRI3...
It's also unfortunate the DRI2 and DRI3 can't share more code.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Cc: Keith Packard <keithp@keithp.com>
Cc: "10.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
/external/mesa3d/src/glx/dri3_glx.c
a2454bdfbd8f20b13e7f821d88e8e5da24e3e2a7 18-Feb-2014 Emil Velikov <emil.l.velikov@gmail.com> glx/dri3: explicitly assign struct components for glx_*_vtable

... to improve readability of code.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
/external/mesa3d/src/glx/dri3_glx.c
ecfe986120adb2c574cb03bea318eae96e564924 16-Mar-2014 Emil Velikov <emil.l.velikov@gmail.com> glx/dri3: rework __DRIextension handling

Use a const array with the extensions, rather than assigning each
one to a fixed size array at runtime.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
/external/mesa3d/src/glx/dri3_glx.c
9b42fd1772b13b10f397d80d11aa8351e6313085 18-Feb-2014 Emil Velikov <emil.l.velikov@gmail.com> dri_interface: Update __DRItexBufferExtensionRec to version 3

With commit e59fa4c46c8("dri2: release texture image.") we updated the
extension without bumping the version number. The patch itself added an
interface required to enable texture_from_pixmap on certain platforms.

The new code was effectively never build, as it depended on
__DRI_TEX_BUFFER_VERSION >= 3, which never came to be in upstream mesa.

This commit bumps the version number, drops the __DRI_TEX_BUFFER_VERSION
checks and resolves all the build conflicts. Additionally it add a version
check as egl and dri3, as require version 2 of the extension which does
not have the releaseTexBuffer hook.

Cc: Juan Zhao <juan.j.zhao@intel.com>
Cc: Kristian Høgsberg <krh@bitplanet.net>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
/external/mesa3d/src/glx/dri3_glx.c
a69fabc76cc5a8d744fb184bfc5a4096ee596c13 24-Feb-2014 Adel Gadllah <adel.gadllah@gmail.com> dri3: Add GLX_EXT_buffer_age support

v2: Indent according to Mesa style, reuse sbc instead of making a new
swap_count field, and actually get a usable back before returning the
age of the back (fixing updated piglit tests). Changes by anholt.

Signed-off-by: Adel Gadllah <adel.gadllah@gmail.com>
Reviewed-by: Robert Bragg <robert@sixbynine.org> (v1)
Reviewed-by: Adel Gadllah <adel.gadllah@gmail.com> (v2)
Reviewed-by: Eric Anholt <eric@anholt.net>
/external/mesa3d/src/glx/dri3_glx.c
0b02d8a633da7ee19793eb12bb5ea407afe0de6f 08-Mar-2014 Eric Anholt <eric@anholt.net> dri3: Prefer the last chosen back when finding a new one.

With the buffer_age code, I need to be able to potentially call this more
than once per frame, and it would be bad if a new special event showing up
meant I chose a different back mid-frame. Now, once we've chosen a back
for the frame, another find_back will choose it again since we know that
it won't have ->busy set until swap.

Note that this makes find_back return a buffer id instead of a backbuffer
index. That's kind of a silly distinction anyway, since it's an identity
mapping between the two (it's the front buffer that is at an offset).

Reviewed-By: Adel Gadllah <adel.gadllah@gmail.com>
/external/mesa3d/src/glx/dri3_glx.c
f41a65397b410d3960a6ed31b05367bee5229120 28-Feb-2014 Emil Velikov <emil.l.velikov@gmail.com> glx: cleanup unneeded headers

- xf86dri.h is the old dri1 header, not required by dri2 nor dri3
- fold xf86drm.h inclusiong inside dri2.h
- dri3_glx does not have any drm specific dependencies
- glapi.h is not required by the dri2 and dri3 codepaths

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
/external/mesa3d/src/glx/dri3_glx.c
e9eb3ec3314475601d181843aed7bbab3cb0cb53 12-Feb-2014 Emil Velikov <emil.l.velikov@gmail.com> glx/dri3: set the implemented version of __DRIimageLoaderExtension

... over the one provided by the spec.
Currently both versions are identical, but that is not
guaranteed to be the case in the future.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
/external/mesa3d/src/glx/dri3_glx.c
3fbd1b0cb576b46ac8df2697cb388db78f48012d 27-Jan-2014 Keith Packard <keithp@keithp.com> dri3: Track current Present swap mode and adjust buffer counts

This automatically adjusts the number of buffers that we want based on
what swapping mode the X server is using and the current swap interval:

swap mode interval buffers
copy > 0 1
copy 0 2
flip > 0 2
flip 0 3

Note that flip with swap interval 0 is currently limited to twice the
underlying refresh rate because of how the kernel manages flipping. Moving
from 3 to 4 buffers would help, but that seems ridiculous.

v2: Just update num_back at the point that the values that change num_back
change. This means we'll have the updated value at the point that the
freeing of old going-to-be-unused backbuffers happens, which might not
have been the case before (change by anholt, acked by keithp).

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
/external/mesa3d/src/glx/dri3_glx.c
aea4757eb4caf6f980fdaa2b9345f26329c29d12 22-Nov-2013 Keith Packard <keithp@keithp.com> dri3, i915, i965: Add __DRI_IMAGE_FOURCC_SARGB8888

The __DRIimage createImageFromFds function takes a fourcc code, but there was
no fourcc code that match __DRI_IMAGE_FORMAT_SARGB8. This adds a define for
that format, adds a translation in DRI3 from __DRI_IMAGE_FORMAT_SARGB8 to
__DRI_IMAGE_FOURCC_SARGB8888 and then adds translations *back* to
__IMAGE_FORMAT_SARGB8 in both the i915 and i965 drivers.

I'll refrain from comments on whether I think having two separate sets of
format defines in dri_interface.h is a good idea or not...

Fixes piglit glx-tfp and glx-visuals-depth

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
/external/mesa3d/src/glx/dri3_glx.c
f12d6d613acd3f85309e4a3063871b188c93a145 26-Nov-2013 Keith Packard <keithp@keithp.com> dri3: Flush XCB before blocking for special events

XCB doesn't flush the output buffer automatically, so we have to call
xcb_flush ourselves before waiting.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
/external/mesa3d/src/glx/dri3_glx.c
09d6c1972037a5519488094afd225f793d2188d0 26-Nov-2013 Keith Packard <keithp@keithp.com> dri3: Enable GLX_INTEL_swap_event

Now that we're tracking SBC values correctly, and the X server has the
ability to send the GLX swap events from a PresentPixmap request, enable
this extension.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
/external/mesa3d/src/glx/dri3_glx.c
1525474eadf5ca000162e05b99d591998d1ed3f6 26-Nov-2013 Keith Packard <keithp@keithp.com> dri3: Fix dri3_wait_for_sbc to wait for completion of requested SBC

Eric figured out that glXWaitForSbcOML wanted to block until the requested
SBC had been completed, which means to wait until the
PresentCompleteNotify event for that SBC had been received.

This replaces the simple sleep(1) loop (which was bogus) with a loop that
just checks to see if we've seen the specified SBC value come back in a
PresentCompleteNotify event yet.

The change is a bit larger than that as I've broken out a piece of common
code to wait for and process a single Present event for the target
drawable.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
/external/mesa3d/src/glx/dri3_glx.c
71d614250ed1f83d8da3adb8e855ee00201c70da 26-Nov-2013 Keith Packard <keithp@keithp.com> dri3: Track full 64-bit SBC numbers, instead of just 32-bits

Tracking the full 64-bit SBC values makes it clearer how those values are
being used, and simplifies the wait_msc code. The only trick is in
re-constructing the full 64-bit value from Present's 32-bit serial number
that we use to pass the SBC value from request to event.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
/external/mesa3d/src/glx/dri3_glx.c
4a8da40fc089d465b72ecee89e24cd92e6714669 23-Jan-2014 Eric Anholt <eric@anholt.net> dri: Fix the logger error message handling.

Since the loader changes, there has been a compiler warning that the
prototype didn't match. It turns out that if a loader error message was
ever thrown, you'd segfault because of trying to use the warning level as
a format string.

Reviewed-by: Keith Packard <keithp@keithp.com>
Tested-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
/external/mesa3d/src/glx/dri3_glx.c
378e7ad26f11aacd02a131262646e48c362539ef 23-Jan-2014 Eric Anholt <eric@anholt.net> dri3: Fix two little memory leaks.

Noticed when valgrinding an unrelated bug.

Reviewed-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
/external/mesa3d/src/glx/dri3_glx.c
eac776cf779b705cbfb8d41812f1d171fb09c76f 11-Jan-2014 Emil Velikov <emil.l.velikov@gmail.com> glx: use the loader util lib

v2
* Set logger to ErrorMessageF. Spotted by Kristian

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
/external/mesa3d/src/glx/dri3_glx.c
6b5111398110f9ae374723ad6225ada1a0e60fd2 24-Nov-2013 Keith Packard <keithp@keithp.com> dri3: Rename DRI3_MAX_BACK to DRI3_NUM_BACK

It is the maximum number of back buffers, but the name is confusing and is
easily read as the maximum back buffer index. Chage to DRI3_NUM_BACK to make
the intended usage a bit clearer.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
/external/mesa3d/src/glx/dri3_glx.c
95b04850d0c578392288939723d8d56e4b600c93 22-Nov-2013 Keith Packard <keithp@keithp.com> dri3: Free resources when drawable is destroyed.

Always nice to clean up after ourselves.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
/external/mesa3d/src/glx/dri3_glx.c
568a27588d13146d0fd7cb4e775e1ac0187e5e29 22-Nov-2013 Keith Packard <keithp@keithp.com> dri3: Switch to libxshmfence version 1.1

libxshmfence v1.0 foolishly used 'int32_t *' for the fence type, which
works when the fence is a linux futex. However, version 1.1
changes the exported datatype to 'struct xshmfence *'

Require libxshmfence version 1.1 and switch the API around.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
/external/mesa3d/src/glx/dri3_glx.c
e0489531455623aa21aa565b2c890362d8437f23 12-Nov-2013 Kristian Høgsberg <krh@bitplanet.net> dri: Remove redundant createNewContext function from __DRIimageDriverExtension

createContextAttribs is a superset of what createNewContext provides.
Also remove the function typedef, since createNewContext is deprecated
and no longer used in multiple interfaces.

Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
Cc: "10.0" <mesa-stable@lists.freedesktop.org>
/external/mesa3d/src/glx/dri3_glx.c
035cce83f7b3d9a037c9e7cc17a212d6cf7e927f 08-Nov-2013 Keith Packard <keithp@keithp.com> dri3: Fix pixmap buf_id computation

Looks like some kind of rebase damage to me...

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
/external/mesa3d/src/glx/dri3_glx.c
4b5d0d10f106ef7659917235dfbcd6d0e00e5bf0 08-Nov-2013 Eric Anholt <eric@anholt.net> glx: Add a more informative debug message in a DRI3 error path.
/external/mesa3d/src/glx/dri3_glx.c
2d94601582e4f0fcaf8c02a15b23cba39dec7bb1 05-Nov-2013 Keith Packard <keithp@keithp.com> Add DRI3+Present loader

Uses the __DRIimage loader interfaces.

v2: Fix _XIOErrors when DRI3 isn't present (change by anholt). Apparently
XCB just terminates your connection if you don't check for extensions
before using them, instead of returning an error like you'd expect.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
/external/mesa3d/src/glx/dri3_glx.c