mesa.git
7 years agoPrevent zero sized wl_egl_window
Sinclair Yeh [Thu, 13 Feb 2014 00:21:11 +0000 (16:21 -0800)]
Prevent zero sized wl_egl_window

It is illegal to create or resize a window to zero (or negative) width
and/or height.  This patch prevents such a request from happening.

7 years agoglsl: Fix condition to generate shader link error
Anuj Phogat [Thu, 19 Dec 2013 22:17:19 +0000 (14:17 -0800)]
glsl: Fix condition to generate shader link error

GL_ARB_ES2_compatibility doesn't say anything about shader linking
when one of the shaders (vertex or fragment shader) is absent. So,
the extension shouldn't change the behavior specified in GLSL
specification.

Tested the behavior on proprietary linux drivers of NVIDIA and AMD.
Both of them allow linking a version 100 shader program in OpenGL
context, when one of the shaders is absent.

Makes following Khronos CTS tests to pass:
successfulcompilevert_linkprogram.test
successfulcompilefrag_linkprogram.test

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
7 years agomesa: Add GL_TEXTURE_CUBE_MAP_ARRAY to legal_get_tex_level_parameter_target()
Anuj Phogat [Sat, 15 Feb 2014 01:27:29 +0000 (17:27 -0800)]
mesa: Add GL_TEXTURE_CUBE_MAP_ARRAY to legal_get_tex_level_parameter_target()

Fixes failing Khronos CTS test packed_depth_stencil_init.test

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
7 years agoi965/fs: Use conditional sends to do FB writes on HSW+.
Eric Anholt [Fri, 14 Feb 2014 05:37:50 +0000 (21:37 -0800)]
i965/fs: Use conditional sends to do FB writes on HSW+.

This drops the MOVs for header setup, which are totally mis-scheduled.

total instructions in shared programs: 1590047 -> 1589331 (-0.05%)
instructions in affected programs:     43729 -> 43013 (-1.64%)
GAINED:                                0
LOST:                                  0

glb27-trex:
x before
+ after
+-----------------------------------------------------------------------------+
|               +      x     xx        +  +    +                              |
|              ++  + xxx ++x xx + ** *x+  +  + +  x *                         |
|+x xx x*    x+++xx*x*xx+++*+*xx++** *x* x+***x*+xx+*     + *    +  +        *|
|               |__|__________MA___A___________|___|                          |
+-----------------------------------------------------------------------------+
    N           Min           Max        Median           Avg        Stddev
x  49         62.33         65.41         63.49      63.53449    0.62757822
+  50         62.28          65.4          63.7       63.6982      0.656564
No difference proven at 95.0% confidence

Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoi965/fs: Drop dead comment about the old proj_attrib_mask optimization.
Eric Anholt [Fri, 14 Feb 2014 23:41:40 +0000 (15:41 -0800)]
i965/fs: Drop dead comment about the old proj_attrib_mask optimization.

The code was removed early last year.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Drop mt->levels[].width/height.
Eric Anholt [Fri, 14 Feb 2014 21:00:40 +0000 (13:00 -0800)]
i965: Drop mt->levels[].width/height.

It often confused people because it was unclear on whether it was the
physical or logical, and people needed the other one as well.  We can
recompute it trivially using the minify() macro, clarifying which value is
being used and making getting the other value obvious.

v2: Fix a pasteo in intel_blit.c's dst flip.

Reviewed-by: Chris Forbes <chrisf@ijw.co.nz> (v1)
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Move singlesample_mt to the renderbuffer.
Eric Anholt [Thu, 13 Feb 2014 18:45:35 +0000 (10:45 -0800)]
i965: Move singlesample_mt to the renderbuffer.

Since only window system renderbuffers can have a singlesample_mt, this
lets us drop a bunch of sanity checking to make sure that we're just a
renderbuffer-like thing.

v2: Fix a badly-written comment (thanks Kenneth!), drop the now trivial
    helper function for set_needs_downsample.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Drop some duplicated code in DRI winsys BO updates.
Eric Anholt [Thu, 13 Feb 2014 22:33:57 +0000 (14:33 -0800)]
i965: Drop some duplicated code in DRI winsys BO updates.

The only DRI2 vs DRI3 delta was just how to decide about frontbuffer-ness
for doing the upsample.

v2: Fix missing singlesample_mt->region->name update in the merged code,
    which would have broken the DRI2 don't-recreate-the-miptree
    optimization.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Simplify intel_miptree_updownsample.
Eric Anholt [Thu, 13 Feb 2014 18:52:47 +0000 (10:52 -0800)]
i965: Simplify intel_miptree_updownsample.

Pretty silly to pass in values dereferenced out of one of the arguments.

