Commit Graph

59613 Commits

Author SHA1 Message Date
Eric Anholt 4b5d0d10f1 glx: Add a more informative debug message in a DRI3 error path. 2013-11-07 19:08:09 -08:00
Keith Packard 2d94601582 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>
2013-11-07 19:08:09 -08:00
Keith Packard 442442026e dri: add __DRIimageLoaderExtension and __DRIimageDriverExtension
These provide an interface between the driver and the loader to allocate
color buffers through the DRIimage extension interface rather than through a
loader-specific extension (as is used by DRI2, for instance).

The driver uses the loader 'getBuffers' interface to allocate color buffers.

The loader uses the createNewScreen2, createNewDrawable, createNewContext,
getAPIMask and createContextAttribs APIS (mostly shared with DRI2).

This interface will work with the DRI3 loader, and should also work with GBM
and other loaders so that drivers need not be customized for each new loader
interface, as long as they provide this image interface.

v2: Fix build of i915 and i965 together (by anholt)

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
2013-11-07 19:08:09 -08:00
Keith Packard 1f085ba18f dri/i915,dri/i965: Use driGLFormatToImageFormat and driImageFormatToGLFormat
Remove private versions of these functions

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
2013-11-07 19:08:09 -08:00
Keith Packard b7818b8c36 dri/common: Add functions mapping MESA_FORMAT_* <-> __DRI_IMAGE_FORMAT_*
The __DRI_IMAGE_FORMAT codes are used by the image extension, drivers need to
be able to translate between them. Instead of duplicating this translation in
each driver, create a shared version.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
2013-11-07 19:08:09 -08:00
Keith Packard aba6b84ce5 Define __DRI_IMAGE_FORMAT_SARGB8
This format will be used by the i965 driver

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2013-11-07 19:08:09 -08:00
Keith Packard bf6591e948 dri/intel: Add explicit size parameter to intel_region_alloc_for_fd
Instead of assuming that the size will be height * pitch, have the caller pass
in the size explicitly.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
2013-11-07 19:08:09 -08:00
Keith Packard 888533dcd6 dri/intel: Split out DRI2 buffer update code to separate function
Make an easy place to splice in a DRI3 version of this function

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2013-11-07 19:08:09 -08:00
Keith Packard f66a6c5fe7 drivers/dri/common: A few dri2 functions are not actually DRI2 specific
This just renames them so that they can be used with the DRI3 extension
without causing too much confusion.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2013-11-07 19:08:09 -08:00
Roland Scheidegger ea1f7d2894 gallivm: deduplicate some indirect register address code
There's only one minor functional change, for immediates the pixel offsets
are no longer added since the values are all the same for all elements in
any case (it might be better if those weren't stored as soa vectors in the
first place maybe).

Reviewed-by: Zack Rusin <zackr@vmware.com>
2013-11-08 03:38:32 +01:00
Ian Romanick 8c5330226f glx/tests: Add unit tests for the DRI2 part of GLX_MESA_query_renderer
After adding $(DEFINES) to AM_CPPFLAGS, the __glXGetCurrentContext
wrapper function is no longer needed and causes compile errors.  Using
the correct defines causes it to be a macro!

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2013-11-07 18:12:33 -08:00
Ian Romanick 0cce553867 glx/tests: Add unit tests for the GLX part of GLX_MESA_query_renderer
These tests primarilly ensure that the functions added by this extension
don't abuse other interfaces (e.g., glx_screen::query_renderer_integer)
when provided bad data.

These tests helped me find a couple small bugs in the initial
implementation.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2013-11-07 18:12:33 -08:00
Ian Romanick d4cc186937 glx/tests: Add GetGLXScreenConfigs_called flag
Tests for the GLX_MESA_query_context extension will use this flag.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2013-11-07 18:12:33 -08:00
Ian Romanick ee6c9fcbca docs: Import extension spec for GLX_MESA_query_renderer
The enumerated values are currently allocated from Intel's range.

v2: Fix a typo.  Update the list of functions to which the new enums can
be passed.  The "Current" versions were previously missing.  Both things
noticed by Marek.

