diff options
Diffstat (limited to 'src/gallium/winsys')
-rw-r--r-- | src/gallium/winsys/g3dvl/dri/dri_winsys.c | 33 | ||||
-rw-r--r-- | src/gallium/winsys/g3dvl/vl_winsys.h | 3 | ||||
-rw-r--r-- | src/gallium/winsys/g3dvl/xlib/xsp_winsys.c | 14 |
3 files changed, 48 insertions, 2 deletions
diff --git a/src/gallium/winsys/g3dvl/dri/dri_winsys.c b/src/gallium/winsys/g3dvl/dri/dri_winsys.c index 096f068..c1e4a54 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); diff --git a/src/gallium/winsys/g3dvl/vl_winsys.h b/src/gallium/winsys/g3dvl/vl_winsys.h index 3e7d771..281a391 100644 --- a/src/gallium/winsys/g3dvl/vl_winsys.h +++ b/src/gallium/winsys/g3dvl/vl_winsys.h @@ -48,6 +48,9 @@ void vl_screen_destroy(struct vl_screen *vscreen); struct pipe_resource* vl_screen_texture_from_drawable(struct vl_screen *vscreen, Drawable drawable); +struct u_rect * +vl_screen_get_dirty_area(struct vl_screen *vscreen); + void* vl_screen_get_private(struct vl_screen *vscreen); diff --git a/src/gallium/winsys/g3dvl/xlib/xsp_winsys.c b/src/gallium/winsys/g3dvl/xlib/xsp_winsys.c index 6cd16bf..a4f5326 100644 --- a/src/gallium/winsys/g3dvl/xlib/xsp_winsys.c +++ b/src/gallium/winsys/g3dvl/xlib/xsp_winsys.c @@ -34,6 +34,7 @@ #include "state_tracker/xlib_sw_winsys.h" #include "softpipe/sp_public.h" +#include "vl/vl_compositor.h" #include "vl_winsys.h" struct vl_xsp_screen @@ -44,6 +45,7 @@ struct vl_xsp_screen Visual visual; struct xlib_drawable xdraw; struct pipe_resource *tex; + struct u_rect dirty_area; }; struct pipe_resource* @@ -68,8 +70,8 @@ vl_screen_texture_from_drawable(struct vl_screen *vscreen, Drawable drawable) if (xsp_screen->tex) { if (xsp_screen->tex->width0 == width && xsp_screen->tex->height0 == height) return xsp_screen->tex; - else - pipe_resource_reference(&xsp_screen->tex, NULL); + pipe_resource_reference(&xsp_screen->tex, NULL); + vl_compositor_reset_dirty_area(&xsp_screen->dirty_area); } memset(&templat, 0, sizeof(struct pipe_resource)); @@ -91,6 +93,13 @@ vl_screen_texture_from_drawable(struct vl_screen *vscreen, Drawable drawable) return xsp_screen->tex; } +struct u_rect * +vl_screen_get_dirty_area(struct vl_screen *vscreen) +{ + struct vl_xsp_screen *xsp_screen = (struct vl_xsp_screen*)vscreen; + return &xsp_screen->dirty_area; +} + void* vl_screen_get_private(struct vl_screen *vscreen) { @@ -126,6 +135,7 @@ vl_screen_create(Display *display, int screen) xsp_screen->display = display; xsp_screen->screen = screen; xsp_screen->xdraw.visual = XDefaultVisual(display, screen); + vl_compositor_reset_dirty_area(&xsp_screen->dirty_area); return &xsp_screen->base; } |