Compare commits

..

293 Commits

Author SHA1 Message Date
Ian Romanick
d6db9143b6 ARB prog parser: Compile lexer as C++ 2011-04-14 12:00:57 -07:00
Ian Romanick
9c0b233c44 ARB prog parser: Compile parser as C++
This is in anticipation of generating GLSL IR from the parser.

The C++ rules for enums vs. ints are just plain broken.
2011-04-14 11:57:59 -07:00
Ian Romanick
364aa72824 glsl: Make bvec types accessible 2011-04-14 11:53:31 -07:00
Ian Romanick
d290ec228b glsl: Add glsl_type::get_sampler_instance method 2011-04-14 11:53:31 -07:00
Ian Romanick
c0906e06ee glsl: Add ir_unop_lit
Like the noise opcode, this opcode really shouldn't exist.  The only
reason it exists is to facilitate translation of assembly shaders to
IR.  These changes include the addition of ir_unop_lit and the
lowering pass that removes it.
2011-04-14 11:53:08 -07:00
Ian Romanick
b6c49104ce glsl: Lower ir_unop_exp to ir_binop_pow
Instead of lowering e^x to 2^(x * log2(e)), lower it to e^x using the
POW opcode.  On GPUs that have a POW instruction, this saves a
multiply (the log2 is already removed by the constant expression evaluator).
2011-04-14 11:52:06 -07:00
Eric Anholt
6a35cbb656 glsl/opt_cpe: Reenable opt_copy_propagation_elements.cpp pass. 2011-04-13 10:51:03 -07:00
Eric Anholt
909bd476ca glsl/opt_cpe: Fix a crash when a kill kills for two reasons.
Fixes glsl-copy-propagation-loop-2 when this optimization pass is
re-enabled.

Reported-by: David Lamparter <equinox@diac24.net>
2011-04-13 10:51:03 -07:00
Eric Anholt
487debfda5 glsl/opt_cpe: Kill when the assignment isn't something we recognize.
A few GLES2 tests tripped over this when using array dereferences to
hit channels on the LHS (see piglit test
glsl-copy-propagation-vector-indexing).  We wouldn't find the
ir_dereference_variable, and assume that that meant that it wasn't an
assignment to a scalar/vector, and thus not notice that the variable
had been changed.
2011-04-13 10:51:03 -07:00
Brian Paul
b9c8b2a1f1 svga: defined QSZ in terms of SVGA3D_MAX_DRAW_PRIMITIVE_RANGES 2011-04-13 09:52:21 -06:00
Brian Paul
32aab51df5 svga: define SVGA3D_MAX_DRAW_PRIMITIVE_RANGES and update comments 2011-04-13 09:52:16 -06:00
Brian Paul
4cbb261eba st/mesa: minor clean-ups in update_textures() 2011-04-13 07:37:03 -06:00
Brian Paul
032a7ef0a1 mesa: 80-column wrapping and whitespace fixes 2011-04-13 07:35:25 -06:00
Brian Paul
75d585e544 mesa: fix some comments in sampler object code 2011-04-13 07:35:25 -06:00
Chad Versace
d3cc3901ab i965: Change assertion condition from implicit to explicit
... because grokking explicit assertions requires fewer neurons.

In brw_misc_state.c:emit_depthbuffer, change assertion condition
    tiling != I915_TILING_X && tiling != I915_TILING_NONE
to
    tiling == I915_TILING_Y

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad.versace@intel.com>
2011-04-12 17:52:09 -07:00
Chad Versace
4d7c187167 i965: Define BRW_DEPTHFORMAT_D24_UNORM_X8_UINT
This depth format was added in Gen5.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad.versace@intel.com>
2011-04-12 17:52:09 -07:00
Chad Versace
05173c61c7 i965: Document brw_context.state.depth_region
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad.versace@intel.com>
2011-04-12 17:52:09 -07:00
Chad Versace
9949d2a251 i965: Remove unnecessary release/reference of brw_context.state.depth_region
Release the old depth region and reference the new one *only* if it has
changed.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad.versace@intel.com>
2011-04-12 17:52:09 -07:00
Kenneth Graunke
3f7318c1b8 i965: Add comments about URB size units and limits.
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Acked-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-04-12 15:21:21 -07:00
Kenneth Graunke
35b3f597bd i965: Never enable the GS on Gen6.
Prior to Gen6, we use the GS for breaking down quads, quad-strips,
and line loops.  On Gen6, earlier stages already take care of this,
so we never need the GS.

Since this code is likely completely untested, remove it for now.
We can write new code when enabling real geometry shaders.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2011-04-12 15:19:47 -07:00
Chris Wilson
f703ba8c42 Revert "i965: Reinstate max-index paranoia"
This reverts commit b4cbd2b312.

It looked like a safe sanity check. It missed the issue of the start of
the buffer not being at 0, but even that was not enough to explain why
setting the max vertex index caused glyphs to be dropped from the game
'Achron'.

Instead, the issue appears to be related to the use of the vertex bias
and so we would need to re-emit the max-index every time we adjusted the
bias, so re-emitting the relocations and defeating the original
optimisation.

Reported-and-tested-by: Thomas Jones <thomas.jones@utoronto.ca>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=35163
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-04-12 19:14:27 +01:00
Benjamin Franzke
f05751aa2a egl/wayland: Update to per-surface frame events 2011-04-12 11:08:17 -04:00
Dave Airlie
b27f206b0c nouveau_vieux: fix build since sampler objects merge 2011-04-12 21:23:00 +10:00
José Fonseca
16d42af618 st/wgl: Prevent spurious framebuffer sizes when the window is minimized.
When the window is minimized GetClientRect will return zeros.

Instead of creating a 1x1 framebuffer, simply preserve the current window
size, until the window is restored or maximized again.
2011-04-12 12:00:49 +01:00
José Fonseca
b5829c0d64 st/wgl: Fix debug output format specifiers of stw_framebuffer_get_size(). 2011-04-12 12:00:49 +01:00
José Fonseca
6b95cfb0de svga: Rebind framebuffer and tss bindings strictly when necessary.
The earlier change to ensure rendertargets and textures are always
rebound at every command buffer start had the downside of making
successive flushes no longer no-ops, as a command buffer with merely
the rebinding commands were being unnecessarily sent to the vGPU.

This change only re-emits the bindings when necessary, by keeping track
of the need to rebind outside of the dirty state update mechanism.
2011-04-12 12:00:49 +01:00
Hans de Goede
e338a1b0ce texstore: fix regression stricter check for memcpy path for unorm88 and unorm1616
According to https://bugs.freedesktop.org/show_bug.cgi?id=34280
commit 5d1387b2da causes the font corruption
problems people have been seeing under various apps and gnome-shell on r200
cards.

This commit changed (loosened) the check for using the memcpy path in the
former al88 / al1616 texstore functions, which are now also used to
store rg texures. This patch restores the old strict check in case of
al textures. I've no idea why this fixes things, since I don't know the
code in question at all. But after seeing the bisect in bfdo34280 point
to this commit, I gave this fix a try and it fixes the font issues seen on
r200 cards.

