[Openchrome-devel] drm-openchrome: Branch 'drm-next-3.19' - 2 commits - drivers/gpu/drm

Kevin Brace kevinbrace at kemper.freedesktop.org
Wed Aug 30 17:51:39 UTC 2017


 drivers/gpu/drm/openchrome/ttm_gem.c       |   20 +++++++++-----
 drivers/gpu/drm/openchrome/via_drv.c       |    6 ++--
 drivers/gpu/drm/openchrome/via_drv.h       |   31 +++++++++++++---------
 drivers/gpu/drm/openchrome/via_fb.c        |    4 +-
 drivers/gpu/drm/openchrome/via_h1_cmdbuf.c |    7 ++---
 drivers/gpu/drm/openchrome/via_ioc32.c     |    6 ++--
 drivers/gpu/drm/openchrome/via_ttm.c       |   40 ++++++++++++++---------------
 7 files changed, 64 insertions(+), 50 deletions(-)

New commits:
commit 0054c2557244a4b55d6a6b3ced1fe71f76061275
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Wed Aug 30 10:50:18 2017 -0700

    Adjust ttm_gem_create input parameter list
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/drivers/gpu/drm/openchrome/ttm_gem.c b/drivers/gpu/drm/openchrome/ttm_gem.c
index a49380e40c20..971fadc1435e 100644
--- a/drivers/gpu/drm/openchrome/ttm_gem.c
+++ b/drivers/gpu/drm/openchrome/ttm_gem.c
@@ -79,19 +79,24 @@ int ttm_mmap(struct file *filp, struct vm_area_struct *vma)
 }
 
 struct drm_gem_object *
