mesa.git
10 years agosvga/winsys: implement GBS support
Brian Paul [Sat, 8 Feb 2014 17:51:15 +0000 (09:51 -0800)]
svga/winsys: implement GBS support

This is a squash commit of many commits by Thomas Hellstrom.

Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Cc: "10.1" <mesa-stable@lists.freedesktop.org>
10 years agogallium/util: Add flush/map debug utility code
Thomas Hellstrom [Sat, 8 Feb 2014 17:51:15 +0000 (09:51 -0800)]
gallium/util: Add flush/map debug utility code

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Cc: "10.1" <mesa-stable@lists.freedesktop.org>
10 years agogallium/pipebuffer: Add a cache buffer manager bypass mask
Thomas Hellstrom [Sat, 8 Feb 2014 17:51:15 +0000 (09:51 -0800)]
gallium/pipebuffer: Add a cache buffer manager bypass mask

In some situations, it may be desirable to bypass the cache at buffer
creation but to insert the buffer in the cache at buffer destruction.
One such situation is where we already have a kernel representation of a
buffer that we want to use, but we also want to insert it in the cache when
it's freed up.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Cc: "10.1" <mesa-stable@lists.freedesktop.org>
10 years agopipebuffer, winsys: Add a size match parameter to the cached buffer manager
Thomas Hellstrom [Sat, 8 Feb 2014 17:51:15 +0000 (09:51 -0800)]
pipebuffer, winsys: Add a size match parameter to the cached buffer manager

In some situations it's important to restrict the sizes of buffers that the
cached buffer manager is allowed to return

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Cc: "10.1" <mesa-stable@lists.freedesktop.org>
10 years agosvga: update texture code for GBS
Brian Paul [Sat, 8 Feb 2014 17:51:15 +0000 (09:51 -0800)]
svga: update texture code for GBS

Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Cc: "10.1" <mesa-stable@lists.freedesktop.org>
10 years agosvga: update buffer code for GBS
Brian Paul [Sat, 8 Feb 2014 17:51:15 +0000 (09:51 -0800)]
svga: update buffer code for GBS

Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Cc: "10.1" <mesa-stable@lists.freedesktop.org>
10 years agosvga: add new helper functions for GBS buffers
Brian Paul [Sat, 8 Feb 2014 17:51:14 +0000 (09:51 -0800)]
svga: add new helper functions for GBS buffers

Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Cc: "10.1" <mesa-stable@lists.freedesktop.org>
10 years agosvga: remove a couple unneeded assertions
Brian Paul [Sat, 8 Feb 2014 17:51:14 +0000 (09:51 -0800)]
svga: remove a couple unneeded assertions

Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Cc: "10.1" <mesa-stable@lists.freedesktop.org>
10 years agosvga: adjust adjustment for point coordinates
Brian Paul [Sat, 8 Feb 2014 17:51:14 +0000 (09:51 -0800)]
svga: adjust adjustment for point coordinates

Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Cc: "10.1" <mesa-stable@lists.freedesktop.org>
10 years agosvga: track which textures are rendered to
Brian Paul [Sat, 8 Feb 2014 17:51:14 +0000 (09:51 -0800)]
svga: track which textures are rendered to

Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Cc: "10.1" <mesa-stable@lists.freedesktop.org>
10 years agosvga: add helpers for tracking rendering to textures
Brian Paul [Sat, 8 Feb 2014 17:51:14 +0000 (09:51 -0800)]
svga: add helpers for tracking rendering to textures

Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Cc: "10.1" <mesa-stable@lists.freedesktop.org>
10 years agosvga: update shader code for GBS
Brian Paul [Sat, 8 Feb 2014 17:51:14 +0000 (09:51 -0800)]
svga: update shader code for GBS

Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Cc: "10.1" <mesa-stable@lists.freedesktop.org>
10 years agosvga: update constant buffer code for GBS
Brian Paul [Sat, 8 Feb 2014 17:51:14 +0000 (09:51 -0800)]
svga: update constant buffer code for GBS

Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Cc: "10.1" <mesa-stable@lists.freedesktop.org>
10 years agosvga: add svga_have_gb_objects/dma() functions
Brian Paul [Sat, 8 Feb 2014 17:51:14 +0000 (09:51 -0800)]
svga: add svga_have_gb_objects/dma() functions

Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Cc: "10.1" <mesa-stable@lists.freedesktop.org>
10 years agosvga: add new GBS commands
Brian Paul [Sat, 8 Feb 2014 17:51:14 +0000 (09:51 -0800)]
svga: add new GBS commands

And update some existing commands.

Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Cc: "10.1" <mesa-stable@lists.freedesktop.org>
10 years agosvga: update svga_winsys interface for GBS
Brian Paul [Sat, 8 Feb 2014 17:51:14 +0000 (09:51 -0800)]
svga: update svga_winsys interface for GBS

