Mesa (pipe-video): [g3dvl] get sampler swizzle right for subpictures

Christian König deathsimple at kemper.freedesktop.org
Sat Mar 26 11:40:26 UTC 2011


Module: Mesa
Branch: pipe-video
Commit: 5f23328a8ad991ef1c70f045865b6a5e13323b67
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5f23328a8ad991ef1c70f045865b6a5e13323b67

Author: Christian König <deathsimple at vodafone.de>
Date:   Sat Mar 26 10:58:38 2011 +0100

[g3dvl] get sampler swizzle right for subpictures

This should make ai44 work correctly.

---

 src/gallium/state_trackers/xorg/xvmc/subpicture.c |   35 ++++++++++++--------
 1 files changed, 21 insertions(+), 14 deletions(-)

diff --git a/src/gallium/state_trackers/xorg/xvmc/subpicture.c b/src/gallium/state_trackers/xorg/xvmc/subpicture.c
index 3d0bb7a..2603030 100644
--- a/src/gallium/state_trackers/xorg/xvmc/subpicture.c
+++ b/src/gallium/state_trackers/xorg/xvmc/subpicture.c
@@ -193,24 +193,31 @@ Status XvMCCreateSubpicture(Display *dpy, XvMCContext *context, XvMCSubpicture *
    memset(&sampler_templ, 0, sizeof(sampler_templ));
    u_sampler_view_default_template(&sampler_templ, tex, tex->format);
 
-#if 0
-   switch (image->id) {
+   switch (xvimage_id) {
       case FOURCC_RGB:
-         assert(subpicture_priv->sfc->format == XvIDToPipe(image->id));
-         for (y = 0; y < height; ++y) {
-            dst_line = dst;
-            for (x = 0; x < width; ++x, src += 3, dst_line += 4) {
-               dst_line[0] = src[2]; /* B */
-               dst_line[1] = src[1]; /* G */
-               dst_line[2] = src[0]; /* R */
-            }
-            dst += xfer->stride;
-         }
+         sampler_templ.swizzle_r = PIPE_SWIZZLE_BLUE;
+         sampler_templ.swizzle_g = PIPE_SWIZZLE_GREEN;
+         sampler_templ.swizzle_b = PIPE_SWIZZLE_RED;
+         sampler_templ.swizzle_a = PIPE_SWIZZLE_ONE;
+         break;
+
+      case FOURCC_AI44:
+         sampler_templ.swizzle_r = PIPE_SWIZZLE_ALPHA;
+         sampler_templ.swizzle_g = PIPE_SWIZZLE_ALPHA;
+         sampler_templ.swizzle_b = PIPE_SWIZZLE_ALPHA;
+         sampler_templ.swizzle_a = PIPE_SWIZZLE_RED;
          break;
+
+      case FOURCC_IA44:
+         sampler_templ.swizzle_r = PIPE_SWIZZLE_RED;
+         sampler_templ.swizzle_g = PIPE_SWIZZLE_RED;
+         sampler_templ.swizzle_b = PIPE_SWIZZLE_RED;
+         sampler_templ.swizzle_a = PIPE_SWIZZLE_ALPHA;
+         break;
+
       default:
-         XVMC_MSG(XVMC_ERR, "[XvMC] Unrecognized Xv image ID 0x%08X.\n", image->id);
+         XVMC_MSG(XVMC_ERR, "[XvMC] Unrecognized Xv image ID 0x%08X.\n", xvimage_id);
    }
-#endif
 
    subpicture_priv->sampler = vpipe->create_sampler_view(vpipe, tex, &sampler_templ);
    pipe_resource_reference(&tex, NULL);




More information about the mesa-commit mailing list