[Mesa-dev] [PATCH 08/19] mesa/st: implement memory objects as a backend for texture storage

Marek Olšák maraeo at gmail.com
Tue Jul 11 18:31:35 UTC 2017


On Sat, Jul 1, 2017 at 1:03 AM, Andres Rodriguez <andresx7 at gmail.com> wrote:
> From: Dave Airlie <airlied at redhat.com>
>
> Instead of allocating memory to back a texture, use the provided memory
> object.
>
> Signed-off-by: Andres Rodriguez <andresx7 at gmail.com>
> ---
>  src/mesa/main/mtypes.h                 |   2 +
>  src/mesa/state_tracker/st_cb_texture.c | 123 +++++++++++++++++++++++++++++++++
>  src/mesa/state_tracker/st_extensions.c |   5 ++
>  3 files changed, 130 insertions(+)
>
> diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
> index 8dcc1a8..463f444 100644
> --- a/src/mesa/main/mtypes.h
> +++ b/src/mesa/main/mtypes.h
> @@ -4125,6 +4125,8 @@ struct gl_extensions
>     GLboolean EXT_framebuffer_sRGB;
>     GLboolean EXT_gpu_program_parameters;
>     GLboolean EXT_gpu_shader4;
> +   GLboolean EXT_memory_object;
> +   GLboolean EXT_memory_object_fd;
>     GLboolean EXT_packed_float;
>     GLboolean EXT_pixel_buffer_object;
>     GLboolean EXT_point_parameters;
> diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
> index 9798321..063f6d6 100644
> --- a/src/mesa/state_tracker/st_cb_texture.c
> +++ b/src/mesa/state_tracker/st_cb_texture.c
> @@ -53,6 +53,7 @@
>  #include "state_tracker/st_cb_flush.h"
>  #include "state_tracker/st_cb_texture.h"
>  #include "state_tracker/st_cb_bufferobjects.h"
> +#include "state_tracker/st_cb_memoryobjects.h"
>  #include "state_tracker/st_format.h"
>  #include "state_tracker/st_pbo.h"
>  #include "state_tracker/st_texture.h"
> @@ -2890,6 +2891,125 @@ st_TexParameter(struct gl_context *ctx,
>     }
>  }
>
> +/**
> + * Allocate a new pipe_resource object
> + * width0, height0, depth0 are the dimensions of the level 0 image
> + * (the highest resolution).  last_level indicates how many mipmap levels
> + * to allocate storage for.  For non-mipmapped textures, this will be zero.
> + */
> +static struct pipe_resource *
> +st_texture_create_memory(struct st_context *st,

st_texture_create_from_memory?

Marek


More information about the mesa-dev mailing list