mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-04 20:38:06 +02:00
gallium/drivers/nouveau: Make use of ARRAY_SIZE macro
Signed-off-by: Edward O'Callaghan <eocallaghan@alterapraxis.com> Signed-off-by: Marek Olšák <marek.olsak@amd.com>
This commit is contained in:
parent
7e43a28079
commit
be51020f2a
14 changed files with 20 additions and 22 deletions
|
|
@ -155,7 +155,7 @@ nv30_transfer_rect_blit(XFER_ARGS)
|
|||
u32 format, stride;
|
||||
|
||||
if (nouveau_pushbuf_space(push, 512, 8, 0) ||
|
||||
nouveau_pushbuf_refn (push, refs, sizeof(refs) / sizeof(refs[0])))
|
||||
nouveau_pushbuf_refn (push, refs, ARRAY_SIZE(refs)))
|
||||
return;
|
||||
|
||||
/* various switches depending on cpp of the transfer */
|
||||
|
|
|
|||
|
|
@ -189,7 +189,7 @@ nv50_blend_state_create(struct pipe_context *pipe,
|
|||
SB_DATA (so, nv50_colormask(cso->rt[0].colormask));
|
||||
}
|
||||
|
||||
assert(so->size <= (sizeof(so->state) / sizeof(so->state[0])));
|
||||
assert(so->size <= ARRAY_SIZE(so->state));
|
||||
return so;
|
||||
}
|
||||
|
||||
|
|
@ -326,7 +326,7 @@ nv50_rasterizer_state_create(struct pipe_context *pipe,
|
|||
SB_BEGIN_3D(so, PIXEL_CENTER_INTEGER, 1);
|
||||
SB_DATA (so, !cso->half_pixel_center);
|
||||
|
||||
assert(so->size <= (sizeof(so->state) / sizeof(so->state[0])));
|
||||
assert(so->size <= ARRAY_SIZE(so->state));
|
||||
return (void *)so;
|
||||
}
|
||||
|
||||
|
|
@ -415,7 +415,7 @@ nv50_zsa_state_create(struct pipe_context *pipe,
|
|||
SB_DATA (so, 0);
|
||||
}
|
||||
|
||||
assert(so->size <= (sizeof(so->state) / sizeof(so->state[0])));
|
||||
assert(so->size <= ARRAY_SIZE(so->state));
|
||||
return (void *)so;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -508,7 +508,6 @@ static struct state_validate {
|
|||
{ nv50_vertex_arrays_validate, NV50_NEW_VERTEX | NV50_NEW_ARRAYS },
|
||||
{ nv50_validate_min_samples, NV50_NEW_MIN_SAMPLES },
|
||||
};
|
||||
#define validate_list_len (sizeof(validate_list) / sizeof(validate_list[0]))
|
||||
|
||||
bool
|
||||
nv50_state_validate(struct nv50_context *nv50, uint32_t mask, unsigned words)
|
||||
|
|
@ -523,7 +522,7 @@ nv50_state_validate(struct nv50_context *nv50, uint32_t mask, unsigned words)
|
|||
state_mask = nv50->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)
|
||||
|
|
|
|||
|
|
@ -200,7 +200,7 @@ nv84_decoder_bsp(struct nv84_decoder *dec,
|
|||
memcpy(dec->bitstream->map + 0x600, more_params, sizeof(more_params));
|
||||
|
||||
PUSH_SPACE(push, 5 + 21 + 3 + 2 + 4 + 2);
|
||||
nouveau_pushbuf_refn(push, bo_refs, sizeof(bo_refs)/sizeof(bo_refs[0]));
|
||||
nouveau_pushbuf_refn(push, bo_refs, ARRAY_SIZE(bo_refs));
|
||||
|
||||
/* Wait for the fence = 1 */
|
||||
BEGIN_NV04(push, SUBC_BSP(0x10), 4);
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ nv84_decoder_vp_h264(struct nv84_decoder *dec,
|
|||
{ dec->vp_params, NOUVEAU_BO_RDWR | NOUVEAU_BO_GART },
|
||||
{ dec->fence, NOUVEAU_BO_RDWR | NOUVEAU_BO_VRAM },
|
||||
};
|
||||
int num_refs = sizeof(bo_refs)/sizeof(*bo_refs);
|
||||
int num_refs = ARRAY_SIZE(bo_refs);
|
||||
bool is_ref = desc->is_reference;
|
||||
|
||||
STATIC_ASSERT(sizeof(struct h264_iparm1) == 0x218);
|
||||
|
|
@ -141,7 +141,7 @@ nv84_decoder_vp_h264(struct nv84_decoder *dec,
|
|||
{ bo1, NOUVEAU_BO_RDWR | NOUVEAU_BO_VRAM },
|
||||
{ bo2, NOUVEAU_BO_RDWR | NOUVEAU_BO_VRAM },
|
||||
};
|
||||
nouveau_pushbuf_refn(push, bo_refs, sizeof(bo_refs)/sizeof(bo_refs[0]));
|
||||
nouveau_pushbuf_refn(push, bo_refs, ARRAY_SIZE(bo_refs));
|
||||
}
|
||||
|
||||
memcpy(dec->vp_params->map, ¶m1, sizeof(param1));
|
||||
|
|
@ -490,7 +490,7 @@ nv84_decoder_vp_mpeg12(struct nv84_decoder *dec,
|
|||
{ NULL, NOUVEAU_BO_RDWR | NOUVEAU_BO_VRAM },
|
||||
{ dec->mpeg12_bo, NOUVEAU_BO_RDWR | NOUVEAU_BO_GART },
|
||||
};
|
||||
int i, num_refs = sizeof(bo_refs) / sizeof(*bo_refs);
|
||||
int i, num_refs = ARRAY_SIZE(bo_refs);
|
||||
struct mpeg12_header header = {0};
|
||||
struct nv50_miptree *y = nv50_miptree(dest->resources[0]);
|
||||
struct nv50_miptree *uv = nv50_miptree(dest->resources[1]);
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ nv98_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--;
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ nv98_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];
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ nv98_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;
|
||||
|
|
|
|||
|
|
@ -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]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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--;
|
||||
|
|
|
|||
|
|
@ -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];
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue