mesa.git
11 years agoilo: honor render condition in blitter
Chia-I Wu [Tue, 25 Jun 2013 07:36:15 +0000 (15:36 +0800)]
ilo: honor render condition in blitter

Make pass_render_condition() available for blitter, and check for render
condition in (and only in) clear(), clear_render_target(), and
clear_depth_stencil().

11 years agoilo: remove ilo_shader_internal.h from GEN6 pipeline
Chia-I Wu [Tue, 25 Jun 2013 02:01:59 +0000 (10:01 +0800)]
ilo: remove ilo_shader_internal.h from GEN6 pipeline

Replace direct shader accesses with ilo_shader_get_kernel_param() and etc.

11 years agoilo: remove ilo_shader_internal.h from GEN7 pipeline
Chia-I Wu [Mon, 24 Jun 2013 15:54:49 +0000 (23:54 +0800)]
ilo: remove ilo_shader_internal.h from GEN7 pipeline

Replace direct shader accesses with ilo_shader_get_kernel_param() and etc.

11 years agoilo: speed up ilo_shader_select_kernel_routing() a bit
Chia-I Wu [Mon, 24 Jun 2013 08:26:25 +0000 (16:26 +0800)]
ilo: speed up ilo_shader_select_kernel_routing() a bit

Remember the order of the source attributes and avoid recomputation when it
does not change.

11 years agoilo: move SBE setup code to ilo_shader.c
Chia-I Wu [Mon, 24 Jun 2013 06:13:33 +0000 (14:13 +0800)]
ilo: move SBE setup code to ilo_shader.c

Add ilo_shader_select_kernel_routing() to construct 3DSTATE_SBE.  It is called
in ilo_finalize_states(), rather than in create_fs_state(), as it depends on
VS/GS and rasterizer states.

With this change, ilo_shader_internal.h is no longer needed for
ilo_gpe_gen6.c.

11 years agoilo: use ilo_shader_state exclusively in GPE
Chia-I Wu [Fri, 21 Jun 2013 06:29:08 +0000 (14:29 +0800)]
ilo: use ilo_shader_state exclusively in GPE

This allows us to remove ilo_shader_internal.h from ilo_gpe_gen7.c.  The
unfinished code in 3DSTATE_DS, 3DSTATE_HS, and INTERFACE_DESCRIPTOR_DATA are
partly or entirely removed.

11 years agoilo: map SO registers at shader compile time
Chia-I Wu [Fri, 21 Jun 2013 06:22:09 +0000 (14:22 +0800)]
ilo: map SO registers at shader compile time

The unmodified pipe_stream_output_info describes its outputs as if they are in
TGSI_FILE_OUTPUT.  Remap the register indices to where they appear in the VUE.

TGSI_SEMANTIC_PSIZE needs a little care because it is at the W channel.

11 years agoilo: use ilo_shader_cso for FS
Chia-I Wu [Fri, 21 Jun 2013 03:36:11 +0000 (11:36 +0800)]
ilo: use ilo_shader_cso for FS

Add ilo_gpe_init_fs_cso() to construct 3DSTATE_PS and shader part of
3DSTATE_WM once and early for fragment shaders.

11 years agoilo: use ilo_rasterizer_state exclusively in GPE
Chia-I Wu [Fri, 21 Jun 2013 04:30:23 +0000 (12:30 +0800)]
ilo: use ilo_rasterizer_state exclusively in GPE

Replace pipe_rasterizer_state by ilo_rasterizer_state for the remaining GPE
functions for consistency.

11 years agoilo: convert pipe_rasterizer_state to ilo_rasterizer_wm
Chia-I Wu [Fri, 21 Jun 2013 03:36:14 +0000 (11:36 +0800)]
ilo: convert pipe_rasterizer_state to ilo_rasterizer_wm

Add ilo_gpe_init_rasterizer_wm() to construct fixed-function part of
3DSTATE_WM once in create_rasterizer_state().

11 years agoilo: use ilo_shader_cso for GS
Chia-I Wu [Thu, 20 Jun 2013 09:42:21 +0000 (17:42 +0800)]
ilo: use ilo_shader_cso for GS

Add ilo_gpe_init_gs_cso() to construct 3DSTATE_GS once and early for geometry
shaders.

11 years agoilo: introduce ilo_shader_cso for VS
Chia-I Wu [Thu, 20 Jun 2013 08:34:25 +0000 (16:34 +0800)]
ilo: introduce ilo_shader_cso for VS

When a new VS kernel is generated, a newly added function,
ilo_gpe_init_vs_cso(), is called to construct 3DSTATE_VS command in
ilo_shader_cso.  When the command needs to be emitted later, we copy the
command from the CSO instead of constructing it dynamically.

11 years agoilo: add functions to query shaders
Chia-I Wu [Tue, 25 Jun 2013 04:12:09 +0000 (12:12 +0800)]
ilo: add functions to query shaders

Add ilo_shader_get_type() to query the type (PIPE_SHADER_x) of the shader.
Add ilo_shader_get_kernel_offset() and ilo_shader_get_kernel_param() to query
the cache offset and various kernel parameters of the selected kernel.

11 years agoilo: clean up finalize_shader_states()
Chia-I Wu [Thu, 20 Jun 2013 04:57:42 +0000 (12:57 +0800)]
ilo: clean up finalize_shader_states()

Add ilo_shader_select_kernel() to replace the dependency table,
ilo_shader_variant_init(), and ilo_shader_state_use_variant().

