summaryrefslogtreecommitdiff
path: root/src/gallium/winsys/drm/radeon/core/radeon_buffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/winsys/drm/radeon/core/radeon_buffer.c')
-rw-r--r--src/gallium/winsys/drm/radeon/core/radeon_buffer.c53
1 files changed, 52 insertions, 1 deletions
diff --git a/src/gallium/winsys/drm/radeon/core/radeon_buffer.c b/src/gallium/winsys/drm/radeon/core/radeon_buffer.c
index 7bf23cba23..0a7b5ecb09 100644
--- a/src/gallium/winsys/drm/radeon/core/radeon_buffer.c
+++ b/src/gallium/winsys/drm/radeon/core/radeon_buffer.c
@@ -33,6 +33,15 @@
#include "radeon_buffer.h"
#include "radeon_bo_gem.h"
+#include "softpipe/sp_texture.h"
+#include "r300_context.h"
+#include <X11/Xutil.h>
+struct radeon_vl_context
+{
+ Display *display;
+ int screen;
+ Drawable drawable;
+};
static const char *radeon_get_name(struct pipe_winsys *ws)
{
@@ -183,11 +192,53 @@ static int radeon_fence_finish(struct pipe_winsys *ws,
return 0;
}
+static void radeon_display_surface(struct pipe_winsys *pws,
+ struct pipe_surface *psurf,
+ struct radeon_vl_context *rvl_ctx)
+{
+ struct r300_texture *r300tex = (struct r300_texture *)(psurf->texture);
+ XImage *ximage;
+ void *data;
+
+ ximage = XCreateImage(rvl_ctx->display,
+ XDefaultVisual(rvl_ctx->display, rvl_ctx->screen),
+ XDefaultDepth(rvl_ctx->display, rvl_ctx->screen),
+ ZPixmap, 0, /* format, offset */
+ NULL, /* data */
+ 0, 0, /* size */
+ 32, /* bitmap_pad */
+ 0); /* bytes_per_line */
+
+ assert(ximage->format);
+ assert(ximage->bitmap_unit);
+
+ data = pws->buffer_map(pws, r300tex->buffer, 0);
+
+ /* update XImage's fields */
+ ximage->data = data;
+ ximage->width = psurf->width;
+ ximage->height = psurf->height;
+ ximage->bytes_per_line = r300tex->stride_override;
+
+ XPutImage(rvl_ctx->display, rvl_ctx->drawable,
+ XDefaultGC(rvl_ctx->display, rvl_ctx->screen),
+ ximage, 0, 0, 0, 0, psurf->width, psurf->height);
+
+ XSync(rvl_ctx->display, 0);
+
+ ximage->data = NULL;
+ XDestroyImage(ximage);
+
+ pws->buffer_unmap(pws, r300tex->buffer);
+}
+
static void radeon_flush_frontbuffer(struct pipe_winsys *pipe_winsys,
struct pipe_surface *pipe_surface,
void *context_private)
{
- /* XXX TODO: call dri2CopyRegion */
+ struct radeon_vl_context *rvl_ctx;
+ rvl_ctx = (struct radeon_vl_context *) context_private;
+ radeon_display_surface(pipe_winsys, pipe_surface, rvl_ctx);
}
struct radeon_winsys* radeon_pipe_winsys(int fd)