freedreno/a3xx: fix TOTALATTRTOVS

In cases where varying fetches are optimized away (just pass-through in
vertex shader, but unused in fragment shader) we need to calculate the
correct TOTALATTROVS based on the actual number of varyings fetched,
otherwise lockup.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
util/u_debug: Pass correct size to strncat.

Courtesy of Clang static analyzer.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
mesa/st: Fix pipe_framebuffer_state::height for PIPE_TEXTURE_1D_ARRAY.

This prevents buffer overflow w/ llvmpipe when running piglit

  bin/gl-3.2-layered-rendering-clear-color-all-types 1d_array single_level -fbo -auto

v2: Compute the framebuffer size as the minimum size, as pointed out by
Brian;  compacted code;  ran piglit quick test list (with no
regressions.)

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
mesa/st: Handle empty frame-buffers without asserting.

Fixes assertion failures with radeonsi.

Tested-by: Marek Olšák <maraeo@gmail.com>
gallivm: Fix wrong operator in lp_exec_default.

Courtesy of MSVC static code analyser.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
swrast: Fix vertex color in _swsetup_Translate()

Straightforward fix to properly load dest->color with color data, as
opposed to position data as previously implemented.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=27499
Cc: "10.1" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
swrast: allocate swrast_texture_image::ImageSlices array if needed

Fixes a segmentation fault in conform divzero.c test.
This happens when glTexImage(level, width=0, height=0) is called.  We
don't allocate texture memory in that case so the ImageSlices array
was never allocated.

Cc: "10.1" <mesa-stable@lists.freedesktop.org>

Reviewed-by: José Fonseca <jfonseca@vmware.com>
swrast: remove _mesa_ prefix from static function

And add a const qualifier.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
swrast: move null pointer check earlier in _swrast_map_teximage()

There's no reason to compute texel size, stride, etc. if there's no
image data to map.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
swrast: move texture_slices() calls out of loops

Reviewed-by: José Fonseca <jfonseca@vmware.com>
docs: fix typo in 10.1.1 release notes URL
draw/llvm: reduce memory usage

Lets make draw_get_option_use_llvm function available unconditionally
and use it to avoid useless allocations when LLVM paths are active.
TGSI machine is never used when we're using LLVM.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
st/xlib: Honour request of 3.1 contexts through core profile where available.

The GLX_ARB_create_context_profile spec says:

    "If version 3.1 is requested, the context returned may implement
    any of the following versions:

      * Version 3.1. The GL_ARB_compatibility extension may or may not
        be implemented, as determined by the implementation.

      * The core profile of version 3.2 or greater."

Mesa does not support GL_ARB_compatibility, and there are no plans to
ever support it, therefore the only chance to honour a 3.1 context is
through core profile, i.e, the 2nd alternative from the spec.

This change does that.  And with it piglit tests that require 3.1
contexts no longer skip.

Assuming there is no objection with this change, src/glx/dri_common.c
and src/gallium/state_trackers/wgl/stw_context.c should also be updated
accordingly, given they have the same logic.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
llvmpipe: Advertise GLSL 3.30.

According to Roland all TGSI support is there in theory.

In practice there are a few piglit failures and crashes, as this hadn't
been tested before.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
st/xlib: Do minimal version checking in glXCreateContextAttribsARB.

The current version checking is wrongly refusing to create 3.3 contexts;
unsupported version are checked elsewhere; and the DRI path doesn't do
this sort of checking neither.

This enables piglit glsl 3.30 tests to run without skipping.

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

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
r300g: fix runtime warning after winsys cleanup

Broken by:
  b2238b3452b0bcf3c1216c20c9918f9f0664b464
  winsys/radeon: remove cs_write_reloc, add simpler cs_get_reloc
r300g: don't crash when getting NULL colorbuffers

Cc: mesa-stable@lists.freedesktop.org
st/mesa: remove trailing NULL colorbuffers

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Brian Paul <brianp@vmware.com>
r600g: fix edge flags and layered rendering on R600-R700

We forgot to set these bits.

Cc: 10.1 mesa-stable@lists.freedesktop.org
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>