[airlied:
r200 has no native working A8, so it does an internal storage format of AL88
however srcFormat == internalFormat == ALPHA when we get to this point,
so it copies, but it wants to store into an AL88 not ALPHA so fails,
I'll also push a piglit test for this on r200].

Many thanks to Nicolas Kaiser who did all the hard work of tracking this down!

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-04-12 20:32:45 +10:00
Brian Paul
847f991a87 ir_to_mesa: silence signed/unsigned comparison warnings 2011-04-11 21:29:06 -06:00
Brian Paul
482a64dcf1 configs: add r600 dir to DRI_DIRS 2011-04-11 21:23:14 -06:00
Brian Paul
155a9670e6 r600: silence various compiler warnings 2011-04-11 21:22:54 -06:00
Brian Paul
1ca5585459 Merge branch 'arb_sampler_objects' 2011-04-11 21:19:41 -06:00
Zou Nan hai
2432ca1c2e Revert "i965: clear global offset to zero in m0.2 for VS DP read."
This reverts commit 66b66295d0.
it was already fixed by commit 9d60a7ce08
2011-04-12 10:52:50 +08:00
Ian Romanick
a7fa203f0d i965: Remove hint_gs_always and resulting dead code
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-04-11 14:43:42 -07:00
Ian Romanick
7e809f0b8d intel: Fix ROUND_DOWN_TO macro
Previously the macro would (ALIGN(value - alignment - 1, alignment)).
At the very least, this was missing parenthesis around "alignment -
1".  As a result, if value was already aligned, it would be reduced by
alignment.  Condisder:

     x = ROUND_DOWN_TO(256, 128);

This becomes:

    x = ALIGN(256 - 128 - 1, 128);

Or:

    x = ALIGN(127, 128);

Which becomes:

    x = 128;

This macro is currently only used in brw_state_batch
(brw_state_batch.c).  It looks like the original version of this macro
would just use too much space in the batch buffer.  It's possible, but
not at all clear to me from the code, that the original behavior is
actually desired.

In any case, this patch does not cause any piglit regressions on my
Ironlake system.

I also think that ALIGN_FLOOR would be a better name for this macro,
but ROUND_DOWN_TO matches rounddown in the Linux kernel.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Whitwell <keithw@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-04-11 14:43:42 -07:00
Ian Romanick
03eade164d glsl: Make GL_ARB_shader_stencil_export enable block be similar to other blocks
Tested-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-04-11 14:43:42 -07:00
Ian Romanick
f2bda1b566 glsl: Only let a shader enable GL_ARB_draw_instanced if the driver supports it
Also make the GL_ARB_draw_instanced block follow the same pattern as
the other blocks.

Tested-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-04-11 14:43:41 -07:00
Brian Paul
65b024d63a mesa: fixup r600 DRI driver for sampler object changes 2011-04-11 13:26:42 -06:00
Eric Anholt
88022278f7 i965: Move the SF VP from state caching to state streaming.
This is a 49.6% +/- 2.0% (n=9, IPS outlier removed) performance
improvement for the hacked-up-for-cache-misses scissor-many, and no
statistically significant performance difference for the
hacked-up-for-cache-hits version (n=9, IPS outlier removed).  No
statistically significant performance difference from ETQW (n=5) from
these last two commits.
2011-04-11 11:55:25 -07:00
Eric Anholt
b1be5bd205 i965: Change the SF unit from state caching to state streaming.
This is a 28.1% +/- 1.4% (n=10) performance improvement for the
hacked-up-for-cache-misses scissor-many (n=10), and no statistically
significant wall-time performance difference for the
hacked-up-for-cache-hits version (n=9, first outlier in each removed
since IPS was warming up.  User time increased by about 4.7%, but
kernel time decreased equivalently).
2011-04-11 11:55:17 -07:00
Eric Anholt
aaf188e3bb i965: Turn SF unit and viewport structs into pointers to prep for streaming.
I wanted to separate this mechanical change from the actual work.
2011-04-11 11:43:40 -07:00
pepp
45920d2ecb u_vbuf_mgr: fixed vbo max_index calculation
Signed-off-by: Marek Olšák <maraeo@gmail.com>
2011-04-11 17:35:28 +02:00
Marek Olšák
5c477ab2de r600g: handle PIPE_CAP_FRAGMENT_COLOR_CLAMP_CONTROL in get_param 2011-04-11 14:38:32 +02:00
Brian Paul
da8d0c965c docs: GL_ARB_sampler_objects updates 2011-04-10 13:12:50 -06:00
Brian Paul
34a5d3b9f4 mesa: plug in new functions for GL_ARB_sampler_objects
Build the new sources, plug the new functions into the dispatch table,
implement display list support.  And enable extension in the gallium
state tracker.
2011-04-10 13:12:49 -06:00
Brian Paul
f22d49de0f mesa: new code/functions for GL_ARB_sampler_objects
This implements the infrastructure for sampler objects and all the new
API functions.
2011-04-10 13:12:49 -06:00
Brian Paul
6bb4d807f7 mesa: alloc/free shared sampler objects 2011-04-10 13:12:49 -06:00
Brian Paul
0308beebc2 mesa: new driver hooks for GL_ARB_sampler_objects 2011-04-10 13:12:49 -06:00
Brian Paul
aebe16da53 mesa: add glGet for GL_ARB_sampler_objects 2011-04-10 13:12:49 -06:00
Brian Paul
ecfaab88b2 mesa: move sampler state into new gl_sampler_object type
gl_texture_object contains an instance of this type for the regular
texture object sampling state.  glGenSamplers() generates new instances
of gl_sampler_object which can override that state with glBindSampler().
2011-04-10 13:12:49 -06:00
Brian Paul
1cbd3a1cc7 glapi: regenerated files for GL_ARB_sampler_objects 2011-04-10 13:12:49 -06:00
Brian Paul
d40ec9a884 glapi: interface for GL_ARB_sampler_objects 2011-04-10 13:12:49 -06:00
Henri Verbeet
a26121f375 glx: Only remove the glx_display from the list after it's destroyed.
Signed-off-by: Henri Verbeet <hverbeet@gmail.com>
2011-04-10 18:53:34 +02:00
Henri Verbeet
a75de67c51 glx: Destroy dri2Hash on DRI2 display destruction.
Signed-off-by: Henri Verbeet <hverbeet@gmail.com>
2011-04-10 18:53:33 +02:00
Henri Verbeet
158d42c8b0 mesa: Also update the color draw buffer if it's explicitly set to GL_NONE.
NOTE: This is a candidate for the 7.10 branch.

Signed-off-by: Henri Verbeet <hverbeet@gmail.com>
2011-04-10 18:53:33 +02:00
Nicolas Kaiser
82cb6e6519 docs: fix typos in wayland spec
Signed-off-by: Nicolas Kaiser <nikai@nikai.net>
Signed-off-by: Brian Paul <brianp@vmware.com>
2011-04-10 10:00:10 -06:00
Nicolas Kaiser
ae5776c41f docs: fix typos in Mesa specs
Signed-off-by: Nicolas Kaiser <nikai@nikai.net>
Signed-off-by: Brian Paul <brianp@vmware.com>
2011-04-10 09:58:53 -06:00
Christoph Bumiller
74559abbef nv50,nvc0: silence shader debug output 2011-04-10 14:06:52 +02:00
Christoph Bumiller
003224bd97 nvc0: make the card permit separate colour outputs 2011-04-10 14:06:52 +02:00
Christoph Bumiller
7b4e478496 nv50-nvc0: make use of COLOR_MASK,BLEND_ENABLE_COMMON 2011-04-10 14:06:52 +02:00
Christoph Bumiller
d9ef976967 nvc0: shrink CSOs a little 2011-04-10 14:06:52 +02:00
Christoph Bumiller
843d5391c3 nv50,nvc0: identify some line rasterization state
Fixes width of non-smooth (aliased) lines on nvc0.
2011-04-10 14:06:52 +02:00
Christoph Bumiller
d546df4d9c nvc0: force perspective correction hint to nicest
Fixes issues in e.g. nexuiz (desertfactory) or supertuxkart that
look like lighting bugs.

They're not visible with the software rasterizers because their
notion of linear interpolation seems to be different from that
of nv50/nvc0.
2011-04-10 14:06:52 +02:00
Christoph Bumiller
ee2a8ea7d9 nv50,nvc0: don't insert instructions after the block terminator 2011-04-10 14:06:51 +02:00
Alan Coopersmith
d27ff8c5cd Make st_pipe_vertex_format return type in st_draw.h match st_draw.c
Fixes compiler error from Sun compilers:
"state_tracker/st_draw.c", line 185: identifier redeclared: st_pipe_vertex_format
        current : function(unsigned int, unsigned int, unsigned int, unsigned char) returning enum pipe_format
        previous: function(unsigned int, unsigned int, unsigned int, unsigned char) returning unsigned int : "state_tracker/st_draw.h", line 73

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2011-04-08 17:36:46 -07:00
Alan Coopersmith
64ce3933f5 Fix GET_PROGRAM_NAME() on Solaris to not try to modify a read-only string
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2011-04-08 17:36:46 -07:00
Marek Olšák
ee678895e9 Revert "r300g: handle DISCARD_WHOLE_RESOURCE for buffers"
This reverts commit 437c748bf5.

The commit is wrong for several reasons. One of them is when we grab
a new buffer, we should update all the states it is bound in,
including all parallel contexts. I don't think this is even doable.

The correct solution would be upload data via a temporary buffer and
do resource_copy_region to the original one.

https://bugs.freedesktop.org/show_bug.cgi?id=36088
2011-04-08 23:20:00 +02:00
Marek Olšák
69c71396c6 r300g: fix another crash with hyperz
https://bugs.freedesktop.org/show_bug.cgi?id=36086
2011-04-08 23:17:15 +02:00
Jon TURNEY
c6e33ca285 Disable direct rendering on Cygwin
Add Cygwin platform-specific settings and drivers to build for dri driver:
- by default, disable direct rendering.
- if direct rendering is enabled, the swrast dridriver is the only one it's
sensible to try to build (this doesn't work at the moment as additional patches
are required to build a libGL which can load just swrast without the DRM headers,
even though there's no actual functional dependency)

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Julien Cristau <jcristau@debian.org>
2011-04-08 20:37:41 +01:00
nobled
e7d18ed1ef Disable direct rendering on GNU/Hurd
The Hurd kernel doesn't have DRM yet.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Julien Cristau <jcristau@debian.org>
Reviewed-By: Jakob Bornecrantz <wallbraker@gmail.com>
2011-04-08 20:37:38 +01:00
Samuel Thibault
758561786c Only require libdrm if direct rendering is actually enabled.
Fix build when configured --with-driver=dri --disable-driglx-direct on targets
without drm e.g. GNU/Hurd and Cygwin

Based on the Debian patch file '05_hurd-ftbfs.diff' by Samuel Thibault.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Julien Cristau <jcristau@debian.org>
Reviewed-By: Jakob Bornecrantz <wallbraker@gmail.com>
2011-04-08 20:37:36 +01:00
Marek Olšák
aac4bae986 r300g: fix crash when adding a new relocation
No idea why it's so hard to reproduce.
Broken with: c35572352e

Thanks to Toni Spets for assistance.
2011-04-08 21:34:16 +02:00
Marek Olšák
ff3d7ce201 r300g: emit US_FORMAT on R520 only 2011-04-08 20:07:01 +02:00
Eric Anholt
9634318290 i965/fs: Remove broken optimization for live intervals in loops.
The theory here was to detect a temporary variable used within a loop,
and avoid considering it live across the entire loop.  However, it was
overeager and failed when the first definition of the variable
appeared within the loop but was only conditionally defined.

Fixes glsl-fs-loop-redundant-condition.
2011-04-08 08:04:00 -10:00
Marek Olšák
a0d154dc13 u_vbuf_mgr: fix crash with unsupported vertex format in hw VBOs 2011-04-08 19:31:26 +02:00
Marek Olšák
1329d94334 r300g: fix crash with hyperz
r300_update_hyperz_state is no longer required to be called here.
2011-04-08 13:27:14 +02:00
Henri Verbeet
1bcdc1e319 r300g: Properly take the sampler view's first_level into account when sampling.
Signed-off-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Marek Olšák <maraeo@gmail.com>
2011-04-08 04:47:37 +02:00
Fabian Bieler
08070cead0 llvmpipe: Take the sampler view's first_level into account when sampling. 2011-04-08 04:47:04 +02:00
Henri Verbeet
9acdd7739b softpipe: Take the sampler view's first_level into account when sampling.
Signed-off-by: Brian Paul <brianp@vmware.com>
2011-04-08 04:45:38 +02:00
Henri Verbeet
79db70bd8a st/mesa: Clamp min_lod to the max miplevel as well.
Otherwise min_lod can potentially be larger than the clamped max_lod. The
code that follows will swap min_lod and max_lod in that case, resulting in a
max_lod larger than MAX_LEVEL.

Signed-off-by: Brian Paul <brianp@vmware.com>
2011-04-08 04:45:03 +02:00
Henri Verbeet
2ecb73379e st/mesa: Set samplers views' first_level.
Base level and min LOD aren't equivalent. In particular, min LOD has no
effect on image array selection for magnification and non-mipmapped
minification.

Signed-off-by: Brian Paul <brianp@vmware.com>
2011-04-08 04:44:21 +02:00
Marek Olšák
7984c2d42d r300g: do not advertise R16F and RG16F on DRM < 2.8.0 2011-04-08 04:38:36 +02:00
Marek Olšák
10ea8567f4 r300g: fix texturing with sizes > 2048 on r500 2011-04-08 04:38:36 +02:00
Marek Olšák
9d5de0fcb6 r300g: add 'radeon: ' prefix to error messages in winsys 2011-04-08 04:38:36 +02:00
Marek Olšák
6eff8479af mesa: fix dstRowDiff computation in RGTC texstore functions
Copied from libtxc_dxtn, this fixes NPOT RGTC1 textures with r300g.
I also did the same for RGTC2.
2011-04-08 04:38:36 +02:00
Kristian Høgsberg
55a629cee5 egl_dri2.c: Open drm device with O_CLOEXEC
Not a good fd to leak.
2011-04-07 18:27:56 -04:00
Henri Verbeet
09eff39a58 r600g: Unreference framebuffer state on context destruction.
Signed-off-by: Henri Verbeet <hverbeet@gmail.com>
2011-04-07 22:29:56 +02:00
Henri Verbeet
3e15fa86d7 r600g: Use symbolic names for NUMBER_TYPE.
Signed-off-by: Henri Verbeet <hverbeet@gmail.com>
2011-04-07 22:29:56 +02:00
Brian Paul
0da2a22ba6 docs: replace llvmpipe/README with docs/llvmpipe.html 2011-04-07 13:56:45 -06:00
Brian Paul
06613b7b3a llvmpipe: document issue with LLVM 2.8 and earlier with AVX 2011-04-07 13:43:00 -06:00
Brian Paul
ef2c80f506 util: add cpu detection for sse 4.2 and avx 2011-04-07 13:41:52 -06:00
Brian Paul
1e105741f1 util: simplify bit shifting in util_cpu_detect() 2011-04-07 13:41:52 -06:00
Brian Paul
6638b4a590 svga: another tweak to adjust_x term (use -0.5) 2011-04-07 11:25:46 -06:00
José Fonseca
584d1e2309 mesa: Update _ElementSize in a few more places. 2011-04-07 13:35:25 +01:00
José Fonseca
0c501bacef mesa/st: Fix user buffer size computation when stride is zero.
Although for GL a zero stride means tightly packed elements, Mesa
internally uses zero strides for constant arrays.

Therefore user buffers need to be defined from

  buffer_offset + src_offset + min_index*stride

to

  buffer_offset + src_offset + max_index*stride + elem_size

Simplifying the later with (max_index + 1)*stride will give zero
sized buffers.

This change also aggregates the st_context's info about user buffers
into a single array.
2011-04-07 12:20:06 +01:00
Brian Paul
204991bf5d mesa: Update _ElementSize. 2011-04-07 12:20:06 +01:00
José Fonseca
23d75936a7 mesa/st: Prevent 'end' < 'start' in vbo_exec_DrawRangeElementsBaseVertex()
We adjust 'end' to fit into _MaxElement, but that may result into a 'start'
value bigger than 'end' being passed downstream, causing havoc.

This could be seen with arb_robustness_draw-vbo-bounds, due to an
application bug.
2011-04-07 12:20:06 +01:00
José Fonseca
aa61b15351 mesa/st: Handle feedback draw when VBO offsets are not sorted in ascending order.
Simply port the same logic from setup_interleaved_attribs().

Avoids overflow in mustpass.c and feedback.c conform tests.
2011-04-07 12:20:06 +01:00
Zou Nan hai
66b66295d0 i965: clear global offset to zero in m0.2 for VS DP read.
Signed-off-by: Zou Nan hai <nanhai.zou@intel.com>
2011-04-07 21:07:57 +08:00
Vinson Lee
8800a798d1 mesa: Fix allocation size of extension_indices array.
Reviewed-by: Brian Paul <brianp@vmware.com>
2011-04-06 16:14:22 -07:00
Brian Paul
95368f25c1 mesa: fix error message text 2011-04-06 16:52:48 -06:00
Brian Paul
7b8830d81d mesa: consolidate code in _mesa_update_array_max_element() 2011-04-06 16:52:48 -06:00
Ian Romanick
de4cb19a1c mesa: Add link to 7.10.2 release notes 2011-04-06 13:46:58 -07:00
Ian Romanick
130872a2a6 docs: update news.html with 7.10.2 release
(cherry picked from commit b0866f6cfd)
2011-04-06 13:46:37 -07:00
Ian Romanick
2c8ba760fa Import 7.10.2 release notes from 7.10 branch 2011-04-06 13:46:20 -07:00
Julian Adams
3f8455d07b r600g: Fix non-independent blend state.
This fixes piglit fbo/fbo-drawbuffers-blend-add.

Signed-off-by: Henri Verbeet <hverbeet@gmail.com>
2011-04-06 21:16:40 +02:00
Brian Paul
122275760d mesa: init/release the default texture buffer object 2011-04-06 13:00:14 -06:00
Brian Paul
53245fffc0 mesa: fix popping of texture state for GL_TEXTURE_BUFFER
Fixes http://bugs.freedesktop.org/show_bug.cgi?id=36032
2011-04-06 12:45:30 -06:00
Brian Paul
c1f4b2364f mesa: TEXTURE_BUFFER fix-up
Fixes http://bugs.freedesktop.org/show_bug.cgi?id=36033
2011-04-06 12:33:30 -06:00
Tom Stellard
cd2857fae1 r300/compiler: Don't try to convert RGB to Alpha in full instructions
Note: This is a candidate for the 7.10 branch.
2011-04-06 00:31:53 -07:00
José Fonseca
740282b417 mesa: Recognize MESA_VERBOSE=all as shortcut for all debug options. 2011-04-06 08:27:53 +01:00
José Fonseca
dcbc9be38e draw: Fix thinko in debug warnings. 2011-04-06 08:27:52 +01:00
José Fonseca
c0f6bfd489 trace: Correct/cleanup.
Observe the actual type hierarchy and polymorphism of sampler views and
surface state.

s/texture/resource/

etc.
2011-04-06 08:26:44 +01:00
José Fonseca
391f7147e7 Revert "trace: Dump blend state as a binary blob."
This reverts commit dcdf94c87c.

No retrace support anymore, so human-legible representation of blend
state is much more useful than a blob.
2011-04-06 08:26:04 +01:00
José Fonseca
afeaf1771d st/python: Remove bindings, and all its dependencies.
Because:
- bindings are not fully automatic, and they are broken most of the time
- unit tests/samples can be written in C on top of graw
- tracing/retracing is more useful at API levels with stable ABIs such as
  GL, producing traces that cover more layers of the driver stack and and
  can be used for regression testing
2011-04-06 08:26:04 +01:00
Brian Paul
14b574433c swrast: simplify assertion to silence warning 2011-04-05 20:18:46 -06:00
Brian Paul
874a2c0b7d mesa: core support for GL_ARB_texture_buffer_object
No GLSL or driver support yet.
2011-04-05 19:02:09 -06:00
Brian Paul
9a77e285e8 mesa: regenerated API entrypoints for GL_ARB_texture_buffer_object 2011-04-05 18:50:39 -06:00
Brian Paul
13ba6b7369 mesa: API spec for GL_ARB_texture_buffer_object 2011-04-05 18:48:26 -06:00
Vinson Lee
622ee08e51 scons: Generate empty git_sha1.h for all platforms.
Fixes MinGW SCons build.
2011-04-05 15:34:30 -07:00
Kenneth Graunke
b4dfb7473e ir_to_mesa: Use gl_register_file enum type rather than 'int'.
src_reg already used this; make dst_reg use it too.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2011-04-05 15:31:58 -07:00
Kenneth Graunke
ce5d969adf ir_to_mesa: Unprefix ir_to_mesa_undef* and ir_to_mesa_address_reg.
Rename ir_to_mesa_undef to undef_src, for clarity.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2011-04-05 15:31:58 -07:00
Kenneth Graunke
5d9718f0db ir_to_mesa: Use emit overloads to avoid passing undef registers.
Makes the code just a little bit cleaner.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2011-04-05 15:31:58 -07:00
Kenneth Graunke
01e19fcf1f ir_to_mesa: Rename ir_to_mesa_emit_*_opX methods to emit_*.
There's really no need for a prefix on member functions, and overloading
takes care of the _op1/_op2 distinction quite nicely.  Eric already made
a similar change in the i965 FS backend.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2011-04-05 15:31:58 -07:00
Kenneth Graunke
cb21fa91b8 ir_to_mesa: Use constructors to convert between src_reg and dst_reg.
Rather than ir_to_mesa_dst_reg_from_src and ir_to_mesa_src_reg_from_dst.

The new constructors are marked 'explicit' so that the compiler can
catch cases where source and destination registers were accidentally
interchanged.

This also necessitated using constructors to initialize the undef and
address registers, as well as adding a default constructor.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2011-04-05 15:29:07 -07:00
Kenneth Graunke
fc6b4332c3 ir_to_mesa: Remove the "ir_to_mesa_" prefix on src_reg/dst_reg types.
Both classes are completely private to ir_to_mesa.cpp, so there won't be
any name conflicts with other parts of Mesa.  The prefix simply makes it
harder to read.

Also, use a class rather than typedef structs.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2011-04-05 15:29:07 -07:00
Kenneth Graunke
461273e910 ir_to_mesa: Rename src_reg and dst_reg variables to src and dst.
This is in preparation from removing the "ir_to_mesa_" prefix on the
src_reg and dst_reg types, which would cause a naming conflict.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2011-04-05 15:29:07 -07:00
Brian Paul
0c2455031d scons: generate empty git_sha1.h file for now
My feeble attempt to invoke the extract_git_sha1 script from
SConscript didn't work.  Hopefully this will do for now.
2011-04-05 14:07:48 -06:00
Ian Romanick
de579a1629 mesa: Include GIT SHA1 in GL version string
Reviewed-by: Corbin Simpson <MostAwesomeDude@gmail.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
2011-04-05 11:21:01 -07:00
Ian Romanick
0fe34b7bbc dri: Remove driver date from renderer string
Reviewed-by: Corbin Simpson <MostAwesomeDude@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
2011-04-05 11:21:01 -07:00
Ian Romanick
9996a86085 ir_to_mesa: Handle shadow compare w/projection and LOD bias correctly
The code would previously handle the projection, then swizzle the
shadow comparitor into place.  However, when the projection is done
"by hand," as in the TXB case, the unprojected shadow comparitor would
over-write the projected shadow comparitor.

Shadow comparison with projection and LOD is an extremely rare case in
real application code, so it shouldn't matter that we don't handle
that case with the greatest efficiency.

NOTE: This is a candidate for the stable branches.

Reviewed-by: Brian Paul <brianp@vmware.com>
References: https://bugs.freedesktop.org/show_bug.cgi?id=32395
2011-04-05 10:57:27 -07:00
Marek Olšák
4af3fe857d r300g: postpone fragment shader state validation until draw_vbo 2011-04-05 19:25:25 +02:00
Tom Stellard
d8361400b7 r300/compiler: Fix vertex shader MAD instructions with constant swizzles
NOTE: This is a candidate for the 7.9 and 7.10 branches.
2011-04-05 09:04:42 -07:00
Fabian Bieler
5d5db24a26 st/mesa: Apply LOD from texture object
Signed-off-by: Brian Paul <brianp@vmware.com>
2011-04-05 09:08:19 -06:00
Fabian Bieler
d863bd7d7b st/mesa: Apply LOD bias from correct texture unit
Signed-off-by: Brian Paul <brianp@vmware.com>
2011-04-05 09:07:07 -06:00
Brian Paul
8778bf221e mesa: fix alpha value for texstore_rgbx8888
Silences constant overflow compiler warning.
2011-04-05 07:53:09 -06:00
Fabian Bieler
c7339d42c6 mesa: Guard against null pointer deref in fbo validation
This matches the behaviour below when numSamples is compared.

At least with the gallium state tracker this can actually occur if st_render_texture fails.

Signed-off-by: Brian Paul <brianp@vmware.com>
2011-04-05 07:51:01 -06:00
Brian Paul
db0f9e701d mesa: added _mesa_get_attachment_teximage() helpers 2011-04-05 07:51:01 -06:00
Brian Paul
e9375cd0e8 mesa: 80-column wrapping 2011-04-05 07:51:01 -06:00
Dave Airlie
9ac64f7301 r300c: fix build since last r300g commit 2011-04-05 16:54:08 +10:00
Marek Olšák
b3011ea60c r300g: fix RG/LATC1_SNORM by doing UNORM->SNORM conversion in the shader 2011-04-05 06:36:56 +02:00
Marek Olšák
20141d9efd r300/compiler: implement the CND opcode
No one uses it now, but I will need it for a lowering pass.
2011-04-05 06:36:56 +02:00
Marek Olšák
c97234507a r300/compiler: set the MSB of ADDR for inline constants
The docs say so.
2011-04-05 06:36:56 +02:00
Brian Paul
5d92596c56 st/mesa: minor assorted clean-ups and fixes 2011-04-04 17:42:43 -06:00
Brian Paul
ed9396782e st/mesa: use 'array' local var to simplify the code a bit 2011-04-04 17:42:43 -06:00
Brian Paul
6cab07685f st/mesa: fix zero-sized user vertex buffer bug
Commit 4c4ab5668c didn't properly
handle the stride==0 case.

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=35961
2011-04-04 17:42:43 -06:00
Ian Romanick
e397b3a7c0 mesa: Add fall-back formats for unsupported snorm formats
This is always the way with real hardware and desktop OpenGL.  Some
hardware can't do some formats natively.  The alpha-only, luminance,
and intensity formats are usually the most problematic.  Some sized
formats can also be problematic.  This patch provides fall-back
formats for those that are not natively supported.

At some point it would be interesting to try providing
device-independent conversions using EXT_texture_swizzle.  The drivers
that support EXT_texture_swizzle could, for example, see
GL_LUMINANCE16_SNORM as MESA_FORMAT_SIGNED_R16 with a { r, r, r, 1 }
swizzle.  Care would need to be taken to prevent issues with using
those textures for FBO rendering.

This is the rest of the fix for glean's pixelFormats test on i965.

Reviewed-by: Marek Olšák <maraeo@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-04-04 15:18:37 -07:00
Ian Romanick
ad3fbac00b i965: Add the missing supportable EXT_texture_snorm formats
This class of hardware can natively sample all of the snorm surface
formats that DX10 requires, but it can't do some of the legacy GL
formats.  In particular, all of the alpha, luminance, and intensity
formats are unsupported.

This partially fixes the breakage in glean's pixelFormats test since
GL_EXT_texture_snorm support was added to Mesa.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-04-04 14:32:01 -07:00
Bryan Cain
19d06b5c05 nv50: prevent NV_OP_SELECT from having flags_def defined 2011-04-04 23:08:54 +02:00
Brian Paul
fdb04c0384 mesa: work around failed assertion for GL_RGBA16_SNORM accum buffer
We use this format to represent the accum buffer.  No snorm texture
sampling or rendering takes place.

Fixes failed assertion with swrast and any app using the accum buffer
(and glxinfo).
2011-04-04 14:37:28 -06:00
Brian Paul
32a11e5324 docs: update prerequisites, remove old demo info 2011-04-04 11:30:46 -06:00
Brian Paul
48f696c793 docs: update info about Mesa packaging/contents 2011-04-04 11:17:55 -06:00
Marek Olšák
0d96ae8fc7 r300/compiler: apply the texture swizzle to shadow pass and fail values too
Piglit tests:
- glsl-fs-shadow2d-01
- glsl-fs-shadow2d-02
- glsl-fs-shadow2d-03
- fs-shadow2d-red-01
- fs-shadow2d-red-02
- fs-shadow2d-red-03

NOTE: This is a candidate for the stable branches.
2011-04-04 19:13:01 +02:00
Marek Olšák
2679760834 r300/compiler: propagate SaturateMode down to the result of shadow comparison
NOTE: This is a candidate for the stable branches.
2011-04-04 19:13:01 +02:00
Alex Deucher
a0fc40f0d5 r600g: add some additional ontario pci ids
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
2011-04-04 11:15:18 -04:00
Alex Deucher
b0da65bd0e r600c: add new ontario pci ids
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
2011-04-04 11:13:44 -04:00
Marek Olšák
6caac3ecb8 r300g: do not wait for a busy BO if neither GPU nor CPU is changing it
Improves frame rate in apps with at least one user vertex buffer and
a hw index buffer.
2011-04-03 22:49:22 +02:00
Marek Olšák
9d881cbd5a r300g: remove unused RADEON_PB_USAGE_CACHE 2011-04-03 21:18:03 +02:00
Marek Olšák
f814dd7a81 r300g: tell the GLSL compiler to lower the continue opcode
NOTE: This is a candidate for the stable branches.
2011-04-03 19:35:43 +02:00
Marek Olšák
652bf121f2 r300g: avoid mapping the same buffer twice
Shouldn't happen, but you never know.
2011-04-03 19:32:27 +02:00
Marek Olšák
437c748bf5 r300g: handle DISCARD_WHOLE_RESOURCE for buffers 2011-04-03 19:32:27 +02:00
Marek Olšák
c35572352e r300g: remove the redundant reference counter in radeon_bo
We already have pb_buffer::reference::count.
2011-04-03 19:32:27 +02:00
Tom Stellard
381d32af74 Revert "r300/compiler: Remove obsolete compiler passes"
This reverts commit 9f013a8233.

These passes are still need for non-GLSL paths like g3dvl and ARB
programs.
2011-04-02 23:22:48 -07:00
Kenneth Graunke
5d7fefb9af i965/fs: Switch W and 1/W in Sandybridge interpolation setup.
Various documentation mentions that "W" is handed to the WM stage,
but further digging seems to indicate that they really mean 1/W.

The code here is still unclear, but changing this fixes piglit
test "fragcoord_w" on Sandybridge as well as a Khronos ES2 conformance
test.  I also tested 3DMarkMobile ES2.0's taiji and hoverjet demos, as
well as Nexuiz, just to be safe.

NOTE: This is a candidate for the 7.10 branch.
2011-04-02 18:58:16 -07:00
Kenneth Graunke
a019dd0d6e i965: Fix null register use in Sandybridge implied move resolution.
Fixes regressions caused by commit 9a21bc6401, namely GPU hangs when
running gnome-shell or compiz (Mesa bugs #35820 and #35853).

I incorrectly refactored the case that dealt with ARF_NULL; even in that
case, the source register needs to be changed to the MRF.

NOTE: This is a candidate for the 7.10 branch (if 9a21bc6401 is
cherry-picked, take this one too).
2011-04-03 00:57:30 -07:00
Eric Anholt
904b8ba1bb i965: Fix the VS thread limits for GT1, and clarify the WM limits on both. 2011-04-01 14:12:32 -07:00
José Fonseca
6586a3b287 tests: Use elts in translate_test. 2011-04-01 20:18:22 +01:00
José Fonseca
3f68d4b058 scons: Add aliases for unit tests. 2011-04-01 20:18:22 +01:00
José Fonseca
17bbc1f042 translate: Respect translate_buffer::max_index. 2011-04-01 20:18:18 +01:00
José Fonseca
3733da31e8 draw: Prevent out-of-bounds vertex buffer access.
Based on some code and ideas from Keith Whitwell.
2011-04-01 20:18:18 +01:00
Marek Olšák
4a7f013f9d gallium: set PIPE_CAP_MIXED_COLORBUFFER_FORMATS in some drivers 2011-04-01 13:48:01 +02:00
Marek Olšák
25f2699767 gallium: add a CAP for mixed colorbuffer format support
Some GPUs can't do it (I think most of DX9 ones), so they should have
the option not to allow it.
2011-04-01 13:48:01 +02:00
Tom Stellard
9f013a8233 r300/compiler: Remove obsolete compiler passes
Branch emulation and loop unrolling are done in the GLSL frontend.
Transforming loops is no longer needed for fragment shaders, but it is still
necessary for vertex shaders.
2011-03-31 23:45:26 -07:00
Tom Stellard
18dcbd358f prog_optimize: Fix reallocating registers for shaders with loops
Registers that are used inside of loops need to be considered live
starting with the first instruction of the outermost loop.

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

NOTE: This is a candidate for the 7.9 and 7.10 branches.

Reviewed-by: Eric Anholt <eric@anholt.net>
2011-03-31 21:20:46 -07:00
Christoph Bumiller
c3526585b7 nv50: fix for GPR allocation granularity being 16 bit 2011-03-31 16:51:32 +02:00
Christoph Bumiller
3f625689ac nv50: copy regalloc fixes from nvc0
Should fix gnome-shell's fade shader.

Unification of the shader backend which is supposed to remove the
code duplication is still WIP.
2011-03-31 16:24:59 +02:00
José Fonseca
3dedd39cdd draw: Revert code reorg in previous change.
Because

  fetch_count = max_index - min_index + 1

overflows for min_index = 0 and max_index = 0xffffffff.

Fixes fdo 35815.
2011-03-31 12:20:37 +01:00
Chris Wilson
c40b7910ee intel: Fix regression in clear_with_blit from 7bae1c3d
Oops, the mask was being used in the loop to determine whether to use
include the stencil || depth values. This began to fail when mask was
cleared at the beginning of the loop. So reorder the tests and do the
work up-front along with determining the depth_stencil value to use.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=35822
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-03-31 11:58:36 +01:00
Luca Barbieri
5f996e2b1d draw: implement vertex color clamping, and disable SSE and PPC paths
(some little changes by Marek Olšák)

Squashed commit of the following:

commit 737c0c6b7d591ac0fc969a7590e1691eeef0ce5e
Author: Luca Barbieri <luca@luca-barbieri.com>
Date:   Fri Aug 27 02:13:57 2010 +0200

    draw: disable SSE and PPC paths (use LLVM instead)

    These paths don't support vertex clamping, and are anyway
    obsoleted by LLVM.

    If you want to re-enable them, add vertex clamping and test that it
    works with the ARB_color_buffer_float piglit tests.

commit fed3486a7ca0683b403913604a26ee49a3ef48c7
Author: Luca Barbieri <luca@luca-barbieri.com>
Date:   Thu Aug 26 18:27:38 2010 +0200

    draw_llvm: respect vertex color clamp

commit ef0efe9f3d1d0f9b40ebab78940491d2154277a9
Author: Luca Barbieri <luca@luca-barbieri.com>
Date:   Thu Aug 26 18:26:43 2010 +0200

    draw: respect vertex clamping in interpreter path
2011-03-31 03:35:31 +02:00
Jerome Glisse
ebe304fa54 gallium: list use inline function to avoid macro shot coming
Macro can lead to hard to debug list bugs. For instance consider
the following :
LIST_ADD(item, list->prev)
3 instruction of the macro became :
(list->prev)->next->prev = item
which is equivalent to :
list->prev = item
Thus list prev field changes and next instruction in the macro
(list->prev)->next = item
became :
item->next = item
And you endup with list corruption, other case lead to similar
list corruption. Inline function are not affected by this short
coming

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
2011-03-30 17:03:00 -04:00
José Fonseca
dcad6fb670 draw: Forgot to remove one istart usage. 2011-03-30 16:09:34 +01:00
José Fonseca
713230ff39 draw: Fix bug when drawing ushort indices.
When the condition

 min_index == 0 && sizeof(ib[0]) == sizeof(draw_elts[0])

was true, we were wrongly ignoring istart and processing indices 0.

Reorder some statements to make the code easier to understand.
2011-03-30 16:05:24 +01:00
Chris Wilson
6584d0cd4f intel: Remove the unrelaxed relocation assertion
Now that we purposefully generate delta that point outside of the target
buffer, the assertion has outlived its usefulness.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-03-30 15:13:05 +01:00
Feng, Haitao
58f95f9d01 egl_dri2 x11: Fix a typo
Signed-off-by: Haitao Feng <haitao.feng@intel.com>
2011-03-30 08:29:09 -04:00
Chris Wilson
5eb9f68708 intel: Add some defense against buffer allocation failure for subimage blits
Once more! This time without the unwarranted conversion from
drm_intel_bo_alloc_tiled.

Signed-off-by: [a very embarrassed] Chris Wilson <chris@chris-wilson.co.uk>
2011-03-30 11:01:42 +01:00
Chris Wilson
f5a9a0bc22 Revert "intel: Add some defense against buffer allocation failure for subimage blits"
This reverts commit de7678ef52.

The conversion from using drm_intel_bo_alloc_tiled to a plain
drm_intel_bo_alloc forgot that the tiled variant adjusts the
allocation height even for TILING_NONE.

Reported-by: Dave Airlie <airlied@redhat.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=35786
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-03-30 11:01:42 +01:00
Michel Dänzer
167d35c303 gallium: Use explicit values in caps enums.
Simplifies mapping between numbers and identifiers for these.
2011-03-30 10:50:11 +02:00
Michel Dänzer
72e82418ef Use row stride instead of width when getting colour index texels.
Untested, noticed while working on the depth/stencil fix.
2011-03-30 10:48:37 +02:00
Michel Dänzer
b082e04619 Use proper source row stride when getting depth/stencil texels. 2011-03-30 09:31:21 +02:00
Kenneth Graunke
ee8d182426 intel: Add IS_GT2 macro for recognizing Sandybridge GT2 systems.
Also, refactor IS_GEN6 to use the IS_GT1 and IS_GT2 macros.
2011-03-29 17:08:53 -07:00
Christoph Bumiller
8f060df60d nv50,nvc0: implement colour clamping controls 2011-03-29 23:09:02 +02:00
Fredrik Höglund
d04ab396a5 r600g: implement texture barrier 2011-03-29 16:54:19 -04:00
Fredrik Höglund
948e1eb8e9 r600g: implement the pipe_screen fence functions
v2: Allocate the fences from a single shared buffer object.
v3: Allocate the r600_fence structs in blocks of 16.
    Spin a few times before calling sched_yield in r600_fence_finish().
2011-03-29 16:37:04 -04:00
Ian Romanick
a99e80d795 mesa: Fix ugly indentation left from previous commit
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Chad Versace <chad.versace@intel.com>
2011-03-29 13:21:09 -07:00
Ian Romanick
89d81ab16c glsl: Calcluate Mesa state slots in front-end instead of back-end
This should be the last bit of infrastructure changes before
generating GLSL IR for assembly shaders.

This commit leaves some odd code formatting in ir_to_mesa and brw_fs.
This was done to minimize whitespace changes / reindentation in some
loops.  The following commit will restore formatting sanity.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Chad Versace <chad.versace@intel.com>
2011-03-29 13:21:08 -07:00
Ian Romanick
92e412e788 glsl: Move _mesa_builtin_uniform_desc from uniforms.c to ir_variable.cpp
This array is going to be used in the main compiler soon.  Leaving
them uniforms.c caused problems for building the stand-alone compiler.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Chad Versace <chad.versace@intel.com>
2011-03-29 13:21:08 -07:00
Marek Olšák
0420ae3d90 r300g: add support for all render targets with one and two channels
The hardware should be set according to this table:

FORMAT -> R300 COLORFORMAT
-------------------------
X16    -> UV88
X16Y16 -> ARGB8888
X32    -> ARGB8888
X32Y32 -> ARGB16161616

US_OUT_FMT must contain the real format.

I wasn't able to make B3G3R2 and L4A4 work, but those aren't important.
2011-03-29 18:47:02 +02:00
Marek Olšák
7d41857566 intel: fix build
broken with e5c6a92a12
(mesa: implement clamping controls (ARB_color_buffer_float))
2011-03-29 18:03:19 +02:00
Chris Wilson
7bae1c3d85 intel: Protect intel_clear_with_blit from failed buffer allocations
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=34419
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-03-29 15:43:56 +01:00
Chris Wilson
252eaa765e i965: Avoid name clash of loop counter and member
src/mesa/drivers/dri/i965/brw_fs.cpp:565 warning: name lookup of ‘c’ changed

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-03-29 15:43:56 +01:00
Chris Wilson
b094dff50a i915: Detect allocation failure of batch buffer
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-03-29 15:43:55 +01:00
Marek Olšák
8cbdfe1de4 docs: update GL3 status 2011-03-29 13:04:15 +02:00
Marek Olšák
2e6a69939c r300g: finish up signed normalized textures and render targets 2011-03-29 12:50:28 +02:00
Marek Olšák
f037914670 r300g: enable clamping controls 2011-03-29 12:50:28 +02:00
Marek Olšák
8d4ec87d7f gallium: remove PIPE_CAP_VERTEX_COLOR_CLAMP_CONTROL
The vertex color clamp control is a property of an API,
a lot like gl_rasterization_rules.

The state should be set according to the API being implemented, for example:
   OpenGL Compatibility: enabled by default
   OpenGL Core: disabled by default
   D3D11: always disabled

This patch also changes the way ARB_color_buffer_float is advertised.
If no SNORM or FLOAT render target is supported, fragment color clamping
is not required.
2011-03-29 12:50:27 +02:00
Marek Olšák
e28fe8fe5d mesa: clamp texture border color if ARB_texture_float is unsupported
ARB_texture_float disables clamping of the texture border color,
ARB_color_buffer_float only modifies clamping of the glGet query.
2011-03-29 12:50:27 +02:00
Marek Olšák
b518f4d0ea st/mesa: choose an appropriate texture format for DrawPixels 2011-03-29 12:50:22 +02:00
Marek Olšák
2af1da1546 gallium: add EXT_texture_snorm support 2011-03-29 12:04:55 +02:00
Marek Olšák
daa5242f9e mesa: implement texstore and texfetch hooks for signed normalized formats
The snorm texstore functions were all broken.

swrast support done except for mipmap generation, but I leave it disabled.
2011-03-29 12:04:55 +02:00
Marek Olšák
0be369975f mesa: initial EXT_texture_snorm support
The component ordering of some formats has been been reversed to match
Gallium types.
2011-03-29 12:04:55 +02:00
Luca Barbieri
47e3896dfd gallium: implement clamping controls (ARB_color_buffer_float)
BTW this changes the gallium interface.
Some rather cosmetic changes by Marek.

Squashed commit of the following:

commit 513b37d484f0318311e84bb86ed4c93cdff71f13
Author: Luca Barbieri <luca@luca-barbieri.com>
Date:   Thu Aug 26 18:17:54 2010 +0200

    mesa/st: respect fragment clamping in st_DrawPixels

commit 546a31e42cad459d7a7a10ebf77fc5ffcf89e9b8
Author: Luca Barbieri <luca@luca-barbieri.com>
Date:   Thu Aug 26 18:17:28 2010 +0200

    mesa/st: support fragment and vertex color clamping

commit c406514a1fbee6891da4cf9ac3eebe4e4407ec13
Author: Luca Barbieri <luca@luca-barbieri.com>
Date:   Tue Aug 24 21:56:37 2010 +0200

    mesa/st: expose ARB_color_buffer_float if unclamping is supported

commit d0c5ea11b6f75f3da2f4ca989115f150ebc7cf8d
Author: Luca Barbieri <luca@luca-barbieri.com>
Date:   Thu Aug 26 17:53:41 2010 +0200

    mesa/st: use unclamped colors

    This assumes that Gallium is to be interpreted as given drivers the
    responsibility to clamp these colors if necessary.

commit aef5c3c6be6edd076e955e37c80905bc447f8a82
Author: Luca Barbieri <luca@luca-barbieri.com>
Date:   Thu Aug 26 18:12:34 2010 +0200

    mesa, mesa/st: handle read color clamping properly

    We set IMAGE_CLAMP_BIT in the caller based on _ClampReadColor, where
    the operation mandates it. (see the removed XXX comment. -Marek)

    TODO: did I get the set of operations mandating it right?

commit 76bdfcfe3ff4145a1818e6cb6e227b730a5f12d8
Author: Luca Barbieri <luca@luca-barbieri.com>
Date:   Thu Aug 26 18:18:25 2010 +0200

    gallium: add color clamping to the interface
2011-03-29 12:04:55 +02:00
Marek Olšák
e5c6a92a12 mesa: implement clamping controls (ARB_color_buffer_float)
Squashed commit of the following:

Author: Marek Olšák <maraeo@gmail.com>

    mesa: fix getteximage so that it doesn't clamp values
    mesa: update the compute_version function
    mesa: add display list support for ARB_color_buffer_float
    mesa: fix glGet query with GL_ALPHA_TEST_REF and ARB_color_buffer_float

commit b2f6ddf907935b2594d2831ddab38cf57a1729ce
Author: Luca Barbieri <luca@luca-barbieri.com>
Date:   Tue Aug 31 16:50:57 2010 +0200

    mesa: document known possible deviations from ARB_color_buffer_float

commit 5458935be800c1b19d1c9d1569dc4fa30a97e8b8
Author: Luca Barbieri <luca@luca-barbieri.com>
Date:   Tue Aug 24 21:54:56 2010 +0200

    mesa: expose GL_ARB_color_buffer_float

commit aef5c3c6be6edd076e955e37c80905bc447f8a82
Author: Luca Barbieri <luca@luca-barbieri.com>
Date:   Thu Aug 26 18:12:34 2010 +0200

    mesa, mesa/st: handle read color clamping properly

    (I'll squash the st/mesa part to a separate commit. -Marek)

    We set IMAGE_CLAMP_BIT in the caller based on _ClampReadColor, where
    the operation mandates it.

    TODO: did I get the set of operations mandating it right?

commit 3a9cb5e59b676b6148c50907ce6eef5441677e36
Author: Luca Barbieri <luca@luca-barbieri.com>
Date:   Thu Aug 26 18:09:41 2010 +0200

    mesa: respect color clamping in texenv programs (v2)

    Changes in v2:
    - Fix attributes other than vertex color sometimes getting clamped

commit de26f9e47e886e176aab6e5a2c3d4481efb64362
Author: Luca Barbieri <luca@luca-barbieri.com>
Date:   Thu Aug 26 18:05:53 2010 +0200

    mesa: restore color clamps on glPopAttrib

commit a55ac3c300c189616627c05d924c40a8b55bfafa
Author: Luca Barbieri <luca@luca-barbieri.com>
Date:   Thu Aug 26 18:04:26 2010 +0200

    mesa: clamp color queries if and only if fragment clamping is enabled

commit 9940a3e31c2fb76cc3d28b15ea78dde369825107
Author: Luca Barbieri <luca@luca-barbieri.com>
Date:   Wed Aug 25 00:00:16 2010 +0200

    mesa: introduce derived _ClampXxxColor state resolving FIXED_ONLY

    To do this, we make ClampColor call FLUSH_VERTICES with the appropriate
    _NEW flag.

    We introduce _NEW_FRAG_CLAMP since fragment clamping has wide-ranging
    effects, despite being in the Color attrib group.

    This may be easily changed by s/_NEW_FRAG_CLAMP/_NEW_COLOR/g

commit 6244c446e3beed5473b4e811d10787e4019f59d6
Author: Luca Barbieri <luca@luca-barbieri.com>
Date:   Thu Aug 26 17:58:24 2010 +0200

    mesa: add unclamped color parameters
2011-03-29 12:04:55 +02:00
Marek Olšák
3bdd12ecb5 mesa: regenerate glapi files 2011-03-29 12:04:54 +02:00
Kenneth Graunke
9d60a7ce08 i965: Resolve implied moves in brw_dp_READ_4_vs_relative.
Fixes piglit test glsl-vs-arrays-3 on Sandybridge, as well as garbage
rendering in 3DMarkMobileES 2.0's Taiji demo and GLBenchmark 2.0's
Egypt and PRO demos.

NOTE: This a candidate for stable release branches.  It depends on
commit 9a21bc6401.
2011-03-29 06:22:48 -07:00
Kenneth Graunke
9a21bc6401 i965: Refactor Sandybridge implied move handling.
This was open-coded in three different places, and more are necessary.
Extract this into a function so it can be reused.

Unfortunately, not all variations were the same: in particular, one set
compression control and checked that the source register was not
ARF_NULL.  This seemed like a good idea, so all cases now do so.
2011-03-29 05:29:06 -07:00
Vinson Lee
4f94e0b76a mesa: Add missing parentheses in glBlitFramebufferEXT error strings. 2011-03-28 20:32:01 -07:00
Ian Romanick
e21beaeb10 intel: Don't leak the tex object miptree when replacing it
Eventually the miptree refcounting interface should be cleaned up.
The assymmetry dramatically increases the probability of bugs like
this.  It should be made to like like libdrm refcounting or the
refcounting style used in other parts of Mesa.

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

Reviewed-by: Eric Anholt <eric@anholt.net>
2011-03-28 19:54:51 -07:00
Vinson Lee
92e29dc5b0 gallivm: Fix build with llvm-2.9.
The build fix of commit 40ae214067 does
not apply to llvm-2.9 but rather to llvm-3.0svn.
2011-03-28 17:48:37 -07:00
Vinson Lee
2737350157 i915g: Fix build.
Fix build failures introduced with commit 0fbb64a529.

Reviewed-by: Jakob Bornecrantz <wallbraker@gmail.com>
2011-03-28 17:37:33 -07:00
Daniel Vetter
0fbb64a529 i915g: use drm ioctl to get pci devid
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2011-03-28 21:23:31 +02:00
Tobias Droste
40ae214067 gallivm: Fix build with llvm-2.9
In llvm-2.9 Target->createMCInstPrinter() takes different arguments

Signed-off-by: Tobias Droste <tdroste@gmx.de>
2011-03-28 17:23:45 +01:00
Henri Verbeet
5d7c27f5ec st/mesa: Validate state before doing blits.
Specifically, this ensures things like the front buffer actually exist. This
fixes piglt fbo/fbo-sys-blit and fd.o bug 35483.

Signed-off-by: Henri Verbeet <hverbeet@gmail.com>
2011-03-27 15:01:59 +02:00
Fabian Bieler
244a3bbf14 r600g: Handle texture fetch instructions with relative addressing
Signed-off-by: Henri Verbeet <hverbeet@gmail.com>
2011-03-27 15:00:07 +02:00
Fabian Bieler
da5b4764b2 r600g: Handle texture fetch instructions with neg or abs on source register
Signed-off-by: Henri Verbeet <hverbeet@gmail.com>
2011-03-27 15:00:07 +02:00
Fabian Bieler
78037d95da r600g: Handle texture fetch instructions with swizzle on source register
Signed-off-by: Henri Verbeet <hverbeet@gmail.com>
2011-03-27 15:00:07 +02:00
Kenneth Graunke
8752824f27 glsl: Accept precision qualifiers on sampler types, but only in ES.
GLSL 1.30 states clearly that only float and int are allowed, while the
GLSL ES specification's issues section states that sampler types may
take precision qualifiers.

Fixes compilation failures in 3DMarkMobileES 2.0 and GLBenchmark 2.0.

NOTE: This is a candidate for stable release branches.
2011-03-26 23:56:18 -07:00
Kenneth Graunke
0c8beb0ab5 i965/fs: Fix linear gl_Color interpolation on pre-gen6 hardware.
Civilization 4's shaders make heavy use of gl_Color and don't use
perspective interpolation.  This resulted in rivers, units, trees, and
so on being rendered almost entirely white.  This is a regression
compared to the old fragment shader backend.

Found by inspection (comparing the old and new FS backend code).

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

NOTE: This is a candidate for the 7.10 branch.
2011-03-26 22:20:11 -07:00
Benjamin Franzke
62d5f7a04a egl/wayland-drm: Fix include path
src/egl/main/egltypedefs.h needs the path for EGL/egl.h

Reported by jlind on irc.
2011-03-26 10:57:31 -04:00
Kristian Høgsberg
a1bd012473 egl_dri2: We don't actually support KHR_gl_texture_2D_image 2011-03-26 10:57:31 -04:00
Kristian Høgsberg
981e338611 egl_dri2: Enable image extensions in one place
We know what we can support in egl_dri2.c so just enable the extensions
there.
2011-03-26 10:57:31 -04:00
Kenneth Graunke
56ef62d988 glsl: Generate readable unique names at print time.
Since GLSL IR allows multiple ir_variables to share the same name, we
need to generate unique names when printing the IR.  Previously, we
always used %s@%p, appending the ir_variable's memory address.

While this worked, it had two drawbacks:
- When there aren't duplicates, the extra "@0x669a3e88" is useless
  and makes the code harder to read.
- Real duplicates were hard to tell apart:
  channel_expressions@0x6699e3c8 vs. channel_expressions@0x6699ddd8

We now append @2, @3, @4, and so on, but only where necessary to
distinguish duplicates.  Since we only do this at print time, any
performance impact is irrelevant.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <idr@freedesktop.org>
2011-03-25 16:31:53 -07:00
Vinson Lee
eb0dd37094 gallivm: Fix build with llvm-2.9.
In llvm-2.9, the header file llvm/System/Host.h has been moved to
llvm/Support/Host.h.
2011-03-25 12:47:06 -07:00
Ian Romanick
dfdff940b6 glsl: Make add_variable, add_uniform, et. al. have similar signatures
While making some other changes in this area I was finding it annoying
each of these functions took mostly the same set of parameters in
differing orders.
2011-03-25 11:28:08 -07:00
Ian Romanick
4e994e150f i965/fs: Use different name for inner loop counter
'i' is already used for the outer loop.  This caused some problems
while doing other work in this area.  No bug exists here... until you
want to use the outer loop counter in the inner loop.
2011-03-25 11:28:07 -07:00
Ian Romanick
0d9d036004 glsl: Fix off-by-one error setting max_array_access for non-constant indexing
NOTE: This is a candidate for the stable branches.
2011-03-25 11:28:07 -07:00
Ian Romanick
bc83f6bd58 glsl: Add array access bounds checking to ir_validate 2011-03-25 11:28:07 -07:00
Brian Paul
cf290344cc mesa: add void to save_TextureBarrierNV() 2011-03-25 10:33:51 -06:00
José Fonseca
28f1d6ab49 glsl: Add void to _mesa_destroy_shader_compiler() argument list.
At least MSVC sees a distinction between foo() and foo(void) and warns
about it.
2011-03-25 16:22:34 +00:00
José Fonseca
a81828cb96 mesa: Avoid redefining PUBLIC/USE/likely/unlikely macros. 2011-03-25 16:22:32 +00:00
José Fonseca
7fbe020bbc mesa: Use appropriate call convention in VertexAttribI*v.
We were using typecasts because the functions pointers are polymorphic
in the second argument type, which.

Surprisingly the wrong calling convention didn't cause crashes on Windows,
but it was causing certain registers to be trashed in MSVC optimized
builds, when processing callists in the ClearView RC Flight Simulator.
2011-03-25 16:22:30 +00:00
José Fonseca
5858abec6e gallium: Avoid redefinition of likely/unlikely macros on non gcc compilers. 2011-03-25 16:22:28 +00:00
José Fonseca
acd7ce57f7 mesa,mapi: Remove spurious const keyword from ClearBufferfi args. 2011-03-25 16:22:26 +00:00
Marek Olšák
226ae9d6c8 r300g: fix alpha-test with no colorbuffer
Piglit:
- fbo-alphatest-nocolor

NOTE: This is a candidate for the stable branches.
2011-03-24 23:37:51 +01:00
Brian Paul
e1a9ef2304 mesa: added _mesa_dump_image() for debugging 2011-03-24 13:38:28 -06:00
Brian Paul
e4852ae4d2 mesa: minor whitespace fixes 2011-03-24 13:38:27 -06:00
Eric Anholt
2911fa0cca i965/fs: Make compile failure more verbose with INTEL_DEBUG=wm. 2011-03-24 11:31:36 -07:00
Eric Anholt
4a101f9577 i965/fs: Clean up reg_undef args from long ago lack of fs_inst overloads. 2011-03-24 11:31:36 -07:00
Eric Anholt
53d78be3bd i965/fs: Clean up the emit calls by introducing emit() overload helpers.
I think the code ends up a lot more legible this way, though we've
still got the overloads in the fs_inst as well (even though there's
only one caller left currently).
2011-03-24 11:31:36 -07:00
Brian Paul
82dd62fb22 mesa: new MESA_EXTENSION_MAX_YEAR env var
If set to year X, only report extensions up to that year.  This is a
work-around for games that try to copy the extensions string to a fixed
size buffer and overflow.  If a game was released in year X, setting
MESA_EXTENSION_MAX_YEAR to that year will likely fix the problem.
2011-03-24 11:39:23 -06:00
Brian Paul
4c75d5ae63 svga: adjust triangle rasterization offset
Fixes minor sub-pixel positioning error in some apps.
2011-03-24 11:32:38 -06:00
Iain Hibbert
c22a7f9045 radeon: use C99 style in macros with variable arguments
Signed-off-by: Iain Hibbert <plunky@netbsd.org>
2011-03-24 08:36:31 -06:00
Brian Paul
ff2950dd69 radeon: reorder #includes to silence warnings
Silences warnings about RADEON_TILING_SURFACE being redefined.
Only compile tested, not run tested.
2011-03-24 08:34:44 -06:00
Brian Paul
b5745429d7 r128: fix an old annoying warning 2011-03-24 08:29:28 -06:00
Brian Paul
7d40bf2566 radeon: fix radeon_create_image_from_name() wrong parameter type 2011-03-24 08:29:28 -06:00
José Fonseca
f4e392bf8d st/wgl: Adjust the pbuffer invisible window size.
Thanks to Brian Paul for diagnosing the issue.
2011-03-24 10:47:03 +00:00
José Fonseca
81992010b5 mesa: More glGet* fixes.
glGet(GL_NORMAL_ARRAY) giving potentially wrong results.

Most of glGet(GL_XXX_ARRAY_BUFFER_BINDING) giving totally bogus results.
2011-03-23 16:47:41 +00:00
Brian Paul
12b9e07966 mesa: remove unused _MESA_NEW_NEED_NORMALS 2011-03-23 09:05:04 -06:00
Brian Paul
7ecb61c30c mesa: remove _MESA_NEW_TRANSFER_STATE 2011-03-23 09:04:22 -06:00
José Fonseca
f6970872c0 mesa: Fix typo glGet*v(GL_TEXTURE_COORD_ARRAY_*). 2011-03-22 22:48:02 +00:00
Fabian Bieler
8d7c12de1e r600g: Check for relative addressing in destination register when trying to merge instruction groups
Signed-off-by: Henri Verbeet <hverbeet@gmail.com>
2011-03-22 21:24:09 +01:00
Dave Airlie
e4b040c2b9 r600g: fix bo names causing -35 EDEADLCK
this is a port of the r300 winsys code to do the same thing.
2011-03-22 11:48:36 +10:00
José Fonseca
b881ea87f1 svga: Avoid synchronizing when doing piecewise upload of textures. 2011-03-21 18:47:24 +00:00
José Fonseca
29288249e3 svga: Undo the DMA buffer size limiting.
Move this to the winsys, given it is not a virtual device limitation,
but a limitation specific to certain winsyses.

Also update debug message.
2011-03-21 18:46:59 +00:00
Dave Airlie
9b13c988ac glapi: drop glapi.[ch] and glapitemp.h from being copied to the X server.
These files are no longer considered shared as the X code is a lot simpler
without sharing them.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-03-21 12:03:20 +10:00
Brian Paul
cfc7ded3ff mesa: 80-column wrapping and comment updates 2011-03-19 14:17:42 -06:00
Brian Paul
d0d767ad4c mesa: 80-column wrapping, update comment 2011-03-19 14:17:41 -06:00
Brian Paul
912c4ec6df gl.h: reorder some #defines 2011-03-19 14:17:41 -06:00
Brian Paul
933b99f113 mesa: consolidate enable/disable code for GL_TEXTURE_GEN_S/T/R/Q 2011-03-19 14:17:41 -06:00
Brian Paul
ec4a21b0e2 mesa: consolidate clip plane update code 2011-03-19 14:17:41 -06:00
Brian Paul
957552fce0 mesa: 80-column wrapping 2011-03-19 14:17:41 -06:00
Brian Paul
aafcbd2cf7 mesa: replace macro with function 2011-03-19 14:17:41 -06:00
Brian Paul
9459cc593c mesa: 80-column wrapping 2011-03-19 14:17:41 -06:00
Brian Paul
630d925666 mesa: rename functions to follow Mesa conventions 2011-03-19 14:17:40 -06:00
Brian Paul
79f4281a52 mesa: 80-column wrapping 2011-03-19 14:17:40 -06:00
Christoph Bumiller
83ff3809f1 nv50,nvc0: implement texture barrier 2011-03-19 14:45:55 +01:00
Tom Stellard
9d2ef284bb r300/compiler: Use a 4-bit writemask in pair instructions
We now use a 4-bit writemask for all instruction types, which makes it
easier to write generic helper functions to manipulte writemasks.

NOTE: This is a candidate for the 7.10 branch.
2011-03-18 12:04:20 -07:00
Johannes Obermayr
8042d751de nouveau: Fix serious compiler warnings
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=35025

Signed-off-by: Brian Paul <brianp@vmware.com>
2011-03-18 12:10:11 -06:00
Brian Paul
5b902a08c1 mesa: minor improvements in glTexEnvfv() 2011-03-17 20:31:58 -06:00
Brian Paul
582570a04c mesa: only report up to 50 _mesa_problem() calls
http://bugs.freedesktop.org/show_bug.cgi?id=35200 reports a disk
partition getting filled because of warning messages.  Stop emitting
after 50.
2011-03-17 20:31:58 -06:00
Brian Paul
147148fd50 swrast: report data type in error message 2011-03-17 20:31:58 -06:00
Kenneth Graunke
5e9aa9926b mesa: Remove the CompileShader driver hook; it's just a no-op. 2011-03-17 14:48:54 -07:00
Brian Paul
cbadedb511 mesa: use _mesa_get_current_tex_unit() helper in BindTexture() 2011-03-16 21:13:31 -06:00
Brian Paul
552f54bf04 mesa: remove unneeded local var in BindTexture() 2011-03-16 21:13:31 -06:00
Brian Paul
dfda559b98 mesa: clean up the glBindTexture early out code a bit 2011-03-16 21:13:31 -06:00
Kenneth Graunke
2279156fe7 i965: Rename brw_(IF|CONT)_gen6 functions to gen6_(IF|CONT). 2011-03-16 14:18:03 -07:00
Tobias Droste
f3a828c21f autoconf: don't use CFLAGS for cpp files
Signed-off-by: Tobias Droste <tdroste@gmx.de>
2011-03-16 13:54:50 -07:00
Kenneth Graunke
2baac48f39 i965: Rename BRW_DATAPORT_..._GEN6 messages to GEN6_... for consistency. 2011-03-16 13:51:44 -07:00
Kenneth Graunke
cc48d663f7 i965: Rename BRW_SAMPLER_MESSAGE_..._GEN5 to GEN5_SAMPLER_MESSAGE.
We already have lots of GEN6_* defines; this seems more consistent.
2011-03-16 13:51:44 -07:00
José Fonseca
b47d508412 svga: Leave any_user_vertex_buffers flag alone.
It is pointless to change, now that we don't replace user vertex buffer
with uploaded copy, per commit 52e598d200.
2011-03-16 15:46:21 +00:00
José Fonseca
74651f5738 svga: Hardcode SVGA_COMBINE_USERBUFFERS to 1.
The code no longer supports otherwise -- it relies on buffers being
uploaded via u_upload_mgr -- so make this clear.

Also, there's no need to flush after draws from user buffers, given all
user content should have been copied by then.
2011-03-16 15:43:00 +00:00
José Fonseca
8767fe2437 mesa: Sort extensions in extension string by year.
The years were obtained automatically by scraping the first year from
the spec text file.  They are approximate.
2011-03-16 11:38:53 +00:00
José Fonseca
e08a3d674a svga: Use transfer information on buffer transfers.
Should prevent the assert failure

  svga_buffer_flush_mapped_range: Assertion `sbuf->map.writing' failed.

on nested transfers.
2011-03-16 11:21:12 +00:00
José Fonseca
6b3713f8b8 glsl2: Silence unused added variable gcc warning. 2011-03-16 09:16:01 +00:00
José Fonseca
5fc5820cbc mesa: Use typecast in BITFIELD64_BIT macro.
Unsigned long is 32bit on several platforms (e.g., Windows), yielding
1UL << 32 to be zero.

Note that BITFIELD64_BIT result is often assigned to variables of type
GLbitfield, instead of GLbitfield64. That's probably wrong and should be
addressed in a later change.
2011-03-16 09:15:30 +00:00
612 changed files with 22931 additions and 115957 deletions

View File

@@ -1,3 +0,0 @@
ifneq ($(TARGET_SIMULATOR),true)
include $(call all-subdir-makefiles)
endif

View File

@@ -5,7 +5,10 @@ TOP = .
SUBDIRS = src
# The git command below generates an empty string when we're not
# building in a GIT tree (i.e., building from a release tarball).
default: $(TOP)/configs/current
@$(TOP)/bin/extract_git_sha1
@for dir in $(SUBDIRS) ; do \
if [ -d $$dir ] ; then \
(cd $$dir && $(MAKE)) || exit 1 ; \
@@ -199,6 +202,7 @@ MAIN_FILES = \
$(DIRECTORY)/aclocal.m4 \
$(DIRECTORY)/bin/config.guess \
$(DIRECTORY)/bin/config.sub \
$(DIRECTORY)/bin/extract_git_sha1 \
$(DIRECTORY)/bin/install-sh \
$(DIRECTORY)/bin/mklib \
$(DIRECTORY)/bin/minstall \

10
bin/extract_git_sha1 Executable file
View File

@@ -0,0 +1,10 @@
#!/bin/sh
touch src/mesa/main/git_sha1.h
if which git > /dev/null; then
# Extract the 7-digit "short" SHA1 for the current HEAD, convert
# it to a string, and wrap it in a #define. This is used in
# src/mesa/main/version.c to put the GIT SHA1 in the GL_VERSION string.
git log -n 1 --oneline |\
sed 's/^\([^ ]*\) .*/#define MESA_GIT_SHA1 "git-\1"/' \
> src/mesa/main/git_sha1.h
fi

View File

@@ -63,7 +63,7 @@ GALLIUM_WINSYS_DIRS = sw sw/xlib drm/vmware drm/intel drm/i965
GALLIUM_TARGET_DIRS =
GALLIUM_STATE_TRACKERS_DIRS = egl
DRI_DIRS = i810 i915 i965 mach64 mga r128 r200 r300 radeon \
DRI_DIRS = i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon \
savage sis tdfx unichrome swrast
INTEL_LIBS = `pkg-config --libs libdrm_intel`

View File

@@ -729,6 +729,27 @@ else
enable_xcb=no
fi
dnl Direct rendering or just indirect rendering
case "$host_os" in
gnu*)
dnl Disable by default on GNU/Hurd
driglx_direct_default="no"
;;
cygwin*)
dnl Disable by default on cygwin
driglx_direct_default="no"
;;
*)
driglx_direct_default="yes"
;;
esac
AC_ARG_ENABLE([driglx-direct],
[AS_HELP_STRING([--disable-driglx-direct],
[enable direct rendering in GLX and EGL for DRI \
@<:@default=auto@:>@])],
[driglx_direct="$enableval"],
[driglx_direct="$driglx_direct_default"])
dnl
dnl libGL configuration per driver
dnl
@@ -762,12 +783,17 @@ dri|no) # these checks are still desired when there is no mesa_driver
AC_MSG_ERROR([Can't use static libraries for DRI drivers])
fi
# Check for libdrm
PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED])
PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED])
PKG_CHECK_MODULES([GLPROTO], [glproto >= $GLPROTO_REQUIRED])
GL_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED dri2proto >= $DRI2PROTO_REQUIRED glproto >= $GLPROTO_REQUIRED"
DRI_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED"
GL_PC_REQ_PRIV="glproto >= $GLPROTO_REQUIRED"
DRI_PC_REQ_PRIV=""
if test x"$driglx_direct" = xyes; then
# Check for libdrm
PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED])
PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED])
GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV libdrm >= $LIBDRM_REQUIRED dri2proto >= $DRI2PROTO_REQUIRED"
DRI_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED"
fi
# find the DRI deps for libGL
if test "$x11_pkgconfig" = yes; then
@@ -910,12 +936,6 @@ AC_ARG_WITH([dri-searchpath],
[DRI_DRIVER_SEARCH_DIR="$withval"],
[DRI_DRIVER_SEARCH_DIR='${DRI_DRIVER_INSTALL_DIR}'])
AC_SUBST([DRI_DRIVER_SEARCH_DIR])
dnl Direct rendering or just indirect rendering
AC_ARG_ENABLE([driglx-direct],
[AS_HELP_STRING([--disable-driglx-direct],
[enable direct rendering in GLX and EGL for DRI @<:@default=enabled@:>@])],
[driglx_direct="$enableval"],
[driglx_direct="yes"])
dnl Which drivers to build - default is chosen by platform
AC_ARG_WITH([dri-drivers],
[AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@],
@@ -1006,6 +1026,16 @@ if test "$mesa_driver" = dri -o "$mesa_driver" = no; then
DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
fi
;;
cygwin*)
DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
if test "x$driglx_direct" = xyes; then
DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
fi
if test "x$DRI_DIRS" = "xyes"; then
DRI_DIRS="swrast"
fi
;;
esac
# default drivers

View File

@@ -0,0 +1,4 @@
Known issues in the ARB_color_buffer_float implementation:
- Rendering to multiple render targets, some fixed-point, some floating-point, with FIXED_ONLY fragment clamping and polygon smooth enabled may write incorrect values to the fixed point buffers (depends on spec interpretation)
- For fragment programs with ARB_fog_* options, colors are clamped before fog application regardless of the fragment clamping setting (this depends on spec interpretation)

View File

@@ -15,7 +15,7 @@ GL 3.0:
GLSL changes (GL_EXT_gpu_shader4, etc) not started
Conditional rendering (GL_NV_conditional_render) DONE (swrast & softpipe)
Map buffer subranges (GL_ARB_map_buffer_range) DONE
Clamping controls (GL_ARB_color_buffer_float) BRANCH ~mareko/mesa floating2
Clamping controls (GL_ARB_color_buffer_float) DONE
Float textures, renderbuffers (GL_ARB_texture_float) BRANCH ~mareko/mesa floating2
GL_EXT_packed_float not started
GL_EXT_texture_shared_exponent not started
@@ -53,7 +53,7 @@ Primitive restart (GL_NV_primitive_restart) DONE (gallium)
Texture buffer objs (GL_ARB_texture_buffer_object) not started
Rectangular textures (GL_ARB_texture_rectangle) DONE
Uniform buffer objs (GL_ARB_uniform_buffer_object) not started
Signed normalized textures (GL_EXT_texture_snorm) ~50% done
Signed normalized textures (GL_EXT_texture_snorm) DONE (gallium)
GL 3.2:
@@ -77,7 +77,7 @@ GLSL 3.30 not started
GL_ARB_blend_func_extended not started
GL_ARB_explicit_attrib_location DONE (swrast, i915, i965)
GL_ARB_occlusion_query2 DONE (swrast, gallium)
GL_ARB_sampler_objects not started
GL_ARB_sampler_objects DONE (gallium)
GL_ARB_texture_rgb10_a2ui not started
GL_ARB_texture_swizzle DONE (same as EXT version)
GL_ARB_timer_query DONE (only Xlib sw driver)

View File

@@ -67,7 +67,7 @@ Additions to Chapter 3 the GLX 1.4 Specification (Functions and Errors)
On "PC" computers, AGP memory can be allocated with glXAllocateMemoryNV
and freed with glXFreeMemoryNV. Sometimes it's useful to know where a
block of AGP memory is located with respect to the start of the AGP
aperature. The function
aperture. The function
GLuint glXGetAGPOffsetMESA( const GLvoid *pointer )

View File

@@ -24,7 +24,7 @@ Number
Dependencies
Reguires EGL 1.4 or later. This extension is written against the
Requires EGL 1.4 or later. This extension is written against the
wording of the EGL 1.4 specification.
EGL_KHR_base_image is required.
@@ -134,7 +134,7 @@ Issues
RESOLVED: The eglQueryImage function has been proposed often,
but it goes against the EGLImage design. EGLImages are opaque
handles to a 2D array of pixels, which can be passed between
client APIs. By referenceing an EGLImage in a client API, the
client APIs. By referencing an EGLImage in a client API, the
EGLImage target (a texture, a renderbuffer or such) can be
used to query the attributes of the EGLImage. We don't have a
full client API for creating and querying DRM buffers, though,

View File

@@ -48,7 +48,7 @@ IP Status
Issues
1. Should we also defined UNPACK_INVERT_MESA for glDrawPixels, etc?
1. Should we also define UNPACK_INVERT_MESA for glDrawPixels, etc?
Resolved: No, we're only concerned with pixel packing. There are other
solutions for inverting images when using glDrawPixels (negative Y pixel

View File

@@ -31,12 +31,12 @@ Overview
Mesa's implementation of GLX is entirely implemented on the client side.
Therefore, Mesa cannot immediately detect when an X window or pixmap is
destroyed in order to free any ancilliary data associated with the window
destroyed in order to free any ancillary data associated with the window
or pixmap.
The glxMesaReleaseBuffers() function can be used to explicitly indicate
when the back color buffer, depth buffer, stencil buffer, and/or accum-
ulation buffer associated with a drawable can be freed.
when the back color buffer, depth buffer, stencil buffer, and/or accumu-
lation buffer associated with a drawable can be freed.
IP Status
@@ -60,7 +60,7 @@ Additions to Chapter 3 of the GLX 1.3 Specification (Functions and Errors)
Bool glXReleaseBuffersMESA( Display *dpy, GLXDrawable d );
causes all software ancilliary buffers (back buffer, depth, stencil,
causes all software ancillary buffers (back buffer, depth, stencil,
accum, etc) associated with the named drawable to be immediately
deallocated. True is returned if <d> is a valid Mesa GLX drawable,
else False is returned. After calling glXReleaseBuffersMESA, the

View File

@@ -35,7 +35,7 @@ Overview
Mesa's glViewport command queries the current window size and updates
its internal data structors accordingly. This normally works fine
since most applications call glViewport in responce to window size
since most applications call glViewport in response to window size
changes.
In some situations, however, the application may not call glViewport
@@ -65,7 +65,7 @@ Additions to the AGL/GLX/WGL Specifications
Errors
INVALID_OPERATION is generated if ResizeBuffersMESA is called betweeen
INVALID_OPERATION is generated if glResizeBuffersMESA is called between
Begin and End.
New State

View File

@@ -88,8 +88,8 @@ Additions to the GLX 1.3 Specification
this is typically the time required to display both the even and odd
fields of a frame of video data.
If <interval> is set to a value of 0, buffer swaps are not synchron-
ized to a video frame. The <interval> value is silently clamped to
If <interval> is set to a value of 0, buffer swaps are not synchro-
nized to a video frame. The <interval> value is silently clamped to
the maximum implementation-dependent value supported before being
stored.

View File

@@ -328,7 +328,7 @@ Additions to Chapter 3 of the OpenGL 2.0 Specification (Rasterization)
-- Section 3.8.10 "Texture Completeness"
Change the second paragaph (page 177) to say (spec changes identical
Change the second paragraph (page 177) to say (spec changes identical
to EXT_texture_array):
"For one-, two-, or three-dimensional textures and one- or
@@ -443,10 +443,10 @@ Additions to Chapter 3 of the OpenGL 2.0 Specification (Rasterization)
Change second through fourth paragraphs (page 188) to say:
"Let D_t be the depth texture value, in the range [0, 1]. For
texture lookups from one- and two-dimesional, rectangle, and
texture lookups from one- and two-dimensional, rectangle, and
one-dimensional array targets, let R be the interpolated <r>
texture coordinate, clamped to the range [0, 1]. For texture lookups
from two-dimesional array texture targets, let R be the interpolated
from two-dimensional array texture targets, let R be the interpolated
<q> texture coordinate, clamped to the range [0, 1]. Then the
effective texture value L_t, I_t, or A_t is computed as follows:
@@ -604,7 +604,7 @@ Additions to Chapter 5 of the OpenGL 2.0 Specification (Special Functions)
-- Section 5.4 "Display Lists"
Change the first paragraphi on page 242 to say (spec changes
Change the first paragraph on page 242 to say (spec changes
identical to EXT_texture_array):
"TexImage3D, TexImage2D, TexImage1D, Histogram, and ColorTable are

View File

@@ -44,7 +44,7 @@ Overview
ARB_texture_compression_rgtc introduces some compressed red and
red_green signed formats but no uncompressed ones, which might
still be useful. NV_texture_shader adds signed texture formats,
but also a lot of functionality which has been superceded by fragment
but also a lot of functionality which has been superseded by fragment
shaders.
It is usually possible to get the same functionality
using a unsigned format by doing scale and bias in a shader, but this
@@ -105,7 +105,7 @@ Issues
This is also different to what NV_texture_shader used.
The above mapping should be considered the reference, but there
is some leeway so other mappings are allowed for implementations which
cannot do this. Particulary the mapping given in NV_texture_shader or
cannot do this. Particularly the mapping given in NV_texture_shader or
the standard OpenGL byte/float mapping is considered acceptable too, as
might be a mapping which represents -1.0 by -128, 0.0 by 0 and 1.0 by
127 (that is, uses different scale factors for negative and positive

View File

@@ -88,7 +88,7 @@ Additions to Chapter 2 of the OpenGL 1.2 Specification (OpenGL Operation)
WindosPos4MESA takes four values indicating x, y, z, and w.
WindowPos3MESA (or WindowPos2MESA) is analaguos, but sets only
x, y, and z with w implicitly set to 1 (or only x and y with z
implicititly set to 0 and w implicitly set to 1).
implicitly set to 0 and w implicitly set to 1).
WindowPosMESA operates like RasterPos except that the current modelview
matrix, projection matrix and viewport parameters are ignored and the
@@ -108,7 +108,7 @@ GLX Protocol
Errors
INVALID_OPERATION is generated if WindowPosMESA is called betweeen
INVALID_OPERATION is generated if WindowPosMESA is called between
Begin and End.
New State

View File

@@ -26,7 +26,7 @@ Number
Dependencies
OpenGL 1.0 or later is required
This extensions is written against the OpenGL 1.4 Specification.
This extension is written against the OpenGL 1.4 Specification.
NV_texture_rectangle effects the definition of this extension.
Overview
@@ -104,7 +104,7 @@ Additions to Chapter 3 of the OpenGL 1.4 Specification (Rasterization)
In section 3.6.4, Rasterization of Pixel Rectangles, on page 104,
add the following to Table 3.12 (Packed pixel fiedl assignments):
add the following to Table 3.12 (Packed pixel field assignments):
First Second Third Fourth
Format Element Element Element Element

View File

@@ -25,7 +25,7 @@ Number
Dependencies
Reguires EGL 1.4 or later. This extension is written against the
Requires EGL 1.4 or later. This extension is written against the
wording of the EGL 1.4 specification.
EGL_KHR_base_image is required.
@@ -40,9 +40,9 @@ Overview
provides a new target for eglCreateImageKHR, to create an EGLImage
from a wl_buffer
Adding a implementation specific wayland interface, allows the
Adding an implementation specific wayland interface, allows the
EGL implementation to define specific wayland requests and events,
needed for buffer sharing in a EGL wayland platform.
needed for buffer sharing in an EGL wayland platform.
IP Status

View File

@@ -62,6 +62,7 @@ a:visited {
<LI><A HREF="perf.html" target="MainFrame">Performance Tips</A>
<LI><A HREF="extensions.html" target="MainFrame">Mesa Extensions</A>
<LI><A HREF="mangling.html" target="MainFrame">Function Name Mangling</A>
<LI><A href="llvmpipe.html" target="MainFrame">Gallium llvmpipe driver</A>
</ul>
<b>Developer Topics</b>

View File

@@ -21,76 +21,52 @@ When a new release is coming, release candidates (betas) may be found
<p>
Mesa is distributed in several parts:
The Mesa package is named MesaLib-x.y.z.{tar.bz2, tar.gz, zip} where x.y.z
is the version. There are three types of compressed archives.
</p>
<ul>
<li><b>MesaLib-x.y.z</b> - the main Mesa library source code, drivers
and documentation.
</li>
<li><b>MesaDemos-x.y.z</b> - OpenGL demonstration and test programs.
Most of the programs require GLUT (either the
<a href="http://www.opengl.org/resources/libraries/glut"
target="_parent">original GLUT by Mark Kilgard</a> or
<a href="http://freeglut.sourceforge.net" target="_parent">freeglut</a> or
<a href="http://openglut.sourceforge.net" target="_parent">OpenGLUT</a>).
</li>
<li><b>MesaGLUT-x.y.z</b> - Mark Kilgard's GLUT, easily compiled and used
with Mesa. Plus, other implementation of GLUT for DOS, OS/2, BeOS, etc.
</li>
</ul>
<p>
If you're not interested in running the demos, you'll only need the first
package.
There's also the MesaGLUT-x.y.z.{tar.bz2, tar.gz, zip} packages which
contain Mark Kilgard's GLUT library.
This is optional.
Most Linux distributions include an implementation of GLUT (such as freeglut).
</p>
<p>
In the past, the Mesa demos collection was distributed as
MesaDemos-x.y.z.{tar.bz2, tar.gz, zip}.
Now, the
<a href="ftp://ftp.freedesktop.org/pub/mesa/demos/" target="_parent">
Mesa demos</a> are distributed separately.
</p>
<p>
If you're new to this and not sure what you're doing, grab all three packages.
</p>
<p>
The packages are available in .tar.gz, .tar.bz2 and .zip formats.
Other sites might offer additional package formats.
</p>
<H1>Unpacking</H1>
<p>
All the packages should be in the same directory prior to unpacking.
To unpack .tar.gz files:
</p>
<ul>
<li>To unpack .tar.gz files:
<pre>
tar zxf MesaLib-X.Y.tar.gz
tar zxf MesaDemos-X.Y.tar.gz
tar zxf MesaGLUT-X.Y.tar.gz
tar zxf MesaLib-x.y.z.tar.gz
</pre>
or
<pre>
gzcat MesaLib-X.Y.tar.gz | tar xf -
gzcat MesaDemos-X.Y.tar.gz | tar xf -
gzcat MesaGLUT-X.Y.tar.gz | tar xf -
gzcat MesaLib-x.y.z.tar.gz | tar xf -
</pre>
or
<pre>
gunzip MesaLib-X.Y.tar.gz ; tar xf MesaLib-X.Y.tar
gunzip MesaDemos-X.Y.tar.gz ; tar xf MesaDemos-X.Y.tar
gunzip MesaGLUT-X.Y.tar.gz ; tar xf MesaGLUT-X.Y.tar
gunzip MesaLib-x.y.z.tar.gz ; tar xf MesaLib-x.y.z.tar
</pre>
<li>To unpack .tar.bz2 files:
<p>
To unpack .tar.bz2 files:
</p>
<pre>
bunzip2 -c MesaLib-X.Y.tar.gz | tar xf -
bunzip2 -c MesaDemos-X.Y.tar.gz | tar xf -
bunzip2 -c MesaGLUT-X.Y.tar.gz | tar xf -
bunzip2 -c MesaLib-x.y.z.tar.gz | tar xf -
</pre>
<li>To unpack .zip files:
<p>
To unpack .zip files:
</p>
<pre>
unzip MesaLib-X.Y.zip
unzip MesaDemos-X.Y.zip
unzip MesaGLUT-X.Y.zip
unzip MesaLib-x.y.z.zip
</pre>
</ul>
<h1>Contents</h1>
@@ -106,22 +82,13 @@ bin/ - shell scripts for making shared libraries, etc
docs/ - documentation
src/ - source code for libraries
src/mesa - sources for the main Mesa library and device drivers
src/gallium - sources for Gallium and Gallium drivers
src/glu - libGLU source code
src/glx - sources for building libGL with full GLX and DRI support
src/glw - Xt/Motif/OpenGL widget code
</pre>
If you downloaded and unpacked the MesaDemos.X.Y package:
<pre>
progs/demos - original Mesa demos
progs/xdemos - GLX OpenGL/Mesa demos
progs/redbook - examples from the OpenGL Programming Guide
progs/samples - examples from SGI
progs/images/ - image files
</pre>
If you downloaded and unpacked the MesaGLUT.X.Y package:
If you downloaded and unpacked the MesaGLUT.x.y.z package:
<pre>
src/glut - GLUT library source code
</pre>

View File

@@ -49,6 +49,15 @@ Setting this variable automatically sets the MESA_TEX_PROG variable as well.
<li>MESA_EXTENSION_OVERRIDE - can be used to enable/disable extensions.
A value such as "GL_EXT_foo -GL_EXT_bar" will enable the GL_EXT_foo extension
and disable the GL_EXT_bar extension.
<li>MESA_EXTENSION_MAX_YEAR - The GL_EXTENSIONS string returned by Mesa is sorted
by extension year.
If this variable is set to year X, only extensions defined on or before year
X will be reported.
This is to work-around a bug in some games where the extension string is
copied into a fixed-size buffer without truncating.
If the extension string is too long, the buffer overrun can cause the game
to crash.
This is a work-around for that.
<li>MESA_GLSL - <a href="shading.html#envvars">shading language compiler options</a>
</ul>

View File

@@ -12,16 +12,16 @@
<ol>
<li><a href="#unix-x11">Unix / X11</a>
<ul>
<li><a href="#prereq">Prerequisites for DRI and hardware acceleration</a>
<li><a href="#prereq-general">General prerequisites for building</a>
<li><a href="#prereq-dri">Prerequisites for DRI and hardware acceleration</a>
<li><a href="#autoconf">Building with autoconf</a>
<li><a href="#traditional">Building with traditional Makefiles</a>
<li><a href="#libs">The Libraries</a>
<li><a href="#demos">Running the demos
<li><a href="#install">Installing the header and library files
<li><a href="#pkg-config">Building OpenGL programs with pkg-config
</ul>
<li><a href="#windows">Windows</a>
<li><a href="#scons">SCons</a>
<li><a href="#scons">Building with SCons</a>
<li><a href="#other">Other</a>
</ol>
<br>
@@ -31,8 +31,22 @@
<H2>1. Unix/X11 Compilation and Installation</H1>
<a name="prereq">
<h3>1.1 Prerequisites for DRI and hardware acceleration</h3>
<a name="prereq-general">
<h3>1.1 General prerequisites for building</h3>
<ul>
<li>lex / yacc - for building the GLSL compiler.
On Linux systems, flex and bison are used.
Versions 2.5.35 and 2.4.1, respectively, (or later) should work.
</li>
<li>python - Python is needed for building the Gallium components.
Version 2.6.4 or later should work.
</li>
</ul>
<a name="prereq-dri">
<h3>1.2 Prerequisites for DRI and hardware acceleration</h3>
<p>
The following are required for DRI-based hardware acceleration with Mesa:
@@ -49,7 +63,7 @@ version 2.4.15 or later
<a name="autoconf">
<h3>1.2 Building with Autoconf</h3>
<h3>1.3 Building with Autoconf</h3>
<p>
Mesa may be <a href="autoconf.html">built using autoconf</a>.
@@ -59,7 +73,7 @@ If that fails the traditional Mesa build system is available.
<a name="traditional">
<h3>1.3 Building with traditional Makefiles</h3>
<h3>1.4 Building with traditional Makefiles</h3>
<p>
The traditional Mesa build system is based on a collection of pre-defined
@@ -126,7 +140,7 @@ Later, if you want to rebuild for a different configuration run
<a name="libs">
<h3>1.4 The libraries</h3>
<h3>1.5 The libraries</h3>
<p>
When compilation has finished, look in the top-level <code>lib/</code>
@@ -185,81 +199,11 @@ If you built the DRI hardware drivers, you'll also see the DRI drivers:
-rwxr-xr-x 1 brian users 10997120 Jul 21 12:13 unichrome_dri.so
</pre>
<a name="demos">
<h3>1.5 Running the demos</h3>
<p>
If you downloaded/unpacked the MesaDemos-x.y.z.tar.gz archive or
obtained Mesa from CVS, the <b>progs/</b> directory will contain a
bunch of demonstration programs.
If you built with Gallium support, look in lib/gallium/ for Gallium-based
versions of libGL and device drivers.
</p>
<p>
Before running a demo, you'll probably have to set two environment variables
to indicate where the libraries are located. For example:
<p>
<blockquote>
<b>cd lib/</b>
<br>
<b>export LD_LIBRARY_PATH=${PWD}</b>
<br>
<b>export LIBGL_DRIVERS_PATH=${PWD}</b> (if using DRI drivers)
</blockquote>
<p>
Next, change to the Mesa/demos/ directory:
</p>
<blockquote>
<b>cd ../progs/demos</b>
</blockquote>
<p>
Run a demo such as gears:
</p>
<blockquote>
<b>./gears</b>
</blockquote>
<p>
If this doesn't work, try the <b>Mesa/progs/xdemos/glxinfo</b> program
and see that it prints the expected Mesa version number.
</p>
<p>
If you're using Linux or a similar OS, verify that the demo program is
being linked with the proper library files:
</p>
<blockquote>
<b>ldd gears</b>
</blockquote>
<p>
You should see something like this:
</p>
<pre>
libglut.so.3 => /home/brian/Mesa/lib/libglut.so.3 (0x40013000)
libGLU.so.1 => /home/brian/Mesa/lib/libGLU.so.1 (0x40051000)
libGL.so.1 => /home/brian/Mesa/lib/libGL.so.1 (0x400e0000)
libc.so.6 => /lib/i686/libc.so.6 (0x42000000)
libm.so.6 => /lib/i686/libm.so.6 (0x403da000)
libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0x403fc000)
libXmu.so.6 => /usr/X11R6/lib/libXmu.so.6 (0x404da000)
libXt.so.6 => /usr/X11R6/lib/libXt.so.6 (0x404f1000)
libXi.so.6 => /usr/X11R6/lib/libXi.so.6 (0x40543000)
libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x4054b000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x405fd000)
libXext.so.6 => /usr/X11R6/lib/libXext.so.6 (0x40605000)
libpthread.so.0 => /lib/i686/libpthread.so.0 (0x40613000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
libdl.so.2 => /lib/libdl.so.2 (0x40644000)
libSM.so.6 => /usr/X11R6/lib/libSM.so.6 (0x40647000)
libICE.so.6 => /usr/X11R6/lib/libICE.so.6 (0x40650000)
</pre>
<p>
Retrace your steps if this doesn't look right.
</p>
<a name="install">

View File

@@ -1,61 +1,116 @@
LLVMPIPE -- a fork of softpipe that employs LLVM for code generation.
<HTML>
<TITLE>llvmpipe</TITLE>
<link rel="stylesheet" type="text/css" href="mesa.css"></head>
<BODY>
<H1>Introduction</H1>
<p>
The Gallium llvmpipe driver is a software rasterizer that uses LLVM to
do runtime code generation.
Shaders, point/line/triangle rasterization and vertex processing are
implemented with LLVM IR which is translated to x86 or x86-64 machine
code.
Also, the driver is multithreaded to take advantage of multiple CPU cores
(up to 8 at this time).
It's the fastest software rasterizer for Mesa.
</p>
Requirements
============
<h1>Requirements</h1>
- A x86 or amd64 processor. 64bit mode is preferred.
<dl>
<dt>An x86 or amd64 processor. 64-bit mode is preferred.</dt>
<dd>
<p>
Support for sse2 is strongly encouraged. Support for ssse3, and sse4.1 will
yield the most efficient code. The less features the CPU has the more
likely is that you ran into underperforming, buggy, or incomplete code.
</p>
<p>
See /proc/cpuinfo to know what your CPU supports.
- LLVM. Version 2.8 recommended. 2.6 or later required.
</p>
</dd>
<dt>LLVM. Version 2.8 recommended. 2.6 or later required.</dt>
<dd>
<p>
<b>NOTE</b>: LLVM 2.8 and earlier will not work on systems that support the
Intel AVX extensions (e.g. Sandybridge). LLVM's code generator will
fail when trying to emit AVX instructions. This was fixed in LLVM 2.9.
</p>
<p>
For Linux, on a recent Debian based distribution do:
</p>
<pre>
aptitude install llvm-dev
</pre>
For a RPM-based distribution do:
</p>
<pre>
yum install llvm-devel
</pre>
<p>
For Windows download pre-built MSVC 9.0 or MinGW binaries from
http://people.freedesktop.org/~jrfonseca/llvm/ and set the LLVM environment
variable to the extracted path.
</p>
<p>
For MSVC there are two set of binaries: llvm-x.x-msvc32mt.7z and
llvm-x.x-msvc32mtd.7z .
</p>
<p>
You have to set the LLVM=/path/to/llvm-x.x-msvc32mtd env var when passing
debug=yes to scons, and LLVM=/path/to/llvm-x.x-msvc32mt when building with
debug=no. This is necessary as LLVM builds as static library so the chosen
MS CRT must match.
</p>
</dd>
- scons (optional)
<dt>scons (optional)</dt>
</dl>
Building
========
<h1>Building</h1>
To build everything on Linux invoke scons as:
<pre>
scons build=debug libgl-xlib
</pre>
Alternatively, you can build it with GNU make, if you prefer, by invoking it as
<pre>
make linux-llvm
</pre>
but the rest of these instructions assume that scons is used.
For windows is everything the except except the winsys:
<pre>
scons build=debug libgl-gdi
</pre>
Using
=====
<h1>Using</h1>
On Linux, building will create a drop-in alternative for libGL.so into
<pre>
build/foo/gallium/targets/libgl-xlib/libGL.so
</pre>
or
<pre>
lib/gallium/libGL.so
</pre>
To use it set the LD_LIBRARY_PATH environment variable accordingly.
@@ -68,19 +123,20 @@ replacing the native ICD driver, but it's quite an advanced usage, so if you
need to ask, don't even try it.
Profiling
=========
<h1>Profiling</h1>
To profile llvmpipe you should pass the options
<pre>
scons build=profile <same-as-before>
</pre>
This will ensure that frame pointers are used both in C and JIT functions, and
that no tail call optimizations are done by gcc.
To better profile JIT code you'll need to build LLVM with oprofile integration.
<pre>
./configure \
--prefix=$install_dir \
--enable-optimized \
@@ -92,43 +148,57 @@ To better profile JIT code you'll need to build LLVM with oprofile integration.
make -C "$build_dir" install
find "$install_dir/lib" -iname '*.a' -print0 | xargs -0 strip --strip-debug
</pre>
The you should define
<pre>
export LLVM=/path/to/llvm-2.6-profile
</pre>
and rebuild.
Unit testing
============
<h1>Unit testing</h1>
<p>
Building will also create several unit tests in
build/linux-???-debug/gallium/drivers/llvmpipe:
</p>
- lp_test_blend: blending
- lp_test_conv: SIMD vector conversion
- lp_test_format: pixel unpacking/packing
</ul>
<li> lp_test_blend: blending
<li> lp_test_conv: SIMD vector conversion
<li> lp_test_format: pixel unpacking/packing
</ul>
<p>
Some of this tests can output results and benchmarks to a tab-separated-file
for posterior analysis, e.g.:
</p>
<pre>
build/linux-x86_64-debug/gallium/drivers/llvmpipe/lp_test_blend -o blend.tsv
</pre>
Development Notes
=================
<h1>Development Notes</h1>
- When looking to this code by the first time start in lp_state_fs.c, and
<ul>
<li>
When looking to this code by the first time start in lp_state_fs.c, and
then skim through the lp_bld_* functions called in there, and the comments
at the top of the lp_bld_*.c functions.
- The driver-independent parts of the LLVM / Gallium code are found in
</li>
<li>
The driver-independent parts of the LLVM / Gallium code are found in
src/gallium/auxiliary/gallivm/. The filenames and function prefixes
need to be renamed from "lp_bld_" to something else though.
- We use LLVM-C bindings for now. They are not documented, but follow the C++
</li>
<li>
We use LLVM-C bindings for now. They are not documented, but follow the C++
interfaces very closely, and appear to be complete enough for code
generation. See
http://npcontemplation.blogspot.com/2008/06/secret-of-llvm-c-bindings.html
for a stand-alone example. See the llvm-c/Core.h file for reference.
</li>
</ul>

View File

@@ -11,6 +11,13 @@
<H1>News</H1>
<h2>April 6, 2011</h2>
<p>
<a href="relnotes-7.10.2.html">Mesa 7.10.2</a> is released. This is a bug
fix release release.
</p>
<h2>March 2, 2011</h2>
<p>

206
docs/relnotes-7.10.2.html Normal file
View File

@@ -0,0 +1,206 @@
<HTML>
<head>
<TITLE>Mesa Release Notes</TITLE>
<link rel="stylesheet" type="text/css" href="mesa.css">
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
</head>
<BODY>
<body bgcolor="#eeeeee">
<H1>Mesa 7.10.2 Release Notes / April 6, 2011</H1>
<p>
Mesa 7.10.2 is a bug fix release which fixes bugs found since the 7.10 release.
</p>
<p>
Mesa 7.10.2 implements the OpenGL 2.1 API, but the version reported by
glGetString(GL_VERSION) depends on the particular driver being used.
Some drivers don't support all the features required in OpenGL 2.1.
</p>
<p>
See the <a href="install.html">Compiling/Installing page</a> for prerequisites
for DRI hardware acceleration.
</p>
<h2>MD5 checksums</h2>
<pre>
2f9f444265534a2cfd9a99d1a8291089 MesaLib-7.10.2.tar.gz
f5de82852f1243f42cc004039e10b771 MesaLib-7.10.2.tar.bz2
47836e37bab6fcafe3ac90c9544ba0e9 MesaLib-7.10.2.zip
175120325828f313621cc5bc6c504803 MesaGLUT-7.10.2.tar.gz
8c71d273f5f8d6c5eda4ffc39e0fe03e MesaGLUT-7.10.2.tar.bz2
03036c8efe7b791a90fa0f2c41b43f43 MesaGLUT-7.10.2.zip
</pre>
<h2>New features</h2>
<p>None.</p>
<h2>Bug fixes</h2>
<p>This list is likely incomplete.</p>
<ul>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=29172">Bug 29172</a> - Arrandale - Pill Popper Pops Pills</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31159">Bug 31159</a> - shadow problem in 0ad game</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=32688">Bug 32688</a> - [RADEON:KMS:R300G] some games have a wireframe or outline visible</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=32949">Bug 32949</a> - [glsl wine] Need for Speed renders incorrectly with GLSL enabled</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=34203">Bug 34203</a> - [GLSL] fail to call long chains across shaders</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=34376">Bug 34376</a> - [GLSL] allowing assignment to unsized array
<ul>
<li>The commit message incorrectly
lists <a href="https://bugs.freedesktop.org/show_bug.cgi?id=34367">bug
34367</a>.</li>
</ul>
</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=34370">Bug 34370</a> - [GLSL] "i&lt;5 &amp;&amp; i&lt;4" in for loop fails</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=34374">Bug 34374</a> - [GLSL] fail to redeclare an array using initializer</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=35073">Bug 35073</a> - [GM45] Alpha test is broken when rendering to FBO with no color attachment</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=35483">Bug 35483</a> - util_blit_pixels_writemask: crash in line 322 of src/gallium/auxiliary/util/u_blit.c</li>
<!-- <li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=">Bug </a> - </li> -->
</ul>
<h2>Changes</h2>
<p>The full set of changes can be viewed by using the following GIT command:</p>
<pre>
git log mesa-7.10.1..mesa-7.10.2
</pre>
<p><em>Note:</em> Reverted commits and the reverts are not included in this list.</p>
<p>Alex Deucher (2):
<ul>
<li>r600c: add new ontario pci ids</li>
<li>r600g: add some additional ontario pci ids</li>
</ul></p>
<p>Benjamin Franzke (1):
<ul>
<li>st/dri: Fix surfaceless gl using contexts with previous bound surfaces</li>
</ul></p>
<p>Brian Paul (9):
<ul>
<li>docs: pull 7.9.2 release notes into 7.10 branch</li>
<li>docs: update news.html with 7.10.1 and 7.9.2 releases</li>
<li>docs: fill in 7.10.1 release data</li>
<li>docs: add, fix release notes links</li>
<li>docs: update info about Mesa packaging/contents</li>
<li>docs: update prerequisites, remove old demo info</li>
<li>mesa: Guard against null pointer deref in fbo validation</li>
<li>st/mesa: Apply LOD bias from correct texture unit</li>
<li>glsl: silence warning in printf() with a cast</li>
</ul></p>
<p>Chad Versace (1):
<ul>
<li>i965: Fix tex_swizzle when depth mode is GL_RED</li>
</ul></p>
<p>Dave Airlie (1):
<ul>
<li>r600: don't close fd on failed load</li>
</ul></p>
<p>Eric Anholt (2):
<ul>
<li>i965: Apply a workaround for the Ironlake "vertex flashing".</li>
<li>i965: Fix alpha testing when there is no color buffer in the FBO.</li>
</ul></p>
<p>Fabian Bieler (1):
<ul>
<li>st/mesa: Apply LOD from texture object</li>
</ul></p>
<p>Henri Verbeet (1):
<ul>
<li>st/mesa: Validate state before doing blits.</li>
</ul></p>
<p>Ian Romanick (13):
<ul>
<li>docs: Add 7.10.1 md5sums</li>
<li>glsl: Refactor AST-to-HIR code handling variable initializers</li>
<li>glsl: Refactor AST-to-HIR code handling variable redeclarations</li>
<li>glsl: Process redeclarations before initializers</li>
<li>glsl: Function signatures cannot have NULL return type</li>
<li>glsl: Add several function / call related validations</li>
<li>linker: Add imported functions to the linked IR</li>
<li>glsl: Use insert_before for lists instead of open coding it</li>
<li>glsl: Only allow unsized array assignment in an initializer</li>
<li>glcpp: Refresh autogenerated lexer files</li>
<li>docs: Initial bits of 7.10.2 release notes</li>
<li>mesa: set version string to 7.10.2</li>
<li>mesa: Remove nonexistant files from _FILES lists</li>
</ul></p>
<p>Jerome Glisse (1):
<ul>
<li>r600g: move user fence into base radeon structure</li>
</ul></p>
<p>José Fonseca (2):
<ul>
<li>mesa: Fix typo glGet*v(GL_TEXTURE_COORD_ARRAY_*).</li>
<li>mesa: More glGet* fixes.</li>
</ul></p>
<p>Kenneth Graunke (4):
<ul>
<li>glcpp: Rework lexer to use a SKIP state rather than REJECT.</li>
<li>glcpp: Remove trailing contexts from #if rules.</li>
<li>i965/fs: Fix linear gl_Color interpolation on pre-gen6 hardware.</li>
<li>glsl: Accept precision qualifiers on sampler types, but only in ES.</li>
</ul></p>
<p>Marek Olšák (15):
<ul>
<li>st/mesa: fix crash when DrawBuffer-&gt;_ColorDrawBuffers[0] is NULL</li>
<li>st/mesa: fail to alloc a renderbuffer if st_choose_renderbuffer_format fails</li>
<li>r300/compiler: fix the saturate modifier when applied to TEX instructions</li>
<li>r300/compiler: fix translating the src negate bits in pair_translate</li>
<li>r300/compiler: Abs doesn't cancel Negate (in the conversion to native swizzles)</li>
<li>r300/compiler: TEX instructions don't support negation on source arguments</li>
<li>r300/compiler: do not set TEX_IGNORE_UNCOVERED on r500</li>
<li>r300/compiler: saturate Z before the shadow comparison</li>
<li>r300/compiler: fix equal and notequal shadow compare functions</li>
<li>r300/compiler: remove unused variables</li>
<li>st/mesa: fix crash when using both user and vbo buffers with the same stride</li>
<li>r300g: fix alpha-test with no colorbuffer</li>
<li>r300g: tell the GLSL compiler to lower the continue opcode</li>
<li>r300/compiler: propagate SaturateMode down to the result of shadow comparison</li>
<li>r300/compiler: apply the texture swizzle to shadow pass and fail values too</li>
</ul></p>
<p>Michel Dänzer (1):
<ul>
<li>Use proper source row stride when getting depth/stencil texels.</li>
</ul></p>
<p>Tom Stellard (4):
<ul>
<li>r300/compiler: Use a 4-bit writemask in pair instructions</li>
<li>prog_optimize: Fix reallocating registers for shaders with loops</li>
<li>r300/compiler: Fix vertex shader MAD instructions with constant swizzles</li>
<li>r300/compiler: Don't try to convert RGB to Alpha in full instructions</li>
</ul></p>
</body>
</html>

View File

@@ -41,6 +41,7 @@ tbd
<li>GL_ARB_texture_compression_rgtc (gallium r600, swrast)
<li>GL_ARB_draw_buffers_blend (gallium)
<li>GL_EXT_texture_sRGB_decode (gallium drivers, swrast, i965)
<li>GL_ARB_sampler_objects (gallium drivers)
</ul>

View File

@@ -14,6 +14,7 @@ The release notes summarize what's new or changed in each Mesa release.
<UL>
<LI><A HREF="relnotes-7.11.html">7.11 release notes</A>
<LI><A HREF="relnotes-7.10.2.html">7.10.2 release notes</A>
<LI><A HREF="relnotes-7.10.1.html">7.10.1 release notes</A>
<LI><A HREF="relnotes-7.10.html">7.10 release notes</A>
<LI><A HREF="relnotes-7.9.2.html">7.9.2 release notes</A>

View File

@@ -390,20 +390,6 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSREGIONNOK) (EGLDisplay dpy, EG
#define EGL_Y_INVERTED_NOK 0x307F
#endif /* EGL_NOK_texture_from_pixmap */
#ifndef EGL_ANDROID_image_native_buffer
#define EGL_ANDROID_image_native_buffer 1
struct android_native_buffer_t;
#define EGL_NATIVE_BUFFER_ANDROID 0x3140 /* eglCreateImageKHR target */
#endif
#ifndef EGL_ANDROID_swap_rectangle
#define EGL_ANDROID_swap_rectangle 1
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLBoolean EGLAPIENTRY eglSetSwapRectangleANDROID (EGLDisplay dpy, EGLSurface draw, EGLint left, EGLint top, EGLint width, EGLint height);
#endif /* EGL_EGLEXT_PROTOTYPES */
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSETSWAPRECTANGLEANDROIDPROC) (EGLDisplay dpy, EGLSurface draw, EGLint left, EGLint top, EGLint width, EGLint height);
#endif
#ifdef __cplusplus
}

View File

@@ -84,15 +84,6 @@ typedef struct wl_egl_display *EGLNativeDisplayType;
typedef struct wl_egl_pixmap *EGLNativePixmapType;
typedef struct wl_egl_window *EGLNativeWindowType;
#elif defined(ANDROID) /* Android */
struct android_native_window_t;
struct egl_native_pixmap_t;
typedef struct android_native_window_t* EGLNativeWindowType;
typedef struct egl_native_pixmap_t* EGLNativePixmapType;
typedef void* EGLNativeDisplayType;
#elif defined(__unix__) || defined(__unix)
#ifdef MESA_EGL_NO_X11_HEADERS

View File

@@ -655,6 +655,8 @@ typedef double GLclampd; /* double precision float in [0,1] */
#define GL_TEXTURE_ENV_COLOR 0x2201
#define GL_TEXTURE_GEN_S 0x0C60
#define GL_TEXTURE_GEN_T 0x0C61
#define GL_TEXTURE_GEN_R 0x0C62
#define GL_TEXTURE_GEN_Q 0x0C63
#define GL_TEXTURE_GEN_MODE 0x2500
#define GL_TEXTURE_BORDER_COLOR 0x1004
#define GL_TEXTURE_WIDTH 0x1000
@@ -685,8 +687,6 @@ typedef double GLclampd; /* double precision float in [0,1] */
#define GL_T 0x2001
#define GL_R 0x2002
#define GL_Q 0x2003
#define GL_TEXTURE_GEN_R 0x0C62
#define GL_TEXTURE_GEN_Q 0x0C63
/* Utility */
#define GL_VENDOR 0x1F00

View File

@@ -813,7 +813,6 @@ struct __DRIdri2ExtensionRec {
#define __DRI_IMAGE_FORMAT_RGB565 0x1001
#define __DRI_IMAGE_FORMAT_XRGB8888 0x1002
#define __DRI_IMAGE_FORMAT_ARGB8888 0x1003
#define __DRI_IMAGE_FORMAT_RGBA8888_REV 0x1004
#define __DRI_IMAGE_USE_SHARE 0x0001
#define __DRI_IMAGE_USE_SCANOUT 0x0002

View File

@@ -1,72 +0,0 @@
"""gallium
Frontend-tool for Gallium3D architecture.
"""
#
# Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
# All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sub license, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice (including the
# next paragraph) shall be included in all copies or substantial portions
# of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
# IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
# ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
import sys
import distutils.sysconfig
import os.path
def generate(env):
# See http://www.scons.org/wiki/PythonExtensions
if sys.platform in ['win32']:
python_root = sys.prefix
python_version = '%u%u' % sys.version_info[:2]
python_include = os.path.join(python_root, 'include')
python_libs = os.path.join(python_root, 'libs')
python_lib = os.path.join(python_libs, 'python' + python_version + '.lib')
env.Append(CPPPATH = [python_include])
env.Append(LIBPATH = [python_libs])
env.Append(LIBS = ['python' + python_version + '.lib'])
env.Replace(SHLIBPREFIX = '')
env.Replace(SHLIBSUFFIX = '.pyd')
# XXX; python25_d.lib is not included in Python for windows, and
# we'll get missing symbols unless we undefine _DEBUG
cppdefines = env['CPPDEFINES']
cppdefines = [define for define in cppdefines if define != '_DEBUG']
env.Replace(CPPDEFINES = cppdefines)
env.AppendUnique(CPPFLAGS = ['/U_DEBUG'])
env.AppendUnique(LINKFLAGS = ['/nodefaultlib:python25_d.lib'])
else:
#env.ParseConfig('python-config --cflags --ldflags --libs')
env.AppendUnique(CPPPATH = [distutils.sysconfig.get_python_inc()])
env.Replace(SHLIBPREFIX = '')
env.Replace(SHLIBSUFFIX = distutils.sysconfig.get_config_vars()['SO'])
# for debugging
#print env.Dump()
def exists(env):
return 1

View File

@@ -1,115 +0,0 @@
# Either one of, or both of, MESA_BUILD_CLASSIC and MESA_BUILD_GALLIUM must be
# set. When MESA_BUILD_GALLIUM is not set, EGL consists of
#
# libmesa_classic_egl
# libmesa_egl
#
# and the rules for it can be found in egl/drivers/android/Android.mk.
#
# When MESA_BUILD_GALLIUM is set, EGL consists of
#
# libmesa_st_egl
# libmesa_egl
# libmesa_st_mesa
# libmesa_pipe_<DRIVER>
# libmesa_winsys_<DRIVER>
# libmesa_gallium
# <plus libmesa_classic_egl if MESA_BUILD_CLASSIC is also set>
#
# and the rules for it can be found in gallium/targets/Android.mk
#
# When MESA_BUILD_CLASSIC is set, DRI drivers are created. A DRI driver
# consists of
#
# libmesa_classic_mesa
# libmesa_glsl
# <driver-specific objects>
#
# and the rules for it can be found in mesa/drivers/Android.mk.
#
# As for gralloc, the goal is to provide a single module that is able to
# detect and support the hardware. This is not the case yet though.
LOCAL_PATH := $(call my-dir)
# DRI drivers
MESA_BUILD_CLASSIC := false
MESA_BUILD_I915C := false
MESA_BUILD_I965C := false
# Gallium drivers
MESA_BUILD_GALLIUM := false
MESA_BUILD_I915G := false
MESA_BUILD_R600G := false
MESA_BUILD_SWRAST := false
# gralloc modules
MESA_BUILD_INTEL := false
MESA_BUILD_RADEON := false
MESA_BUILD_VMWGFX := false
MESA_DO_BUILD := false
ifeq ($(strip $(BOARD_USES_I915C)),true)
MESA_BUILD_CLASSIC := true
MESA_BUILD_I915C := true
# gralloc
MESA_BUILD_INTEL := true
MESA_DO_BUILD := true
endif
ifeq ($(strip $(BOARD_USES_I915G)),true)
MESA_BUILD_GALLIUM := true
MESA_BUILD_I915G := true
# gralloc
MESA_BUILD_INTEL := true
MESA_DO_BUILD := true
endif
ifeq ($(strip $(BOARD_USES_I965C)),true)
MESA_BUILD_CLASSIC := true
MESA_BUILD_I965C := true
# gralloc
MESA_BUILD_INTEL := true
MESA_DO_BUILD := true
endif
ifeq ($(strip $(BOARD_USES_R600G)),true)
MESA_BUILD_GALLIUM := true
MESA_BUILD_R600G := true
# gralloc
MESA_BUILD_RADEON := true
MESA_DO_BUILD := true
endif
ifeq ($(strip $(BOARD_USES_VMWGFX)),true)
MESA_BUILD_GALLIUM := true
MESA_BUILD_SWRAST := true
# gralloc
MESA_BUILD_VMWGFX := true
MESA_DO_BUILD := true
endif
ifeq ($(strip $(MESA_DO_BUILD)),true)
# build the real modules
include $(call all-subdir-makefiles)
include $(CLEAR_VARS)
symlink := $(TARGET_OUT_SHARED_LIBRARIES)/hw/gralloc.$(TARGET_PRODUCT)$(TARGET_SHLIB_SUFFIX)
symlink_to := gralloc.mesa$(TARGET_SHLIB_SUFFIX)
$(symlink): PRIVATE_TO := $(symlink_to)
$(symlink): $(TARGET_OUT_SHARED_LIBRARIES)/hw/$(symlink_to)
@echo "Symlink: $@ -> $(PRIVATE_TO)"
@mkdir -p $(dir $@)
@rm -rf $@
$(hide) ln -sf $(PRIVATE_TO) $@
ALL_PREBUILT += $(symlink)
endif # MESA_DO_BUILD

View File

@@ -1,111 +0,0 @@
# Android.mk for EGL
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
# from main/Makefile
SOURCES = \
eglapi.c \
eglarray.c \
eglconfig.c \
eglcontext.c \
eglcurrent.c \
egldisplay.c \
egldriver.c \
eglfallbacks.c \
eglglobals.c \
eglimage.c \
egllog.c \
eglmisc.c \
eglmode.c \
eglscreen.c \
eglstring.c \
eglsurface.c \
eglsync.c
LOCAL_SRC_FILES := \
$(addprefix main/, $(SOURCES))
LOCAL_CFLAGS := \
-DPTHREADS \
-D_EGL_NATIVE_PLATFORM=_EGL_PLATFORM_ANDROID \
-D_EGL_DRIVER_SEARCH_DIR=\"/system/lib/egl\" \
-D_EGL_OS_UNIX=1 \
-fvisibility=hidden \
-Wno-sign-compare
ifeq ($(strip $(MESA_BUILD_CLASSIC)),true)
LOCAL_CFLAGS += -D_EGL_BUILT_IN_DRIVER_ANDROID
endif
ifeq ($(strip $(MESA_BUILD_GALLIUM)),true)
LOCAL_CFLAGS += -D_EGL_BUILT_IN_DRIVER_GALLIUM
endif
LOCAL_C_INCLUDES := \
external/mesa/include
LOCAL_MODULE := libmesa_egl
include $(BUILD_STATIC_LIBRARY)
ifeq ($(strip $(MESA_BUILD_CLASSIC)),true)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := \
drivers/android/egl_android.c \
drivers/android/droid.c \
drivers/android/droid_core.c \
drivers/android/droid_image.c
LOCAL_CFLAGS := \
-D_EGL_MAIN=_eglBuiltInDriverANDROID \
-DDEFAULT_DRIVER_DIR=\"/system/lib/dri\" \
-DPTHREADS \
-fvisibility=hidden \
-Wno-sign-compare
LOCAL_C_INCLUDES := \
external/mesa/include \
external/mesa/src/mapi \
external/mesa/src/egl/main \
external/mesa/src/gralloc \
external/drm \
external/drm/include/drm \
external/mesa/src/mesa/drivers \
external/mesa/src/gallium/include \
external/mesa/src/gallium/winsys
LOCAL_MODULE := libmesa_classic_egl
include $(BUILD_STATIC_LIBRARY)
# build libGLES if gallium is not enabled
ifneq ($(strip $(MESA_BUILD_GALLIUM)),true)
include $(CLEAR_VARS)
LOCAL_SRC_FILES :=
LOCAL_CFLAGS :=
LOCAL_C_INCLUDES :=
LOCAL_STATIC_LIBRARIES :=
LOCAL_WHOLE_STATIC_LIBRARIES := \
libmesa_classic_egl \
libmesa_egl
LOCAL_SHARED_LIBRARIES := \
libglapi \
libdrm \
libdl \
libhardware \
liblog \
libcutils
LOCAL_MODULE := libGLES_mesa
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/egl
include $(BUILD_SHARED_LIBRARY)
endif # MESA_BUILD_GALLIUM
endif # MESA_BUILD_CLASSIC

View File

@@ -1,762 +0,0 @@
/*
* Copyright © 2010 Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* Authors:
* Kristian Høgsberg <krh@bitplanet.net>
*/
#define LOG_TAG "MESA-EGL"
#include <stdlib.h>
#include <string.h>
#include <dlfcn.h>
#include <cutils/log.h>
#include "droid.h"
static const __DRIuseInvalidateExtension use_invalidate = {
{ __DRI_USE_INVALIDATE, 1 }
};
static __DRIimage *
droid_lookup_egl_image(__DRIscreen *screen, void *image, void *data)
{
_EGLDisplay *disp = data;
struct droid_egl_image *dimg;
_EGLImage *img;
(void) screen;
img = _eglLookupImage(image, disp);
if (img == NULL) {
_eglError(EGL_BAD_PARAMETER, "droid_lookup_egl_image");
return NULL;
}
dimg = droid_egl_image(image);
return dimg->dri_image;
}
static const __DRIimageLookupExtension image_lookup_extension = {
{ __DRI_IMAGE_LOOKUP, 1 },
droid_lookup_egl_image
};
static int
get_format_bpp(int native)
{
int bpp;
/* see libpixelflinger/format.cpp */
switch (native) {
case GGL_PIXEL_FORMAT_RGBA_8888:
case GGL_PIXEL_FORMAT_RGBX_8888:
case GGL_PIXEL_FORMAT_BGRA_8888:
bpp = 4;
break;
case GGL_PIXEL_FORMAT_RGB_888:
bpp = 3;
break;
case GGL_PIXEL_FORMAT_RGB_565:
case GGL_PIXEL_FORMAT_RGBA_5551:
case GGL_PIXEL_FORMAT_RGBA_4444:
case GGL_PIXEL_FORMAT_LA_88:
bpp = 2;
break;
case GGL_PIXEL_FORMAT_RGB_332:
case GGL_PIXEL_FORMAT_A_8:
case GGL_PIXEL_FORMAT_L_8:
bpp = 1;
break;
default:
bpp = 0;
break;
}
return bpp;
}
#include <gralloc_gem.h>
int
get_native_buffer_name(struct android_native_buffer_t *buf)
{
struct drm_bo_t *bo;
bo = drm_gem_get(buf->handle);
return (bo) ? bo->name : 0;
}
EGLBoolean
droid_dequeue_buffer(struct droid_egl_surface *dsurf)
{
__DRIbuffer *buf = &dsurf->dri_buffer;
if (dsurf->window->dequeueBuffer(dsurf->window, &dsurf->buffer))
return EGL_FALSE;
dsurf->buffer->common.incRef(&dsurf->buffer->common);
dsurf->window->lockBuffer(dsurf->window, dsurf->buffer);
buf->attachment = __DRI_BUFFER_FAKE_FRONT_LEFT;
buf->name = get_native_buffer_name(dsurf->buffer);
buf->cpp = get_format_bpp(dsurf->buffer->format);
buf->pitch = dsurf->buffer->stride * buf->cpp;
buf->flags = 0;
return EGL_TRUE;
}
EGLBoolean
droid_enqueue_buffer(struct droid_egl_surface *dsurf)
{
dsurf->window->queueBuffer(dsurf->window, dsurf->buffer);
dsurf->buffer->common.decRef(&dsurf->buffer->common);
dsurf->buffer = NULL;
return EGL_TRUE;
}
static void
droid_flush_front_buffer(__DRIdrawable * driDrawable, void *loaderPrivate)
{
}
static __DRIbuffer *
droid_get_buffers_with_format(__DRIdrawable * driDrawable,
int *width, int *height,
unsigned int *attachments, int count,
int *out_count, void *loaderPrivate)
{
struct droid_egl_surface *dsurf = loaderPrivate;
struct droid_egl_display *ddpy =
droid_egl_display(dsurf->base.Resource.Display);
if (!dsurf->buffer) {
if (!droid_dequeue_buffer(dsurf))
return NULL;
}
dsurf->base.Width = dsurf->buffer->width;
dsurf->base.Height = dsurf->buffer->height;
if (width)
*width = dsurf->buffer->width;
if (height)
*height = dsurf->buffer->height;
*out_count = 1;
return &dsurf->dri_buffer;
}
static const EGLint droid_to_egl_attribute_map[] = {
0,
EGL_BUFFER_SIZE, /* __DRI_ATTRIB_BUFFER_SIZE */
EGL_LEVEL, /* __DRI_ATTRIB_LEVEL */
EGL_RED_SIZE, /* __DRI_ATTRIB_RED_SIZE */
EGL_GREEN_SIZE, /* __DRI_ATTRIB_GREEN_SIZE */
EGL_BLUE_SIZE, /* __DRI_ATTRIB_BLUE_SIZE */
EGL_LUMINANCE_SIZE, /* __DRI_ATTRIB_LUMINANCE_SIZE */
EGL_ALPHA_SIZE, /* __DRI_ATTRIB_ALPHA_SIZE */
0, /* __DRI_ATTRIB_ALPHA_MASK_SIZE */
EGL_DEPTH_SIZE, /* __DRI_ATTRIB_DEPTH_SIZE */
EGL_STENCIL_SIZE, /* __DRI_ATTRIB_STENCIL_SIZE */
0, /* __DRI_ATTRIB_ACCUM_RED_SIZE */
0, /* __DRI_ATTRIB_ACCUM_GREEN_SIZE */
0, /* __DRI_ATTRIB_ACCUM_BLUE_SIZE */
0, /* __DRI_ATTRIB_ACCUM_ALPHA_SIZE */
EGL_SAMPLE_BUFFERS, /* __DRI_ATTRIB_SAMPLE_BUFFERS */
EGL_SAMPLES, /* __DRI_ATTRIB_SAMPLES */
0, /* __DRI_ATTRIB_RENDER_TYPE, */
0, /* __DRI_ATTRIB_CONFIG_CAVEAT */
0, /* __DRI_ATTRIB_CONFORMANT */
0, /* __DRI_ATTRIB_DOUBLE_BUFFER */
0, /* __DRI_ATTRIB_STEREO */
0, /* __DRI_ATTRIB_AUX_BUFFERS */
0, /* __DRI_ATTRIB_TRANSPARENT_TYPE */
0, /* __DRI_ATTRIB_TRANSPARENT_INDEX_VALUE */
0, /* __DRI_ATTRIB_TRANSPARENT_RED_VALUE */
0, /* __DRI_ATTRIB_TRANSPARENT_GREEN_VALUE */
0, /* __DRI_ATTRIB_TRANSPARENT_BLUE_VALUE */
0, /* __DRI_ATTRIB_TRANSPARENT_ALPHA_VALUE */
0, /* __DRI_ATTRIB_FLOAT_MODE */
0, /* __DRI_ATTRIB_RED_MASK */
0, /* __DRI_ATTRIB_GREEN_MASK */
0, /* __DRI_ATTRIB_BLUE_MASK */
0, /* __DRI_ATTRIB_ALPHA_MASK */
EGL_MAX_PBUFFER_WIDTH, /* __DRI_ATTRIB_MAX_PBUFFER_WIDTH */
EGL_MAX_PBUFFER_HEIGHT, /* __DRI_ATTRIB_MAX_PBUFFER_HEIGHT */
EGL_MAX_PBUFFER_PIXELS, /* __DRI_ATTRIB_MAX_PBUFFER_PIXELS */
0, /* __DRI_ATTRIB_OPTIMAL_PBUFFER_WIDTH */
0, /* __DRI_ATTRIB_OPTIMAL_PBUFFER_HEIGHT */
0, /* __DRI_ATTRIB_VISUAL_SELECT_GROUP */
0, /* __DRI_ATTRIB_SWAP_METHOD */
EGL_MAX_SWAP_INTERVAL, /* __DRI_ATTRIB_MAX_SWAP_INTERVAL */
EGL_MIN_SWAP_INTERVAL, /* __DRI_ATTRIB_MIN_SWAP_INTERVAL */
0, /* __DRI_ATTRIB_BIND_TO_TEXTURE_RGB */
0, /* __DRI_ATTRIB_BIND_TO_TEXTURE_RGBA */
0, /* __DRI_ATTRIB_BIND_TO_MIPMAP_TEXTURE */
0, /* __DRI_ATTRIB_BIND_TO_TEXTURE_TARGETS */
EGL_Y_INVERTED_NOK, /* __DRI_ATTRIB_YINVERTED */
0, /* __DRI_ATTRIB_FRAMEBUFFER_SRGB_CAPABLE */
};
static struct droid_egl_config *
droid_add_config(_EGLDisplay *dpy, const __DRIconfig *dri_config, int id,
int depth, EGLint surface_type, int rgba_masks[4])
{
struct droid_egl_config *conf;
struct droid_egl_display *ddpy;
_EGLConfig base;
unsigned int attrib, value, double_buffer;
EGLint key;
int dri_masks[4] = { 0, 0, 0, 0 };
int i;
ddpy = dpy->DriverData;
_eglInitConfig(&base, dpy, id);
i = 0;
double_buffer = 0;
while (ddpy->core->indexConfigAttrib(dri_config, i++, &attrib, &value)) {
switch (attrib) {
case __DRI_ATTRIB_RENDER_TYPE:
if (value & __DRI_ATTRIB_RGBA_BIT)
value = EGL_RGB_BUFFER;
else if (value & __DRI_ATTRIB_LUMINANCE_BIT)
value = EGL_LUMINANCE_BUFFER;
else
assert(0);
_eglSetConfigKey(&base, EGL_COLOR_BUFFER_TYPE, value);
break;
case __DRI_ATTRIB_CONFIG_CAVEAT:
if (value & __DRI_ATTRIB_NON_CONFORMANT_CONFIG)
value = EGL_NON_CONFORMANT_CONFIG;
else if (value & __DRI_ATTRIB_SLOW_BIT)
value = EGL_SLOW_CONFIG;
else
value = EGL_NONE;
_eglSetConfigKey(&base, EGL_CONFIG_CAVEAT, value);
break;
case __DRI_ATTRIB_DOUBLE_BUFFER:
double_buffer = value;
break;
case __DRI_ATTRIB_RED_MASK:
dri_masks[0] = value;
break;
case __DRI_ATTRIB_GREEN_MASK:
dri_masks[1] = value;
break;
case __DRI_ATTRIB_BLUE_MASK:
dri_masks[2] = value;
break;
case __DRI_ATTRIB_ALPHA_MASK:
dri_masks[3] = value;
break;
default:
key = droid_to_egl_attribute_map[attrib];
if (key != 0)
_eglSetConfigKey(&base, key, value);
break;
}
}
/* In EGL, double buffer or not isn't a config attribute. Pixmaps
* surfaces are always single buffered, pbuffer surfaces are always
* back buffers and windows can be either, selected by passing an
* attribute at window surface construction time. To support this
* we ignore all double buffer configs and manipulate the buffer we
* return in the getBuffer callback to get the behaviour we want. */
if (double_buffer)
return NULL;
if (depth > 0 && depth != _eglGetConfigKey(&base, EGL_BUFFER_SIZE))
return NULL;
if (memcmp(dri_masks, rgba_masks, sizeof(rgba_masks)))
return NULL;
_eglSetConfigKey(&base, EGL_NATIVE_RENDERABLE, EGL_TRUE);
_eglSetConfigKey(&base, EGL_SURFACE_TYPE, surface_type);
_eglSetConfigKey(&base, EGL_RENDERABLE_TYPE, dpy->ClientAPIs);
_eglSetConfigKey(&base, EGL_CONFORMANT, dpy->ClientAPIs);
if (!_eglValidateConfig(&base, EGL_FALSE)) {
_eglLog(_EGL_DEBUG, "DRI2: failed to validate config %d", id);
return NULL;
}
conf = calloc(1, sizeof(*conf));
if (conf != NULL) {
memcpy(&conf->base, &base, sizeof(base));
conf->dri_config = dri_config;
_eglLinkConfig(&conf->base);
}
return conf;
}
static EGLBoolean
droid_add_configs_for_visuals(_EGLDriver *drv, _EGLDisplay *dpy)
{
struct droid_egl_display *ddpy = droid_egl_display(dpy);
const struct {
int format;
int size;
int rgba_masks[4];
} visuals[] = {
{ GGL_PIXEL_FORMAT_RGBA_8888, 32, { 0xff, 0xff00, 0xff0000, 0xff000000 } },
{ GGL_PIXEL_FORMAT_RGBX_8888, 32, { 0xff, 0xff00, 0xff0000, 0x0 } },
{ GGL_PIXEL_FORMAT_RGB_888, 24, { 0xff, 0xff00, 0xff0000, 0x0 } },
{ GGL_PIXEL_FORMAT_RGB_565, 16, { 0xf800, 0x7e0, 0x1f, 0x0 } },
{ GGL_PIXEL_FORMAT_BGRA_8888, 32, { 0xff0000, 0xff00, 0xff, 0xff000000 } },
{ GGL_PIXEL_FORMAT_A_8, 8, { 0xf800, 0x7e0, 0x1f, 0x0 } },
{ 0, 0, { 0, 0, 0, 0 } }
};
int count, i, j;
count = 0;
for (i = 0; visuals[i].format; i++) {
int format_count = 0;
for (j = 0; ddpy->dri_configs[j]; j++) {
struct droid_egl_config *dconf;
dconf = droid_add_config(dpy, ddpy->dri_configs[j], count + 1,
visuals[i].size, EGL_WINDOW_BIT, visuals[i].rgba_masks);
if (dconf) {
_eglSetConfigKey(&dconf->base,
EGL_NATIVE_VISUAL_TYPE, visuals[i].format);
count++;
format_count++;
}
}
if (!format_count) {
_eglLog(_EGL_DEBUG, "No DRI config supports native format 0x%x",
visuals[i].format);
}
}
return (count != 0);
}
struct droid_extension_match {
const char *name;
int version;
int offset;
};
static struct droid_extension_match droid_driver_extensions[] = {
{ __DRI_CORE, 1, offsetof(struct droid_egl_display, core) },
{ __DRI_DRI2, 1, offsetof(struct droid_egl_display, dri2) },
{ NULL, 0, 0 }
};
static struct droid_extension_match droid_core_extensions[] = {
{ __DRI2_FLUSH, 1, offsetof(struct droid_egl_display, flush) },
{ __DRI_IMAGE, 1, offsetof(struct droid_egl_display, image) },
{ NULL, 0, 0 }
};
extern const __DRIextension *__driDriverExtensions[];
static EGLBoolean
droid_bind_extensions(struct droid_egl_display *ddpy,
struct droid_extension_match *matches,
const __DRIextension **extensions)
{
int i, j, ret = EGL_TRUE;
void *field;
for (i = 0; extensions[i]; i++) {
_eglLog(_EGL_DEBUG, "DRI2: found extension `%s'", extensions[i]->name);
for (j = 0; matches[j].name; j++) {
if (strcmp(extensions[i]->name, matches[j].name) == 0 &&
extensions[i]->version >= matches[j].version) {
field = ((char *) ddpy + matches[j].offset);
*(const __DRIextension **) field = extensions[i];
_eglLog(_EGL_INFO, "DRI2: found extension %s version %d",
extensions[i]->name, extensions[i]->version);
}
}
}
for (j = 0; matches[j].name; j++) {
field = ((char *) ddpy + matches[j].offset);
if (*(const __DRIextension **) field == NULL) {
_eglLog(_EGL_FATAL, "DRI2: did not find extension %s version %d",
matches[j].name, matches[j].version);
ret = EGL_FALSE;
}
}
return ret;
}
static EGLBoolean
droid_create_screen(_EGLDisplay *dpy)
{
struct droid_egl_display *ddpy = droid_egl_display(dpy);
const __DRIextension **extensions;
unsigned int api_mask;
ddpy->dri_screen =
ddpy->dri2->createNewScreen(0, ddpy->fd, ddpy->extensions,
&ddpy->dri_configs, dpy);
if (ddpy->dri_screen == NULL) {
_eglLog(_EGL_WARNING, "failed to create dri screen");
return EGL_FALSE;
}
extensions = ddpy->core->getExtensions(ddpy->dri_screen);
if (!droid_bind_extensions(ddpy, droid_core_extensions, extensions)) {
ddpy->core->destroyScreen(ddpy->dri_screen);
return EGL_FALSE;
}
if (ddpy->dri2->base.version >= 2)
api_mask = ddpy->dri2->getAPIMask(ddpy->dri_screen);
else
api_mask = 1 << __DRI_API_OPENGL;
dpy->ClientAPIs = 0;
if (api_mask & (1 <<__DRI_API_OPENGL))
dpy->ClientAPIs |= EGL_OPENGL_BIT;
if (api_mask & (1 <<__DRI_API_GLES))
dpy->ClientAPIs |= EGL_OPENGL_ES_BIT;
if (api_mask & (1 << __DRI_API_GLES2))
dpy->ClientAPIs |= EGL_OPENGL_ES2_BIT;
if (ddpy->dri2->base.version >= 2) {
dpy->Extensions.KHR_surfaceless_gles1 = EGL_TRUE;
dpy->Extensions.KHR_surfaceless_gles2 = EGL_TRUE;
dpy->Extensions.KHR_surfaceless_opengl = EGL_TRUE;
}
return EGL_TRUE;
}
static EGLBoolean
droid_load_driver(_EGLDisplay *dpy, const char *driver_name)
{
struct droid_egl_display *ddpy = droid_egl_display(dpy);
const __DRIextension **extensions;
char path[PATH_MAX], *base = NULL;
void *handle;
if (geteuid() == getuid()) {
/* don't allow setuid apps to use LIBGL_DRIVERS_PATH */
base = getenv("LIBGL_DRIVERS_PATH");
}
if (!base)
base = DEFAULT_DRIVER_DIR;
snprintf(path, sizeof(path), "%s/%s_dri.so", base, driver_name);
handle = dlopen(path, RTLD_NOW | RTLD_GLOBAL);
if (!handle) {
_eglLog(_EGL_WARNING, "DRI2: failed to load %s: %s", path, dlerror());
return EGL_FALSE;
}
_eglLog(_EGL_DEBUG, "DRI2: dlopen(%s)", path);
extensions = dlsym(handle, __DRI_DRIVER_EXTENSIONS);
if (!extensions) {
_eglLog(_EGL_WARNING, "DRI2: driver exports no extensions");
dlclose(handle);
return EGL_FALSE;
}
if (!droid_bind_extensions(ddpy, droid_driver_extensions, extensions)) {
dlclose(handle);
return EGL_FALSE;
}
ddpy->dri_handle = handle;
return EGL_TRUE;
}
#include <xf86drm.h>
/* for i915 */
#include <i915_drm.h>
#include "dri/intel/intel_chipset.h"
/* for radeon */
#include <radeon_drm.h>
#include "radeon/drm/radeon_drm_public.h"
static const char *
droid_get_driver_name(int fd)
{
drmVersionPtr version;
char *name = NULL;
version = drmGetVersion(fd);
if (!version) {
_eglLog(_EGL_WARNING, "invalid drm fd");
return NULL;
}
if (!version->name) {
_eglLog(_EGL_WARNING, "unable to determine the driver name");
drmFreeVersion(version);
return NULL;
}
if (strcmp(version->name, "i915") == 0) {
struct drm_i915_getparam gp;
int id, ret;
memset(&gp, 0, sizeof(gp));
gp.param = I915_PARAM_CHIPSET_ID;
gp.value = &id;
ret = drmCommandWriteRead(fd, DRM_I915_GETPARAM, &gp, sizeof(gp));
if (ret) {
_eglLog(_EGL_WARNING, "failed to get param for i915");
}
else {
name = (IS_965(id)) ? "i965" : "i915";
}
}
else if (strcmp(version->name, "radeon") == 0) {
struct drm_radeon_info info;
int id, ret;
memset(&info, 0, sizeof(info));
info.request = RADEON_INFO_DEVICE_ID;
info.value = (long) &id;
ret = drmCommandWriteRead(fd, DRM_RADEON_INFO, &info, sizeof(info));
if (ret) {
_eglLog(_EGL_WARNING, "failed to get info for radeon");
}
else {
name = (is_r3xx(id)) ? "r300" : "r600";
}
}
drmFreeVersion(version);
return name;
}
static int
droid_open_device(void)
{
const hw_module_t *mod;
int fd = -1, err;
err = hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &mod);
if (!err) {
const gralloc_module_t *gr = (gralloc_module_t *) mod;
err = -EINVAL;
if (gr->perform)
err = gr->perform(gr, GRALLOC_MODULE_PERFORM_GET_DRM_FD, &fd);
}
if (err || fd < 0) {
_eglLog(_EGL_WARNING, "fail to get drm fd");
fd = -1;
}
return fd;
}
static EGLBoolean
droid_initialize_android(_EGLDriver *drv, _EGLDisplay *dpy)
{
struct droid_egl_display *ddpy;
const char *driver_name;
int fd;
fd = droid_open_device();
if (fd < 0)
return EGL_FALSE;
driver_name = droid_get_driver_name(fd);
if (!driver_name)
return EGL_FALSE;
ddpy = calloc(1, sizeof(*ddpy));
if (!ddpy)
return _eglError(EGL_BAD_ALLOC, "eglInitialize");
ddpy->fd = fd;
dpy->DriverData = (void *) ddpy;
if (!droid_load_driver(dpy, driver_name))
return EGL_FALSE;
ddpy->loader_extension.base.name = __DRI_DRI2_LOADER;
ddpy->loader_extension.base.version = 3;
ddpy->loader_extension.getBuffers = NULL;
ddpy->loader_extension.flushFrontBuffer = droid_flush_front_buffer;
ddpy->loader_extension.getBuffersWithFormat =
droid_get_buffers_with_format;
ddpy->extensions[0] = &ddpy->loader_extension.base;
ddpy->extensions[1] = &image_lookup_extension.base;
ddpy->extensions[2] = &use_invalidate.base;
ddpy->extensions[3] = NULL;
if (!droid_create_screen(dpy)) {
free(ddpy);
return EGL_FALSE;
}
if (!droid_add_configs_for_visuals(drv, dpy)) {
ddpy->core->destroyScreen(ddpy->dri_screen);
free(ddpy);
}
dpy->Extensions.ANDROID_image_native_buffer = EGL_TRUE;
dpy->Extensions.KHR_image_base = EGL_TRUE;
/* we're supporting EGL 1.4 */
dpy->VersionMajor = 1;
dpy->VersionMinor = 4;
return EGL_TRUE;
}
static EGLBoolean
droid_terminate(_EGLDriver *drv, _EGLDisplay *dpy)
{
struct droid_egl_display *ddpy = droid_egl_display(dpy);
_eglReleaseDisplayResources(drv, dpy);
_eglCleanupDisplay(dpy);
ddpy->core->destroyScreen(ddpy->dri_screen);
dlclose(ddpy->dri_handle);
free(ddpy);
dpy->DriverData = NULL;
return EGL_TRUE;
}
static EGLBoolean
droid_initialize(_EGLDriver *drv, _EGLDisplay *dpy)
{
/* not until swrast_dri is supported */
if (dpy->Options.UseFallback)
return EGL_FALSE;
switch (dpy->Platform) {
case _EGL_PLATFORM_ANDROID:
if (dpy->Options.TestOnly)
return EGL_TRUE;
return droid_initialize_android(drv, dpy);
default:
return EGL_FALSE;
}
}
static _EGLProc
droid_get_proc_address(_EGLDriver *drv, const char *procname)
{
struct droid_egl_driver *ddrv = droid_egl_driver(drv);
return ddrv->get_proc_address(procname);
}
static void
droid_log(EGLint level, const char *msg)
{
switch (level) {
case _EGL_DEBUG:
LOGD(msg);
break;
case _EGL_INFO:
LOGI(msg);
break;
case _EGL_WARNING:
LOGW(msg);
break;
case _EGL_FATAL:
LOG_FATAL(msg);
break;
default:
break;
}
}
static void
droid_unload(_EGLDriver *drv)
{
struct droid_egl_driver *ddrv = droid_egl_driver(drv);
free(ddrv);
}
#include "glapi/glapi.h" /* for _glapi_get_proc_address */
static EGLBoolean
droid_load(_EGLDriver *drv)
{
struct droid_egl_driver *ddrv = droid_egl_driver(drv);
ddrv->get_proc_address = (_EGLProc (*)(const char *)) _glapi_get_proc_address;
ddrv->glFlush = (void (*)(void))
ddrv->get_proc_address("glFlush");
ddrv->glFinish = (void (*)(void))
ddrv->get_proc_address("glFinish");
return EGL_TRUE;
}
_EGLDriver *
droid_create_driver(void)
{
struct droid_egl_driver *ddrv;
ddrv = calloc(1, sizeof(*ddrv));
if (!ddrv)
return NULL;
if (!droid_load(&ddrv->base))
return NULL;
_eglSetLogProc(droid_log);
ddrv->base.Name = "Droid";
ddrv->base.Unload = droid_unload;
_eglInitDriverFallbacks(&ddrv->base);
ddrv->base.API.Initialize = droid_initialize;
ddrv->base.API.Terminate = droid_terminate;
ddrv->base.API.GetProcAddress = droid_get_proc_address;
return &ddrv->base;
}

View File

@@ -1,129 +0,0 @@
/*
* Copyright © 2010 Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* Authors:
* Kristian Høgsberg <krh@bitplanet.net>
*/
#ifndef _DROID_H_
#define _DROID_H_
#include <errno.h>
#include <ui/egl/android_natives.h>
#include <ui/android_native_buffer.h>
#include <pixelflinger/format.h>
#include <GL/gl.h>
#include <GL/internal/dri_interface.h>
#include "egldriver.h"
#include "egldisplay.h"
#include "eglcontext.h"
#include "eglsurface.h"
#include "eglconfig.h"
#include "eglimage.h"
#include "eglcurrent.h"
#include "egllog.h"
struct droid_egl_driver
{
_EGLDriver base;
_EGLProc (*get_proc_address)(const char *procname);
void (*glFlush)(void);
void (*glFinish)(void);
};
struct droid_egl_display
{
int fd;
void *dri_handle;
__DRIscreen *dri_screen;
const __DRIconfig **dri_configs;
__DRIcoreExtension *core;
__DRIdri2Extension *dri2;
__DRI2flushExtension *flush;
__DRIimageExtension *image;
__DRIdri2LoaderExtension loader_extension;
const __DRIextension *extensions[8];
};
struct droid_egl_context
{
_EGLContext base;
__DRIcontext *dri_context;
};
struct droid_egl_surface
{
_EGLSurface base;
__DRIdrawable *dri_drawable;
__DRIbuffer dri_buffer;
android_native_window_t *window;
android_native_buffer_t *buffer;
};
struct droid_egl_config
{
_EGLConfig base;
const __DRIconfig *dri_config;
};
struct droid_egl_image
{
_EGLImage base;
__DRIimage *dri_image;
};
/* standard typecasts */
_EGL_DRIVER_STANDARD_TYPECASTS(droid_egl)
_EGL_DRIVER_TYPECAST(droid_egl_image, _EGLImage, obj)
_EGLDriver *
droid_create_driver(void);
void
droid_init_core_functions(_EGLDriver *drv);
void
droid_init_image_functions(_EGLDriver *drv);
EGLBoolean
droid_dequeue_buffer(struct droid_egl_surface *dsurf);
EGLBoolean
droid_enqueue_buffer(struct droid_egl_surface *dsurf);
int
get_native_buffer_name(struct android_native_buffer_t *buf);
#endif /* _DROID_H_ */

View File

@@ -1,347 +0,0 @@
/*
* Copyright © 2010 Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* Authors:
* Kristian Høgsberg <krh@bitplanet.net>
*/
#include "droid.h"
static _EGLContext *
droid_create_context(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf,
_EGLContext *share_list, const EGLint *attrib_list)
{
struct droid_egl_context *dctx;
struct droid_egl_display *ddpy = droid_egl_display(disp);
struct droid_egl_context *dctx_shared = droid_egl_context(share_list);
struct droid_egl_config *dconf = droid_egl_config(conf);
const __DRIconfig *dri_config;
int api;
(void) drv;
dctx = calloc(1, sizeof *dctx);
if (!dctx) {
_eglError(EGL_BAD_ALLOC, "eglCreateContext");
return NULL;
}
if (!_eglInitContext(&dctx->base, disp, conf, attrib_list))
goto cleanup;
switch (dctx->base.ClientAPI) {
case EGL_OPENGL_ES_API:
switch (dctx->base.ClientVersion) {
case 1:
api = __DRI_API_GLES;
break;
case 2:
api = __DRI_API_GLES2;
break;
default:
_eglError(EGL_BAD_PARAMETER, "eglCreateContext");
return NULL;
}
break;
case EGL_OPENGL_API:
api = __DRI_API_OPENGL;
break;
default:
_eglError(EGL_BAD_PARAMETER, "eglCreateContext");
return NULL;
}
if (conf != NULL)
dri_config = dconf->dri_config;
else
dri_config = NULL;
if (ddpy->dri2->base.version >= 2) {
dctx->dri_context =
ddpy->dri2->createNewContextForAPI(ddpy->dri_screen,
api,
dri_config,
dctx_shared ?
dctx_shared->dri_context : NULL,
dctx);
} else if (api == __DRI_API_OPENGL) {
dctx->dri_context =
ddpy->dri2->createNewContext(ddpy->dri_screen,
dconf->dri_config,
dctx_shared ?
dctx_shared->dri_context : NULL,
dctx);
} else {
/* fail */
}
if (!dctx->dri_context)
goto cleanup;
return &dctx->base;
cleanup:
free(dctx);
return NULL;
}
static EGLBoolean
droid_destroy_context(_EGLDriver *drv, _EGLDisplay *disp, _EGLContext *ctx)
{
struct droid_egl_display *ddpy = droid_egl_display(disp);
struct droid_egl_context *dctx = droid_egl_context(ctx);
(void) drv;
if (!_eglPutContext(ctx))
return EGL_TRUE;
(*ddpy->core->destroyContext)(dctx->dri_context);
free(dctx);
return EGL_TRUE;
}
static _EGLSurface *
droid_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
_EGLConfig *conf, EGLNativeWindowType window,
const EGLint *attrib_list)
{
struct droid_egl_display *ddpy = droid_egl_display(disp);
struct droid_egl_config *dconf = droid_egl_config(conf);
struct droid_egl_surface *dsurf;
int format, vis_type;
(void) drv;
if (!window || window->common.magic != ANDROID_NATIVE_WINDOW_MAGIC) {
_eglError(EGL_BAD_NATIVE_WINDOW, "droid_create_surface");
return NULL;
}
if (window->query(window, NATIVE_WINDOW_FORMAT, &format)) {
_eglError(EGL_BAD_NATIVE_WINDOW, "droid_create_surface");
return NULL;
}
vis_type = _eglGetConfigKey(&dconf->base, EGL_NATIVE_VISUAL_TYPE);
if (format != vis_type) {
_eglLog(_EGL_WARNING, "Native format mismatch: 0x%x != 0x%x",
format, vis_type);
}
dsurf = calloc(1, sizeof *dsurf);
if (!dsurf) {
_eglError(EGL_BAD_ALLOC, "droid_create_surface");
return NULL;
}
if (!_eglInitSurface(&dsurf->base, disp, type, conf, attrib_list))
goto cleanup_surf;
dsurf->dri_drawable =
(*ddpy->dri2->createNewDrawable) (ddpy->dri_screen,
dconf->dri_config, dsurf);
if (dsurf->dri_drawable == NULL) {
_eglError(EGL_BAD_ALLOC, "dri2->createNewDrawable");
goto cleanup_pixmap;
}
window->common.incRef(&window->common);
window->query(window, NATIVE_WINDOW_WIDTH, &dsurf->base.Width);
window->query(window, NATIVE_WINDOW_HEIGHT, &dsurf->base.Height);
dsurf->window = window;
return &dsurf->base;
cleanup_dri_drawable:
ddpy->core->destroyDrawable(dsurf->dri_drawable);
cleanup_pixmap:
cleanup_surf:
free(dsurf);
return NULL;
}
static _EGLSurface *
droid_create_window_surface(_EGLDriver *drv, _EGLDisplay *disp,
_EGLConfig *conf, EGLNativeWindowType window,
const EGLint *attrib_list)
{
return droid_create_surface(drv, disp, EGL_WINDOW_BIT, conf,
window, attrib_list);
}
static _EGLSurface *
droid_create_pixmap_surface(_EGLDriver *drv, _EGLDisplay *disp,
_EGLConfig *conf, EGLNativePixmapType pixmap,
const EGLint *attrib_list)
{
return NULL;
}
static _EGLSurface *
droid_create_pbuffer_surface(_EGLDriver *drv, _EGLDisplay *disp,
_EGLConfig *conf, const EGLint *attrib_list)
{
return NULL;
}
static EGLBoolean
droid_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf)
{
struct droid_egl_display *ddpy = droid_egl_display(disp);
struct droid_egl_surface *dsurf = droid_egl_surface(surf);
(void) drv;
if (!_eglPutSurface(surf))
return EGL_TRUE;
(*ddpy->core->destroyDrawable)(dsurf->dri_drawable);
if (dsurf->buffer)
droid_enqueue_buffer(dsurf);
dsurf->window->common.decRef(&dsurf->window->common);
free(surf);
return EGL_TRUE;
}
static EGLBoolean
droid_make_current(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *dsurf,
_EGLSurface *rsurf, _EGLContext *ctx)
{
struct droid_egl_driver *ddrv = droid_egl_driver(drv);
struct droid_egl_display *ddpy = droid_egl_display(disp);
struct droid_egl_surface *droid_dsurf = droid_egl_surface(dsurf);
struct droid_egl_surface *droid_rsurf = droid_egl_surface(rsurf);
struct droid_egl_context *dctx = droid_egl_context(ctx);
_EGLContext *old_ctx;
_EGLSurface *old_dsurf, *old_rsurf;
__DRIdrawable *ddraw, *rdraw;
__DRIcontext *cctx;
/* make new bindings */
if (!_eglBindContext(ctx, dsurf, rsurf, &old_ctx, &old_dsurf, &old_rsurf))
return EGL_FALSE;
/* flush before context switch */
if (old_ctx && ddrv->glFlush)
ddrv->glFlush();
ddraw = (droid_dsurf) ? droid_dsurf->dri_drawable : NULL;
rdraw = (droid_rsurf) ? droid_rsurf->dri_drawable : NULL;
cctx = (dctx) ? dctx->dri_context : NULL;
if ((cctx == NULL && ddraw == NULL && rdraw == NULL) ||
ddpy->core->bindContext(cctx, ddraw, rdraw)) {
droid_destroy_surface(drv, disp, old_dsurf);
droid_destroy_surface(drv, disp, old_rsurf);
if (old_ctx) {
/* unbind the old context only when there is no new context bound */
if (!ctx) {
__DRIcontext *old_cctx = droid_egl_context(old_ctx)->dri_context;
ddpy->core->unbindContext(old_cctx);
}
droid_destroy_context(drv, disp, old_ctx);
}
return EGL_TRUE;
} else {
/* undo the previous _eglBindContext */
_eglBindContext(old_ctx, old_dsurf, old_rsurf, &ctx, &dsurf, &rsurf);
assert(&dctx->base == ctx &&
&droid_dsurf->base == dsurf &&
&droid_rsurf->base == rsurf);
_eglPutSurface(dsurf);
_eglPutSurface(rsurf);
_eglPutContext(ctx);
_eglPutSurface(old_dsurf);
_eglPutSurface(old_rsurf);
_eglPutContext(old_ctx);
return EGL_FALSE;
}
}
static EGLBoolean
droid_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw)
{
struct droid_egl_driver *ddrv = droid_egl_driver(drv);
struct droid_egl_display *ddpy = droid_egl_display(disp);
struct droid_egl_surface *dsurf = droid_egl_surface(draw);
_EGLContext *ctx;
if (ddrv->glFlush) {
ctx = _eglGetCurrentContext();
if (ctx && ctx->DrawSurface == &dsurf->base)
ddrv->glFlush();
}
(*ddpy->flush->flush)(dsurf->dri_drawable);
if (dsurf->buffer)
droid_enqueue_buffer(dsurf);
(*ddpy->flush->invalidate)(dsurf->dri_drawable);
return EGL_TRUE;
}
static EGLBoolean
droid_wait_client(_EGLDriver *drv, _EGLDisplay *disp, _EGLContext *ctx)
{
struct droid_egl_driver *ddrv = droid_egl_driver(drv);
struct droid_egl_display *ddpy = droid_egl_display(disp);
struct droid_egl_surface *dsurf = droid_egl_surface(ctx->DrawSurface);
if (ddrv->glFinish)
ddrv->glFinish();
if (dsurf)
(*ddpy->flush->flush)(dsurf->dri_drawable);
return EGL_TRUE;
}
void
droid_init_core_functions(_EGLDriver *drv)
{
struct droid_egl_driver *ddrv = droid_egl_driver(drv);
ddrv->base.API.CreateContext = droid_create_context;
ddrv->base.API.DestroyContext = droid_destroy_context;
ddrv->base.API.CreateWindowSurface = droid_create_window_surface;
ddrv->base.API.CreatePixmapSurface = droid_create_pixmap_surface;
ddrv->base.API.CreatePbufferSurface = droid_create_pbuffer_surface;
ddrv->base.API.DestroySurface = droid_destroy_surface;
ddrv->base.API.MakeCurrent = droid_make_current;
ddrv->base.API.SwapBuffers = droid_swap_buffers;
ddrv->base.API.WaitClient = droid_wait_client;
}