This adds new interface functions for guest-backed surfaces and
adds a mobid parameter to the surface_relocation() function.

Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Cc: "10.1" <mesa-stable@lists.freedesktop.org>
10 years agosvga: update dumping code with new GBS commands, etc
Brian Paul [Sat, 8 Feb 2014 17:51:14 +0000 (09:51 -0800)]
svga: update dumping code with new GBS commands, etc

Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Cc: "10.1" <mesa-stable@lists.freedesktop.org>
10 years agosvga: split / update svga3d header files
Brian Paul [Sat, 8 Feb 2014 17:51:13 +0000 (09:51 -0800)]
svga: split / update svga3d header files

The old svga3d_reg.h file is split into separate header files and we
add new items for guest-backed surfaces.

Plus some minor code fixes because of renamed symbols.

Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Cc: "10.1" <mesa-stable@lists.freedesktop.org>
10 years agost/vdpau: add support for DEINTERLACE_TEMPORAL
Grigori Goronzy [Thu, 13 Feb 2014 20:32:30 +0000 (21:32 +0100)]
st/vdpau: add support for DEINTERLACE_TEMPORAL

Reviewed-by: Christian König <christian.koenig@amd.com>
10 years agovl: add motion adaptive deinterlacer
Grigori Goronzy [Thu, 13 Feb 2014 20:32:29 +0000 (21:32 +0100)]
vl: add motion adaptive deinterlacer

Reviewed-by: Christian König <christian.koenig@amd.com>
10 years agost/omx/enc: fix scaling src alignment issue
Leo Liu [Mon, 3 Feb 2014 15:41:05 +0000 (10:41 -0500)]
st/omx/enc: fix scaling src alignment issue

Signed-off-by: Leo Liu <leo.liu@amd.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
10 years agoradeon: reverse DBG_NO_HYPERZ logic
Alex Deucher [Wed, 12 Feb 2014 17:00:17 +0000 (12:00 -0500)]
radeon: reverse DBG_NO_HYPERZ logic

Change the flag to DBG_HYPERZ and reverse the logic
so setting the flag enabled the feature.  This disables
hyperz on r600g and radeonsi by default.  It can be
enabled by setting the env var.  There are just too
many issues with certain apps so leave it disabled for
now until we sort out the issues with the problematic
apps.

Bugs:
https://bugs.freedesktop.org/show_bug.cgi?id=58660
https://bugs.freedesktop.org/show_bug.cgi?id=64471
https://bugs.freedesktop.org/show_bug.cgi?id=66352
https://bugs.freedesktop.org/show_bug.cgi?id=68799
https://bugs.freedesktop.org/show_bug.cgi?id=72685
https://bugs.freedesktop.org/show_bug.cgi?id=73088
https://bugs.freedesktop.org/show_bug.cgi?id=74428
https://bugs.freedesktop.org/show_bug.cgi?id=74803
https://bugs.freedesktop.org/show_bug.cgi?id=74863
https://bugs.freedesktop.org/show_bug.cgi?id=74892
https://bugzilla.kernel.org/show_bug.cgi?id=70411

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: "10.1" "10.0" <mesa-stable@lists.freedesktop.org>
Acked-by: Marek Olšák <marek.olsak@amd.com>
10 years agopipe-loader: Add support for render nodes v2
Tom Stellard [Fri, 24 Jan 2014 22:51:06 +0000 (17:51 -0500)]
pipe-loader: Add support for render nodes v2

v2:
   - Add missing call to pipe_loader_drm_release()
   - Fix render node macros
   - Drop render-node configure option

10 years agopipe-loader: Add auth_x parameter to pipe_loader_drm_probe_fd()
Tom Stellard [Mon, 27 Jan 2014 15:34:16 +0000 (10:34 -0500)]
pipe-loader: Add auth_x parameter to pipe_loader_drm_probe_fd()

The caller can use this boolean parameter to tell the pipe-loader
to authenticate with the X server when probing a file descriptor.

10 years agost/omx/dec/h264: fix pic_order_cnt_type==2
Christian König [Thu, 13 Feb 2014 11:50:51 +0000 (12:50 +0100)]
st/omx/dec/h264: fix pic_order_cnt_type==2

Signed-off-by: Christian König <christian.koenig@amd.com>
10 years agonouveau: fix chipset checks for nv1a by using the oclass instead
Ilia Mirkin [Wed, 12 Feb 2014 23:22:56 +0000 (18:22 -0500)]
nouveau: fix chipset checks for nv1a by using the oclass instead