With the changes, we no longer need to include ilo_shader_internal.h in
ilo_state.c.

11 years agoilo: use multiple entry points for shader creation
Chia-I Wu [Thu, 20 Jun 2013 04:46:36 +0000 (12:46 +0800)]
ilo: use multiple entry points for shader creation

Replace ilo_shader_state_create() by

 ilo_shader_create_vs()
 ilo_shader_create_gs()
 ilo_shader_create_fs()
 ilo_shader_create_cs()

Rename ilo_shader_state_destroy() to ilo_shader_destroy().  The old
ilo_shader_destroy() is renamed to ilo_shader_destroy_kernel().

11 years agoilo: move internal shader interface to a new header
Chia-I Wu [Thu, 20 Jun 2013 03:52:03 +0000 (11:52 +0800)]
ilo: move internal shader interface to a new header

Move it to ilo_shader_internal.h.  The goal is to make files not part of the
compiler include only ilo_shader.h eventually.

11 years agogallium/hud: do not use free() for the free_query_data hook
Brian Paul [Mon, 24 Jun 2013 16:43:16 +0000 (10:43 -0600)]
gallium/hud: do not use free() for the free_query_data hook

That confuses Gallium's memory debugging code where CALLOC/MALLOC
must be matched with FREE, not free().

Reviewed-by: Marek Olšák <maraeo@gmail.com>
11 years agodraw: check for out-of-memory conditions in the AA line module.
Matthew McClure [Fri, 21 Jun 2013 19:44:44 +0000 (12:44 -0700)]
draw: check for out-of-memory conditions in the AA line module.

To prevent segfaults in the AA line module, the code will check for a
valid pointer to the aaline_stage in the draw context.

Fixes segfault from backtrace:

* aaline_stage_from_pipe
  aaline_delete_fs_state

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agotests/graw: Fix typo in shader-leak.c
José Fonseca [Mon, 24 Jun 2013 14:29:25 +0000 (15:29 +0100)]
tests/graw: Fix typo in shader-leak.c

11 years agotools/trace: Fix syntax.
José Fonseca [Mon, 24 Jun 2013 13:45:49 +0000 (14:45 +0100)]
tools/trace: Fix syntax.

Cleaned/commented up the code, but forgot to actually test before
commiting...

11 years agost/dri/sw: Fix pitch calculation in drisw_update_tex_buffer
Richard Sandiford [Tue, 18 Jun 2013 15:41:43 +0000 (16:41 +0100)]
st/dri/sw: Fix pitch calculation in drisw_update_tex_buffer

swrastGetImage rounds the pitch up to 4 bytes for compatibility reasons
that are explained in drisw_glx.c:bytes_per_line, so drisw_update_tex_buffer
must do the same.

Fixes window skew seen while running firefox over vnc on a 16-bit screen.

NOTE: This is a candidate for the stable branches.

[ajax: fixed typo in comment]

Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Signed-off-by: Richard Sandiford <rsandifo@linux.vnet.ibm.com>
11 years agogallium: Fix llvmpipe on big-endian machines
Adam Jackson [Mon, 24 Jun 2013 13:48:56 +0000 (09:48 -0400)]
gallium: Fix llvmpipe on big-endian machines

Squashed commit of the following:

commit 0857a7e105bfcbc4d1431b2cc56612094c747ca3
Author: Richard Sandiford <r.sandiford@uk.ibm.com>
Date:   Tue Jun 18 12:25:07 2013 -0400

    gallivm: Fix lp_build_rgba8_to_fi32_soa for big endian

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Richard Sandiford <r.sandiford@uk.ibm.com>
commit 0d65131649a8aa140e2db228ba779d685c4333e3
Author: Richard Sandiford <r.sandiford@uk.ibm.com>
Date:   Tue Jun 18 12:25:07 2013 -0400

    gallivm: Fix big-endian machines

    This adds a bit-shift count to the format table, and adds the concept of
    vector or bitwise alignment on gathers.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Richard Sandiford <r.sandiford@uk.ibm.com>
commit 9740bda9b7dc894b629ed38be9b51059ce90818f
Author: Richard Sandiford <r.sandiford@uk.ibm.com>
Date:   Tue Jun 18 12:25:07 2013 -0400

    llvmpipe: Fix convert_to_blend_type on big-endian

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Richard Sandiford <r.sandiford@uk.ibm.com>
commit ae037c2de0f029e4e99371c0de25560484f0d8df
Author: Richard Sandiford <r.sandiford@uk.ibm.com>
Date:   Tue Jun 18 12:25:06 2013 -0400

    util: Convert color pack to packed formats

    This fixes them on big-endian.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Richard Sandiford <r.sandiford@uk.ibm.com>
