mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-02-15 02:20:29 +01:00
svga: Ensure pending drawing commands other surface operations are emitted before DMAs.
This behavior was last when moving the transfers to the contexts. This fixes several piglit failures, which were reading the color renderbuffer before the draw operations were emitted.
This commit is contained in:
parent
f9b4867846
commit
0ced789a0b
8 changed files with 40 additions and 17 deletions
|
|
@ -34,6 +34,7 @@
|
|||
|
||||
#include "svga_context.h"
|
||||
#include "svga_screen.h"
|
||||
#include "svga_surface.h"
|
||||
#include "svga_resource_texture.h"
|
||||
#include "svga_resource_buffer.h"
|
||||
#include "svga_resource.h"
|
||||
|
|
@ -247,6 +248,30 @@ void svga_hwtnl_flush_retry( struct svga_context *svga )
|
|||
assert(ret == 0);
|
||||
}
|
||||
|
||||
|
||||
/* Emit all operations pending on host surfaces.
|
||||
*/
|
||||
void svga_surfaces_flush(struct svga_context *svga)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
/* Emit buffered drawing commands.
|
||||
*/
|
||||
svga_hwtnl_flush_retry( svga );
|
||||
|
||||
/* Emit back-copy from render target view to texture.
|
||||
*/
|
||||
for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) {
|
||||
if (svga->curr.framebuffer.cbufs[i])
|
||||
svga_propagate_surface(svga, svga->curr.framebuffer.cbufs[i]);
|
||||
}
|
||||
|
||||
if (svga->curr.framebuffer.zsbuf)
|
||||
svga_propagate_surface(svga, svga->curr.framebuffer.zsbuf);
|
||||
|
||||
}
|
||||
|
||||
|
||||
struct svga_winsys_context *
|
||||
svga_winsys_context( struct pipe_context *pipe )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -453,6 +453,8 @@ void svga_context_flush( struct svga_context *svga,
|
|||
|
||||
void svga_hwtnl_flush_retry( struct svga_context *svga );
|
||||
|
||||
void svga_surfaces_flush(struct svga_context *svga);
|
||||
|
||||
struct pipe_context *
|
||||
svga_context_create(struct pipe_screen *screen,
|
||||
void *priv);
|
||||
|
|
|
|||
|
|
@ -50,7 +50,9 @@ static void svga_surface_copy(struct pipe_context *pipe,
|
|||
struct pipe_surface *srcsurf, *dstsurf;*/
|
||||
unsigned dst_face, dst_z, src_face, src_z;
|
||||
|
||||
svga_hwtnl_flush_retry( svga );
|
||||
/* Emit buffered drawing commands, and any back copies.
|
||||
*/
|
||||
svga_surfaces_flush( svga );
|
||||
|
||||
#if 0
|
||||
srcsurf = screen->get_tex_surface(screen, src_tex,
|
||||
|
|
|
|||
|
|
@ -36,20 +36,10 @@ static void svga_flush( struct pipe_context *pipe,
|
|||
struct pipe_fence_handle **fence )
|
||||
{
|
||||
struct svga_context *svga = svga_context(pipe);
|
||||
int i;
|
||||
|
||||
/* Emit buffered drawing commands.
|
||||
/* Emit buffered drawing commands, and any back copies.
|
||||
*/
|
||||
svga_hwtnl_flush_retry( svga );
|
||||
|
||||
/* Emit back-copy from render target view to texture.
|
||||
*/
|
||||
for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) {
|
||||
if (svga->curr.framebuffer.cbufs[i])
|
||||
svga_propagate_surface(pipe, svga->curr.framebuffer.cbufs[i]);
|
||||
}
|
||||
if (svga->curr.framebuffer.zsbuf)
|
||||
svga_propagate_surface(pipe, svga->curr.framebuffer.zsbuf);
|
||||
svga_surfaces_flush( svga );
|
||||
|
||||
/* Flush command queue.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ static void svga_set_framebuffer_state(struct pipe_context *pipe,
|
|||
|
||||
for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++)
|
||||
if (dst->cbufs[i] && dst->cbufs[i] != fb->cbufs[i])
|
||||
svga_propagate_surface(pipe, dst->cbufs[i]);
|
||||
svga_propagate_surface(svga, dst->cbufs[i]);
|
||||
}
|
||||
|
||||
/* XXX: Actually the virtual hardware may support rendertargets with
|
||||
|
|
|
|||
|
|
@ -215,6 +215,10 @@ svga_transfer_dma(struct svga_context *svga,
|
|||
SVGA_DBG(DEBUG_PERF, "%s: readback transfer\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
/* Ensure any pending operations on host surfaces are queued on the command
|
||||
* buffer first.
|
||||
*/
|
||||
svga_surfaces_flush( svga );
|
||||
|
||||
if(!st->swbuf) {
|
||||
/* Do the DMA transfer in a single go */
|
||||
|
|
|
|||
|
|
@ -340,7 +340,7 @@ void svga_mark_surfaces_dirty(struct svga_context *svga)
|
|||
* pipe is optional context to inline the blit command in.
|
||||
*/
|
||||
void
|
||||
svga_propagate_surface(struct pipe_context *pipe, struct pipe_surface *surf)
|
||||
svga_propagate_surface(struct svga_context *svga, struct pipe_surface *surf)
|
||||
{
|
||||
struct svga_surface *s = svga_surface(surf);
|
||||
struct svga_texture *tex = svga_texture(surf->texture);
|
||||
|
|
@ -365,7 +365,7 @@ svga_propagate_surface(struct pipe_context *pipe, struct pipe_surface *surf)
|
|||
|
||||
if (s->handle != tex->handle) {
|
||||
SVGA_DBG(DEBUG_VIEWS, "svga: Surface propagate: tex %p, level %u, from %p\n", tex, surf->u.tex.level, surf);
|
||||
svga_texture_copy_handle(svga_context(pipe),
|
||||
svga_texture_copy_handle(svga,
|
||||
s->handle, 0, 0, 0, s->real_level, s->real_face,
|
||||
tex->handle, 0, 0, zslice, surf->u.tex.level, face,
|
||||
u_minify(tex->b.b.width0, surf->u.tex.level),
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ struct svga_surface
|
|||
|
||||
|
||||
extern void
|
||||
svga_propagate_surface(struct pipe_context *pipe, struct pipe_surface *surf);
|
||||
svga_propagate_surface(struct svga_context *svga, struct pipe_surface *surf);
|
||||
|
||||
extern boolean
|
||||
svga_surface_needs_propagation(struct pipe_surface *surf);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue