mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-13 02:46:23 +00:00
tests/gem_partial_pwrite_pread: refactor subtests into functions
This was a too big mess. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
parent
af228d4edc
commit
1a55ca753e
@ -103,27 +103,11 @@ blt_bo_fill(drm_intel_bo *tmp_bo, drm_intel_bo *bo, int val)
|
|||||||
|
|
||||||
#define MAX_BLT_SIZE 128
|
#define MAX_BLT_SIZE 128
|
||||||
#define ROUNDS 1000
|
#define ROUNDS 1000
|
||||||
int main(int argc, char **argv)
|
uint8_t tmp[BO_SIZE];
|
||||||
|
|
||||||
|
static void test_partial_reads(void)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
uint8_t tmp[BO_SIZE];
|
|
||||||
uint8_t *gtt_ptr;
|
|
||||||
|
|
||||||
srandom(0xdeadbeef);
|
|
||||||
|
|
||||||
fd = drm_open_any();
|
|
||||||
|
|
||||||
bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
|
|
||||||
//drm_intel_bufmgr_gem_enable_reuse(bufmgr);
|
|
||||||
devid = intel_get_drm_devid(fd);
|
|
||||||
batch = intel_batchbuffer_alloc(bufmgr, devid);
|
|
||||||
|
|
||||||
/* overallocate the buffers we're actually using because */
|
|
||||||
scratch_bo = drm_intel_bo_alloc(bufmgr, "scratch bo", BO_SIZE, 4096);
|
|
||||||
staging_bo = drm_intel_bo_alloc(bufmgr, "staging bo", BO_SIZE, 4096);
|
|
||||||
|
|
||||||
drmtest_init_aperture_trashers(bufmgr);
|
|
||||||
mappable_gtt_limit = gem_mappable_aperture_size();
|
|
||||||
|
|
||||||
printf("checking partial reads\n");
|
printf("checking partial reads\n");
|
||||||
for (i = 0; i < ROUNDS; i++) {
|
for (i = 0; i < ROUNDS; i++) {
|
||||||
@ -147,6 +131,13 @@ int main(int argc, char **argv)
|
|||||||
drmtest_progress("partial reads test: ", i, ROUNDS);
|
drmtest_progress("partial reads test: ", i, ROUNDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static void test_partial_writes(void)
|
||||||
|
{
|
||||||
|
int i, j;
|
||||||
|
uint8_t *gtt_ptr;
|
||||||
|
|
||||||
printf("checking partial writes\n");
|
printf("checking partial writes\n");
|
||||||
for (i = 0; i < ROUNDS; i++) {
|
for (i = 0; i < ROUNDS; i++) {
|
||||||
int start, len;
|
int start, len;
|
||||||
@ -191,6 +182,13 @@ int main(int argc, char **argv)
|
|||||||
drmtest_progress("partial writes test: ", i, ROUNDS);
|
drmtest_progress("partial writes test: ", i, ROUNDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static void test_partial_read_writes(void)
|
||||||
|
{
|
||||||
|
int i, j;
|
||||||
|
uint8_t *gtt_ptr;
|
||||||
|
|
||||||
printf("checking partial writes after partial reads\n");
|
printf("checking partial writes after partial reads\n");
|
||||||
for (i = 0; i < ROUNDS; i++) {
|
for (i = 0; i < ROUNDS; i++) {
|
||||||
int start, len;
|
int start, len;
|
||||||
@ -253,6 +251,31 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
drmtest_progress("partial read/writes test: ", i, ROUNDS);
|
drmtest_progress("partial read/writes test: ", i, ROUNDS);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
srandom(0xdeadbeef);
|
||||||
|
|
||||||
|
fd = drm_open_any();
|
||||||
|
|
||||||
|
bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
|
||||||
|
//drm_intel_bufmgr_gem_enable_reuse(bufmgr);
|
||||||
|
devid = intel_get_drm_devid(fd);
|
||||||
|
batch = intel_batchbuffer_alloc(bufmgr, devid);
|
||||||
|
|
||||||
|
/* overallocate the buffers we're actually using because */
|
||||||
|
scratch_bo = drm_intel_bo_alloc(bufmgr, "scratch bo", BO_SIZE, 4096);
|
||||||
|
staging_bo = drm_intel_bo_alloc(bufmgr, "staging bo", BO_SIZE, 4096);
|
||||||
|
|
||||||
|
drmtest_init_aperture_trashers(bufmgr);
|
||||||
|
mappable_gtt_limit = gem_mappable_aperture_size();
|
||||||
|
|
||||||
|
test_partial_reads();
|
||||||
|
|
||||||
|
test_partial_writes();
|
||||||
|
|
||||||
|
test_partial_read_writes();
|
||||||
|
|
||||||
drmtest_cleanup_aperture_trashers();
|
drmtest_cleanup_aperture_trashers();
|
||||||
drm_intel_bufmgr_destroy(bufmgr);
|
drm_intel_bufmgr_destroy(bufmgr);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user