[Mesa-dev] [PATCH] mesa: Fix FB blitting in case of zero size src or dst rect

Paul Berry stereotype441 at gmail.com
Fri Mar 8 08:02:47 PST 2013


On 7 March 2013 14:15, Anuj Phogat <anuj.phogat at gmail.com> wrote:

> Framebuffer blitting operation should be skipped if any of the
> dimensions (width/height) of src/dst rect are zero.
>
> Fixes: fbblit(negative.nullblit.zeroSize) in Intel oglconform
> https://bugs.freedesktop.org/show_bug.cgi?id=59495
>
> Note: Candidate for all the stable branches.
>
> Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
> ---
>  src/mesa/main/fbobject.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
> index d6acc58..58a2d0b 100644
> --- a/src/mesa/main/fbobject.c
> +++ b/src/mesa/main/fbobject.c
> @@ -2876,7 +2876,9 @@ _mesa_BlitFramebuffer(GLint srcX0, GLint srcY0,
> GLint srcX1, GLint srcY1,
>     readFb = ctx->ReadBuffer;
>     drawFb = ctx->DrawBuffer;
>
> -   if (!readFb || !drawFb) {
> +   if (!readFb || !drawFb ||
> +       (srcX1 - srcX0) == 0 || (srcY1 - srcY0) == 0 ||
> +       (dstX1 - dstX0) == 0 || (dstY1 - dstY0) == 0) {
>        /* This will normally never happen but someday we may want to
>         * support MakeCurrent() with no drawables.
>         */
>

This seems too early.  All of the error checking (which appears below this
check) should still occur if the src/dst dimensions are zero.  We should
add the check to this conditional instead (near the end of the function, at
line 3193):

   if (!mask) {
      return;
   }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20130308/7bf9b1b6/attachment.html>


More information about the mesa-dev mailing list