Hi !<div><br></div><div>I tested the new set of patches and I got xine almost working (it wasn&#39;t with the previous series).</div><div><br></div><div>I can&#39;t start Xine alone, but Xine can run my samples if I starts them from the command line. So the problem seems to be drawing the background of the xine window.</div>

<div>I get this error either way, but it&#39;s only fatal if I run Xin without any video (it segfault or run with a black screen, monopolizing 100% of a CPU) :</div><div><div>&quot;vo_vdpau: video surface doesn&#39;t match size contraints (1920 x 1080) -&gt; (1920 x 1080) != (1920 x 1088). Segfaults ahead!&quot;</div>

<div><br></div><div>Also, seeking doesn&#39;t seems to be working when using keyboard (the video just restart from the begining or xine segfault), but kind of works when using the slider.</div><div>This error gets printed (it seems to be because of the xine osd beeing incorrectly drawn, on a green background) :</div>

<div><div>&quot;vo_vdpau: failed to get surface bits !! No backend implementation could be loaded.&quot;</div></div><div>Screenshot of the osd : <a href="http://img706.imageshack.us/img706/7977/cran07032012200803.png">http://img706.imageshack.us/img706/7977/cran07032012200803.png</a></div>

<div><br></div><div><br></div><div>Emeric</div><br><div class="gmail_quote">2012/3/7 Christian König <span dir="ltr">&lt;<a href="mailto:deathsimple@vodafone.de">deathsimple@vodafone.de</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div class="HOEnZb"><div class="h5">This gets xine working with VDPAU.<br>
<br>
v2: some minor bugfixes.<br>
<br>
Signed-off-by: Christian König &lt;<a href="mailto:deathsimple@vodafone.de">deathsimple@vodafone.de</a>&gt;<br>
---<br>
 src/gallium/auxiliary/vl/vl_video_buffer.c |   56 ++++++++++++++++++++++++---<br>
 1 files changed, 49 insertions(+), 7 deletions(-)<br>
<br>
diff --git a/src/gallium/auxiliary/vl/vl_video_buffer.c b/src/gallium/auxiliary/vl/vl_video_buffer.c<br>
index df21769..21231b2 100644<br>
--- a/src/gallium/auxiliary/vl/vl_video_buffer.c<br>
+++ b/src/gallium/auxiliary/vl/vl_video_buffer.c<br>
@@ -62,6 +62,18 @@ const enum pipe_format const_resource_formats_VUYA[3] = {<br>
    PIPE_FORMAT_NONE<br>
 };<br>
<br>
+const enum pipe_format const_resource_formats_YUYV[3] = {<br>
+   PIPE_FORMAT_R8G8_R8B8_UNORM,<br>
+   PIPE_FORMAT_NONE,<br>
+   PIPE_FORMAT_NONE<br>
+};<br>
+<br>
+const enum pipe_format const_resource_formats_UYVY[3] = {<br>
+   PIPE_FORMAT_G8R8_B8R8_UNORM,<br>
+   PIPE_FORMAT_NONE,<br>
+   PIPE_FORMAT_NONE<br>
+};<br>
+<br>
 const unsigned const_resource_plane_order_YUV[3] = {<br>
    0,<br>
    1,<br>
@@ -90,6 +102,12 @@ vl_video_buffer_formats(struct pipe_screen *screen, enum pipe_format format)<br>
    case PIPE_FORMAT_B8G8R8A8_UNORM:<br>
       return const_resource_formats_VUYA;<br>
<br>
+   case PIPE_FORMAT_YUYV:<br>
+      return const_resource_formats_YUYV;<br>
+<br>
+   case PIPE_FORMAT_UYVY:<br>
+      return const_resource_formats_UYVY;<br>
+<br>
    default:<br>
       return NULL;<br>
    }<br>
@@ -98,13 +116,15 @@ vl_video_buffer_formats(struct pipe_screen *screen, enum pipe_format format)<br>
 const unsigned *<br>
 vl_video_buffer_plane_order(enum pipe_format format)<br>
 {<br>
-    switch(format) {<br>
+   switch(format) {<br>
    case PIPE_FORMAT_YV12:<br>
       return const_resource_plane_order_YVU;<br>
<br>
    case PIPE_FORMAT_NV12:<br>
    case PIPE_FORMAT_R8G8B8A8_UNORM:<br>
    case PIPE_FORMAT_B8G8R8A8_UNORM:<br>
+   case PIPE_FORMAT_YUYV:<br>
+   case PIPE_FORMAT_UYVY:<br>
       return const_resource_plane_order_YUV;<br>
<br>
    default:<br>
@@ -112,6 +132,19 @@ vl_video_buffer_plane_order(enum pipe_format format)<br>
    }<br>
 }<br>
<br>
+static enum pipe_format<br>
+vl_video_buffer_surface_format(enum pipe_format format)<br>
+{<br>
+   const struct util_format_description *desc;<br>
+<br>
+   /* a subsampled format can&#39;t work as surface use RGBA instead */<br>
+   desc = util_format_description(format);<br>
+   if (desc-&gt;layout == UTIL_FORMAT_LAYOUT_SUBSAMPLED)<br>
+      return PIPE_FORMAT_R8G8B8A8_UNORM;<br>
+<br>
+   return format;<br>
+}<br>
+<br>
 boolean<br>
 vl_video_buffer_is_format_supported(struct pipe_screen *screen,<br>
                                     enum pipe_format format,<br>
@@ -125,10 +158,17 @@ vl_video_buffer_is_format_supported(struct pipe_screen *screen,<br>
       return false;<br>
<br>
    for (i = 0; i &lt; VL_NUM_COMPONENTS; ++i) {<br>
-      if (!resource_formats[i])<br>
+      enum pipe_format format = resource_formats[i];<br>
+<br>
+      if (format == PIPE_FORMAT_NONE)<br>
          continue;<br>
<br>
-      if (!screen-&gt;is_format_supported(screen, resource_formats[i], PIPE_TEXTURE_2D, 0, PIPE_USAGE_STATIC))<br>
+      /* we at least need to sample from it */<br>
+      if (!screen-&gt;is_format_supported(screen, format, PIPE_TEXTURE_2D, 0, PIPE_BIND_SAMPLER_VIEW))<br>
+         return false;<br>
+<br>
+      format = vl_video_buffer_surface_format(format);<br>
+      if (!screen-&gt;is_format_supported(screen, format, PIPE_TEXTURE_2D, 0, PIPE_BIND_RENDER_TARGET))<br>
          return false;<br>
    }<br>
<br>
@@ -181,7 +221,7 @@ vl_vide_buffer_template(struct pipe_resource *templ,<br>
 {<br>
    memset(templ, 0, sizeof(*templ));<br>
    templ-&gt;target = depth &gt; 1 ? PIPE_TEXTURE_3D : PIPE_TEXTURE_2D;<br>
-   templ-&gt;format = resource_format;<br>
+   templ-&gt;format = vl_video_buffer_surface_format(resource_format);<br>
    templ-&gt;width0 = tmpl-&gt;width;<br>
    templ-&gt;height0 = tmpl-&gt;height;<br>
    templ-&gt;depth0 = depth;<br>
@@ -262,6 +302,7 @@ vl_video_buffer_sampler_view_components(struct pipe_video_buffer *buffer)<br>
    struct vl_video_buffer *buf = (struct vl_video_buffer *)buffer;<br>
    struct pipe_sampler_view sv_templ;<br>
    struct pipe_context *pipe;<br>
+   const enum pipe_format *sampler_format;<br>
    const unsigned *plane_order;<br>
    unsigned i, j, component;<br>
<br>
@@ -269,18 +310,19 @@ vl_video_buffer_sampler_view_components(struct pipe_video_buffer *buffer)<br>
<br>
    pipe = buf-&gt;base.context;<br>
<br>
+   sampler_format = vl_video_buffer_formats(pipe-&gt;screen, buf-&gt;base.buffer_format);<br>
    plane_order = vl_video_buffer_plane_order(buf-&gt;base.buffer_format);<br>
<br>
    for (component = 0, i = 0; i &lt; buf-&gt;num_planes; ++i ) {<br>
       struct pipe_resource *res = buf-&gt;resources[plane_order[i]];<br>
-      unsigned nr_components = util_format_get_nr_components(res-&gt;format);<br>
+      unsigned nr_components = MIN2(util_format_get_nr_components(res-&gt;format), 3);<br>
<br>
       for (j = 0; j &lt; nr_components; ++j, ++component) {<br>
          assert(component &lt; VL_NUM_COMPONENTS);<br>
<br>
          if (!buf-&gt;sampler_view_components[component]) {<br>
             memset(&amp;sv_templ, 0, sizeof(sv_templ));<br>
-            u_sampler_view_default_template(&amp;sv_templ, res, res-&gt;format);<br>
+            u_sampler_view_default_template(&amp;sv_templ, res, sampler_format[plane_order[i]]);<br>
             sv_templ.swizzle_r = sv_templ.swizzle_g = sv_templ.swizzle_b = PIPE_SWIZZLE_RED + j;<br>
             sv_templ.swizzle_a = PIPE_SWIZZLE_ONE;<br>
             buf-&gt;sampler_view_components[component] = pipe-&gt;create_sampler_view(pipe, res, &amp;sv_templ);<br>
@@ -289,6 +331,7 @@ vl_video_buffer_sampler_view_components(struct pipe_video_buffer *buffer)<br>
          }<br>
       }<br>
    }<br>
+   assert(component == VL_NUM_COMPONENTS);<br>
<br>
    return buf-&gt;sampler_view_components;<br>
<br>
@@ -406,7 +449,6 @@ vl_video_buffer_create_ex(struct pipe_context *pipe,<br>
       goto error;<br>
<br>
    if (resource_formats[1] == PIPE_FORMAT_NONE) {<br>
-      assert(tmpl-&gt;chroma_format == PIPE_VIDEO_CHROMA_FORMAT_444);<br>
       assert(resource_formats[2] == PIPE_FORMAT_NONE);<br>
       return vl_video_buffer_create_ex2(pipe, tmpl, resources);<br>
    }<br>
--<br>
1.7.5.4<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</div></div></blockquote></div><br></div>