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>
This commit is contained in:
Emma Anholt 2021-06-20 08:41:50 -07:00
parent 51458ba9e9
commit f8867b3d98
2 changed files with 26 additions and 14 deletions

View file

@ -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

View file

@ -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;
}