commit 5b05ac0c89ae092ea8ba5bba9f739708d7396b5c
Author: Richard Sandiford <r.sandiford@uk.ibm.com>
Date:   Tue Jun 18 12:25:06 2013 -0400

    graw-xlib: Convert to packed formats

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Richard Sandiford <r.sandiford@uk.ibm.com>
commit 51396e7d098cb6ff794391cf11afe4dbf86dbea0
Author: Richard Sandiford <r.sandiford@uk.ibm.com>
Date:   Tue Jun 18 12:25:06 2013 -0400

    format: Convert to packed formats

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Richard Sandiford <r.sandiford@uk.ibm.com>
commit 417b60bc66eb450e68a92ab0e47f76e292b385e6
Author: Adam Jackson <ajax@redhat.com>
Date:   Tue Jun 18 12:25:06 2013 -0400

    st/dri: Convert to packed formats

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Richard Sandiford <r.sandiford@uk.ibm.com>
commit 0934b2e022a5e0847d312c40734e2b44cac52fd8
Author: Richard Sandiford <r.sandiford@uk.ibm.com>
Date:   Tue Jun 18 12:25:06 2013 -0400

    st/xlib: Convert to packed formats

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Richard Sandiford <r.sandiford@uk.ibm.com>
commit a307ea3c3716a706963acce7966b5e405ba11db9
Author: Richard Sandiford <r.sandiford@uk.ibm.com>
Date:   Tue Jun 18 12:25:06 2013 -0400

    gbm: Convert to packed formats

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Richard Sandiford <r.sandiford@uk.ibm.com>
commit 53eebdd253e1960a645ea278f31d7ef6a6cf4aeb
Author: Richard Sandiford <r.sandiford@uk.ibm.com>
Date:   Tue Jun 18 12:25:06 2013 -0400

    tests: Convert to packed formats

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Richard Sandiford <r.sandiford@uk.ibm.com>
commit 2f77fe3ee524945eacd546efcac34f7799fb3124
Author: Adam Jackson <ajax@redhat.com>
Date:   Tue Jun 18 13:07:37 2013 -0400

    gallium: Document packed formats

Signed-off-by: Adam Jackson <ajax@redhat.com>
commit 1f1017159ce951f922210a430de9229f91f62714
Author: Richard Sandiford <r.sandiford@uk.ibm.com>
Date:   Tue Jun 18 12:25:06 2013 -0400

    gallium: Introduce 32-bit packed format names

    These are for interacting with buffers natively described in terms of
    bit shifts, like X11 visuals:

        uint32_t xyzw8888 = (x << 0) | (y << 8) | (z << 16) | (w << 24);

    Define these in terms of (endian-dependent) aliases to the array-style
    format names.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Richard Sandiford <r.sandiford@uk.ibm.com>
commit 6cc7ab1ee66ed668da78c1d951dfd7782b4e786a
Author: Adam Jackson <ajax@redhat.com>
Date:   Mon Jun 3 12:10:32 2013 -0400

    gallium: Document format name conventions

    v2:
    - Fix a channel name thinko (Michel Dänzer)
    - Elaborate on SCALED versus INT
    - Add links to DirectX and FOURCC docs

Signed-off-by: Adam Jackson <ajax@redhat.com>
commit df4d269e7fb62051a3c029b84147465001e5776e
Author: Adam Jackson <ajax@redhat.com>
Date:   Tue Jun 18 12:25:06 2013 -0400

    gallivm: Remove all notion of byte-swapping

Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
11 years agollvmpipe: fix wrong results for queries not in a scene
Roland Scheidegger [Thu, 20 Jun 2013 18:31:18 +0000 (20:31 +0200)]
llvmpipe: fix wrong results for queries not in a scene

The result isn't always 0 in this case (depends on query type),
so instead of special casing this just use the ordinary path (should result
in correct values thanks to initialization in query_begin/end), just
skipping the fence wait.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agogallium/docs: more documentation for pipe_resource::array_size
Brian Paul [Fri, 21 Jun 2013 19:25:42 +0000 (13:25 -0600)]
gallium/docs: more documentation for pipe_resource::array_size

It should never be zero and for cube/cube_arrays it should be a
multiple of six.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agosvga: minor cleanups, comments in svga_tgsi_insn.c
Brian Paul [Fri, 21 Jun 2013 22:24:55 +0000 (16:24 -0600)]
svga: minor cleanups, comments in svga_tgsi_insn.c

11 years agosvga: add null ptr check in svga_get_tex_sampler_view()
Brian Paul [Fri, 21 Jun 2013 22:09:05 +0000 (16:09 -0600)]
svga: add null ptr check in svga_get_tex_sampler_view()

Trivial.

11 years agotools/trace: Several tweaks/fixes to dump_state
José Fonseca [Sat, 22 Jun 2013 11:30:12 +0000 (12:30 +0100)]
tools/trace: Several tweaks/fixes to dump_state

11 years agotrace: Dump result of create_stream_output_target
José Fonseca [Sat, 22 Jun 2013 11:26:10 +0000 (12:26 +0100)]
trace: Dump result of create_stream_output_target

11 years agovl/mpeg12: fix mpeg-1 bytestream parsing
Maarten Lankhorst [Sat, 22 Jun 2013 07:33:52 +0000 (09:33 +0200)]
vl/mpeg12: fix mpeg-1 bytestream parsing

This fixes the bytestream parsing of mpeg-1 stream, but still leaves
open a number of issues with the interpretation:
- IDCT mismatch control is not correct for MPEG-1.
- Slices do not have to start and end on the same horizontal row of macroblocks.
- picture_coding_type = 4 (D-pictures) is not handled.
- full_pel_*_vector is not handled.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
11 years agofreedreno/a3xx/compiler: ensure min # of cycles after bary instr
Rob Clark [Fri, 21 Jun 2013 19:05:12 +0000 (15:05 -0400)]
freedreno/a3xx/compiler: ensure min # of cycles after bary instr

