On Wed, Jun 7, 2017 at 10:12 PM, Ilia Mirkin <imir...@alum.mit.edu> wrote: > This creates string lifetime issues... should probably document that > the pointer returned by get_vendor and get_name are supposed to last > for the lifetime of the screen.
Was the lifetime of the string not always guaranteed? Most drivers use a statically-declared string or a literal string. I think the lifetime has always been at least the same as the lifetime of pipe_screen. Marek > > On Wed, Jun 7, 2017 at 4:09 PM, Marek Olšák <mar...@gmail.com> wrote: >> From: Marek Olšák <marek.ol...@amd.com> >> >> --- >> src/mesa/state_tracker/st_cb_strings.c | 4 +--- >> src/mesa/state_tracker/st_context.h | 2 -- >> 2 files changed, 1 insertion(+), 5 deletions(-) >> >> diff --git a/src/mesa/state_tracker/st_cb_strings.c >> b/src/mesa/state_tracker/st_cb_strings.c >> index 99d93a7..85fe5a7 100644 >> --- a/src/mesa/state_tracker/st_cb_strings.c >> +++ b/src/mesa/state_tracker/st_cb_strings.c >> @@ -40,23 +40,21 @@ >> #include "st_cb_strings.h" >> >> static const GLubyte * >> st_get_string(struct gl_context * ctx, GLenum name) >> { >> struct st_context *st = st_context(ctx); >> struct pipe_screen *screen = st->pipe->screen; >> >> switch (name) { >> case GL_VENDOR: { >> - const char *vendor = screen->get_vendor( screen ); >> - util_snprintf(st->vendor, sizeof(st->vendor), "%s", vendor); >> - return (GLubyte *) st->vendor; >> + return (GLubyte *) screen->get_vendor(screen); >> } >> >> case GL_RENDERER: >> return (GLubyte *) screen->get_name(screen); >> >> default: >> return NULL; >> } >> } >> >> diff --git a/src/mesa/state_tracker/st_context.h >> b/src/mesa/state_tracker/st_context.h >> index 1756e57..6ca7ddb 100644 >> --- a/src/mesa/state_tracker/st_context.h >> +++ b/src/mesa/state_tracker/st_context.h >> @@ -150,22 +150,20 @@ struct st_context >> boolean include; >> struct pipe_scissor_state rects[PIPE_MAX_WINDOW_RECTANGLES]; >> } window_rects; >> unsigned sample_mask; >> >> GLuint poly_stipple[32]; /**< In OpenGL's bottom-to-top order */ >> >> GLuint fb_orientation; >> } state; >> >> - char vendor[100]; >> - >> uint64_t dirty; /**< dirty states */ >> >> /** This masks out unused shader resources. Only valid in draw calls. */ >> uint64_t active_states; >> >> /* If true, further analysis of states is required to know if something >> * has changed. Used mainly for shaders. >> */ >> bool gfx_shaders_may_be_dirty; >> bool compute_shader_may_be_dirty; >> -- >> 2.7.4 >> >> _______________________________________________ >> mesa-dev mailing list >> mesa-dev@lists.freedesktop.org >> https://lists.freedesktop.org/mailman/listinfo/mesa-dev _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev