mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-01 11:50:09 +01:00
vl/compositor: replace pipe_video_rect with u_rect
So we support things like flipping also. Signed-off-by: Christian König <deathsimple@vodafone.de>
This commit is contained in:
parent
32c4381d4a
commit
d645dc65b6
10 changed files with 55 additions and 62 deletions
|
|
@ -528,31 +528,31 @@ cleanup_buffers(struct vl_compositor *c)
|
|||
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 };
|
||||
|
||||
|
|
@ -766,30 +766,30 @@ vl_compositor_set_csc_matrix(struct vl_compositor_state *s, const float matrix[1
|
|||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -811,8 +811,8 @@ vl_compositor_set_buffer_layer(struct vl_compositor_state *s,
|
|||
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;
|
||||
|
|
@ -865,8 +865,8 @@ vl_compositor_set_palette_layer(struct vl_compositor_state *s,
|
|||
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);
|
||||
|
|
@ -894,8 +894,8 @@ vl_compositor_set_rgba_layer(struct vl_compositor_state *s,
|
|||
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);
|
||||
|
||||
|
|
|
|||
|
|
@ -147,13 +147,13 @@ vl_compositor_get_clear_color(struct vl_compositor_state *settings, union pipe_c
|
|||
* 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
|
||||
|
|
@ -181,8 +181,8 @@ vl_compositor_set_buffer_layer(struct vl_compositor_state *state,
|
|||
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);
|
||||
|
||||
/**
|
||||
|
|
@ -194,8 +194,8 @@ vl_compositor_set_palette_layer(struct vl_compositor_state *state,
|
|||
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);
|
||||
|
||||
/**
|
||||
|
|
@ -206,8 +206,8 @@ vl_compositor_set_rgba_layer(struct vl_compositor_state *state,
|
|||
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);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
|
|
|||
|
|
@ -38,11 +38,6 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct pipe_video_rect
|
||||
{
|
||||
unsigned x, y, w, h;
|
||||
};
|
||||
|
||||
/*
|
||||
* see table 6-12 in the spec
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -204,7 +204,7 @@ VdpStatus vlVdpVideoMixerRender(VdpVideoMixer mixer,
|
|||
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;
|
||||
|
||||
|
|
|
|||
|
|
@ -214,7 +214,7 @@ vlVdpOutputSurfacePutBitsIndexed(VdpOutputSurface surface,
|
|||
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)
|
||||
|
|
@ -448,8 +448,7 @@ vlVdpOutputSurfaceRenderOutputSurface(VdpOutputSurface destination_surface,
|
|||
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;
|
||||
|
||||
|
|
|
|||
|
|
@ -202,8 +202,7 @@ vlVdpPresentationQueueDisplay(VdpPresentationQueue presentation_queue,
|
|||
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;
|
||||
|
||||
|
|
@ -231,15 +230,15 @@ vlVdpPresentationQueueDisplay(VdpPresentationQueue presentation_queue,
|
|||
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -270,14 +270,14 @@ PipeToProfile(enum pipe_video_profile p_profile)
|
|||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -437,8 +437,8 @@ Status XvMCBlendSubpicture(Display *dpy, XvMCSurface *target_surface, XvMCSubpic
|
|||
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;
|
||||
|
|
|
|||
|
|
@ -355,8 +355,8 @@ Status XvMCPutSurface(Display *dpy, XvMCSurface *surface, Drawable drawable,
|
|||
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;
|
||||
|
|
|
|||
|
|
@ -90,8 +90,8 @@ typedef struct
|
|||
/* 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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue