nine: Add state tracker nine for Direct3D9

Work of Joakim Sindholt (zhasha) and Christoph Bumiller (chrisbmr).
Small fixies and sync with latest Mesa by David Heidelberger (okias).
Build improvements by Emil Velikov (xexaxo).
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>