g3dvl: correctly distinct dst area and clip area in the compositor
authorChristian König <deathsimple@vodafone.de>
Fri, 15 Jul 2011 15:20:55 +0000 (17:20 +0200)
committerChristian König <deathsimple@vodafone.de>
Fri, 15 Jul 2011 15:36:02 +0000 (17:36 +0200)
Otherwise xine won't scale correctly.

src/gallium/auxiliary/vl/vl_compositor.c
src/gallium/auxiliary/vl/vl_compositor.h
src/gallium/state_trackers/vdpau/mixer.c
src/gallium/state_trackers/vdpau/presentation.c
src/gallium/state_trackers/xorg/xvmc/surface.c

index 0bd1bae..8018d06 100644 (file)
@@ -239,8 +239,6 @@ init_pipe_state(struct vl_compositor *c)
 
    c->viewport.scale[2] = 1;
    c->viewport.scale[3] = 1;
-   c->viewport.translate[0] = 0;
-   c->viewport.translate[1] = 0;
    c->viewport.translate[2] = 0;
    c->viewport.translate[3] = 0;
 
@@ -653,6 +651,7 @@ vl_compositor_render(struct vl_compositor *c,
                      enum pipe_mpeg12_picture_type picture_type,
                      struct pipe_surface           *dst_surface,
                      struct pipe_video_rect        *dst_area,
+                     struct pipe_video_rect        *dst_clip,
                      struct pipe_fence_handle      **fence)
 {
    struct pipe_scissor_state scissor;
@@ -663,15 +662,24 @@ vl_compositor_render(struct vl_compositor *c,
    c->fb_state.width = dst_surface->width;
    c->fb_state.height = dst_surface->height;
    c->fb_state.cbufs[0] = dst_surface;
-
-   c->viewport.scale[0] = dst_surface->width;
-   c->viewport.scale[1] = dst_surface->height;
-
+   
    if (dst_area) {
-      scissor.minx = dst_area->x;
-      scissor.miny = dst_area->y;
-      scissor.maxx = dst_area->x + dst_area->w;
-      scissor.maxy = dst_area->y + dst_area->h;
+      c->viewport.scale[0] = dst_area->w;
+      c->viewport.scale[1] = dst_area->h;
+      c->viewport.translate[0] = dst_area->x;
+      c->viewport.translate[1] = dst_area->y;
+   } else {
+      c->viewport.scale[0] = dst_surface->width;
+      c->viewport.scale[1] = dst_surface->height;
+      c->viewport.translate[0] = 0;
+      c->viewport.translate[1] = 0;
+   }
+
+   if (dst_clip) {
+      scissor.minx = dst_clip->x;
+      scissor.miny = dst_clip->y;
+      scissor.maxx = dst_clip->x + dst_clip->w;
+      scissor.maxy = dst_clip->y + dst_clip->h;
    } else {
       scissor.minx = 0;
       scissor.miny = 0;
index df662db..08ddc67 100644 (file)
@@ -158,6 +158,7 @@ vl_compositor_render(struct vl_compositor          *compositor,
                      enum pipe_mpeg12_picture_type picture_type,
                      struct pipe_surface           *dst_surface,
                      struct pipe_video_rect        *dst_area,
+                     struct pipe_video_rect        *dst_clip,
                      struct pipe_fence_handle      **fence);
 
 /**
index d518700..b85b1f2 100644 (file)
@@ -158,7 +158,7 @@ VdpStatus vlVdpVideoMixerRender(VdpVideoMixer mixer,
    vl_compositor_clear_layers(&vmixer->compositor);
    vl_compositor_set_buffer_layer(&vmixer->compositor, 0, surf->video_buffer, NULL, NULL);
    vl_compositor_render(&vmixer->compositor, PIPE_MPEG12_PICTURE_TYPE_FRAME,
-                        dst->surface, NULL, NULL);
+                        dst->surface, NULL, NULL, NULL);
 
    return VDP_STATUS_OK;
 }
index 1176c7a..fe93741 100644 (file)
@@ -170,7 +170,7 @@ vlVdpPresentationQueueDisplay(VdpPresentationQueue presentation_queue,
    vl_compositor_clear_layers(&pq->compositor);
    vl_compositor_set_rgba_layer(&pq->compositor, 0, surf->sampler_view, NULL, NULL);
    vl_compositor_render(&pq->compositor, PIPE_MPEG12_PICTURE_TYPE_FRAME,
-                        drawable_surface, NULL, NULL);
+                        drawable_surface, NULL, NULL, NULL);
 
    pq->device->context->pipe->screen->flush_frontbuffer
    (
index aef1eff..0e8b4f8 100644 (file)
@@ -567,7 +567,8 @@ Status XvMCPutSurface(Display *dpy, XvMCSurface *surface, Drawable drawable,
    // Workaround for r600g, there seems to be a bug in the fence refcounting code
    pipe->screen->fence_reference(pipe->screen, &surface_priv->fence, NULL);
 
-   vl_compositor_render(compositor, PictureToPipe(flags), context_priv->drawable_surface, &dst_rect, &surface_priv->fence);
+   vl_compositor_render(compositor, PictureToPipe(flags), context_priv->drawable_surface, 
+                        &dst_rect, NULL, &surface_priv->fence);
 
    XVMC_MSG(XVMC_TRACE, "[XvMC] Submitted surface %p for display. Pushing to front buffer.\n", surface);