-ttm_gem_create(struct drm_device *dev, struct ttm_bo_device *bdev,
-	       enum ttm_bo_type origin, int types, bool interruptible,
-	       int byte_align, int page_align, unsigned long size)
+ttm_gem_create(struct drm_device *dev,
+		struct ttm_bo_device *bdev,
+		unsigned long size,
+		enum ttm_bo_type type,
+		uint32_t domains,
+		uint32_t byte_alignment,
+		uint32_t page_alignment,
+		bool interruptible)
 {
 	struct ttm_buffer_object *bo = NULL;
 	struct ttm_gem_object *obj;
 	int ret;
 
-	size = round_up(size, byte_align);
-	size = ALIGN(size, page_align);
+	size = round_up(size, byte_alignment);
+	size = ALIGN(size, page_alignment);
 
-	ret = via_bo_create(bdev, &bo, size, origin, types,
-				byte_align, page_align,
+	ret = via_bo_create(bdev, &bo, size, type, domains,
+				byte_alignment, page_alignment,
 				interruptible, NULL, NULL);
 	if (ret) {
 		DRM_ERROR("Failed to create buffer object\n");
diff --git a/drivers/gpu/drm/openchrome/via_drv.c b/drivers/gpu/drm/openchrome/via_drv.c
index 998130d28896..a332c70fba9c 100644
--- a/drivers/gpu/drm/openchrome/via_drv.c
+++ b/drivers/gpu/drm/openchrome/via_drv.c
@@ -199,9 +199,9 @@ static int via_dumb_create(struct drm_file *filp, struct drm_device *dev,
 
 	args->pitch = round_up(args->width * (args->bpp >> 3), 16);
 	args->size = args->pitch * args->height;
-	obj = ttm_gem_create(dev, &dev_priv->bdev, ttm_bo_type_device,
-			     TTM_PL_FLAG_VRAM, false, 16, PAGE_SIZE,
-			     args->size);
+	obj = ttm_gem_create(dev, &dev_priv->bdev, args->size,
+				ttm_bo_type_device, TTM_PL_FLAG_VRAM,
+				16, PAGE_SIZE, false);
 	if (IS_ERR(obj))
 		return PTR_ERR(obj);
 
diff --git a/drivers/gpu/drm/openchrome/via_drv.h b/drivers/gpu/drm/openchrome/via_drv.h
index e175833487dd..0ae0be53f822 100644
--- a/drivers/gpu/drm/openchrome/via_drv.h
+++ b/drivers/gpu/drm/openchrome/via_drv.h
@@ -278,12 +278,15 @@ extern int ttm_mmap(struct file *filp, struct vm_area_struct *vma);
 
 extern int ttm_gem_open_object(struct drm_gem_object *obj, struct drm_file *file_priv);
 extern void ttm_gem_free_object(struct drm_gem_object *obj);
-extern struct drm_gem_object *ttm_gem_create(struct drm_device *dev,
-                         struct ttm_bo_device *bdev,
-                         enum ttm_bo_type origin,
-                         int type, bool interruptible,
-                         int byte_align, int page_align,
-                         unsigned long size);
+extern struct drm_gem_object *
+ttm_gem_create(struct drm_device *dev,
+		struct ttm_bo_device *bdev,
+		unsigned long size,
+		enum ttm_bo_type type,
+		uint32_t domains,
+		uint32_t byte_alignment,
+		uint32_t page_alignment,
+		bool interruptible);
 extern struct ttm_buffer_object *ttm_gem_mapping(struct drm_gem_object *obj);
 
 extern struct ttm_tt *
diff --git a/drivers/gpu/drm/openchrome/via_fb.c b/drivers/gpu/drm/openchrome/via_fb.c
index 75b44e603af7..3b3cec909853 100644
--- a/drivers/gpu/drm/openchrome/via_fb.c
+++ b/drivers/gpu/drm/openchrome/via_fb.c
@@ -1073,9 +1073,9 @@ static int via_fb_probe(struct drm_fb_helper *helper,
 	size = mode_cmd.pitches[0] * mode_cmd.height;
 	size = ALIGN(size, PAGE_SIZE);
 
-	gem_obj = ttm_gem_create(helper->dev, &dev_priv->bdev,
+	gem_obj = ttm_gem_create(dev, &dev_priv->bdev, size,
 				ttm_bo_type_kernel, TTM_PL_FLAG_VRAM,
-				false, 1, PAGE_SIZE, size);
+				1, PAGE_SIZE, false);
 	if (unlikely(IS_ERR(gem_obj))) {
 		ret = PTR_ERR(gem_obj);
 		goto out_err;
diff --git a/drivers/gpu/drm/openchrome/via_ioc32.c b/drivers/gpu/drm/openchrome/via_ioc32.c
index 8b44bd4bb0df..9b4418dff690 100644
--- a/drivers/gpu/drm/openchrome/via_ioc32.c
+++ b/drivers/gpu/drm/openchrome/via_ioc32.c
@@ -66,9 +66,9 @@ via_gem_alloc(struct drm_device *dev, void *data,
 	struct drm_gem_object *obj;
 	int ret = -ENOMEM;
 
-	obj = ttm_gem_create(dev, &dev_priv->bdev, ttm_bo_type_device,
-			     args->domains, false, args->alignment,
-			     PAGE_SIZE, args->size);
+	obj = ttm_gem_create(dev, &dev_priv->bdev, args->size,
+				ttm_bo_type_device, args->domains,
+				args->alignment, PAGE_SIZE, false);
 	if (obj != NULL) {
 		ret = drm_gem_handle_create(filp, obj, &args->handle);
 		/* drop reference from allocate - handle holds it now */
commit 81764de585929cc4cc1476ba0500265b5480e125
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Wed Aug 30 10:47:34 2017 -0700

    Adjust via_bo_create input parameter list
    
    Renaming and changing the order to make it similar to ttm_bo_init.
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/drivers/gpu/drm/openchrome/ttm_gem.c b/drivers/gpu/drm/openchrome/ttm_gem.c
index b6a995b7af2e..a49380e40c20 100644
--- a/drivers/gpu/drm/openchrome/ttm_gem.c
+++ b/drivers/gpu/drm/openchrome/ttm_gem.c
@@ -90,8 +90,9 @@ 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_create(bdev, size, origin, types, byte_align,
-			      page_align, interruptible, NULL, NULL, &bo);
+	ret = via_bo_create(bdev, &bo, size, origin, types,
+				byte_align, page_align,
+				interruptible, NULL, NULL);
 	if (ret) {
 		DRM_ERROR("Failed to create buffer object\n");
 		return ERR_PTR(ret);
diff --git a/drivers/gpu/drm/openchrome/via_drv.h b/drivers/gpu/drm/openchrome/via_drv.h
index e9473e667a26..e175833487dd 100644
--- a/drivers/gpu/drm/openchrome/via_drv.h
+++ b/drivers/gpu/drm/openchrome/via_drv.h
@@ -257,12 +257,16 @@ void via_mm_fini(struct drm_device *dev);
 extern void ttm_placement_from_domain(struct ttm_buffer_object *bo,
                       struct ttm_placement *placement,
                       u32 domains, struct ttm_bo_device *bdev);
-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,
-               struct reservation_object *resv,
-               struct ttm_buffer_object **p_bo);
+extern int via_bo_create(struct ttm_bo_device *bdev,
+				struct ttm_buffer_object **p_bo,
+				unsigned long size,
+				enum ttm_bo_type type,
+				uint32_t domains,
+				uint32_t byte_alignment,
+				uint32_t page_alignment,
+				bool interruptible,
+				struct sg_table *sg,
+				struct reservation_object *resv);
 extern int via_bo_pin(struct ttm_buffer_object *bo, struct ttm_bo_kmap_obj *kmap);
 extern int via_bo_unpin(struct ttm_buffer_object *bo, struct ttm_bo_kmap_obj *kmap);
 extern int via_ttm_allocate_kernel_buffer(struct ttm_bo_device *bdev, unsigned long size,
diff --git a/drivers/gpu/drm/openchrome/via_h1_cmdbuf.c b/drivers/gpu/drm/openchrome/via_h1_cmdbuf.c
index fbd211b1c55f..0713785b3968 100644
--- a/drivers/gpu/drm/openchrome/via_h1_cmdbuf.c
+++ b/drivers/gpu/drm/openchrome/via_h1_cmdbuf.c
@@ -159,9 +159,10 @@ static int via_initialize(struct drm_device *dev,
 		return ret;
 	}
 
-	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);
+	ret = via_bo_create(&dev_priv->bdev, &bo, init->size,
+				ttm_bo_type_kernel, TTM_PL_FLAG_TT,
+				VIA_MM_ALIGN_SIZE, PAGE_SIZE,
+				false, NULL, NULL);
 	if (!ret) {
 		ret = via_bo_pin(bo, &dev_priv->dmabuf);
 		if (ret)
diff --git a/drivers/gpu/drm/openchrome/via_ttm.c b/drivers/gpu/drm/openchrome/via_ttm.c
index 259c3eba8428..3912f63dce1d 100644
--- a/drivers/gpu/drm/openchrome/via_ttm.c
+++ b/drivers/gpu/drm/openchrome/via_ttm.c
@@ -616,8 +616,8 @@ int via_mm_init(struct via_device *dev_priv)
         goto exit;
     }
 
-    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);
+    ret = via_bo_create(&dev_priv->bdev, &bo, VIA_MMIO_REGSIZE, ttm_bo_type_kernel,
+                        TTM_PL_FLAG_PRIV0, 1, PAGE_SIZE, false, NULL, NULL);
     if (ret) {
         DRM_ERROR("Failed to create a buffer object for MMIO: %d\n", ret);
         goto exit;
@@ -689,17 +689,16 @@ ttm_placement_from_domain(struct ttm_buffer_object *bo, struct ttm_placement *pl
     placement->placement = heap->placements;
 }
 
-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,
-        struct reservation_object *resv,
-        struct ttm_buffer_object **p_bo)
+int via_bo_create(struct ttm_bo_device *bdev,
+			struct ttm_buffer_object **p_bo,
+			unsigned long size,
+			enum ttm_bo_type type,
+			uint32_t domains,
+			uint32_t byte_alignment,
+			uint32_t page_alignment,
+			bool interruptible,
+			struct sg_table *sg,
+			struct reservation_object *resv)
 {
     struct ttm_buffer_object *bo = NULL;
     struct ttm_placement placement;
@@ -709,8 +708,8 @@ via_bo_create(struct ttm_bo_device *bdev,
 
     DRM_DEBUG("Entered via_bo_create.\n");
 
-    size = round_up(size, byte_align);
-    size = ALIGN(size, page_align);
+    size = round_up(size, byte_alignment);
+    size = ALIGN(size, page_alignment);
 
     heap = kzalloc(sizeof(struct ttm_heap), GFP_KERNEL);
     if (unlikely(!heap)) {
@@ -725,8 +724,8 @@ via_bo_create(struct ttm_bo_device *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,
+    ret = ttm_bo_init(bdev, bo, size, type, &placement,
+              page_alignment >> PAGE_SHIFT,
               interruptible, NULL, acc_size,
               sg, NULL, via_ttm_bo_destroy);
 
@@ -792,9 +791,10 @@ via_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_create(bdev, size, ttm_bo_type_kernel, domain,
-                  alignment, PAGE_SIZE, false, NULL,
-                  NULL, &kmap->bo);
+    int ret = via_bo_create(bdev, &kmap->bo, size,
+                            ttm_bo_type_kernel, domain,
+                            alignment, PAGE_SIZE,
+                            false, NULL, NULL);
     if (likely(!ret)) {
         ret = via_bo_pin(kmap->bo, kmap);
         if (unlikely(ret)) {


More information about the Openchrome-devel mailing list