svga: Validate surface during copy check

Fixes piglit test arb_copy_buffer-data-sync.
The test fails inconsistently because svga_buffer_surface handle is sometimes
not present at time of copy check, so the copy does not happen.
Adding a validata_host_surface() call for the surface being copied ensures the
handle is present.

Signed-off-by: Maaz Mombasawala <maaz.mombasawala@broadcom.com>
Reviewed-by: Neha Bhende <neha.bhende@broadcom.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29949>
This commit is contained in:
Maaz Mombasawala
2023-12-20 12:38:28 -08:00
committed by Marge Bot
parent e5b53d9408
commit 1a8b232115

View File

@@ -12,6 +12,7 @@
#include "svga_resource_buffer.h"
#include "svga_resource_texture.h"
#include "svga_surface.h"
#include "svga_resource_buffer_upload.h"
//#include "util/u_blit_sw.h"
#include "util/format/u_format.h"
@@ -807,6 +808,13 @@ is_texture_valid_to_copy(struct svga_context *svga,
struct svga_buffer *buf = svga_buffer(resource);
struct svga_buffer_surface *bufsurf = buf->bufsurf;
if (!bufsurf) {
if (svga_buffer_validate_host_surface(svga, buf, buf->bind_flags)
!= PIPE_OK)
return false;
bufsurf = buf->bufsurf;
}
return (bufsurf &&
bufsurf->surface_state >= SVGA_SURFACE_STATE_UPDATED);
} else {