mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-12 10:26:12 +00:00
gem_stress: optin to set num_buffers
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
parent
294c78f4ab
commit
130daf9cd0
@ -108,6 +108,7 @@ drm_intel_bo *busy_bo;
|
|||||||
|
|
||||||
static struct {
|
static struct {
|
||||||
unsigned scratch_buf_size;
|
unsigned scratch_buf_size;
|
||||||
|
unsigned num_buffers;
|
||||||
int no_hw;
|
int no_hw;
|
||||||
int gpu_busy_load;
|
int gpu_busy_load;
|
||||||
} options;
|
} options;
|
||||||
@ -565,14 +566,16 @@ static void parse_options(int argc, char **argv)
|
|||||||
static struct option long_options[] = {
|
static struct option long_options[] = {
|
||||||
{"no-hw", 0, 0, 'd'},
|
{"no-hw", 0, 0, 'd'},
|
||||||
{"buf-size", 1, 0, 's'},
|
{"buf-size", 1, 0, 's'},
|
||||||
{"gpu-busy-load", 1, 0, 'g'}
|
{"gpu-busy-load", 1, 0, 'g'},
|
||||||
|
{"buffer-count", 1, 0, 'c'}
|
||||||
};
|
};
|
||||||
|
|
||||||
options.scratch_buf_size = 256*4096;
|
options.scratch_buf_size = 256*4096;
|
||||||
options.no_hw = 0;
|
options.no_hw = 0;
|
||||||
options.gpu_busy_load = 0;
|
options.gpu_busy_load = 0;
|
||||||
|
options.num_buffers = 0;
|
||||||
|
|
||||||
while((c = getopt_long(argc, argv, "ns:g:",
|
while((c = getopt_long(argc, argv, "ns:g:c:",
|
||||||
long_options, &option_index)) != -1) {
|
long_options, &option_index)) != -1) {
|
||||||
switch(c) {
|
switch(c) {
|
||||||
case 'd':
|
case 'd':
|
||||||
@ -600,6 +603,10 @@ static void parse_options(int argc, char **argv)
|
|||||||
gpu_busy_load = options.gpu_busy_load = tmp;
|
gpu_busy_load = options.gpu_busy_load = tmp;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'c':
|
||||||
|
options.num_buffers = atoi(optarg);
|
||||||
|
printf("buffer count set to %i\n", options.num_buffers);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
printf("unkown command options\n");
|
printf("unkown command options\n");
|
||||||
break;
|
break;
|
||||||
@ -616,11 +623,14 @@ static void init(void)
|
|||||||
unsigned tmp;
|
unsigned tmp;
|
||||||
|
|
||||||
drm_fd = drm_open_any();
|
drm_fd = drm_open_any();
|
||||||
tmp = gem_aperture_size(drm_fd) / (1024*1024);;
|
if (options.num_buffers == 0) {
|
||||||
tmp = tmp > 256 ? 256 : tmp;
|
tmp = gem_aperture_size(drm_fd);
|
||||||
num_buffers = 2 * tmp / 3;
|
tmp = tmp > 256*(1024*1024) ? 256*(1024*1024) : tmp;
|
||||||
num_buffers /= 2;
|
num_buffers = 2 * tmp / options.scratch_buf_size / 3;
|
||||||
printf("Using %d 1MiB buffers\n", num_buffers);
|
num_buffers /= 2;
|
||||||
|
printf("using %u buffers\n", num_buffers);
|
||||||
|
} else
|
||||||
|
num_buffers = options.num_buffers;
|
||||||
|
|
||||||
bufmgr = drm_intel_bufmgr_gem_init(drm_fd, 4096);
|
bufmgr = drm_intel_bufmgr_gem_init(drm_fd, 4096);
|
||||||
drm_intel_bufmgr_gem_enable_reuse(bufmgr);
|
drm_intel_bufmgr_gem_enable_reuse(bufmgr);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user