Commit f4ebcd133b9 ("dri/nouveau: NV17_3D class is not available for
NV1a chipset") fixed this partially by using the correct 3d class.
However there were a lot of checks left over comparing against the
chipset.

Reported-and-tested-by: John F. Godfrey <jfgodfrey@gmail.com>
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: 9.2 10.0 10.1 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
10 years agost/omx: initial OpenMAX H264 encoder v7
Christian König [Mon, 5 Aug 2013 17:41:27 +0000 (11:41 -0600)]
st/omx: initial OpenMAX H264 encoder v7

v2 (chk): fix eos handling
v3 (leo): implement scaling configuration support
v4 (leo): fix bitrate bug
v5 (chk): add workaround for bug in Bellagio
v6 (chk): fix div by 0 if framerate isn't known,
          user separate pipe object for scale and transfer,
          always flush the transfer pipe before encoding
v7 (chk): make suggested changes, cleanup a bit more,
          only advertise encoder on supported hardware

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Leo Liu <leo.liu@amd.com>
10 years agoradeon/vce: initial VCE support v8
Christian König [Thu, 17 Oct 2013 12:21:40 +0000 (06:21 -0600)]
radeon/vce: initial VCE support v8

v2 (chk): revert feedback buffer hack
v3 (slava): fixed bitstream size calculation
v4 (chk): always create buffers in the right domain
v5 (chk): flush async
v6 (chk): rework fw interface add version check
v7 (leo): implement cropping support
v8 (chk): add hw checks

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Leo Liu <leo.liu@amd.com>
Signed-off-by: Slava Grigorev <slava.grigorev@amd.com>
10 years agoradeon/winsys: add VCE support v4
Christian König [Mon, 8 Jul 2013 14:32:04 +0000 (08:32 -0600)]
radeon/winsys: add VCE support v4

v2: add fw version query
v3: add README.VCE
v4: avoid error msg when kernel doesn't support it

Signed-off-by: Christian König <christian.koenig@amd.com>
10 years agonv50: mark scissors/viewports dirty on context switch
Ilia Mirkin [Thu, 13 Feb 2014 07:33:37 +0000 (02:33 -0500)]
nv50: mark scissors/viewports dirty on context switch

Commit 246ca4b001 ("nv50: implement multiple viewports/scissors, enable
ARB_viewport_array") added dirty tracking to scissors/viewports. However
it neglected to mark them all as dirty on a context switch. This fixes
an apparent regression in webgl in chrome, but probably in any
application that switches contexts.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agogallium/vl: remove remaining softpipe video functions
Christian König [Tue, 11 Feb 2014 10:55:47 +0000 (11:55 +0100)]
gallium/vl: remove remaining softpipe video functions

Unused and unmaintained for quite a while.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
10 years agodocs: add nv50 to the ARB_viewport_array list
Ilia Mirkin [Thu, 13 Feb 2014 03:14:23 +0000 (22:14 -0500)]
docs: add nv50 to the ARB_viewport_array list

10 years agonv50: implement multiple viewports/scissors, enable ARB_viewport_array
Ilia Mirkin [Tue, 21 Jan 2014 07:56:01 +0000 (02:56 -0500)]
nv50: implement multiple viewports/scissors, enable ARB_viewport_array

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Christoph Bumiller <e0425955@student.tuwien.ac.at>
10 years agomesa/st: hardcode the viewport bounds range
Ilia Mirkin [Tue, 11 Feb 2014 05:26:32 +0000 (00:26 -0500)]
mesa/st: hardcode the viewport bounds range

The bound range is disconnected from the viewport dimensions. This is
the relevant bit from glViewportArray:

"""
The location of the viewport's bottom left corner, given by (x, y) is
clamped to be within the implementaiton-dependent viewport bounds range.
The viewport bounds range [min, max] can be determined by calling glGet
with argument GL_VIEWPORT_BOUNDS_RANGE. Viewport width and height are
silently clamped to a range that depends on the implementation. To query
this range, call glGet with argument GL_MAX_VIEWPORT_DIMS.
"""

Just set it to +/-16384, as that is the minimum required by
ARB_viewport_array and the value that all current drivers provide.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agoscons: add meta_blit.c to src/mesa/SConscript
Brian Paul [Thu, 13 Feb 2014 00:46:11 +0000 (17:46 -0700)]
scons: add meta_blit.c to src/mesa/SConscript

10 years agometa: Add acceleration for depth glBlitFramebuffer().
Eric Anholt [Wed, 5 Feb 2014 07:57:29 +0000 (23:57 -0800)]
meta: Add acceleration for depth glBlitFramebuffer().

Surprisingly, the GLSL shaders already wrote the sampled r value to
FragDepth.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=51600
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agometa: Use BindRenderbufferTexImage() for meta glBlitFramebuffer().
Eric Anholt [Tue, 4 Feb 2014 23:00:46 +0000 (15:00 -0800)]
meta: Use BindRenderbufferTexImage() for meta glBlitFramebuffer().

This avoids a CopyTexImage() on Intel i965 hardware without blorp.

v2: Move the !readAtt check up higher.
v3: Rebase on idr's changes, plus readAtt check is totally gone, and also
    fix a typo in a comment.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v2)
10 years agoi965: Add a driver hook for binding renderbuffers to textures.
Eric Anholt [Tue, 4 Feb 2014 20:51:11 +0000 (12:51 -0800)]
i965: Add a driver hook for binding renderbuffers to textures.

This will let us use meta's acceleration from renderbuffers without having
to do a CopyTexImage first.

This is like what we do for TFP, but just taking an existing renderbuffer
and binding it to a texture with whatever its format was.  The
implementation won't work for stencil renderbuffers, and it only does
non-texture renderbuffers (but then, if you're using a texture
renderbuffer, you can just pull the texture object/level/slice out of the
renderbuffer, anyway).

v2: Don't forget to propagate NumSamples to the teximage.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agometa: Do a massive unindent (and rename) of blitframebuffer_texture().
Eric Anholt [Tue, 4 Feb 2014 22:52:27 +0000 (14:52 -0800)]
meta: Do a massive unindent (and rename) of blitframebuffer_texture().

This function is only handling the color case.  We can just unindent as
long as we're willing to do the check for the bit outside of the
function.

v2: Rebase on idr's changes, drop readAtt check that's always non-null
    anyway (it's a pointer into to the statically-allocated attachments
    array in the renderbuffer).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v1)
