summaryrefslogtreecommitdiffstats
path: root/src/gallium/winsys/g3dvl/dri
diff options
context:
space:
mode:
authorChristian König <[email protected]>2012-02-25 12:26:37 +0100
committerChristian König <[email protected]>2012-03-01 15:06:55 +0100
commitc14c84f383309ee0fdf007c0d3e968c38f3af86e (patch)
treefbf5050c11df315d3f4728307e273e0f91e6f42c /src/gallium/winsys/g3dvl/dri
parent91ac681113b05f8fe4dff51c3b80f967ac05c867 (diff)
vl: move dirty area handling into winsys abstraction
Fixing uninitialized areas in SwapBuffers mode. Signed-off-by: Christian König <[email protected]>
Diffstat (limited to 'src/gallium/winsys/g3dvl/dri')
-rw-r--r--src/gallium/winsys/g3dvl/dri/dri_winsys.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/gallium/winsys/g3dvl/dri/dri_winsys.c b/src/gallium/winsys/g3dvl/dri/dri_winsys.c
index 096f068dbb4..c1e4a54bc49 100644
--- a/src/gallium/winsys/g3dvl/dri/dri_winsys.c
+++ b/src/gallium/winsys/g3dvl/dri/dri_winsys.c
@@ -43,6 +43,7 @@
#include "util/u_hash_table.h"
#include "util/u_inlines.h"
+#include "vl/vl_compositor.h"
#include "vl_winsys.h"
struct vl_dri_screen
@@ -51,6 +52,12 @@ struct vl_dri_screen
xcb_connection_t *conn;
xcb_drawable_t drawable;
+ unsigned width, height;
+
+ bool current_buffer;
+ uint32_t buffer_names[2];
+ struct u_rect dirty_areas[2];
+
bool flushed;
xcb_dri2_swap_buffers_cookie_t swap_cookie;
xcb_dri2_wait_sbc_cookie_t wait_cookie;
@@ -79,6 +86,8 @@ vl_dri2_flush_frontbuffer(struct pipe_screen *screen,
scrn->swap_cookie = xcb_dri2_swap_buffers_unchecked(scrn->conn, scrn->drawable, 0, 0, 0, 0, 0, 0);
scrn->wait_cookie = xcb_dri2_wait_sbc_unchecked(scrn->conn, scrn->drawable, 0, 0);
scrn->buffers_cookie = xcb_dri2_get_buffers_unchecked(scrn->conn, scrn->drawable, 1, 1, attachments);
+
+ scrn->current_buffer = !scrn->current_buffer;
}
static void
@@ -113,6 +122,9 @@ vl_screen_texture_from_drawable(struct vl_screen *vscreen, Drawable drawable)
if (scrn->drawable != drawable) {
vl_dri2_destroy_drawable(scrn);
xcb_dri2_create_drawable(scrn->conn, drawable);
+ scrn->current_buffer = false;
+ vl_compositor_reset_dirty_area(&scrn->dirty_areas[0]);
+ vl_compositor_reset_dirty_area(&scrn->dirty_areas[1]);
scrn->drawable = drawable;
if (scrn->flushed) {
@@ -138,6 +150,17 @@ vl_screen_texture_from_drawable(struct vl_screen *vscreen, Drawable drawable)
assert(reply->count == 1);
+ if (reply->width != scrn->width || reply->height != scrn->height) {
+ vl_compositor_reset_dirty_area(&scrn->dirty_areas[0]);
+ vl_compositor_reset_dirty_area(&scrn->dirty_areas[1]);
+ scrn->width = reply->width;
+ scrn->height = reply->height;
+
+ } else if (buffers[0].name != scrn->buffer_names[scrn->current_buffer]) {
+ vl_compositor_reset_dirty_area(&scrn->dirty_areas[scrn->current_buffer]);
+ scrn->buffer_names[scrn->current_buffer] = buffers[0].name;
+ }
+
memset(&dri2_front_handle, 0, sizeof(dri2_front_handle));
dri2_front_handle.type = DRM_API_HANDLE_TYPE_SHARED;
dri2_front_handle.handle = buffers[0].name;
@@ -161,6 +184,14 @@ vl_screen_texture_from_drawable(struct vl_screen *vscreen, Drawable drawable)
return tex;
}
+struct u_rect *
+vl_screen_get_dirty_area(struct vl_screen *vscreen)
+{
+ struct vl_dri_screen *scrn = (struct vl_dri_screen*)vscreen;
+ assert(scrn);
+ return &scrn->dirty_areas[scrn->current_buffer];
+}
+
void*
vl_screen_get_private(struct vl_screen *vscreen)
{
@@ -234,6 +265,8 @@ vl_screen_create(Display *display, int screen)
goto free_screen;
scrn->base.pscreen->flush_frontbuffer = vl_dri2_flush_frontbuffer;
+ vl_compositor_reset_dirty_area(&scrn->dirty_areas[0]);
+ vl_compositor_reset_dirty_area(&scrn->dirty_areas[1]);
free(dri2_query);
free(connect);