The results of a bary.f do not appear to be immediatley available, but
there is no explicit sync bit.  Instead the compiler must just ensure
that there are a minimum number of instructions following the bary
before use of the result of the bary.  We aren't clever enough for that
so just throw in some nop's.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
11 years agofreedreno/a3xx/compiler: add TGSI_OPCODE_ABS
Rob Clark [Fri, 21 Jun 2013 19:01:49 +0000 (15:01 -0400)]
freedreno/a3xx/compiler: add TGSI_OPCODE_ABS

Signed-off-by: Rob Clark <robclark@freedesktop.org>
11 years agofreedreno/a3xx/compiler: add TGSI_OPCODE_DPH
Rob Clark [Fri, 21 Jun 2013 19:01:15 +0000 (15:01 -0400)]
freedreno/a3xx/compiler: add TGSI_OPCODE_DPH

Signed-off-by: Rob Clark <robclark@freedesktop.org>
11 years agofreedreno/a3xx/compiler: fix for replicating instructions
Rob Clark [Fri, 21 Jun 2013 18:39:54 +0000 (14:39 -0400)]
freedreno/a3xx/compiler: fix for replicating instructions

If we are accumulating result into tmp.x, and need a mov to final
destination, we want to move the .x component into all of the components
enabled from the read dest's writemask, ie. we want:

  MOV dst.xyzw tmp.xxxx

rather than:

  MOV dst.xyzw tmp.xyzw

Signed-off-by: Rob Clark <robclark@freedesktop.org>
11 years agomesa: Move the common _mesa_glsl_compile_shader() code to glsl/.
Eric Anholt [Wed, 12 Jun 2013 22:49:43 +0000 (15:49 -0700)]
mesa: Move the common _mesa_glsl_compile_shader() code to glsl/.

This code had no relation to ir_to_mesa.cpp, since it was also used by
intel and state_tracker, and most of it was duplicated with the standalone
compiler (which has periodically drifted from the Mesa copy).

v2: Split from the ir_to_mesa to shaderapi.c changes.

Acked-by: Paul Berry <stereotype441@gmail.com> (v1)
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agomesa: Move shader compiler API code to shaderapi.c
Eric Anholt [Wed, 19 Jun 2013 23:00:23 +0000 (16:00 -0700)]
mesa: Move shader compiler API code to shaderapi.c

There was nothing ir_to_mesa-specific about this code, but it's not
exactly part of the compiler's core turning-source-into-IR job either.

v2: Split from the ir_to_mesa to glsl/ commit, avoid renaming the sh
    variable.

Acked-by: Paul Berry <stereotype441@gmail.com> (v1)
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agomesa: Fix missing setting of shader->IsES.
Eric Anholt [Thu, 13 Jun 2013 17:24:36 +0000 (10:24 -0700)]
mesa: Fix missing setting of shader->IsES.

I noticed this while trying to merge code with the builtin compiler, which
does set it.

Note that this causes two regressions in piglit in
default-precision-sampler.* which try to link without a vertex or fragment
shader, due to being run under the desktop glslparsertest binary (using
ARB_ES3_compatibility) that doesn't know about this requirement.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agomesa: Use shared code for converting shader targets to short strings.
Eric Anholt [Wed, 12 Jun 2013 23:57:11 +0000 (16:57 -0700)]
mesa: Use shared code for converting shader targets to short strings.

We were duplicating this code all over the place, and they all would need
updating for the next set of shader targets.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoglsl: Remove ir_print_visitor.h includes and usage
Eric Anholt [Wed, 12 Jun 2013 23:21:28 +0000 (16:21 -0700)]
glsl: Remove ir_print_visitor.h includes and usage

We have ir->print() to do the old declaration of a visitor and having the
IR accept the visitor (yuck!).  And now you can call _mesa_print_ir()
safely anywhere that you know what an ir_instruction is.

A couple of missing printf("\n")s are added in error paths -- when an
expression is handed to the visitor, it doesn't print '\n' (since it might
be a step in printing a whole expression tree).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoglsl: Make _mesa_print_ir() available from anything including ir.h.
Eric Anholt [Wed, 12 Jun 2013 23:10:33 +0000 (16:10 -0700)]
glsl: Make _mesa_print_ir() available from anything including ir.h.

No more forgetting to #include "ir_print_visitor.h" when doing temporary
debug code, or forgetting and leaving it in after removing your temporary
debug code.  Also, available from C code so you don't need to move the
caller to C++ just to call it (see also: ir_to_mesa.cpp).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoglsl: Make some files safe to include from C
Paul Berry [Fri, 22 Mar 2013 20:29:55 +0000 (13:29 -0700)]
glsl: Make some files safe to include from C

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agotools/trace: Quick instructions/notes.
José Fonseca [Fri, 21 Jun 2013 10:12:31 +0000 (11:12 +0100)]
tools/trace: Quick instructions/notes.
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agotools/trace: Do a better job at comparing multi line strings.
José Fonseca [Fri, 21 Jun 2013 10:08:56 +0000 (11:08 +0100)]
tools/trace: Do a better job at comparing multi line strings.

For TGSI diffing.
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agotools/trace: Tool to compare json state dumps.
José Fonseca [Thu, 20 Jun 2013 18:40:47 +0000 (19:40 +0100)]
tools/trace: Tool to compare json state dumps.

Copied verbatim from apitrace's scripts/jsondiff.py
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agotools/trace: Tool to dump gallium state at any draw call.
José Fonseca [Thu, 20 Jun 2013 18:40:06 +0000 (19:40 +0100)]
tools/trace: Tool to dump gallium state at any draw call.