10 years agometa: Move glBlitFramebuffer() to a separate file.
Eric Anholt [Mon, 3 Feb 2014 23:31:01 +0000 (15:31 -0800)]
meta: Move glBlitFramebuffer() to a separate file.

v2: Drop a bunch of unnecessary includes (by Kenneth), rebase on idr's
    changes.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v1)
10 years agometa: De-static some of meta's functions.
Eric Anholt [Mon, 3 Feb 2014 23:08:54 +0000 (15:08 -0800)]
meta: De-static some of meta's functions.

I want split some meta.c code off to a separate file, so these functions
can't be static any more.

v2: Rebase on idr's changes, also expose setup_blit_shader,
    blit_shader_table_cleanup, setup_vertex_objects,
    setup_ff_tnl_for_blit.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v1)
10 years agometa: Move the meta structures to the meta header.
Eric Anholt [Mon, 3 Feb 2014 23:02:16 +0000 (15:02 -0800)]
meta: Move the meta structures to the meta header.

I'd like to split some of our code to separate files, since 4k lines and
growing is pretty unreasonable for all these separate operations.

v2: Rebase on idr's changes.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v1)
10 years agometa: Fold the texture setup into setup_copypix_texture().
Eric Anholt [Mon, 3 Feb 2014 23:58:03 +0000 (15:58 -0800)]
meta: Fold the texture setup into setup_copypix_texture().

There was this funny argument passed to setup for "did alloc decide we
need to allocate new texture storage?", which goes away if we don't have
the caller do alloc as a separate step.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agometa: Drop the src == dst restriction on meta glBlitFramebuffer().
Eric Anholt [Wed, 5 Feb 2014 07:22:52 +0000 (23:22 -0800)]
meta: Drop the src == dst restriction on meta glBlitFramebuffer().

From the GL_ARB_fbo spec:

    If the source and destination buffers are identical, and the
    source and destination rectangles overlap, the result of the blit
    operation is undefined.

As far as I know, that's the only thing that would have been of concern
for this.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Make TexImage error cases about internalFormat more informative.
Eric Anholt [Tue, 4 Feb 2014 22:04:14 +0000 (14:04 -0800)]
mesa: Make TexImage error cases about internalFormat more informative.

I tripped over one of these when debugging meta, and it's a lot nicer to
just see the internalFormat being complained about.

v2: Drop a note in the other errors path that there is one early return.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agometa: Rename the "sampler" stuff to "blit shader".
Eric Anholt [Wed, 12 Feb 2014 00:33:20 +0000 (16:33 -0800)]
meta: Rename the "sampler" stuff to "blit shader".

While these structs are generated per GLSL sampler type, they're structs
of data-about-shaders (notably, the ID of a shader program), not
data-about-samplers.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agometa: Drop a now-trivial helper function.
Eric Anholt [Wed, 12 Feb 2014 00:19:29 +0000 (16:19 -0800)]
meta: Drop a now-trivial helper function.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agometa: Fold the glUseProgram() into the blit program generator.
Eric Anholt [Wed, 12 Feb 2014 00:13:21 +0000 (16:13 -0800)]
meta: Fold the glUseProgram() into the blit program generator.

