Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ee546cd3 authored by Jordan Crouse's avatar Jordan Crouse Committed by Rob Clark
Browse files

drm/msm: Reference count address spaces



There are reasons for a memory object to outlive the file descriptor
that created it and so the address space that a buffer object is
attached to must also outlive the file descriptor. Reference count
the address space so that it can remain viable until all the objects
have released their addresses.

Signed-off-by: default avatarJordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: default avatarRob Clark <robdclark@gmail.com>
parent 9873ef07
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -438,6 +438,6 @@ void adreno_gpu_cleanup(struct adreno_gpu *adreno_gpu)
	if (gpu->aspace) {
		gpu->aspace->mmu->funcs->detach(gpu->aspace->mmu,
			iommu_ports, ARRAY_SIZE(iommu_ports));
		msm_gem_address_space_destroy(gpu->aspace);
		msm_gem_address_space_put(gpu->aspace);
	}
}
+1 −1
Original line number Diff line number Diff line
@@ -169,7 +169,7 @@ static void mdp4_destroy(struct msm_kms *kms)
	if (aspace) {
		aspace->mmu->funcs->detach(aspace->mmu,
				iommu_ports, ARRAY_SIZE(iommu_ports));
		msm_gem_address_space_destroy(aspace);
		msm_gem_address_space_put(aspace);
	}

	if (mdp4_kms->rpm_enabled)
+1 −1
Original line number Diff line number Diff line
@@ -175,7 +175,7 @@ static void mdp5_kms_destroy(struct msm_kms *kms)
	if (aspace) {
		aspace->mmu->funcs->detach(aspace->mmu,
				iommu_ports, ARRAY_SIZE(iommu_ports));
		msm_gem_address_space_destroy(aspace);
		msm_gem_address_space_put(aspace);
	}
}

+2 −1
Original line number Diff line number Diff line
@@ -191,7 +191,8 @@ void msm_gem_unmap_vma(struct msm_gem_address_space *aspace,
int msm_gem_map_vma(struct msm_gem_address_space *aspace,
		struct msm_gem_vma *vma, struct sg_table *sgt, int npages);

void msm_gem_address_space_destroy(struct msm_gem_address_space *aspace);
void msm_gem_address_space_put(struct msm_gem_address_space *aspace);

struct msm_gem_address_space *
msm_gem_address_space_create(struct device *dev, struct iommu_domain *domain,
		const char *name);
+2 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@
#ifndef __MSM_GEM_H__
#define __MSM_GEM_H__

#include <linux/kref.h>
#include <linux/reservation.h>
#include "msm_drv.h"

@@ -31,6 +32,7 @@ struct msm_gem_address_space {
	 */
	struct drm_mm mm;
	struct msm_mmu *mmu;
	struct kref kref;
};

struct msm_gem_vma {
Loading