diff options
author | Edward O'Callaghan <[email protected]> | 2015-12-04 15:27:18 +1100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2015-12-06 17:03:17 +0100 |
commit | be51020f2ad2ce8e8dc4d0f3a79186000fb01454 (patch) | |
tree | 5404db5712d9284eaf0e96bda9d90fad42ef46a1 /src/gallium/drivers/nouveau/nvc0 | |
parent | 7e43a280793af50e826fb6183670de8e3d427d74 (diff) |
gallium/drivers/nouveau: Make use of ARRAY_SIZE macro
Signed-off-by: Edward O'Callaghan <[email protected]>
Signed-off-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium/drivers/nouveau/nvc0')
6 files changed, 8 insertions, 9 deletions
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_program.c b/src/gallium/drivers/nouveau/nvc0/nvc0_program.c index 43d7c7b1123..67a25acf778 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_program.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_program.c @@ -502,7 +502,7 @@ nvc0_program_dump(struct nvc0_program *prog) unsigned pos; if (prog->type != PIPE_SHADER_COMPUTE) { - for (pos = 0; pos < sizeof(prog->hdr) / sizeof(prog->hdr[0]); ++pos) + for (pos = 0; pos < ARRAY_SIZE(prog->hdr); ++pos) debug_printf("HDR[%02"PRIxPTR"] = 0x%08x\n", pos * sizeof(prog->hdr[0]), prog->hdr[pos]); } diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_state.c b/src/gallium/drivers/nouveau/nvc0/nvc0_state.c index 5dce5f0e65d..5da0ea81a27 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_state.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_state.c @@ -176,7 +176,7 @@ nvc0_blend_state_create(struct pipe_context *pipe, } } - assert(so->size <= (sizeof(so->state) / sizeof(so->state[0]))); + assert(so->size <= ARRAY_SIZE(so->state)); return so; } @@ -305,7 +305,7 @@ nvc0_rasterizer_state_create(struct pipe_context *pipe, SB_IMMED_3D(so, PIXEL_CENTER_INTEGER, !cso->half_pixel_center); - assert(so->size <= (sizeof(so->state) / sizeof(so->state[0]))); + assert(so->size <= ARRAY_SIZE(so->state)); return (void *)so; } @@ -383,7 +383,7 @@ nvc0_zsa_state_create(struct pipe_context *pipe, SB_DATA (so, nvgl_comparison_op(cso->alpha.func)); } - assert(so->size <= (sizeof(so->state) / sizeof(so->state[0]))); + assert(so->size <= ARRAY_SIZE(so->state)); return (void *)so; } diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c b/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c index 205e7dc6ae9..b02a590c375 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c @@ -667,7 +667,6 @@ static struct state_validate { { nvc0_tfb_validate, NVC0_NEW_TFB_TARGETS | NVC0_NEW_GMTYPROG }, { nvc0_validate_min_samples, NVC0_NEW_MIN_SAMPLES }, }; -#define validate_list_len (sizeof(validate_list) / sizeof(validate_list[0])) bool nvc0_state_validate(struct nvc0_context *nvc0, uint32_t mask, unsigned words) @@ -682,7 +681,7 @@ nvc0_state_validate(struct nvc0_context *nvc0, uint32_t mask, unsigned words) state_mask = nvc0->dirty & mask; if (state_mask) { - for (i = 0; i < validate_list_len; ++i) { + for (i = 0; i < ARRAY_SIZE(validate_list); ++i) { struct state_validate *validate = &validate_list[i]; if (state_mask & validate->states) diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_video_bsp.c b/src/gallium/drivers/nouveau/nvc0/nvc0_video_bsp.c index 9139bc1c911..4392f62c530 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_video_bsp.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_video_bsp.c @@ -56,7 +56,7 @@ nvc0_decoder_bsp(struct nouveau_vp3_decoder *dec, union pipe_desc desc, #endif { dec->bitplane_bo, NOUVEAU_BO_RDWR | NOUVEAU_BO_VRAM }, }; - int num_refs = sizeof(bo_refs)/sizeof(*bo_refs); + int num_refs = ARRAY_SIZE(bo_refs); if (!dec->bitplane_bo) num_refs--; diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_video_ppp.c b/src/gallium/drivers/nouveau/nvc0/nvc0_video_ppp.c index 4ceec4fbffc..e4504e6c411 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_video_ppp.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_video_ppp.c @@ -40,7 +40,7 @@ nvc0_decoder_setup_ppp(struct nouveau_vp3_decoder *dec, struct nouveau_vp3_video { dec->fence_bo, NOUVEAU_BO_WR | NOUVEAU_BO_GART }, #endif }; - unsigned num_refs = sizeof(bo_refs)/sizeof(*bo_refs); + unsigned num_refs = ARRAY_SIZE(bo_refs); for (i = 0; i < 2; ++i) { struct nv50_miptree *mt = (struct nv50_miptree *)target->resources[i]; diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_video_vp.c b/src/gallium/drivers/nouveau/nvc0/nvc0_video_vp.c index 91543782dfc..73d55148151 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_video_vp.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_video_vp.c @@ -86,7 +86,7 @@ nvc0_decoder_vp(struct nouveau_vp3_decoder *dec, union pipe_desc desc, #endif { dec->fw_bo, NOUVEAU_BO_RD | NOUVEAU_BO_VRAM }, }; - int num_refs = sizeof(bo_refs)/sizeof(*bo_refs) - !dec->fw_bo; + int num_refs = ARRAY_SIZE(bo_refs) - !dec->fw_bo; #if NOUVEAU_VP3_DEBUG_FENCE fence_extra = 4; |