[Mesa-dev] [PATCH] i965: Don't create a temp PBO when uploading data from glTexImage*

Anuj Phogat anuj.phogat at gmail.com
Fri Jun 12 09:37:36 PDT 2015


On Fri, Jun 12, 2015 at 7:34 AM, Neil Roberts <neil at linux.intel.com> wrote:
> Previously when glTexImage* is called it would attempt to create a
> temporary PBO if the texture is busy in order to avoid blocking when
> mapping the texture. This doesn't make much sense for glTexImage
> because in that case we are completely replacing the texture anyway so
> instead of allocating a PBO we can just allocate new storage for the
> texture.
>
> The code was buggy anyway because it was checking whether the buffer
> was busy before calling Driver->AllocTextureImageBuffer. That function
> actually always frees the buffer and recreates a new one so it was
> checking whether the previous buffer was busy and this is irrelevant.
>
> In practice I think this wouldn't matter too much because the upper
> layers of Mesa always call Driver->FreeTextureImageBuffer before
> calling Driver->TexImage anyway so there would never be a buffer that
> could be busy.
> ---
>  src/mesa/drivers/dri/i965/intel_tex_image.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/intel_tex_image.c b/src/mesa/drivers/dri/i965/intel_tex_image.c
> index 85d3d04..2874e5b 100644
> --- a/src/mesa/drivers/dri/i965/intel_tex_image.c
> +++ b/src/mesa/drivers/dri/i965/intel_tex_image.c
> @@ -95,8 +95,6 @@ intelTexImage(struct gl_context * ctx,
>     struct intel_texture_image *intelImage = intel_texture_image(texImage);
>     bool ok;
>
> -   bool tex_busy = intelImage->mt && drm_intel_bo_busy(intelImage->mt->bo);
> -
>     DBG("%s mesa_format %s target %s format %s type %s level %d %dx%dx%d\n",
>         __func__, _mesa_get_format_name(texImage->TexFormat),
>         _mesa_lookup_enum_by_nr(texImage->TexObject->Target),
> @@ -116,7 +114,8 @@ intelTexImage(struct gl_context * ctx,
>                                     texImage->Depth,
>                                     format, type, pixels,
>                                     false /*allocate_storage*/,
> -                                   tex_busy, unpack);
> +                                   false /*create_pbo*/,
> +                                   unpack);
>     if (ok)
>        return;
>
> --
> 1.9.3
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev

It makes sense.
Reviewed-by: Anuj Phogat <anuj.phogat at gmail.com>


More information about the mesa-dev mailing list