v2: Get the destination size from the dst, even though the callers are
    always dealing with src size == dst size cases.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Don't try to use the ctx->ReadBuffer when asked to blorp miptrees.
Eric Anholt [Thu, 13 Feb 2014 23:58:21 +0000 (15:58 -0800)]
i965: Don't try to use the ctx->ReadBuffer when asked to blorp miptrees.

So far it's happened to be that we're only ever calling
intel_miptree_blit() (up/downsampling) from the ReadBuffer, but I stumbled
over a null ReadBuffer case when debugging later parts of the series.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Make the mt->target of multisample renderbuffers be 2D_MS.
Eric Anholt [Fri, 7 Feb 2014 22:20:34 +0000 (14:20 -0800)]
i965: Make the mt->target of multisample renderbuffers be 2D_MS.

Mostly mt->target == 2D_MS just results in a few checks that we don't try
to allocate multiple LODs and don't try to do slice copies with them.  But
with the introduction of binding renderbuffers to textures, we need more
consistency.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agometa: Push into desktop GL mode when doing meta operations.
Eric Anholt [Tue, 11 Feb 2014 20:10:59 +0000 (12:10 -0800)]
meta: Push into desktop GL mode when doing meta operations.

This lets us simplify our shaders, and rely on GLES-prohibited
functionality (like ARB_texture_multisample) when writing these
driver-internal functions.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agometa: Fix blit shader compile on non-glsl-130 drivers.
Eric Anholt [Fri, 14 Feb 2014 22:31:17 +0000 (14:31 -0800)]
meta: Fix blit shader compile on non-glsl-130 drivers.

Compare this VS to the one for the post-130 case.  Fixes piglit
glsl-lod-bias, and presumably tons of other code (I haven't done a full
piglit run on swrast).

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74911
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoconfigure: fix build error with XA
Rob Clark [Tue, 18 Feb 2014 13:12:37 +0000 (08:12 -0500)]
configure: fix build error with XA

Fixes:

xa_tracker.c: In function 'xa_tracker_create':
 xa_tracker.c:147:5: error: implicit declaration of function 'pipe_loader_drm_probe_fd' [-Werror=implicit-function-declaration]

in some build configurations, as XA now implicitly depends on
gallium_drm_loader.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
7 years agor600g,radeonsi: Consolidate logic for short-circuiting flushes
Michel Dänzer [Thu, 13 Feb 2014 02:51:09 +0000 (11:51 +0900)]
r600g,radeonsi: Consolidate logic for short-circuiting flushes

Fixes radeonsi emitting command streams to the kernel even when there
have been no draw calls before a flush, potentially powering up the GPU
needlessly.

Incidentally, this also cuts the runtime of piglit gpu.py in about half
on my Kaveri system, probably because an X11 client going away no longer
always results in a command stream being submitted to the kernel via
glamor.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=65761
Cc: "10.1" mesa-stable@lists.freedesktop.org
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agost/dri: remove #ifdef DRM_CAP_PRIME guard
Emil Velikov [Thu, 13 Feb 2014 00:44:32 +0000 (00:44 +0000)]
st/dri: remove #ifdef DRM_CAP_PRIME guard

Required for libdrm 2.4.37 and earlier. Both scons and automake
require version 2.4.38 now so that guard is not longer needed.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoautomake: remove leftover XORG and LIBKMS variables
Emil Velikov [Tue, 18 Feb 2014 00:08:03 +0000 (00:08 +0000)]
automake: remove leftover XORG and LIBKMS variables

No longer set or used since the removal of st/xorg.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoscons: sync package requirements
Emil Velikov [Thu, 13 Feb 2014 00:28:27 +0000 (00:28 +0000)]
scons: sync package requirements

xorg-server and libkms is no longer required since the removal
of the xorg state-tracker.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoconfigure: bump up libdrm requirement to 2.4.38
Emil Velikov [Thu, 13 Feb 2014 00:23:16 +0000 (00:23 +0000)]
configure: bump up libdrm requirement to 2.4.38

This is the first version that introduced DRM_CAP_PRIME, which is
implicitly required by egl/wayland.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoconfigure: use test -n whenever possible
Emil Velikov [Tue, 4 Feb 2014 17:32:03 +0000 (17:32 +0000)]
configure: use test -n whenever possible

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoconfigure: use test -z whenever possible
Emil Velikov [Tue, 11 Feb 2014 14:47:37 +0000 (14:47 +0000)]
configure: use test -z whenever possible

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoconfigure: cleanup classic dri drivers handling
Emil Velikov [Tue, 4 Feb 2014 17:26:38 +0000 (17:26 +0000)]
configure: cleanup classic dri drivers handling

