pvr: de-dup strncmp in pvrsrvkm winsys

Signed-off-by: Luigi Santivetti <luigi.santivetti@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41236>
This commit is contained in:
Luigi Santivetti 2026-04-27 14:28:42 +01:00 committed by Marge Bot
parent 443c259630
commit 20b42f4466

View file

@ -251,39 +251,40 @@ static VkResult pvr_srv_memctx_init(struct pvr_srv_winsys *srv_ws)
if (result != VK_SUCCESS)
goto err_pvr_srv_int_ctx_destroy;
if (general_heap_idx == -1 &&
strncmp(heap_name,
PVR_SRV_GENERAL_HEAP_IDENT,
sizeof(PVR_SRV_GENERAL_HEAP_IDENT)) == 0) {
#define pvr_srv_heap_needs_init(heap_index, name1, name2) \
((heap_index) == -1 && \
strncmp((name1), \
(name2), \
sizeof((name2))) == 0)
if (pvr_srv_heap_needs_init(general_heap_idx, heap_name,
PVR_SRV_GENERAL_HEAP_IDENT)) {
general_heap_idx = i;
} else if (pds_heap_idx == -1 &&
strncmp(heap_name,
PVR_SRV_PDSCODEDATA_HEAP_IDENT,
sizeof(PVR_SRV_PDSCODEDATA_HEAP_IDENT)) == 0) {
} else if (pvr_srv_heap_needs_init(pds_heap_idx, heap_name,
PVR_SRV_PDSCODEDATA_HEAP_IDENT)) {
pds_heap_idx = i;
} else if (rgn_hdr_heap_idx == -1 &&
strncmp(heap_name,
PVR_SRV_RGNHDR_BRN_63142_HEAP_IDENT,
sizeof(PVR_SRV_RGNHDR_BRN_63142_HEAP_IDENT)) == 0) {
} else if (pvr_srv_heap_needs_init(rgn_hdr_heap_idx, heap_name,
PVR_SRV_RGNHDR_BRN_63142_HEAP_IDENT)) {
rgn_hdr_heap_idx = i;
} else if (transfer_3d_heap_idx == -1 &&
strncmp(heap_name,
PVR_SRV_TRANSFER_3D_HEAP_IDENT,
sizeof(PVR_SRV_TRANSFER_3D_HEAP_IDENT)) == 0) {
} else if (pvr_srv_heap_needs_init(transfer_3d_heap_idx, heap_name,
PVR_SRV_TRANSFER_3D_HEAP_IDENT)) {
transfer_3d_heap_idx = i;
} else if (usc_heap_idx == -1 &&
strncmp(heap_name,
PVR_SRV_USCCODE_HEAP_IDENT,
sizeof(PVR_SRV_USCCODE_HEAP_IDENT)) == 0) {
} else if (pvr_srv_heap_needs_init(usc_heap_idx, heap_name,
PVR_SRV_USCCODE_HEAP_IDENT)) {
usc_heap_idx = i;
} else if (vis_test_heap_idx == -1 &&
strncmp(heap_name,
PVR_SRV_VISIBILITY_TEST_HEAP_IDENT,
sizeof(PVR_SRV_VISIBILITY_TEST_HEAP_IDENT)) == 0) {
} else if (pvr_srv_heap_needs_init(vis_test_heap_idx, heap_name,
PVR_SRV_VISIBILITY_TEST_HEAP_IDENT)) {
vis_test_heap_idx = i;
}
}
#undef pvr_srv_heap_needs_init
/* Check for and initialise required heaps. */
if (general_heap_idx == -1 || pds_heap_idx == -1 ||
transfer_3d_heap_idx == -1 || usc_heap_idx == -1 ||