Commit Graph

68505 Commits

Author SHA1 Message Date
Anuj Phogat 6960a3962c i965: Move the comment to the right place
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Neil Roberts <neil@linux.intel.com>
2015-02-25 14:11:37 -08:00
Anuj Phogat 524a729f68 i965: Fix condition to use Y tiling in blitter in intel_miptree_create()
Y tiling is supported in blitter on SNB+.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Neil Roberts <neil@linux.intel.com>
2015-02-25 14:11:32 -08:00
Anuj Phogat 688309374d meta: Pass null pointer for the pixel data to avoid unnecessary data upload
to a temporary pbo created in _mesa_meta_pbo_GetTexSubImage().

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Neil Roberts <neil@linux.intel.com>
2015-02-25 14:11:28 -08:00
Anuj Phogat 068ba4ac78 meta: Fix buffer object assignment to account for both pack and unpack bo's
create_texture_for_pbo() is shared by _mesa_meta_pbo_GetTexSubImage()
and _mesa_meta_pbo_TexSubImage() functions. So, we need to account
for both pack and unpack buffer objects.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Neil Roberts <neil@linux.intel.com>
2015-02-25 14:11:23 -08:00
Anuj Phogat 618c4c4b6a meta: Use GL_STREAM_READ for pbo created with GL_PIXEL_PACK_BUFFER
create_texture_for_pbo() is used by both _mesa_meta_pbo_GetTexSubImage()
and _mesa_meta_pbo_TexSubImage() functions with different PBO targets.
Use GL_STREAM_READ with GL_PIXEL_PACK_BUFFER and GL_STREAM_DRAW with
GL_PIXEL_UNPACK_BUFFER.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Neil Roberts <neil@linux.intel.com>
2015-02-25 14:11:14 -08:00
Anuj Phogat 8d6ae49a8b meta: Add assertion check for ctx->Meta->SaveStackDepth
before using it for derefrencing.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Neil Roberts <neil@linux.intel.com>
2015-02-25 14:10:59 -08:00
Anuj Phogat 0a4ea87344 meta: Do power of two samples check only for samples > 0
otherwise samples=0 passes the check, which is invalid.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Neil Roberts <neil@linux.intel.com>
2015-02-25 14:10:47 -08:00
Matt Turner cb25087c7b glsl: Rewrite and fix min/max to saturate optimization.
There were some bugs, and the code was really difficult to follow. We
would optimize

   min(max(x, b), 1.0) into max(sat(x), b)

but not pay attention to the order of min/max and also do

   max(min(x, b), 1.0) into max(sat(x), b)

Corrects four shaders from Champions of Regnum that do

   min(max(x, 1), 10)

and corrects rendering of Mass Effect under VMware Workstation.

Cc: "10.4 10.5" <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89180
Reviewed-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2015-02-25 08:44:49 -08:00
Rob Clark 864340219b freedreno: drop ARRAY_SIZE macro
Since now ARRAY_SIZE has been added to util/macros.h.  Fixes a bunch of:

  freedreno_util.h:79:0: warning: "ARRAY_SIZE" redefined
   #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
   ^
  In file included from ../../../../src/gallium/include/pipe/p_compiler.h:36:0,
                   from ../../../../src/gallium/include/pipe/p_context.h:31,
                   from freedreno_context.h:32,
                   from freedreno_context.c:29:
  ../../../../src/util/macros.h:29:0: note: this is the location of the previous definition
   #  define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x)))
   ^

Signed-off-by: Rob Clark <robclark@freedesktop.org>
2015-02-25 08:37:58 -05:00
Neil Roberts 67e3302497 i965: Don't force x-tiling for 16-bpp formats on Gen>7
Sandybridge doesn't support y-tiling for surface formats with 16 or
more bpp. There was previously an override to explicitly allow this
for Gen7. However, this restriction is also removed in Gen8+ so we
should use y-tiling there too.

