[Mesa-dev] [PATCH 6/7] Gallium/dri2: implement blitImage
Axel Davy
axel.davy at ens.fr
Fri Mar 7 08:26:06 PST 2014
Signed-off-by: Axel Davy <axel.davy at ens.fr>
---
src/gallium/state_trackers/dri/drm/dri2.c | 44 ++++++++++++++++++++++++++++---
1 file changed, 41 insertions(+), 3 deletions(-)
diff --git a/src/gallium/state_trackers/dri/drm/dri2.c b/src/gallium/state_trackers/dri/drm/dri2.c
index 3d8d569..4ddc81a 100644
--- a/src/gallium/state_trackers/dri/drm/dri2.c
+++ b/src/gallium/state_trackers/dri/drm/dri2.c
@@ -1021,6 +1021,43 @@ dri2_from_dma_bufs(__DRIscreen *screen,
}
static void
+dri2_blit_image(__DRIcontext *context, __DRIimage *dst, __DRIimage *src,
+ int dstx0, int dsty0, int dstwidth, int dstheight,
+ int srcx0, int srcy0, int srcwidth, int srcheight)
+{
+ struct dri_context *ctx = dri_context(context);
+ struct pipe_context *pipe = ctx->st->pipe;
+ struct pipe_screen* screen = dri_screen(ctx->sPriv)->base.screen;
+ struct pipe_blit_info blit;
+
+ if (!dst || !src)
+ return;
+
+ memset(&blit, 0, sizeof(blit));
+ blit.dst.resource = dst->texture;
+ blit.dst.box.x = dstx0;
+ blit.dst.box.y = dsty0;
+ blit.dst.box.width = dstwidth;
+ blit.dst.box.height = dstheight;
+ blit.dst.box.depth = 1;
+ blit.dst.format = dst->texture->format;
+ blit.src.resource = src->texture;
+ blit.src.box.x = srcx0;
+ blit.src.box.y = srcy0;
+ blit.src.box.width = srcwidth;
+ blit.src.box.height = srcheight;
+ blit.src.box.depth = 1;
+ blit.src.format = src->texture->format;
+ blit.mask = PIPE_MASK_RGBA;
+ blit.filter = PIPE_TEX_FILTER_NEAREST;
+
+ pipe->blit(pipe, &blit);
+
+ ctx->st->flush(ctx->st, 0, NULL);
+ pipe->flush_resource(pipe, dst->texture);
+}
+
+static void
dri2_destroy_image(__DRIimage *img)
{
pipe_resource_reference(&img->texture, NULL);
@@ -1028,7 +1065,7 @@ dri2_destroy_image(__DRIimage *img)
}
static struct __DRIimageExtensionRec dri2ImageExtension = {
- { __DRI_IMAGE, 6 },
+ { __DRI_IMAGE, 9 },
dri2_create_image_from_name,
dri2_create_image_from_renderbuffer,
dri2_destroy_image,
@@ -1039,6 +1076,9 @@ static struct __DRIimageExtensionRec dri2ImageExtension = {
dri2_from_names,
dri2_from_planar,
dri2_create_from_texture,
+ NULL,
+ NULL,
+ dri2_blit_image
};
/*
@@ -1093,8 +1133,6 @@ dri2_init_screen(__DRIscreen * sPriv)
if (drmGetCap(sPriv->fd, DRM_CAP_PRIME, &cap) == 0 &&
(cap & DRM_PRIME_CAP_IMPORT)) {
-
- dri2ImageExtension.base.version = 8;
dri2ImageExtension.createImageFromFds = dri2_from_fds;
dri2ImageExtension.createImageFromDmaBufs = dri2_from_dma_bufs;
}
--
1.8.3.2
More information about the mesa-dev
mailing list