mesa: change MAX_PROGRAM_ADDRESS_REGS to 1, clamp to it in state tracker

We've never properly supported more than one address register.  There
isn't even a field in prog_src_register or prog_dst_register to indicate
which address register to use if RelAddr!=0.

In the state tracker, clamp MaxAddressRegs against MAX_PROGRAM_ADDRESS_REGS
since many gallium drivers do support more.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=65226

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
intel: make intel_flush_front safe to call during initial MakeCurrent

The patch that follows will fix a bug that prevents
intel_flush_front() from being called often enough.  In doing so, it
will create a situation where intel_flush_front() during the initial
call to glXMakeCurrent().  In this circumstance, ctx->DrawBuffer
hasn't been initialized yet and is NULL.  Fortunately,
intel->front_buffer_dirty is false, so intel_flush_front() doesn't
actually need to do anything.  To avoid a segfault, swap the order of
terms in intel_flush_front()'s if statement.
intel: flush fake front buffer more robustly.

When a fake front buffer is in use, if we request the front buffer
(using screen->dri2.loader->getBuffersWithFormat()), the X server
copies the real front buffer to the fake front buffer and returns the
fake front buffer.  We sometimes make redundant requests for the front
buffer (due to using a single counter to track invalidates for both
the front and back buffers), so there's a danger of pending front
buffer rendering getting overwritten when the redundant front buffer
request occurs.

Previous to this patch, intel_update_renderbuffers() worked around
that problem by sometimes doing intel_flush() and intel_flush_front()
before calling intel_query_dri2_buffers().  But it only did the
workaround when the front buffer was bound for drawing; it didn't do
it when the front buffer was bound for reading.

This patch moves the workaround code to intel_query_dri2_buffers(), so
that it happens in exactly the circumstances where it is needed.

This should fix some of the sporadic failures in Piglit tests
fbo-sys-blit and fbo-sys-sub-blit.
intel: flush fake front buffer if server is about to destroy it.

Fixes piglit test "spec/!OpenGL 1.0/gl-1.0-front-invalidate-back"