summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/xorg
diff options
context:
space:
mode:
authorZack Rusin <[email protected]>2009-10-24 01:29:27 -0400
committerZack Rusin <[email protected]>2009-10-26 08:15:48 -0400
commit0b069d648b787636cc57149f47a06fb16f7629ab (patch)
treecae8b875136b7a39b4fbbc908e1db88e16217169 /src/gallium/state_trackers/xorg
parenta9f8baf00b264a9b370ecb611334af3063674ce5 (diff)
st/xorg: stop overflowing yuv buffers
Diffstat (limited to 'src/gallium/state_trackers/xorg')
-rw-r--r--src/gallium/state_trackers/xorg/xorg_exa_tgsi.c2
-rw-r--r--src/gallium/state_trackers/xorg/xorg_xv.c55
2 files changed, 37 insertions, 20 deletions
diff --git a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c
index 7cb11dc42bd..30fcff8a494 100644
--- a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c
+++ b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c
@@ -247,7 +247,7 @@ create_vs(struct pipe_context *pipe,
const1 = ureg_DECL_constant(ureg, 1);
/* it has to be either a fill or a composite op */
- debug_assert(is_fill ^ is_composite);
+ debug_assert((is_fill ^ is_composite) ^ is_yuv);
src = ureg_DECL_vs_input(ureg, input_slot++);
dst = ureg_DECL_output(ureg, TGSI_SEMANTIC_POSITION, 0);
diff --git a/src/gallium/state_trackers/xorg/xorg_xv.c b/src/gallium/state_trackers/xorg/xorg_xv.c
index 983310f9b52..b054ba80661 100644
--- a/src/gallium/state_trackers/xorg/xorg_xv.c
+++ b/src/gallium/state_trackers/xorg/xorg_xv.c
@@ -216,6 +216,7 @@ copy_packed_data(ScrnInfoPtr pScrn,
char *ymap, *vmap, *umap;
unsigned char y1, y2, u, v;
int yidx, uidx, vidx;
+ int y_array_size = w * h;
src = buf + (top * srcPitch) + (left << 1);
@@ -232,13 +233,12 @@ copy_packed_data(ScrnInfoPtr pScrn,
PIPE_TRANSFER_WRITE,
left, top, w, h);
- ymap = screen->transfer_map(screen, ytrans);
- umap = screen->transfer_map(screen, utrans);
- vmap = screen->transfer_map(screen, vtrans);
+ ymap = (char*)screen->transfer_map(screen, ytrans);
+ umap = (char*)screen->transfer_map(screen, utrans);
+ vmap = (char*)screen->transfer_map(screen, vtrans);
switch (id) {
case FOURCC_YV12: {
- int y_array_size = w * h;
for (i = 0; i < w; ++i) {
for (j = 0; i < h; ++j) {
/*XXX use src? */
@@ -252,22 +252,39 @@ copy_packed_data(ScrnInfoPtr pScrn,
}
}
break;
+ case FOURCC_UYVY:
+ for (i = 0; i < y_array_size; i +=2 ) {
+ /* extracting two pixels */
+ u = buf[0];
+ y1 = buf[1];
+ v = buf[2];
+ y2 = buf[3];
+ buf += 4;
+
+ ymap[yidx++] = y1;
+ ymap[yidx++] = y2;
+ umap[uidx++] = u;
+ umap[uidx++] = u;
+ vmap[vidx++] = v;
+ vmap[vidx++] = v;
+ }
+ break;
case FOURCC_YUY2:
- for (j = 0; j < h; ++j) {
- for (i = 0; i < w; ++i) {
- /* extracting two pixels */
- y1 = buf[0];
- u = buf[1];
- y2 = buf[2];
- v = buf[3];
-
- ymap[yidx++] = y1;
- ymap[yidx++] = y2;
- umap[uidx++] = u;
- umap[uidx++] = u;
- vmap[vidx++] = v;
- vmap[vidx++] = v;
- }
+ for (i = 0; i < y_array_size; i +=2 ) {
+ /* extracting two pixels */
+ y1 = buf[0];
+ u = buf[1];
+ y2 = buf[2];
+ v = buf[3];
+
+ buf += 4;
+
+ ymap[yidx++] = y1;
+ ymap[yidx++] = y2;
+ umap[uidx++] = u;
+ umap[uidx++] = u;
+ vmap[vidx++] = v;
+ vmap[vidx++] = v;
}
break;
default: