<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - swrast crashes with compiz"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=64791">64791</a>
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>mesa-dev@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>swrast crashes with compiz
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>pierre-bugzilla@ossman.eu
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>Mesa
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I'm getting a crash when using the classic swrast driver together with compiz.

I have no idea how this is supposed to work, but the issue is that getImage()
gets called with NULL as the destination buffer. The calling function is
swrastSetTexBuffer2(), and to me it looks a bit off.

The function fetches the current texture image (creating one if needed),
modifies the fields and then calls getImage(). At no point does it adjust the
size of the buffer to match the new fields though. So I guess that happened
implicitly at some point, but doesn't anymore.

I applied this (in the spirit of similiar functions) and that got rid of the
crash:

Index: mesa/src/mesa/drivers/dri/swrast/swrast.c
===================================================================
--- mesa/src/mesa/drivers/dri/swrast/swrast.c    (revision 27412)
+++ mesa/src/mesa/drivers/dri/swrast/swrast.c    (working copy)
@@ -94,9 +94,15 @@
     else
     texFormat = MESA_FORMAT_ARGB8888;

+    /* Free old texture image */
+    dri_ctx->Base.Driver.FreeTextureImageBuffer(&dri_ctx->Base, texImage);
+
     _mesa_init_teximage_fields(&dri_ctx->Base, texImage,
                    w, h, 1, 0, internalFormat, texFormat);

+    /* Allocate texture memory (no pixel data yet) */
+    dri_ctx->Base.Driver.AllocTextureImageBuffer(&dri_ctx->Base, texImage);
+
     sPriv->swrast_loader->getImage(dPriv, x, y, w, h, (char *)swImage->Buffer,
                    dPriv->loaderPrivate);



Unfortunately it doesn't seem to create something that actually works.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>