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 */
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;
}
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;
}
SB_DATA (so, 0);
}
- assert(so->size <= (sizeof(so->state) / sizeof(so->state[0])));
+ assert(so->size <= ARRAY_SIZE(so->state));
return (void *)so;
}
{ 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)
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)
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);
{ 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);
{ 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));
{ 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]);
#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--;
{ 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];
#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;
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]);
}
}
}
- assert(so->size <= (sizeof(so->state) / sizeof(so->state[0])));
+ assert(so->size <= ARRAY_SIZE(so->state));
return so;
}
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;
}
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;
}
{ 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)
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)
#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--;
{ 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];
#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;