View File

@@ -1,134 +0,0 @@
/*
* Copyright © 2010 Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* Authors:
* Kristian Høgsberg <krh@bitplanet.net>
*/
#include "droid.h"
static _EGLImage *
droid_create_image_android_native_buffer(_EGLDisplay *disp,
EGLClientBuffer buffer)
{
struct droid_egl_display *ddpy = droid_egl_display(disp);
struct android_native_buffer_t *buf =
(struct android_native_buffer_t *) buffer;
struct droid_egl_image *dimg;
EGLint format, name;
if (!buf || buf->common.magic != ANDROID_NATIVE_BUFFER_MAGIC ||
buf->common.version != sizeof(*buf)) {
_eglError(EGL_BAD_PARAMETER, "eglCreateEGLImageKHR");
return NULL;
}
name = get_native_buffer_name(buf);
if (!name) {
_eglError(EGL_BAD_PARAMETER, "eglCreateEGLImageKHR");
return NULL;
}
switch (buf->format) {
case HAL_PIXEL_FORMAT_BGRA_8888:
format = __DRI_IMAGE_FORMAT_ARGB8888;
break;
case HAL_PIXEL_FORMAT_RGB_565:
format = __DRI_IMAGE_FORMAT_RGB565;
break;
case HAL_PIXEL_FORMAT_RGBA_8888:
format = __DRI_IMAGE_FORMAT_RGBA8888_REV;
break;
case HAL_PIXEL_FORMAT_RGBX_8888:
case HAL_PIXEL_FORMAT_RGB_888:
case HAL_PIXEL_FORMAT_RGBA_5551:
case HAL_PIXEL_FORMAT_RGBA_4444:
/* unsupported */
default:
_eglLog(_EGL_WARNING, "unsupported native buffer format 0x%x", buf->format);
return NULL;
break;
}
dimg = calloc(1, sizeof(*dimg));
if (!dimg) {
_eglError(EGL_BAD_ALLOC, "droid_create_image_mesa_drm");
return NULL;
}
if (!_eglInitImage(&dimg->base, disp)) {
free(dimg);
return NULL;
}
dimg->dri_image =
ddpy->image->createImageFromName(ddpy->dri_screen,
buf->width,
buf->height,
format,
name,
buf->stride,
dimg);
if (!dimg->dri_image) {
free(dimg);
_eglError(EGL_BAD_ALLOC, "droid_create_image_mesa_drm");
return NULL;
}
return &dimg->base;
}
static _EGLImage *
droid_create_image_khr(_EGLDriver *drv, _EGLDisplay *disp,
_EGLContext *ctx, EGLenum target,
EGLClientBuffer buffer, const EGLint *attr_list)
{
switch (target) {
case EGL_NATIVE_BUFFER_ANDROID:
return droid_create_image_android_native_buffer(disp, buffer);
default:
_eglError(EGL_BAD_PARAMETER, "droid_create_image_khr");
return EGL_NO_IMAGE_KHR;
}
}
static EGLBoolean
droid_destroy_image_khr(_EGLDriver *drv, _EGLDisplay *disp, _EGLImage *image)
{
struct droid_egl_display *ddpy = droid_egl_display(disp);
struct droid_egl_image *dimg = droid_egl_image(image);
ddpy->image->destroyImage(dimg->dri_image);
free(dimg);
return EGL_TRUE;
}
void
droid_init_image_functions(_EGLDriver *drv)
{
struct droid_egl_driver *ddrv = droid_egl_driver(drv);
ddrv->base.API.CreateImageKHR = droid_create_image_khr;
ddrv->base.API.DestroyImageKHR = droid_destroy_image_khr;
}

