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

Commit ca144bfa authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: kgsl: Use a token address for memstore"

parents 8295c46e 3ba19ae9
Loading
Loading
Loading
Loading
+2 −6
Original line number Original line Diff line number Diff line
@@ -2305,12 +2305,8 @@ static int adreno_prop_device_shadow(struct kgsl_device *device,
	struct kgsl_shadowprop shadowprop = { 0 };
	struct kgsl_shadowprop shadowprop = { 0 };


	if (device->memstore->hostptr) {
	if (device->memstore->hostptr) {
		/*
		/* Pass a dummy address to identify memstore */
		 * NOTE: with mmu enabled, gpuaddr doesn't mean
		shadowprop.gpuaddr =  KGSL_MEMSTORE_TOKEN_ADDRESS;
		 * anything to mmap().
		 */

		shadowprop.gpuaddr =  (unsigned long)device->memstore->gpuaddr;
		shadowprop.size = device->memstore->size;
		shadowprop.size = device->memstore->size;


		shadowprop.flags = KGSL_FLAGS_INITIALIZED |
		shadowprop.flags = KGSL_FLAGS_INITIALIZED |
+2 −8
Original line number Original line Diff line number Diff line
@@ -51,15 +51,9 @@ int adreno_getproperty_compat(struct kgsl_device *device,
			}
			}
			memset(&shadowprop, 0, sizeof(shadowprop));
			memset(&shadowprop, 0, sizeof(shadowprop));
			if (device->memstore->hostptr) {
			if (device->memstore->hostptr) {
				/*
				/* Give a token address to identify memstore */
				 * NOTE: with mmu enabled, gpuaddr doesn't mean
				 * anything to mmap().
				 * NOTE: shadowprop.gpuaddr is uint32
				 * (because legacy) and the memstore gpuaddr is
				 * 64 bit. Cast the memstore gpuaddr to uint32.
				 */
				shadowprop.gpuaddr = (unsigned int)
				shadowprop.gpuaddr = (unsigned int)
					device->memstore->gpuaddr;
					KGSL_MEMSTORE_TOKEN_ADDRESS;
				shadowprop.size =
				shadowprop.size =
					(unsigned int) device->memstore->size;
					(unsigned int) device->memstore->size;
				/*
				/*
+2 −2
Original line number Original line Diff line number Diff line
@@ -4553,7 +4553,7 @@ kgsl_get_unmapped_area(struct file *file, unsigned long addr,
	struct kgsl_device *device = dev_priv->device;
	struct kgsl_device *device = dev_priv->device;
	struct kgsl_mem_entry *entry = NULL;
	struct kgsl_mem_entry *entry = NULL;


	if (vma_offset == (unsigned long) device->memstore->gpuaddr)
	if (vma_offset == (unsigned long) KGSL_MEMSTORE_TOKEN_ADDRESS)
		return get_unmapped_area(NULL, addr, len, pgoff, flags);
		return get_unmapped_area(NULL, addr, len, pgoff, flags);


	val = get_mmap_entry(private, &entry, pgoff, len);
	val = get_mmap_entry(private, &entry, pgoff, len);
@@ -4597,7 +4597,7 @@ static int kgsl_mmap(struct file *file, struct vm_area_struct *vma)


	/* Handle leagacy behavior for memstore */
	/* Handle leagacy behavior for memstore */


	if (vma_offset == (unsigned long) device->memstore->gpuaddr)
	if (vma_offset == (unsigned long) KGSL_MEMSTORE_TOKEN_ADDRESS)
		return kgsl_mmap_memstore(file, device, vma);
		return kgsl_mmap_memstore(file, device, vma);


	/*
	/*
+10 −0
Original line number Original line Diff line number Diff line
@@ -15,6 +15,16 @@
#define KGSL_IOMMU_GLOBAL_MEM_BASE32	0xf8000000
#define KGSL_IOMMU_GLOBAL_MEM_BASE32	0xf8000000
#define KGSL_IOMMU_GLOBAL_MEM_BASE64	0xfc000000
#define KGSL_IOMMU_GLOBAL_MEM_BASE64	0xfc000000


/*
 * This is a dummy token address that we use to identify memstore when the user
 * wants to map it. mmap() uses a unsigned long for the offset so we need a 32
 * bit value that works with all sized apps. We chose a value that was purposely
 * unmapped so if you increase the global memory size make sure it doesn't
 * conflict
 */

#define KGSL_MEMSTORE_TOKEN_ADDRESS 0xfff00000

#define KGSL_IOMMU_GLOBAL_MEM_BASE(__mmu)	\
#define KGSL_IOMMU_GLOBAL_MEM_BASE(__mmu)	\
	(test_bit(KGSL_MMU_64BIT, &(__mmu)->features) ? \
	(test_bit(KGSL_MMU_64BIT, &(__mmu)->features) ? \
		KGSL_IOMMU_GLOBAL_MEM_BASE64 : KGSL_IOMMU_GLOBAL_MEM_BASE32)
		KGSL_IOMMU_GLOBAL_MEM_BASE64 : KGSL_IOMMU_GLOBAL_MEM_BASE32)