int current_set;
/* juggle two sets of seperate Y, U and V
* textures */
- struct pipe_texture *yuv[2][3];
+ struct pipe_resource *yuv[2][3];
struct pipe_sampler_view *yuv_views[2][3];
};
*p_h = drw_h;
}
-static INLINE struct pipe_texture *
+static INLINE struct pipe_resource *
create_component_texture(struct pipe_context *pipe,
int width, int height)
{
struct pipe_screen *screen = pipe->screen;
- struct pipe_texture *tex = 0;
- struct pipe_texture templ;
+ struct pipe_resource *tex = 0;
+ struct pipe_resource templ;
memset(&templ, 0, sizeof(templ));
templ.target = PIPE_TEXTURE_2D;
templ.width0 = width;
templ.height0 = height;
templ.depth0 = 1;
- templ.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER;
+ templ.array_size = 1;
+ templ.bind = PIPE_BIND_SAMPLER_VIEW;
- tex = screen->texture_create(screen, &templ);
+ tex = screen->resource_create(screen, &templ);
return tex;
}
static int
check_yuv_textures(struct xorg_xv_port_priv *priv, int width, int height)
{
- struct pipe_texture **dst = priv->yuv[priv->current_set];
+ struct pipe_resource **dst = priv->yuv[priv->current_set];
struct pipe_sampler_view **dst_view = priv->yuv_views[priv->current_set];
struct pipe_sampler_view view_templ;
struct pipe_context *pipe = priv->r->pipe;
if (!dst[0] ||
dst[0]->width0 != width ||
dst[0]->height0 != height) {
- pipe_texture_reference(&dst[0], NULL);
+ pipe_resource_reference(&dst[0], NULL);
pipe_sampler_view_reference(&dst_view[0], NULL);
}
if (!dst[1] ||
dst[1]->width0 != width ||
dst[1]->height0 != height) {
- pipe_texture_reference(&dst[1], NULL);
+ pipe_resource_reference(&dst[1], NULL);
pipe_sampler_view_reference(&dst_view[1], NULL);
}
if (!dst[2] ||
dst[2]->width0 != width ||
dst[2]->height0 != height) {
- pipe_texture_reference(&dst[2], NULL);
+ pipe_resource_reference(&dst[2], NULL);
pipe_sampler_view_reference(&dst_view[2], NULL);
}
unsigned short w, unsigned short h)
{
int i, j;
- struct pipe_texture **dst = port->yuv[port->current_set];
+ struct pipe_resource **dst = port->yuv[port->current_set];
struct pipe_transfer *ytrans, *utrans, *vtrans;
struct pipe_context *pipe = port->r->pipe;
char *ymap, *vmap, *umap;
int yidx, uidx, vidx;
int y_array_size = w * h;
- ytrans = pipe->get_tex_transfer(pipe, dst[0],
- 0, 0, 0,
- PIPE_TRANSFER_WRITE,
- left, top, w, h);
- utrans = pipe->get_tex_transfer(pipe, dst[1],
- 0, 0, 0,
- PIPE_TRANSFER_WRITE,
- left, top, w, h);
- vtrans = pipe->get_tex_transfer(pipe, dst[2],
- 0, 0, 0,
- PIPE_TRANSFER_WRITE,
- left, top, w, h);
+ ytrans = pipe_get_transfer(pipe, dst[0],
+ 0, 0,
+ PIPE_TRANSFER_WRITE,
+ left, top, w, h);
+ utrans = pipe_get_transfer(pipe, dst[1],
+ 0, 0,
+ PIPE_TRANSFER_WRITE,
+ left, top, w, h);
+ vtrans = pipe_get_transfer(pipe, dst[2],
+ 0, 0,
+ PIPE_TRANSFER_WRITE,
+ left, top, w, h);
ymap = (char*)pipe->transfer_map(pipe, ytrans);
umap = (char*)pipe->transfer_map(pipe, utrans);
pipe->transfer_unmap(pipe, ytrans);
pipe->transfer_unmap(pipe, utrans);
pipe->transfer_unmap(pipe, vtrans);
- pipe->tex_transfer_destroy(pipe, ytrans);
- pipe->tex_transfer_destroy(pipe, utrans);
- pipe->tex_transfer_destroy(pipe, vtrans);
+ pipe->transfer_destroy(pipe, ytrans);
+ pipe->transfer_destroy(pipe, utrans);
+ pipe->transfer_destroy(pipe, vtrans);
}
static void
draw_yuv(struct xorg_xv_port_priv *port,
- int src_x, int src_y, int src_w, int src_h,
+ float src_x, float src_y, float src_w, float src_h,
int dst_x, int dst_y, int dst_w, int dst_h)
{
- struct pipe_texture **textures = port->yuv[port->current_set];
+ struct pipe_resource **textures = port->yuv[port->current_set];
/*debug_printf(" draw_yuv([%d, %d, %d ,%d], [%d, %d, %d, %d])\n",
src_x, src_y, src_w, src_h,
cso_set_fragment_shader_handle(port->r->cso, shader.fs);
}
-static INLINE void
-conditional_flush(struct pipe_context *pipe, struct pipe_texture **tex,
- int num)
-{
- int i;
- for (i = 0; i < num; ++i) {
- if (tex[i] && pipe->is_texture_referenced(pipe, tex[i], 0, 0) &
- PIPE_REFERENCED_FOR_WRITE) {
- pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL);
- return;
- }
- }
-}
-
static void
bind_samplers(struct xorg_xv_port_priv *port)
{
struct pipe_sampler_state *samplers[PIPE_MAX_SAMPLERS];
struct pipe_sampler_state sampler;
- struct pipe_texture **dst = port->yuv[port->current_set];
+ struct pipe_resource **dst = port->yuv[port->current_set];
struct pipe_sampler_view **dst_views = port->yuv_views[port->current_set];
memset(&sampler, 0, sizeof(struct pipe_sampler_state));
- conditional_flush(port->r->pipe, dst, 3);
-
sampler.wrap_s = PIPE_TEX_WRAP_CLAMP;
sampler.wrap_t = PIPE_TEX_WRAP_CLAMP;
sampler.min_img_filter = PIPE_TEX_FILTER_LINEAR;
if (!dst || !dst->tex)
XORG_FALLBACK("Xv destination %s", !dst ? "!dst" : "!dst->tex");
- dst_surf = xorg_gpu_surface(pPriv->r->pipe->screen, dst);
+ dst_surf = xorg_gpu_surface(pPriv->r->pipe, dst);
hdtv = ((src_w >= RES_720P_X) && (src_h >= RES_720P_Y));
+#ifdef COMPOSITE
REGION_TRANSLATE(pScrn->pScreen, dstRegion, -pPixmap->screen_x,
-pPixmap->screen_y);
+#endif
dxo = dstRegion->extents.x1;
dyo = dstRegion->extents.y1;
int box_y2 = pbox->y2;
float diff_x = (float)src_w / (float)dst_w;
float diff_y = (float)src_h / (float)dst_h;
- int offset_x = box_x1 - dstX + pPixmap->screen_x;
- int offset_y = box_y1 - dstY + pPixmap->screen_y;
- int offset_w;
- int offset_h;
+ float offset_x = box_x1 - dstX;
+ float offset_y = box_y1 - dstY;
+ float offset_w;
+ float offset_h;
+
+#ifdef COMPOSITE
+ offset_x += pPixmap->screen_x;
+ offset_y += pPixmap->screen_y;
+#endif
x = box_x1;
y = box_y1;
offset_h = dst_h - h;
draw_yuv(pPriv,
- src_x + offset_x*diff_x, src_y + offset_y*diff_y,
- src_w - offset_w*diff_x, src_h - offset_h*diff_y,
+ (float) src_x + offset_x*diff_x, (float) src_y + offset_y*diff_y,
+ (float) src_w - offset_w*diff_x, (float) src_h - offset_h*diff_y,
x, y, w, h);
pbox++;