nv50: correctly calculate the number of vertical blocks during transfer map

Cc: "10.0 10.1" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
mesa: remove unused driver hook BindBuffer

Reviewed-by: Fredrik Höglund <fredrik@kde.org>
mesa: add storage flags parameter to Driver.BufferData

It will be used by glBufferStorage. The parameters are chosen according
to ARB_buffer_storage.

Reviewed-by: Fredrik Höglund <fredrik@kde.org>
mesa: implement glBufferStorage, immutable buffers; add extension enable flag

Reviewed-by: Fredrik Höglund <fredrik@kde.org>

v2: dropped the error that DYNAMIC_STORAGE is required for MAP_WRITE_BIT,
    the error is removed in the latest revision of GL 4.4
glapi: add ARB_buffer_storage

Reviewed-by: Fredrik Höglund <fredrik@kde.org>
mesa: add error checks to glMapBufferRange, glMapBuffer for ARB_buffer_storage

Reviewed-by: Fredrik Höglund <fredrik@kde.org>
mesa: allow buffers mapped with the persistent flag to be used by the GPU

v2: also fixed InvalidateBufferData, added citations from the 4.4 spec

Reviewed-by: Fredrik Höglund <fredrik@kde.org>
gallium: add interface for persistent and coherent buffer mappings

Required for ARB_buffer_storage.
st/mesa: implement ARB_buffer_storage

Reviewed-by: Fredrik Höglund <fredrik@kde.org>
r300g,r600g,radeonsi: add support for ARB_buffer_storage

All GTT memory mappings are coherent and therefore can be persistent.

Reviewed-by: Fredrik Höglund <fredrik@kde.org>
gallium: the other drivers don't support ARB_buffer_storage

Reviewed-by: Fredrik Höglund <fredrik@kde.org>
gallium/upload_mgr: don't unmap buffers if persistent mappings are supported

Reviewed-by: Fredrik Höglund <fredrik@kde.org>
gallium/upload_mgr: remove useless variable "size"

Reviewed-by: Fredrik Höglund <fredrik@kde.org>
docs: update ARB_buffer_storage status

Reviewed-by: Fredrik Höglund <fredrik@kde.org>
mesa: allow buffers to be mapped multiple times

OpenGL allows a buffer to be mapped only once, but we also map buffers
internally, e.g. in the software primitive restart fallback, for PBOs,
vbo_get_minmax_index, etc. This has always been a problem, but it will
be a bigger problem with persistent buffer mappings, which will prevent
all Mesa functions from mapping buffers for internal purposes.

This adds a driver interface to core Mesa which supports multiple buffer
mappings and allows 2 mappings: one for the GL user and one for Mesa.

Note that Gallium supports an unlimited number of buffer and texture
mappings, so it's not really an issue for Gallium.

v2: fix unmapping in xm_dd.c, remove the GL errors there
v3: fix the intel driver (by Fredrik)

Reviewed-by: Fredrik Höglund <fredrik@kde.org>
radeonsi: move PA_SU_POLY_OFFSET_DB_FMT_CNTL to framebuffer state

It doesn't depend on anything else.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
r600g,radeonsi: share r600_surface

I'm gonna use this in radeonsi.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
r600g: use r600_surface::db_z_info

db_z_info was unused. This just renames the variable to match the register
name.

Now, db_depth_info is unused on Evergreen.
Both variables will be needed on SI though.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
r600g: remove r600_surface::htile_enabled

v2: use one of the htile registers instead

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
r600g: remove r600_resource.h

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>