Everyone was just immediately calling it and doing nothing else with the
shader program id.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agometa: Simplify the blit shader setup steps.
Eric Anholt [Wed, 12 Feb 2014 00:08:51 +0000 (16:08 -0800)]
meta: Simplify the blit shader setup steps.

The only thing that wants to track the glsl_sampler structure is the
shader string generator.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoi965/vec4: Fix confusion between SWIZZLE and BRW_SWIZZLE macros.
Francisco Jerez [Thu, 28 Nov 2013 06:21:45 +0000 (22:21 -0800)]
i965/vec4: Fix confusion between SWIZZLE and BRW_SWIZZLE macros.

Most of the VEC4 back-end agrees on src_reg::swizzle being one of the
BRW_SWIZZLE macros defined in brw_reg.h, except in two places where we
use Mesa's SWIZZLE macros.  There is even a doxygen comment saying
that Mesa's macros are the right ones.  They are incompatible swizzle
representations (3 bits vs. 2 bits per component), and the code using
Mesa's works by pure luck.  Fix it.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agoi965/fs: Remove fs_reg::sechalf.
Francisco Jerez [Wed, 15 Jan 2014 21:21:50 +0000 (22:21 +0100)]
i965/fs: Remove fs_reg::sechalf.

The same effect can be achieved using ::subreg_offset.  Remove the
less flexible alternative and define a convenience function to keep
the fs_reg interface sane.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agoi965/fs: Remove fs_reg::smear.
Francisco Jerez [Wed, 15 Jan 2014 21:21:30 +0000 (22:21 +0100)]
i965/fs: Remove fs_reg::smear.

The same effect can be achieved using a combination of ::stride and
::subreg_offset.  Remove the less flexible ::smear to keep the data
members of fs_reg orthogonal.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agoi965/fs: Add support for specifying register horizontal strides.
Francisco Jerez [Sun, 8 Dec 2013 03:57:35 +0000 (04:57 +0100)]
i965/fs: Add support for specifying register horizontal strides.

v2: Some improvements for copy propagation with non-contiguous
    register strides and mismatching types.
v3: Add example of the situation that the copy propagation changes are
    intended to avoid.  Clarify that 'fs_reg::apply_stride()' is expected
    to work with zero strides too.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agoi965/fs: Add support for sub-register byte offsets to the FS back-end IR.
Francisco Jerez [Sun, 8 Dec 2013 03:57:08 +0000 (04:57 +0100)]
i965/fs: Add support for sub-register byte offsets to the FS back-end IR.

It would be nice if we could have a single 'reg_offset' field
expressed in bytes that would serve the purpose of both, but the
semantics of 'reg_offset' are quite complex currently (it's measured
in units of one, eight or sixteen dwords depending on the register
file and the dispatch width) and changing it to bytes would be a very
intrusive change at this stage.  Add a separate 'subreg_offset' field
for now.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agoglsl: rename _restrict to restrict_flag
Brian Paul [Wed, 12 Feb 2014 20:22:27 +0000 (13:22 -0700)]
glsl: rename _restrict to restrict_flag

To fix MSVC compile breakage.  Evidently, _restrict is an MSVC keyword,
though the docs only mention __restrict (with two underscores).

Note: we may want to also rename _volatile to volatile_flag to be
consistent.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74900
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: assorted clean-ups in detach_shader()
Brian Paul [Mon, 10 Feb 2014 23:13:04 +0000 (16:13 -0700)]
mesa: assorted clean-ups in detach_shader()

Fix formatting, add new comments, get rid of extraneous indentation.
Suggested by Ian in bug 74723.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agosvga: replace out-of-temps assertion with debug warning
Brian Paul [Mon, 10 Feb 2014 23:12:32 +0000 (16:12 -0700)]
svga: replace out-of-temps assertion with debug warning

Signed-off-by: Brian Paul <brianp@vmware.com>
10 years agomesa: Handle binding of uniforms to image units with glUniform*().
Francisco Jerez [Sat, 23 Nov 2013 03:59:48 +0000 (19:59 -0800)]
mesa: Handle binding of uniforms to image units with glUniform*().

v2: Set driver-specified flag in NewDriverState when glUniform* is
    used to bind an image unit.
v3: Abbreviate argument type check.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agoglsl/linker: Propagate image uniform access qualifiers to the driver.
Francisco Jerez [Sun, 24 Nov 2013 05:56:56 +0000 (21:56 -0800)]
glsl/linker: Propagate image uniform access qualifiers to the driver.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agoglsl/linker: Assign image uniform indices.
Francisco Jerez [Fri, 22 Nov 2013 23:53:52 +0000 (15:53 -0800)]
glsl/linker: Assign image uniform indices.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agoglsl/linker: Count and check image resources.
Francisco Jerez [Fri, 22 Nov 2013 23:53:26 +0000 (15:53 -0800)]
glsl/linker: Count and check image resources.

