[PATCH 2/2] drm/radeon/kms: fix the colorbuffer CS checker for r300-r500

Marek Olšák maraeo at gmail.com
Sun Sep 12 12:52:26 PDT 2010


Tested-by: Sven Arvidsson <sa at whiz.se>

Posted here:
https://bugs.freedesktop.org/show_bug.cgi?id=30036#c6

On Sun, Sep 12, 2010 at 5:09 AM, Marek Olšák <maraeo at gmail.com> wrote:

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


More information about the dri-devel mailing list