swrast* (gallium, classic): add MESA_copy_sub_buffer support (v3)
[mesa.git] / src / gallium / state_trackers / xvmc / surface.c
index 615fd08d2a1e565f619d5842ba5647f30ff273ba..f6876be943b5ee68406b0dca59267d9cb7becd8f 100644 (file)
 
 #include <X11/Xlibint.h>
 
-#include "pipe/p_video_decoder.h"
+#include "pipe/p_video_codec.h"
 #include "pipe/p_video_state.h"
 #include "pipe/p_state.h"
 
 #include "util/u_inlines.h"
 #include "util/u_memory.h"
 #include "util/u_math.h"
-
-#include "vl_winsys.h"
+#include "vl/vl_winsys.h"
 
 #include "xvmc_private.h"
 
@@ -58,7 +57,7 @@ MacroBlocksToPipe(XvMCContextPrivate *context,
    assert(num_macroblocks);
 
    for (; num_macroblocks > 0; --num_macroblocks) {
-      mb->base.codec = PIPE_VIDEO_CODEC_MPEG12;
+      mb->base.codec = PIPE_VIDEO_FORMAT_MPEG12;
       mb->x = xvmc_mb->x;
       mb->y = xvmc_mb->y;
       mb->macroblock_type = xvmc_mb->macroblock_type;
@@ -178,7 +177,8 @@ Status XvMCCreateSurface(Display *dpy, XvMCContext *context, XvMCSurface *surfac
    tmpl.buffer_format = pipe->screen->get_video_param
    (
       pipe->screen,
-      PIPE_VIDEO_PROFILE_MPEG2_MAIN,
+      context_priv->decoder->profile,
+      context_priv->decoder->entrypoint,
       PIPE_VIDEO_CAP_PREFERED_FORMAT
    );
    tmpl.chroma_format = context_priv->decoder->chroma_format;
@@ -187,11 +187,16 @@ Status XvMCCreateSurface(Display *dpy, XvMCContext *context, XvMCSurface *surfac
    tmpl.interlaced = pipe->screen->get_video_param
    (
       pipe->screen,
-      PIPE_VIDEO_PROFILE_MPEG2_MAIN,
+      context_priv->decoder->profile,
+      context_priv->decoder->entrypoint,
       PIPE_VIDEO_CAP_PREFERS_INTERLACED
    );
 
    surface_priv->video_buffer = pipe->create_video_buffer(pipe, &tmpl);
+   if (!surface_priv->video_buffer) {
+      FREE(surface_priv);
+      return BadAlloc;
+   }
    surface_priv->context = context;
 
    surface->surface_id = XAllocID(dpy);
@@ -216,7 +221,7 @@ Status XvMCRenderSurface(Display *dpy, XvMCContext *context, unsigned int pictur
 )
 {
    struct pipe_mpeg12_macroblock mb[num_macroblocks];
-   struct pipe_video_decoder *decoder;
+   struct pipe_video_codec *decoder;
    struct pipe_mpeg12_picture_desc desc;
 
    XvMCContextPrivate *context_priv;
@@ -387,7 +392,6 @@ Status XvMCPutSurface(Display *dpy, XvMCSurface *surface, Drawable drawable,
 
    memset(&surf_templ, 0, sizeof(surf_templ));
    surf_templ.format = tex->format;
-   surf_templ.usage = PIPE_BIND_RENDER_TARGET;
    surf = pipe->create_surface(pipe, tex, &surf_templ);
 
    if (!surf)
@@ -434,16 +438,16 @@ Status XvMCPutSurface(Display *dpy, XvMCSurface *surface, Drawable drawable,
 
    vl_compositor_set_layer_dst_area(cstate, 0, &dst_rect);
    vl_compositor_set_layer_dst_area(cstate, 1, &dst_rect);
-   vl_compositor_render(cstate, compositor, surf, dirty_area);
+   vl_compositor_render(cstate, compositor, surf, dirty_area, true);
 
-   pipe->flush(pipe, &surface_priv->fence);
+   pipe->flush(pipe, &surface_priv->fence, 0);
 
    XVMC_MSG(XVMC_TRACE, "[XvMC] Submitted surface %p for display. Pushing to front buffer.\n", surface);
 
    pipe->screen->flush_frontbuffer
    (
       pipe->screen, tex, 0, 0,
-      vl_screen_get_private(context_priv->vscreen)
+      vl_screen_get_private(context_priv->vscreen), NULL
    );
 
    if(dump_window == -1) {