This is important to do for Skylake which doesn't support x-tiling for
3D surfaces.

Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
2015-02-25 13:19:34 +00:00
Andreas Boll 6d164f65c5 glx: Fix returned values of GLX_RENDERER_PREFERRED_PROFILE_MESA
If the renderer supports the core profile the query returned incorrectly
0x8 as value, because it was using (1U << __DRI_API_OPENGL_CORE) for the
returned value.

The same happened with the compatibility profile. It returned 0x1
(1U << __DRI_API_OPENGL) instead of 0x2.

Internal DRI defines:
   dri_interface.h: #define __DRI_API_OPENGL       0
   dri_interface.h: #define __DRI_API_OPENGL_CORE  3

Those two bits are supposed for internal usage only and should be
translated to GLX_CONTEXT_CORE_PROFILE_BIT_ARB (0x1) for a preferred
core context profile and GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB (0x2)
for a preferred compatibility context profile.

This patch implements the above translation in the glx module.

v2: Fix the incorrect behavior in the glx module

Cc: "10.3 10.4 10.5" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Andreas Boll <andreas.boll.dev@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2015-02-25 08:23:38 +01:00
Andreas Boll 06924972d5 dri/common: Update comment about driQueryRendererIntegerCommon
Since 87d3ae0b45
driQueryRendererIntegerCommon handles __DRI2_RENDERER_PREFFERED_PROFILE
too.

Signed-off-by: Andreas Boll <andreas.boll.dev@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2015-02-25 08:23:33 +01:00
Ilia Mirkin 720ba6ca97 glsl: add double support for packing varyings
Doubles are always packed, but a single double will never cross a slot
boundary -- single slots can still be wasted in some situations.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2015-02-24 22:07:29 -05:00
Laura Ekstrand 546aba143d common: Fix PBOs for 1D_ARRAY.
Corrects the way that _mesa_meta_pbo_TexSubImage and
_mesa_meta_pbo_GetTexSubImage handle 1D_ARRAY textures.  Fixes a failure in
the Piglit arb_direct_state_access/gettextureimage-targets test.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Tested-by: Laura Ekstrand <laura@jlekstrand.net>

Cc: "10.4, 10.5" <mesa-stable@lists.freedesktop.org>
2015-02-24 17:33:44 -08:00
Laura Ekstrand ccc5ce6f72 common: Correct PBO 2D_ARRAY handling.
Changes PBO uploads and downloads to use a tall (height * depth) 2D texture
for blitting. This fixes the bug where 2D_ARRAY, 3D, and CUBE_MAP_ARRAY
textures are not properly uploaded and downloaded.

Removes the option to use a 2D ARRAY texture for the PBO during upload and
download.  This option didn't work because the miptree couldn't be set up
reliably.

v2: Review from Jason Ekstrand and Neil Roberts:
   -Delete the depth parameter from create_texture_for_pbo
   -Abandon the option to create a 2D ARRAY texture in create_texture_for_pbo

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>

Cc: "10.4, 10.5" <mesa-stable@lists.freedesktop.org>
2015-02-24 17:30:13 -08:00
Laura Ekstrand 06084652fe common: Correct texture init for meta pbo uploads and downloads.
This moves the line setting immutability for the texture to after
_mesa_initialize_texture_object so that the initializer function will not
cancel it out. Moreover, because of the ARB_texture_view extension, immutable
textures must have NumLayers > 0, or depth will equal (0-1)=0xFFFFFFFF during
SURFACE_STATE setup, which triggers assertions.

v2: Review from Kenneth Graunke:
   - Include more explanation in the commit message.
   - Make texture setup bug fixes into a separate patch.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>

Cc: "10.4, 10.5" <mesa-stable@lists.freedesktop.org>
2015-02-24 17:27:52 -08:00
Brian Paul 88ff8dee02 mesa: remove DEG2RAD macro
Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-02-24 17:10:28 -07:00
Brian Paul ab68219a59 mesa: remove MAX_GLUSHORT, move MAX_GLUINT
The later is only used in one place in swrast.

Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-02-24 17:10:28 -07:00
Brian Paul f847ddb64d mesa: move signbit() macro to c99_math.h
Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-02-24 17:10:28 -07:00
Brian Paul 612143b2d0 mesa: remove unused isblank() function
Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-02-24 17:10:28 -07:00
Brian Paul e033d2c642 glcpp: remove unneeded #include of core.h
isblank() is not used in the code.

Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-02-24 17:10:28 -07:00
Brian Paul 9fd7e9d831 mesa: remove sqrtf macro
Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-02-24 17:10:28 -07:00
Kenneth Graunke ee3f674572 i965: Remove redundant discard jumps.
With the previous optimization in place, some shaders wind up with
multiple discard jumps in a row, or jumps directly to the next
instruction.  We can remove those.