View File

@@ -1,42 +0,0 @@
/*
* Copyright © 2010 Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* Authors:
* Kristian Høgsberg <krh@bitplanet.net>
*/
#include "droid.h"
_EGLDriver *
_EGL_MAIN(const char *args)
{
_EGLDriver *drv;
drv = droid_create_driver();
if (drv) {
droid_init_core_functions(drv);
droid_init_image_functions(drv);
}
return drv;
}

View File

@@ -462,6 +462,12 @@ dri2_create_screen(_EGLDisplay *disp)
}
}
if (dri2_dpy->image) {
disp->Extensions.MESA_drm_image = EGL_TRUE;
disp->Extensions.KHR_image_base = EGL_TRUE;
disp->Extensions.KHR_gl_renderbuffer_image = EGL_TRUE;
}
return EGL_TRUE;
cleanup_dri_screen:

View File

@@ -708,11 +708,6 @@ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp)
for (i = 0; dri2_dpy->driver_configs[i]; i++)
dri2_add_config(disp, dri2_dpy->driver_configs[i], i + 1, 0, 0, NULL);
disp->Extensions.MESA_drm_image = EGL_TRUE;
disp->Extensions.KHR_image_base = EGL_TRUE;
disp->Extensions.KHR_gl_renderbuffer_image = EGL_TRUE;
disp->Extensions.KHR_gl_texture_2D_image = EGL_TRUE;
#ifdef HAVE_WAYLAND_PLATFORM
disp->Extensions.WL_bind_wayland_display = EGL_TRUE;
#endif

