[Openchrome-devel] drm-openchrome: 4 commits - drivers/gpu/drm

Kevin Brace kevinbrace at kemper.freedesktop.org
Mon Jan 16 20:07:59 UTC 2017


 drivers/gpu/drm/via/init_ttm.c      |   38 ++++++++++++++++++++++++------------
 drivers/gpu/drm/via/ttm_gem.c       |    2 -
 drivers/gpu/drm/via/via_drv.c       |    2 -
 drivers/gpu/drm/via/via_drv.h       |    4 +--
 drivers/gpu/drm/via/via_h1_cmdbuf.c |    2 -
 drivers/gpu/drm/via/via_mem.h       |    2 -
 6 files changed, 32 insertions(+), 18 deletions(-)

New commits:
commit b5bb0e1f3ace721de541841271e995dc7eb3830e
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Mon Jan 16 14:07:30 2017 -0600

    Version bumped to 3.0.11
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/drivers/gpu/drm/via/via_drv.h b/drivers/gpu/drm/via/via_drv.h
index 3f6788c..85219a7 100644
--- a/drivers/gpu/drm/via/via_drv.h
+++ b/drivers/gpu/drm/via/via_drv.h
@@ -27,11 +27,11 @@
 #define DRIVER_AUTHOR       "The OpenChrome Project"
 #define DRIVER_NAME         "via"
 #define DRIVER_DESC         "OpenChrome DRM for VIA Technologies Chrome IGP"
-#define DRIVER_DATE         "20170102"
+#define DRIVER_DATE         "20170116"
 
 #define DRIVER_MAJOR		3
 #define DRIVER_MINOR		0
-#define DRIVER_PATCHLEVEL	10
+#define DRIVER_PATCHLEVEL	11
 
 #include <linux/module.h>
 
commit ea70c1cc20fe6524aa190e682b74adba84edd6e4
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Mon Jan 16 14:06:18 2017 -0600

    Improved the error handling of via_bo_create
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/drivers/gpu/drm/via/init_ttm.c b/drivers/gpu/drm/via/init_ttm.c
index 2d7c71b..a6f041e 100644
--- a/drivers/gpu/drm/via/init_ttm.c
+++ b/drivers/gpu/drm/via/init_ttm.c
@@ -158,12 +158,16 @@ via_bo_create(struct ttm_bo_device *bdev,
 	size_t acc_size;
 	int ret = -ENOMEM;
 
+    DRM_DEBUG("Entered via_bo_create.\n");
+
 	size = round_up(size, byte_align);
 	size = ALIGN(size, page_align);
 
 	heap = kzalloc(sizeof(struct ttm_heap), GFP_KERNEL);
-	if (unlikely(!heap))
-		return ret;
+    if (unlikely(!heap)) {
+        DRM_ERROR("Failed to allocate kernel memory.");
+        goto exit;
+    }
 
 	bo = &heap->pbo;
 
@@ -176,10 +180,18 @@ via_bo_create(struct ttm_bo_device *bdev,
 			  page_align >> PAGE_SHIFT,
 			  interruptible, NULL, acc_size,
 			  sg, NULL, ttm_buffer_object_destroy);
-	if (unlikely(ret))
-		kfree(heap);
-	else
-		*p_bo = bo;
+
+    if (unlikely(ret)) {
+        DRM_ERROR("Failed to initialize a TTM Buffer Object.");
+        goto error;
+    }
+
+	*p_bo = bo;
+	goto exit;
+error:
+    kfree(heap);
+exit:
+    DRM_DEBUG("Exiting via_bo_create.\n");
 	return ret;
 }
 