v2: Add comment about the reason why image variables take up space
    from the default uniform block.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agoglsl: Add image built-in function generator.
Francisco Jerez [Tue, 26 Nov 2013 04:29:57 +0000 (20:29 -0800)]
glsl: Add image built-in function generator.

Because of the combinatorial explosion of different image built-ins
with different image dimensionalities and base data types, enumerating
all the 242 possibilities would be annoying and a waste of .text
space.  Instead use a special path in the built-in builder that loops
over all the known image types.

v2: Generate built-ins on GLSL version 4.20 too.  Rename
    '_has_float_data_type' to '_supports_float_data_type'.  Avoid
    duplicating enumeration of image built-ins in create_intrinsics()
    and create_builtins().
v3: Use a more orthodox approach for passing image built-in generator
    parameters.
v4: Cosmetic changes.

Acked-by: Paul Berry <stereotype441@gmail.com>
10 years agoglsl: Add built-in constants for ARB_shader_image_load_store.
Francisco Jerez [Wed, 12 Feb 2014 16:15:21 +0000 (17:15 +0100)]
glsl: Add built-in constants for ARB_shader_image_load_store.

v2: Add them on GLSL version 4.20 too.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agoglcpp: Add built-in define for ARB_shader_image_load_store.
Francisco Jerez [Wed, 12 Feb 2014 16:12:24 +0000 (17:12 +0100)]
glcpp: Add built-in define for ARB_shader_image_load_store.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agoglsl: Add built-in types defined by ARB_shader_image_load_store.
Francisco Jerez [Mon, 25 Nov 2013 22:09:13 +0000 (14:09 -0800)]
glsl: Add built-in types defined by ARB_shader_image_load_store.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agoglsl/ast: Generalize some sampler variable restrictions to all opaque types.
Francisco Jerez [Tue, 26 Nov 2013 03:38:37 +0000 (19:38 -0800)]
glsl/ast: Generalize some sampler variable restrictions to all opaque types.

No opaque types may be statically initialized in the shader, all
opaque variables must be declared uniform or be part of an "in"
function parameter declaration, no opaque types may be used as the
return type of a function.

v2: Add explicit check for opaque types in interface blocks.  Check
    for opaque types in ir_dereference::is_lvalue().

Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agoglsl/ast: Forbid declaration of image variables in structures and uniform blocks.
Francisco Jerez [Fri, 22 Nov 2013 23:17:05 +0000 (15:17 -0800)]
glsl/ast: Forbid declaration of image variables in structures and uniform blocks.

Aggregating images inside uniform blocks is explicitly disallowed by
the standard, aggregating them inside structures is not (as of GL
4.4), but there is a similar problem as with atomic counters: image
uniform declarations require either a "writeonly" memory qualifier or
an explicit format qualifier, which are explicitly forbidden in
structure member declarations.  In the resolution of Khronos bug
#10903 the same wording applied to atomic counters was decided to mean
that they're not allowed inside structures -- Rejecting image member
declarations within structures seems the most reasonable option for
now.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agoglsl/ast: Make sure that image argument qualifiers match the function prototype.
Francisco Jerez [Sun, 8 Dec 2013 03:56:06 +0000 (04:56 +0100)]
glsl/ast: Make sure that image argument qualifiers match the function prototype.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agoglsl/ast: Verify that function calls don't discard image format qualifiers.
Francisco Jerez [Fri, 22 Nov 2013 23:11:50 +0000 (15:11 -0800)]
glsl/ast: Verify that function calls don't discard image format qualifiers.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agoglsl/ast: Validate and apply memory qualifiers to image variables.
Francisco Jerez [Mon, 25 Nov 2013 23:57:56 +0000 (15:57 -0800)]
glsl/ast: Validate and apply memory qualifiers to image variables.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agoglsl/parser: Handle image built-in types.
Francisco Jerez [Mon, 25 Nov 2013 23:14:25 +0000 (15:14 -0800)]
glsl/parser: Handle image built-in types.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agoglsl/parser: Handle image memory qualifiers.
Francisco Jerez [Mon, 25 Nov 2013 23:10:35 +0000 (15:10 -0800)]
glsl/parser: Handle image memory qualifiers.

v2: Make the "map" array static const.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agoglsl/parser: Handle the early_fragment_tests input layout qualifier.
Francisco Jerez [Wed, 12 Feb 2014 16:10:09 +0000 (17:10 +0100)]
glsl/parser: Handle the early_fragment_tests input layout qualifier.

