diff options
author | Christian König <[email protected]> | 2012-02-25 13:53:29 +0100 |
---|---|---|
committer | Christian König <[email protected]> | 2012-03-02 13:14:21 +0100 |
commit | d645dc65b6c5e7d46538e98208a703f0f7a5d20b (patch) | |
tree | e6c1c8ebf578775dd2c8524a6394602235fd674c /src | |
parent | 32c4381d4a0479b3d9bfe305ce701be6b5ac8e18 (diff) |
vl/compositor: replace pipe_video_rect with u_rect
So we support things like flipping also.
Signed-off-by: Christian König <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/auxiliary/vl/vl_compositor.c | 46 | ||||
-rw-r--r-- | src/gallium/auxiliary/vl/vl_compositor.h | 16 | ||||
-rw-r--r-- | src/gallium/include/pipe/p_video_state.h | 5 | ||||
-rw-r--r-- | src/gallium/state_trackers/vdpau/mixer.c | 2 | ||||
-rw-r--r-- | src/gallium/state_trackers/vdpau/output.c | 5 | ||||
-rw-r--r-- | src/gallium/state_trackers/vdpau/presentation.c | 19 | ||||
-rw-r--r-- | src/gallium/state_trackers/vdpau/vdpau_private.h | 12 | ||||
-rw-r--r-- | src/gallium/state_trackers/xvmc/subpicture.c | 4 | ||||
-rw-r--r-- | src/gallium/state_trackers/xvmc/surface.c | 4 | ||||
-rw-r--r-- | src/gallium/state_trackers/xvmc/xvmc_private.h | 4 |
10 files changed, 55 insertions, 62 deletions
diff --git a/src/gallium/auxiliary/vl/vl_compositor.c b/src/gallium/auxiliary/vl/vl_compositor.c index 9666ad1e047..b0302980561 100644 --- a/src/gallium/auxiliary/vl/vl_compositor.c +++ b/src/gallium/auxiliary/vl/vl_compositor.c @@ -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); diff --git a/src/gallium/auxiliary/vl/vl_compositor.h b/src/gallium/auxiliary/vl/vl_compositor.h index 8c574798591..f998a2e081c 100644 --- a/src/gallium/auxiliary/vl/vl_compositor.h +++ b/src/gallium/auxiliary/vl/vl_compositor.h @@ -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); /*@}*/ diff --git a/src/gallium/include/pipe/p_video_state.h b/src/gallium/include/pipe/p_video_state.h index b73c94b7a5d..00390d3e170 100644 --- a/src/gallium/include/pipe/p_video_state.h +++ b/src/gallium/include/pipe/p_video_state.h @@ -38,11 +38,6 @@ extern "C" { #endif -struct pipe_video_rect -{ - unsigned x, y, w, h; -}; - /* * see table 6-12 in the spec */ diff --git a/src/gallium/state_trackers/vdpau/mixer.c b/src/gallium/state_trackers/vdpau/mixer.c index ac0ce86beeb..ead9323eb8f 100644 --- a/src/gallium/state_trackers/vdpau/mixer.c +++ b/src/gallium/state_trackers/vdpau/mixer.c @@ -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; diff --git a/src/gallium/state_trackers/vdpau/output.c b/src/gallium/state_trackers/vdpau/output.c index 0583c52fe82..0ea502939c3 100644 --- a/src/gallium/state_trackers/vdpau/output.c +++ b/src/gallium/state_trackers/vdpau/output.c @@ -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; diff --git a/src/gallium/state_trackers/vdpau/presentation.c b/src/gallium/state_trackers/vdpau/presentation.c index 71447793f58..4d12bb3e700 100644 --- a/src/gallium/state_trackers/vdpau/presentation.c +++ b/src/gallium/state_trackers/vdpau/presentation.c @@ -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); diff --git a/src/gallium/state_trackers/vdpau/vdpau_private.h b/src/gallium/state_trackers/vdpau/vdpau_private.h index e74c68187d2..1b617847d4a 100644 --- a/src/gallium/state_trackers/vdpau/vdpau_private.h +++ b/src/gallium/state_trackers/vdpau/vdpau_private.h @@ -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; diff --git a/src/gallium/state_trackers/xvmc/subpicture.c b/src/gallium/state_trackers/xvmc/subpicture.c index 6b1b091cf89..058c56816ac 100644 --- a/src/gallium/state_trackers/xvmc/subpicture.c +++ b/src/gallium/state_trackers/xvmc/subpicture.c @@ -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; diff --git a/src/gallium/state_trackers/xvmc/surface.c b/src/gallium/state_trackers/xvmc/surface.c index 47853cf6924..33b7dc2b164 100644 --- a/src/gallium/state_trackers/xvmc/surface.c +++ b/src/gallium/state_trackers/xvmc/surface.c @@ -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; diff --git a/src/gallium/state_trackers/xvmc/xvmc_private.h b/src/gallium/state_trackers/xvmc/xvmc_private.h index 26f874ad87a..014d83f0516 100644 --- a/src/gallium/state_trackers/xvmc/xvmc_private.h +++ b/src/gallium/state_trackers/xvmc/xvmc_private.h @@ -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; |