[openchrome-devel] drm-openchrome: Branch 'drm-next-5.5' - 3 commits - drivers/gpu/drm

Kevin Brace kevinbrace at kemper.freedesktop.org
Wed Oct 9 20:26:02 UTC 2019


 drivers/gpu/drm/openchrome/openchrome_crtc.c    |   51 ++++++++++--------------
 drivers/gpu/drm/openchrome/openchrome_display.c |   24 ++---------
 drivers/gpu/drm/openchrome/openchrome_display.h |    3 -
 drivers/gpu/drm/openchrome/openchrome_drv.h     |    9 ++--
 4 files changed, 35 insertions(+), 52 deletions(-)

New commits:
commit 8a2ced05cc2c6d06d1018b5fe78f77241db0b3a1
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Wed Oct 9 13:24:25 2019 -0700

    drm/openchrome: Version bumped to 3.1.16
    
    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 6d849d111d7d..a287c9629cad 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	15
+#define DRIVER_PATCHLEVEL	16
 #define DRIVER_NAME		"openchrome"
 #define DRIVER_DESC		"OpenChrome DRM for VIA Technologies Chrome IGP"
-#define DRIVER_DATE		"20190929"
+#define DRIVER_DATE		"20191009"
 #define DRIVER_AUTHOR		"OpenChrome Project"
 
 
commit 1be30f71608a7a9b3008381b7f48613cfb7accb9
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Wed Oct 9 13:11:24 2019 -0700

    drm/openchrome: Allocate primary plane struct storage dynamically
    
    This is what the universal plane helper functions expect.
    openchrome_plane_init() will be discontinued.
    
    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 79170a8a6198..02642c09e15b 100644
--- a/drivers/gpu/drm/openchrome/openchrome_crtc.c
+++ b/drivers/gpu/drm/openchrome/openchrome_crtc.c
@@ -2497,20 +2497,32 @@ static const struct drm_plane_helper_funcs
 openchrome_drm_plane_helper_funcs = {
 };
 
-int openchrome_plane_init(struct drm_device *dev, uint32_t index)
+int via_crtc_init(struct drm_device *dev, uint32_t index)
 {
 	struct openchrome_drm_private *dev_private =
 						dev->dev_private;
+	struct via_crtc *iga = &dev_private->iga[index];
 	struct drm_plane *primary;
+	struct drm_crtc *crtc = &iga->base;
+	uint32_t possible_crtcs;
+	int cursor_size = 64 * 64 * 4, i;
+	u16 *gamma;
 	int ret;
 
-	DRM_DEBUG_KMS("Entered %s.\n", __func__);
+	iga->index = index;
 
-	primary = &dev_private->primary[index];
+	possible_crtcs = 1 << index;
+
+	primary = kzalloc(sizeof(struct drm_plane), GFP_KERNEL);
+	if (!primary) {
+		ret = -ENOMEM;
+		DRM_ERROR("Failed to allocate a primary plane.\n");
+		goto exit;
+	}
 
 	drm_plane_helper_add(primary,
 			&openchrome_drm_plane_helper_funcs);
-	ret = drm_universal_plane_init(dev, primary, 0,
+	ret = drm_universal_plane_init(dev, primary, possible_crtcs,
 			&drm_primary_helper_funcs,
 			openchrome_drm_plane_format,
 			ARRAY_SIZE(openchrome_drm_plane_format),
@@ -2521,28 +2533,6 @@ int openchrome_plane_init(struct drm_device *dev, uint32_t index)
 		goto free_primary;
 	}
 
-	goto exit;
-free_primary:
-	drm_plane_cleanup(primary);
-exit:
-	DRM_DEBUG_KMS("Exiting %s.\n", __func__);
-	return ret;
-}
-
-int via_crtc_init(struct drm_device *dev, uint32_t index)
-{
-	struct openchrome_drm_private *dev_private =
-						dev->dev_private;
-	struct via_crtc *iga = &dev_private->iga[index];
-	struct drm_plane *primary;
-	struct drm_crtc *crtc = &iga->base;
-	int cursor_size = 64 * 64 * 4, i;
-	u16 *gamma;
-	int ret;
-
-	primary = &dev_private->primary[index];
-
-	iga->index = index;
 	if (index) {
 		drm_crtc_helper_add(crtc,
 			&openchrome_iga2_drm_crtc_helper_funcs);
@@ -2551,7 +2541,7 @@ int via_crtc_init(struct drm_device *dev, uint32_t index)
 				NULL);
 		if (ret) {
 			DRM_ERROR("Failed to initialize CRTC!\n");
-			goto exit;
+			goto cleanup_primary;
 		}
 
 		iga->timings.htotal.count = ARRAY_SIZE(iga2_hor_total);
@@ -2635,7 +2625,7 @@ int via_crtc_init(struct drm_device *dev, uint32_t index)
 				NULL);
 		if (ret) {
 			DRM_ERROR("Failed to initialize CRTC!\n");
-			goto exit;
+			goto cleanup_primary;
 		}
 
 		iga->timings.htotal.count = ARRAY_SIZE(iga1_hor_total);
@@ -2738,6 +2728,11 @@ int via_crtc_init(struct drm_device *dev, uint32_t index)
 		goto exit;
 	}
 
