Created
March 28, 2015 14:54
-
-
Save invisiblek/43b7c3d2b5d4aa589a2c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/drivers/gpu/ion/ion_heap.c b/drivers/gpu/ion/ion_heap.c | |
index fe878fe..0b193a0 100644 | |
--- a/drivers/gpu/ion/ion_heap.c | |
+++ b/drivers/gpu/ion/ion_heap.c | |
@@ -229,43 +229,6 @@ int ion_heap_buffer_zero(struct ion_buffer *buffer) | |
return ret; | |
} | |
-int ion_heap_buffer_zero_old(struct ion_buffer *buffer) | |
-{ | |
- struct sg_table *table = buffer->sg_table; | |
- pgprot_t pgprot; | |
- struct scatterlist *sg; | |
- struct vm_struct *vm_struct; | |
- int i, j, ret = 0; | |
- | |
- if (buffer->flags & ION_FLAG_CACHED) | |
- pgprot = PAGE_KERNEL; | |
- else | |
- pgprot = pgprot_writecombine(PAGE_KERNEL); | |
- | |
- vm_struct = get_vm_area(PAGE_SIZE, VM_ALLOC); | |
- if (!vm_struct) | |
- return -ENOMEM; | |
- | |
- for_each_sg(table->sgl, sg, table->nents, i) { | |
- struct page *page = sg_page(sg); | |
- unsigned long len = sg_dma_len(sg); | |
- | |
- for (j = 0; j < len / PAGE_SIZE; j++) { | |
- struct page *sub_page = page + j; | |
- struct page **pages = &sub_page; | |
- ret = map_vm_area(vm_struct, pgprot, &pages); | |
- if (ret) | |
- goto end; | |
- memset(vm_struct->addr, 0, PAGE_SIZE); | |
- unmap_kernel_range((unsigned long)vm_struct->addr, | |
- PAGE_SIZE); | |
- } | |
- } | |
-end: | |
- free_vm_area(vm_struct); | |
- return ret; | |
-} | |
- | |
void ion_heap_free_page(struct ion_buffer *buffer, struct page *page, | |
unsigned int order) | |
{ | |
diff --git a/drivers/gpu/ion/ion_page_pool.c b/drivers/gpu/ion/ion_page_pool.c | |
index 1744741..a1845de 100644 | |
--- a/drivers/gpu/ion/ion_page_pool.c | |
+++ b/drivers/gpu/ion/ion_page_pool.c | |
@@ -22,7 +22,6 @@ | |
#include <linux/module.h> | |
#include <linux/slab.h> | |
#include <linux/vmalloc.h> | |
-#include <linux/swap.h> | |
#include "ion_priv.h" | |
struct ion_page_pool_item { | |
@@ -99,22 +98,25 @@ static struct page *ion_page_pool_remove(struct ion_page_pool *pool, bool high) | |
return page; | |
} | |
-void *ion_page_pool_alloc(struct ion_page_pool *pool) | |
+void *ion_page_pool_alloc(struct ion_page_pool *pool, bool *from_pool) | |
{ | |
struct page *page = NULL; | |
BUG_ON(!pool); | |
- mutex_lock(&pool->mutex); | |
- if (pool->high_count) | |
- page = ion_page_pool_remove(pool, true); | |
- else if (pool->low_count) | |
- page = ion_page_pool_remove(pool, false); | |
- mutex_unlock(&pool->mutex); | |
+ *from_pool = true; | |
- if (!page) | |
+ if (mutex_trylock(&pool->mutex)) { | |
+ if (pool->high_count) | |
+ page = ion_page_pool_remove(pool, true); | |
+ else if (pool->low_count) | |
+ page = ion_page_pool_remove(pool, false); | |
+ mutex_unlock(&pool->mutex); | |
+ } | |
+ if (!page) { | |
page = ion_page_pool_alloc_pages(pool); | |
- | |
+ *from_pool = false; | |
+ } | |
return page; | |
} | |
@@ -144,10 +146,7 @@ int ion_page_pool_shrink(struct ion_page_pool *pool, gfp_t gfp_mask, | |
int i; | |
bool high; | |
- if (current_is_kswapd()) | |
- high = 1; | |
- else | |
- high = !!(gfp_mask & __GFP_HIGHMEM); | |
+ high = gfp_mask & __GFP_HIGHMEM; | |
if (nr_to_scan == 0) | |
return ion_page_pool_total(pool, high); | |
@@ -156,10 +155,10 @@ int ion_page_pool_shrink(struct ion_page_pool *pool, gfp_t gfp_mask, | |
struct page *page; | |
mutex_lock(&pool->mutex); | |
- if (pool->low_count) { | |
- page = ion_page_pool_remove(pool, false); | |
- } else if (high && pool->high_count) { | |
+ if (high && pool->high_count) { | |
page = ion_page_pool_remove(pool, true); | |
+ } else if (pool->low_count) { | |
+ page = ion_page_pool_remove(pool, false); | |
} else { | |
mutex_unlock(&pool->mutex); | |
break; | |
diff --git a/drivers/gpu/ion/ion_priv.h b/drivers/gpu/ion/ion_priv.h | |
index 8b1c54e..1f78cb1 100644 | |
--- a/drivers/gpu/ion/ion_priv.h | |
+++ b/drivers/gpu/ion/ion_priv.h | |
@@ -2,7 +2,7 @@ | |
* drivers/gpu/ion/ion_priv.h | |
* | |
* Copyright (C) 2011 Google, Inc. | |
- * Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. | |
+ * Copyright (c) 2011-2014, The Linux Foundation. All rights reserved. | |
* | |
* This software is licensed under the terms of the GNU General Public | |
* License version 2, as published by the Free Software Foundation, and | |
@@ -377,7 +377,7 @@ struct ion_page_pool { | |
struct ion_page_pool *ion_page_pool_create(gfp_t gfp_mask, unsigned int order); | |
void ion_page_pool_destroy(struct ion_page_pool *); | |
-void *ion_page_pool_alloc(struct ion_page_pool *); | |
+void *ion_page_pool_alloc(struct ion_page_pool *, bool *from_pool); | |
void ion_page_pool_free(struct ion_page_pool *, struct page *); | |
/** ion_page_pool_shrink - shrinks the size of the memory cached in the pool | |
diff --git a/drivers/gpu/ion/ion_system_heap.c b/drivers/gpu/ion/ion_system_heap.c | |
index 6e26ea9..b7ad01f 100644 | |
--- a/drivers/gpu/ion/ion_system_heap.c | |
+++ b/drivers/gpu/ion/ion_system_heap.c | |
@@ -2,7 +2,7 @@ | |
* drivers/gpu/ion/ion_system_heap.c | |
* | |
* Copyright (C) 2011 Google, Inc. | |
- * Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. | |
+ * Copyright (c) 2011-2014, The Linux Foundation. All rights reserved. | |
* | |
* This software is licensed under the terms of the GNU General Public | |
* License version 2, as published by the Free Software Foundation, and | |
@@ -34,7 +34,7 @@ static unsigned int high_order_gfp_flags = (GFP_HIGHUSER | | |
__GFP_NO_KSWAPD) & ~__GFP_WAIT; | |
static unsigned int low_order_gfp_flags = (GFP_HIGHUSER | | |
__GFP_NOWARN); | |
-static const unsigned int orders[] = {8, 4, 0}; | |
+static const unsigned int orders[] = {9, 8, 4, 0}; | |
static const int num_orders = ARRAY_SIZE(orders); | |
static int order_to_index(unsigned int order) | |
{ | |
@@ -59,13 +59,15 @@ struct ion_system_heap { | |
struct page_info { | |
struct page *page; | |
+ bool from_pool; | |
unsigned int order; | |
struct list_head list; | |
}; | |
static struct page *alloc_buffer_page(struct ion_system_heap *heap, | |
struct ion_buffer *buffer, | |
- unsigned long order) | |
+ unsigned long order, | |
+ bool *from_pool) | |
{ | |
bool cached = ion_buffer_cached(buffer); | |
bool split_pages = ion_buffer_fault_user_mappings(buffer); | |
@@ -76,7 +78,7 @@ static struct page *alloc_buffer_page(struct ion_system_heap *heap, | |
pool = heap->uncached_pools[order_to_index(order)]; | |
else | |
pool = heap->cached_pools[order_to_index(order)]; | |
- page = ion_page_pool_alloc(pool); | |
+ page = ion_page_pool_alloc(pool, from_pool); | |
if (!page) | |
return 0; | |
@@ -119,14 +121,14 @@ static struct page_info *alloc_largest_available(struct ion_system_heap *heap, | |
struct page *page; | |
struct page_info *info; | |
int i; | |
- | |
+ bool from_pool; | |
for (i = 0; i < num_orders; i++) { | |
if (size < order_to_size(orders[i])) | |
continue; | |
if (max_order < orders[i]) | |
continue; | |
- page = alloc_buffer_page(heap, buffer, orders[i]); | |
+ page = alloc_buffer_page(heap, buffer, orders[i], &from_pool); | |
if (!page) | |
continue; | |
@@ -134,6 +136,7 @@ static struct page_info *alloc_largest_available(struct ion_system_heap *heap, | |
if (info) { | |
info->page = page; | |
info->order = orders[i]; | |
+ info->from_pool = from_pool; | |
} | |
return info; | |
} | |
@@ -470,7 +473,7 @@ static int ion_system_heap_create_pools(struct ion_page_pool **pools) | |
struct ion_page_pool *pool; | |
gfp_t gfp_flags = low_order_gfp_flags; | |
- if (orders[i] > 4) | |
+ if (orders[i]) | |
gfp_flags = high_order_gfp_flags; | |
pool = ion_page_pool_create(gfp_flags, orders[i]); | |
if (!pool) | |
diff --git a/drivers/gpu/msm/adreno.c b/drivers/gpu/msm/adreno.c | |
index 36ea61a..6f8919a 100644 | |
--- a/drivers/gpu/msm/adreno.c | |
+++ b/drivers/gpu/msm/adreno.c | |
@@ -3282,7 +3282,7 @@ static int adreno_waittimestamp(struct kgsl_device *device, | |
return -EINVAL; | |
ret = adreno_drawctxt_wait(ADRENO_DEVICE(device), context, | |
- timestamp, msecs_to_jiffies(msecs)); | |
+ timestamp, msecs); | |
/* If the context got invalidated then return a specific error */ | |
drawctxt = ADRENO_CONTEXT(context); | |
diff --git a/drivers/gpu/msm/adreno.h b/drivers/gpu/msm/adreno.h | |
index 5ce5268..03a36e2 100644 | |
--- a/drivers/gpu/msm/adreno.h | |
+++ b/drivers/gpu/msm/adreno.h | |
@@ -468,6 +468,7 @@ int adreno_coresight_enable(struct coresight_device *csdev); | |
void adreno_coresight_disable(struct coresight_device *csdev); | |
void adreno_coresight_remove(struct platform_device *pdev); | |
int adreno_coresight_init(struct platform_device *pdev); | |
+ | |
bool adreno_hw_isidle(struct kgsl_device *device); | |
int adreno_idle(struct kgsl_device *device); | |
bool adreno_isidle(struct kgsl_device *device); | |
diff --git a/drivers/gpu/msm/adreno_dispatch.c b/drivers/gpu/msm/adreno_dispatch.c | |
index 616efa5..1527d83 100644 | |
--- a/drivers/gpu/msm/adreno_dispatch.c | |
+++ b/drivers/gpu/msm/adreno_dispatch.c | |
@@ -92,6 +92,7 @@ static inline bool _isidle(struct kgsl_device *device) | |
if (!kgsl_pwrctrl_isenabled(device)) | |
goto ret; | |
+ | |
ts = kgsl_readtimestamp(device, NULL, KGSL_TIMESTAMP_RETIRED); | |
/* If GPU HW status is idle return true */ | |
diff --git a/drivers/gpu/msm/adreno_snapshot.c b/drivers/gpu/msm/adreno_snapshot.c | |
index 4df4edd..a11c63d 100644 | |
--- a/drivers/gpu/msm/adreno_snapshot.c | |
+++ b/drivers/gpu/msm/adreno_snapshot.c | |
@@ -918,11 +918,6 @@ static int snapshot_ib(struct kgsl_device *device, void *snapshot, | |
header->ptbase = (__u32)obj->ptbase; | |
header->size = obj->dwords; | |
- /* Make sure memory is mapped */ | |
- if (obj->entry) | |
- src = (unsigned int *) | |
- kgsl_gpuaddr_to_vaddr(&obj->entry->memdesc, obj->gpuaddr); | |
- | |
/* Write the contents of the ib */ | |
for (i = 0; i < obj->dwords; i++, src++, dst++) { | |
*dst = *src; | |
diff --git a/drivers/gpu/msm/kgsl_device.h b/drivers/gpu/msm/kgsl_device.h | |
index 9df7926..582af93 100644 | |
--- a/drivers/gpu/msm/kgsl_device.h | |
+++ b/drivers/gpu/msm/kgsl_device.h | |
@@ -788,5 +788,4 @@ static inline void kgsl_mutex_unlock(struct mutex *mutex, atomic64_t *owner) | |
atomic64_set(owner, 0); | |
mutex_unlock(mutex); | |
} | |
- | |
#endif /* __KGSL_DEVICE_H */ | |
diff --git a/drivers/gpu/msm/kgsl_iommu.c b/drivers/gpu/msm/kgsl_iommu.c | |
old mode 100755 | |
new mode 100644 | |
index 8825198..c4fa8af | |
--- a/drivers/gpu/msm/kgsl_iommu.c | |
+++ b/drivers/gpu/msm/kgsl_iommu.c | |
@@ -517,7 +517,7 @@ static void kgsl_iommu_clk_disable_event(struct kgsl_device *device, void *data, | |
* Return - void | |
*/ | |
static void | |
- kgsl_iommu_disable_clk_on_ts(struct kgsl_mmu *mmu, | |
+kgsl_iommu_disable_clk_on_ts(struct kgsl_mmu *mmu, | |
unsigned int ts, int ctx_id) | |
{ | |
struct kgsl_iommu_disable_clk_param *param; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment