/** @data: Pointer to local copy of FW context data. */ void *data;
/** @data_size: Size of FW context data, in bytes. */
u32 data_size;
/** @ctx_id: FW context ID. */
u32 ctx_id;
/** * @faulty: Set to 1 when the context queues had unfinished job when * a GPU reset happened. * * In that case, the context is in an inconsistent state and can't be * used anymore.
*/
atomic_t faulty;
/** @queues: Union containing all kind of queues. */ union { struct { /** @geometry: Geometry queue. */ struct pvr_queue *geometry;
/** @fragment: Fragment queue. */ struct pvr_queue *fragment;
};
/** * pvr_context_get() - Take additional reference on context. * @ctx: Context pointer. * * Call pvr_context_put() to release. * * Returns: * * The requested context on success, or * * %NULL if no context pointer passed.
*/ static __always_inline struct pvr_context *
pvr_context_get(struct pvr_context *ctx)
{ if (ctx)
kref_get(&ctx->ref_count);
return ctx;
}
/** * pvr_context_get_if_referenced() - Take an additional reference on a still * referenced context. * @ctx: Context pointer. * * Call pvr_context_put() to release. * * Returns: * * True on success, or * * false if no context pointer passed, or the context wasn't still * * referenced.
*/ static __always_inline bool
pvr_context_get_if_referenced(struct pvr_context *ctx)
{ return ctx != NULL && kref_get_unless_zero(&ctx->ref_count) != 0;
}
/** * pvr_context_lookup() - Lookup context pointer from handle and file. * @pvr_file: Pointer to pvr_file structure. * @handle: Context handle. * * Takes reference on context. Call pvr_context_put() to release. * * Return: * * The requested context on success, or * * %NULL on failure (context does not exist, or does not belong to @pvr_file).
*/ static __always_inline struct pvr_context *
pvr_context_lookup(struct pvr_file *pvr_file, u32 handle)
{ struct pvr_context *ctx;
/* Take the array lock to protect against context removal. */
xa_lock(&pvr_file->ctx_handles);
ctx = pvr_context_get(xa_load(&pvr_file->ctx_handles, handle));
xa_unlock(&pvr_file->ctx_handles);
return ctx;
}
/** * pvr_context_lookup_id() - Lookup context pointer from ID. * @pvr_dev: Device pointer. * @id: FW context ID. * * Takes reference on context. Call pvr_context_put() to release. * * Return: * * The requested context on success, or * * %NULL on failure (context does not exist).
*/ static __always_inline struct pvr_context *
pvr_context_lookup_id(struct pvr_device *pvr_dev, u32 id)
{ struct pvr_context *ctx;
/* Take the array lock to protect against context removal. */
xa_lock(&pvr_dev->ctx_ids);
/* Contexts are removed from the ctx_ids set in the context release path, * meaning the ref_count reached zero before they get removed. We need * to make sure we're not trying to acquire a context that's being * destroyed.
*/
ctx = xa_load(&pvr_dev->ctx_ids, id); if (!kref_get_unless_zero(&ctx->ref_count))
ctx = NULL;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.