st/dri: use st->flush callback to flush the backbuffer

Previously the flush was done before the call to st->flush but
could lead to problems as FLUSH_VERTICES could push some work
that would change the backbuffer (or modify it).

With this commit, all the backbuffer flushing code is executed
right before the call to st_flush.

Closes: drm/amd#842
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=205049

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
42 jobs for !2836 with fix_dcc_raven in 18 minutes and 49 seconds (queued for 12 seconds)
detached
Status Job ID Name Coverage
  Container
passed #1102825
aarch64
arm_build

00:00:20

passed #1102826
aarch64
arm_test

00:00:23

passed #1102821
lava_arm64

00:00:33

passed #1102820
lava_armhf

00:00:18

passed #1102822
x86_build

00:00:33

passed #1102824
x86_build_old

00:00:19

passed #1102823
x86_test-gl

00:00:20

 
  Build
passed #1102828
lava-build:arm64

00:05:22

passed #1102827
lava-build:armhf

00:04:01

passed #1102832
aarch64
meson-arm64

00:03:07

passed #1102831
aarch64
meson-armhf

00:01:23

passed #1102833
meson-clang

00:07:05

passed #1102836
meson-clover

00:05:22

passed #1102837
meson-clover-old-llvm

00:04:40

passed #1102839
meson-i386

00:04:17

passed #1102830
meson-main

00:06:44

passed #1102840
meson-mingw32-x86_64

00:04:12

passed #1102829
meson-testing

00:03:43

passed #1102838
meson-vulkan

00:03:29

passed #1102841
scons

00:10:43

passed #1102842
scons-old-llvm

00:06:52

passed #1102834
scons-swr

00:01:47

passed #1102835
scons-win64

00:10:21

 
  Test
passed #1102861
db410c
arm64_a306_gles2

00:05:25

passed #1102858
mesa-cheza
arm64_a630_gles2

00:01:32

passed #1102860
mesa-cheza
arm64_a630_gles3

00:05:56

passed #1102859
mesa-cheza
arm64_a630_gles31

00:04:14

passed #1102843
lava-sun50i-h6-pine-h64
panfrost-t720-test:arm64

00:09:13

passed #1102844
lava-rk3288-veyron-jaq
panfrost-t760-test:armhf

00:05:08

passed #1102846
lava-meson-gxm-khadas-vim2
panfrost-t820-test:arm64

00:12:35

passed #1102845
lava-rk3399-gru-kevin
panfrost-t860-test:arm64

00:04:38

passed #1102848
piglit-glslparser

00:05:44

passed #1102847
piglit-quick_gl

00:08:59

passed #1102849
piglit-quick_shader

00:04:43

passed #1102850
test-llvmpipe-gles2

00:05:15

passed #1102851
test-softpipe-gles2

00:02:52

passed #1102854
test-softpipe-gles31 1/4

00:02:14

passed #1102852
test-softpipe-gles3 1/2

00:05:06

passed #1102855
test-softpipe-gles31 2/4

00:03:05

passed #1102856
test-softpipe-gles31 3/4

00:03:44

passed #1102857
test-softpipe-gles31 4/4

00:03:34

passed #1102853
test-softpipe-gles3 2/2

00:05:37