summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/state_trackers/xorg/xorg_composite.c74
-rw-r--r--src/gallium/state_trackers/xorg/xorg_exa.c8
-rw-r--r--src/gallium/state_trackers/xorg/xorg_exa.h2
3 files changed, 78 insertions, 6 deletions
diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c
index ad14eb75ed7..86402a0d130 100644
--- a/src/gallium/state_trackers/xorg/xorg_composite.c
+++ b/src/gallium/state_trackers/xorg/xorg_composite.c
@@ -2,9 +2,10 @@
#include "xorg_exa_tgsi.h"
-#include <cso_cache/cso_context.h>
+#include "cso_cache/cso_context.h"
+#include "util/u_draw_quad.h"
-#include <pipe/p_inlines.h>
+#include "pipe/p_inlines.h"
struct xorg_composite_blend {
int op:8;
@@ -75,19 +76,80 @@ blend_for_op(int op)
return xorg_blends[BLEND_OP_OVER];
}
+
+static struct pipe_buffer *
+setup_vertex_data_tex(struct exa_context *ctx,
+ float x0, float y0, float x1, float y1,
+ float x2, float y2, float x3, float y3,
+ float s0, float t0, float s1, float t1,
+ float z)
+{
+ ctx->vertices[0][0][0] = x0;
+ ctx->vertices[0][0][1] = y0;
+ ctx->vertices[0][0][2] = z;
+ ctx->vertices[0][1][0] = s0; /*s*/
+ ctx->vertices[0][1][1] = t0; /*t*/
+
+ ctx->vertices[1][0][0] = x1;
+ ctx->vertices[1][0][1] = y1;
+ ctx->vertices[1][0][2] = z;
+ ctx->vertices[1][1][0] = s1; /*s*/
+ ctx->vertices[1][1][1] = t0; /*t*/
+
+ ctx->vertices[2][0][0] = x2;
+ ctx->vertices[2][0][1] = y2;
+ ctx->vertices[2][0][2] = z;
+ ctx->vertices[2][1][0] = s1;
+ ctx->vertices[2][1][1] = t1;
+
+ ctx->vertices[3][0][0] = x3;
+ ctx->vertices[3][0][1] = y3;
+ ctx->vertices[3][0][2] = z;
+ ctx->vertices[3][1][0] = s0;
+ ctx->vertices[3][1][1] = t1;
+
+ return pipe_user_buffer_create(ctx->ctx->screen,
+ ctx->vertices,
+ sizeof(ctx->vertices));
+}
+
static void
-draw_texture(struct exa_context *exa)
+draw_texture(struct exa_context *exa,
+ struct pipe_texture *tex,
+ float x1offset, float y1offset,
+ float x2offset, float y2offset,
+ float x1, float y1,
+ float x2, float y2,
+ float x3, float y3,
+ float x4, float y4)
{
-#if 0
+ struct pipe_context *pipe = exa->ctx;
+ struct pipe_buffer *buf;
+ float s0, t0, s1, t1;
+
+ assert(tex->width[0] != 0);
+ assert(tex->height[0] != 0);
+
+ s0 = x1offset / tex->width[0];
+ s1 = x2offset / tex->width[0];
+ t0 = y1offset / tex->height[0];
+ t1 = y2offset / tex->height[0];
+
+ /* draw quad */
+ buf = setup_vertex_data_tex(exa, x1, y1, x2, y2, x3, y3, x4, y4,
+ s0, t0, s1, t1, 0.0f);
+
if (buf) {
util_draw_vertex_buffer(pipe, buf, 0,
PIPE_PRIM_TRIANGLE_FAN,
4, /* verts */
2); /* attribs/vert */
- pipe_buffer_reference(&buf, NULL);
+ pipe_buffer_reference(&buf,
+ NULL);
}
-#endif
+
+ cso_restore_vertex_shader(exa->cso);
}
boolean xorg_composite_accelerated(int op,
diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c
index 8077c9388f6..305d75d520a 100644
--- a/src/gallium/state_trackers/xorg/xorg_exa.c
+++ b/src/gallium/state_trackers/xorg/xorg_exa.c
@@ -563,6 +563,7 @@ xorg_exa_init(ScrnInfoPtr pScrn)
modesettingPtr ms = modesettingPTR(pScrn);
struct exa_context *exa;
ExaDriverPtr pExa;
+ int i;
exa = xcalloc(1, sizeof(struct exa_context));
if (!exa)
@@ -614,6 +615,13 @@ xorg_exa_init(ScrnInfoPtr pScrn)
/* Share context with DRI */
ms->ctx = exa->ctx;
+ /* common vertex data setup */
+ for (i = 0; i < 4; ++i) {
+ exa->vertices[i][0][3] = 1.0f; /* w */
+ exa->vertices[i][1][2] = 0.0f; /* r */
+ exa->vertices[i][1][3] = 1.0f; /* q */
+ }
+
exa->cso = cso_create_context(exa->ctx);
exa->shaders = xorg_shaders_create(exa);
diff --git a/src/gallium/state_trackers/xorg/xorg_exa.h b/src/gallium/state_trackers/xorg/xorg_exa.h
index 0a93fa0bd7d..90ad8400ffd 100644
--- a/src/gallium/state_trackers/xorg/xorg_exa.h
+++ b/src/gallium/state_trackers/xorg/xorg_exa.h
@@ -18,6 +18,8 @@ struct exa_context
struct pipe_constant_buffer vs_const_buffer;
struct pipe_constant_buffer fs_const_buffer;
+
+ float vertices[4][2][4];
};