Tested-by: Sven Arvidsson &lt;<a href="mailto:sa@whiz.se">sa@whiz.se</a>&gt;<br><br>Posted here:<br><a href="https://bugs.freedesktop.org/show_bug.cgi?id=30036#c6">https://bugs.freedesktop.org/show_bug.cgi?id=30036#c6</a><br>

<br><div class="gmail_quote">On Sun, Sep 12, 2010 at 5:09 AM, Marek Olšák <span dir="ltr">&lt;<a href="mailto:maraeo@gmail.com">maraeo@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

This commit fixes bogus CS rejection if it contains a sequence<br>
of the following operations:<br>
<br>
- Set the color buffer 0. track-&gt;cb[i].robj becomes non-NULL.<br>
- Render.<br>
- Set a larger zbuffer than the previously-set color buffer.<br>
- Set a larger scissor area as well.<br>
- Set the color channel mask to 0 to do depth-only rendering.<br>
- Render. --&gt; rejected, because track-&gt;cb[i].robj remained non-NULL,<br>
  therefore the conditional checking for the color channel mask and<br>
  friends is not performed, and the larger scissor area causes<br>
  the rejection.<br>
<br>
This fixes bugs:<br>
- <a href="https://bugs.freedesktop.org/show_bug.cgi?id=29762" target="_blank">https://bugs.freedesktop.org/show_bug.cgi?id=29762</a><br>
- <a href="https://bugs.freedesktop.org/show_bug.cgi?id=28869" target="_blank">https://bugs.freedesktop.org/show_bug.cgi?id=28869</a><br>
And maybe some others which seem to look the same.<br>
<br>
If possible, this commit should go to stable as well.<br>
<br>
Signed-off-by: Marek Olšák &lt;<a href="mailto:maraeo@gmail.com">maraeo@gmail.com</a>&gt;<br>
---<br>
 drivers/gpu/drm/radeon/r100.c |   11 ++++++-----<br>
 1 files changed, 6 insertions(+), 5 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c<br>
index ec64b36..e151f16 100644<br>
--- a/drivers/gpu/drm/radeon/r100.c<br>
+++ b/drivers/gpu/drm/radeon/r100.c<br>
@@ -3297,13 +3297,14 @@ int r100_cs_track_check(struct radeon_device *rdev, struct r100_cs_track *track)<br>
        unsigned long size;<br>
        unsigned prim_walk;<br>
        unsigned nverts;<br>
+       unsigned num_cb = track-&gt;num_cb;<br>
<br>
-       for (i = 0; i &lt; track-&gt;num_cb; i++) {<br>
+       if (!track-&gt;zb_cb_clear &amp;&amp; !track-&gt;color_channel_mask &amp;&amp;<br>
+           !track-&gt;blend_read_enable)<br>
+               num_cb = 0;<br>
+<br>
+       for (i = 0; i &lt; num_cb; i++) {<br>
                if (track-&gt;cb[i].robj == NULL) {<br>
-                       if (!(track-&gt;zb_cb_clear || track-&gt;color_channel_mask ||<br>
-                             track-&gt;blend_read_enable)) {<br>
-                               continue;<br>
-                       }<br>
                        DRM_ERROR(&quot;[drm] No buffer for color buffer %d !\n&quot;, i);<br>
                        return -EINVAL;<br>
                }<br>
<font color="#888888">--<br>
1.7.0.4<br>
<br>
</font></blockquote></div><br>