Skip to content

Instantly share code, notes, and snippets.

@invisiblek
Created March 28, 2015 14:55
Show Gist options
  • Save invisiblek/663f6a3c66c4ea8313da to your computer and use it in GitHub Desktop.
Save invisiblek/663f6a3c66c4ea8313da to your computer and use it in GitHub Desktop.
diff --git a/drivers/gpu/ion/ion_page_pool.c b/drivers/gpu/ion/ion_page_pool.c
index 9e7d0c2..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 {
@@ -107,13 +106,13 @@ void *ion_page_pool_alloc(struct ion_page_pool *pool, bool *from_pool)
*from_pool = true;
- 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);
-
+ 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;
@@ -147,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);
@@ -159,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_system_heap.c b/drivers/gpu/ion/ion_system_heap.c
index faa9060..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)
{
@@ -473,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
index 8825198..c4fa8af 100755
--- 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