View File

@@ -429,7 +429,7 @@ wayland_create_buffer(struct dri2_egl_surface *dri2_surf, __DRIbuffer *buffer)
}
static void
wayland_frame_callback(void *data, uint32_t time)
wayland_frame_callback(struct wl_surface *surface, void *data, uint32_t time)
{
struct dri2_egl_surface *dri2_surf = data;
@@ -459,7 +459,8 @@ dri2_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw)
dri2_surf->block_swap_buffers = EGL_TRUE;
wl_display_frame_callback(dri2_dpy->wl_dpy->display,
wayland_frame_callback, dri2_surf);
dri2_surf->wl_win->surface,
wayland_frame_callback, dri2_surf);
if (dri2_surf->type == DRI2_WINDOW_SURFACE) {
pointer_swap(
@@ -677,11 +678,7 @@ dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp)
EGL_WINDOW_BIT | EGL_PIXMAP_BIT, NULL);
disp->Extensions.MESA_drm_image = EGL_TRUE;
disp->Extensions.KHR_image_base = EGL_TRUE;
disp->Extensions.KHR_image_pixmap = EGL_TRUE;
disp->Extensions.KHR_gl_renderbuffer_image = EGL_TRUE;
disp->Extensions.KHR_gl_texture_2D_image = EGL_TRUE;
disp->Extensions.WL_bind_wayland_display = EGL_TRUE;
dri2_dpy->authenticate = dri2_wayland_authenticate;

