mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-20 13:50:11 +01:00
mesa: gallium: make GL object maximum label length a pipescreen cap
Commit a4ffd2395f ("mesa: Implement label sharing from GL objects with
UM drivers") enabled GL clients to tag objects at a UM driver level. In
the case of Panfrost, and for both KMDs, maximum label size is set to
4096, but the Mesa limit is much lower.
Since glObjectLabel() allocates object labels dynamically, there's no
need to have this value chiseled in stone, so allow Gallium driver
implementers to set their own limit through a pipe screen capability.
Keep the same default maximum label length as before.
Signed-off-by: Adrián Larumbe <adrian.larumbe@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38027>
This commit is contained in:
parent
fa9ac826be
commit
a68c584d70
5 changed files with 11 additions and 8 deletions
|
|
@ -187,6 +187,8 @@ u_init_pipe_screen_caps(struct pipe_screen *pscreen, int accel)
|
|||
|
||||
caps->min_vma =
|
||||
caps->max_vma = 0;
|
||||
|
||||
caps->max_label_length = 256;
|
||||
}
|
||||
|
||||
uint64_t u_default_get_timestamp(UNUSED struct pipe_screen *screen)
|
||||
|
|
|
|||
|
|
@ -1126,6 +1126,7 @@ struct pipe_caps {
|
|||
unsigned shader_subgroup_supported_stages;
|
||||
unsigned shader_subgroup_supported_features;
|
||||
unsigned multiview;
|
||||
unsigned max_label_length;
|
||||
uint64_t max_timeline_semaphore_difference;
|
||||
|
||||
/** for CL SVM */
|
||||
|
|
|
|||
|
|
@ -242,7 +242,6 @@
|
|||
|
||||
/** For GL_KHR_debug */
|
||||
/*@{*/
|
||||
#define MAX_LABEL_LENGTH 256
|
||||
#define MAX_DEBUG_GROUP_STACK_DEPTH 64
|
||||
/*@}*/
|
||||
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ descriptor=[
|
|||
[ "DEBUG_NEXT_LOGGED_MESSAGE_LENGTH", "LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA" ],
|
||||
[ "MAX_DEBUG_LOGGED_MESSAGES", "CONST(MAX_DEBUG_LOGGED_MESSAGES), NO_EXTRA" ],
|
||||
[ "MAX_DEBUG_MESSAGE_LENGTH", "CONST(MAX_DEBUG_MESSAGE_LENGTH), NO_EXTRA" ],
|
||||
[ "MAX_LABEL_LENGTH", "CONST(MAX_LABEL_LENGTH), NO_EXTRA" ],
|
||||
[ "MAX_LABEL_LENGTH", "CAPS_UINT(max_label_length), NO_EXTRA" ],
|
||||
[ "MAX_DEBUG_GROUP_STACK_DEPTH", "CONST(MAX_DEBUG_GROUP_STACK_DEPTH), NO_EXTRA" ],
|
||||
[ "DEBUG_GROUP_STACK_DEPTH", "LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA" ],
|
||||
|
||||
|
|
|
|||
|
|
@ -125,6 +125,7 @@ static void
|
|||
set_label(struct gl_context *ctx, GLenum identifier, GLuint name, char **labelPtr,
|
||||
const char *label, int length, const char *caller, bool ext_length)
|
||||
{
|
||||
unsigned max_label_len = ctx->screen->caps.max_label_length;
|
||||
char *old_label = *labelPtr;
|
||||
*labelPtr = NULL;
|
||||
|
||||
|
|
@ -132,11 +133,11 @@ set_label(struct gl_context *ctx, GLenum identifier, GLuint name, char **labelPt
|
|||
if (label) {
|
||||
if ((!ext_length && length >= 0) ||
|
||||
(ext_length && length > 0)) {
|
||||
if (length >= MAX_LABEL_LENGTH)
|
||||
if (length >= max_label_len)
|
||||
_mesa_error(ctx, GL_INVALID_VALUE,
|
||||
"%s(length=%d, which is not less than "
|
||||
"GL_MAX_LABEL_LENGTH=%d)", caller, length,
|
||||
MAX_LABEL_LENGTH);
|
||||
"GL_MAX_LABEL_LENGTH=%u)", caller, length,
|
||||
max_label_len);
|
||||
|
||||
/* explicit length */
|
||||
*labelPtr = malloc(length+1);
|
||||
|
|
@ -157,11 +158,11 @@ set_label(struct gl_context *ctx, GLenum identifier, GLuint name, char **labelPt
|
|||
}
|
||||
|
||||
int len = strlen(label);
|
||||
if (len >= MAX_LABEL_LENGTH)
|
||||
if (len >= max_label_len)
|
||||
_mesa_error(ctx, GL_INVALID_VALUE,
|
||||
"%s(label length=%d, which is not less than "
|
||||
"GL_MAX_LABEL_LENGTH=%d)", caller, len,
|
||||
MAX_LABEL_LENGTH);
|
||||
"GL_MAX_LABEL_LENGTH=%u)", caller, len,
|
||||
max_label_len);
|
||||
|
||||
/* null-terminated string */
|
||||
*labelPtr = strdup(label);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue