Attempt to fix the issue reported by Alan Grimes with DRM_RADEON_TEXTURE
authorEric Anholt <anholt@FreeBSD.org>
Thu, 25 Aug 2005 03:38:07 +0000 (03:38 +0000)
committerEric Anholt <anholt@FreeBSD.org>
Thu, 25 Aug 2005 03:38:07 +0000 (03:38 +0000)
erroring out when it shouldn't.  The errno could be changed by usleep() between
the ioctl call and the loop check, if a signal was received.  This could cause
an EAGAIN return from the DRM_RADEON_TEXTURE ioctl to not loop again.
Instead of checking errno, check thevalue of ret itself, since it is a saved
(and sign-flipped) copy of errno from the ioctl call.

src/mesa/drivers/dri/r200/r200_texmem.c
src/mesa/drivers/dri/r300/r300_texmem.c
src/mesa/drivers/dri/radeon/radeon_texmem.c

index 7472afeedd7888e46bfaed2d4bc8fedfd3010a58..14ee8238ad86d487a9e06952b45caadd1ae5c845 100644 (file)
@@ -427,7 +427,7 @@ static void uploadSubImage( r200ContextPtr rmesa, r200TexObjPtr t,
            fprintf(stderr, "DRM_RADEON_TEXTURE:  again!\n");
         usleep(1);
       }
-   } while ( ret && errno == EAGAIN );
+   } while ( ret == -EAGAIN );
 
    UNLOCK_HARDWARE( rmesa );
 
index 5c70e2e3c5401259788622be063952b61274f326..ca392762ad4422bd2602ed4129de024f6e12ced9 100644 (file)
@@ -417,7 +417,7 @@ static void uploadSubImage(r300ContextPtr rmesa, r300TexObjPtr t,
                                        "DRM_RADEON_TEXTURE:  again!\n");
                        usleep(1);
                }
-       } while (ret && errno == EAGAIN);
+       } while (ret == -EAGAIN);
 
        UNLOCK_HARDWARE(&rmesa->radeon);
 
index d492e190c12c5c53795cd92461e28dee059d0474..3943afcde0bdf694864316a54cfb725879bd3c3c 100644 (file)
@@ -304,7 +304,7 @@ static void uploadSubImage( radeonContextPtr rmesa, radeonTexObjPtr t,
    do {
       ret = drmCommandWriteRead( rmesa->dri.fd, DRM_RADEON_TEXTURE,
                                  &tex, sizeof(drm_radeon_texture_t) );
-   } while ( ret && errno == EAGAIN );
+   } while ( ret == -EAGAIN );
 
    UNLOCK_HARDWARE( rmesa );