View File

@@ -231,7 +231,7 @@ dri2_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
if (dri2_dpy->dri2) {
xcb_dri2_create_drawable (dri2_dpy->conn, dri2_surf->drawable);
} else {
swrastCreateDrawable(dri2_dpy, dri2_surf, _eglGetConfigKey(conf, EGL_DEPTH_SIZE));
swrastCreateDrawable(dri2_dpy, dri2_surf, _eglGetConfigKey(conf, EGL_BUFFER_SIZE));
}
if (type != EGL_PBUFFER_BIT) {
@@ -990,7 +990,7 @@ dri2_initialize_x11_dri2(_EGLDriver *drv, _EGLDisplay *disp)
if (!dri2_load_driver(disp))
goto cleanup_conn;
dri2_dpy->fd = open(dri2_dpy->device_name, O_RDWR);
dri2_dpy->fd = open(dri2_dpy->device_name, O_RDWR | O_CLOEXEC);
if (dri2_dpy->fd == -1) {
_eglLog(_EGL_WARNING,
"DRI2: could not open %s (%s)", dri2_dpy->device_name,
@@ -1030,11 +1030,7 @@ dri2_initialize_x11_dri2(_EGLDriver *drv, _EGLDisplay *disp)
goto cleanup_configs;
}
disp->Extensions.MESA_drm_image = EGL_TRUE;
disp->Extensions.KHR_image_base = EGL_TRUE;
disp->Extensions.KHR_image_pixmap = EGL_TRUE;
disp->Extensions.KHR_gl_renderbuffer_image = EGL_TRUE;
disp->Extensions.KHR_gl_texture_2D_image = EGL_TRUE;
disp->Extensions.NOK_swap_region = EGL_TRUE;
disp->Extensions.NOK_texture_from_pixmap = EGL_TRUE;

View File

@@ -917,9 +917,6 @@ eglGetProcAddress(const char *procname)
#ifdef EGL_WL_bind_display
{ "eglBindWaylandDisplayWL", (_EGLProc) eglBindWaylandDisplayWL },
{ "eglUnbindWaylandDisplayWL", (_EGLProc) eglUnbindWaylandDisplayWL },
#endif
#ifdef EGL_ANDROID_swap_rectangle
{ "eglSetSwapRectangleANDROID", (_EGLProc) eglSetSwapRectangleANDROID },
#endif
{ NULL, NULL }
};
@@ -1538,25 +1535,3 @@ eglUnbindWaylandDisplayWL(EGLDisplay dpy, struct wl_display *display)
RETURN_EGL_EVAL(disp, ret);
}
#endif
#ifdef EGL_ANDROID_swap_rectangle
EGLBoolean EGLAPIENTRY
eglSetSwapRectangleANDROID(EGLDisplay dpy, EGLSurface draw,
EGLint left, EGLint top,
EGLint width, EGLint height)
{
_EGLDisplay *disp = _eglLockDisplay(dpy);
_EGLSurface *surf = _eglLookupSurface(draw, disp);
_EGLDriver *drv;
EGLBoolean ret;
_EGL_CHECK_SURFACE(disp, surf, EGL_FALSE, drv);
if (!disp->Extensions.ANDROID_swap_rectangle)
RETURN_EGL_EVAL(disp, EGL_FALSE);
ret = drv->API.SetSwapRectangleANDROID(drv, disp, surf, left, top, width, height);
RETURN_EGL_EVAL(disp, ret);
}
#endif

View File

@@ -101,10 +101,6 @@ typedef EGLBoolean (*BindWaylandDisplayWL_t)(_EGLDriver *drv, _EGLDisplay *disp,
typedef EGLBoolean (*UnbindWaylandDisplayWL_t)(_EGLDriver *drv, _EGLDisplay *disp, struct wl_display *display);
#endif
#ifdef EGL_ANDROID_swap_rectangle
typedef EGLBoolean (*SetSwapRectangleANDROID_t)(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw, EGLint left, EGLint top, EGLint width, EGLint height);
#endif
/**
* The API dispatcher jumps through these functions
*/
@@ -184,10 +180,6 @@ struct _egl_api
BindWaylandDisplayWL_t BindWaylandDisplayWL;
UnbindWaylandDisplayWL_t UnbindWaylandDisplayWL;
#endif
#ifdef EGL_ANDROID_swap_rectangle
SetSwapRectangleANDROID_t SetSwapRectangleANDROID;
#endif
};
#endif /* EGLAPI_INCLUDED */

View File

@@ -29,8 +29,7 @@ _eglGetNativePlatformFromEnv(void)
{ _EGL_PLATFORM_X11, "x11" },
{ _EGL_PLATFORM_WAYLAND, "wayland" },
{ _EGL_PLATFORM_DRM, "drm" },
{ _EGL_PLATFORM_FBDEV, "fbdev" },
{ _EGL_PLATFORM_ANDROID, "android" }
{ _EGL_PLATFORM_FBDEV, "fbdev" }
};
_EGLPlatformType plat = _EGL_INVALID_PLATFORM;
const char *plat_name;

View File

@@ -14,7 +14,6 @@ enum _egl_platform_type {
_EGL_PLATFORM_WAYLAND,
_EGL_PLATFORM_DRM,
_EGL_PLATFORM_FBDEV,
_EGL_PLATFORM_ANDROID,
_EGL_NUM_PLATFORMS,
_EGL_INVALID_PLATFORM = -1
@@ -78,9 +77,6 @@ struct _egl_extensions
EGLBoolean NOK_swap_region;
EGLBoolean NOK_texture_from_pixmap;
EGLBoolean ANDROID_image_native_buffer;
EGLBoolean ANDROID_swap_rectangle;
};

View File

@@ -40,9 +40,6 @@ const struct {
#ifdef _EGL_BUILT_IN_DRIVER_GALLIUM
{ "egl_gallium", _eglBuiltInDriverGALLIUM },
#endif
#ifdef _EGL_BUILT_IN_DRIVER_ANDROID
{ "egl_android", _eglBuiltInDriverANDROID },
#endif
#ifdef _EGL_BUILT_IN_DRIVER_DRI2
{ "egl_dri2", _eglBuiltInDriverDRI2 },
#endif

View File

@@ -58,10 +58,6 @@ extern _EGLDriver *
_eglBuiltInDriverGALLIUM(const char *args);
extern _EGLDriver *
_eglBuiltInDriverANDROID(const char *args);
extern _EGLDriver *
_eglBuiltInDriverDRI2(const char *args);

View File

@@ -111,9 +111,6 @@ _eglUpdateExtensionsString(_EGLDisplay *dpy)
_EGL_CHECK_EXTENSION(NOK_swap_region);
_EGL_CHECK_EXTENSION(NOK_texture_from_pixmap);
_EGL_CHECK_EXTENSION(ANDROID_image_native_buffer);
_EGL_CHECK_EXTENSION(ANDROID_swap_rectangle);
#undef _EGL_CHECK_EXTENSION
}

View File

@@ -12,7 +12,8 @@ wayland_drm_OBJECTS = $(wayland_drm_SOURCES:.c=.o)
wayland_drm_INCLUDES = \
$(WAYLAND_CFLAGS) \
-I$(TOP)/src/egl/main
-I$(TOP)/src/egl/main \
-I$(TOP)/include
# Generate protocol sources
prefix=$(shell pkg-config --variable=prefix wayland-server)

View File

@@ -1,3 +0,0 @@
ifeq ($(strip $(MESA_BUILD_GALLIUM)),true)
include $(call all-subdir-makefiles)
endif

View File

@@ -53,7 +53,6 @@ if env['drm']:
# Needed by some state trackers
SConscript('winsys/sw/null/SConscript')
SConscript('state_trackers/python/SConscript')
if env['platform'] != 'embedded':
SConscript('state_trackers/vega/SConscript')
SConscript('state_trackers/egl/SConscript')

View File

