[Mesa-dev] [PATCH] mesa: stop abstracting texture object hashtable locking

Samuel Pitoiset samuel.pitoiset at gmail.com
Thu Apr 6 07:40:13 UTC 2017


Reviewed-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>

On 04/06/2017 06:43 AM, Timothy Arceri wrote:
> This doesn't do anything useful so just remove it.
> ---
>  src/mesa/main/shaderimage.c |  5 +++--
>  src/mesa/main/texobj.c      | 17 ++---------------
>  src/mesa/main/texobj.h      |  6 ------
>  3 files changed, 5 insertions(+), 23 deletions(-)
>
> diff --git a/src/mesa/main/shaderimage.c b/src/mesa/main/shaderimage.c
> index 5cce3ac..45b72c9 100644
> --- a/src/mesa/main/shaderimage.c
> +++ b/src/mesa/main/shaderimage.c
> @@ -23,20 +23,21 @@
>   * Authors:
>   *    Francisco Jerez <currojerez at riseup.net>
>   */
>
>  #include <assert.h>
>
>  #include "shaderimage.h"
>  #include "mtypes.h"
>  #include "formats.h"
>  #include "errors.h"
> +#include "hash.h"
>  #include "context.h"
>  #include "texobj.h"
>  #include "teximage.h"
>  #include "enums.h"
>
>  /*
>   * Define endian-invariant aliases for some mesa formats that are
>   * defined in terms of their channel layout from LSB to MSB in a
>   * 32-bit word.  The actual byte offsets matter here because the user
>   * is allowed to bit-cast one format into another and get predictable
> @@ -666,21 +667,21 @@ _mesa_BindImageTextures(GLuint first, GLsizei count, const GLuint *textures)
>      *          errors and then a second pass to actually perform the
>      *          bindings.  Should we have different error semantics?
>      *
>      *       RESOLVED:  Yes.  In this specification, when the parameters for
>      *       one of the <count> binding points are invalid, that binding
>      *       point is not updated and an error will be generated.  However,
>      *       other binding points in the same command will be updated if
>      *       their parameters are valid and no other error occurs."
>      */
>
> -   _mesa_begin_texture_lookups(ctx);
> +   _mesa_HashLockMutex(ctx->Shared->TexObjects);
>
>     for (i = 0; i < count; i++) {
>        struct gl_image_unit *u = &ctx->ImageUnits[first + i];
>        const GLuint texture = textures ? textures[i] : 0;
>
>        if (texture != 0) {
>           struct gl_texture_object *texObj;
>           GLenum tex_format;
>
>           if (!u->TexObj || u->TexObj->Name != texture) {
> @@ -754,12 +755,12 @@ _mesa_BindImageTextures(GLuint first, GLsizei count, const GLuint *textures)
>           _mesa_reference_texobj(&u->TexObj, NULL);
>           u->Level = 0;
>           u->Layered = GL_FALSE;
>           u->_Layer = u->Layer = 0;
>           u->Access = GL_READ_ONLY;
>           u->Format = GL_R8;
>           u->_ActualFormat = MESA_FORMAT_R_UNORM8;
>        }
>     }
>
> -   _mesa_end_texture_lookups(ctx);
> +   _mesa_HashUnlockMutex(ctx->Shared->TexObjects);
>  }
> diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
> index 0481309..a96b394 100644
> --- a/src/mesa/main/texobj.c
> +++ b/src/mesa/main/texobj.c
> @@ -121,33 +121,20 @@ _mesa_lookup_texture_err(struct gl_context *ctx, GLuint id, const char* func)
>
>     if (id > 0)
>        texObj = _mesa_lookup_texture(ctx, id); /* Returns NULL if not found. */
>
>     if (!texObj)
>        _mesa_error(ctx, GL_INVALID_OPERATION, "%s(texture)", func);
>
>     return texObj;
>  }
>
> -void
> -_mesa_begin_texture_lookups(struct gl_context *ctx)
> -{
> -   _mesa_HashLockMutex(ctx->Shared->TexObjects);
> -}
> -
> -
> -void
> -_mesa_end_texture_lookups(struct gl_context *ctx)
> -{
> -   _mesa_HashUnlockMutex(ctx->Shared->TexObjects);
> -}
> -
>
>  struct gl_texture_object *
>  _mesa_lookup_texture_locked(struct gl_context *ctx, GLuint id)
>  {
>     return (struct gl_texture_object *)
>        _mesa_HashLookupLocked(ctx->Shared->TexObjects, id);
>  }
>
>  /**
>   * Return a pointer to the current texture object for the given target
> @@ -1815,21 +1802,21 @@ _mesa_BindTextures(GLuint first, GLsizei count, const GLuint *textures)
>         *          errors and then a second pass to actually perform the
>         *          bindings.  Should we have different error semantics?
>         *
>         *       RESOLVED:  Yes.  In this specification, when the parameters for
>         *       one of the <count> binding points are invalid, that binding
>         *       point is not updated and an error will be generated.  However,
>         *       other binding points in the same command will be updated if
>         *       their parameters are valid and no other error occurs."
>         */
>
> -      _mesa_begin_texture_lookups(ctx);
> +      _mesa_HashLockMutex(ctx->Shared->TexObjects);
>
>        for (i = 0; i < count; i++) {
>           if (textures[i] != 0) {
>              struct gl_texture_unit *texUnit = &ctx->Texture.Unit[first + i];
>              struct gl_texture_object *current = texUnit->_Current;
>              struct gl_texture_object *texObj;
>
>              if (current && current->Name == textures[i])
>                 texObj = current;
>              else
> @@ -1847,21 +1834,21 @@ _mesa_BindTextures(GLuint first, GLsizei count, const GLuint *textures)
>                 _mesa_error(ctx, GL_INVALID_OPERATION,
>                             "glBindTextures(textures[%d]=%u is not zero "
>                             "or the name of an existing texture object)",
>                             i, textures[i]);
>              }
>           } else {
>              unbind_textures_from_unit(ctx, first + i);
>           }
>        }
>
> -      _mesa_end_texture_lookups(ctx);
> +      _mesa_HashUnlockMutex(ctx->Shared->TexObjects);
>     } else {
>        /* Unbind all textures in the range <first> through <first>+<count>-1 */
>        for (i = 0; i < count; i++)
>           unbind_textures_from_unit(ctx, first + i);
>     }
>  }
>
>
>  /**
>   * Set texture priorities.
> diff --git a/src/mesa/main/texobj.h b/src/mesa/main/texobj.h
> index 8776763..a9db167 100644
> --- a/src/mesa/main/texobj.h
> +++ b/src/mesa/main/texobj.h
> @@ -47,26 +47,20 @@ extern "C" {
>   * \name Internal functions
>   */
>  /*@{*/
>
>  extern struct gl_texture_object *
>  _mesa_lookup_texture(struct gl_context *ctx, GLuint id);
>
>  extern struct gl_texture_object *
>  _mesa_lookup_texture_err(struct gl_context *ctx, GLuint id, const char* func);
>
> -extern void
> -_mesa_begin_texture_lookups(struct gl_context *ctx);
> -
> -extern void
> -_mesa_end_texture_lookups(struct gl_context *ctx);
> -
>  extern struct gl_texture_object *
>  _mesa_lookup_texture_locked(struct gl_context *ctx, GLuint id);
>
>  extern struct gl_texture_object *
>  _mesa_get_current_tex_object(struct gl_context *ctx, GLenum target);
>
>  extern struct gl_texture_object *
>  _mesa_new_texture_object( struct gl_context *ctx, GLuint name, GLenum target );
>
>  extern void
>


More information about the mesa-dev mailing list