From: Russell King <rmk+ker...@arm.linux.org.uk> Combine the event data into an array of etnaviv_event structures, rather than individual arrays.
Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk> --- drivers/staging/etnaviv/etnaviv_gpu.c | 18 +++++++++--------- drivers/staging/etnaviv/etnaviv_gpu.h | 8 ++++++-- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/drivers/staging/etnaviv/etnaviv_gpu.c b/drivers/staging/etnaviv/etnaviv_gpu.c index d06665aa319b..55a58cb27a3d 100644 --- a/drivers/staging/etnaviv/etnaviv_gpu.c +++ b/drivers/staging/etnaviv/etnaviv_gpu.c @@ -380,8 +380,8 @@ int etnaviv_gpu_init(struct etnaviv_gpu *gpu) /* Setup event management */ spin_lock_init(&gpu->event_spinlock); init_completion(&gpu->event_free); - for (i = 0; i < ARRAY_SIZE(gpu->event_used); i++) { - gpu->event_used[i] = false; + for (i = 0; i < ARRAY_SIZE(gpu->event); i++) { + gpu->event[i].used = false; complete(&gpu->event_free); } @@ -681,9 +681,9 @@ static unsigned int event_alloc(struct etnaviv_gpu *gpu) spin_lock_irqsave(&gpu->event_spinlock, flags); /* find first free event */ - for (i = 0; i < ARRAY_SIZE(gpu->event_used); i++) { - if (gpu->event_used[i] == false) { - gpu->event_used[i] = true; + for (i = 0; i < ARRAY_SIZE(gpu->event); i++) { + if (gpu->event[i].used == false) { + gpu->event[i].used = true; event = i; break; } @@ -700,11 +700,11 @@ static void event_free(struct etnaviv_gpu *gpu, unsigned int event) spin_lock_irqsave(&gpu->event_spinlock, flags); - if (gpu->event_used[event] == false) { + if (gpu->event[event].used == false) { dev_warn(gpu->dev->dev, "event %u is already marked as free", event); spin_unlock_irqrestore(&gpu->event_spinlock, flags); } else { - gpu->event_used[event] = false; + gpu->event[event].used = false; spin_unlock_irqrestore(&gpu->event_spinlock, flags); complete(&gpu->event_free); @@ -781,7 +781,7 @@ int etnaviv_gpu_submit(struct etnaviv_gpu *gpu, struct etnaviv_gem_submit *submi goto fail; } - gpu->event_to_fence[event] = submit->fence; + gpu->event[event].fence = submit->fence; etnaviv_buffer_queue(gpu, event, submit); @@ -833,7 +833,7 @@ static irqreturn_t irq_handler(int irq, void *data) else { uint8_t event = __fls(intr); dev_dbg(gpu->dev->dev, "event %u\n", event); - gpu->retired_fence = gpu->event_to_fence[event]; + gpu->retired_fence = gpu->event[event].fence; event_free(gpu, event); etnaviv_gpu_retire(gpu); } diff --git a/drivers/staging/etnaviv/etnaviv_gpu.h b/drivers/staging/etnaviv/etnaviv_gpu.h index 707096b5fe98..519b9344ed0c 100644 --- a/drivers/staging/etnaviv/etnaviv_gpu.h +++ b/drivers/staging/etnaviv/etnaviv_gpu.h @@ -78,6 +78,11 @@ struct etnaviv_chip_identity { uint32_t buffer_size; }; +struct etnaviv_event { + bool used; + uint32_t fence; +}; + struct etnaviv_gpu { const char *name; struct drm_device *dev; @@ -88,8 +93,7 @@ struct etnaviv_gpu { struct drm_gem_object *buffer; /* event management: */ - bool event_used[30]; - uint32_t event_to_fence[30]; + struct etnaviv_event event[30]; struct completion event_free; struct spinlock event_spinlock; -- 2.1.4