v3: Fix typo in return type of glXQueryRendererIntegerMESA in the spec
body (noticed by Ken).  Fix typo in issue #14 referencing itself instead
of issue #13 (noticed by Dave).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Dave Airlie <airlied@redhat.com>
2013-11-07 18:12:33 -08:00
Ian Romanick 4680d237c5 glx/dri2: Add DRI2 support for GLX_MESA_query_renderer
The new functions for this extension were added to a separate file
(dri2_query_renderer.c) to facilitate unit testing.  I tried putting
them in dri2_glx.c, and it resulting in an unending chain of
dependencies.  It was the proverbial threading hanging from a sweater.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-11-07 18:12:33 -08:00
Ian Romanick 419684091c glx/dri2: Pull some internal structures out to a separate header file
This structures will be accessed by internal functions that will be
added in a file separate from dri2_glx.c.  The new code will be added to
a new file to facilitate unit testing.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-11-07 18:12:32 -08:00
Ian Romanick 4944588cfd glx/tests: Silence warnings after adding fields to glx_screen_vtable
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2013-11-07 18:12:32 -08:00
Ian Romanick 6c28c037c4 glx: Add functions and GLX plumbing for GLX_MESA_query_renderer
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-11-07 18:12:32 -08:00
Ian Romanick 38a1d8b14c glx: Add GLX_MESA_query_renderer
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-11-07 18:12:32 -08:00
Ian Romanick b3ffc5b6f4 glx: Add extension tracking GLX_MESA_query_renderer
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-11-07 18:12:32 -08:00
Ian Romanick 1e4ce08f38 i965: Wire up initial support for DRI_RENDERER_QUERY extension
v2: Use sysconf instead of sysinfo for improved portability.  Suggested
by Ken.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-11-07 18:12:27 -08:00
Ian Romanick 2fe6fbd19f i915: Wire up initial support for DRI_RENDERER_QUERY extension
v2: Use sysconf instead of sysinfo for improved portability.  Suggested
by Ken.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-11-07 18:08:15 -08:00
Ian Romanick 9dbc14abcf dri: Add function to implement queries common to all Mesa drivers
v2: Add assertions that the version string has the expected format.
This will catch build errors (or changes to the version string format)
in debug build without exposing release builds to buffer over-runs.
Suggested by Ken.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-11-07 18:08:15 -08:00
Ian Romanick 83ffe47be0 i965: Refactor the renderer string creation out of intelGetString
This will soon be used in intel_screen.c from a function that doesn't
have a gl_context.

v2: Delete local variables that are now unused.  This matches v1 of the
changes to the i915 driver.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-11-07 18:08:15 -08:00
Ian Romanick 339f36fc5e i915: Refactor the renderer string creation out of intelGetString
This will soon be used in intel_screen.c from a function that doesn't
have a gl_context.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-11-07 18:08:15 -08:00
Ian Romanick 18291251ec i965: Refactor the vendor string out of intelGetString
This will soon be used in intel_screen.c from a function that doesn't
have a gl_context.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-11-07 18:08:15 -08:00
Ian Romanick 135b7e7260 i915: Refactor the vendor string out of intelGetString
This will soon be used in intel_screen.c from a function that doesn't
have a gl_context.

v2: Remove spurious break after return.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-11-07 18:08:15 -08:00
Ian Romanick 64bb1e857a dri: Add interface definition for DRI_RENDERER_QUERY extension
This will be used to let apps query hardware and driver limits before
creating a GL context.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-11-07 18:08:15 -08:00
Ian Romanick 1f712bdd38 i965: Enable DRI_Robustness extension
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-11-07 17:40:25 -08:00
Ian Romanick e8dac9632d i965: Propagate the GPU reset notifiction strategy down into the driver
If the application requests reset notifiction, connect up the reset
status query method and set gl_context::ResetStrategy.

v2: Update based on kernel interface / libdrm changes.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-11-07 17:40:25 -08:00
Ian Romanick 8f2c93ff75 i965: Add function to query the GPU reset status for a context
v2: Update based on kernel interface / libdrm changes.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-11-07 17:40:25 -08:00
Ian Romanick 15c3bac3d0 i965: Handle __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS flag
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-11-07 17:40:25 -08:00
Ian Romanick 7b140d1bda mesa/dri: Move context flag validation down into the drivers
Soon some drivers will support a different set of flags than other
drivers.  If some flags have to be filtered in the driver, we might as
well filter all of them in the driver.

The changes in nouveau use tabs because nouveau seems to have it's own
indentation rules.

v2: Fix some rebase failures noticed by Ken (returning the wrong types,
etc.).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-11-07 17:40:05 -08:00
Ian Romanick 17c94de33b mesa/dri: Add basic plumbing for GLX_ARB_robustness reset notification strategy
No drivers advertise the DRI2 extension yet, so no driver should ever
see a value other than false for notify_reset.

The changes in nouveau use tabs because nouveau seems to have it's own
indentation rules.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-11-07 17:31:16 -08:00
Ian Romanick 916bc4491a mesa: Implement proper tracking logic for glGetGraphicsResetStatusARB
Drivers still have to implement dd_function_table::GetGraphicsResetStatus.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
2013-11-07 16:41:38 -08:00
Ian Romanick a6eb04c3d8 mesa: Add gl_shared_state::ShareGroupReset and gl_context::ShareGroupReset
These will be used to determine whether to signal a GPU reset after
another context in the share group has observed a reset.

