st/mesa: Only pause queries if there are any active queries to pause.

Previously, ReadPixels, PBO upload/download, and clears would call
cso_save_state with CSO_PAUSE_QUERIES, causing cso_context to call
pipe->set_active_query_state() twice for each operation.  This can
potentially cause driver work to enable/disable statistics counters.

But often, there are no queries happening which need to be paused.
By keeping a simple tally of active queries, we can skip this work.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
22 jobs for !1913 with st-pausequeries in 21 seconds (queued for 16 seconds)
detached
Status Job ID Name Coverage
  Containers Build
passed #595345
debian

00:00:21

 
  Build+Test
canceled #595354
meson-arm64

canceled #595353
meson-armhf

canceled #595348
meson-clang

canceled #595351
meson-clover

canceled #595355
meson-i386

canceled #595346
meson-main

canceled #595347
meson-swr-glvnd

canceled #595352
meson-vulkan

canceled #595357
scons-llvm

canceled #595356
scons-nollvm

canceled #595349
scons-swr

canceled #595350
scons-win64

 
  Test
canceled #595358
test-llvmpipe-gles2 1/4

canceled #595359
test-llvmpipe-gles2 2/4

canceled #595360
test-llvmpipe-gles2 3/4

canceled #595361
test-llvmpipe-gles2 4/4

canceled #595362
test-softpipe-gles2 1/4

canceled #595363
test-softpipe-gles2 2/4

canceled #595364
test-softpipe-gles2 3/4

canceled #595365
test-softpipe-gles2 4/4

canceled #595366
test-softpipe-gles3-limited