/* SPDX-License-Identifier: GPL-2.0 OR MIT */ /************************************************************************** * * Copyright (c) 2023-2024 Broadcom. All Rights Reserved. The term * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sub license, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice (including the * next paragraph) shall be included in all copies or substantial portions * of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * USE OR OTHER DEALINGS IN THE SOFTWARE. *
**************************************************************************/
/** * struct vmw_bo - TTM buffer object with vmwgfx additions * @tbo: The TTM buffer object * @placement: The preferred placement for this buffer object * @places: The chosen places for the preferred placement. * @busy_places: Chosen busy places for the preferred placement * @map: Kmap object for semi-persistent mappings * @res_tree: RB tree of resources using this buffer object as a backing MOB * @res_prios: Eviction priority counts for attached resources * @map_count: The number of currently active maps. Will differ from the * cpu_writers because it includes kernel maps. * @cpu_writers: Number of synccpu write grabs. Protected by reservation when * increased. May be decreased without reservation. * @dx_query_ctx: DX context if this buffer object is used as a DX query MOB * @dirty: structure for user-space dirty-tracking
*/ struct vmw_bo { struct ttm_buffer_object tbo;
int vmw_user_bo_lookup(struct drm_file *filp,
u32 handle, struct vmw_bo **out);
/** * vmw_bo_adjust_prio - Adjust the buffer object eviction priority * according to attached resources * @vbo: The struct vmw_bo
*/ staticinlinevoid vmw_bo_prio_adjust(struct vmw_bo *vbo)
{ int i = ARRAY_SIZE(vbo->res_prios);
while (i--) { if (vbo->res_prios[i]) {
vbo->tbo.priority = i; return;
}
}
vbo->tbo.priority = 3;
}
/** * vmw_bo_prio_add - Notify a buffer object of a newly attached resource * eviction priority * @vbo: The struct vmw_bo * @prio: The resource priority * * After being notified, the code assigns the highest resource eviction priority * to the backing buffer object (mob).
*/ staticinlinevoid vmw_bo_prio_add(struct vmw_bo *vbo, int prio)
{ if (vbo->res_prios[prio]++ == 0)
vmw_bo_prio_adjust(vbo);
}
/** * vmw_bo_used_prio_del - Notify a buffer object of a resource with a certain * priority being removed * @vbo: The struct vmw_bo * @prio: The resource priority * * After being notified, the code assigns the highest resource eviction priority * to the backing buffer object (mob).
*/ staticinlinevoid vmw_bo_prio_del(struct vmw_bo *vbo, int prio)
{ if (--vbo->res_prios[prio] == 0)
vmw_bo_prio_adjust(vbo);
}
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.