[PATCH v4] drm/ttm: Clarify that the TTM_PL_SYSTEM is under TTMs control
Christian König
christian.koenig at amd.com
Wed Nov 24 08:22:42 UTC 2021
Am 10.11.21 um 15:50 schrieb Zack Rusin:
> TTM takes full control over TTM_PL_SYSTEM placed buffers. This makes
> driver internal usage of TTM_PL_SYSTEM prone to errors because it
> requires the drivers to manually handle all interactions between TTM
> which can swap out those buffers whenever it thinks it's the right
> thing to do and driver.
>
> CPU buffers which need to be fenced and shared with accelerators should
> be placed in driver specific placements that can explicitly handle
> CPU/accelerator buffer fencing.
> Currently, apart, from things silently failing nothing is enforcing
> that requirement which means that it's easy for drivers and new
> developers to get this wrong. To avoid the confusion we can document
> this requirement and clarify the solution.
>
> This came up during a discussion on dri-devel:
> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore.kernel.org%2Fdri-devel%2F232f45e9-8748-1243-09bf-56763e6668b3%40amd.com&data=04%7C01%7Cchristian.koenig%40amd.com%7Cbcf8d8977e68448fa20808d9a4597927%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637721526467013347%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=3pldUWJ8u7AEDxtG0vQBINIL7%2FQE4HiE%2FQ7x8fi0MK8%3D&reserved=0
>
> Signed-off-by: Zack Rusin <zackr at vmware.com>
> Cc: Christian König <christian.koenig at amd.com>
> Cc: Thomas Hellström <thomas.hellstrom at linux.intel.com>
Reviewed-by: Christian König <christian.koenig at amd.com>
> ---
> include/drm/ttm/ttm_placement.h | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/include/drm/ttm/ttm_placement.h b/include/drm/ttm/ttm_placement.h
> index 76d1b9119a2b..8074d0f6cae5 100644
> --- a/include/drm/ttm/ttm_placement.h
> +++ b/include/drm/ttm/ttm_placement.h
> @@ -35,6 +35,17 @@
>
> /*
> * Memory regions for data placement.
> + *
> + * Buffers placed in TTM_PL_SYSTEM are considered under TTMs control and can
> + * be swapped out whenever TTMs thinks it is a good idea.
> + * In cases where drivers would like to use TTM_PL_SYSTEM as a valid
> + * placement they need to be able to handle the issues that arise due to the
> + * above manually.
> + *
> + * For BO's which reside in system memory but for which the accelerator
> + * requires direct access (i.e. their usage needs to be synchronized
> + * between the CPU and accelerator via fences) a new, driver private
> + * placement that can handle such scenarios is a good idea.
> */
>
> #define TTM_PL_SYSTEM 0
More information about the dri-devel
mailing list