Commit Graph

45849 Commits

Author SHA1 Message Date
Marek Olšák 685b8345a8 r600g: remove struct r600_reloc
That is really private to winsys/radeon.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2011-08-16 09:15:10 +02:00
Marek Olšák 1acaf09778 r600g: don't use RADEON_GEM_DOMAIN_CPU
Also staging resources shouldn't be allocated with the initial domain
being VRAM.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2011-08-16 09:15:10 +02:00
Marek Olšák 3e57972216 r600g: remove reloc-related variables from radeon_bo
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2011-08-16 09:15:10 +02:00
Marek Olšák 638d75185e r600g: let radeon_winsys maintain the list of relocations
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2011-08-16 09:15:10 +02:00
Marek Olšák 9865b1ec8c r600g: remove now-unused r600_context::fenced_bo
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2011-08-16 09:15:10 +02:00
Marek Olšák 591d8c3350 r600g: remove the fences which were used for the cache buffer manager
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2011-08-16 09:15:10 +02:00
Marek Olšák cdbb8a195a r600g: remove now-unused r600_bo::size
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2011-08-16 09:15:10 +02:00
Marek Olšák 60ff68ad00 r600g: remove the cache buffer manager from winsys/r600
As we've just started using the one from winsys/radeon.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2011-08-16 09:15:10 +02:00
Marek Olšák 11daa7e325 r600g: allocate/destroy buffers using radeon_winsys
We use the cache buffer manager from radeon_winsys now, but we don't use
anything else yet.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2011-08-16 09:15:10 +02:00
Marek Olšák edca57e533 r600g: remove unused function declarations
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2011-08-16 09:15:10 +02:00
Marek Olšák 39db886548 r600g: remove unused r600_bo::tiling_flags
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2011-08-16 09:15:10 +02:00
Marek Olšák c092e236cc r600g: remove unused r600_bo::kernel_pitch
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2011-08-16 09:15:10 +02:00
Marek Olšák 2ce783d8dd r600g: put radeon_winsys in screen::winsys, don't include drm_driver in the pipe
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2011-08-16 09:15:10 +02:00
Marek Olšák 354f76f386 r600g: cleanup includes in winsys
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2011-08-16 09:15:10 +02:00
Marek Olšák fb8cf51eeb r600g: move some queries into winsys/radeon
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2011-08-16 09:15:10 +02:00
Marek Olšák ce12f82692 r600g: first step into winsys/radeon
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2011-08-16 09:15:10 +02:00
Benjamin Franzke 8c40940321 dri2: Add __DRI_BUFFER_COUNT token
Remove definition from egl_dri2.
Defining this is egl_dri2.h breaks as soon as
a new dri2 buffer token is added like with commit
4501a5d6e8.
2011-08-16 09:06:41 +02:00
Cooper Yuan 9b784069ce dri2: add code to dri2_Flush extension.
It's going to flush client's commands in eglWaitClient(). Before this,
egl applications using pixmap or pbuffer flicker because of no flush.

Reviewed-by: Alan Hourihane
2011-08-16 09:32:10 +08:00
Eric Anholt a313c29c77 glsl: When assigning to a whole array, mark the array as accessed.
The vs-varying-array-mat2-col-row-wr test writes a mat2[3] constant to
a mat2[3] varying out array, and also statically accesses element 1 of
it on the VS and FS sides.  At link time it would get trimmed down to
just 2 elements, and then codegen of the VS would end up generating
assignments to the unallocated last entry of the array.  On the new
i965 VS backend, that happened to land on the vertex position.

Some issues remain in this test on softpipe, i965/old-vs and
i965/new-vs on visual inspection, but i965 is passing because only one
green pixel is probed, not the whole split green/red quad.
2011-08-15 17:54:27 -07:00
Eric Anholt 5880a9a4a7 radeon: Explain to the user what went wrong when built without libdrm.
Before this commit, even LIBGL_DEBUG=verbose would just fail with:
libGL error: failed to create dri screen
2011-08-15 17:54:27 -07:00
Paul Berry 303e05cc24 glsl: Add validations for ir_call.
This patch extends ir_validate.cpp to check the following
characteristics of each ir_call:

- The number of actual parameters must match the number of formal
  parameters in the signature.

- The type of each actual parameter must match the type of the
  corresponding formal parameter in the signature.

- Each "out" or "inout" actual parameter must be an lvalue.

