disp: msm: sde: add helper to check VM hw availability

Add a utility function to check if HW has been handed over to
another VM.

Change-Id: Ic36ca1e7f15f7608e69d69fc3f4e7ad40be15704
Signed-off-by: Steve Cohen <cohens@codeaurora.org>
This commit is contained in:
Steve Cohen
2021-08-11 17:59:00 -04:00
والد 9690b545df
کامیت 7f3b2f0a4b
6فایلهای تغییر یافته به همراه40 افزوده شده و 36 حذف شده

مشاهده پرونده

@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
*/
#ifndef __SDE_VM_H__
@@ -285,6 +285,23 @@ static inline struct sde_vm_ops *sde_vm_get_ops(struct sde_kms *sde_kms)
return &sde_kms->vm->vm_ops;
}
/**
* sde_vm_owns_hw - checks if the executing VM currently has HW ownership (caller must be holding
* the sde_vm_lock)
* @sde_kms - pointer to sde_kms
* @return - true if this VM currently owns the HW
*/
static inline bool sde_vm_owns_hw(struct sde_kms *sde_kms)
{
struct sde_vm_ops *vm_ops = sde_kms ? sde_vm_get_ops(sde_kms) : NULL;
if (vm_ops && vm_ops->vm_owns_hw)
return vm_ops->vm_owns_hw(sde_kms);
return true;
}
#else
static inline int sde_vm_primary_init(struct sde_kms *kms)
{
@@ -314,5 +331,10 @@ static inline struct sde_vm_ops *sde_vm_get_ops(struct sde_kms *sde_kms)
return NULL;
}
static inline bool sde_vm_owns_hw(struct sde_kms *sde_kms)
{
return true;
}
#endif /* IS_ENABLED(CONFIG_DRM_SDE_VM) */
#endif /* __SDE_VM_H__ */