+	goto exit;
+cleanup_primary:
+	drm_plane_cleanup(primary);
+free_primary:
+	kfree(primary);
 exit:
 	return ret;
 }
diff --git a/drivers/gpu/drm/openchrome/openchrome_display.c b/drivers/gpu/drm/openchrome/openchrome_display.c
index 47845efcaa0f..f4be439cb72f 100644
--- a/drivers/gpu/drm/openchrome/openchrome_display.c
+++ b/drivers/gpu/drm/openchrome/openchrome_display.c
@@ -493,16 +493,6 @@ via_modeset_init(struct drm_device *dev)
 	via_i2c_init(dev);
 	via_hwcursor_init(dev_private);
 
-	ret = openchrome_plane_init(dev, 0);
-	if (ret) {
-		goto exit;
-	}
-
-	ret = openchrome_plane_init(dev, 1);
-	if (ret) {
-		goto exit;
-	}
-
 	for (i = 0; i < OPENCHROME_MAX_CRTC; i++) {
 		ret = via_crtc_init(dev, i);
 		if (ret) {
diff --git a/drivers/gpu/drm/openchrome/openchrome_display.h b/drivers/gpu/drm/openchrome/openchrome_display.h
index 62d6a50548f5..faff26f2b30d 100644
--- a/drivers/gpu/drm/openchrome/openchrome_display.h
+++ b/drivers/gpu/drm/openchrome/openchrome_display.h
@@ -175,7 +175,6 @@ extern void via_fbdev_fini(struct drm_device *dev);
 /* crtc */
 extern void via_load_crtc_pixel_timing(struct drm_crtc *crtc,
 					struct drm_display_mode *mode);
-int openchrome_plane_init(struct drm_device *dev, uint32_t index);
 extern int via_crtc_init(struct drm_device *dev, uint32_t index);
 
 /* encoders */
diff --git a/drivers/gpu/drm/openchrome/openchrome_drv.h b/drivers/gpu/drm/openchrome/openchrome_drv.h
index bfaaacb31241..6d849d111d7d 100644
--- a/drivers/gpu/drm/openchrome/openchrome_drv.h
+++ b/drivers/gpu/drm/openchrome/openchrome_drv.h
@@ -154,8 +154,6 @@ struct openchrome_drm_private {
 
 	enum via_engine engine_type;
 
-	struct drm_plane primary[2];
-
 	struct via_crtc iga[OPENCHROME_MAX_CRTC];
 
 	bool spread_spectrum;
commit 4df2052cf9e915c4ed5e741b6fb77587194946a8
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Thu Oct 3 17:40:54 2019 -0400

    drm/openchrome: Use OPENCHROME_MAX_CRTC parameter
    
    Set OPENCHROME_MAX_CRTC to 2.
    
    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 5309e7f42d78..79170a8a6198 100644
--- a/drivers/gpu/drm/openchrome/openchrome_crtc.c
+++ b/drivers/gpu/drm/openchrome/openchrome_crtc.c
@@ -2497,7 +2497,7 @@ static const struct drm_plane_helper_funcs
 openchrome_drm_plane_helper_funcs = {
 };
 
-int openchrome_plane_init(struct drm_device *dev, int index)
+int openchrome_plane_init(struct drm_device *dev, uint32_t index)
 {
 	struct openchrome_drm_private *dev_private =
 						dev->dev_private;
@@ -2529,7 +2529,7 @@ exit:
 	return ret;
 }
 
-int via_crtc_init(struct drm_device *dev, int index)
+int via_crtc_init(struct drm_device *dev, uint32_t index)
 {
 	struct openchrome_drm_private *dev_private =
 						dev->dev_private;
diff --git a/drivers/gpu/drm/openchrome/openchrome_display.c b/drivers/gpu/drm/openchrome/openchrome_display.c
index 29ce8cadb86a..47845efcaa0f 100644
--- a/drivers/gpu/drm/openchrome/openchrome_display.c
+++ b/drivers/gpu/drm/openchrome/openchrome_display.c
@@ -479,6 +479,7 @@ int
 via_modeset_init(struct drm_device *dev)
 {
 	struct openchrome_drm_private *dev_private = dev->dev_private;
+	uint32_t i;
 	int ret = 0;
 
 	openchrome_mode_config_init(dev_private);
@@ -502,14 +503,11 @@ via_modeset_init(struct drm_device *dev)
 		goto exit;
 	}
 
-	ret = via_crtc_init(dev, 0);
-	if (ret) {
-		goto exit;
-	}
-
-	ret = via_crtc_init(dev, 1);
-	if (ret) {
-		goto exit;
+	for (i = 0; i < OPENCHROME_MAX_CRTC; i++) {
+		ret = via_crtc_init(dev, i);
+		if (ret) {
+			goto exit;
+		}
 	}
 
 	openchrome_ext_dvi_probe(dev);
diff --git a/drivers/gpu/drm/openchrome/openchrome_display.h b/drivers/gpu/drm/openchrome/openchrome_display.h
index b0c205ad8576..62d6a50548f5 100644
--- a/drivers/gpu/drm/openchrome/openchrome_display.h
+++ b/drivers/gpu/drm/openchrome/openchrome_display.h
@@ -175,8 +175,8 @@ extern void via_fbdev_fini(struct drm_device *dev);
 /* crtc */
 extern void via_load_crtc_pixel_timing(struct drm_crtc *crtc,
 					struct drm_display_mode *mode);
-int openchrome_plane_init(struct drm_device *dev, int index);
-extern int via_crtc_init(struct drm_device *dev, int index);
+int openchrome_plane_init(struct drm_device *dev, uint32_t index);
+extern int via_crtc_init(struct drm_device *dev, uint32_t index);
 
 /* encoders */
 extern void via_set_sync_polarity(struct drm_encoder *encoder,
diff --git a/drivers/gpu/drm/openchrome/openchrome_drv.h b/drivers/gpu/drm/openchrome/openchrome_drv.h
index 99139051dfa2..bfaaacb31241 100644
--- a/drivers/gpu/drm/openchrome/openchrome_drv.h
+++ b/drivers/gpu/drm/openchrome/openchrome_drv.h
@@ -60,6 +60,8 @@
 
 #define OPENCHROME_TTM_PL_NUM	2
 
+#define OPENCHROME_MAX_CRTC	2
+
 #define VIA_MM_ALIGN_SIZE	16
 
 #define DRM_FILE_PAGE_OFFSET	(0x100000000ULL >> PAGE_SHIFT)
@@ -154,7 +156,8 @@ struct openchrome_drm_private {
 
 	struct drm_plane primary[2];
 
-	struct via_crtc iga[2];
+	struct via_crtc iga[OPENCHROME_MAX_CRTC];
+
 	bool spread_spectrum;
 
 	/*


More information about the openchrome-devel mailing list