broadcom: move HW-dependant constants to v3d_device_info

Right now we have some HW-dependant constants that we are accessing
using the same mechanism that some hw-dependant functions, through a
macro (V3DV_X macro).

But this means that each time that we need to get those constant
values, we need to do a hw version check. Also, right now both the
macro and the defines with each HW value are duplicated on v3d and
v3dv. Also that macro is ugly and has a ugly name.

This commit moves those values to the already common v3d_device_info
structure.

Reviewed-by: Jose Maria Casanova Crespo <jmcasanova@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29535>
This commit is contained in:
Alejandro Piñeiro
2024-06-04 10:01:58 +02:00
committed by Marge Bot
parent b0f3923d8a
commit 5eee101477
9 changed files with 44 additions and 89 deletions
+16 -9
View File
@@ -71,15 +71,22 @@ v3d_get_device_info(int fd, struct v3d_device_info* devinfo, v3d_ioctl_fun drm_i
devinfo->has_accumulators = devinfo->ver < 71;
switch (devinfo->ver) {
case 42:
case 71:
break;
default:
fprintf(stderr,
"V3D %d.%d not supported by this version of Mesa.\n",
devinfo->ver / 10,
devinfo->ver % 10);
return false;
case 42:
devinfo->clipper_xy_granularity = 256.0f;
devinfo->cle_readahead = 256u;
devinfo->cle_buffer_min_size = 4096u;
break;
case 71:
devinfo->clipper_xy_granularity = 64.0f;
devinfo->cle_readahead = 1024u;
devinfo->cle_buffer_min_size = 16384u;
break;
default:
fprintf(stderr,
"V3D %d.%d not supported by this version of Mesa.\n",
devinfo->ver / 10,
devinfo->ver % 10);
return false;
}
ret = drm_ioctl(fd, DRM_IOCTL_V3D_GET_PARAM, &hub_ident3);
+14
View File
@@ -51,6 +51,20 @@ struct v3d_device_info {
/** If the hw has accumulator registers */
bool has_accumulators;
/** Granularity for the Clipper XY Scaling */
float clipper_xy_granularity;
/** The Control List Executor (CLE) pre-fetches V3D_CLE_READAHEAD
* bytes from the Control List buffer. The usage of these last bytes
* should be avoided or the CLE would pre-fetch the data after the
* end of the CL buffer, reporting the kernel "MMU error from client
* CLE".
*/
uint32_t cle_readahead;
/** Minimum size for a buffer storing the Control List Executor (CLE) */
uint32_t cle_buffer_min_size;
};
typedef int (*v3d_ioctl_fun)(int fd, unsigned long request, void *arg);