diff options
Diffstat (limited to 'radeondemo.c')
-rw-r--r-- | radeondemo.c | 73 |
1 files changed, 71 insertions, 2 deletions
diff --git a/radeondemo.c b/radeondemo.c index 6041f30..48a1bba 100644 --- a/radeondemo.c +++ b/radeondemo.c @@ -16,7 +16,7 @@ struct radeon _radeon_ctx; struct radeon *radeon = &_radeon_ctx; -int run_test(struct radeon *radeon) +int run_test1(struct radeon *radeon) { struct r600_accel_object test1 = {0}; int size, i; @@ -60,10 +60,77 @@ int run_test(struct radeon *radeon) radeon_bo_unmap(test1.bo); } +int run_test2(struct radeon *radeon) +{ + struct r600_accel_object test1 = {0}; + int size, i; + + test1.pitch = 1408; + test1.width = 1366; + test1.height = 768; + test1.bpp = 32; + test1.domain = RADEON_GEM_DOMAIN_GTT; + test1.tiling_flags = 0; + + size = test1.pitch*test1.height*(test1.bpp / 8); + test1.bo = radeon_bo_open(radeon->bufmgr, 0, size, 4096, RADEON_GEM_DOMAIN_GTT, 0); + if (!test1.bo) + return -1; + + radeon_bo_map(test1.bo, 1); + { + uint32_t *data = test1.bo->ptr; + data[0] = 0xdeadbeef; + } + radeon_bo_unmap(test1.bo); + + do_solid_fill_prepare(radeon, &test1, 0xffff0000); + evergreen_solid(radeon, 0, 0, test1.width, test1.height); + evergreen_finish_op(radeon, 8); + + radeon_cs_flush_indirect(radeon); + + radeon_bo_map(test1.bo, 0); + + { + uint32_t *data = test1.bo->ptr; + for (i = 0; i < 32; i++) { + fprintf(stderr,"%08x ", data[i]); + } + fprintf(stderr,"\n"); + +// fprintf(stderr,"bo1 %08x %08x\n", data[0], data[1]); + } + radeon_bo_unmap(test1.bo); +} + +bool is_accel_working(struct radeon *radeon) +{ +struct drm_radeon_info ginfo; + int r,tmp; + memset(&ginfo, 0, sizeof(ginfo)); + ginfo.request = RADEON_INFO_ACCEL_WORKING2; + r = drmCommandWriteRead(radeon->fd, DRM_RADEON_INFO, &ginfo, sizeof(ginfo)); + if (r) { + /* If kernel is too old before 2.6.32 than assume accel is working */ + if (r == -EINVAL) { + ErrorF("Kernel too old missing accel " + "information, assuming accel is working\n"); + return true; + } + return false; + } + if (tmp) + return true; + return false; + +} int radeon_init(struct radeon *radeon, int fd) { radeon->fd = fd; + is_accel_working(radeon); + { struct drm_radeon_gem_info mminfo; @@ -153,7 +220,9 @@ int main(int argc, char **argv) exit(-1); } - run_test(radeon); + run_test1(radeon); + + run_test2(radeon); radeon_fini(radeon); drmClose(drmFD); |