diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2009-12-02 14:12:19 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2009-12-02 14:12:19 +0000 |
commit | b68d3646f1fdfe012c16741958c7a62136a9b5aa (patch) | |
tree | 25f0ad8411db93fc36efabef39cdc9450041eb0b /src | |
parent | 0ff4d42a42b9e537b083343ee7dcc41cb41ae7cf (diff) |
Review use of errno after libdrm call
Since drm may not actually set the appropriate errno after a failure, we
must use the return code instead when determining the cause of failure.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src')
-rw-r--r-- | src/i830_accel.c | 2 | ||||
-rw-r--r-- | src/i830_batchbuffer.c | 7 | ||||
-rw-r--r-- | src/i830_dri.c | 1 | ||||
-rw-r--r-- | src/i830_memory.c | 3 | ||||
-rw-r--r-- | src/i830_uxa.c | 15 | ||||
-rw-r--r-- | src/i965_hwmc.c | 1 |
6 files changed, 14 insertions, 15 deletions
diff --git a/src/i830_accel.c b/src/i830_accel.c index 26228376..4302eca0 100644 --- a/src/i830_accel.c +++ b/src/i830_accel.c @@ -40,8 +40,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "config.h" #endif -#include <errno.h> - #include "xf86.h" #include "i830.h" #include "i810_reg.h" diff --git a/src/i830_batchbuffer.c b/src/i830_batchbuffer.c index 0c755d62..e1537aec 100644 --- a/src/i830_batchbuffer.c +++ b/src/i830_batchbuffer.c @@ -32,7 +32,6 @@ #include <assert.h> #include <stdlib.h> -#include <errno.h> #include "xf86.h" #include "i830.h" @@ -44,6 +43,7 @@ static void intel_next_batch(ScrnInfoPtr scrn) { intel_screen_private *intel = intel_get_screen_private(scrn); + int ret; /* The 865 has issues with larger-than-page-sized batch buffers. */ if (IS_I865G(intel)) @@ -53,8 +53,9 @@ static void intel_next_batch(ScrnInfoPtr scrn) intel->batch_bo = dri_bo_alloc(intel->bufmgr, "batch", 4096 * 4, 4096); - if (dri_bo_map(intel->batch_bo, 1) != 0) - FatalError("Failed to map batchbuffer: %s\n", strerror(errno)); + ret = dri_bo_map(intel->batch_bo, 1); + if (ret != 0) + FatalError("Failed to map batchbuffer: %s\n", strerror(-ret)); intel->batch_used = 0; intel->batch_ptr = intel->batch_bo->virtual; diff --git a/src/i830_dri.c b/src/i830_dri.c index 440748bc..a9eed5bd 100644 --- a/src/i830_dri.c +++ b/src/i830_dri.c @@ -42,7 +42,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include <sys/types.h> #include <sys/stat.h> #include <sys/ioctl.h> -#include <errno.h> #include <unistd.h> #include <fcntl.h> diff --git a/src/i830_memory.c b/src/i830_memory.c index ea4922ae..7abea723 100644 --- a/src/i830_memory.c +++ b/src/i830_memory.c @@ -77,7 +77,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include <assert.h> #include <inttypes.h> #include <string.h> -#include <errno.h> #include <sys/types.h> #include <sys/ioctl.h> @@ -366,7 +365,7 @@ i830_memory *i830_allocate_memory(ScrnInfoPtr scrn, const char *name, if (ret != 0 || tiling_mode != requested_tiling_mode) { xf86DrvMsg(scrn->scrnIndex, X_ERROR, "Failed to set tiling on %s: %s\n", mem->name, - ret == 0 ? "rejected by kernel" : strerror(errno)); + ret == 0 ? "rejected by kernel" : strerror(-ret)); } mem->tiling_mode = tiling_mode; diff --git a/src/i830_uxa.c b/src/i830_uxa.c index 875833ba..2227c58a 100644 --- a/src/i830_uxa.c +++ b/src/i830_uxa.c @@ -569,6 +569,7 @@ static Bool i830_uxa_prepare_access(PixmapPtr pixmap, uxa_access_t access) intel_screen_private *intel = intel_get_screen_private(scrn); struct intel_pixmap *priv = i830_get_pixmap_intel(pixmap); dri_bo *bo = priv->bo; + int ret; if (!list_is_empty(&priv->batch) && (access == UXA_ACCESS_RW || priv->batch_write_domain)) @@ -576,19 +577,21 @@ static Bool i830_uxa_prepare_access(PixmapPtr pixmap, uxa_access_t access) /* No VT sema or GEM? No GTT mapping. */ if (!scrn->vtSema || bo->size > intel->max_gtt_map_size) { - if (dri_bo_map(bo, access == UXA_ACCESS_RW) != 0) { + ret = dri_bo_map(bo, access == UXA_ACCESS_RW); + if (ret != 0) { xf86DrvMsg(scrn->scrnIndex, X_WARNING, - "%s: bo map failed: %d [%s]\n", + "%s: bo map failed: %s\n", __FUNCTION__, - errno, strerror(errno)); + strerror(-ret)); return FALSE; } } else { - if (drm_intel_gem_bo_map_gtt(bo)) { + ret = drm_intel_gem_bo_map_gtt(bo); + if (ret != 0) { xf86DrvMsg(scrn->scrnIndex, X_WARNING, - "%s: gtt bo map failed: %d [%s]\n", + "%s: gtt bo map failed: %s\n", __FUNCTION__, - errno, strerror(errno)); + strerror(-ret)); return FALSE; } } diff --git a/src/i965_hwmc.c b/src/i965_hwmc.c index 3fe4f413..5b24f3be 100644 --- a/src/i965_hwmc.c +++ b/src/i965_hwmc.c @@ -31,7 +31,6 @@ #include <X11/extensions/Xv.h> #include <X11/extensions/XvMC.h> #include <fourcc.h> -#include <errno.h> #include "i830.h" #include "i830_dri.h" |