freedreno: fix problems if no color buf bound

Signed-off-by: Rob Clark <robclark@freedesktop.org>
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>
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>
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>
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>
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>
st/xa: use pipe-loader to get screen

This lets multiple gallium drivers use XA.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
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>
pipe-loader: add pipe loader for freedreno/msm

Signed-off-by: Rob Clark <robclark@freedesktop.org>
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>
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>
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)
targets/vdpau: Don't link unused libraries

libvdpau, libselinux and libexpat are not used.

Signed-off-by: Kusanagi Kouichi <slash@ac.auone-net.jp>
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>
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>
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>
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>
configure: use test -z whenever possible

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
configure: use test -n whenever possible

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
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>