[openchrome-devel] drm-openchrome: Branch 'drm-next-4.21' - 5 commits - drivers/gpu/drm

Kevin Brace kevinbrace at kemper.freedesktop.org
Thu Jan 10 14:12:23 UTC 2019


 drivers/gpu/drm/openchrome/openchrome_crtc.c  |    2 
 drivers/gpu/drm/openchrome/openchrome_drv.c   |    4 -
 drivers/gpu/drm/openchrome/openchrome_drv.h   |    7 --
 drivers/gpu/drm/openchrome/openchrome_fb.c    |    8 +-
 drivers/gpu/drm/openchrome/openchrome_ioc32.c |    6 +-
 drivers/gpu/drm/openchrome/openchrome_ttm.c   |   76 --------------------------
 6 files changed, 12 insertions(+), 91 deletions(-)

New commits:
commit b4c23d69ee745a6d10b222bfa502780317b23a96
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Thu Jan 10 08:06:00 2019 -0600

    drm/openchrome: Version bumped to 3.1.3
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/drivers/gpu/drm/openchrome/openchrome_drv.h b/drivers/gpu/drm/openchrome/openchrome_drv.h
index 7ce318cb612b..84707a9e1069 100644
--- a/drivers/gpu/drm/openchrome/openchrome_drv.h
+++ b/drivers/gpu/drm/openchrome/openchrome_drv.h
@@ -51,10 +51,10 @@
 
 #define DRIVER_MAJOR		3
 #define DRIVER_MINOR		1
-#define DRIVER_PATCHLEVEL	2
+#define DRIVER_PATCHLEVEL	3
 #define DRIVER_NAME		"openchrome"
 #define DRIVER_DESC		"OpenChrome DRM for VIA Technologies Chrome IGP"
-#define DRIVER_DATE		"20190107"
+#define DRIVER_DATE		"20190110"
 #define DRIVER_AUTHOR		"OpenChrome Project"
 
 
commit 2e4813dd6fbfb2584e34d7bca180233eb6ae9907
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Thu Jan 10 08:03:15 2019 -0600

    drm/openchrome: Do not include <drm/drm_global.h>
    
    Due to commit 2bb42410b1bd324912389c6ac748df1c1befd69f by Thomas
    Zimmermann, the main header file should not be including drm_global.h.
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/drivers/gpu/drm/openchrome/openchrome_drv.h b/drivers/gpu/drm/openchrome/openchrome_drv.h
index 162511438b3d..7ce318cb612b 100644
--- a/drivers/gpu/drm/openchrome/openchrome_drv.h
+++ b/drivers/gpu/drm/openchrome/openchrome_drv.h
@@ -37,7 +37,6 @@
 #include <video/vga.h>
 
 #include <drm/drmP.h>
-#include <drm/drm_global.h>
 #include <drm/drm_gem.h>
 
 #include "ttm/ttm_bo_api.h"
commit 22865bf8df231901ef20e3b1144b17f7fe486d4d
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Thu Jan 10 08:02:51 2019 -0600

    drm/openchrome: Initialize globals during device init
    
    Based on commit a64f784bb14a56bfdfad2dc397dd67e4564e3a29 by Christian
    König. Make sure that the global BO state is always correctly initialized.
    This allows removing all the device code to initialize it.
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/drivers/gpu/drm/openchrome/openchrome_drv.h b/drivers/gpu/drm/openchrome/openchrome_drv.h
index 0093d9649f6d..162511438b3d 100644
--- a/drivers/gpu/drm/openchrome/openchrome_drv.h
+++ b/drivers/gpu/drm/openchrome/openchrome_drv.h
@@ -98,7 +98,6 @@ struct via_state {
 };
 
 struct via_ttm {
-	struct ttm_bo_global_ref bo_global_ref;
 	struct ttm_bo_device bdev;
 };
 
diff --git a/drivers/gpu/drm/openchrome/openchrome_ttm.c b/drivers/gpu/drm/openchrome/openchrome_ttm.c
index 13e99542f61f..b2426d8bf7e3 100644
--- a/drivers/gpu/drm/openchrome/openchrome_ttm.c
+++ b/drivers/gpu/drm/openchrome/openchrome_ttm.c
@@ -31,42 +31,6 @@
 
 #define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT)
 
