Merge remote branch 'vdpau/pipe-video' into pipe-video
authorChristian König <deathsimple@vodafone.de>
Mon, 10 Jan 2011 22:41:08 +0000 (23:41 +0100)
committerChristian König <deathsimple@vodafone.de>
Mon, 10 Jan 2011 22:41:08 +0000 (23:41 +0100)
Conflicts:
src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c
src/gallium/drivers/softpipe/sp_video_context.c
src/gallium/include/pipe/p_format.h
src/gallium/state_trackers/xorg/xvmc/context.c
src/gallium/tests/unit/SConscript

1  2 
configs/autoconf.in
configure.ac
src/gallium/auxiliary/vl/vl_compositor.c
src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c
src/gallium/drivers/softpipe/sp_video_context.c
src/gallium/include/pipe/p_defines.h
src/gallium/include/pipe/p_screen.h
src/gallium/include/pipe/p_video_context.h
src/gallium/include/pipe/p_video_state.h
src/gallium/state_trackers/xorg/xvmc/subpicture.c

Simple merge
diff --cc configure.ac
index a1d754c5b4b39f41acbcb490ba9cc427e3334da9,8544c5f0a910e8409c60e195c7ea458142aff65e..0599de4a119dbd29a72c02c48a700c0ce0ebee61
              PKG_CHECK_MODULES([LIBKMS_XORG], [libkms >= $LIBKMS_XORG_REQUIRED])
              HAVE_ST_XORG="yes"
              ;;
 -        es)
 -            AC_MSG_WARN([state tracker 'es' has been replaced by --enable-gles-overlay])
 -
 -            if test "x$enable_gles_overlay" != xyes; then
 -                if test "x$enable_gles1" != xyes -a "x$enable_gles2" != xyes; then
 -                    CORE_DIRS="mapi/es1api mapi/es2api $CORE_DIRS"
 -                fi
 -                GLES_OVERLAY=1
 -                EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(GLESv1_CM_LIB) $(GLESv2_LIB)'
 -            fi
 -          tracker=""
 -            ;;
          vega)
 -            CORE_DIRS="$CORE_DIRS mapi/vgapi"
 -            VG_LIB_DEPS="$VG_LIB_DEPS -lpthread"
 -            EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(VG_LIB)'
 +            if test "x$enable_openvg" != xyes; then
 +                AC_MSG_ERROR([cannot build vega state tracker without --enable-openvg])
 +            fi
              ;;
-         xorg/xvmc)
-             # Check for libXvMC?
+       xorg/xvmc)
+             # Check for xvmc?
              if test "x$enable_gallium_g3dvl" != xyes; then
                  AC_MSG_ERROR([cannot build XvMC state tracker without --enable-gallium-g3dvl])
              fi
index 5187c635e4b36c44db3ca9d3478742e1f018956a,c4be9c05a3ee22f079250ef9d74e39b137a558f5..d7b29497ace9a56dcfe626f05f3a8bd54435996e
@@@ -629,9 -631,10 +631,9 @@@ void vl_compositor_set_csc_matrix(struc
        pipe_buffer_map(compositor->pipe, compositor->fs_const_buf,
                        PIPE_TRANSFER_WRITE | PIPE_TRANSFER_DISCARD,
                        &buf_transfer),
-       mat,
-       sizeof(struct fragment_shader_consts)
+               mat,
+               sizeof(struct fragment_shader_consts)
     );
  
 -   pipe_buffer_unmap(compositor->pipe, compositor->fs_const_buf,
 -                     buf_transfer);
 +   pipe_buffer_unmap(compositor->pipe, buf_transfer);
  }
