Module: Mesa Branch: main Commit: f8867b3d989f3d338b0796c028aae7272b20f827 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f8867b3d989f3d338b0796c028aae7272b20f827
Author: Emma Anholt <[email protected]> Date: Sun Jun 20 08:41:50 2021 -0700 i915g: Create an i915_surface for our pipe_surfaces. Nothing added in yet, just wrapping the struct. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11512> --- src/gallium/drivers/i915/i915_context.h | 9 +++++++++ src/gallium/drivers/i915/i915_surface.c | 31 +++++++++++++++++-------------- 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/src/gallium/drivers/i915/i915_context.h b/src/gallium/drivers/i915/i915_context.h index 579cfd8575c..65e24fb56a9 100644 --- a/src/gallium/drivers/i915/i915_context.h +++ b/src/gallium/drivers/i915/i915_context.h @@ -211,6 +211,10 @@ struct i915_sampler_state { unsigned maxlod; }; +struct i915_surface { + struct pipe_surface templ; +}; + struct i915_velems_state { unsigned count; struct pipe_vertex_element velem[PIPE_MAX_ATTRIBS]; @@ -401,5 +405,10 @@ i915_context( struct pipe_context *pipe ) return (struct i915_context *)pipe; } +static inline struct i915_surface * +i915_surface(struct pipe_surface *pipe) +{ + return (struct i915_surface *)pipe; +} #endif diff --git a/src/gallium/drivers/i915/i915_surface.c b/src/gallium/drivers/i915/i915_surface.c index 4322ff94904..095e978c4e7 100644 --- a/src/gallium/drivers/i915/i915_surface.c +++ b/src/gallium/drivers/i915/i915_surface.c @@ -357,26 +357,29 @@ i915_create_surface_custom(struct pipe_context *ctx, unsigned width0, unsigned height0) { - struct pipe_surface *ps; + struct i915_surface *surf; assert(surf_tmpl->u.tex.first_layer == surf_tmpl->u.tex.last_layer); if (pt->target != PIPE_TEXTURE_CUBE && pt->target != PIPE_TEXTURE_3D) assert(surf_tmpl->u.tex.first_layer == 0); - ps = CALLOC_STRUCT(pipe_surface); - if (ps) { - /* could subclass pipe_surface and store offset as it used to do */ - pipe_reference_init(&ps->reference, 1); - pipe_resource_reference(&ps->texture, pt); - ps->format = surf_tmpl->format; - ps->width = u_minify(width0, surf_tmpl->u.tex.level); - ps->height = u_minify(height0, surf_tmpl->u.tex.level); - ps->u.tex.level = surf_tmpl->u.tex.level; - ps->u.tex.first_layer = surf_tmpl->u.tex.first_layer; - ps->u.tex.last_layer = surf_tmpl->u.tex.last_layer; - ps->context = ctx; - } + surf = CALLOC_STRUCT(i915_surface); + if (!surf) + return NULL; + + struct pipe_surface *ps = &surf->templ; + + pipe_reference_init(&ps->reference, 1); + pipe_resource_reference(&ps->texture, pt); + ps->format = surf_tmpl->format; + ps->width = u_minify(width0, surf_tmpl->u.tex.level); + ps->height = u_minify(height0, surf_tmpl->u.tex.level); + ps->u.tex.level = surf_tmpl->u.tex.level; + ps->u.tex.first_layer = surf_tmpl->u.tex.first_layer; + ps->u.tex.last_layer = surf_tmpl->u.tex.last_layer; + ps->context = ctx; + return ps; } _______________________________________________ mesa-commit mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-commit