@@ -1,217 +0,0 @@
LOCAL_PATH := $(call my-dir)
# from Makefile
C_SOURCES = \
cso_cache/cso_cache.c \
cso_cache/cso_context.c \
cso_cache/cso_hash.c \
draw/draw_context.c \
draw/draw_fs.c \
draw/draw_gs.c \
draw/draw_pipe.c \
draw/draw_pipe_aaline.c \
draw/draw_pipe_aapoint.c \
draw/draw_pipe_clip.c \
draw/draw_pipe_cull.c \
draw/draw_pipe_flatshade.c \
draw/draw_pipe_offset.c \
draw/draw_pipe_pstipple.c \
draw/draw_pipe_stipple.c \
draw/draw_pipe_twoside.c \
draw/draw_pipe_unfilled.c \
draw/draw_pipe_util.c \
draw/draw_pipe_validate.c \
draw/draw_pipe_vbuf.c \
draw/draw_pipe_wide_line.c \
draw/draw_pipe_wide_point.c \
draw/draw_pt.c \
draw/draw_pt_emit.c \
draw/draw_pt_fetch.c \
draw/draw_pt_fetch_emit.c \
draw/draw_pt_fetch_shade_emit.c \
draw/draw_pt_fetch_shade_pipeline.c \
draw/draw_pt_post_vs.c \
draw/draw_pt_so_emit.c \
draw/draw_pt_util.c \
draw/draw_pt_vsplit.c \
draw/draw_vertex.c \
draw/draw_vs.c \
draw/draw_vs_aos.c \
draw/draw_vs_aos_io.c \
draw/draw_vs_aos_machine.c \
draw/draw_vs_exec.c \
draw/draw_vs_ppc.c \
draw/draw_vs_sse.c \
draw/draw_vs_varient.c \
indices/u_indices_gen.c \
indices/u_unfilled_gen.c \
os/os_misc.c \
os/os_stream.c \
os/os_stream_log.c \
os/os_stream_null.c \
os/os_stream_stdc.c \
os/os_stream_str.c \
os/os_time.c \
pipebuffer/pb_buffer_fenced.c \
pipebuffer/pb_buffer_malloc.c \
pipebuffer/pb_bufmgr_alt.c \
pipebuffer/pb_bufmgr_cache.c \
pipebuffer/pb_bufmgr_debug.c \
pipebuffer/pb_bufmgr_mm.c \
pipebuffer/pb_bufmgr_ondemand.c \
pipebuffer/pb_bufmgr_pool.c \
pipebuffer/pb_bufmgr_slab.c \
pipebuffer/pb_validate.c \
rbug/rbug_connection.c \
rbug/rbug_context.c \
rbug/rbug_core.c \
rbug/rbug_demarshal.c \
rbug/rbug_texture.c \
rbug/rbug_shader.c \
rtasm/rtasm_cpu.c \
rtasm/rtasm_execmem.c \
rtasm/rtasm_ppc.c \
rtasm/rtasm_ppc_spe.c \
rtasm/rtasm_x86sse.c \
tgsi/tgsi_build.c \
tgsi/tgsi_dump.c \
tgsi/tgsi_exec.c \
tgsi/tgsi_info.c \
tgsi/tgsi_iterate.c \
tgsi/tgsi_parse.c \
tgsi/tgsi_ppc.c \
tgsi/tgsi_sanity.c \
tgsi/tgsi_scan.c \
tgsi/tgsi_sse2.c \
tgsi/tgsi_text.c \
tgsi/tgsi_transform.c \
tgsi/tgsi_ureg.c \
tgsi/tgsi_util.c \
translate/translate.c \
translate/translate_cache.c \
translate/translate_generic.c \
translate/translate_sse.c \
util/u_debug.c \
util/u_debug_describe.c \
util/u_debug_refcnt.c \
util/u_debug_stack.c \
util/u_debug_symbol.c \
util/u_dump_defines.c \
util/u_dump_state.c \
util/u_bitmask.c \
util/u_blit.c \
util/u_blitter.c \
util/u_cache.c \
util/u_caps.c \
util/u_cpu_detect.c \
util/u_dl.c \
util/u_draw_quad.c \
util/u_format.c \
util/u_format_other.c \
util/u_format_latc.c \
util/u_format_s3tc.c \
util/u_format_rgtc.c \
util/u_format_srgb.c \
util/u_format_table.c \
util/u_format_tests.c \
util/u_format_yuv.c \
util/u_format_zs.c \
util/u_framebuffer.c \
util/u_gen_mipmap.c \
util/u_half.c \
util/u_handle_table.c \
util/u_hash.c \
util/u_hash_table.c \
util/u_index_modify.c \
util/u_keymap.c \
util/u_linear.c \
util/u_linkage.c \
util/u_network.c \
util/u_math.c \
util/u_mm.c \
util/u_pstipple.c \
util/u_rect.c \
util/u_ringbuffer.c \
util/u_sampler.c \
util/u_simple_shaders.c \
util/u_slab.c \
util/u_snprintf.c \
util/u_staging.c \
util/u_surface.c \
util/u_surfaces.c \
util/u_texture.c \
util/u_tile.c \
util/u_transfer.c \
util/u_resource.c \
util/u_upload_mgr.c \
util/u_vbuf_mgr.c
GENERATED_SOURCES = \
indices/u_indices_gen.c \
indices/u_unfilled_gen.c \
util/u_format_srgb.c \
util/u_format_table.c \
util/u_half.c
include $(CLEAR_VARS)
LOCAL_SRC_FILES := \
$(filter-out $(GENERATED_SOURCES), $(C_SOURCES))
LOCAL_CFLAGS := \
-fvisibility=hidden \
-Wno-sign-compare
LOCAL_C_INCLUDES := \
external/mesa/include \
external/mesa/src/gallium/include \
external/mesa/src/gallium/auxiliary \
external/mesa/src/gallium/drivers \
external/mesa/src/gallium/auxiliary/util
LOCAL_MODULE := libmesa_gallium
LOCAL_MODULE_CLASS := STATIC_LIBRARIES
intermediates := $(call local-intermediates-dir)
GEN_SCRIPT := $(LOCAL_PATH)/indices/u_indices_gen.py
GEN := $(intermediates)/indices/u_indices_gen.c
$(GEN): PRIVATE_CUSTOM_TOOL = python $< > $@
$(GEN): $(GEN_SCRIPT)
$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)
GEN_SCRIPT := $(LOCAL_PATH)/indices/u_unfilled_gen.py
GEN := $(intermediates)/indices/u_unfilled_gen.c
$(GEN): PRIVATE_CUSTOM_TOOL = python $< > $@
$(GEN): $(GEN_SCRIPT)
$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)
GEN_SCRIPT := $(LOCAL_PATH)/util/u_format_srgb.py
GEN := $(intermediates)/util/u_format_srgb.c
$(GEN): PRIVATE_CUSTOM_TOOL = python $< > $@
$(GEN): $(GEN_SCRIPT)
$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)
GEN_SCRIPT := $(LOCAL_PATH)/util/u_format_table.py
GEN := $(intermediates)/util/u_format_table.c
$(GEN): PRIVATE_CUSTOM_TOOL := python $(GEN_SCRIPT) $(LOCAL_PATH)/util/u_format.csv > $(GEN)
$(GEN): $(GEN_SCRIPT) $(LOCAL_PATH)/util/u_format.csv
$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)
GEN_SCRIPT := $(LOCAL_PATH)/util/u_half.py
GEN := $(intermediates)/util/u_half.c
$(GEN): PRIVATE_CUSTOM_TOOL = python $< > $@
$(GEN): $(GEN_SCRIPT)
$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)
include $(BUILD_STATIC_LIBRARY)

View File

@@ -107,6 +107,7 @@ C_SOURCES = \
util/u_caps.c \
util/u_cpu_detect.c \
util/u_dl.c \
util/u_draw.c \
util/u_draw_quad.c \
util/u_format.c \
util/u_format_other.c \

View File

