st/xvmc: Include u_surface.h for u_copy_rect.
[mesa.git] / src / gallium / state_trackers / xvmc / subpicture.c
index f9f646b7496c01eaa2d26884d22b3a6deae04d43..ef8e578b48579e4952173da9073f8c3ccfdb3070 100644 (file)
 #include <X11/extensions/XvMClib.h>
 
 #include "pipe/p_screen.h"
-#include "pipe/p_video_decoder.h"
+#include "pipe/p_video_codec.h"
 #include "pipe/p_state.h"
 
 #include "util/u_memory.h"
 #include "util/u_math.h"
 #include "util/u_format.h"
 #include "util/u_sampler.h"
+#include "util/u_surface.h"
 #include "util/u_rect.h"
 #include "vl/vl_winsys.h"
 
@@ -115,8 +116,7 @@ static Status Validate(Display *dpy, XvPortID port, int surface_type_id, int xvi
 
    subpictures = XvMCListSubpictureTypes(dpy, port, surface_type_id, &num_subpics);
    if (num_subpics < 1) {
-      if (subpictures)
-         free(subpictures);
+      free(subpictures);
       return BadMatch;
    }
    if (!subpictures)
@@ -174,20 +174,16 @@ upload_sampler(struct pipe_context *pipe, struct pipe_sampler_view *dst,
    struct pipe_transfer *transfer;
    void *map;
 
-   transfer = pipe->get_transfer(pipe, dst->texture, 0, PIPE_TRANSFER_WRITE, dst_box);
-   if (!transfer)
+   map = pipe->transfer_map(pipe, dst->texture, 0, PIPE_TRANSFER_WRITE,
+                            dst_box, &transfer);
+   if (!map)
       return;
 
-   map = pipe->transfer_map(pipe, transfer);
-   if (map) {
-      util_copy_rect(map, dst->texture->format, transfer->stride, 0, 0,
-                     dst_box->width, dst_box->height,
-                     src, src_stride, src_x, src_y);
+   util_copy_rect(map, dst->texture->format, transfer->stride, 0, 0,
+                  dst_box->width, dst_box->height,
+                  src, src_stride, src_x, src_y);
 
-      pipe->transfer_unmap(pipe, transfer);
-   }
-
-   pipe->transfer_destroy(pipe, transfer);
+   pipe->transfer_unmap(pipe, transfer);
 }
 
 PUBLIC
@@ -232,6 +228,7 @@ Status XvMCCreateSubpicture(Display *dpy, XvMCContext *context, XvMCSubpicture *
    tex_templ.last_level = 0;
    if (pipe->screen->get_video_param(pipe->screen,
                                      PIPE_VIDEO_PROFILE_UNKNOWN,
+                                     PIPE_VIDEO_ENTRYPOINT_UNKNOWN,
                                      PIPE_VIDEO_CAP_NPOT_TEXTURES)) {
       tex_templ.width0 = width;
       tex_templ.height0 = height;
@@ -324,20 +321,15 @@ Status XvMCClearSubpicture(Display *dpy, XvMCSubpicture *subpicture, short x, sh
    dst = subpicture_priv->sampler;
 
    /* TODO: Assert clear rect is within bounds? Or clip? */
-   transfer = pipe->get_transfer(pipe, dst->texture, 0, PIPE_TRANSFER_WRITE, &dst_box);
-   if (!transfer)
+   map = pipe->transfer_map(pipe, dst->texture, 0, PIPE_TRANSFER_WRITE,
+                            &dst_box, &transfer);
+   if (!map)
       return XvMCBadSubpicture;
 
-   map = pipe->transfer_map(pipe, transfer);
-   if (map) {
-      util_fill_rect(map, dst->texture->format, transfer->stride, 0, 0,
-                     dst_box.width, dst_box.height, &uc);
-
-      pipe->transfer_unmap(pipe, transfer);
-   }
-
-   pipe->transfer_destroy(pipe, transfer);
+   util_fill_rect(map, dst->texture->format, transfer->stride, 0, 0,
+                  dst_box.width, dst_box.height, &uc);
 
+   pipe->transfer_unmap(pipe, transfer);
    return Success;
 }