Based from the code from the good old python state tracker.

Extremely handy to diagnose regressions in state trackers.
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agotools/trace: Defer blob hex-decoding.
José Fonseca [Thu, 20 Jun 2013 18:38:55 +0000 (19:38 +0100)]
tools/trace: Defer blob hex-decoding.

To speed up parsing.
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agotrace: Don't dump texture transfers.
José Fonseca [Thu, 20 Jun 2013 18:37:31 +0000 (19:37 +0100)]
trace: Don't dump texture transfers.

Huge trace files with little value.
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agoilo: replace a boolean by bool
Chia-I Wu [Thu, 20 Jun 2013 03:38:28 +0000 (11:38 +0800)]
ilo: replace a boolean by bool

bool is used internally.  This is just cosmetic.

11 years agoilo: rename cache_seqno to uploaded
Chia-I Wu [Thu, 20 Jun 2013 03:36:36 +0000 (11:36 +0800)]
ilo: rename cache_seqno to uploaded

It has been used as a bool since shader cache rework.

11 years agoutil: (trivial) add has_popcnt field
Roland Scheidegger [Wed, 19 Jun 2013 21:46:15 +0000 (23:46 +0200)]
util: (trivial) add has_popcnt field

Not used yet but there's a couple of places in llvmpipe which should use this
(occlusion count is currently very inefficent if there's no cpu popcnt
instruction).

11 years agollvmpipe: use 64bit counter for occlusion queries
Roland Scheidegger [Wed, 19 Jun 2013 21:42:28 +0000 (23:42 +0200)]
llvmpipe: use 64bit counter for occlusion queries

Some APIs require 64bit and at least for 64bit archs the overhead
should be minimal.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agollvmpipe: handle more queries
Roland Scheidegger [Wed, 19 Jun 2013 21:38:39 +0000 (23:38 +0200)]
llvmpipe: handle more queries

Handle PIPE_QUERY_GPU_FINISHED and PIPE_QUERY_TIMESTAMP_DISJOINT, and
also fill out the ps_invocations and c_primitives from the
PIPE_QUERY_PIPELINE_STATISTICS (the others in there should already
be handled). Note that ps_invocations isn't pixel exact, just 16 pixel
exact but I guess it's better than nothing.
Doesn't really seem to work correctly but there's probably bugs elsewhere.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agosoftpipe: handle all queries, and change for the new disjoint semantics
Roland Scheidegger [Tue, 18 Jun 2013 21:27:31 +0000 (23:27 +0200)]
softpipe: handle all queries, and change for the new disjoint semantics

The driver can do render_condition but wasn't handling the occlusion
and so_overflow predicates (though the latter might not work yet due
to gs support).

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agogallium: fix PIPE_QUERY_TIMESTAMP_DISJOINT
Roland Scheidegger [Wed, 19 Jun 2013 21:25:39 +0000 (23:25 +0200)]
gallium: fix PIPE_QUERY_TIMESTAMP_DISJOINT

The semantics didn't really make sense, not really matching neither d3d9
(though the docs are all broken there) nor d3d10. So make it match d3d10
semantics, which actually gives meaning to the "disjoint" part.
Drivers are fixed up in a very primitive way, I have no idea what could
actually cause the counter to become unreliable so just always return
FALSE for the disjoint part.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agotrace: Dump pipe_rasterizer_state::clip_halfz.
José Fonseca [Mon, 10 Jun 2013 08:47:00 +0000 (09:47 +0100)]
trace: Dump pipe_rasterizer_state::clip_halfz.

Trivial.

11 years agosvga: add some comments about primitive conversion
Brian Paul [Wed, 19 Jun 2013 16:39:43 +0000 (10:39 -0600)]
svga: add some comments about primitive conversion

And clean up the svga_translate_prim() function with better
variable names.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agoindices: add some comments
Brian Paul [Wed, 19 Jun 2013 16:39:43 +0000 (10:39 -0600)]
indices: add some comments

This is pretty complicated code with few/any comments.  Here's a first stab.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agosvga: reindent svga_tgsi.c
Brian Paul [Wed, 19 Jun 2013 16:39:43 +0000 (10:39 -0600)]
svga: reindent svga_tgsi.c

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agosvga: whitespace, comment, formatting fixes in svga_tgsi_emit.h
Brian Paul [Wed, 19 Jun 2013 16:39:43 +0000 (10:39 -0600)]
svga: whitespace, comment, formatting fixes in svga_tgsi_emit.h

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agosvga: move some svga/tgsi functions
Brian Paul [Wed, 19 Jun 2013 16:39:43 +0000 (10:39 -0600)]
svga: move some svga/tgsi functions

Move some functions from the svga_tgsi_insn.h header into the
svga_tgsi_insn.c file since they're only used there.  Plus, add
comments and fix formatting.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agosvga: formatting fixes in svga_tgsi_insn.c
Brian Paul [Wed, 19 Jun 2013 16:39:43 +0000 (10:39 -0600)]
svga: formatting fixes in svga_tgsi_insn.c

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agomesa: wrap comments, code to 78 columns in multisample.c
Brian Paul [Wed, 19 Jun 2013 16:39:43 +0000 (10:39 -0600)]
mesa: wrap comments, code to 78 columns in multisample.c

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agomesa: remove unused BITSET64 macros
Brian Paul [Wed, 19 Jun 2013 16:39:43 +0000 (10:39 -0600)]
mesa: remove unused BITSET64 macros

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agonvc0: kill assert in ppp code
Maarten Lankhorst [Wed, 19 Jun 2013 11:08:51 +0000 (13:08 +0200)]
nvc0: kill assert in ppp code