Without NIR on Haswell:
total instructions in shared programs: 5777258 -> 5775872 (-0.02%)
instructions in affected programs:     20312 -> 18926 (-6.82%)
helped:                                716

With NIR on Haswell:
total instructions in shared programs: 5773163 -> 5771785 (-0.02%)
instructions in affected programs:     21040 -> 19662 (-6.55%)
helped:                                717

v2: Use the CFG rather than the old instructions list.  Presumably
    the placeholder halt will be in the last basic block.

v3: Make sure placeholder_halt->prev isn't the head sentinel (caught
    twice by Eric Anholt).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2015-02-24 15:24:53 -08:00
Kenneth Graunke 30f51f1a1a glsl: Optimize "if (cond) discard;" to a conditional discard.
st_glsl_to_tgsi and ir_to_mesa have handled conditional discards for a
long time; the previous patch added that capability to i965.

i965 (Haswell) shader-db stats:

Without NIR:
total instructions in shared programs: 5792133 -> 5776360 (-0.27%)
instructions in affected programs:     737585 -> 721812 (-2.14%)
helped:                                6300
HURT:                                  68
GAINED:                                2

With NIR:
total instructions in shared programs: 5787538 -> 5769569 (-0.31%)
instructions in affected programs:     767843 -> 749874 (-2.34%)
helped:                                6522
HURT:                                  35
GAINED:                                6

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2015-02-24 15:24:53 -08:00
Kenneth Graunke 8eb6c10999 i965/fs: Handle conditional discards.
The discard condition tells us which channels we want killed.  We want
to invert that condition to get the channels that should survive (remain
live) in f0.1.  Emit a CMP to negate it.

Nothing generates these today, but that will change shortly.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2015-02-24 15:24:52 -08:00
Kenneth Graunke 8e62bd52f8 nir: Introduce nir_intrinsic_discard_if.
This is a conditional discard, which takes a boolean source.

Note that we don't generate ir_discard::condition today, so this
shouldn't break drivers (since none implement this intrinsic yet).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2015-02-24 15:24:52 -08:00
Kenneth Graunke 23d42b46e3 glsl: Delete dead discard conditions in constant folding.
opt_constant_folding() already detects conditional assignments where the
condition is constant, and either deletes the assignment or the
condition.

Make it handle discards in the same fashion.

Spotted happening in the wild in Tropico 5 shaders.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2015-02-24 15:24:52 -08:00
Kenneth Graunke d77b186871 glsl: Handle conditional discards in lower_discard_flow().
This pass wasn't prepared to handle conditional discards.

Instead of initializing the "discarded" temporary to "true", set it to
the condition.  Then, refer to the variable for the condition, to avoid
duplicating the expression tree.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2015-02-24 15:24:52 -08:00
Kenneth Graunke 44b45da994 glsl: Make ir_rvalue_visitor visit ir_discard::condition.
This was forgotten.

I omitted the NULL check since we don't check ir_assignment::condition
either.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2015-02-24 15:24:52 -08:00
Kenneth Graunke 926d8b0510 glsl: Make ir_validate check the type of ir_discard::condition.
Copy and pasted from the ir_if::condition handling, plus a NULL check.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2015-02-24 15:24:52 -08:00
Matt Turner 6f5604601c Revert "i965/fs: Remove force_writemask_all assertion for execsize < 8."
This reverts commit 0d8f27eab7.

"This doesn't seem to be necessary." <- I was wrong!