v2: Only allow the early_fragment_tests qualifier in fragment shaders.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agoglsl/lexer: Add new tokens for ARB_shader_image_load_store.
Francisco Jerez [Mon, 25 Nov 2013 22:59:46 +0000 (14:59 -0800)]
glsl/lexer: Add new tokens for ARB_shader_image_load_store.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agoglsl/ast: Keep track of type qualifiers defined by ARB_shader_image_load_store.
Francisco Jerez [Wed, 12 Feb 2014 15:56:01 +0000 (16:56 +0100)]
glsl/ast: Keep track of type qualifiers defined by ARB_shader_image_load_store.

v2: Add comment next to the read_only and write_only qualifier flags.
    Change temporary copies of the type qualifier mask to use uint64_t
    too.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agoglsl: Add gl_uniform_storage fields to keep track of image uniform indices.
Francisco Jerez [Fri, 22 Nov 2013 23:50:48 +0000 (15:50 -0800)]
glsl: Add gl_uniform_storage fields to keep track of image uniform indices.

v2: Promote anonymous struct into named struct.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agoglsl: Add image memory and layout qualifiers to ir_variable.
Francisco Jerez [Sat, 23 Nov 2013 04:57:44 +0000 (20:57 -0800)]
glsl: Add image memory and layout qualifiers to ir_variable.

v2: Add comment next to the read_only and write_only qualifier flags.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agoglsl: Add helper methods to glsl_type for dealing with images.
Francisco Jerez [Mon, 25 Nov 2013 22:03:06 +0000 (14:03 -0800)]
glsl: Add helper methods to glsl_type for dealing with images.

Add predicates to query if a GLSL type is or contains an image.
Rename sampler_coordinate_components() to coordinate_components().

v2: Use assert instead of unreachable.
v3: No need to use a separate code-path for images in
    coordinate_components() after merging image and sampler fields in
    the glsl_type structure.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agoglsl: Add image type to the GLSL IR.
Francisco Jerez [Mon, 25 Nov 2013 21:50:47 +0000 (13:50 -0800)]
glsl: Add image type to the GLSL IR.

v2: Reuse the glsl_sampler_dim enum for images.  Reuse the
    glsl_type::sampler_* fields instead of creating new ones specific
    to image types.  Reuse the same constructor as for samplers adding
    a new 'base_type' argument.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agoglsl: Add ARB_shader_image_load_store extension enables.
Francisco Jerez [Wed, 12 Feb 2014 15:54:40 +0000 (16:54 +0100)]
glsl: Add ARB_shader_image_load_store extension enables.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agomesa: Preserve the NewArrays state when copying a VAO
Fredrik Höglund [Fri, 7 Feb 2014 19:34:08 +0000 (20:34 +0100)]
mesa: Preserve the NewArrays state when copying a VAO

Cc: "10.1" "10.0" <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=72895
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agonouveau: create only 1 shared screen between vdpau and opengl
Maarten Lankhorst [Wed, 12 Feb 2014 13:56:53 +0000 (14:56 +0100)]
nouveau: create only 1 shared screen between vdpau and opengl

This fixes bug 73200 "vdpau-GL interop fails due to different screen
objects" in the same way radeon does.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agogallium makefiles: use a linker script for building dri drivers
Maarten Lankhorst [Wed, 12 Feb 2014 12:50:43 +0000 (13:50 +0100)]
gallium makefiles: use a linker script for building dri drivers

Only export __driDriverExtensions by default, and radeon_drm_winsys_create on radeons.
Remove -Bsymbolic which should no longer be needed.

As a side effect, it ought to fix a manifestation of bug 73200 on radeon.

Signed-off-by: Maarten Lankhorst<maarten.lankhorst@canonical.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
10 years agoglsl: Do not vectorize vector array dereferences.
Matt Turner [Mon, 10 Feb 2014 20:09:19 +0000 (12:09 -0800)]
glsl: Do not vectorize vector array dereferences.

Array dereferences must have scalar indices, so we cannot vectorize
them.

Cc: "10.1" <mesa-stable@lists.freedesktop.org>
Reported-by: Andrew Guertin <lists@dolphinling.net>
Tested-by: Andrew Guertin <lists@dolphinling.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agometa: Enable cubemap array texture support to decompress_texture_image
Ian Romanick [Tue, 17 Dec 2013 01:11:15 +0000 (17:11 -0800)]
meta: Enable cubemap array texture support to decompress_texture_image

Fixed piglit test getteximage-targets S3TC CUBE_ARRAY on systems that
don't have libtxc_dxtn installed.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agometa: Add cubemap array support to generic blit shader code
Ian Romanick [Tue, 17 Dec 2013 01:10:29 +0000 (17:10 -0800)]
meta: Add cubemap array support to generic blit shader code

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agometa: Get the correct info log
Ian Romanick [Tue, 17 Dec 2013 00:25:07 +0000 (16:25 -0800)]
meta: Get the correct info log

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agometa: Expand texture coordinate from vec3 to vec4
Ian Romanick [Mon, 16 Dec 2013 23:35:02 +0000 (15:35 -0800)]
meta: Expand texture coordinate from vec3 to vec4