-static int via_ttm_global_init(
-			struct openchrome_drm_private *dev_private)
-{
-	struct drm_global_reference *bo_ref;
-	int rc;
-
-	bo_ref = &dev_private->ttm.bo_global_ref.ref;
-	bo_ref->global_type = DRM_GLOBAL_TTM_BO;
-	bo_ref->size = sizeof(struct ttm_bo_global);
-	bo_ref->init = &ttm_bo_global_init;
-	bo_ref->release = &ttm_bo_global_release;
-
-	rc = drm_global_item_ref(bo_ref);
-	if (unlikely(rc != 0)) {
-		DRM_ERROR("Failed setting up TTM BO subsystem\n");
-		return rc;
-	}
-
-	return rc;
-}
-
-static void via_ttm_global_release(struct drm_global_reference *global_ref,
-				struct ttm_bo_global_ref *global_bo,
-				struct ttm_bo_device *bdev)
-{
-	DRM_DEBUG_KMS("Entered %s.\n", __func__);
-
-	if (global_bo->ref.release == NULL)
-		return;
-
-	drm_global_item_unref(&global_bo->ref);
-	global_bo->ref.release == NULL;
-
-	DRM_DEBUG_KMS("Exiting %s.\n", __func__);
-}
-
 static void via_ttm_bo_destroy(struct ttm_buffer_object *bo)
 {
 	struct ttm_heap *heap = container_of(bo, struct ttm_heap, bo);
@@ -251,16 +215,9 @@ int via_mm_init(struct openchrome_drm_private *dev_private)
 
 	DRM_DEBUG_KMS("Entered %s.\n", __func__);
 
-	ret = via_ttm_global_init(dev_private);
-	if (ret) {
-		DRM_ERROR("Failed to initialise TTM: %d\n", ret);
-		goto exit;
-	}
-
 	dev_private->ttm.bdev.dev_mapping = dev->anon_inode->i_mapping;
 
 	ret = ttm_bo_device_init(&dev_private->ttm.bdev,
-				dev_private->ttm.bo_global_ref.ref.object,
 				&via_bo_driver,
 				dev->anon_inode->i_mapping,
 				DRM_FILE_PAGE_OFFSET,
@@ -290,10 +247,6 @@ void via_mm_fini(struct drm_device *dev)
 
 	ttm_bo_device_release(&dev_private->ttm.bdev);
 
-	via_ttm_global_release(&dev_private->ttm.mem_global_ref,
-				&dev_private->ttm.bo_global_ref,
-				&dev_private->ttm.bdev);
-
 	DRM_DEBUG_KMS("Exiting %s.\n", __func__);
 }
 
commit 0821961bd54ed676053a544373e5e5c574ac333f
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Thu Jan 10 08:02:28 2019 -0600

    drm/openchrome: Use a static ttm_mem_global instance
    
    Based on commit 27eb1fa9130a98edd2b321d4dbce5c8b244ee7af by Christian
    König. As the name says we only need one global instance of
    ttm_mem_global. Drop all the driver initialization and just use a single
    exported instance which is initialized during BO global initialization.
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/drivers/gpu/drm/openchrome/openchrome_drv.h b/drivers/gpu/drm/openchrome/openchrome_drv.h
index cfcc5e71afcf..0093d9649f6d 100644
--- a/drivers/gpu/drm/openchrome/openchrome_drv.h
+++ b/drivers/gpu/drm/openchrome/openchrome_drv.h
@@ -98,7 +98,6 @@ struct via_state {
 };
 
 struct via_ttm {
-	struct drm_global_reference mem_global_ref;
 	struct ttm_bo_global_ref bo_global_ref;
 	struct ttm_bo_device bdev;
 };
diff --git a/drivers/gpu/drm/openchrome/openchrome_ttm.c b/drivers/gpu/drm/openchrome/openchrome_ttm.c
index a89c494c949a..13e99542f61f 100644
--- a/drivers/gpu/drm/openchrome/openchrome_ttm.c
+++ b/drivers/gpu/drm/openchrome/openchrome_ttm.c
@@ -31,38 +31,12 @@
 
 #define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT)
 
-static int via_ttm_mem_global_init(struct drm_global_reference *ref)
-{
-	return ttm_mem_global_init(ref->object);
-}
-
-static void via_ttm_mem_global_release(struct drm_global_reference *ref)
-{
-	ttm_mem_global_release(ref->object);
-}
-
 static int via_ttm_global_init(
 			struct openchrome_drm_private *dev_private)
 {
-	struct drm_global_reference *global_ref;
 	struct drm_global_reference *bo_ref;
 	int rc;
 
-	global_ref = &dev_private->ttm.mem_global_ref;
-	global_ref->global_type = DRM_GLOBAL_TTM_MEM;
-	global_ref->size = sizeof(struct ttm_mem_global);
-	global_ref->init = &via_ttm_mem_global_init;
-	global_ref->release = &via_ttm_mem_global_release;
-
-	rc = drm_global_item_ref(global_ref);
-	if (unlikely(rc != 0)) {
-		DRM_ERROR("Failed setting up TTM memory accounting\n");
-		global_ref->release = NULL;
-		return rc;
-	}
-
-	dev_private->ttm.bo_global_ref.mem_glob =
-				dev_private->ttm.mem_global_ref.object;
 	bo_ref = &dev_private->ttm.bo_global_ref.ref;
 	bo_ref->global_type = DRM_GLOBAL_TTM_BO;
 	bo_ref->size = sizeof(struct ttm_bo_global);
@@ -72,8 +46,6 @@ static int via_ttm_global_init(
 	rc = drm_global_item_ref(bo_ref);
 	if (unlikely(rc != 0)) {
 		DRM_ERROR("Failed setting up TTM BO subsystem\n");
-		drm_global_item_unref(global_ref);
-		global_ref->release = NULL;
 		return rc;
 	}
 
@@ -86,12 +58,11 @@ static void via_ttm_global_release(struct drm_global_reference *global_ref,
 {
 	DRM_DEBUG_KMS("Entered %s.\n", __func__);
 
-	if (global_ref->release == NULL)
+	if (global_bo->ref.release == NULL)
 		return;
 
 	drm_global_item_unref(&global_bo->ref);
-	drm_global_item_unref(global_ref);
-	global_ref->release = NULL;
+	global_bo->ref.release == NULL;
 
 	DRM_DEBUG_KMS("Exiting %s.\n", __func__);
 }
commit 8aecdafabdf387b946a63d327a66c551120583ea
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Thu Jan 10 08:01:51 2019 -0600

    drm/openchrome: Replace drm_gem_object_unreference_* with put functions
    
    Based on commit 3ce11806c0ba279b5893bb9eb1d193e1acbef7b6 by Thomas
    Zimmermann. This patch unifies the naming of DRM functions for
    reference counting of struct drm_gem_object. The resulting code is more
    aligned with the rest of the Linux kernel interfaces.
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/drivers/gpu/drm/openchrome/openchrome_crtc.c b/drivers/gpu/drm/openchrome/openchrome_crtc.c
index 9b6e87e45181..2a0ab4a08800 100644
--- a/drivers/gpu/drm/openchrome/openchrome_crtc.c
+++ b/drivers/gpu/drm/openchrome/openchrome_crtc.c
@@ -333,7 +333,7 @@ static int via_crtc_cursor_set(struct drm_crtc *crtc,
 		}
 		ttm_bo_kunmap(&user_kmap);
 	}
-	drm_gem_object_unreference_unlocked(obj);
+	drm_gem_object_put_unlocked(obj);
 	via_cursor_address(crtc);
 	via_show_cursor(crtc);
 
diff --git a/drivers/gpu/drm/openchrome/openchrome_drv.c b/drivers/gpu/drm/openchrome/openchrome_drv.c
index 62e31e357890..76f1442a85cb 100644
--- a/drivers/gpu/drm/openchrome/openchrome_drv.c
+++ b/drivers/gpu/drm/openchrome/openchrome_drv.c
@@ -70,7 +70,7 @@ static int via_dumb_create(struct drm_file *filp,
 
 	ret = drm_gem_handle_create(filp, obj, &args->handle);
 	/* drop reference from allocate - handle holds it now */
-	drm_gem_object_unreference_unlocked(obj);
+	drm_gem_object_put_unlocked(obj);
 
 	DRM_DEBUG_KMS("Exiting %s.\n", __func__);
 	return ret;
@@ -94,7 +94,7 @@ static int via_dumb_mmap(struct drm_file *filp, struct drm_device *dev,
 		*offset_p = drm_vma_node_offset_addr(&bo->vma_node);
 		rc = 0;
 	}
-	drm_gem_object_unreference_unlocked(obj);
+	drm_gem_object_put_unlocked(obj);
 
 	DRM_DEBUG_KMS("Exiting %s.\n", __func__);
 	return rc;
diff --git a/drivers/gpu/drm/openchrome/openchrome_fb.c b/drivers/gpu/drm/openchrome/openchrome_fb.c
index a9fcc179843e..0ad043ead05a 100644
--- a/drivers/gpu/drm/openchrome/openchrome_fb.c
+++ b/drivers/gpu/drm/openchrome/openchrome_fb.c
@@ -966,7 +966,7 @@ via_user_framebuffer_destroy(struct drm_framebuffer *fb)
 	struct drm_gem_object *gem_obj = via_fb->gem_obj;
 
 	if (gem_obj) {
-		drm_gem_object_unreference_unlocked(gem_obj);
+		drm_gem_object_put_unlocked(gem_obj);
 		via_fb->gem_obj = NULL;
 	}
 
@@ -1013,7 +1013,7 @@ via_user_framebuffer_create(struct drm_device *dev,
 	drm_helper_mode_fill_fb_struct(dev, &via_fb->fb, mode_cmd);
 	ret = drm_framebuffer_init(dev, &via_fb->fb, &via_fb_funcs);
 	if (ret) {
-		drm_gem_object_unreference(gem_obj);
+		drm_gem_object_put(gem_obj);
 		kfree(via_fb);
 		return ERR_PTR(ret);
 	}
@@ -1181,7 +1181,7 @@ out_err:
 	}
 
 	if (gem_obj) {
-		drm_gem_object_unreference_unlocked(gem_obj);
+		drm_gem_object_put_unlocked(gem_obj);
 		via_fb->gem_obj = NULL;
 	}
 exit:
@@ -1265,7 +1265,7 @@ void via_fbdev_fini(struct drm_device *dev)
 	}
 
 	if (via_fb->gem_obj) {
-		drm_gem_object_unreference_unlocked(via_fb->gem_obj);
+		drm_gem_object_put_unlocked(via_fb->gem_obj);
 		via_fb->gem_obj = NULL;
 	}
 
diff --git a/drivers/gpu/drm/openchrome/openchrome_ioc32.c b/drivers/gpu/drm/openchrome/openchrome_ioc32.c
index d38f4fce3ab6..3ec4cafcabcc 100644
--- a/drivers/gpu/drm/openchrome/openchrome_ioc32.c
+++ b/drivers/gpu/drm/openchrome/openchrome_ioc32.c
@@ -74,7 +74,7 @@ via_gem_alloc(struct drm_device *dev, void *data,
 	if (obj != NULL) {
 		ret = drm_gem_handle_create(filp, obj, &args->handle);
 		/* drop reference from allocate - handle holds it now */
-		drm_gem_object_unreference_unlocked(obj);
+		drm_gem_object_put_unlocked(obj);
 		if (!ret) {
 			struct ttm_buffer_object *bo = ttm_gem_mapping(obj);
 
@@ -126,7 +126,7 @@ via_gem_state(struct drm_device *dev, void *data, struct drm_file *file_priv)
 		}
 	}
 	mutex_lock(&dev->struct_mutex);
-	drm_gem_object_unreference(obj);
+	drm_gem_object_put(obj);
 	mutex_unlock(&dev->struct_mutex);
 	return ret;
 }
@@ -157,7 +157,7 @@ via_gem_wait(struct drm_device *dev, void *data, struct drm_file *file_priv)
 	ttm_bo_unreserve(bo);
 
 	mutex_lock(&dev->struct_mutex);
-	drm_gem_object_unreference(obj);
+	drm_gem_object_put(obj);
 	mutex_unlock(&dev->struct_mutex);
 	return ret;
 }


More information about the openchrome-devel mailing list