diff options
Diffstat (limited to 'src/gallium/state_trackers/dri')
-rw-r--r-- | src/gallium/state_trackers/dri/sw/drisw.c | 58 |
1 files changed, 54 insertions, 4 deletions
diff --git a/src/gallium/state_trackers/dri/sw/drisw.c b/src/gallium/state_trackers/dri/sw/drisw.c index 9f00a53152e..64a64af14ec 100644 --- a/src/gallium/state_trackers/dri/sw/drisw.c +++ b/src/gallium/state_trackers/dri/sw/drisw.c @@ -37,6 +37,7 @@ #include "util/u_format.h" #include "util/u_memory.h" #include "util/u_inlines.h" +#include "util/u_box.h" #include "pipe/p_context.h" #include "state_tracker/drisw_api.h" #include "state_tracker/st_context.h" @@ -71,6 +72,18 @@ put_image(__DRIdrawable *dPriv, void *data, unsigned width, unsigned height) } static INLINE void +put_image2(__DRIdrawable *dPriv, void *data, int x, int y, + unsigned width, unsigned height, unsigned stride) +{ + __DRIscreen *sPriv = dPriv->driScreenPriv; + const __DRIswrastLoaderExtension *loader = sPriv->swrast_loader; + + loader->putImage2(dPriv, __DRI_SWRAST_IMAGE_OP_SWAP, + x, y, width, height, stride, + data, dPriv->loaderPrivate); +} + +static INLINE void get_image(__DRIdrawable *dPriv, int x, int y, int width, int height, void *data) { __DRIscreen *sPriv = dPriv->driScreenPriv; @@ -99,9 +112,19 @@ drisw_put_image(struct dri_drawable *drawable, put_image(dPriv, data, width, height); } +static void +drisw_put_image2(struct dri_drawable *drawable, + void *data, int x, int y, unsigned width, unsigned height, + unsigned stride) +{ + __DRIdrawable *dPriv = drawable->dPriv; + + put_image2(dPriv, data, x, y, width, height, stride); +} + static INLINE void drisw_present_texture(__DRIdrawable *dPriv, - struct pipe_resource *ptex) + struct pipe_resource *ptex, struct pipe_box *sub_box) { struct dri_drawable *drawable = dri_drawable(dPriv); struct dri_screen *screen = dri_screen(drawable->sPriv); @@ -109,7 +132,7 @@ drisw_present_texture(__DRIdrawable *dPriv, if (swrast_no_present) return; - screen->base.screen->flush_frontbuffer(screen->base.screen, ptex, 0, 0, drawable); + screen->base.screen->flush_frontbuffer(screen->base.screen, ptex, 0, 0, drawable, sub_box); } static INLINE void @@ -126,7 +149,7 @@ static INLINE void drisw_copy_to_front(__DRIdrawable * dPriv, struct pipe_resource *ptex) { - drisw_present_texture(dPriv, ptex); + drisw_present_texture(dPriv, ptex, NULL); drisw_invalidate_drawable(dPriv); } @@ -158,6 +181,30 @@ drisw_swap_buffers(__DRIdrawable *dPriv) } static void +drisw_copy_sub_buffer(__DRIdrawable *dPriv, int x, int y, + int w, int h) +{ + struct dri_context *ctx = dri_get_current(dPriv->driScreenPriv); + struct dri_drawable *drawable = dri_drawable(dPriv); + struct pipe_resource *ptex; + struct pipe_box box; + if (!ctx) + return; + + ptex = drawable->textures[ST_ATTACHMENT_BACK_LEFT]; + + if (ptex) { + if (ctx->pp && drawable->textures[ST_ATTACHMENT_DEPTH_STENCIL]) + pp_run(ctx->pp, ptex, ptex, drawable->textures[ST_ATTACHMENT_DEPTH_STENCIL]); + + ctx->st->flush(ctx->st, ST_FLUSH_FRONT, NULL); + + u_box_2d(x, dPriv->h - y - h, w, h, &box); + drisw_present_texture(dPriv, ptex, &box); + } +} + +static void drisw_flush_frontbuffer(struct dri_context *ctx, struct dri_drawable *drawable, enum st_attachment_type statt) @@ -288,7 +335,8 @@ static const __DRIextension *drisw_screen_extensions[] = { }; static struct drisw_loader_funcs drisw_lf = { - .put_image = drisw_put_image + .put_image = drisw_put_image, + .put_image2 = drisw_put_image2 }; static const __DRIconfig ** @@ -359,12 +407,14 @@ const struct __DriverAPIRec driDriverAPI = { .SwapBuffers = drisw_swap_buffers, .MakeCurrent = dri_make_current, .UnbindContext = dri_unbind_context, + .CopySubBuffer = drisw_copy_sub_buffer, }; /* This is the table of extensions that the loader will dlsym() for. */ PUBLIC const __DRIextension *__driDriverExtensions[] = { &driCoreExtension.base, &driSWRastExtension.base, + &driCopySubBufferExtension, &gallium_config_options.base, NULL }; |