It's no longer always true, and the video tilign aligment should
ensure the alignment is handled correctly regardless.

11 years agoilo: rework shader cache
Chia-I Wu [Wed, 19 Jun 2013 01:56:05 +0000 (09:56 +0800)]
ilo: rework shader cache

The new code makes the shader cache manages all shaders and be able to upload
all of them to a caller-provided bo as a whole.

Previously, we uploaded only the bound shaders.  When a different set of
shaders is bound, we had to allocate a new kernel bo to upload if the current
one is busy.

11 years agonv50: avoid crash on updating RASTERIZE_ENABLE state
Emil Velikov [Tue, 18 Jun 2013 22:02:24 +0000 (00:02 +0200)]
nv50: avoid crash on updating RASTERIZE_ENABLE state

When doing blit using the 3D engine, the rasterizer cso may be NULL.

Ported from nvc0 commit 8aa8b0539.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
11 years agowayland: Handle global_remove event as well
Kristian Høgsberg [Tue, 18 Jun 2013 20:53:46 +0000 (16:53 -0400)]
wayland: Handle global_remove event as well

We need to set up a handler for the global_remove event that gets sent
out when a global gets removed.  Without the handler we end up calling
a NULL pointer.

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

NOTE: This is a candidate for the stable branches.

Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
11 years agogen7: fix GPU hang on WebGL texture-size test
Jordan Justen [Mon, 17 Jun 2013 21:05:21 +0000 (14:05 -0700)]
gen7: fix GPU hang on WebGL texture-size test

When rendering to a texture with BaseLevel set, the miptree may be laid
out such that BaseLevel is in level 0 of the miptree (to avoid wasting
memory on unused levels between 0 and BaseLevel-1).  In that case, we
have to shift our render target's level down to the appropriate level of
the smaller miptree.

The WebGL test in combination with a meta code relating to
glGenerateMipmap also triggered a similar failure scenario.

This GPU hang regression was introduced by c754f7a8.

Bugzilla: http://bugs.freedesktop.org/show_bug.cgi?id=65324
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agointel: Remove unused IS_POWER_OF_TWO() macro.
Eric Anholt [Tue, 11 Jun 2013 22:59:07 +0000 (15:59 -0700)]
intel: Remove unused IS_POWER_OF_TWO() macro.

The is_power_of_two() inline function has been used instead.

Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agoRevert "draw: clear the draw buffers in draw"
Zack Rusin [Tue, 18 Jun 2013 01:06:11 +0000 (21:06 -0400)]
Revert "draw: clear the draw buffers in draw"

This reverts commit 41966fdb3b71c0b70aeb095e0eb3c5626c144a3a.
While it's a lot cleaner it causes regressions because
the draw interface is always called from the draw functions
of the drivers (because the buffers need to be mapped) which
means that the stream output buffers endup being cleared on
every draw rather than on setting.

Signed-off-by: Zack Rusin <zackr@vmware.com>
11 years agollvmpipe: fixes for conditional rendering
Roland Scheidegger [Mon, 17 Jun 2013 22:42:31 +0000 (00:42 +0200)]
llvmpipe: fixes for conditional rendering

honor render_condition for clear_render_target and clear_depth_stencil.
Also add minimal support for occlusion predicate, though it can't be active
at the same time as an occlusion query yet.
While here also switchify some large if-else (actually just mutually
exclusive if-if-if...) constructs.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agogallium: add condition parameter to render_condition
Roland Scheidegger [Fri, 14 Jun 2013 17:48:57 +0000 (19:48 +0200)]
gallium: add condition parameter to render_condition

For conditional rendering this makes it possible to skip rendering
if either the predicate is true or false, as supported by d3d10
(in fact previously it was sort of implied skip rendering if predicate
is false for occlusion predicate, and true for so_overflow predicate).
There's no cap bit for this as presumably all drivers could do it trivially
(but this patch does not implement it for the drivers using true
hw predicates, nvxx, r600, radeonsi, no change is expected for OpenGL
functionality).

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agoilo: construct depth/stencil command in create_surface()
Chia-I Wu [Tue, 18 Jun 2013 04:33:15 +0000 (12:33 +0800)]
ilo: construct depth/stencil command in create_surface()

Add ilo_gpe_init_zs_surface() to construct

 3DSTATE_DEPTH_BUFFER
 3DSTATE_STENCIL_BUFFER
 3DSTATE_HIER_DEPTH_BUFFER

at surface creation time.  This allows fast state emission in draw_vbo().

11 years agointel: Allow blorp CopyTexSubImage to nonzero destination slices.
Eric Anholt [Tue, 4 Jun 2013 17:35:26 +0000 (10:35 -0700)]
intel: Allow blorp CopyTexSubImage to nonzero destination slices.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agointel: Allow blit CopyTexSubImage to nonzero destination slices.
Eric Anholt [Mon, 3 Jun 2013 22:57:23 +0000 (15:57 -0700)]
intel: Allow blit CopyTexSubImage to nonzero destination slices.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agointel: Directly implement blit glBlitFramebuffer instead of awkward reuse.
Eric Anholt [Tue, 4 Jun 2013 03:50:50 +0000 (20:50 -0700)]
intel: Directly implement blit glBlitFramebuffer instead of awkward reuse.

