summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/openchrome
diff options
context:
space:
mode:
authorKevin Brace <kevinbrace@gmx.com>2020-11-09 09:10:25 -0800
committerKevin Brace <kevinbrace@gmx.com>2020-11-09 09:10:25 -0800
commit1e96451aeee4d0bf248408df33c0017849770446 (patch)
tree80d82befc465d3052db29554ee2b76e9ce45438d /drivers/gpu/drm/openchrome
parente270cc1027f041a88a06b6c1b72a78760ef56a91 (diff)
Revert "drm/openchrome: Initialize plane and crtc separately"
Diffstat (limited to 'drivers/gpu/drm/openchrome')
-rw-r--r--drivers/gpu/drm/openchrome/openchrome_crtc.c64
-rw-r--r--drivers/gpu/drm/openchrome/openchrome_display.c26
-rw-r--r--drivers/gpu/drm/openchrome/openchrome_drv.h7
3 files changed, 23 insertions, 74 deletions
diff --git a/drivers/gpu/drm/openchrome/openchrome_crtc.c b/drivers/gpu/drm/openchrome/openchrome_crtc.c
index b8499e21aa34..fcce3fbbe33a 100644
--- a/drivers/gpu/drm/openchrome/openchrome_crtc.c
+++ b/drivers/gpu/drm/openchrome/openchrome_crtc.c
@@ -2239,23 +2239,17 @@ static const uint32_t openchrome_primary_formats[] = {
DRM_FORMAT_RGB332,
};
-int openchrome_plane_init(struct openchrome_drm_private *dev_private,
- struct drm_plane **p_primary,
- struct drm_plane **p_cursor)
+int openchrome_crtc_init(struct openchrome_drm_private *dev_private,
+ uint32_t index)
{
struct drm_device *dev = dev_private->dev;
- struct drm_plane *primary = NULL;
- struct drm_plane *cursor = NULL;
+ struct via_crtc *iga;
+ struct drm_plane *primary;
+ struct drm_plane *cursor;
uint32_t possible_crtcs;
- uint32_t i;
int ret;
- DRM_DEBUG_KMS("Entered %s.\n", __func__);
-
- possible_crtcs = 0;
- for (i = 0; i < OPENCHROME_MAX_CRTC; i++) {
- possible_crtcs |= 1 << i;
- }
+ possible_crtcs = 1 << index;
primary = kzalloc(sizeof(struct drm_plane), GFP_KERNEL);
if (!primary) {
@@ -2293,43 +2287,15 @@ int openchrome_plane_init(struct openchrome_drm_private *dev_private,
goto free_cursor;
}
- goto exit;
-free_cursor:
- kfree(cursor);
- cursor = NULL;
-cleanup_primary:
- drm_plane_cleanup(primary);
-free_primary:
- kfree(primary);
- primary = NULL;
-exit:
- *p_primary = primary;
- *p_cursor = cursor;
-
- DRM_DEBUG_KMS("Exiting %s.\n", __func__);
- return ret;
-}
-
-int openchrome_crtc_init(struct openchrome_drm_private *dev_private,
- struct drm_plane *primary,
- struct drm_plane *cursor,
- uint32_t i)
-{
- struct drm_device *dev = dev_private->dev;
- struct via_crtc *iga;
- int ret;
-
- DRM_DEBUG_KMS("Entered %s.\n", __func__);
-
iga = kzalloc(sizeof(struct via_crtc), GFP_KERNEL);
if (!iga) {
ret = -ENOMEM;
DRM_ERROR("Failed to allocate CRTC storage.\n");
- goto exit;
+ goto cleanup_cursor;
}
drm_crtc_helper_add(&iga->base,
- &openchrome_drm_crtc_helper_funcs);
+ &openchrome_drm_crtc_helper_funcs);
ret = drm_crtc_init_with_planes(dev, &iga->base,
primary, cursor,
&openchrome_drm_crtc_funcs,
@@ -2339,12 +2305,20 @@ int openchrome_crtc_init(struct openchrome_drm_private *dev_private,
goto free_crtc;
}
- iga->index = i;
- openchrome_crtc_param_init(dev_private, &iga->base, i);
+ iga->index = index;
+
+ openchrome_crtc_param_init(dev_private, &iga->base, index);
goto exit;
free_crtc:
kfree(iga);
+cleanup_cursor:
+ drm_plane_cleanup(cursor);
+free_cursor:
+ kfree(cursor);
+cleanup_primary:
+ drm_plane_cleanup(primary);
+free_primary:
+ kfree(primary);
exit:
- DRM_DEBUG_KMS("Exiting %s.\n", __func__);
return ret;
}
diff --git a/drivers/gpu/drm/openchrome/openchrome_display.c b/drivers/gpu/drm/openchrome/openchrome_display.c
index 36c65df1c7d4..a7ebc4926a4b 100644
--- a/drivers/gpu/drm/openchrome/openchrome_display.c
+++ b/drivers/gpu/drm/openchrome/openchrome_display.c
@@ -460,13 +460,9 @@ int
via_modeset_init(struct drm_device *dev)
{
struct openchrome_drm_private *dev_private = dev->dev_private;
- struct drm_plane *primary;
- struct drm_plane *cursor;
uint32_t i;
int ret = 0;
- DRM_DEBUG_KMS("Entered %s.\n", __func__);
-
openchrome_mode_config_init(dev_private);
/* Initialize the number of display connectors. */
@@ -484,20 +480,10 @@ via_modeset_init(struct drm_device *dev)
via_hwcursor_init(dev_private);
- ret = openchrome_plane_init(dev_private, &primary, &cursor);
- if (ret) {
- DRM_ERROR("Failed to initialize planes!\n");
- goto free_i2c;
- }
-
for (i = 0; i < OPENCHROME_MAX_CRTC; i++) {
- ret = openchrome_crtc_init(dev_private,
- primary,
- cursor,
- i);
+ ret = openchrome_crtc_init(dev_private, i);
if (ret) {
- DRM_ERROR("Failed to initialize CRTC!\n");
- goto free_crtc;
+ goto exit;
}
}
@@ -527,17 +513,11 @@ via_modeset_init(struct drm_device *dev)
/* Initialize the frame buffer device. */
ret = openchrome_fb_init(dev);
if (ret) {
- goto free_crtc;
+ goto exit;
}
drm_kms_helper_poll_init(dev);
- goto exit;
-free_crtc:
- drm_mode_config_cleanup(dev);
-free_i2c:
- via_i2c_exit();
exit:
- DRM_DEBUG_KMS("Exiting %s.\n", __func__);
return ret;
}
diff --git a/drivers/gpu/drm/openchrome/openchrome_drv.h b/drivers/gpu/drm/openchrome/openchrome_drv.h
index f6214933157e..1ddc1cf4f7d0 100644
--- a/drivers/gpu/drm/openchrome/openchrome_drv.h
+++ b/drivers/gpu/drm/openchrome/openchrome_drv.h
@@ -453,13 +453,8 @@ extern void openchrome_fb_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 openchrome_drm_private *dev_private,
- struct drm_plane **p_primary,
- struct drm_plane **p_cursor);
int openchrome_crtc_init(struct openchrome_drm_private *dev_private,
- struct drm_plane *primary,
- struct drm_plane *cursor,
- uint32_t i);
+ uint32_t index);
/* encoders */
extern void via_set_sync_polarity(struct drm_encoder *encoder,