commit fef5aebccb451ecdf60d6e87a5b40206d268cf27
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Mon Jan 16 14:04:18 2017 -0600

    Minor tweaks to via_bo_create
    
    Making the code more common with Matrox G200 DRM and Cirrus Logic DRM.
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/drivers/gpu/drm/via/init_ttm.c b/drivers/gpu/drm/via/init_ttm.c
index c85b083..2d7c71b 100644
--- a/drivers/gpu/drm/via/init_ttm.c
+++ b/drivers/gpu/drm/via/init_ttm.c
@@ -152,16 +152,16 @@ via_bo_create(struct ttm_bo_device *bdev,
 		struct reservation_object *resv,
 		struct ttm_buffer_object **p_bo)
 {
-	unsigned long acc_size = sizeof(struct ttm_heap);
 	struct ttm_buffer_object *bo = NULL;
 	struct ttm_placement placement;
 	struct ttm_heap *heap;
+	size_t acc_size;
 	int ret = -ENOMEM;
 
 	size = round_up(size, byte_align);
 	size = ALIGN(size, page_align);
 
-	heap = kzalloc(acc_size, GFP_KERNEL);
+	heap = kzalloc(sizeof(struct ttm_heap), GFP_KERNEL);
 	if (unlikely(!heap))
 		return ret;
 
@@ -169,10 +169,12 @@ via_bo_create(struct ttm_bo_device *bdev,
 
 	ttm_placement_from_domain(bo, &placement, domains, bdev);
 
+	acc_size = ttm_bo_dma_acc_size(bdev, size,
+	                                sizeof(struct ttm_heap));
+
 	ret = ttm_bo_init(bdev, bo, size, origin, &placement,
 			  page_align >> PAGE_SHIFT,
-			  interruptible, NULL,
-			  ttm_bo_dma_acc_size(bdev, size, acc_size),
+			  interruptible, NULL, acc_size,
 			  sg, NULL, ttm_buffer_object_destroy);
 	if (unlikely(ret))
 		kfree(heap);
commit 012e6f88a63730fdf8f8f82ffa8ba9b4680e9daf
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Mon Jan 16 14:00:41 2017 -0600

    Changed via_bo_allocate to via_bo_create
    
    After reading AMD Radeon DRM and Matrox G200 DRM, they call it
    (Chip Vendor)_bo_create for a function OpenChrome DRM calls it
    via_bo_allocate. We will go along with their style of naming
    functions.
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/drivers/gpu/drm/via/init_ttm.c b/drivers/gpu/drm/via/init_ttm.c
index 0b712b6..c85b083 100644
--- a/drivers/gpu/drm/via/init_ttm.c
+++ b/drivers/gpu/drm/via/init_ttm.c
@@ -141,7 +141,7 @@ ttm_placement_from_domain(struct ttm_buffer_object *bo, struct ttm_placement *pl
 }
 
 int
-via_bo_allocate(struct ttm_bo_device *bdev,
+via_bo_create(struct ttm_bo_device *bdev,
 		unsigned long size,
 		enum ttm_bo_type origin,
 		uint32_t domains,
@@ -229,7 +229,7 @@ ttm_allocate_kernel_buffer(struct ttm_bo_device *bdev, unsigned long size,
 				uint32_t alignment, uint32_t domain,
 				struct ttm_bo_kmap_obj *kmap)
 {
-	int ret = via_bo_allocate(bdev, size, ttm_bo_type_kernel, domain,
+	int ret = via_bo_create(bdev, size, ttm_bo_type_kernel, domain,
 				  alignment, PAGE_SIZE, false, NULL,
 				  NULL, &kmap->bo);
 	if (likely(!ret)) {
diff --git a/drivers/gpu/drm/via/ttm_gem.c b/drivers/gpu/drm/via/ttm_gem.c
index aa46773..5dc50a1 100644
--- a/drivers/gpu/drm/via/ttm_gem.c
+++ b/drivers/gpu/drm/via/ttm_gem.c
@@ -95,7 +95,7 @@ ttm_gem_create(struct drm_device *dev, struct ttm_bo_device *bdev,
 	size = round_up(size, byte_align);
 	size = ALIGN(size, page_align);
 
-	ret = via_bo_allocate(bdev, size, origin, types, byte_align,
+	ret = via_bo_create(bdev, size, origin, types, byte_align,
 			      page_align, interruptible, NULL, NULL, &bo);
 	if (ret) {
 		DRM_ERROR("Failed to create buffer object\n");
diff --git a/drivers/gpu/drm/via/via_drv.c b/drivers/gpu/drm/via/via_drv.c
index f7ab710..744b639 100644
--- a/drivers/gpu/drm/via/via_drv.c
+++ b/drivers/gpu/drm/via/via_drv.c
@@ -151,7 +151,7 @@ via_mmio_setup(struct drm_device *dev)
 	if (ret)
 		return ret;
 
-	ret = via_bo_allocate(&dev_priv->bdev, VIA_MMIO_REGSIZE, ttm_bo_type_kernel,
+	ret = via_bo_create(&dev_priv->bdev, VIA_MMIO_REGSIZE, ttm_bo_type_kernel,
 			      TTM_PL_FLAG_PRIV0, 1, PAGE_SIZE, false, NULL, NULL, &bo);
 	if (ret)
 		goto err;
diff --git a/drivers/gpu/drm/via/via_h1_cmdbuf.c b/drivers/gpu/drm/via/via_h1_cmdbuf.c
index 92bf0a3..efcb830 100644
--- a/drivers/gpu/drm/via/via_h1_cmdbuf.c
+++ b/drivers/gpu/drm/via/via_h1_cmdbuf.c
@@ -159,7 +159,7 @@ static int via_initialize(struct drm_device *dev,
 		return ret;
 	}
 
-	ret = via_bo_allocate(&dev_priv->bdev, init->size, ttm_bo_type_kernel,
+	ret = via_bo_create(&dev_priv->bdev, init->size, ttm_bo_type_kernel,
 				TTM_PL_FLAG_TT, VIA_MM_ALIGN_SIZE, PAGE_SIZE,
 				false, NULL, NULL, &bo);
 	if (!ret) {
diff --git a/drivers/gpu/drm/via/via_mem.h b/drivers/gpu/drm/via/via_mem.h
index 4641dc2..ce8441f 100644
--- a/drivers/gpu/drm/via/via_mem.h
+++ b/drivers/gpu/drm/via/via_mem.h
@@ -50,7 +50,7 @@ extern void ttm_global_fini(struct drm_global_reference *global_ref,
 			    struct ttm_bo_global_ref *global_bo,
 			    struct ttm_bo_device *bdev);
 
-extern int via_bo_allocate(struct ttm_bo_device *bdev, unsigned long size,
+extern int via_bo_create(struct ttm_bo_device *bdev, unsigned long size,
 			   enum ttm_bo_type origin, uint32_t domains,
 			   uint32_t byte_align, uint32_t page_align,
 			   bool interruptible, struct sg_table *sg,


More information about the Openchrome-devel mailing list