@@ -154,6 +154,7 @@ source = [
'util/u_dump_defines.c',
'util/u_dump_state.c',
'util/u_dl.c',
'util/u_draw.c',
'util/u_draw_quad.c',
'util/u_format.c',
'util/u_format_other.c',

View File

@@ -751,7 +751,7 @@ void
draw_set_mapped_texture(struct draw_context *draw,
unsigned sampler_idx,
uint32_t width, uint32_t height, uint32_t depth,
uint32_t last_level,
uint32_t first_level, uint32_t last_level,
uint32_t row_stride[PIPE_MAX_TEXTURE_LEVELS],
uint32_t img_stride[PIPE_MAX_TEXTURE_LEVELS],
const void *data[PIPE_MAX_TEXTURE_LEVELS])
@@ -760,7 +760,7 @@ draw_set_mapped_texture(struct draw_context *draw,
if(draw->llvm)
draw_llvm_set_mapped_texture(draw,
sampler_idx,
width, height, depth, last_level,
width, height, depth, first_level, last_level,
row_stride, img_stride, data);
#endif
}

View File

@@ -123,7 +123,7 @@ void
draw_set_mapped_texture(struct draw_context *draw,
unsigned sampler_idx,
uint32_t width, uint32_t height, uint32_t depth,
uint32_t last_level,
uint32_t first_level, uint32_t last_level,
uint32_t row_stride[PIPE_MAX_TEXTURE_LEVELS],
uint32_t img_stride[PIPE_MAX_TEXTURE_LEVELS],
const void *data[PIPE_MAX_TEXTURE_LEVELS]);

View File

@@ -106,6 +106,7 @@ create_jit_texture_type(struct gallivm_state *gallivm)
elem_types[DRAW_JIT_TEXTURE_WIDTH] =
elem_types[DRAW_JIT_TEXTURE_HEIGHT] =
elem_types[DRAW_JIT_TEXTURE_DEPTH] =
elem_types[DRAW_JIT_TEXTURE_FIRST_LEVEL] =
elem_types[DRAW_JIT_TEXTURE_LAST_LEVEL] = int32_type;
elem_types[DRAW_JIT_TEXTURE_ROW_STRIDE] =
elem_types[DRAW_JIT_TEXTURE_IMG_STRIDE] =
@@ -136,6 +137,9 @@ create_jit_texture_type(struct gallivm_state *gallivm)
LP_CHECK_MEMBER_OFFSET(struct draw_jit_texture, depth,
target, texture_type,
DRAW_JIT_TEXTURE_DEPTH);
LP_CHECK_MEMBER_OFFSET(struct draw_jit_texture, first_level,
target, texture_type,
DRAW_JIT_TEXTURE_FIRST_LEVEL);
LP_CHECK_MEMBER_OFFSET(struct draw_jit_texture, last_level,
target, texture_type,
DRAW_JIT_TEXTURE_LAST_LEVEL);
@@ -438,7 +442,8 @@ generate_vs(struct draw_llvm *llvm,
const LLVMValueRef (*inputs)[NUM_CHANNELS],
LLVMValueRef system_values_array,
LLVMValueRef context_ptr,
struct lp_build_sampler_soa *draw_sampler)
struct lp_build_sampler_soa *draw_sampler,
boolean clamp_vertex_color)
{
const struct tgsi_token *tokens = llvm->draw->vs.vertex_shader->state.tokens;
struct lp_type vs_type;
@@ -474,6 +479,30 @@ generate_vs(struct draw_llvm *llvm,
outputs,
sampler,
&llvm->draw->vs.vertex_shader->info);
if(clamp_vertex_color)
{
LLVMValueRef out;
unsigned chan, attrib;
struct lp_build_context bld;
struct tgsi_shader_info* info = &llvm->draw->vs.vertex_shader->info;
lp_build_context_init(&bld, llvm->gallivm, vs_type);
for (attrib = 0; attrib < info->num_outputs; ++attrib) {
for(chan = 0; chan < NUM_CHANNELS; ++chan) {
if(outputs[attrib][chan]) {
switch (info->output_semantic_name[attrib]) {
case TGSI_SEMANTIC_COLOR:
case TGSI_SEMANTIC_BCOLOR:
out = LLVMBuildLoad(builder, outputs[attrib][chan], "");
out = lp_build_clamp(&bld, out, bld.zero, bld.one);
LLVMBuildStore(builder, out, outputs[attrib][chan]);
break;
}
}
}
}
}
}
#if DEBUG_STORE
@@ -1235,7 +1264,8 @@ draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant)
ptr_aos,
system_values_array,
context_ptr,
sampler);
sampler,
variant->key.clamp_vertex_color);
/* store original positions in clip before further manipulation */
store_clip(gallivm, io, outputs);
@@ -1446,7 +1476,8 @@ draw_llvm_generate_elts(struct draw_llvm *llvm, struct draw_llvm_variant *varian
ptr_aos,
system_values_array,
context_ptr,
sampler);
sampler,
variant->key.clamp_vertex_color);
/* store original positions in clip before further manipulation */
store_clip(gallivm, io, outputs);
@@ -1524,6 +1555,8 @@ draw_llvm_make_variant_key(struct draw_llvm *llvm, char *store)
key = (struct draw_llvm_variant_key *)store;
key->clamp_vertex_color = llvm->draw->rasterizer->clamp_vertex_color; /**/
/* Presumably all variants of the shader should have the same
* number of vertex elements - ie the number of shader inputs.
*/
@@ -1566,7 +1599,7 @@ void
draw_llvm_set_mapped_texture(struct draw_context *draw,
unsigned sampler_idx,
uint32_t width, uint32_t height, uint32_t depth,
uint32_t last_level,
uint32_t first_level, uint32_t last_level,
uint32_t row_stride[PIPE_MAX_TEXTURE_LEVELS],
uint32_t img_stride[PIPE_MAX_TEXTURE_LEVELS],
const void *data[PIPE_MAX_TEXTURE_LEVELS])
@@ -1582,9 +1615,10 @@ draw_llvm_set_mapped_texture(struct draw_context *draw,
jit_tex->width = width;
jit_tex->height = height;
jit_tex->depth = depth;
jit_tex->first_level = first_level;
jit_tex->last_level = last_level;
for (j = 0; j <= last_level; j++) {
for (j = first_level; j <= last_level; j++) {
jit_tex->data[j] = data[j];
jit_tex->row_stride[j] = row_stride[j];
jit_tex->img_stride[j] = img_stride[j];

View File

@@ -50,6 +50,7 @@ struct draw_jit_texture
uint32_t width;
uint32_t height;
uint32_t depth;
uint32_t first_level;
uint32_t last_level;
uint32_t row_stride[PIPE_MAX_TEXTURE_LEVELS];
uint32_t img_stride[PIPE_MAX_TEXTURE_LEVELS];
@@ -64,6 +65,7 @@ enum {
DRAW_JIT_TEXTURE_WIDTH = 0,
DRAW_JIT_TEXTURE_HEIGHT,
DRAW_JIT_TEXTURE_DEPTH,
DRAW_JIT_TEXTURE_FIRST_LEVEL,
DRAW_JIT_TEXTURE_LAST_LEVEL,
DRAW_JIT_TEXTURE_ROW_STRIDE,
DRAW_JIT_TEXTURE_IMG_STRIDE,
@@ -162,6 +164,7 @@ struct draw_llvm_variant_key
{
unsigned nr_vertex_elements:8;
unsigned nr_samplers:8;
unsigned clamp_vertex_color:1;
unsigned clip_xy:1;
unsigned clip_z:1;
unsigned clip_user:1;
@@ -169,7 +172,7 @@ struct draw_llvm_variant_key
unsigned bypass_viewport:1;
unsigned need_edgeflags:1;
unsigned nr_planes:4;
unsigned pad:6;
unsigned pad:5;
/* Variable number of vertex elements:
*/
@@ -295,7 +298,7 @@ void
draw_llvm_set_mapped_texture(struct draw_context *draw,
unsigned sampler_idx,
uint32_t width, uint32_t height, uint32_t depth,
uint32_t last_level,
uint32_t first_level, uint32_t last_level,
uint32_t row_stride[PIPE_MAX_TEXTURE_LEVELS],
uint32_t img_stride[PIPE_MAX_TEXTURE_LEVELS],
const void *data[PIPE_MAX_TEXTURE_LEVELS]);

View File

@@ -144,6 +144,7 @@ draw_llvm_texture_member(const struct lp_sampler_dynamic_state *base,
DRAW_LLVM_TEXTURE_MEMBER(width, DRAW_JIT_TEXTURE_WIDTH, TRUE)
DRAW_LLVM_TEXTURE_MEMBER(height, DRAW_JIT_TEXTURE_HEIGHT, TRUE)
DRAW_LLVM_TEXTURE_MEMBER(depth, DRAW_JIT_TEXTURE_DEPTH, TRUE)
DRAW_LLVM_TEXTURE_MEMBER(first_level,DRAW_JIT_TEXTURE_FIRST_LEVEL, TRUE)
DRAW_LLVM_TEXTURE_MEMBER(last_level, DRAW_JIT_TEXTURE_LAST_LEVEL, TRUE)
DRAW_LLVM_TEXTURE_MEMBER(row_stride, DRAW_JIT_TEXTURE_ROW_STRIDE, FALSE)
DRAW_LLVM_TEXTURE_MEMBER(img_stride, DRAW_JIT_TEXTURE_IMG_STRIDE, FALSE)
@@ -209,6 +210,7 @@ draw_llvm_sampler_soa_create(const struct lp_sampler_static_state *static_state,
sampler->dynamic_state.base.width = draw_llvm_texture_width;
sampler->dynamic_state.base.height = draw_llvm_texture_height;
sampler->dynamic_state.base.depth = draw_llvm_texture_depth;
sampler->dynamic_state.base.first_level = draw_llvm_texture_first_level;
sampler->dynamic_state.base.last_level = draw_llvm_texture_last_level;
sampler->dynamic_state.base.row_stride = draw_llvm_texture_row_stride;
sampler->dynamic_state.base.img_stride = draw_llvm_texture_img_stride;

View File

@@ -146,6 +146,14 @@ struct draw_context
struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS];
unsigned nr_vertex_buffers;
/*
* This is the largest legal index value for the current set of
* bound vertex buffers. Regardless of any other consideration,
* all vertex lookups need to be clamped to 0..max_index to
* prevent out-of-bound access.
*/
unsigned max_index;
struct pipe_vertex_element vertex_element[PIPE_MAX_ATTRIBS];
unsigned nr_vertex_elements;

View File

@@ -470,6 +470,17 @@ draw_vbo(struct draw_context *draw,
if (0)
draw_print_arrays(draw, info->mode, info->start, MIN2(info->count, 20));
draw->pt.max_index = util_draw_max_index(draw->pt.vertex_buffer,
draw->pt.nr_vertex_buffers,
draw->pt.vertex_element,
draw->pt.nr_vertex_elements,
info);
/*
* TODO: We could use draw->pt.max_index to further narrow
* the min_index/max_index hints given by the state tracker.
*/
for (instance = 0; instance < info->instance_count; instance++) {
draw->instance_id = instance + info->start_instance;

View File

@@ -139,7 +139,7 @@ void draw_pt_fetch_run( struct pt_fetch *fetch,
((char *)draw->pt.user.vbuffer[i] +
draw->pt.vertex_buffer[i].buffer_offset),
draw->pt.vertex_buffer[i].stride,
draw->pt.user.max_index);
draw->pt.max_index);
}
translate->run_elts( translate,

View File

@@ -186,7 +186,7 @@ static void fetch_emit_prepare( struct draw_pt_middle_end *middle,
((char *)draw->pt.user.vbuffer[i] +
draw->pt.vertex_buffer[i].buffer_offset),
draw->pt.vertex_buffer[i].stride,
draw->pt.user.max_index);
draw->pt.max_index);
}
*max_vertices = (draw->render->max_vertex_buffer_bytes /

View File

@@ -169,7 +169,7 @@ static void fse_prepare( struct draw_pt_middle_end *middle,
((const ubyte *) draw->pt.user.vbuffer[i] +
draw->pt.vertex_buffer[i].buffer_offset),
draw->pt.vertex_buffer[i].stride,
draw->pt.user.max_index );
draw->pt.max_index );
}
*max_vertices = (draw->render->max_vertex_buffer_bytes /

View File

@@ -85,7 +85,12 @@ vsplit_flush_cache(struct vsplit_frontend *vsplit, unsigned flags)
static INLINE void
vsplit_add_cache(struct vsplit_frontend *vsplit, unsigned fetch)
{
unsigned hash = fetch % MAP_SIZE;
struct draw_context *draw = vsplit->draw;
unsigned hash;
fetch = MIN2(fetch, draw->pt.max_index);
hash = fetch % MAP_SIZE;
if (vsplit->cache.fetches[hash] != fetch) {
/* update cache */

View File

@@ -47,14 +47,18 @@ CONCAT(vsplit_primitive_, ELT_TYPE)(struct vsplit_frontend *vsplit,
const ushort *draw_elts = NULL;
unsigned i;
ib += istart;
/* use the ib directly */
if (min_index == 0 && sizeof(ib[0]) == sizeof(draw_elts[0])) {
if (icount > vsplit->max_vertices)
return FALSE;
for (i = 0; i < icount; i++) {
ELT_TYPE idx = ib[istart + i];
assert(idx >= min_index && idx <= max_index);
ELT_TYPE idx = ib[i];
if (idx < min_index || idx > max_index) {
debug_printf("warning: index out of range\n");
}
}
draw_elts = (const ushort *) ib;
}
@@ -83,17 +87,21 @@ CONCAT(vsplit_primitive_, ELT_TYPE)(struct vsplit_frontend *vsplit,
if (!draw_elts) {
if (min_index == 0) {
for (i = 0; i < icount; i++) {
ELT_TYPE idx = ib[istart + i];
ELT_TYPE idx = ib[i];
assert(idx >= min_index && idx <= max_index);
if (idx < min_index || idx > max_index) {
debug_printf("warning: index out of range\n");
}
vsplit->draw_elts[i] = (ushort) idx;
}
}
else {
for (i = 0; i < icount; i++) {
ELT_TYPE idx = ib[istart + i];
ELT_TYPE idx = ib[i];
assert(idx >= min_index && idx <= max_index);
if (idx < min_index || idx > max_index) {
debug_printf("warning: index out of range\n");
}
vsplit->draw_elts[i] = (ushort) (idx - min_index);
}
}

View File

@@ -104,10 +104,17 @@ draw_create_vertex_shader(struct draw_context *draw,
}
if (!draw->pt.middle.llvm) {
#if 0
/* these paths don't support vertex clamping
* TODO: either add it, or remove them completely
* use LLVM instead if you want performance
* use exec instead if you want debugging/more correctness
*/
#if defined(PIPE_ARCH_X86)
vs = draw_create_vs_sse( draw, shader );
#elif defined(PIPE_ARCH_PPC)
vs = draw_create_vs_ppc( draw, shader );
#endif
#endif
}
#if HAVE_LLVM

View File

@@ -95,6 +95,7 @@ vs_exec_run_linear( struct draw_vertex_shader *shader,
struct tgsi_exec_machine *machine = evs->machine;
unsigned int i, j;
unsigned slot;
boolean clamp_vertex_color = shader->draw->rasterizer->clamp_vertex_color;
tgsi_exec_set_constant_buffers(machine, PIPE_MAX_CONSTANT_BUFFERS,
constants, const_size);
@@ -151,11 +152,22 @@ vs_exec_run_linear( struct draw_vertex_shader *shader,
*/
for (j = 0; j < max_vertices; j++) {
for (slot = 0; slot < shader->info.num_outputs; slot++) {
output[slot][0] = machine->Outputs[slot].xyzw[0].f[j];
output[slot][1] = machine->Outputs[slot].xyzw[1].f[j];
output[slot][2] = machine->Outputs[slot].xyzw[2].f[j];
output[slot][3] = machine->Outputs[slot].xyzw[3].f[j];
unsigned name = shader->info.output_semantic_name[slot];
if(clamp_vertex_color &&
(name == TGSI_SEMANTIC_COLOR || name == TGSI_SEMANTIC_BCOLOR))
{
output[slot][0] = CLAMP(machine->Outputs[slot].xyzw[0].f[j], 0.0f, 1.0f);
output[slot][1] = CLAMP(machine->Outputs[slot].xyzw[1].f[j], 0.0f, 1.0f);
output[slot][2] = CLAMP(machine->Outputs[slot].xyzw[2].f[j], 0.0f, 1.0f);
output[slot][3] = CLAMP(machine->Outputs[slot].xyzw[3].f[j], 0.0f, 1.0f);
}
else
{
output[slot][0] = machine->Outputs[slot].xyzw[0].f[j];
output[slot][1] = machine->Outputs[slot].xyzw[1].f[j];
output[slot][2] = machine->Outputs[slot].xyzw[2].f[j];
output[slot][3] = machine->Outputs[slot].xyzw[3].f[j];
}
}
#if 0

View File

@@ -32,7 +32,12 @@
#include <llvm/Target/TargetInstrInfo.h>
#include <llvm/Support/raw_ostream.h>
#include <llvm/Support/MemoryObject.h>
#if HAVE_LLVM >= 0x0209
#include <llvm/Support/Host.h>
#else
#include <llvm/System/Host.h>
#endif
#if HAVE_LLVM >= 0x0207
#include <llvm/MC/MCDisassembler.h>
@@ -202,9 +207,17 @@ lp_disassemble(const void* func)
}
raw_debug_ostream Out;
TargetMachine *TM = T->createTargetMachine(Triple, "");
#if HAVE_LLVM >= 0x0300
unsigned int AsmPrinterVariant = AsmInfo->getAssemblerDialect();
#else
int AsmPrinterVariant = AsmInfo->getAssemblerDialect();
#if HAVE_LLVM >= 0x0208
#endif
#if HAVE_LLVM >= 0x0300
OwningPtr<MCInstPrinter> Printer(
T->createMCInstPrinter(*TM, AsmPrinterVariant, *AsmInfo));
#elif HAVE_LLVM >= 0x0208
OwningPtr<MCInstPrinter> Printer(
T->createMCInstPrinter(AsmPrinterVariant, *AsmInfo));
#else
@@ -216,8 +229,6 @@ lp_disassemble(const void* func)
return;
}
TargetMachine *TM = T->createTargetMachine(Triple, "");
const TargetInstrInfo *TII = TM->getInstrInfo();
/*

View File

@@ -51,6 +51,10 @@
*/
#define BRILINEAR_FACTOR 2
static LLVMValueRef
lp_build_minify(struct lp_build_context *bld,
LLVMValueRef base_size,
LLVMValueRef level);
/**
* Does the given texture wrap mode allow sampling the texture border color?
@@ -184,9 +188,11 @@ lp_sampler_static_state(struct lp_sampler_static_state *state,
*/
static LLVMValueRef
lp_build_rho(struct lp_build_sample_context *bld,
unsigned unit,
const LLVMValueRef ddx[4],
const LLVMValueRef ddy[4])
{
struct lp_build_context *int_size_bld = &bld->int_size_bld;
struct lp_build_context *float_size_bld = &bld->float_size_bld;
struct lp_build_context *float_bld = &bld->float_bld;
const unsigned dims = bld->dims;
@@ -198,8 +204,9 @@ lp_build_rho(struct lp_build_sample_context *bld,
LLVMValueRef dsdx, dsdy, dtdx, dtdy, drdx, drdy;
LLVMValueRef rho_x, rho_y;
LLVMValueRef rho_vec;
LLVMValueRef float_size;
LLVMValueRef int_size, float_size;
LLVMValueRef rho;
LLVMValueRef first_level, first_level_vec;
dsdx = ddx[0];
dsdy = ddy[0];
@@ -235,7 +242,11 @@ lp_build_rho(struct lp_build_sample_context *bld,
rho_vec = lp_build_max(float_size_bld, rho_x, rho_y);
float_size = lp_build_int_to_float(float_size_bld, bld->int_size);
first_level = bld->dynamic_state->first_level(bld->dynamic_state,
bld->gallivm, unit);
first_level_vec = lp_build_broadcast_scalar(&bld->int_size_bld, first_level);
int_size = lp_build_minify(int_size_bld, bld->int_size, first_level_vec);
float_size = lp_build_int_to_float(float_size_bld, int_size);
rho_vec = lp_build_mul(float_size_bld, rho_vec, float_size);
@@ -442,7 +453,7 @@ lp_build_lod_selector(struct lp_build_sample_context *bld,
else {
LLVMValueRef rho;
rho = lp_build_rho(bld, ddx, ddy);
rho = lp_build_rho(bld, unit, ddx, ddy);
/*
* Compute lod = log2(rho)
@@ -542,18 +553,18 @@ lp_build_nearest_mip_level(struct lp_build_sample_context *bld,
LLVMValueRef *level_out)
{
struct lp_build_context *int_bld = &bld->int_bld;
LLVMValueRef last_level, level;
LLVMValueRef zero = lp_build_const_int32(bld->gallivm, 0);
LLVMValueRef first_level, last_level, level;
first_level = bld->dynamic_state->first_level(bld->dynamic_state,
bld->gallivm, unit);
last_level = bld->dynamic_state->last_level(bld->dynamic_state,
bld->gallivm, unit);
/* convert float lod to integer */
level = lod_ipart;
level = lp_build_add(int_bld, lod_ipart, first_level);
/* clamp level to legal range of levels */
*level_out = lp_build_clamp(int_bld, level, zero, last_level);
*level_out = lp_build_clamp(int_bld, level, first_level, last_level);
}
@@ -573,39 +584,42 @@ lp_build_linear_mip_levels(struct lp_build_sample_context *bld,
LLVMBuilderRef builder = bld->gallivm->builder;
struct lp_build_context *int_bld = &bld->int_bld;
struct lp_build_context *float_bld = &bld->float_bld;
LLVMValueRef last_level;
LLVMValueRef first_level, last_level;
LLVMValueRef clamp_min;
LLVMValueRef clamp_max;
*level0_out = lod_ipart;
*level1_out = lp_build_add(int_bld, lod_ipart, int_bld->one);
first_level = bld->dynamic_state->first_level(bld->dynamic_state,
bld->gallivm, unit);
*level0_out = lp_build_add(int_bld, lod_ipart, first_level);
*level1_out = lp_build_add(int_bld, *level0_out, int_bld->one);
last_level = bld->dynamic_state->last_level(bld->dynamic_state,
bld->gallivm, unit);
/*
* Clamp both lod_ipart and lod_ipart + 1 to [0, last_level], with the
* minimum number of comparisons, and zeroing lod_fpart in the extreme
* Clamp both *level0_out and *level1_out to [first_level, last_level], with
* the minimum number of comparisons, and zeroing lod_fpart in the extreme
* ends in the process.
*/
/* lod_ipart < 0 */
/* *level0_out < first_level */
clamp_min = LLVMBuildICmp(builder, LLVMIntSLT,
lod_ipart, int_bld->zero,
"clamp_lod_to_zero");
*level0_out, first_level,
"clamp_lod_to_first");
*level0_out = LLVMBuildSelect(builder, clamp_min,
int_bld->zero, *level0_out, "");
first_level, *level0_out, "");
*level1_out = LLVMBuildSelect(builder, clamp_min,
int_bld->zero, *level1_out, "");
first_level, *level1_out, "");
*lod_fpart_inout = LLVMBuildSelect(builder, clamp_min,
float_bld->zero, *lod_fpart_inout, "");
/* lod_ipart >= last_level */
/* *level0_out >= last_level */
clamp_max = LLVMBuildICmp(builder, LLVMIntSGE,
lod_ipart, last_level,
*level0_out, last_level,
"clamp_lod_to_last");
*level0_out = LLVMBuildSelect(builder, clamp_max,

View File

@@ -120,6 +120,12 @@ struct lp_sampler_dynamic_state
struct gallivm_state *gallivm,
unsigned unit);
/** Obtain the first mipmap level (base level) (returns int32) */
LLVMValueRef
(*first_level)( const struct lp_sampler_dynamic_state *state,
struct gallivm_state *gallivm,
unsigned unit);
/** Obtain the number of mipmap levels minus one (returns int32) */
LLVMValueRef
(*last_level)( const struct lp_sampler_dynamic_state *state,

View File

@@ -939,6 +939,7 @@ lp_build_sample_aos(struct lp_build_sample_context *bld,
LLVMValueRef unswizzled[4];
LLVMValueRef face_ddx[4], face_ddy[4];
struct lp_build_context h16_bld;
LLVMValueRef first_level;
LLVMValueRef i32t_zero = lp_build_const_int32(bld->gallivm, 0);
/* we only support the common/simple wrap modes at this time */
@@ -1008,7 +1009,9 @@ lp_build_sample_aos(struct lp_build_sample_context *bld,
lp_build_nearest_mip_level(bld, unit, lod_ipart, &ilevel0);
}
else {
ilevel0 = i32t_zero;
first_level = bld->dynamic_state->first_level(bld->dynamic_state,
bld->gallivm, unit);
ilevel0 = first_level;
}
break;
case PIPE_TEX_MIPFILTER_NEAREST:
@@ -1065,7 +1068,7 @@ lp_build_sample_aos(struct lp_build_sample_context *bld,
lp_build_sample_mipmap(bld,
mag_filter, PIPE_TEX_MIPFILTER_NONE,
s, t, r,
i32t_zero, NULL, NULL,
ilevel0, NULL, NULL,
packed_lo, packed_hi);
}
lp_build_endif(&if_ctx);

View File

@@ -943,6 +943,7 @@ lp_build_sample_general(struct lp_build_sample_context *bld,
LLVMValueRef ilevel0, ilevel1 = NULL;
LLVMValueRef face_ddx[4], face_ddy[4];
LLVMValueRef texels[4];
LLVMValueRef first_level;
LLVMValueRef i32t_zero = lp_build_const_int32(bld->gallivm, 0);
unsigned chan;
@@ -1009,7 +1010,9 @@ lp_build_sample_general(struct lp_build_sample_context *bld,
lp_build_nearest_mip_level(bld, unit, lod_ipart, &ilevel0);
}
else {
ilevel0 = i32t_zero;
first_level = bld->dynamic_state->first_level(bld->dynamic_state,
bld->gallivm, unit);
ilevel0 = first_level;
}
break;
case PIPE_TEX_MIPFILTER_NEAREST:
@@ -1068,7 +1071,7 @@ lp_build_sample_general(struct lp_build_sample_context *bld,
lp_build_sample_mipmap(bld, unit,
mag_filter, PIPE_TEX_MIPFILTER_NONE,
s, t, r,
i32t_zero, NULL, NULL,
ilevel0, NULL, NULL,
texels);
}
lp_build_endif(&if_ctx);

View File

@@ -307,7 +307,7 @@ typedef int64_t pipe_condvar;
* pipe_barrier
*/
#if (defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_HAIKU) || defined(PIPE_OS_EMBEDDED)) && !defined(PIPE_OS_ANDROID)
#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_HAIKU) || defined(PIPE_OS_EMBEDDED)
typedef pthread_barrier_t pipe_barrier;

View File

@@ -726,6 +726,16 @@ void x86_movzx16(struct x86_function *p, struct x86_reg dst, struct x86_reg src
emit_modrm(p, dst, src);
}
void x86_cmovcc( struct x86_function *p,
struct x86_reg dst,
struct x86_reg src,
enum x86_cc cc)
{
DUMP_RRI( dst, src, cc );
emit_2ub( p, 0x0f, 0x40 + cc );
emit_modrm( p, dst, src );
}
void x86_xor( struct x86_function *p,
struct x86_reg dst,
struct x86_reg src )

View File

@@ -309,6 +309,7 @@ void sse_movmskps( struct x86_function *p, struct x86_reg dst, struct x86_reg sr
void x86_add( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
void x86_and( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
void x86_cmovcc( struct x86_function *p, struct x86_reg dst, struct x86_reg src, enum x86_cc cc );
void x86_cmp( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
void x86_dec( struct x86_function *p, struct x86_reg reg );
void x86_inc( struct x86_function *p, struct x86_reg reg );

View File

@@ -39,7 +39,7 @@ struct translate *translate_create( const struct translate_key *key )
struct translate *translate = NULL;
#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64)
/*translate = translate_sse2_create( key );*/
translate = translate_sse2_create( key );
if (translate)
return translate;
#else

View File

@@ -1067,6 +1067,8 @@ static boolean init_inputs( struct translate_sse *p,
struct translate_buffer *buffer = &p->buffer[varient->buffer_index];
if (!index_size || varient->instance_divisor) {
struct x86_reg buf_max_index = x86_make_disp(p->machine_EDI,
get_offset(p, &buffer->max_index));
struct x86_reg buf_stride = x86_make_disp(p->machine_EDI,
get_offset(p, &buffer->stride));
struct x86_reg buf_ptr = x86_make_disp(p->machine_EDI,
@@ -1100,14 +1102,17 @@ static boolean init_inputs( struct translate_sse *p,
x86_mov(p->func, tmp_EAX, elt);
}
/*
* TODO: Respect translate_buffer::max_index.
/* Clamp to max_index
*/
x86_cmp(p->func, tmp_EAX, buf_max_index);
x86_cmovcc(p->func, tmp_EAX, buf_max_index, cc_AE);
x86_imul(p->func, tmp_EAX, buf_stride);
x64_rexw(p->func);
x86_add(p->func, tmp_EAX, buf_base_ptr);
x86_cmp(p->func, p->count_EBP, p->tmp_EAX);
/* In the linear case, keep the buffer pointer instead of the
* index number.
@@ -1163,6 +1168,10 @@ static struct x86_reg get_buffer_ptr( struct translate_sse *p,
x86_make_disp(p->machine_EDI,
get_offset(p, &p->buffer[varient->buffer_index].base_ptr));
struct x86_reg buf_max_index =
x86_make_disp(p->machine_EDI,
get_offset(p, &p->buffer[varient->buffer_index].max_index));
/* Calculate pointer to current attrib:
@@ -1179,6 +1188,12 @@ static struct x86_reg get_buffer_ptr( struct translate_sse *p,
x86_mov(p->func, ptr, elt);
break;
}
/* Clamp to max_index
*/
x86_cmp(p->func, ptr, buf_max_index);
x86_cmovcc(p->func, ptr, buf_max_index, cc_AE);
x86_imul(p->func, ptr, buf_stride);
x64_rexw(p->func);
x86_add(p->func, ptr, buf_base_ptr);

View File

@@ -270,13 +270,15 @@ util_cpu_detect(void)
util_cpu_caps.x86_cpu_type = 8 + ((regs2[0] >> 20) & 255); /* use extended family (P4, IA64) */
/* general feature flags */
util_cpu_caps.has_tsc = (regs2[3] & (1 << 8 )) >> 8; /* 0x0000010 */
util_cpu_caps.has_mmx = (regs2[3] & (1 << 23 )) >> 23; /* 0x0800000 */
util_cpu_caps.has_sse = (regs2[3] & (1 << 25 )) >> 25; /* 0x2000000 */
util_cpu_caps.has_sse2 = (regs2[3] & (1 << 26 )) >> 26; /* 0x4000000 */
util_cpu_caps.has_sse3 = (regs2[2] & (1)); /* 0x0000001 */
util_cpu_caps.has_ssse3 = (regs2[2] & (1 << 9 )) >> 9; /* 0x0000020 */
util_cpu_caps.has_sse4_1 = (regs2[2] & (1 << 19)) >> 19;
util_cpu_caps.has_tsc = (regs2[3] >> 8) & 1; /* 0x0000010 */
util_cpu_caps.has_mmx = (regs2[3] >> 23) & 1; /* 0x0800000 */
util_cpu_caps.has_sse = (regs2[3] >> 25) & 1; /* 0x2000000 */
util_cpu_caps.has_sse2 = (regs2[3] >> 26) & 1; /* 0x4000000 */
util_cpu_caps.has_sse3 = (regs2[2] >> 0) & 1; /* 0x0000001 */
util_cpu_caps.has_ssse3 = (regs2[2] >> 9) & 1; /* 0x0000020 */
util_cpu_caps.has_sse4_1 = (regs2[2] >> 19) & 1;
util_cpu_caps.has_sse4_2 = (regs2[2] >> 20) & 1;
util_cpu_caps.has_avx = (regs2[2] >> 28) & 1;
util_cpu_caps.has_mmx2 = util_cpu_caps.has_sse; /* SSE cpus supports mmxext too */
cacheline = ((regs2[1] >> 8) & 0xFF) * 8;
@@ -290,10 +292,10 @@ util_cpu_detect(void)
cpuid(0x80000001, regs2);
util_cpu_caps.has_mmx |= (regs2[3] & (1 << 23 )) >> 23; /* 0x0800000 */
util_cpu_caps.has_mmx2 |= (regs2[3] & (1 << 22 )) >> 22; /* 0x400000 */
util_cpu_caps.has_3dnow = (regs2[3] & (1 << 31 )) >> 31; /* 0x80000000 */
util_cpu_caps.has_3dnow_ext = (regs2[3] & (1 << 30 )) >> 30;
util_cpu_caps.has_mmx |= (regs2[3] >> 23) & 1;
util_cpu_caps.has_mmx2 |= (regs2[3] >> 22) & 1;
util_cpu_caps.has_3dnow = (regs2[3] >> 31) & 1;
util_cpu_caps.has_3dnow_ext = (regs2[3] >> 30) & 1;
}
if (regs[0] >= 0x80000006) {
@@ -329,6 +331,8 @@ util_cpu_detect(void)
debug_printf("util_cpu_caps.has_sse3 = %u\n", util_cpu_caps.has_sse3);
debug_printf("util_cpu_caps.has_ssse3 = %u\n", util_cpu_caps.has_ssse3);
debug_printf("util_cpu_caps.has_sse4_1 = %u\n", util_cpu_caps.has_sse4_1);
debug_printf("util_cpu_caps.has_sse4_2 = %u\n", util_cpu_caps.has_sse4_2);
debug_printf("util_cpu_caps.has_avx = %u\n", util_cpu_caps.has_avx);
debug_printf("util_cpu_caps.has_3dnow = %u\n", util_cpu_caps.has_3dnow);
debug_printf("util_cpu_caps.has_3dnow_ext = %u\n", util_cpu_caps.has_3dnow_ext);
debug_printf("util_cpu_caps.has_altivec = %u\n", util_cpu_caps.has_altivec);

View File

@@ -53,6 +53,8 @@ struct util_cpu_caps {
unsigned has_sse3:1;
unsigned has_ssse3:1;
unsigned has_sse4_1:1;
unsigned has_sse4_2:1;
unsigned has_avx:1;
unsigned has_3dnow:1;
unsigned has_3dnow_ext:1;
unsigned has_altivec:1;

View File

@@ -39,6 +39,7 @@
#include <stddef.h>
#include "pipe/p_compiler.h"
struct list_head
@@ -47,50 +48,56 @@ struct list_head
struct list_head *next;
};
static INLINE void list_inithead(struct list_head *item)
{
item->prev = item;
item->next = item;
}
#define LIST_INITHEAD(__item) \
do { \
(__item)->prev = (__item); \
(__item)->next = (__item); \
} while (0)
static INLINE void list_add(struct list_head *item, struct list_head *list)
{
item->prev = list;
item->next = list->next;
list->next->prev = item;
list->next = item;
}
#define LIST_ADD(__item, __list) \
do { \
(__item)->prev = (__list); \
(__item)->next = (__list)->next; \
(__list)->next->prev = (__item); \
(__list)->next = (__item); \
} while (0)
static INLINE void list_addtail(struct list_head *item, struct list_head *list)
{
item->next = list;
item->prev = list->prev;
list->prev->next = item;
list->prev = item;
}
#define LIST_ADDTAIL(__item, __list) \
do { \
(__item)->next = (__list); \
(__item)->prev = (__list)->prev; \
(__list)->prev->next = (__item); \
(__list)->prev = (__item); \
} while(0)
static INLINE void list_replace(struct list_head *from, struct list_head *to)
{
to->prev = from->prev;
to->next = from->next;
from->next->prev = to;
from->prev->next = to;
}
#define LIST_REPLACE(__from, __to) \
do { \
(__to)->prev = (__from)->prev; \
(__to)->next = (__from)->next; \
(__from)->next->prev = (__to); \
(__from)->prev->next = (__to); \
} while (0)
static INLINE void list_del(struct list_head *item)
{
item->prev->next = item->next;
item->next->prev = item->prev;
}
#define LIST_DEL(__item) \
do { \
(__item)->prev->next = (__item)->next; \
(__item)->next->prev = (__item)->prev; \
} while(0)
static INLINE void list_delinit(struct list_head *item)
{
item->prev->next = item->next;
item->next->prev = item->prev;
item->next = item;
item->prev = item;
}
#define LIST_DELINIT(__item) \
do { \
(__item)->prev->next = (__item)->next; \
(__item)->next->prev = (__item)->prev; \
(__item)->next = (__item); \
(__item)->prev = (__item); \
} while(0)
#define LIST_INITHEAD(__item) list_inithead(__item)
#define LIST_ADD(__item, __list) list_add(__item, __list)
#define LIST_ADDTAIL(__item, __list) list_addtail(__item, __list)
#define LIST_REPLACE(__from, __to) list_replace(__from, __to)
#define LIST_DEL(__item) list_del(__item)
#define LIST_DELINIT(__item) list_delinit(__item)
#define LIST_ENTRY(__type, __item, __field) \
((__type *)(((char *)(__item)) - offsetof(__type, __field)))
@@ -114,4 +121,21 @@ struct list_head
storage = container_of(pos->member.next, pos, member); \
&pos->member != (head); \
pos = storage, storage = container_of(storage->member.next, storage, member))
#define LIST_FOR_EACH_ENTRY_SAFE_REV(pos, storage, head, member) \
for (pos = container_of((head)->prev, pos, member), \
storage = container_of(pos->member.prev, pos, member); \
&pos->member != (head); \
pos = storage, storage = container_of(storage->member.prev, storage, member))
#define LIST_FOR_EACH_ENTRY_FROM(pos, start, head, member) \
for (pos = container_of((start), pos, member); \
&pos->member != (head); \
pos = container_of(pos->member.next, pos, member))
#define LIST_FOR_EACH_ENTRY_FROM_REV(pos, start, head, member) \
for (pos = container_of((start), pos, member); \
&pos->member != (head); \
pos = container_of(pos->member.prev, pos, member))
#endif /*_U_DOUBLE_LIST_H_*/

View File

@@ -0,0 +1,99 @@
/**************************************************************************
*
* Copyright 2011 VMware, Inc.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
**************************************************************************/
#include "util/u_debug.h"
#include "util/u_math.h"
#include "util/u_format.h"
#include "util/u_draw.h"
/**
* Returns the largest legal index value for the current set of bound vertex
* buffers. Regardless of any other consideration, all vertex lookups need to
* be clamped to 0..max_index to prevent an out-of-bound access.
*/
unsigned
util_draw_max_index(
const struct pipe_vertex_buffer *vertex_buffers,
unsigned nr_vertex_buffers,
const struct pipe_vertex_element *vertex_elements,
unsigned nr_vertex_elements,
const struct pipe_draw_info *info)
{
unsigned max_index;
unsigned i;
max_index = ~0;
for (i = 0; i < nr_vertex_elements; i++) {
const struct pipe_vertex_element *element =
&vertex_elements[i];
const struct pipe_vertex_buffer *buffer =
&vertex_buffers[element->vertex_buffer_index];
unsigned buffer_size;
const struct util_format_description *format_desc;
unsigned format_size;
assert(buffer->buffer->height0 == 1);
assert(buffer->buffer->depth0 == 1);
buffer_size = buffer->buffer->width0;
format_desc = util_format_description(element->src_format);
assert(format_desc->block.width == 1);
assert(format_desc->block.height == 1);
assert(format_desc->block.bits % 8 == 0);
format_size = format_desc->block.bits/8;
assert(buffer_size - buffer->buffer_offset <= buffer_size);
buffer_size -= buffer->buffer_offset;
assert(buffer_size - element->src_offset <= buffer_size);
buffer_size -= element->src_offset;
assert(buffer_size - format_size <= buffer_size);
buffer_size -= format_size;
if (buffer->stride != 0) {
unsigned buffer_max_index;
buffer_max_index = buffer_size / buffer->stride;
if (element->instance_divisor == 0) {
/* Per-vertex data */
max_index = MIN2(max_index, buffer_max_index);
}
else {
/* Per-instance data. Simply make sure the state tracker didn't
* request more instances than those that fit in the buffer */
assert((info->start_instance + info->instance_count)/element->instance_divisor
<= (buffer_max_index + 1));
}
}
}
return max_index;
}

View File

@@ -34,6 +34,11 @@
#include "pipe/p_state.h"
#ifdef __cplusplus
extern "C" {
#endif
static INLINE void
util_draw_init_info(struct pipe_draw_info *info)
{
@@ -136,4 +141,18 @@ util_draw_range_elements(struct pipe_context *pipe,
pipe->draw_vbo(pipe, &info);
}
unsigned
util_draw_max_index(
const struct pipe_vertex_buffer *vertex_buffers,
unsigned nr_vertex_buffers,
const struct pipe_vertex_element *vertex_elements,
unsigned nr_vertex_elements,
const struct pipe_draw_info *info);
#ifdef __cplusplus
}
#endif
#endif /* !U_DRAW_H */

View File

@@ -88,6 +88,14 @@ PIPE_FORMAT_L16_UNORM , plain, 1, 1, un16, , , , xxx1, r
PIPE_FORMAT_A16_UNORM , plain, 1, 1, un16, , , , 000x, rgb
PIPE_FORMAT_I16_UNORM , plain, 1, 1, un16, , , , xxxx, rgb
PIPE_FORMAT_L16A16_UNORM , plain, 1, 1, un16, un16, , , xxxy, rgb
PIPE_FORMAT_A8_SNORM , plain, 1, 1, sn8 , , , , 000x, rgb
PIPE_FORMAT_L8_SNORM , plain, 1, 1, sn8 , , , , xxx1, rgb
PIPE_FORMAT_L8A8_SNORM , plain, 1, 1, sn8 , sn8 , , , xxxy, rgb
PIPE_FORMAT_I8_SNORM , plain, 1, 1, sn8 , , , , xxxx, rgb
PIPE_FORMAT_A16_SNORM , plain, 1, 1, sn16, , , , 000x, rgb
PIPE_FORMAT_L16_SNORM , plain, 1, 1, sn16, , , , xxx1, rgb
PIPE_FORMAT_L16A16_SNORM , plain, 1, 1, sn16, sn16, , , xxxy, rgb
PIPE_FORMAT_I16_SNORM , plain, 1, 1, sn16, , , , xxxx, rgb
# SRGB formats
PIPE_FORMAT_L8_SRGB , plain, 1, 1, un8 , , , , xxx1, srgb
Can't render this file because it contains an unexpected character in line 8 and column 3.

View File

@@ -199,16 +199,6 @@ roundf(float x)
#endif /* _MSC_VER */
#ifdef PIPE_OS_ANDROID
static INLINE
double log2(double d)
{
return log(d) / M_LN2;
}
#endif

View File

@@ -499,7 +499,7 @@ void u_vbuf_mgr_set_vertex_buffers(struct u_vbuf_mgr *mgrb,
/* Update the maximum index. */
mgr->b.max_index =
MIN2(mgr->b.max_index,
(vb->buffer->width0 - vb->buffer_offset) / vb->stride);
(vb->buffer->width0 - vb->buffer_offset) / vb->stride - 1);
}
for (; i < mgr->b.nr_real_vertex_buffers; i++) {
@@ -572,7 +572,11 @@ void u_vbuf_mgr_draw_begin(struct u_vbuf_mgr *mgrb,
int min_index, max_index;
min_index = info->min_index - info->index_bias;
max_index = info->max_index - info->index_bias;
if (info->max_index == ~0) {
max_index = mgr->b.max_index;
} else {
max_index = MIN2(info->max_index - info->index_bias, mgr->b.max_index);
}
/* Translate vertices with non-native layouts or formats. */
if (mgr->incompatible_vb_layout || mgr->ve->incompatible_layout) {

View File

@@ -53,7 +53,7 @@ struct u_vbuf_mgr {
int nr_real_vertex_buffers;
/* Precomputed max_index for hardware vertex buffers. */
int max_index;
unsigned max_index;
/* This uploader can optionally be used by the driver.
*

View File

@@ -7,6 +7,30 @@ The rasterizer state controls the rendering of points, lines and triangles.
Attributes include polygon culling state, line width, line stipple,
multisample state, scissoring and flat/smooth shading.
Linkage
clamp_vertex_color
^^^^^^^^^^^^^^^^^^
If set, TGSI_SEMANTIC_COLOR registers are clamped to the [0, 1] range after
the execution of the vertex shader, before being passed to the geometry
shader or fragment shader.
OpenGL: glClampColor(GL_CLAMP_VERTEX_COLOR) in GL 3.0 or GL_ARB_color_buffer_float
D3D11: seems always disabled
clamp_fragment_color
^^^^^^^^^^^^^^^^^^^^
Controls whether TGSI_SEMANTIC_COLOR outputs of the fragment shader
are clamped to [0, 1].
OpenGL: glClampColor(GL_CLAMP_FRAGMENT_COLOR) in GL 3.0 or ARB_color_buffer_float
D3D11: seems always disabled
Shading
-------

View File

@@ -1 +0,0 @@
include $(call all-subdir-makefiles)

View File

@@ -1,48 +0,0 @@
ifeq ($(strip $(MESA_BUILD_I915G)),true)
LOCAL_PATH := $(call my-dir)
# from Makefile
C_SOURCES = \
i915_blit.c \
i915_clear.c \
i915_flush.c \
i915_context.c \
i915_debug.c \
i915_debug_fp.c \
i915_state.c \
i915_state_immediate.c \
i915_state_dynamic.c \
i915_state_derived.c \
i915_state_emit.c \
i915_state_fpc.c \
i915_state_sampler.c \
i915_state_static.c \
i915_screen.c \
i915_prim_emit.c \
i915_prim_vbuf.c \
i915_resource.c \
i915_resource_texture.c \
i915_resource_buffer.c \
i915_fpc_emit.c \
i915_fpc_translate.c \
i915_surface.c
include $(CLEAR_VARS)
LOCAL_SRC_FILES := \
$(C_SOURCES)
LOCAL_CFLAGS := \
-fvisibility=hidden \
-Wno-sign-compare
LOCAL_C_INCLUDES := \
external/mesa/src/gallium/include \
external/mesa/src/gallium/auxiliary
LOCAL_MODULE := libmesa_pipe_i915
include $(BUILD_STATIC_LIBRARY)
endif # MESA_BUILD_I915G

View File

@@ -55,7 +55,7 @@ i915_buffer_destroy(struct pipe_screen *screen,
{
struct i915_buffer *buffer = i915_buffer(resource);
if (buffer->free_on_destroy)
FREE(buffer->data);
align_free(buffer->data);
FREE(buffer);
}

View File

@@ -54,6 +54,7 @@ lp_jit_create_types(struct llvmpipe_context *lp)
elem_types[LP_JIT_TEXTURE_WIDTH] =
elem_types[LP_JIT_TEXTURE_HEIGHT] =
elem_types[LP_JIT_TEXTURE_DEPTH] =
elem_types[LP_JIT_TEXTURE_FIRST_LEVEL] =
elem_types[LP_JIT_TEXTURE_LAST_LEVEL] = LLVMInt32TypeInContext(lc);
elem_types[LP_JIT_TEXTURE_ROW_STRIDE] =
elem_types[LP_JIT_TEXTURE_IMG_STRIDE] =
@@ -81,6 +82,9 @@ lp_jit_create_types(struct llvmpipe_context *lp)
LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, depth,
gallivm->target, texture_type,
LP_JIT_TEXTURE_DEPTH);
LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, first_level,
gallivm->target, texture_type,
LP_JIT_TEXTURE_FIRST_LEVEL);
LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, last_level,
gallivm->target, texture_type,
LP_JIT_TEXTURE_LAST_LEVEL);

View File

@@ -50,6 +50,7 @@ struct lp_jit_texture
uint32_t width;
uint32_t height;
uint32_t depth;
uint32_t first_level;
uint32_t last_level;
uint32_t row_stride[LP_MAX_TEXTURE_LEVELS];
uint32_t img_stride[LP_MAX_TEXTURE_LEVELS];
@@ -66,6 +67,7 @@ enum {
LP_JIT_TEXTURE_WIDTH = 0,
LP_JIT_TEXTURE_HEIGHT,
LP_JIT_TEXTURE_DEPTH,
LP_JIT_TEXTURE_FIRST_LEVEL,
LP_JIT_TEXTURE_LAST_LEVEL,
LP_JIT_TEXTURE_ROW_STRIDE,
LP_JIT_TEXTURE_IMG_STRIDE,

View File

@@ -166,6 +166,7 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
return 0;
case PIPE_CAP_TGSI_INSTANCEID:
case PIPE_CAP_VERTEX_ELEMENT_INSTANCE_DIVISOR:
case PIPE_CAP_MIXED_COLORBUFFER_FORMATS:
return 1;
default:
return 0;

View File

@@ -653,6 +653,7 @@ lp_setup_set_fragment_sampler_views(struct lp_setup_context *setup,
jit_tex->width = tex->width0;
jit_tex->height = tex->height0;
jit_tex->depth = tex->depth0;
jit_tex->first_level = view->u.tex.first_level;
jit_tex->last_level = tex->last_level;
/* We're referencing the texture's internal data, so save a
@@ -663,7 +664,7 @@ lp_setup_set_fragment_sampler_views(struct lp_setup_context *setup,
if (!lp_tex->dt) {
/* regular texture - setup array of mipmap level pointers */
int j;
for (j = 0; j <= tex->last_level; j++) {
for (j = view->u.tex.first_level; j <= tex->last_level; j++) {
jit_tex->data[j] =
llvmpipe_get_texture_image_all(lp_tex, j, LP_TEX_USAGE_READ,
LP_TEX_LAYOUT_LINEAR);
@@ -677,6 +678,7 @@ lp_setup_set_fragment_sampler_views(struct lp_setup_context *setup,
jit_tex->width = TILE_SIZE/8;
jit_tex->height = TILE_SIZE/8;
jit_tex->depth = 1;
jit_tex->first_level = 0;
jit_tex->last_level = 0;
jit_tex->row_stride[j] = 0;
jit_tex->img_stride[j] = 0;

View File

@@ -269,7 +269,7 @@ llvmpipe_prepare_vertex_sampling(struct llvmpipe_context *lp,
if (!lp_tex->dt) {
/* regular texture - setup array of mipmap level pointers */
int j;
for (j = 0; j <= tex->last_level; j++) {
for (j = view->u.tex.first_level; j <= tex->last_level; j++) {
data[j] =
llvmpipe_get_texture_image_all(lp_tex, j, LP_TEX_USAGE_READ,
LP_TEX_LAYOUT_LINEAR);
@@ -293,7 +293,7 @@ llvmpipe_prepare_vertex_sampling(struct llvmpipe_context *lp,
draw_set_mapped_texture(lp->draw,
i,
tex->width0, tex->height0, tex->depth0,
tex->last_level,
view->u.tex.first_level, tex->last_level,
row_stride, img_stride, data);
}
}

View File

@@ -149,6 +149,7 @@ lp_llvm_texture_member(const struct lp_sampler_dynamic_state *base,
LP_LLVM_TEXTURE_MEMBER(width, LP_JIT_TEXTURE_WIDTH, TRUE)
LP_LLVM_TEXTURE_MEMBER(height, LP_JIT_TEXTURE_HEIGHT, TRUE)
LP_LLVM_TEXTURE_MEMBER(depth, LP_JIT_TEXTURE_DEPTH, TRUE)
LP_LLVM_TEXTURE_MEMBER(first_level, LP_JIT_TEXTURE_FIRST_LEVEL, TRUE)
LP_LLVM_TEXTURE_MEMBER(last_level, LP_JIT_TEXTURE_LAST_LEVEL, TRUE)
LP_LLVM_TEXTURE_MEMBER(row_stride, LP_JIT_TEXTURE_ROW_STRIDE, FALSE)
LP_LLVM_TEXTURE_MEMBER(img_stride, LP_JIT_TEXTURE_IMG_STRIDE, FALSE)
@@ -219,6 +220,7 @@ lp_llvm_sampler_soa_create(const struct lp_sampler_static_state *static_state,
sampler->dynamic_state.base.width = lp_llvm_texture_width;
sampler->dynamic_state.base.height = lp_llvm_texture_height;
sampler->dynamic_state.base.depth = lp_llvm_texture_depth;
sampler->dynamic_state.base.first_level = lp_llvm_texture_first_level;
sampler->dynamic_state.base.last_level = lp_llvm_texture_last_level;
sampler->dynamic_state.base.row_stride = lp_llvm_texture_row_stride;
sampler->dynamic_state.base.img_stride = lp_llvm_texture_img_stride;

View File

@@ -337,6 +337,7 @@ static int noop_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
case PIPE_CAP_TEXTURE_SHADOW_MAP:
case PIPE_CAP_TEXTURE_SWIZZLE:
case PIPE_CAP_BLEND_EQUATION_SEPARATE:
case PIPE_CAP_MIXED_COLORBUFFER_FORMATS:
return 1;
case PIPE_CAP_DUAL_SOURCE_BLEND:

Some files were not shown because too many files have changed in this diff Show More