From efaf024f8c7c1000af06e54a85378818d55c5160 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Christian=20K=C3=B6nig?= Date: Wed, 13 Apr 2011 19:32:49 +0200 Subject: [PATCH] xvmc: use a pipe_video_rect for subpicture src & dst --- src/gallium/state_trackers/xorg/xvmc/subpicture.c | 13 +++++-------- src/gallium/state_trackers/xorg/xvmc/surface.c | 7 +++---- src/gallium/state_trackers/xorg/xvmc/xvmc_private.h | 9 +++++---- 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/src/gallium/state_trackers/xorg/xvmc/subpicture.c b/src/gallium/state_trackers/xorg/xvmc/subpicture.c index 31b1a96512f..68519c08885 100644 --- a/src/gallium/state_trackers/xorg/xvmc/subpicture.c +++ b/src/gallium/state_trackers/xorg/xvmc/subpicture.c @@ -417,6 +417,9 @@ 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}; + XvMCSurfacePrivate *surface_priv; XvMCSubpicturePrivate *subpicture_priv; @@ -439,16 +442,10 @@ Status XvMCBlendSubpicture(Display *dpy, XvMCSurface *target_surface, XvMCSubpic subpicture_priv = subpicture->privData; /* TODO: Assert rects are within bounds? Or clip? */ + subpicture_priv->src_rect = src_rect; + subpicture_priv->dst_rect = dst_rect; surface_priv->subpicture = subpicture; - surface_priv->subx = subx; - surface_priv->suby = suby; - surface_priv->subw = subw; - surface_priv->subh = subh; - surface_priv->surfx = surfx; - surface_priv->surfy = surfy; - surface_priv->surfw = surfw; - surface_priv->surfh = surfh; subpicture_priv->surface = target_surface; return Success; diff --git a/src/gallium/state_trackers/xorg/xvmc/surface.c b/src/gallium/state_trackers/xorg/xvmc/surface.c index c8c8638e581..f22d315c90d 100644 --- a/src/gallium/state_trackers/xorg/xvmc/surface.c +++ b/src/gallium/state_trackers/xorg/xvmc/surface.c @@ -431,14 +431,13 @@ Status XvMCPutSurface(Display *dpy, XvMCSurface *surface, Drawable drawable, compositor->set_buffer_layer(compositor, 0, surface_priv->video_buffer, &src_rect, NULL); if (subpicture_priv) { - struct pipe_video_rect src_rect = {surface_priv->subx, surface_priv->suby, surface_priv->subw, surface_priv->subh}; - struct pipe_video_rect dst_rect = {surface_priv->surfx, surface_priv->surfy, surface_priv->surfw, surface_priv->surfh}; - XVMC_MSG(XVMC_TRACE, "[XvMC] Surface %p has subpicture %p.\n", surface, surface_priv->subpicture); assert(subpicture_priv->surface == surface); + if (subpicture_priv->palette) - compositor->set_palette_layer(compositor, 1, subpicture_priv->sampler, subpicture_priv->palette, &src_rect, &dst_rect); + compositor->set_palette_layer(compositor, 1, subpicture_priv->sampler, subpicture_priv->palette, + &subpicture_priv->src_rect, &subpicture_priv->dst_rect); else compositor->set_rgba_layer(compositor, 1, subpicture_priv->sampler, &src_rect, &dst_rect); diff --git a/src/gallium/state_trackers/xorg/xvmc/xvmc_private.h b/src/gallium/state_trackers/xorg/xvmc/xvmc_private.h index b902d7d2817..056bdfc2f3c 100644 --- a/src/gallium/state_trackers/xorg/xvmc/xvmc_private.h +++ b/src/gallium/state_trackers/xorg/xvmc/xvmc_private.h @@ -31,6 +31,8 @@ #include #include +#include + #include #include @@ -77,10 +79,6 @@ typedef struct /* The subpicture associated with this surface, if any. */ XvMCSubpicture *subpicture; - short subx, suby; - unsigned short subw, subh; - short surfx, surfy; - unsigned short surfw, surfh; /* Some XvMC functions take a surface but not a context, so we keep track of which context each surface belongs to. */ @@ -94,6 +92,9 @@ typedef struct /* optional palette for this subpicture */ struct pipe_sampler_view *palette; + struct pipe_video_rect src_rect; + struct pipe_video_rect dst_rect; + /* The surface this subpicture is currently associated with, if any. */ XvMCSurface *surface; -- 2.30.2