[Mesa-dev] [PATCH 1/4] meta: Remove error checks for texture <-> pixel-buffer transfers that don't belong in driver code

Laura Ekstrand laura at jlekstrand.net
Thu Mar 5 09:55:51 PST 2015


On Thu, Mar 5, 2015 at 12:20 AM, Eduardo Lima Mitev <elima at igalia.com>
wrote:

> The implementation of texture <-> pixel-buffer transfers in drivers common
> layer
> includes certain error checks and argument validation that don't belong
> there,
> considering how the Mesa codebase is laid out. These are higher level
> validations that, if necessary, should be performed earlier (i.e, in GL API
> entry points).
>
> This patch simply removes these error checks from driver code.
>
> For more information, see discussion at
> http://lists.freedesktop.org/archives/mesa-dev/2015-February/077417.html.
> ---
>  src/mesa/drivers/common/meta_tex_subimage.c | 44
> -----------------------------
>  1 file changed, 44 deletions(-)
>
> diff --git a/src/mesa/drivers/common/meta_tex_subimage.c
> b/src/mesa/drivers/common/meta_tex_subimage.c
> index bba2b4f..34ef191 100644
> --- a/src/mesa/drivers/common/meta_tex_subimage.c
> +++ b/src/mesa/drivers/common/meta_tex_subimage.c
> @@ -149,34 +149,12 @@ _mesa_meta_pbo_TexSubImage(struct gl_context *ctx,
> GLuint dims,
>     bool success = false;
>     int z, iters;
>
> -   /* XXX: This should probably be passed in from somewhere */
> -   const char *where = "_mesa_meta_pbo_TexSubImage";
> -
>     if (!_mesa_is_bufferobj(packing->BufferObj) && !create_pbo)
>        return false;
>
> You can't get rid of this block.  It's not part of the PBO checking code;
it's here because _mesa_meta_texsubimage can't handle these formats.

> -   if (format == GL_DEPTH_COMPONENT ||
> -       format == GL_DEPTH_STENCIL ||
> -       format == GL_STENCIL_INDEX ||
> -       format == GL_COLOR_INDEX)
> -      return false;
> -
>     if (ctx->_ImageTransferState)
>        return false;
>
> -   if (!_mesa_validate_pbo_access(dims, packing, width, height, depth,
> -                                  format, type, INT_MAX, pixels)) {
> -      _mesa_error(ctx, GL_INVALID_OPERATION,
> -                  "%s(out of bounds PBO access)", where);
> -      return true;
> -   }
> -
> -   if (_mesa_check_disallowed_mapping(packing->BufferObj)) {
> -      /* buffer is mapped - that's an error */
> -      _mesa_error(ctx, GL_INVALID_OPERATION, "%s(PBO is mapped)", where);
> -      return true;
> -   }
> -
>     /* Only accept tightly packed pixels from the user. */
>     if (packing->ImageHeight != 0 && packing->ImageHeight != height)
>        return false;
> @@ -272,34 +250,12 @@ _mesa_meta_pbo_GetTexSubImage(struct gl_context
> *ctx, GLuint dims,
>     bool success = false;
>     int z, iters;
>
> -   /* XXX: This should probably be passed in from somewhere */
> -   const char *where = "_mesa_meta_pbo_GetTexSubImage";
> -
>     if (!_mesa_is_bufferobj(packing->BufferObj))
>        return false;
>
> As above, you can't remove this block.

> -   if (format == GL_DEPTH_COMPONENT ||
> -       format == GL_DEPTH_STENCIL ||
> -       format == GL_STENCIL_INDEX ||
> -       format == GL_COLOR_INDEX)
> -      return false;
> -
>     if (ctx->_ImageTransferState)
>        return false;
>
> -   if (!_mesa_validate_pbo_access(dims, packing, width, height, depth,
> -                                  format, type, INT_MAX, pixels)) {
> -      _mesa_error(ctx, GL_INVALID_OPERATION,
> -                  "%s(out of bounds PBO access)", where);
> -      return true;
> -   }
> -
> -   if (_mesa_check_disallowed_mapping(packing->BufferObj)) {
> -      /* buffer is mapped - that's an error */
> -      _mesa_error(ctx, GL_INVALID_OPERATION, "%s(PBO is mapped)", where);
> -      return true;
> -   }
> -
>     /* Only accept tightly packed pixels from the user. */
>     if (packing->ImageHeight != 0 && packing->ImageHeight != height)
>        return false;
> --
> 2.1.3
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150305/4f5f33fb/attachment.html>


More information about the mesa-dev mailing list