OSDN Git Service

radeon: fix 32/64 bit issue with sign extension
authorDave Airlie <airlied@linux.ie>
Mon, 14 Sep 2009 21:29:02 +0000 (07:29 +1000)
committerDave Airlie <airlied@linux.ie>
Mon, 14 Sep 2009 21:30:22 +0000 (07:30 +1000)
Not sure what intptr_t was up to here.

Reported and tested by: Kevin DeKorte
Signed-off-by: Dave Airlie <airlied@redhat.com>
libdrm/radeon/radeon_cs_gem.c

index a0db53b..e42ec48 100644 (file)
@@ -100,10 +100,10 @@ static struct radeon_cs *cs_gem_create(struct radeon_cs_manager *csm,
     }
     csg->chunks[0].chunk_id = RADEON_CHUNK_ID_IB;
     csg->chunks[0].length_dw = 0;
-    csg->chunks[0].chunk_data = (uint64_t)(intptr_t)csg->base.packets;
+    csg->chunks[0].chunk_data = (uint64_t)(uintptr_t)csg->base.packets;
     csg->chunks[1].chunk_id = RADEON_CHUNK_ID_RELOCS;
     csg->chunks[1].length_dw = 0;
-    csg->chunks[1].chunk_data = (uint64_t)(intptr_t)csg->relocs;
+    csg->chunks[1].chunk_data = (uint64_t)(uintptr_t)csg->relocs;
     return (struct radeon_cs*)csg;
 }
 
@@ -184,7 +184,7 @@ static int cs_gem_write_reloc(struct radeon_cs *cs,
         }
         cs->relocs = csg->relocs = tmp;
         csg->nrelocs += 1;
-        csg->chunks[1].chunk_data = (uint64_t)(intptr_t)csg->relocs;
+        csg->chunks[1].chunk_data = (uint64_t)(uintptr_t)csg->relocs;
     }
     csg->relocs_bo[csg->base.crelocs] = bo;
     idx = (csg->base.crelocs++) * RELOC_SIZE;
@@ -269,11 +269,11 @@ static int cs_gem_emit(struct radeon_cs *cs)
 
     csg->chunks[0].length_dw = cs->cdw;
 
-    chunk_array[0] = (uint64_t)(intptr_t)&csg->chunks[0];
-    chunk_array[1] = (uint64_t)(intptr_t)&csg->chunks[1];
+    chunk_array[0] = (uint64_t)(uintptr_t)&csg->chunks[0];
+    chunk_array[1] = (uint64_t)(uintptr_t)&csg->chunks[1];
 
     csg->cs.num_chunks = 2;
-    csg->cs.chunks = (uint64_t)(intptr_t)chunk_array;
+    csg->cs.chunks = (uint64_t)(uintptr_t)chunk_array;
 
     r = drmCommandWriteRead(cs->csm->fd, DRM_RADEON_CS,
                             &csg->cs, sizeof(struct drm_radeon_cs));