Reviewed-by: Chad Versace <chad@chad-versace.us>
2011-08-15 17:23:02 -07:00
Paul Berry a52b53b56e glsl: Make is_lvalue() and variable_referenced() const.
These functions don't modify the target instruction, so it makes sense
to make them const.  This allows these functions to be called from ir
validation code (which uses const to ensure that it doesn't
accidentally modify the IR being validated).

Reviewed-by: Chad Versace <chad@chad-versace.us>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-08-15 17:23:02 -07:00
Paul Berry 67b5a3267d glsl: Perform implicit type conversions on function call out parameters.
When an out parameter undergoes an implicit type conversion, we need
to store it in a temporary, and then after the call completes, convert
the resulting value.  In other words, we convert code like the
following:

void f(out int x);
float value;
f(value);

Into IR that's equivalent to this:

void f(out int x);
float value;
int out_parameter_conversion;
f(out_parameter_conversion);
value = float(out_parameter_conversion);

This transformation needs to happen during ast-to-IR convertion (as
opposed to, say, a lowering pass), because it is invalid IR for formal
and actual parameters to have types that don't match.

Fixes piglit tests
spec/glsl-1.20/compiler/qualifiers/out-conversion-int-to-float.vert and
spec/glsl-1.20/execution/qualifiers/vs-out-conversion-*.shader_test,
and bug 39651.

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

Reviewed-by: Chad Versace <chad@chad-versace.us>
2011-08-15 17:23:01 -07:00
Kenneth Graunke c548192caf docs: Remove GLw from the documentation except for a new FAQ entry.
Also remove an outdated reference to GLEW being in tree.

Reviewed-by: Brian Paul <brianp@vmware.com>
2011-08-15 13:37:27 -07:00
Kenneth Graunke 63720114b4 glw: Remove GLw source.
libGLw is an old OpenGL widget library with optional Motif support.
It almost never changes and very few people actually still care about
it, so we've decided to ship it separately.

The new home for libGLw is: git://git.freedesktop.org/mesa/glw/

Reviewed-by: Brian Paul <brianp@vmware.com>
2011-08-15 13:37:09 -07:00
Ian Romanick a352e2d08e glsl: Modify strategy for accumulating conditions when lowering if-statements
Previously if-statements were lowered from inner-most to outer-most
(i.e., bottom-up).  All assignments within an if-statement would have
the condition of the if-statement appended to its existing condition.
As a result the assignments from a deeply nested if-statement would
have a very long and complex condition.

Several shaders in the OpenGL ES2 conformance test suite contain
non-constant array indexing that has been lowered by the shader
writer.  These tests usually look something like:

    if (i == 0) {
        value = array[0];
    } else if (i == 1) {
        value = array[1];
    } else ...