index 3b94e104b44081fb1b2075e1445227655a44172c,75e09deabc44d7c064bcefcc68d0a9a72c2ce46c..de83b6a5338b0b363991b5e9a31b2cae5d3cc9dd
@@@ -630,70 -1039,158 +631,69 @@@ static struct pipe_sampler_vie
  }
  
  static void
 -flush(struct vl_mpeg12_mc_renderer *r)
 +get_motion_vectors(struct pipe_mpeg12_macroblock *mb, struct vertex2s mv[4])
  {
 -   unsigned num_macroblocks[NUM_MACROBLOCK_TYPES] = { 0 };
 -   unsigned vb_start = 0;
 -   struct vertex_shader_consts *vs_consts;
 -   struct pipe_transfer *buf_transfer;
 -   
 -   unsigned i;
 -
 -   assert(r);
 -   assert(r->num_macroblocks == r->macroblocks_per_batch);
 -
 -   gen_macroblock_stream(r, num_macroblocks);
 -
 -   r->fb_state.cbufs[0] = r->surface;
 -
 -   r->pipe->set_framebuffer_state(r->pipe, &r->fb_state);
 -   r->pipe->set_viewport_state(r->pipe, &r->viewport);
 -
 -   vs_consts = pipe_buffer_map
 -   (
 -      r->pipe, r->vs_const_buf,
 -      PIPE_TRANSFER_WRITE | PIPE_TRANSFER_DISCARD,
 -      &buf_transfer
 -   );
 -
 -   vs_consts->denorm.x = r->surface->width;
 -   vs_consts->denorm.y = r->surface->height;
 -
 -   pipe_buffer_unmap(r->pipe, r->vs_const_buf, buf_transfer);
 -
 -   r->pipe->set_constant_buffer(r->pipe, PIPE_SHADER_VERTEX, 0,
 -                                r->vs_const_buf);
 -                                                              
 -
 -   if (num_macroblocks[MACROBLOCK_TYPE_INTRA] > 0) {
 -      r->pipe->set_vertex_buffers(r->pipe, 1, r->vertex_bufs.all);
 -      r->pipe->bind_vertex_elements_state(r->pipe, r->vertex_elems_state.individual.i);
 -      r->pipe->set_fragment_sampler_views(r->pipe, 3, r->sampler_views.all);
 -      r->pipe->bind_fragment_sampler_states(r->pipe, 3, r->samplers.all);
 -      r->pipe->bind_vs_state(r->pipe, r->i_vs);
 -      r->pipe->bind_fs_state(r->pipe, r->i_fs);
 -
 -      util_draw_arrays(r->pipe,PIPE_PRIM_TRIANGLES,vb_start,num_macroblocks[MACROBLOCK_TYPE_INTRA] * 24);
 -
 -      vb_start += num_macroblocks[MACROBLOCK_TYPE_INTRA] * 24;
 -   }
 -
 -   if (num_macroblocks[MACROBLOCK_TYPE_FWD_FRAME_PRED] > 0) {
 -      r->pipe->set_vertex_buffers(r->pipe, 2, r->vertex_bufs.all);
 -      r->pipe->bind_vertex_elements_state(r->pipe, r->vertex_elems_state.individual.p);
 -      r->textures.individual.ref[0] = r->past->texture;
 -      r->sampler_views.individual.ref[0] = find_or_create_sampler_view(r, r->past);
 -      r->pipe->set_fragment_sampler_views(r->pipe, 4, r->sampler_views.all);
 -      r->pipe->bind_fragment_sampler_states(r->pipe, 4, r->samplers.all);
 -      r->pipe->bind_vs_state(r->pipe, r->p_vs[0]);
 -      r->pipe->bind_fs_state(r->pipe, r->p_fs[0]);
 -
 -      util_draw_arrays(r->pipe,PIPE_PRIM_TRIANGLES,vb_start,num_macroblocks[MACROBLOCK_TYPE_FWD_FRAME_PRED] * 24);
 -
 -
 -      vb_start += num_macroblocks[MACROBLOCK_TYPE_FWD_FRAME_PRED] * 24;
 -   }
 -
 -   if (false /*num_macroblocks[MACROBLOCK_TYPE_FWD_FIELD_PRED] > 0 */ ) {
 -      r->pipe->set_vertex_buffers(r->pipe, 2, r->vertex_bufs.all);
 -      r->pipe->bind_vertex_elements_state(r->pipe, r->vertex_elems_state.individual.p);
 -      r->textures.individual.ref[0] = r->past->texture;
 -      r->sampler_views.individual.ref[0] = find_or_create_sampler_view(r, r->past);
 -      r->pipe->set_fragment_sampler_views(r->pipe, 4, r->sampler_views.all);
 -      r->pipe->bind_fragment_sampler_states(r->pipe, 4, r->samplers.all);
 -      r->pipe->bind_vs_state(r->pipe, r->p_vs[1]);
 -      r->pipe->bind_fs_state(r->pipe, r->p_fs[1]);
 -
 -      util_draw_arrays(r->pipe,PIPE_PRIM_TRIANGLES,vb_start,num_macroblocks[MACROBLOCK_TYPE_FWD_FIELD_PRED] * 24);
 +   switch (mb->mb_type) {
 +      case PIPE_MPEG12_MACROBLOCK_TYPE_BI:
 +      {
 +         if (mb->mo_type == PIPE_MPEG12_MOTION_TYPE_FRAME) {
 +            mv[2].x = mb->pmv[0][1][0];
 +            mv[2].y = mb->pmv[0][1][1];
  
 +         } else {
 +            mv[2].x = mb->pmv[0][1][0];
 +            mv[2].y = mb->pmv[0][1][1] - (mb->pmv[0][1][1] % 4);
  
 -      vb_start += num_macroblocks[MACROBLOCK_TYPE_FWD_FIELD_PRED] * 24;
 -   }
 +            mv[3].x = mb->pmv[1][1][0];
 +            mv[3].y = mb->pmv[1][1][1] - (mb->pmv[1][1][1] % 4);
  
 -   if (num_macroblocks[MACROBLOCK_TYPE_BKWD_FRAME_PRED] > 0) {
 -      r->pipe->set_vertex_buffers(r->pipe, 2, r->vertex_bufs.all);
 -      r->pipe->bind_vertex_elements_state(r->pipe, r->vertex_elems_state.individual.p);
 -      r->textures.individual.ref[0] = r->future->texture;
 -      r->sampler_views.individual.ref[0] = find_or_create_sampler_view(r, r->future);
 -      r->pipe->set_fragment_sampler_views(r->pipe, 4, r->sampler_views.all);
 -      r->pipe->bind_fragment_sampler_states(r->pipe, 4, r->samplers.all);
 -      r->pipe->bind_vs_state(r->pipe, r->p_vs[0]);
 -      r->pipe->bind_fs_state(r->pipe, r->p_fs[0]);
 +            if(mb->mvfs[0][1]) mv[2].y += 2;
 +            if(!mb->mvfs[1][1]) mv[3].y -= 2;
 +         }
  
 -      util_draw_arrays(r->pipe,PIPE_PRIM_TRIANGLES,vb_start,num_macroblocks[MACROBLOCK_TYPE_BKWD_FRAME_PRED] * 24);
 +         /* fall-through */
 +      }
 +      case PIPE_MPEG12_MACROBLOCK_TYPE_FWD:
 +      case PIPE_MPEG12_MACROBLOCK_TYPE_BKWD:
 +      {
 +         if (mb->mb_type == PIPE_MPEG12_MACROBLOCK_TYPE_BKWD) {
  
 -      vb_start += num_macroblocks[MACROBLOCK_TYPE_BKWD_FRAME_PRED] * 24;
 -   }
 +            if (mb->mo_type == PIPE_MPEG12_MOTION_TYPE_FRAME) {
 +               mv[0].x = mb->pmv[0][1][0];
 +               mv[0].y = mb->pmv[0][1][1];
  
 -   if (false /*num_macroblocks[MACROBLOCK_TYPE_BKWD_FIELD_PRED] > 0*/ ) {
 -      r->pipe->set_vertex_buffers(r->pipe, 2, r->vertex_bufs.all);
 -      r->pipe->bind_vertex_elements_state(r->pipe, r->vertex_elems_state.individual.p);
 -      r->textures.individual.ref[0] = r->future->texture;
 -      r->sampler_views.individual.ref[0] = find_or_create_sampler_view(r, r->future);
 -      r->pipe->set_fragment_sampler_views(r->pipe, 4, r->sampler_views.all);
 -      r->pipe->bind_fragment_sampler_states(r->pipe, 4, r->samplers.all);
 -      r->pipe->bind_vs_state(r->pipe, r->p_vs[1]);
 -      r->pipe->bind_fs_state(r->pipe, r->p_fs[1]);
 +            } else {
 +               mv[0].x = mb->pmv[0][1][0];
 +               mv[0].y = mb->pmv[0][1][1] - (mb->pmv[0][1][1] % 4);
  
 -      util_draw_arrays(r->pipe,PIPE_PRIM_TRIANGLES,vb_start,num_macroblocks[MACROBLOCK_TYPE_BKWD_FIELD_PRED] * 24);
 +               mv[1].x = mb->pmv[1][1][0];
 +               mv[1].y = mb->pmv[1][1][1] - (mb->pmv[1][1][1] % 4);
  
 -      vb_start += num_macroblocks[MACROBLOCK_TYPE_BKWD_FIELD_PRED] * 24;
 -   }
 +               if(mb->mvfs[0][1]) mv[0].y += 2;
 +               if(!mb->mvfs[1][1]) mv[1].y -= 2;
 +            }
  
 -   if (num_macroblocks[MACROBLOCK_TYPE_BI_FRAME_PRED] > 0) {
 -      r->pipe->set_vertex_buffers(r->pipe, 3, r->vertex_bufs.all);
 -      r->pipe->bind_vertex_elements_state(r->pipe, r->vertex_elems_state.individual.b);
 -      r->textures.individual.ref[0] = r->past->texture;
 -      r->textures.individual.ref[1] = r->future->texture;
 -      r->sampler_views.individual.ref[0] = find_or_create_sampler_view(r, r->past);
 -      r->sampler_views.individual.ref[1] = find_or_create_sampler_view(r, r->future);
 -      r->pipe->set_fragment_sampler_views(r->pipe, 5, r->sampler_views.all);
 -      r->pipe->bind_fragment_sampler_states(r->pipe, 5, r->samplers.all);
 -      r->pipe->bind_vs_state(r->pipe, r->b_vs[0]);
 -      r->pipe->bind_fs_state(r->pipe, r->b_fs[0]);
 +         } else {
  
 +            if (mb->mo_type == PIPE_MPEG12_MOTION_TYPE_FRAME) {
 +               mv[0].x = mb->pmv[0][0][0];
 +               mv[0].y = mb->pmv[0][0][1];
  
 -      util_draw_arrays(r->pipe,PIPE_PRIM_TRIANGLES,vb_start,num_macroblocks[MACROBLOCK_TYPE_BI_FRAME_PRED] * 24);
 +            } else {
 +               mv[0].x = mb->pmv[0][0][0];
 +               mv[0].y = mb->pmv[0][0][1] - (mb->pmv[0][0][1] % 4);
  
 -      vb_start += num_macroblocks[MACROBLOCK_TYPE_BI_FRAME_PRED] * 24;
 -   }
 +               mv[1].x = mb->pmv[1][0][0];
 +               mv[1].y = mb->pmv[1][0][1] - (mb->pmv[1][0][1] % 4);
  
 -   if (false /*num_macroblocks[MACROBLOCK_TYPE_BI_FIELD_PRED] > 0 */ ) {
 -      r->pipe->set_vertex_buffers(r->pipe, 3, r->vertex_bufs.all);
 -      r->pipe->bind_vertex_elements_state(r->pipe, r->vertex_elems_state.individual.b);
 -      r->textures.individual.ref[0] = r->past->texture;
 -      r->textures.individual.ref[1] = r->future->texture;
 -      r->sampler_views.individual.ref[0] = find_or_create_sampler_view(r, r->past);
 -      r->sampler_views.individual.ref[1] = find_or_create_sampler_view(r, r->future);
 -      r->pipe->set_fragment_sampler_views(r->pipe, 5, r->sampler_views.all);
 -      r->pipe->bind_fragment_sampler_states(r->pipe, 5, r->samplers.all);
 -      r->pipe->bind_vs_state(r->pipe, r->b_vs[1]);
 -      r->pipe->bind_fs_state(r->pipe, r->b_fs[1]);
 -
 -      util_draw_arrays(r->pipe,PIPE_PRIM_TRIANGLES,vb_start,num_macroblocks[MACROBLOCK_TYPE_BI_FIELD_PRED] * 24);
 -
 -      vb_start += num_macroblocks[MACROBLOCK_TYPE_BI_FIELD_PRED] * 24;
 +               if(mb->mvfs[0][0]) mv[0].y += 2;
 +               if(!mb->mvfs[1][0]) mv[1].y -= 2;
 +            }
 +         }
 +      }
 +      default:
 +         break;
     }
 -
 -   r->pipe->flush(r->pipe, PIPE_FLUSH_RENDER_CACHE, r->fence);
 -
 -   if (r->eb_handling == VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_ONE)
 -      for (i = 0; i < 3; ++i)
 -         r->zero_block[i].x = ZERO_BLOCK_NIL;
 -
 -   r->num_macroblocks = 0;
  }
  
  static void
index 895aab1b2b1a29ce3f1e9dc075ee90f75bf6be2a,9acf7171e5a090479d31f7c28e9a988f1206fcd4..daebbc54ad8dddb7e9a88d4e5eff38cda47b2867
@@@ -541,11 -448,10 +544,11 @@@ sp_mpeg12_create(struct pipe_context *p
     ctx->base.destroy = sp_mpeg12_destroy;
     ctx->base.get_param = sp_mpeg12_get_param;
     ctx->base.is_format_supported = sp_mpeg12_is_format_supported;
 +   ctx->base.create_surface = sp_mpeg12_create_surface;
     ctx->base.decode_macroblocks = sp_mpeg12_decode_macroblocks;
     ctx->base.render_picture = sp_mpeg12_render_picture;
-    ctx->base.surface_fill = sp_mpeg12_surface_fill;
-    ctx->base.surface_copy = sp_mpeg12_surface_copy;
+    ctx->base.clear_render_target = sp_mpeg12_clear_render_target;
+    ctx->base.resource_copy_region = sp_mpeg12_resource_copy_region;
     ctx->base.get_transfer = sp_mpeg12_get_transfer;
     ctx->base.transfer_destroy = sp_mpeg12_transfer_destroy;
     ctx->base.transfer_map = sp_mpeg12_transfer_map;
Simple merge
Simple merge