This gets us support for blitting to attachment types other than
textures.

v2: fix up comments from review by Kenneth.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
11 years agointel: Move XRGB->ARGB blit logic into intel_miptree_blit().
Eric Anholt [Tue, 4 Jun 2013 05:55:39 +0000 (22:55 -0700)]
intel: Move XRGB->ARGB blit logic into intel_miptree_blit().

Now any caller (such as glCopyPixels()) can benefit from it, and it only
changes the correct subset of the destination instead of a whole teximage.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agointel: Fix Y tiling support for glCopyTexSubImage's alpha override.
Eric Anholt [Tue, 4 Jun 2013 05:40:26 +0000 (22:40 -0700)]
intel: Fix Y tiling support for glCopyTexSubImage's alpha override.

Apparently we don't have any piglit tests for this, because it would have
assertion failed in a debug build, or just rendered wrong in a non-debug
build if the destination wasn't covering whole tiles.

v2: Use the new macros.

Reviewed-by: Paul Berry <stereotype441@gmail.com> (v1)
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v1)
11 years agointel: Make batch macros for doing BCS_SWCTRL setup.
Eric Anholt [Mon, 3 Jun 2013 23:49:40 +0000 (16:49 -0700)]
intel: Make batch macros for doing BCS_SWCTRL setup.

We're going to add more BCS_SWCTRL setup instances soon, and you have to
be careful to have the set and restore atomic with the rendering that's
done, so that our state doesn't leak out to other rendering processes.

v2: Rewrite the patch to have batch begin/advance macros so that magic
    numbers don't get sprinkled around (and so you don't mix up your
    do-I-need-to-reset vs what-do-I-reset-to logic, which I nearly did in
    the next patch when first writing it)

Acked-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agomesa: Hide weirdness of 1D_ARRAY textures from Driver.CopyTexSubImage().
Eric Anholt [Mon, 3 Jun 2013 22:12:49 +0000 (15:12 -0700)]
mesa: Hide weirdness of 1D_ARRAY textures from Driver.CopyTexSubImage().

Intel had brokenness here, and I'd like to continue moving Mesa toward
hiding 1D_ARRAY's ridiculousness inside of the core, like we did with
MapTextureImage.  Fixes copyteximage 1D_ARRAY on intel.

There's still an impedance mismatch in meta when falling back to read and
texsubimage, since texsubimage expects coordinates into 1D_ARRAY as
(width, slice, 0) instead of (width, 0, slice).

v2: Fix offset of scanline reads from the source. (Thanks Brian!), replace
    dd.h comment with Paul's text and replace early exit with an assert.

Reviewed-by: Brian Paul <brianp@vmware.com> (v1)
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v1)
Reviewed-by: Paul Berry <stereotype441@gmail.com> (v1)
11 years agotgsi: text parser: fix parsing of array in declaration
Dave Airlie [Sun, 16 Jun 2013 11:24:00 +0000 (21:24 +1000)]
tgsi: text parser: fix parsing of array in declaration

I noticed this code didn't work as advertised while doing some passing around
of TGSI shaders and trying to reparse them, and things failing.

This seems to fix it here for at least the small test case I hacked into a
graw test.

Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agomesa: Fix ieee fp on Alpha
Sven Joachim [Fri, 14 Jun 2013 20:10:33 +0000 (22:10 +0200)]
mesa: Fix ieee fp on Alpha

Commit 1f82bf12ed inadvertently broke it, checking for __IEEE_FLOAT on all
Alpha machines instead of only on VMS as before.

NOTE: This is a candidate for the 9.1 branch.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Andreas Boll <andreas.boll.dev@gmail.com>
Signed-off-by: Sven Joachim <svenjoac@gmx.de>
11 years agost/xlib: Fix XImage stride calculation
Richard Sandiford [Mon, 17 Jun 2013 16:13:25 +0000 (12:13 -0400)]
st/xlib: Fix XImage stride calculation

Fixes window skew seen while running gnome on a 16-bit screen over vnc.

NOTE: This is a candidate for stable release branches.

Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Richard Sandiford <rsandifo@linux.vnet.ibm.com>
11 years agost/xlib Fix XIMage bytes-per-pixel calculation
Richard Sandiford [Mon, 17 Jun 2013 16:10:49 +0000 (12:10 -0400)]
st/xlib Fix XIMage bytes-per-pixel calculation

Fixes a crash seen while running gnome on a 16-bit screen over vnc.

NOTE: This is a candidate for stable release branches.

Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Richard Sandiford <rsandifo@linux.vnet.ibm.com>
11 years agogallium: replace bswap_32 calls with util_bswap32
Jonathan Gray [Sun, 16 Jun 2013 15:11:01 +0000 (01:11 +1000)]
gallium: replace bswap_32 calls with util_bswap32

byteswap.h and bswap_32 aren't portable, replace them with calls to
gallium's util_bswap32 as suggested by Mark Kettenis.  Lets these files
build on OpenBSD.

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
11 years agodraw: fix a regression in computing max elt
Zack Rusin [Thu, 13 Jun 2013 17:34:57 +0000 (13:34 -0400)]
draw: fix a regression in computing max elt

