svga: refactor some shader code

Put common code in new svga_shader.c file.  Considate separate vertex/
fragment shader ID generation.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
(cherry picked from commit 4686f610b18a04bc6213ccadf7be1176bbda3e34)
svga: check shader size against max command buffer size

If the shader is too large, plug in a dummy shader.  This patch also
reworks the existing dummy shader code.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
(cherry picked from commit 97fdace6d70b6499d0490cd6ca2a4253284b386d)
svga: replace out-of-temps assertion with debug warning

Signed-off-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 23d4ff53d4acd0c33c633174a288a640664036fe)
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>
(cherry picked from commit 2e0c90847f16a9cf2a40436beacb65c65535fa4a)
svga: update dumping code with new GBS commands, etc

Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Cc: "10.1" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 024711385ec5333976b124d33a030c30f1345ed1)
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>
(cherry picked from commit d993ada50cf2f112bfff2bd7fbb5a6c25ca00306)
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>
(cherry picked from commit 823fbfdca7165ac11eab2a7e168960f5874ebdc3)
svga: add svga_have_gb_objects/dma() functions

Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Cc: "10.1" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 31dfefc47f9f12c49fd3cfb27ba4fe384cb60380)
svga: update constant buffer code for GBS

Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Cc: "10.1" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 2f1fc8db108eb771414aa5440d4c439f63f4e7c1)
svga: update shader code for GBS

Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Cc: "10.1" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit f84c830b144fd4d53f862fc6ad05541e5bf60a3b)
svga: add helpers for tracking rendering to textures

Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Cc: "10.1" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit c1e60a61e8ca3bdac0530ad1aeb3c751f273b73d)
svga: track which textures are rendered to

Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Cc: "10.1" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit d0c22a6d53a9cce2d40006f3d4d7dd7e2f63aca9)
svga: adjust adjustment for point coordinates

Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Cc: "10.1" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit f8bbd8261d297be11f1f2eaf768c2a8ace0cb69d)
svga: remove a couple unneeded assertions

Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Cc: "10.1" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 6476bcbc5005b76e1494a201f92f3c76bd8e9727)
svga: add new helper functions for GBS buffers

Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Cc: "10.1" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit e0a6fb09bdfde40253b924b6c9d1fdf3f16fed21)
svga: update buffer code for GBS

Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Cc: "10.1" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 72b0e959fc38cf4f01d8aaeabe7336cc88588f90)
svga: update texture code for GBS

Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Cc: "10.1" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 3d1fd6df5315cfa4b9c8b1332f5078a89abc3ed8)
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>
(cherry picked from commit c9e9b1862b472b2671b8d3b339f9f7624a272073)
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>
(cherry picked from commit 8af358d8bc9f7563cd76313b16d7b149197a4b2c)
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>
(cherry picked from commit 59e7c596215155b556ba8cf06233b621b88f49c6)