v2: Change ShareGroupReset from GLboolean to bool.  Suggested by Brian.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
2013-11-07 16:41:38 -08:00
Ian Romanick 2fdc0ee19f mesa: Add dd_function_table::GetGraphicsResetStatus
This allows drivers to determine whether a GPU reset has occured.  It
should return non-zero status if a reset was observed by the specified
context.  Another mechanism will be used to observe resets occuring in
other contexts in the share group.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
2013-11-07 16:41:38 -08:00
Ian Romanick 114d360dfa mesa: Remove gl_context::ResetStatus
This isn't going to be used in the actual implemenation of
glGetGraphicsResetStatus.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
2013-11-07 16:41:38 -08:00
Matt Turner 69b425efae st/xorg: Delete.
Acked-by: Lucas Stach <l.stach@pengutronix.de>
2013-11-07 16:14:25 -08:00
Matt Turner 48f4f59dc6 xorg-nouveau: Delete. 2013-11-07 16:14:25 -08:00
Matt Turner 11ff1725cc xorg-i915: Delete.
Acked-by: Jakob Bornecrantz <wallbraker@gmail.com>
Acked-by: Stéphane Marchesin <stephane.marchesin@gmail.com>
2013-11-07 16:14:25 -08:00
Ian Romanick cf0da87917 docs: Mark off ARB_shader_atomic_counters for i965
...and update relnotes.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2013-11-07 16:02:03 -08:00
Francisco Jerez 597634556e i965/gen7: Expose ARB_shader_atomic_counters.
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-11-07 15:56:57 -08:00
Francisco Jerez 5c114939b4 glsl: Linker support for ARB_shader_atomic_counters.
v2: Add comments on the purpose of the auxiliary data structures.
    Check for atomic counter overlaps.  Use the contains_atomic()
    convenience method.  Add static assert with the number of expected
    shader stages.
v3: Don't resize atomic arrays.
v4: Add comment on the reason why we don't resize atomic counter
    arrays.  Use 'strcmp(...) == 0' instead of '!strcmp(...)'.
v5 (idr):  Don't use STL in the linker.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-11-07 15:56:57 -08:00
Francisco Jerez e63bb29853 glsl: Implement parser support for atomic counters.
v2: Mark atomic counters as read-only variables.  Move offset overlap
    code to the linker.  Use the contains_atomic() convenience method.
v3: Use pointer to integer instead of non-const reference.  Add
    comment so we remember to add a spec quotation from the next GLSL
    release once the issue of atomic counter aggregation within
    structures is clarified.
v4 (idr): Don't use std::map because it's overkill.  Add an assertion
    that ctx->Const.MaxAtomicBufferBindings <= MAX_COMBINED_ATOMIC_BUFFERS.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-11-07 15:56:57 -08:00
Kenneth Graunke 30f61c471d Revert "i965: Add support for GL_AMD_performance_monitor on Ironlake."
This reverts most of commit 0f2da77307.
(I chose to leave the additions to brw_defines.h.)

My previous Ironlake implementation was somewhat broken: counter data
was global, rather than per-context.  This meant that performance
monitors captured data from your compositor, 2D driver, and other 3D
programs.

Originally, I believed that Sandybridge and later had an easy way to
avoid this problem (setting per-context flags in OACONTROL), while
Ironlake did not.  So I'd intended to leave it as a known limitation of
performance monitoring support on Ironlake.  However, this turned out
not to be true.

Unfortunately, our hardware only has one set of aggregating performance
counters shared between all 3D programs, and their values are not saved
or restored by hardware contexts.  Also, at least on Sandybridge and
Ivybridge, the counters lose their values if the GPU goes to sleep.

To work around both of these problems, we have to snapshot the
performance counters at the beginning and end of each batch, similar to
how we handle query objects on platforms that don't support hardware
contexts.

For occlusion queries, this batch bookending approach is fairly simple:
only one occlusion query can be active at a time, and the result is a
single integer.  Performance monitors are more complex: an arbitrary
number of monitors can be active at a time, each monitoring some subset
of our ~30 observability counters.  Individual monitors can be started
and stopped at any point during the batch.  Tracking where each monitor
started/ended relative to batch flushes ends up being a pain.  And you
can run out of space in the buffer.

Properly supporting this required some serious rearchitecting of the
code.  Rather than writing patches to try and morph a broken system into
a working one (which operates quite differently), I decided it would be
simplest to revert the old code and start fresh.  Parts will look
familiar, but other parts are new.

I also decided it would be best to include Sandybridge and Ivybridge
support from the start, since the newer platforms have added complexity
that I wanted to make sure worked.  They're also what most people care
about these days.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
2013-11-07 15:52:02 -08:00
Kenneth Graunke 1bd6233169 glsl: Enable dFdx, dFdy, and fwidth by default in GLSL ES 3.00.
Previously, we only exposed them in desktop GL or with:

   #extension GL_OES_standard_derivatives : enable

GLSL ES 3.00 includes these without an extension, so we need to expose
them by default.

Note that the above #extension line results in an error or desktop GL,
so we don't need to worry about this.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
2013-11-07 15:52:02 -08:00
Fredrik Höglund c9ac891fa4 docs: Mark off ARB_vertex_type_10f_11f_11f_rev for r600g
...and update relnotes.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2013-11-07 23:55:46 +01:00
Fredrik Höglund e420fb887f r600g: Add support for PIPE_FORMAT_R11G11B10_FLOAT vertex elements
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2013-11-07 23:51:44 +01:00
Fredrik Höglund bfc28e4aff st/mesa: Add support for ARB_vertex_type_10f_11f_11f_rev
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2013-11-07 23:51:24 +01:00