diff mbox

[2/2] drm/radeon: use zero sized BOs for fences v2

Message ID 1407846732-2377-2-git-send-email-deathsimple@vodafone.de (mailing list archive)
State New, archived
Headers show

Commit Message

Christian König Aug. 12, 2014, 12:32 p.m. UTC
From: Christian König <christian.koenig@amd.com>

This patch allows userspace to created zero sized buffers
for use as pure synchronization object.

Signed-off-by: Christian König <christian.koenig@amd.com>
---
 drivers/gpu/drm/radeon/radeon_drv.c    | 3 ++-
 drivers/gpu/drm/radeon/radeon_object.c | 2 +-
 drivers/gpu/drm/radeon/radeon_vm.c     | 3 +++
 3 files changed, 6 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
index 86d6b56..5ec6273 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -84,9 +84,10 @@ 
  *   2.39.0 - Add INFO query for number of active CUs
  *   2.40.0 - Add RADEON_GEM_GTT_WC/UC, flush HDP cache before submitting
  *            CS to GPU
+ *   2.41.0 - Allow zero sized BOs
  */
 #define KMS_DRIVER_MAJOR	2
-#define KMS_DRIVER_MINOR	40
+#define KMS_DRIVER_MINOR	41
 #define KMS_DRIVER_PATCHLEVEL	0
 int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags);
 int radeon_driver_unload_kms(struct drm_device *dev);
diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c
index 480c87d..9dd670e 100644
--- a/drivers/gpu/drm/radeon/radeon_object.c
+++ b/drivers/gpu/drm/radeon/radeon_object.c
@@ -154,7 +154,7 @@  int radeon_bo_create(struct radeon_device *rdev,
 
 	size = ALIGN(size, PAGE_SIZE);
 
-	if (kernel) {
+	if (kernel || size == 0) {
 		type = ttm_bo_type_kernel;
 	} else if (sg) {
 		type = ttm_bo_type_sg;
diff --git a/drivers/gpu/drm/radeon/radeon_vm.c b/drivers/gpu/drm/radeon/radeon_vm.c
index 058f200..b2c336a 100644
--- a/drivers/gpu/drm/radeon/radeon_vm.c
+++ b/drivers/gpu/drm/radeon/radeon_vm.c
@@ -883,6 +883,9 @@  int radeon_vm_bo_update(struct radeon_device *rdev,
 	uint32_t flags;
 	int r;
 
+	if (bo_va->bo && radeon_bo_size(bo_va->bo) == 0)
+		return 0;
+
 	if (!bo_va->it.start) {
 		dev_err(rdev->dev, "bo %p don't has a mapping in vm %p\n",
 			bo_va->bo, vm);