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

Commit d8b75e15 authored by Harshdeep Dhatt's avatar Harshdeep Dhatt Committed by Carter Cooper
Browse files

msm: kgsl: Allocate global buffers through paged memory



The global buffers are allocated through cma, which can
be very limited on some targets. Add a flag to allocate
a global buffer through our page allocator.

CRs-Fixed: 1024295
Change-Id: Ie796b03ce152774535f593acdf00e900109d303a
Signed-off-by: default avatarHarshdeep Dhatt <hdhatt@codeaurora.org>
parent cc915a39
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -3913,7 +3913,7 @@ int kgsl_device_platform_probe(struct kgsl_device *device)
		goto error_close_mmu;

	status = kgsl_allocate_global(device, &device->memstore,
		KGSL_MEMSTORE_SIZE, 0, 0);
		KGSL_MEMSTORE_SIZE, 0, KGSL_MEMDESC_CONTIG);

	if (status != 0)
		goto error_close_mmu;
+2 −0
Original line number Diff line number Diff line
@@ -163,6 +163,8 @@ struct kgsl_memdesc_ops {
#define KGSL_MEMDESC_PRIVILEGED BIT(6)
/* The memdesc is TZ locked content protection */
#define KGSL_MEMDESC_TZ_LOCKED BIT(7)
/* The memdesc is allocated through contiguous memory */
#define KGSL_MEMDESC_CONTIG BIT(8)

/**
 * struct kgsl_memdesc - GPU memory object descriptor
+1 −5
Original line number Diff line number Diff line
@@ -313,10 +313,6 @@ kgsl_sharedmem_init_sysfs(void)
		drv_attr_list);
}

static int kgsl_sharedmem_page_alloc_user(struct kgsl_memdesc *memdesc,
				struct kgsl_pagetable *pagetable,
				uint64_t size);

static int kgsl_cma_alloc_secure(struct kgsl_device *device,
			struct kgsl_memdesc *memdesc, uint64_t size);

@@ -672,7 +668,7 @@ static inline int get_page_size(size_t size, unsigned int align)
}
#endif

static int
int
kgsl_sharedmem_page_alloc_user(struct kgsl_memdesc *memdesc,
			struct kgsl_pagetable *pagetable,
			uint64_t size)
+15 −2
Original line number Diff line number Diff line
/* Copyright (c) 2002,2007-2015, The Linux Foundation. All rights reserved.
/* Copyright (c) 2002,2007-2016, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -71,6 +71,10 @@ int kgsl_allocate_user(struct kgsl_device *device,

void kgsl_get_memory_usage(char *str, size_t len, uint64_t memflags);

int kgsl_sharedmem_page_alloc_user(struct kgsl_memdesc *memdesc,
				struct kgsl_pagetable *pagetable,
				uint64_t size);

#define MEMFLAGS(_flags, _mask, _shift) \
	((unsigned int) (((_flags) & (_mask)) >> (_shift)))

@@ -266,7 +270,16 @@ static inline int kgsl_allocate_global(struct kgsl_device *device,
	memdesc->flags = flags;
	memdesc->priv = priv;

	ret = kgsl_sharedmem_alloc_contig(device, memdesc, NULL, (size_t) size);
	if ((memdesc->priv & KGSL_MEMDESC_CONTIG) != 0)
		ret = kgsl_sharedmem_alloc_contig(device, memdesc, NULL,
						(size_t) size);
	else {
		ret = kgsl_sharedmem_page_alloc_user(memdesc, NULL,
						(size_t) size);
		if (ret == 0)
			kgsl_memdesc_map(memdesc);
	}

	if (ret == 0)
		kgsl_mmu_add_global(device, memdesc);