The IR for the last assignment ends up as:

    (assign (expression bool && (expression bool ! (var_ref if_to_cond_assign_condition) ) (expression bool && (expression bool ! (var_ref if_to_cond_assign_condition@20) ) (expression bool && (expression bool ! (var_ref if_to_cond_assign_condition@22) ) (expression bool && (expression bool ! (var_ref if_to_cond_assign_condition@24) ) (var_ref if_to_cond_assign_condition@26) ) ) ) )  (x) (var_ref value) (array_ref (var_ref array) (constant int (5)))

The Mesa IR that is generated from this is just as awesome as you
might expect.

Three changes are made to the way if-statements are lowered.

1. Two condition variables, if_to_cond_assign_then and
if_to_cond_assign_else, are created for each if-then-else structure.
The former contains the "positive" condition, and the later contains
the "negative" condtion.  This change was implemented in the previous
patch.

2. Each condition variable is added to a hash-table when it is created.

3. When lowering an if-statement, assignments to existing condtion
variables get the current condition anded.  This ensures that nested
condition variables are only set to true when the condition variable
for all outer if-statements is also true.

Changes #1 and #3 combine to ensure the correctness of the resulting
code.

4. When a condition assignment is encountered with a condition that is
a dereference of a previously added condition variable, the condition
is not modified.

Change #4 prevents the continuous accumulation of conditions on
assignments.

If the original if-statements were:

    if (x) {
        if (a && b && c && d && e) {
            ...
        } else {
            ...
        }
    } else {
        if (g && h && i && j && k) {
            ...
        } else {
            ...
        }
    }

The lowered code will be

    if_to_cond_assign_then@1 = x;
    if_to_cond_assign_then@2 = a && b && c && d && e
        && if_to_cond_assign_then@1;
    ...
    if_to_cond_assign_else@2 = !if_to_cond_assign_then
        && if_to_cond_assign_then@1;
    ...

    if_to_cond_assign_else@1 = !if_to_cond_assign_then@1;
    if_to_cond_assign_then@3 = g && h && i && j;
        && if_to_cond_assign_else@1;
    ...
    if_to_cond_assign_else@3 = !if_to_cond_assign_then
        && if_to_cond_assign_else@1;
    ...

Depending on how instructions are emitted, there may be an extra
instruction due to the duplication of the '&&
if_to_cond_assign_{then,else}@1' on the nested else conditions.  In
addition, this may cause some unnecessary register pressure since in
the simple case (where the nested conditions are not complex) the
nested then-condition variables are live longer than strictly
necessary.

Before this change, one of the shaders in the OpenGL ES2 conformance
test suite's acos_float_frag_xvary generated 348 Mesa IR instructions.
After this change it only generates 124.  Many, but not all, of these
instructions would have also been eliminated by CSE.

Reviewed-by: Eric Anholt <eric@anholt.net>
2011-08-15 11:44:27 -07:00
Ian Romanick 4a026d6ba5 glsl: Slight change to the code generated by if-flattening
Now the condition (for the then-clause) and the inverse condition (for
the else-clause) get written to separate temporary variables.  In the
presence of complex conditions, this shouldn't result in more code
being generated.  If the original if-statement was

    if (a && b && c && d && e) {
        ...
    } else {
        ...
    }

The lowered code will be

   if_to_cond_assign_then = a && b && c && d && e;
   ...
   if_to_cond_assign_else = !if_to_cond_assign_then;
   ...

Reviewed-by: Eric Anholt <eric@anholt.net>
2011-08-15 11:44:26 -07:00
Ian Romanick 13df36ecb6 glsl: Replace foreach_iter with foreach_list_safe
Reviewed-by: Eric Anholt <eric@anholt.net>
2011-08-15 11:44:26 -07:00
Ian Romanick 5c84378541 glsl: Make move_block_to_cond_assign not care which branch it's processing
This will make some future changes a bit easier to digest.

Reviewed-by: Eric Anholt <eric@anholt.net>
2011-08-15 11:44:26 -07:00
Benjamin Franzke 2e71c7d4ff egl: Log (debug) native platform type
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
2011-08-15 09:42:16 +02:00
Benjamin Franzke 85fe948494 egl: Native Display autodetection
EGL doesnt define howto manage different native platforms.
So mesa has a builtime configurable default platform,
whith non-standard envvar (EGL_PLATFORM) overwrites.
This caused unneeded bugreports, when EGL_PLATFORM was forgotten.

Detection is grouped into basic types of NativeDisplays (which itself
needs to be detected).  The final decision is based on characteristcs
of these basic types:

  File Desciptor based platforms (fbdev):
    - fstat(2) to check for being a fd that belongs to a character device
    - check kernel subsystem (todo)

  Pointer to structuctures (x11, wayland, drm/gbm):
    - mincore(2) to check whether its valid pointer to some memory.
    - magic elements (e.g. pointers to exported symbols):
      o wayland display stores interface type pointer (first elm.)
      o gbm stores pointer to its constructor (first elm.)
      o x11 as a fallback (FIXME?)

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
2011-08-15 09:42:16 +02:00
Cooper Yuan f5e757ea60 Destroy context in dri2/glx driver when apps call eglDestroyContext 2011-08-14 15:14:17 +08:00
Chia-I Wu e09b706c9e glapi: remove gen-es
Not used anymore.
2011-08-13 15:14:24 +08:00
Chia-I Wu 6eff33dc7f glapi: generate ES dispatch headers from core mesa
GLESv1 and GLESv2 have their own dispatch.h and remap_helper.h.  These
headers are only used by api_exec_es1.c and api_exec_es2.c in core mesa.
Move the rules to generate them from glapi to core mesa.

Reviewed-by: Brian Paul <brianp@vmware.com>

[olv: updated after reviewing to fix SCons build]
2011-08-13 15:14:00 +08:00
Chia-I Wu 786e5a2fb4 glapi: add glapi_gen.mk to help header generation
glapi_gen.mk is supposed to be included by glapi users to simplify
header generation.  This commit also makes es1api, es2api, and
shared-glapi use it.

Reviewed-by: Brian Paul <brianp@vmware.com>

[olv: updated after reviewing to prefix all variables in glapi_gen.mk by
 glapi_gen]
2011-08-13 13:57:10 +08:00
Chia-I Wu 5076561b35 glapi: use gl_and_es_API.xml to generate GLES headers
glapi/gen-es/ defines two sets of GLAPI XMLs for OpenGL ES 1.1
(es1_API.xml) and 2.0 (es2_API.xml) respectively.  They are used to
generate dispatch.h and remap_helper.h for GLES.  Together with
gl_and_es_API.xml, we have to maintain three sets of GLAPI XMLs.

This commit makes dispatch.h and remap_helper.h for GLES be generated
from gl_and_es_API.xml.

Reviewed-by: Brian Paul <brianp@vmware.com>
2011-08-13 13:54:57 +08:00
Chia-I Wu b8202b3d44 glapi: add methods to filter functions
add gl_api::filter_functions and gl_function::filter_entry_points to
filter out unwanted functions and entry points.

Reviewed-by: Brian Paul <brianp@vmware.com>
2011-08-13 13:54:54 +08:00
Chia-I Wu 281947b351 glapi: add gles_api.py
Move the list of entry points belong to GLES from mapi_abi.py to a new
file.

Until we figure out how to describe the APIs an entry point belongs to
in the XML file, and how to handle the case where an entry point others
alias is missing in some APIs, this is an easier solution than
maintaining another two sets of XMLs in glapi/gen-es/.

Reviewed-by: Brian Paul <brianp@vmware.com>
2011-08-13 13:54:30 +08:00
Michel Dänzer 3ce243879a gallium/gbm: Add dependencies for libraries linked into pipe_*.so.
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
2011-08-12 11:10:56 +02:00
Chad Versace 9cd64ec35a x86-64: Fix compile error with clang
Remove the 'f' suffix from a float literal.
    - .float 0.0f+1.0
    + .float 1.0

This fixes the following compile error with clang:
    error: unexpected token in directive
    .float 0.0f+1.0
              ^

Note: This is a candidate for the stable branches.
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
Signed-off-by: Chad Versace <chad@chad-versace.us>
2011-08-11 09:33:41 -07:00
Brian Paul 099aad2fb0 mesa: fix initialization of GL_FOG_MODE in _mesa_init_driver_state() 2011-08-11 09:05:53 -06:00
Brian Paul 9b8287f8f5 mesa: fix ColorMask array index in _mesa_init_driver_state()
This doesn't really make any difference because all the colormasks
are the same upon context set-up, but it makes more sense.
2011-08-11 09:04:48 -06:00
Brian Paul 37a64baea8 swrast: don't try to do depth testing if there's no depth buffer
Fixes piglit hiz-depth-stencil-test-fbo-d0-s8 crash.
See http://bugs.freedesktop.org/show_bug.cgi?id=37907

NOTE: This is a candidate for the 7.11 branch.
2011-08-11 08:53:17 -06:00
Andreas Fänger e411cd7b0a swrast: initial multi-threaded span rendering
Optional parallel rendering of spans using OpenMP.
Initial implementation for aa triangles. A new option for scons is
also provided to activate the openmp support (off by default).

Signed-off-by: Brian Paul <brianp@vmware.com>
2011-08-11 08:33:59 -06:00
Ben Widawsky fa351bd2e0 intel: GetBuffer fix
After copy buffer on preGEN6, it is necessary to wait for the blit to
complete before returning data to the user.

This should fix the piglit test: copy_buffer_coherency (pre-GEN6).

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-08-10 16:07:40 -07:00
Lauri Kasanen df7859be6b r600g: Add support for ROUND, v2
This is a GLSL 1.3 feature, but also used by MLAA.

Signed-off-by: Lauri Kasanen <cand@gmx.com>
2011-08-10 16:08:59 -04:00
Carl Simonson 09eeb0ff27 i830: Add missing vtable entry for i830 from the hiz work. 2011-08-10 11:10:43 -07:00
Eric Anholt c9e81fe14f i965: Drop the reg/hw_reg distinction.
"reg" was set in only one case, virtual GRFs pre register allocation,
and would be unset and have hw_reg set after allocation.  Since we
never bothered with looking at virtual GRF number after allocation
anyway, just use the same storage and avoid confusion.
2011-08-10 11:03:48 -07:00
Eric Anholt b1f0bffd39 i965/fs: Factor out the register allocator setup to a separate function.
Besides separating out a logical step of the giant register allocator
function, this now communicates a bunch of the allocator information
through entries in brw_context, which will make this code partially
reusable for caching the expensive allocator setup.
2011-08-10 11:03:48 -07:00
Eric Anholt 4e10d5825b i965/fs: Simplify the register allocator using a map from RA reg to GRF.
It's fewer pointers to track, and when we start caching the register
set, should be algorithmically better in the cache hit case (lookup in
a byte-per-register array, instead of a linear walk through
desctiption of register classes to find how to translate that class).
2011-08-10 11:03:48 -07:00