From d4af7d25198ecfaac65fb58cd76da0640b042936 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 10 Dec 2021 11:06:29 +1000 Subject: [PATCH] mesa/st: move st strings handling into mesa Reviewed-by: Emma Anholt Part-of: --- src/mesa/main/getstring.c | 25 ++++++----- src/mesa/meson.build | 2 - src/mesa/state_tracker/st_cb_strings.c | 60 -------------------------- src/mesa/state_tracker/st_cb_strings.h | 35 --------------- 4 files changed, 14 insertions(+), 108 deletions(-) delete mode 100644 src/mesa/state_tracker/st_cb_strings.c delete mode 100644 src/mesa/state_tracker/st_cb_strings.h diff --git a/src/mesa/main/getstring.c b/src/mesa/main/getstring.c index a09c46798f3..0c1ae3dd702 100644 --- a/src/mesa/main/getstring.c +++ b/src/mesa/main/getstring.c @@ -34,10 +34,11 @@ #include "macros.h" #include "version.h" #include "spirv_extensions.h" - -#include "state_tracker/st_cb_strings.h" #include "api_exec_decl.h" +#include "pipe/p_context.h" +#include "pipe/p_screen.h" + /** * Return the string for a glGetString(GL_SHADING_LANGUAGE_VERSION) query. */ @@ -135,19 +136,21 @@ _mesa_GetString( GLenum name ) return (const GLubyte *) ctx->Const.RendererOverride; } - /* this is a required driver function */ - { - /* Give the driver the chance to handle this query */ - const GLubyte *str = st_get_string(ctx, name); - if (str) - return str; - } + struct pipe_screen *screen = ctx->pipe->screen; switch (name) { - case GL_VENDOR: + case GL_VENDOR: { + const GLubyte *str = (const GLubyte *)screen->get_vendor(screen); + if (str) + return str; return (const GLubyte *) vendor; - case GL_RENDERER: + } + case GL_RENDERER: { + const GLubyte *str = (const GLubyte *)screen->get_name(screen); + if (str) + return str; return (const GLubyte *) renderer; + } case GL_VERSION: return (const GLubyte *) ctx->VersionString; case GL_EXTENSIONS: diff --git a/src/mesa/meson.build b/src/mesa/meson.build index 52cd3d8a95d..edc322d6c87 100644 --- a/src/mesa/meson.build +++ b/src/mesa/meson.build @@ -365,8 +365,6 @@ files_libmesa = files( 'state_tracker/st_cb_readpixels.h', 'state_tracker/st_cb_semaphoreobjects.c', 'state_tracker/st_cb_semaphoreobjects.h', - 'state_tracker/st_cb_strings.c', - 'state_tracker/st_cb_strings.h', 'state_tracker/st_cb_syncobj.c', 'state_tracker/st_cb_syncobj.h', 'state_tracker/st_cb_texture.c', diff --git a/src/mesa/state_tracker/st_cb_strings.c b/src/mesa/state_tracker/st_cb_strings.c deleted file mode 100644 index 9b14d43942d..00000000000 --- a/src/mesa/state_tracker/st_cb_strings.c +++ /dev/null @@ -1,60 +0,0 @@ -/************************************************************************** - * - * Copyright 2007 VMware, Inc. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - - /* - * Authors: - * Keith Whitwell - * Brian Paul - */ - -#include "main/glheader.h" -#include "main/macros.h" -#include "pipe/p_context.h" -#include "pipe/p_screen.h" -#include "util/u_string.h" -#include "st_context.h" -#include "st_cb_strings.h" - -const GLubyte * -st_get_string(struct gl_context * ctx, GLenum name) -{ - struct st_context *st = st_context(ctx); - struct pipe_screen *screen = st->screen; - - switch (name) { - case GL_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_cb_strings.h b/src/mesa/state_tracker/st_cb_strings.h deleted file mode 100644 index 2457adefd65..00000000000 --- a/src/mesa/state_tracker/st_cb_strings.h +++ /dev/null @@ -1,35 +0,0 @@ -/************************************************************************** - * - * Copyright 2007 VMware, Inc. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - - -#ifndef ST_CB_STRINGS_H -#define ST_CB_STRINGS_H - -const GLubyte *st_get_string(struct gl_context * ctx, GLenum name); - -#endif /* ST_CB_STRINGS_H */ -