nine: Add state tracker nine for Direct3D9

Work of Joakim Sindholt (zhasha) and Christoph Bumiller (chrisbmr).
v2 Small fixies and sync with latest Mesa by David Heidelberger (okias).
v3 Build improvements by Emil Velikov (xexaxo).
v4 Modified to use directly PIPE_CAP_VIDEO_MEMORY
instead of PIPE_CAP_DEVICE_MEMORY_SIZE.
nine: query9, improve QUERY handling

This fix wine tests segfault.

Signed-off-by: David Heidelberger <david.heidelberger@ixit.cz>
nine: device9: check MIPMAP levels

Fixes wine d3d9 device test.

Signed-off-by: David Heidelberger <david.heidelberger@ixit.cz>
nine: D3DFMT_UNKNOWN isn't allowed screen format

Fixed one wine d3d9 test and StarCraft 2 works fine with it.

Signed-off-by: David Heidelberger <david.heidelberger@ixit.cz>