This will be necessary to support cubemap array textures because they
use all four components.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agometa: Use GLSL to decompress 2D-array textures
Ian Romanick [Mon, 16 Dec 2013 23:01:54 +0000 (15:01 -0800)]
meta: Use GLSL to decompress 2D-array textures

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=72582
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agometa: Use common GLSL code for blits
Ian Romanick [Mon, 16 Dec 2013 21:10:53 +0000 (13:10 -0800)]
meta: Use common GLSL code for blits

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agometa: Improve GLSL version check
Ian Romanick [Mon, 16 Dec 2013 21:10:11 +0000 (13:10 -0800)]
meta: Improve GLSL version check

We want to use the GLSL 1.30-ish path for OpenGL ES 3.0.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agometa: Add rectangle textures to the shader-per-sampler-type table
Ian Romanick [Mon, 16 Dec 2013 19:56:26 +0000 (11:56 -0800)]
meta: Add rectangle textures to the shader-per-sampler-type table

Rectangle textures were not necessary for mipmap generation (because
they cannot have mipmaps), but all of the future users of this common
code will need to support rectangle textures.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agometa: Refactor shader generation code out of mipmap generation path
Ian Romanick [Mon, 16 Dec 2013 19:54:08 +0000 (11:54 -0800)]
meta: Refactor shader generation code out of mipmap generation path

This is quite like code we want for blits.  Pull it out so that it can
be shared by other paths.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agometa: Refactor the table of glsl_sampler structures
Ian Romanick [Mon, 16 Dec 2013 19:52:38 +0000 (11:52 -0800)]
meta: Refactor the table of glsl_sampler structures

This will allow the same table of shader-per-sampler-type to be used for
paths in meta other than just mipmap generation.  This is also the
reason the declarations of the structures was moved towards the top of
the file.

v2: Code formatting change suggested by Brian.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agometa: Use common vertex setup code for _mesa_meta_Bitmap too
Ian Romanick [Sun, 15 Dec 2013 03:33:02 +0000 (19:33 -0800)]
meta: Use common vertex setup code for _mesa_meta_Bitmap too

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agometa: Add storage to the vertex structure for R, G, B, and A
Ian Romanick [Sun, 15 Dec 2013 03:32:39 +0000 (19:32 -0800)]
meta: Add storage to the vertex structure for R, G, B, and A

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agometa: Use common routine to configure fixed-function TNL state
Ian Romanick [Sat, 14 Dec 2013 19:36:32 +0000 (11:36 -0800)]
meta: Use common routine to configure fixed-function TNL state

Also... glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0) *is* the identity
matrix, so drop the unnecessary call to _mesa_Ortho.

v2: Rename setup_ff_TNL_for_blit() to setup_ff_tnl_for_blit().  Seems
    silly to capitalize one out of two to three acronyms in the name
    (change by anholt, acked by idr).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com> (v1)
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965: Fix General and Indirect Base Addresses on Broadwell.
Kenneth Graunke [Mon, 3 Feb 2014 22:30:39 +0000 (14:30 -0800)]
i965: Fix General and Indirect Base Addresses on Broadwell.

I set the "address modify enable" bit in the wrong DWord.  The first
DWord is the high 16 bits of the address, while the second is the low
32-bits and enable bit.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965: Drop VECTOR_MASK_ENABLE in Broadwell's 3DSTATE_VS packet.
Kenneth Graunke [Mon, 3 Feb 2014 18:45:31 +0000 (10:45 -0800)]
i965: Drop VECTOR_MASK_ENABLE in Broadwell's 3DSTATE_VS packet.

We never set it on previous generations, but I had to set it in
3DSTATE_PS for correct behavior.  For symmetry, I set it in 3DSTATE_VS
as well, but there's no actual need to do so.  Piglit works fine either
way.  The documentation also remarks that there should never be a need
to program this.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965/gs: Fix EndPrimitive on Broadwell.
Kenneth Graunke [Thu, 30 Jan 2014 00:31:31 +0000 (16:31 -0800)]
i965/gs: Fix EndPrimitive on Broadwell.

My earlier patch (i965: Reserve space for "Vertex Count" in GS outputs.)
incremented Global Offset for most URB writes to make room for the new
"Vertex Count" field, but failed to shift the URB writes used for
writing control bits.

Confusingly, Global Offset must be incremented by 2 here, rather than 1.
The URB writes we use for actual data are HWord writes, which treat
Global Offset as a 256-bit offset.  These are OWord writes, so it's
treated as a 128-bit offset instead.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>