From 116a02be2264807dafb5fdfd4e3c913bb728c11f Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Mon, 11 Jan 2010 11:41:47 +1000 Subject: st/dri: update dri2 drawables when viewport is changed Fixes gnome-shell on nouveau, as well as window resize with various other applications. Signed-off-by: Ben Skeggs --- src/gallium/include/pipe/p_screen.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/gallium/include/pipe') diff --git a/src/gallium/include/pipe/p_screen.h b/src/gallium/include/pipe/p_screen.h index f0a4de5df3..b8e001a6b0 100644 --- a/src/gallium/include/pipe/p_screen.h +++ b/src/gallium/include/pipe/p_screen.h @@ -266,6 +266,11 @@ struct pipe_screen { void (*video_surface_destroy)( struct pipe_video_surface *vsfc ); + /** + * Do any special operations to ensure buffer size is correct + */ + void (*update_buffer)( struct pipe_screen *ws, + void *context_private ); /** * Do any special operations to ensure frontbuffer contents are -- cgit v1.2.3 From 13c2475339d502644464041fcaac3890770d3abd Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 21 Jan 2010 09:13:15 -0800 Subject: gallium: Remove temporary hack for the absence of a discard flag. PIPE_BUFFER_USAGE_DISCARD flag now exists. --- src/gallium/include/pipe/p_inlines.h | 7 ------- 1 file changed, 7 deletions(-) (limited to 'src/gallium/include/pipe') diff --git a/src/gallium/include/pipe/p_inlines.h b/src/gallium/include/pipe/p_inlines.h index 5fbd62a03d..6949f56574 100644 --- a/src/gallium/include/pipe/p_inlines.h +++ b/src/gallium/include/pipe/p_inlines.h @@ -63,13 +63,6 @@ pipe_buffer_map(struct pipe_screen *screen, if(screen->buffer_map_range) { unsigned offset = 0; unsigned length = buf->size; - - /* XXX: Actually we should be using/detecting DISCARD - * instead of assuming that WRITE implies discard */ - if((usage & PIPE_BUFFER_USAGE_CPU_WRITE) && - !(usage & PIPE_BUFFER_USAGE_DISCARD)) - usage |= PIPE_BUFFER_USAGE_CPU_READ; - return screen->buffer_map_range(screen, buf, offset, length, usage); } else -- cgit v1.2.3 From 707b28136f7b7dea49bce23b0fcd0a757646ff7a Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 21 Jan 2010 09:19:25 -0800 Subject: gallium: Set PIPE_BUFFER_USAGE_DISCARD flag in pipe_buffer_write. --- src/gallium/include/pipe/p_inlines.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/gallium/include/pipe') diff --git a/src/gallium/include/pipe/p_inlines.h b/src/gallium/include/pipe/p_inlines.h index 6949f56574..11ed46c7e7 100644 --- a/src/gallium/include/pipe/p_inlines.h +++ b/src/gallium/include/pipe/p_inlines.h @@ -119,7 +119,8 @@ pipe_buffer_write(struct pipe_screen *screen, map = pipe_buffer_map_range(screen, buf, offset, size, PIPE_BUFFER_USAGE_CPU_WRITE | - PIPE_BUFFER_USAGE_FLUSH_EXPLICIT); + PIPE_BUFFER_USAGE_FLUSH_EXPLICIT | + PIPE_BUFFER_USAGE_DISCARD); assert(map); if(map) { memcpy((uint8_t *)map + offset, data, size); -- cgit v1.2.3 From a8477fb00c1a7b8bfefb5779bc05c51cdb29cdb5 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 21 Jan 2010 09:30:22 -0800 Subject: gallium: New inline to write buffers which avoids synchronization. --- src/gallium/include/pipe/p_inlines.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'src/gallium/include/pipe') diff --git a/src/gallium/include/pipe/p_inlines.h b/src/gallium/include/pipe/p_inlines.h index 11ed46c7e7..72f5c1dc2a 100644 --- a/src/gallium/include/pipe/p_inlines.h +++ b/src/gallium/include/pipe/p_inlines.h @@ -129,6 +129,37 @@ pipe_buffer_write(struct pipe_screen *screen, } } +/** + * Special case for writing non-overlapping ranges. + * + * We can avoid GPU/CPU synchronization when writing range that has never + * been written before. + */ +static INLINE void +pipe_buffer_write_nooverlap(struct pipe_screen *screen, + struct pipe_buffer *buf, + unsigned offset, unsigned size, + const void *data) +{ + void *map; + + assert(offset < buf->size); + assert(offset + size <= buf->size); + assert(size); + + map = pipe_buffer_map_range(screen, buf, offset, size, + PIPE_BUFFER_USAGE_CPU_WRITE | + PIPE_BUFFER_USAGE_FLUSH_EXPLICIT | + PIPE_BUFFER_USAGE_DISCARD | + PIPE_BUFFER_USAGE_UNSYNCHRONIZED); + assert(map); + if(map) { + memcpy((uint8_t *)map + offset, data, size); + pipe_buffer_flush_mapped_range(screen, buf, offset, size); + pipe_buffer_unmap(screen, buf); + } +} + static INLINE void pipe_buffer_read(struct pipe_screen *screen, struct pipe_buffer *buf, -- cgit v1.2.3