* Make sure that only drivers that are handled by configure.ac
are included in DRI_DIRS.
* Change with_dri_drivers default value to auto, and set enable
autodetection, when enable_opengl is on.

v2: Move "test" to the correct location.
v3: Squash DRI_DIRS handling before the switch statement.
Suggested by Ilia Mirkin

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoconfigure: compact ppc/sparc DRI_DIRS handling
Emil Velikov [Mon, 3 Feb 2014 21:05:19 +0000 (21:05 +0000)]
configure: compact ppc/sparc DRI_DIRS handling

Both arches have the same list of dri_dirs.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoconfigure: drop explicit DRI_DIRS assignment on some platforms/arches
Emil Velikov [Mon, 3 Feb 2014 20:54:08 +0000 (20:54 +0000)]
configure: drop explicit DRI_DIRS assignment on some platforms/arches

Both x86_64|amd64 and *bsd, already set the full range of available
classic dri drivers. Drop the explicit assignment, and fall back to
the generic default.
Keep explicit list from plafroms/arches that do not handle the default
list.

Update help strings, to explicitly mention "classic" for applicable
DRI drivers.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoconfigure: cleanup switch statement
Emil Velikov [Mon, 3 Feb 2014 20:38:10 +0000 (20:38 +0000)]
configure: cleanup switch statement

Move all the cases within one switch statement and handle
i9{1,6}5 and r{adeon,200} independently.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agotargets/vdpau: Don't link unused libraries
Kusanagi Kouichi [Mon, 17 Feb 2014 08:29:14 +0000 (17:29 +0900)]
targets/vdpau: Don't link unused libraries

libvdpau, libselinux and libexpat are not used.

Signed-off-by: Kusanagi Kouichi <slash@ac.auone-net.jp>
7 years agoconfigure: Try pkg-config first for libselinux
Kusanagi Kouichi [Sat, 15 Feb 2014 02:53:00 +0000 (11:53 +0900)]
configure: Try pkg-config first for libselinux

v2 (Emil) Add SELINUX_CFLAGS in the respective locations

Signed-off-by: Kusanagi Kouichi <slash@ac.auone-net.jp>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com> (v1)
7 years agotargets/vdpau: Always use c++ to link
Kusanagi Kouichi [Wed, 12 Feb 2014 07:07:55 +0000 (16:07 +0900)]
targets/vdpau: Always use c++ to link

If built without llvm, the following error occurs with mplayer:

Failed to open VDPAU backend .../libvdpau_r600.so: undefined symbol: _ZTVN10__cxxabiv117__class_type_infoE
[vo/vdpau] Error when calling vdp_device_create_x11: 1

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Kusanagi Kouichi <slash@ac.auone-net.jp>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
7 years agost/xvmc: fix tests so that they pass
Ilia Mirkin [Sun, 16 Feb 2014 07:21:59 +0000 (02:21 -0500)]
st/xvmc: fix tests so that they pass

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Christian König <christian.koenig@amd.com>
7 years agopipe-loader: add pipe loader for freedreno/msm
Rob Clark [Mon, 10 Feb 2014 15:45:36 +0000 (10:45 -0500)]
pipe-loader: add pipe loader for freedreno/msm

Signed-off-by: Rob Clark <robclark@freedesktop.org>
7 years agost/xa: missing handle type
Rob Clark [Mon, 10 Feb 2014 15:44:02 +0000 (10:44 -0500)]
st/xa: missing handle type

DRM_API_HANDLE_TYPE_SHARED is zero, so doesn't actually fix anything.
But we shouldn't rely on SHARED handle type being zero.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
7 years agost/xa: use pipe-loader to get screen
Rob Clark [Mon, 10 Feb 2014 15:43:11 +0000 (10:43 -0500)]
st/xa: use pipe-loader to get screen

This lets multiple gallium drivers use XA.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
7 years agopipe-loader: split out "client" version
Rob Clark [Mon, 10 Feb 2014 14:39:23 +0000 (09:39 -0500)]
pipe-loader: split out "client" version

Build two versions of pipe-loader, with only the client version linking
in x11 client side dependencies.  This will allow the XA state tracker
to use pipe-loader.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
7 years agofreedreno/a3xx/compiler: use (ss) for WAR hazards
Rob Clark [Sun, 16 Feb 2014 00:01:38 +0000 (19:01 -0500)]
freedreno/a3xx/compiler: use (ss) for WAR hazards

Seems texture sample instructions don't immediately consume there
src(s).  In fact, some shaders from blob compiler seem to indiciate that
it does not even count the texture sample instructions when calculating
number of delay slots to fill for non-sample instructions.  (Although so
far it seems inconclusive as to whether this is required.)

