summaryrefslogtreecommitdiff
path: root/src/gallium/state_trackers/xorg
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/state_trackers/xorg')
-rw-r--r--src/gallium/state_trackers/xorg/xorg_composite.c2
-rw-r--r--src/gallium/state_trackers/xorg/xorg_crtc.c6
-rw-r--r--src/gallium/state_trackers/xorg/xorg_dri2.c6
-rw-r--r--src/gallium/state_trackers/xorg/xorg_exa.c48
-rw-r--r--src/gallium/state_trackers/xorg/xorg_exa_tgsi.c32
-rw-r--r--src/gallium/state_trackers/xorg/xorg_renderer.c114
-rw-r--r--src/gallium/state_trackers/xorg/xorg_xv.c23
-rw-r--r--src/gallium/state_trackers/xorg/xvmc/surface.c6
8 files changed, 153 insertions, 84 deletions
diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c
index a5975aad51..1c248a629e 100644
--- a/src/gallium/state_trackers/xorg/xorg_composite.c
+++ b/src/gallium/state_trackers/xorg/xorg_composite.c
@@ -423,8 +423,6 @@ bind_samplers(struct exa_context *exa, int op,
-
-
static INLINE boolean matrix_from_pict_transform(PictTransform *trans, float *matrix)
{
if (!trans)
diff --git a/src/gallium/state_trackers/xorg/xorg_crtc.c b/src/gallium/state_trackers/xorg/xorg_crtc.c
index ddcaedde37..9e8c14d741 100644
--- a/src/gallium/state_trackers/xorg/xorg_crtc.c
+++ b/src/gallium/state_trackers/xorg/xorg_crtc.c
@@ -196,10 +196,10 @@ crtc_load_cursor_argb_ga3d(xf86CrtcPtr crtc, CARD32 * image)
templat.tex_usage |= PIPE_TEXTURE_USAGE_PRIMARY;
templat.target = PIPE_TEXTURE_2D;
templat.last_level = 0;
- templat.depth[0] = 1;
+ templat.depth0 = 1;
templat.format = PIPE_FORMAT_A8R8G8B8_UNORM;
- templat.width[0] = 64;
- templat.height[0] = 64;
+ templat.width0 = 64;
+ templat.height0 = 64;
pf_get_block(templat.format, &templat.block);
crtcp->cursor_tex = ms->screen->texture_create(ms->screen,
diff --git a/src/gallium/state_trackers/xorg/xorg_dri2.c b/src/gallium/state_trackers/xorg/xorg_dri2.c
index 4fa47548a4..2394f004d2 100644
--- a/src/gallium/state_trackers/xorg/xorg_dri2.c
+++ b/src/gallium/state_trackers/xorg/xorg_dri2.c
@@ -109,9 +109,9 @@ dri2_do_create_buffer(DrawablePtr pDraw, DRI2BufferPtr buffer, unsigned int form
template.format = ms->ds_depth_bits_last ?
PIPE_FORMAT_S8Z24_UNORM : PIPE_FORMAT_Z24S8_UNORM;
pf_get_block(template.format, &template.block);
- template.width[0] = pDraw->width;
- template.height[0] = pDraw->height;
- template.depth[0] = 1;
+ template.width0 = pDraw->width;
+ template.height0 = pDraw->height;
+ template.depth0 = 1;
template.last_level = 0;
template.tex_usage = PIPE_TEXTURE_USAGE_DEPTH_STENCIL |
PIPE_TEXTURE_USAGE_DISPLAY_TARGET;
diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c
index 32485add94..16e683019c 100644
--- a/src/gallium/state_trackers/xorg/xorg_exa.c
+++ b/src/gallium/state_trackers/xorg/xorg_exa.c
@@ -274,8 +274,8 @@ ExaPrepareAccess(PixmapPtr pPix, int index)
PIPE_REFERENCED_FOR_WRITE)
exa->pipe->flush(exa->pipe, 0, NULL);
- assert(pPix->drawable.width <= priv->tex->width[0]);
- assert(pPix->drawable.height <= priv->tex->height[0]);
+ assert(pPix->drawable.width <= priv->tex->width0);
+ assert(pPix->drawable.height <= priv->tex->height0);
priv->map_transfer =
exa->scrn->get_tex_transfer(exa->scrn, priv->tex, 0, 0, 0,
@@ -283,9 +283,13 @@ ExaPrepareAccess(PixmapPtr pPix, int index)
PIPE_TRANSFER_MAP_DIRECTLY |
#endif
PIPE_TRANSFER_READ_WRITE,
+<<<<<<< HEAD:src/gallium/state_trackers/xorg/xorg_exa.c
+ 0, 0, priv->tex->width0, priv->tex->height0);
+=======
0, 0,
pPix->drawable.width,
pPix->drawable.height );
+>>>>>>> origin/mesa_7_7_branch:src/gallium/state_trackers/xorg/xorg_exa.c
if (!priv->map_transfer)
#ifdef EXA_MIXED_PIXMAPS
return FALSE;
@@ -524,8 +528,8 @@ ExaCopy(PixmapPtr pDstPixmap, int srcX, int srcY, int dstX, int dstY,
dstX, dstY,
srcX, srcY,
width, height,
- exa->copy.src_texture->width[0],
- exa->copy.src_texture->height[0]);
+ exa->copy.src_texture->width0,
+ exa->copy.src_texture->height0);
}
}
@@ -861,8 +865,8 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height,
if (priv->tex)
debug_printf(" ==> old texture %dx%d\n",
- priv->tex->width[0],
- priv->tex->height[0]);
+ priv->tex->width0,
+ priv->tex->height0);
}
@@ -890,8 +894,8 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height,
/* Deal with screen resize */
if ((exa->accel || priv->flags) &&
(!priv->tex ||
- !size_match(width, priv->tex->width[0]) ||
- !size_match(height, priv->tex->height[0]) ||
+ !size_match(width, priv->tex->width0) ||
+ !size_match(height, priv->tex->height0) ||
priv->tex_flags != priv->flags)) {
struct pipe_texture *texture = NULL;
struct pipe_texture template;
@@ -901,15 +905,15 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height,
exa_get_pipe_format(depth, &template.format, &bitsPerPixel, &priv->picture_format);
pf_get_block(template.format, &template.block);
if (ROUND_UP_TEXTURES && priv->flags == 0) {
- template.width[0] = util_next_power_of_two(width);
- template.height[0] = util_next_power_of_two(height);
+ template.width0 = util_next_power_of_two(width);
+ template.height0 = util_next_power_of_two(height);
}
else {
- template.width[0] = width;
- template.height[0] = height;
+ template.width0 = width;
+ template.height0 = height;
}
- template.depth[0] = 1;
+ template.depth0 = 1;
template.last_level = 0;
template.tex_usage = PIPE_TEXTURE_USAGE_RENDER_TARGET | priv->flags;
priv->tex_flags = priv->flags;
@@ -924,12 +928,12 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height,
src_surf = xorg_gpu_surface(exa->pipe->screen, priv);
if (exa->pipe->surface_copy) {
exa->pipe->surface_copy(exa->pipe, dst_surf, 0, 0, src_surf,
- 0, 0, min(width, texture->width[0]),
- min(height, texture->height[0]));
+ 0, 0, min(width, texture->width0),
+ min(height, texture->height0));
} else {
util_surface_copy(exa->pipe, FALSE, dst_surf, 0, 0, src_surf,
- 0, 0, min(width, texture->width[0]),
- min(height, texture->height[0]));
+ 0, 0, min(width, texture->width0),
+ min(height, texture->height0));
}
exa->scrn->tex_surface_destroy(dst_surf);
exa->scrn->tex_surface_destroy(src_surf);
@@ -962,8 +966,8 @@ xorg_exa_set_texture(PixmapPtr pPixmap, struct pipe_texture *tex)
if (!priv)
return FALSE;
- if (pPixmap->drawable.width != tex->width[0] ||
- pPixmap->drawable.height != tex->height[0])
+ if (pPixmap->drawable.width != tex->width0 ||
+ pPixmap->drawable.height != tex->height0)
return FALSE;
pipe_texture_reference(&priv->tex, tex);
@@ -986,9 +990,9 @@ xorg_exa_create_root_texture(ScrnInfoPtr pScrn,
template.target = PIPE_TEXTURE_2D;
exa_get_pipe_format(depth, &template.format, &bitsPerPixel, &dummy);
pf_get_block(template.format, &template.block);
- template.width[0] = width;
- template.height[0] = height;
- template.depth[0] = 1;
+ template.width0 = width;
+ template.height0 = height;
+ template.depth0 = 1;
template.last_level = 0;
template.tex_usage |= PIPE_TEXTURE_USAGE_RENDER_TARGET;
template.tex_usage |= PIPE_TEXTURE_USAGE_PRIMARY;
diff --git a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c
index 13a9840bdd..89b794a09a 100644
--- a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c
+++ b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c
@@ -47,22 +47,22 @@ static void
print_fs_traits(int fs_traits)
{
const char *strings[] = {
- "FS_COMPOSITE", // = 1 << 0,
- "FS_MASK", // = 1 << 1,
- "FS_SOLID_FILL", // = 1 << 2,
- "FS_LINGRAD_FILL", // = 1 << 3,
- "FS_RADGRAD_FILL", // = 1 << 4,
- "FS_CA_FULL", // = 1 << 5, /* src.rgba * mask.rgba */
- "FS_CA_SRCALPHA", // = 1 << 6, /* src.aaaa * mask.rgba */
- "FS_YUV", // = 1 << 7,
- "FS_SRC_REPEAT_NONE", // = 1 << 8,
- "FS_MASK_REPEAT_NONE",// = 1 << 9,
- "FS_SRC_SWIZZLE_RGB", // = 1 << 10,
- "FS_MASK_SWIZZLE_RGB",// = 1 << 11,
- "FS_SRC_SET_ALPHA", // = 1 << 12,
- "FS_MASK_SET_ALPHA", // = 1 << 13,
- "FS_SRC_LUMINANCE", // = 1 << 14,
- "FS_MASK_LUMINANCE", // = 1 << 15,
+ "FS_COMPOSITE", /* = 1 << 0 */
+ "FS_MASK", /* = 1 << 1 */
+ "FS_SOLID_FILL", /* = 1 << 2 */
+ "FS_LINGRAD_FILL", /* = 1 << 3 */
+ "FS_RADGRAD_FILL", /* = 1 << 4 */
+ "FS_CA_FULL", /* = 1 << 5 - src.rgba * mask.rgba */
+ "FS_CA_SRCALPHA", /* = 1 << 6 - src.aaaa * mask.rgba */
+ "FS_YUV", /* = 1 << 7 */
+ "FS_SRC_REPEAT_NONE", /* = 1 << 8 */
+ "FS_MASK_REPEAT_NONE",/* = 1 << 9 */
+ "FS_SRC_SWIZZLE_RGB", /* = 1 << 10 */
+ "FS_MASK_SWIZZLE_RGB",/* = 1 << 11 */
+ "FS_SRC_SET_ALPHA", /* = 1 << 12 */
+ "FS_MASK_SET_ALPHA", /* = 1 << 13 */
+ "FS_SRC_LUMINANCE", /* = 1 << 14 */
+ "FS_MASK_LUMINANCE", /* = 1 << 15 */
};
int i, k;
debug_printf("%s: ", __func__);
diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.c b/src/gallium/state_trackers/xorg/xorg_renderer.c
index cbb84a8c0d..8f73ec5fe1 100644
--- a/src/gallium/state_trackers/xorg/xorg_renderer.c
+++ b/src/gallium/state_trackers/xorg/xorg_renderer.c
@@ -170,14 +170,14 @@ add_vertex_data1(struct xorg_renderer *r,
map_point(src_matrix, pt3[0], pt3[1], &pt3[0], &pt3[1]);
}
- s0 = pt0[0] / src->width[0];
- s1 = pt1[0] / src->width[0];
- s2 = pt2[0] / src->width[0];
- s3 = pt3[0] / src->width[0];
- t0 = pt0[1] / src->height[0];
- t1 = pt1[1] / src->height[0];
- t2 = pt2[1] / src->height[0];
- t3 = pt3[1] / src->height[0];
+ s0 = pt0[0] / src->width0;
+ s1 = pt1[0] / src->width0;
+ s2 = pt2[0] / src->width0;
+ s3 = pt3[0] / src->width0;
+ t0 = pt0[1] / src->height0;
+ t1 = pt1[1] / src->height0;
+ t2 = pt2[1] / src->height0;
+ t3 = pt3[1] / src->height0;
/* 1st vertex */
add_vertex_1tex(r, dstX, dstY, s0, t0);
@@ -248,15 +248,15 @@ add_vertex_data2(struct xorg_renderer *r,
map_point(mask_matrix, mpt1[0], mpt1[1], &mpt1[0], &mpt1[1]);
}
- src_s0 = spt0[0] / src->width[0];
- src_t0 = spt0[1] / src->height[0];
- src_s1 = spt1[0] / src->width[0];
- src_t1 = spt1[1] / src->height[0];
+ src_s0 = spt0[0] / src->width0;
+ src_t0 = spt0[1] / src->height0;
+ src_s1 = spt1[0] / src->width0;
+ src_t1 = spt1[1] / src->height0;
- mask_s0 = mpt0[0] / mask->width[0];
- mask_t0 = mpt0[1] / mask->height[0];
- mask_s1 = mpt1[0] / mask->width[0];
- mask_t1 = mpt1[1] / mask->height[0];
+ mask_s0 = mpt0[0] / mask->width0;
+ mask_t0 = mpt0[1] / mask->height0;
+ mask_s1 = mpt1[0] / mask->width0;
+ mask_t1 = mpt1[1] / mask->height0;
/* 1st vertex */
add_vertex_2tex(r, dstX, dstY,
@@ -286,10 +286,10 @@ setup_vertex_data_yuv(struct xorg_renderer *r,
spt1[0] = srcX + srcW;
spt1[1] = srcY + srcH;
- s0 = spt0[0] / tex[0]->width[0];
- t0 = spt0[1] / tex[0]->height[0];
- s1 = spt1[0] / tex[0]->width[0];
- t1 = spt1[1] / tex[0]->height[0];
+ s0 = spt0[0] / tex[0]->width0;
+ t0 = spt0[1] / tex[0]->height0;
+ s1 = spt1[0] / tex[0]->width0;
+ t1 = spt1[1] / tex[0]->height0;
/* 1st vertex */
add_vertex_1tex(r, dstX, dstY, s0, t0);
@@ -509,9 +509,9 @@ renderer_clone_texture(struct xorg_renderer *r,
templ.target = PIPE_TEXTURE_2D;
templ.format = format;
templ.last_level = 0;
- templ.width[0] = src->width[0];
- templ.height[0] = src->height[0];
- templ.depth[0] = 1;
+ templ.width0 = src->width0;
+ templ.height0 = src->height0;
+ templ.depth0 = 1;
pf_get_block(format, &templ.block);
templ.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER;
@@ -533,13 +533,13 @@ renderer_clone_texture(struct xorg_renderer *r,
ps_tex, /* dest */
0, 0, /* destx/y */
ps_read,
- 0, 0, src->width[0], src->height[0]);
+ 0, 0, src->width0, src->height0);
} else {
util_surface_copy(pipe, FALSE,
ps_tex, /* dest */
0, 0, /* destx/y */
ps_read,
- 0, 0, src->width[0], src->height[0]);
+ 0, 0, src->width0, src->height0);
}
pipe_surface_reference(&ps_read, NULL);
pipe_surface_reference(&ps_tex, NULL);
@@ -559,6 +559,69 @@ void renderer_copy_pixmap(struct xorg_renderer *r,
float s0, t0, s1, t1;
float x0, y0, x1, y1;
+<<<<<<< HEAD:src/gallium/state_trackers/xorg/xorg_renderer.c
+ if (r->pipe->is_texture_referenced(r->pipe, src, 0, 0) &
+ PIPE_REFERENCED_FOR_WRITE)
+ r->pipe->flush(r->pipe, PIPE_FLUSH_RENDER_CACHE, NULL);
+
+ dst_loc[0] = dx;
+ dst_loc[1] = dy;
+ dst_loc[2] = width;
+ dst_loc[3] = height;
+ dst_bounds[0] = 0.f;
+ dst_bounds[1] = 0.f;
+ dst_bounds[2] = dst->width0;
+ dst_bounds[3] = dst->height0;
+
+ src_loc[0] = sx;
+ src_loc[1] = sy;
+ src_loc[2] = width;
+ src_loc[3] = height;
+ src_bounds[0] = 0.f;
+ src_bounds[1] = 0.f;
+ src_bounds[2] = src->width0;
+ src_bounds[3] = src->height0;
+
+ bound_rect(src_loc, src_bounds, src_shift);
+ bound_rect(dst_loc, dst_bounds, dst_shift);
+ shift[0] = src_shift[0] - dst_shift[0];
+ shift[1] = src_shift[1] - dst_shift[1];
+
+ if (shift[0] < 0)
+ shift_rectx(src_loc, src_bounds, -shift[0]);
+ else
+ shift_rectx(dst_loc, dst_bounds, shift[0]);
+
+ if (shift[1] < 0)
+ shift_recty(src_loc, src_bounds, -shift[1]);
+ else
+ shift_recty(dst_loc, dst_bounds, shift[1]);
+
+ sync_size(src_loc, dst_loc);
+
+ if (src_loc[2] >= 0 && src_loc[3] >= 0 &&
+ dst_loc[2] >= 0 && dst_loc[3] >= 0) {
+ struct pipe_texture *temp_src = src;
+
+ if (src == dst)
+ temp_src = create_sampler_texture(r, src);
+
+ renderer_copy_texture(r,
+ temp_src,
+ src_loc[0],
+ src_loc[1],
+ src_loc[0] + src_loc[2],
+ src_loc[1] + src_loc[3],
+ dst,
+ dst_loc[0],
+ dst_loc[1],
+ dst_loc[0] + dst_loc[2],
+ dst_loc[1] + dst_loc[3]);
+
+ if (src == dst)
+ pipe_texture_reference(&temp_src, NULL);
+ }
+=======
/* XXX: could put the texcoord scaling calculation into the vertex
* shader.
@@ -579,6 +642,7 @@ void renderer_copy_pixmap(struct xorg_renderer *r,
add_vertex_1tex(r, x1, y0, s1, t0);
add_vertex_1tex(r, x1, y1, s1, t1);
add_vertex_1tex(r, x0, y1, s0, t1);
+>>>>>>> origin/mesa_7_7_branch:src/gallium/state_trackers/xorg/xorg_renderer.c
}
diff --git a/src/gallium/state_trackers/xorg/xorg_xv.c b/src/gallium/state_trackers/xorg/xorg_xv.c
index b3315dccad..b8eca8c817 100644
--- a/src/gallium/state_trackers/xorg/xorg_xv.c
+++ b/src/gallium/state_trackers/xorg/xorg_xv.c
@@ -73,10 +73,11 @@ static XF86VideoEncodingRec DummyEncoding[1] = {
}
};
-#define NUM_IMAGES 2
+#define NUM_IMAGES 3
static XF86ImageRec Images[NUM_IMAGES] = {
XVIMAGE_UYVY,
XVIMAGE_YUY2,
+ XVIMAGE_YV12,
};
struct xorg_xv_port_priv {
@@ -166,9 +167,9 @@ create_component_texture(struct pipe_context *pipe,
templ.target = PIPE_TEXTURE_2D;
templ.format = PIPE_FORMAT_L8_UNORM;
templ.last_level = 0;
- templ.width[0] = width;
- templ.height[0] = height;
- templ.depth[0] = 1;
+ templ.width0 = width;
+ templ.height0 = height;
+ templ.depth0 = 1;
pf_get_block(PIPE_FORMAT_L8_UNORM, &templ.block);
templ.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER;
@@ -182,18 +183,18 @@ check_yuv_textures(struct xorg_xv_port_priv *priv, int width, int height)
{
struct pipe_texture **dst = priv->yuv[priv->current_set];
if (!dst[0] ||
- dst[0]->width[0] != width ||
- dst[0]->height[0] != height) {
+ dst[0]->width0 != width ||
+ dst[0]->height0 != height) {
pipe_texture_reference(&dst[0], NULL);
}
if (!dst[1] ||
- dst[1]->width[0] != width ||
- dst[1]->height[0] != height) {
+ dst[1]->width0 != width ||
+ dst[1]->height0 != height) {
pipe_texture_reference(&dst[1], NULL);
}
if (!dst[2] ||
- dst[2]->width[0] != width ||
- dst[2]->height[0] != height) {
+ dst[2]->width0 != width ||
+ dst[2]->height0 != height) {
pipe_texture_reference(&dst[2], NULL);
}
@@ -532,6 +533,7 @@ put_image(ScrnInfoPtr pScrn,
switch (id) {
case FOURCC_UYVY:
case FOURCC_YUY2:
+ case FOURCC_YV12:
default:
srcPitch = width << 1;
break;
@@ -580,6 +582,7 @@ query_image_attributes(ScrnInfoPtr pScrn,
switch (id) {
case FOURCC_UYVY:
case FOURCC_YUY2:
+ case FOURCC_YV12:
default:
size = *w << 1;
if (pitches)
diff --git a/src/gallium/state_trackers/xorg/xvmc/surface.c b/src/gallium/state_trackers/xorg/xvmc/surface.c
index bf9038f356..8cb73f4897 100644
--- a/src/gallium/state_trackers/xorg/xvmc/surface.c
+++ b/src/gallium/state_trackers/xorg/xvmc/surface.c
@@ -103,9 +103,9 @@ CreateOrResizeBackBuffer(struct pipe_video_context *vpipe, unsigned int width, u
/* XXX: Needs to match the drawable's format? */
template.format = PIPE_FORMAT_X8R8G8B8_UNORM;
template.last_level = 0;
- template.width[0] = width;
- template.height[0] = height;
- template.depth[0] = 1;
+ template.width0 = width;
+ template.height0 = height;
+ template.depth0 = 1;
pf_get_block(template.format, &template.block);
template.tex_usage = PIPE_TEXTURE_USAGE_DISPLAY_TARGET;