gl can use elts without setting indices, in which case
our eltMax was set to 0 and always invoking the overflow
condition. So by default set eltMax to maximum, it will
be curbed by draw_set_indexes (if it ever comes) and if
not then it will let gl's glVertexPointer/glDrawArrays
work correctly. Fixes piglit's
triangle-rasterization-overdraw test.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agodraw: clear the draw buffers in draw
Zack Rusin [Thu, 13 Jun 2013 21:57:47 +0000 (17:57 -0400)]
draw: clear the draw buffers in draw

Moves clearing of the draw so target buffers to the draw
module. They had to be cleared in the drivers before
which was quite messy.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agoilo: add pipe-based copy method to ilo_blitter
Chia-I Wu [Mon, 17 Jun 2013 06:17:10 +0000 (14:17 +0800)]
ilo: add pipe-based copy method to ilo_blitter

It enables accelerated resource_copy_region() when blt-based method fails.

11 years agoilo: add BLT-based blitting methods to ilo_blitter
Chia-I Wu [Mon, 17 Jun 2013 05:59:51 +0000 (13:59 +0800)]
ilo: add BLT-based blitting methods to ilo_blitter

Port BLT code in ilo_blit.c to BLT-based blitting methods of ilo_blitter.  Add
BLT-based clears.  The latter is verifed with util_clear(), but it is not in
use yet.

11 years agoilo: replace util_blitter by ilo_blitter
Chia-I Wu [Mon, 17 Jun 2013 04:24:17 +0000 (12:24 +0800)]
ilo: replace util_blitter by ilo_blitter

ilo_blitter is just a wrapper for util_blitter for now.  We will port BLT code
to ilo_blitter shortly.

11 years agoi965: Assume flexible hardware primitive restart exists in the future.
Kenneth Graunke [Sat, 26 Jan 2013 10:06:08 +0000 (02:06 -0800)]
i965: Assume flexible hardware primitive restart exists in the future.

Primitive restart with an arbitrary cut index was first supported as of
Haswell.  It's very doubtful that they'd take that away in future
hardware, so we may as well alter the check now.

11 years agoi965: Shrink Gen5 VUE map layout to be the same as Gen4.
Chris Forbes [Fri, 7 Jun 2013 18:11:44 +0000 (06:11 +1200)]
i965: Shrink Gen5 VUE map layout to be the same as Gen4.

The PRM suggests a larger layout, mostly to support having
gl_ClipDistance[] somewhere predictable for the fixed-function clipper
-- but it didn't actually arrive in Gen5.

Just use the same layout for both Gen4 and Gen5.

No Piglit regressions.

Improves performance in CS:S Video Stress Test by ~3%.

V2: - Remove now-useless function for determining the SF URB read offset
    - Remove now-unused BRW_VARYING_SLOT_POS_DUPLICATE

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Implement 16-wide math on G45 and Ironlake.
Kenneth Graunke [Sat, 30 Mar 2013 07:15:54 +0000 (00:15 -0700)]
i965: Implement 16-wide math on G45 and Ironlake.

[chrisf:]
Improves performance in CS:S video stress test by about 2%.
No piglit regressions on Ironlake.

Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
11 years agoglsl: Disallow return with a void argument from void functions.
Matt Turner [Wed, 22 May 2013 21:57:04 +0000 (14:57 -0700)]
glsl: Disallow return with a void argument from void functions.

NOTE: This is a candidate for the stable branches.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Allow implicit conversion of return values.
Matt Turner [Wed, 22 May 2013 19:14:32 +0000 (12:14 -0700)]
glsl: Allow implicit conversion of return values.

Required by ARB_shading_language_420pack.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Add gl_{Max,Min}ProgramTexelOffset built-in constants.
Matt Turner [Wed, 22 May 2013 17:56:25 +0000 (10:56 -0700)]
glsl: Add gl_{Max,Min}ProgramTexelOffset built-in constants.

Required by ARB_shading_language_420pack. Note that the 420pack spec
incorrectly specifies their values as (Min, Max) = (-7, 8) when they
should be (-8, 7) as listed in the GLSL 4.30 and ESSL 3.0 specs.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Allow swizzles on scalars.
Matt Turner [Mon, 20 May 2013 18:01:37 +0000 (11:01 -0700)]
glsl: Allow swizzles on scalars.

Required by ARB_shading_language_420pack.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Allow .length() method on vectors and matrices.
Matt Turner [Mon, 20 May 2013 16:18:01 +0000 (09:18 -0700)]
glsl: Allow .length() method on vectors and matrices.

Required by ARB_shading_language_420pack.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agomesa: Add infrastructure for ARB_shading_language_420pack.
Todd Previte [Mon, 20 May 2013 15:41:18 +0000 (08:41 -0700)]
mesa: Add infrastructure for ARB_shading_language_420pack.

v2 [mattst88]
  - Split infrastructure into separate patch.
  - Add preprocessor #define.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoilo: fix for half-float vertex arrays
Chia-I Wu [Fri, 14 Jun 2013 16:56:17 +0000 (00:56 +0800)]
ilo: fix for half-float vertex arrays

Commit 6fe0453c339b6e894e0ee8d2200e7638a43ed21e broke half-float vertex
arrays.  This reverts a part of that commit, and explains why.

11 years agoilo: add some assertions to help debugging
Chia-I Wu [Fri, 14 Jun 2013 07:35:36 +0000 (15:35 +0800)]
ilo: add some assertions to help debugging

Assert that we do not support user vertex/index/constant buffers.  Issue a
warning when a sampler view is created for a resource without
PIPE_BIND_SAMPLER_VIEW.