So we support things like flipping also.
Signed-off-by: Christian König <deathsimple@vodafone.de>
pipe_resource_reference(&c->vertex_buf.buffer, NULL);
}
-static INLINE struct pipe_video_rect
+static INLINE struct u_rect
default_rect(struct vl_compositor_layer *layer)
{
struct pipe_resource *res = layer->sampler_views[0]->texture;
- struct pipe_video_rect rect = { 0, 0, res->width0, res->height0 * res->depth0 };
+ struct u_rect rect = { 0, res->width0, 0, res->height0 * res->depth0 };
return rect;
}
static INLINE struct vertex2f
-calc_topleft(struct vertex2f size, struct pipe_video_rect rect)
+calc_topleft(struct vertex2f size, struct u_rect rect)
{
- struct vertex2f res = { rect.x / size.x, rect.y / size.y };
+ struct vertex2f res = { rect.x0 / size.x, rect.y0 / size.y };
return res;
}
static INLINE struct vertex2f
-calc_bottomright(struct vertex2f size, struct pipe_video_rect rect)
+calc_bottomright(struct vertex2f size, struct u_rect rect)
{
- struct vertex2f res = { (rect.x + rect.w) / size.x, (rect.y + rect.h) / size.y };
+ struct vertex2f res = { rect.x1 / size.x, rect.y1 / size.y };
return res;
}
static INLINE void
calc_src_and_dst(struct vl_compositor_layer *layer, unsigned width, unsigned height,
- struct pipe_video_rect src, struct pipe_video_rect dst)
+ struct u_rect src, struct u_rect dst)
{
struct vertex2f size = { width, height };
}
void
-vl_compositor_set_dst_area(struct vl_compositor_state *s, struct pipe_video_rect *dst_area)
+vl_compositor_set_dst_area(struct vl_compositor_state *s, struct u_rect *dst_area)
{
assert(s);
s->viewport_valid = dst_area != NULL;
if (dst_area) {
- s->viewport.scale[0] = dst_area->w;
- s->viewport.scale[1] = dst_area->h;
- s->viewport.translate[0] = dst_area->x;
- s->viewport.translate[1] = dst_area->y;
+ s->viewport.scale[0] = dst_area->x1 - dst_area->x0;
+ s->viewport.scale[1] = dst_area->y1 - dst_area->y0;
+ s->viewport.translate[0] = dst_area->x0;
+ s->viewport.translate[1] = dst_area->y0;
}
}
void
-vl_compositor_set_dst_clip(struct vl_compositor_state *s, struct pipe_video_rect *dst_clip)
+vl_compositor_set_dst_clip(struct vl_compositor_state *s, struct u_rect *dst_clip)
{
assert(s);
s->scissor_valid = dst_clip != NULL;
if (dst_clip) {
- s->scissor.minx = dst_clip->x;
- s->scissor.miny = dst_clip->y;
- s->scissor.maxx = dst_clip->x + dst_clip->w;
- s->scissor.maxy = dst_clip->y + dst_clip->h;
+ s->scissor.minx = dst_clip->x0;
+ s->scissor.miny = dst_clip->y0;
+ s->scissor.maxx = dst_clip->x1;
+ s->scissor.maxy = dst_clip->y1;
}
}
struct vl_compositor *c,
unsigned layer,
struct pipe_video_buffer *buffer,
- struct pipe_video_rect *src_rect,
- struct pipe_video_rect *dst_rect,
+ struct u_rect *src_rect,
+ struct u_rect *dst_rect,
enum vl_compositor_deinterlace deinterlace)
{
struct pipe_sampler_view **sampler_views;
unsigned layer,
struct pipe_sampler_view *indexes,
struct pipe_sampler_view *palette,
- struct pipe_video_rect *src_rect,
- struct pipe_video_rect *dst_rect,
+ struct u_rect *src_rect,
+ struct u_rect *dst_rect,
bool include_color_conversion)
{
assert(s && c && indexes && palette);
struct vl_compositor *c,
unsigned layer,
struct pipe_sampler_view *rgba,
- struct pipe_video_rect *src_rect,
- struct pipe_video_rect *dst_rect)
+ struct u_rect *src_rect,
+ struct u_rect *dst_rect)
{
assert(s && c && rgba);
* set the destination area
*/
void
-vl_compositor_set_dst_area(struct vl_compositor_state *settings, struct pipe_video_rect *dst_area);
+vl_compositor_set_dst_area(struct vl_compositor_state *settings, struct u_rect *dst_area);
/**
* set the destination clipping
*/
void
-vl_compositor_set_dst_clip(struct vl_compositor_state *settings, struct pipe_video_rect *dst_clip);
+vl_compositor_set_dst_clip(struct vl_compositor_state *settings, struct u_rect *dst_clip);
/**
* set overlay samplers
struct vl_compositor *compositor,
unsigned layer,
struct pipe_video_buffer *buffer,
- struct pipe_video_rect *src_rect,
- struct pipe_video_rect *dst_rect,
+ struct u_rect *src_rect,
+ struct u_rect *dst_rect,
enum vl_compositor_deinterlace deinterlace);
/**
unsigned layer,
struct pipe_sampler_view *indexes,
struct pipe_sampler_view *palette,
- struct pipe_video_rect *src_rect,
- struct pipe_video_rect *dst_rect,
+ struct u_rect *src_rect,
+ struct u_rect *dst_rect,
bool include_color_conversion);
/**
struct vl_compositor *compositor,
unsigned layer,
struct pipe_sampler_view *rgba,
- struct pipe_video_rect *src_rect,
- struct pipe_video_rect *dst_rect);
+ struct u_rect *src_rect,
+ struct u_rect *dst_rect);
/*@}*/
extern "C" {
#endif
-struct pipe_video_rect
-{
- unsigned x, y, w, h;
-};
-
/*
* see table 6-12 in the spec
*/
uint32_t layer_count,
VdpLayer const *layers)
{
- struct pipe_video_rect src_rect, dst_rect, dst_clip;
+ struct u_rect src_rect, dst_rect, dst_clip;
enum vl_compositor_deinterlace deinterlace;
unsigned layer = 0;
struct pipe_sampler_view *sv_idx = NULL, *sv_tbl = NULL;
struct pipe_box box;
- struct pipe_video_rect dst_rect;
+ struct u_rect dst_rect;
vlsurface = vlGetDataHTAB(surface);
if (!vlsurface)
struct vl_compositor *compositor;
struct vl_compositor_state *cstate;
- struct pipe_video_rect src_rect;
- struct pipe_video_rect dst_rect;
+ struct u_rect src_rect, dst_rect;
void *blend;
struct pipe_context *pipe;
struct pipe_resource *tex;
struct pipe_surface surf_templ, *surf_draw;
- struct pipe_video_rect src_rect, dst_clip;
- struct u_rect *dirty_area;
+ struct u_rect src_rect, dst_clip, *dirty_area;
struct vl_compositor *compositor;
surf->timestamp = (vlVdpTime)earliest_presentation_time;
- src_rect.x = 0;
- src_rect.y = 0;
- src_rect.w = surf_draw->width;
- src_rect.h = surf_draw->height;
+ src_rect.x0 = 0;
+ src_rect.y0 = 0;
+ src_rect.x1 = surf_draw->width;
+ src_rect.y1 = surf_draw->height;
- dst_clip.x = 0;
- dst_clip.y = 0;
- dst_clip.w = clip_width ? clip_width : surf_draw->width;
- dst_clip.h = clip_height ? clip_height : surf_draw->height;
+ dst_clip.x0 = 0;
+ dst_clip.y0 = 0;
+ dst_clip.x1 = clip_width ? clip_width : surf_draw->width;
+ dst_clip.y1 = clip_height ? clip_height : surf_draw->height;
vl_compositor_clear_layers(&pq->cstate);
vl_compositor_set_rgba_layer(&pq->cstate, compositor, 0, surf->sampler_view, &src_rect, NULL);
}
}
-static inline struct pipe_video_rect *
-RectToPipe(const VdpRect *src, struct pipe_video_rect *dst)
+static inline struct u_rect *
+RectToPipe(const VdpRect *src, struct u_rect *dst)
{
if (src) {
- dst->x = MIN2(src->x1, src->x0);
- dst->y = MIN2(src->y1, src->y0);
- dst->w = abs(src->x1 - src->x0);
- dst->h = abs(src->y1 - src->y0);
+ dst->x0 = src->x0;
+ dst->y0 = src->y0;
+ dst->x1 = src->x1;
+ dst->y1 = src->y1;
return dst;
}
return NULL;
short subx, short suby, unsigned short subw, unsigned short subh,
short surfx, short surfy, unsigned short surfw, unsigned short surfh)
{
- struct pipe_video_rect src_rect = {subx, suby, subw, subh};
- struct pipe_video_rect dst_rect = {surfx, surfy, surfw, surfh};
+ struct u_rect src_rect = {subx, subx + subw, suby, suby + subh};
+ struct u_rect dst_rect = {surfx, surfx + surfw, surfy, surfy + surfh};
XvMCSurfacePrivate *surface_priv;
XvMCSubpicturePrivate *subpicture_priv;
XvMCContextPrivate *context_priv;
XvMCSubpicturePrivate *subpicture_priv;
XvMCContext *context;
- struct pipe_video_rect src_rect = {srcx, srcy, srcw, srch};
- struct pipe_video_rect dst_rect = {destx, desty, destw, desth};
+ struct u_rect src_rect = {srcx, srcx + srcw, srcy, srcy + srch};
+ struct u_rect dst_rect = {destx, destx + destw, desty, desty + desth};
struct pipe_resource *tex;
struct pipe_surface surf_templ, *surf;
/* optional palette for this subpicture */
struct pipe_sampler_view *palette;
- struct pipe_video_rect src_rect;
- struct pipe_video_rect dst_rect;
+ struct u_rect src_rect;
+ struct u_rect dst_rect;
/* The surface this subpicture is currently associated with, if any. */
XvMCSurface *surface;