All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] drm/ttm: allow zero sized kernel allocations
@ 2014-08-07 14:30 Christian König
  2014-08-07 14:30 ` [PATCH 2/2] drm/radeon: allow zero sized BOs for fences Christian König
  0 siblings, 1 reply; 4+ messages in thread
From: Christian König @ 2014-08-07 14:30 UTC (permalink / raw)
  To: dri-devel

From: Christian König <christian.koenig@amd.com>

This patch allows to create zero sized TTM buffer
objects for driver internal use.

Signed-off-by: Christian König <christian.koenig@amd.com>
---
 drivers/gpu/drm/ttm/ttm_bo.c      | 4 ++--
 drivers/gpu/drm/ttm/ttm_bo_util.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index 3da89d5..0b96a3b 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -309,7 +309,7 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo,
 		if (ret)
 			goto out_err;
 
-		if (mem->mem_type != TTM_PL_SYSTEM) {
+		if (bo->ttm->num_pages && mem->mem_type != TTM_PL_SYSTEM) {
 			ret = ttm_tt_bind(bo->ttm, mem);
 			if (ret)
 				goto out_err;
@@ -1107,7 +1107,7 @@ int ttm_bo_init(struct ttm_bo_device *bdev,
 	}
 
 	num_pages = (size + PAGE_SIZE - 1) >> PAGE_SHIFT;
-	if (num_pages == 0) {
+	if (type != ttm_bo_type_kernel && num_pages == 0) {
 		pr_err("Illegal buffer object size\n");
 		if (destroy)
 			(*destroy)(bo);
diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
index 30e5d90..8354195 100644
--- a/drivers/gpu/drm/ttm/ttm_bo_util.c
+++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
@@ -63,7 +63,7 @@ int ttm_bo_move_ttm(struct ttm_buffer_object *bo,
 	if (unlikely(ret != 0))
 		return ret;
 
-	if (new_mem->mem_type != TTM_PL_SYSTEM) {
+	if (ttm->num_pages && new_mem->mem_type != TTM_PL_SYSTEM) {
 		ret = ttm_tt_bind(ttm, new_mem);
 		if (unlikely(ret != 0))
 			return ret;
-- 
1.9.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-08-07 15:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-07 14:30 [PATCH 1/2] drm/ttm: allow zero sized kernel allocations Christian König
2014-08-07 14:30 ` [PATCH 2/2] drm/radeon: allow zero sized BOs for fences Christian König
2014-08-07 15:01   ` Jerome Glisse
2014-08-07 15:52     ` Christian König

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.