In particular, when a src register of a previous texture sample
instruction is clobbered, the (ss) bit is needed to synchronize with the
tex pipeline to ensure it has picked up the previous values before they
are overwritten.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
7 years agofreedreno/a3xx/compiler: fix RA typo
Rob Clark [Sun, 16 Feb 2014 12:41:59 +0000 (07:41 -0500)]
freedreno/a3xx/compiler: fix RA typo

Was supposed to be a '+', otherwise we end up with a negative offset and
choosing registers below the assigned range.

This seems to fix the scheduling mystery "solved" by adding in extra
delay slots.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
7 years agofreedreno/a3xx/compiler: handle kill properly (new compiler)
Rob Clark [Sun, 16 Feb 2014 12:35:20 +0000 (07:35 -0500)]
freedreno/a3xx/compiler: handle kill properly (new compiler)

Since 'kill' does not produce a result, the new compiler was happily
optimizing them out.  We need to instead track 'kill's similar to
outputs.  But since there is no non-predicated kill instruction,
(and for flattend if/else we do want them to be predicated), we need
to track the topmost branch condition on the stack and use that as src
arg to the kill.  For a kill at the topmost level, we have to generate
an immediate 1.0 to feed into the cmps.f for setting the predicate
register.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
7 years agofreedreno/a3xx/compiler: trans_cmp() sanity
Rob Clark [Sun, 16 Feb 2014 12:29:13 +0000 (07:29 -0500)]
freedreno/a3xx/compiler: trans_cmp() sanity

Thanks to figuring out 32bit float render target, and adding regdump
test in fdre-a3xx, I can more easily play around with instructions to
figure out range of inputs/outputs/etc.  And from this I can conclude
that cmps.f works more like expected and I can do something much more
simple in trans_cmp() (compared to before which was more closely
emulating the instruction sequence of the blob compiler).

And using sel.b32 (binary 0/1) often makes more sense than sel.f32
(+/- float) or sel.u32 (+/- uint) as it can use the output directly
from cmps.f without needing the 'add.s tmp0, tmp0, -1'.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
7 years agofreedreno: fix problems if no color buf bound
Rob Clark [Mon, 10 Feb 2014 14:14:15 +0000 (09:14 -0500)]
freedreno: fix problems if no color buf bound

Signed-off-by: Rob Clark <robclark@freedesktop.org>
7 years agometa: Don't try to enable FF texturing when we're using GLSL.
Eric Anholt [Wed, 5 Feb 2014 23:45:25 +0000 (15:45 -0800)]
meta: Don't try to enable FF texturing when we're using GLSL.

On a core context, this would throw an error.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agomain: Avoid double-free of shader Label
Carl Worth [Thu, 13 Feb 2014 17:49:27 +0000 (09:49 -0800)]
main: Avoid double-free of shader Label

As documented, the _mesa_free_shader_program_data function:

"Frees all the data that hangs off a shader program object, but not
the object itself."

This means that this function may be called multiple times on the same object,
(and has been observed to). Meanwhile, the shProg->Label field was not being
set to NULL after its free(). This led to a second call to free() of the same
address on the second call to this function.

Fix this by setting this field to NULL after free(), (just as with all other
calls to free() in this function).

Reviewed-by: Brian Paul <brianp@vmware.com>
CC: mesa-stable@lists.freedesktop.org
7 years agogallium/pipebuffer: change pb_cache_manager_create() size_factor to float
Brian Paul [Fri, 14 Feb 2014 14:45:23 +0000 (07:45 -0700)]
gallium/pipebuffer: change pb_cache_manager_create() size_factor to float

Requested by Marek.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Cc: "10.1" <mesa-stable@lists.freedesktop.org>
7 years agosvga/winsys: Propagate surface shared information to the winsys
Thomas Hellstrom [Sat, 8 Feb 2014 17:51:15 +0000 (09:51 -0800)]
svga/winsys: Propagate surface shared information to the winsys

The linux winsys needs to know whether a surface is shared.
For guest-backed surfaces we need this information to avoid allocating a
mob out of the mob cache for shared surfaces, but instead allocate a shared
mob, that is never put in the mob cache, from the kernel.

Also previously, all surfaces were given the "shareable" attribute when
allocated from the kernel. This is too permissive for client-local surfaces.
Now that we have the needed info, only set the "shareable" attribute if the
client indicates that it needs to share the surface.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Cc: "10.1" <mesa-stable@lists.freedesktop.org>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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

7 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.

7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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

7 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>
7 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>
7 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

7 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>
7 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)
7 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>
7 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)
7 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)
7 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)
7 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)
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>