[Mesa-dev] [PATCH 1/2] i965: Minor fixes to PBO uploads and downloads.

Jason Ekstrand jason at jlekstrand.net
Wed Feb 18 20:27:20 PST 2015


On Wed, Feb 18, 2015 at 5:45 PM, Laura Ekstrand <laura at jlekstrand.net>
wrote:

> Fixes all of the failures in
> arb_direct_state_access/gettextureimage-targets
> except for GL_TEXTURE_1D_ARRAY PBO. Previously, the miptree for meta pbo
> uploads and downloads was not getting initialized correctly.
> ---
>  src/mesa/drivers/common/meta_tex_subimage.c   | 8 ++++++--
>  src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 2 +-
>  src/mesa/drivers/dri/i965/intel_tex.c         | 3 ++-
>  src/mesa/main/dd.h                            | 1 +
>  4 files changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/src/mesa/drivers/common/meta_tex_subimage.c
> b/src/mesa/drivers/common/meta_tex_subimage.c
> index 68c8273..6196283 100644
> --- a/src/mesa/drivers/common/meta_tex_subimage.c
> +++ b/src/mesa/drivers/common/meta_tex_subimage.c
> @@ -51,7 +51,7 @@ create_texture_for_pbo(struct gl_context *ctx, bool
> create_pbo,
>  {
>     uint32_t pbo_format;
>     GLenum internal_format;
> -   unsigned row_stride;
> +   unsigned row_stride, image_stride;
>     struct gl_buffer_object *buffer_obj;
>     struct gl_texture_object *tex_obj;
>     struct gl_texture_image *tex_image;
> @@ -74,6 +74,8 @@ create_texture_for_pbo(struct gl_context *ctx, bool
> create_pbo,
>     pixels = _mesa_image_address3d(packing, pixels,
>                                    width, height, format, type, 0, 0, 0);
>     row_stride = _mesa_image_row_stride(packing, width, format, type);
> +   image_stride = _mesa_image_image_stride(packing, width, height, format,
> +                                           type);
>
>     if (_mesa_is_bufferobj(packing->BufferObj)) {
>        *tmp_pbo = 0;
> @@ -100,8 +102,9 @@ create_texture_for_pbo(struct gl_context *ctx, bool
> create_pbo,
>     _mesa_GenTextures(1, tmp_tex);
>     tex_obj = _mesa_lookup_texture(ctx, *tmp_tex);
>     tex_obj->Target = depth > 1 ? GL_TEXTURE_2D_ARRAY : GL_TEXTURE_2D;
> +   _mesa_initialize_texture_object(ctx, tex_obj, *tmp_tex,
> tex_obj->Target);
>     tex_obj->Immutable = GL_TRUE;
> -   _mesa_initialize_texture_object(ctx, tex_obj, *tmp_tex, GL_TEXTURE_2D);
> +   tex_obj->NumLayers = 1;
>

Why are you setting NumLayers to 1?  If this is the number of array slices,
shouldn't it be set to depth or something?


>
>     internal_format = _mesa_get_format_base_format(pbo_format);
>
> @@ -114,6 +117,7 @@ create_texture_for_pbo(struct gl_context *ctx, bool
> create_pbo,
>                                                       buffer_obj,
>                                                       (intptr_t)pixels,
>                                                       row_stride,
> +                                                     image_stride,
>                                                       read_only)) {
>        _mesa_DeleteTextures(1, tmp_tex);
>        _mesa_DeleteBuffers(1, tmp_pbo);
> diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> index 0e3888f..b46532d 100644
> --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> @@ -724,7 +724,7 @@ intel_miptree_create_for_bo(struct brw_context *brw,
>     mt = intel_miptree_create_layout(brw, target, format,
>                                      0, 0,
>                                      width, height, depth,
> -                                    true, 0, false);
> +                                    true, 0, true);
>

It's not at all obvious from the commit message that this is happening or
what it is.  Since it lives inside intel_miptree_create_bo, it should
probably be its own commit with its own commit message.


>     if (!mt) {
>        free(mt);
>        return mt;
> diff --git a/src/mesa/drivers/dri/i965/intel_tex.c
> b/src/mesa/drivers/dri/i965/intel_tex.c
> index 2d3009a..3a0c09a 100644
> --- a/src/mesa/drivers/dri/i965/intel_tex.c
> +++ b/src/mesa/drivers/dri/i965/intel_tex.c
> @@ -305,6 +305,7 @@ intel_set_texture_storage_for_buffer_object(struct
> gl_context *ctx,
>                                              struct gl_buffer_object
> *buffer_obj,
>                                              uint32_t buffer_offset,
>                                              uint32_t row_stride,
> +                                            uint32_t image_stride,
>                                              bool read_only)
>  {
>     struct brw_context *brw = brw_context(ctx);
> @@ -334,7 +335,7 @@ intel_set_texture_storage_for_buffer_object(struct
> gl_context *ctx,
>
>     drm_intel_bo *bo = intel_bufferobj_buffer(brw, intel_buffer_obj,
>                                               buffer_offset,
> -                                             row_stride * image->Height);
> +                                             image_stride * image->Depth);
>     intel_texobj->mt =
>        intel_miptree_create_for_bo(brw, bo,
>                                    image->TexFormat,
> diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
> index ec8662b..9de08e2 100644
> --- a/src/mesa/main/dd.h
> +++ b/src/mesa/main/dd.h
> @@ -429,6 +429,7 @@ struct dd_function_table {
>                                              struct gl_buffer_object
> *bufferObj,
>                                              uint32_t buffer_offset,
>                                              uint32_t row_stride,
> +                                            uint32_t image_stride,
>                                              bool read_only);
>
>     /**
> --
> 2.1.0
>
> _______________________________________________
> 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/20150218/4a72bce4/attachment.html>


More information about the mesa-dev mailing list