Tested-by: Markus Wick <markus@selfnet.de>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
2015-02-24 14:08:04 -08:00
Matt Turner 2c7a703b05 i965/fs: Emit MOV(1) instructions with force_writemask_all.
Fixes rendering with Dolphin.

Tested-by: Markus Wick <markus@selfnet.de>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
2015-02-24 14:08:04 -08:00
Matt Turner 467077b834 i965/fs: Optimize (gl_FrontFacing ? x : y) where x and y are ±1.0.
total instructions in shared programs: 5695356 -> 5689775 (-0.10%)
instructions in affected programs:     486231 -> 480650 (-1.15%)
helped:                                2604
LOST:                                  1
2015-02-24 14:08:04 -08:00
Matt Turner b8582d18e6 i965/fs/nir: Optimize integer multiply by a 16-bit constant.
Gen8+ support was just broken, since MUL now consumes 32-bits from both
sources. Fixes 986 piglit tests on my BDW.

total instructions in shared programs: 7753873 -> 7753522 (-0.00%)
instructions in affected programs:     28164 -> 27813 (-1.25%)
helped:                                77
GAINED:                                47

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2015-02-24 14:08:04 -08:00
Matt Turner 7a997a3863 i965/fs/nir: Optimize (gl_FrontFacing ? x : y) where x and y are ±1.0.
total instructions in shared programs: 7756214 -> 7753873 (-0.03%)
instructions in affected programs:     455452 -> 453111 (-0.51%)
helped:                                2333

Reviewed-by: Eric Anholt <eric@anholt.net>
2015-02-24 14:08:04 -08:00
Jason Ekstrand c750ecaa12 nir/register: Add a parent_instr field
This adds a parent_instr field similar to the one for ssa_def.  The
difference here is that the parent_instr field on a nir_register can be
NULL if the register does not have a unique definition or if that
definition does not dominate all its uses.  We set this field in the
out-of-SSA pass so that backends can get SSA-like information even after
they have gone out of SSA.

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2015-02-24 14:08:04 -08:00
Marek Olšák fc59695b92 st/mesa: remove unused/broken function st_print_shaders
Reviewed-by: Dave Airlie <airlied@redhat.com>
2015-02-24 22:59:57 +01:00
Brian Paul a86054bac7 st/mesa: remove struct qualifier from st_src_reg parameter
It's a class.  Silences MSVC warning.
2015-02-24 14:44:19 -07:00
Brian Paul a2b366b92c mesa: remove INV_SQRTF() macro
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-02-24 14:44:19 -07:00
Brian Paul bbb2d84032 mesa: remove ceilf, floorf macros
Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-02-24 14:44:19 -07:00
Brian Paul bdd0402ca3 mesa: remove expf macro
Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-02-24 14:44:19 -07:00
Brian Paul cffedcf163 mesa: remove logf macro
Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-02-24 14:44:19 -07:00
Brian Paul f5816d77e2 mesa: remove powf macro
Use the wrapper in c99_math.h if needed.

Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-02-24 14:44:19 -07:00
Brian Paul bad154e677 mesa: remove unused exp2f, log2f, truncf wrappers
Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-02-24 14:44:19 -07:00
Brian Paul aeabf4ede5 mesa: remove unused acosf, asinf, atan2f, etc. macros
Not used anywhere.  If any of these are needed, they should be added
to c99_math.h

Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-02-24 14:44:19 -07:00
Brian Paul bd7f7aac56 mesa: replace FABSF with fabsf
Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-02-24 14:44:19 -07:00
Brian Paul 46ce78d4c6 mesa: replace FLOORF with floorf
Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-02-24 14:44:19 -07:00
Brian Paul b2c13534f7 mesa: remove unused CEILF macro
Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-02-24 14:44:19 -07:00
Brian Paul 79b480ccc0 mesa: replace LOGF, EXPF with logf, expf
Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-02-24 14:44:19 -07:00
Brian Paul e25f7772ca mesa: replace FREXPF, LDEXPF with frexpf, ldexpf
Start getting rid of some imports.h macros.  Use the c99 functions instead.

Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-02-24 14:44:19 -07:00