mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 04:38:03 +02:00
xa: move surface to ref/unref api
This make ddx life easier. Signed-off-by: Jerome Glisse <jglisse@redhat.com> Signed-off-by: Rob Clark <robclark@freedesktop.org>
This commit is contained in:
parent
d156c032c9
commit
8b21a3825b
3 changed files with 19 additions and 3 deletions
|
|
@ -59,6 +59,7 @@ struct xa_format_descriptor {
|
|||
};
|
||||
|
||||
struct xa_surface {
|
||||
int refcount;
|
||||
struct pipe_resource template;
|
||||
struct xa_tracker *xa;
|
||||
struct pipe_resource *tex;
|
||||
|
|
|
|||
|
|
@ -328,6 +328,7 @@ surface_create(struct xa_tracker *xa,
|
|||
if (!srf->tex)
|
||||
goto out_no_tex;
|
||||
|
||||
srf->refcount = 1;
|
||||
srf->xa = xa;
|
||||
srf->flags = flags;
|
||||
srf->fdesc = fdesc;
|
||||
|
|
@ -451,9 +452,22 @@ xa_surface_redefine(struct xa_surface *srf,
|
|||
return XA_ERR_NONE;
|
||||
}
|
||||
|
||||
XA_EXPORT void
|
||||
xa_surface_destroy(struct xa_surface *srf)
|
||||
XA_EXPORT struct xa_surface*
|
||||
xa_surface_ref(struct xa_surface *srf)
|
||||
{
|
||||
if (srf == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
srf->refcount++;
|
||||
return srf;
|
||||
}
|
||||
|
||||
XA_EXPORT void
|
||||
xa_surface_unref(struct xa_surface *srf)
|
||||
{
|
||||
if (srf == NULL || --srf->refcount) {
|
||||
return;
|
||||
}
|
||||
pipe_resource_reference(&srf->tex, NULL);
|
||||
free(srf);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -176,7 +176,8 @@ extern struct xa_surface * xa_surface_from_handle(struct xa_tracker *xa,
|
|||
|
||||
enum xa_formats xa_surface_format(const struct xa_surface *srf);
|
||||
|
||||
extern void xa_surface_destroy(struct xa_surface *srf);
|
||||
extern struct xa_surface *xa_surface_ref(struct xa_surface *srf);
|
||||
extern void xa_surface_unref(struct xa_surface *srf);
|
||||
|
||||
extern int xa_surface_redefine(struct xa_surface *srf,
|
||||
int width,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue