drivers/gpu/drm/openchrome/openchrome_crtc.c    |   38 ++++++++++++++++--------
 drivers/gpu/drm/openchrome/openchrome_display.c |    2 -
 drivers/gpu/drm/openchrome/openchrome_drv.h     |    7 +---
 3 files changed, 29 insertions(+), 18 deletions(-)

New commits:
commit d14b3158a26ada1ec1e089a46a02d5dc022e85fa
Author: Kevin Brace <kevinbr...@gmx.com>
Date:   Tue Oct 22 16:04:35 2019 -0700

    drm/openchrome: Version bumped to 3.1.20
    
    Signed-off-by: Kevin Brace <kevinbr...@gmx.com>

diff --git a/drivers/gpu/drm/openchrome/openchrome_drv.h 
b/drivers/gpu/drm/openchrome/openchrome_drv.h
index f564d75dc325..cf6cae145848 100644
--- a/drivers/gpu/drm/openchrome/openchrome_drv.h
+++ b/drivers/gpu/drm/openchrome/openchrome_drv.h
@@ -61,10 +61,10 @@
 
 #define DRIVER_MAJOR           3
 #define DRIVER_MINOR           1
-#define DRIVER_PATCHLEVEL      19
+#define DRIVER_PATCHLEVEL      20
 #define DRIVER_NAME            "openchrome"
 #define DRIVER_DESC            "OpenChrome DRM for VIA Technologies Chrome IGP"
-#define DRIVER_DATE            "20191019"
+#define DRIVER_DATE            "20191022"
 #define DRIVER_AUTHOR          "OpenChrome Project"
 
 
commit 8e8e77d0278c1d9d1b5545c717d445f8e613459a
Author: Kevin Brace <kevinbr...@gmx.com>
Date:   Tue Oct 22 15:36:54 2019 -0700

    drm/openchrome: Reference cursor BO differently when destroying it
    
    Signed-off-by: Kevin Brace <kevinbr...@gmx.com>

diff --git a/drivers/gpu/drm/openchrome/openchrome_crtc.c 
b/drivers/gpu/drm/openchrome/openchrome_crtc.c
index 70d82451ff68..d05c94d851d0 100644
--- a/drivers/gpu/drm/openchrome/openchrome_crtc.c
+++ b/drivers/gpu/drm/openchrome/openchrome_crtc.c
@@ -319,7 +319,7 @@ static void openchrome_crtc_destroy(struct drm_crtc *crtc)
 {
        struct via_crtc *iga = container_of(crtc, struct via_crtc, base);
 
-       if (iga->cursor_bo->kmap.bo) {
+       if (iga->cursor_bo) {
                openchrome_bo_destroy(iga->cursor_bo, true);
                iga->cursor_bo = NULL;
        }
commit 202e4ccdceeeaaab600310c0f58bb77635bd25b1
Author: Kevin Brace <kevinbr...@gmx.com>
Date:   Tue Oct 22 15:33:23 2019 -0700

    drm/openchrome: Allocate via_crtc struct dynamically
    
    Signed-off-by: Kevin Brace <kevinbr...@gmx.com>

diff --git a/drivers/gpu/drm/openchrome/openchrome_crtc.c 
b/drivers/gpu/drm/openchrome/openchrome_crtc.c
index 5bb3eb1b6d95..70d82451ff68 100644
--- a/drivers/gpu/drm/openchrome/openchrome_crtc.c
+++ b/drivers/gpu/drm/openchrome/openchrome_crtc.c
@@ -324,7 +324,8 @@ static void openchrome_crtc_destroy(struct drm_crtc *crtc)
                iga->cursor_bo = NULL;
        }
 
-       drm_crtc_cleanup(crtc);
+       drm_crtc_cleanup(&iga->base);
+       kfree(iga);
 }
 
 static const struct drm_crtc_funcs openchrome_drm_crtc_funcs = {
@@ -2077,16 +2078,13 @@ int openchrome_crtc_init(struct openchrome_drm_private 
*dev_private,
                                uint32_t index)
 {
        struct drm_device *dev = dev_private->dev;
-       struct via_crtc *iga = &dev_private->iga[index];
+       struct via_crtc *iga;
        struct drm_plane *primary;
        struct drm_plane *cursor;
-       struct drm_crtc *crtc = &iga->base;
        uint32_t possible_crtcs;
        uint64_t cursor_size = 64 * 64 * 4;
        int ret;
 
-       iga->index = index;
-
        possible_crtcs = 1 << index;
 
        primary = kzalloc(sizeof(struct drm_plane), GFP_KERNEL);
@@ -2125,16 +2123,26 @@ int openchrome_crtc_init(struct openchrome_drm_private 
*dev_private,
                goto free_cursor;
        }
 
-       drm_crtc_helper_add(crtc,
+       iga = kzalloc(sizeof(struct via_crtc), GFP_KERNEL);
+       if (!iga) {
+               ret = -ENOMEM;
+               DRM_ERROR("Failed to allocate CRTC storage.\n");
+               goto cleanup_cursor;
+       }
+
+       drm_crtc_helper_add(&iga->base,
                        &openchrome_drm_crtc_helper_funcs);
-       ret = drm_crtc_init_with_planes(dev, crtc, primary, cursor,
+       ret = drm_crtc_init_with_planes(dev, &iga->base,
+                                       primary, cursor,
                                        &openchrome_drm_crtc_funcs,
                                        NULL);
        if (ret) {
                DRM_ERROR("Failed to initialize CRTC!\n");
-               goto cleanup_cursor;
+               goto free_crtc;
        }
 
+       iga->index = index;
+
        if (dev->pdev->device == PCI_DEVICE_ID_VIA_CLE266 ||
                dev->pdev->device == PCI_DEVICE_ID_VIA_KM400)
                cursor_size = 32 * 32 * 4;
@@ -2148,10 +2156,15 @@ int openchrome_crtc_init(struct openchrome_drm_private 
*dev_private,
                                        &iga->cursor_bo);
        if (ret) {
                DRM_ERROR("Failed to create cursor.\n");
-               goto cleanup_cursor;
+               goto cleanup_crtc;
        }
 
+       openchrome_crtc_param_init(dev_private, &iga->base, index);
        goto exit;
+cleanup_crtc:
+       drm_crtc_cleanup(&iga->base);
+free_crtc:
+       kfree(iga);
 cleanup_cursor:
        drm_plane_cleanup(cursor);
 free_cursor:
@@ -2166,11 +2179,12 @@ exit:
 
 void openchrome_crtc_param_init(
                struct openchrome_drm_private *dev_private,
+               struct drm_crtc *crtc,
                uint32_t index)
 {
        struct drm_device *dev = dev_private->dev;
-       struct via_crtc *iga = &dev_private->iga[index];
-       struct drm_crtc *crtc = &iga->base;
+       struct via_crtc *iga = container_of(crtc,
+                                               struct via_crtc, base);
        u16 *gamma;
        uint32_t i;
 
diff --git a/drivers/gpu/drm/openchrome/openchrome_display.c 
b/drivers/gpu/drm/openchrome/openchrome_display.c
index 91ff28861703..4d696a2740f9 100644
--- a/drivers/gpu/drm/openchrome/openchrome_display.c
+++ b/drivers/gpu/drm/openchrome/openchrome_display.c
@@ -498,8 +498,6 @@ via_modeset_init(struct drm_device *dev)
                if (ret) {
                        goto exit;
                }
-
-               openchrome_crtc_param_init(dev_private, i);
        }
 
        openchrome_ext_dvi_probe(dev);
diff --git a/drivers/gpu/drm/openchrome/openchrome_drv.h 
b/drivers/gpu/drm/openchrome/openchrome_drv.h
index 2c5d8a71dbc7..f564d75dc325 100644
--- a/drivers/gpu/drm/openchrome/openchrome_drv.h
+++ b/drivers/gpu/drm/openchrome/openchrome_drv.h
@@ -243,8 +243,6 @@ struct openchrome_drm_private {
 
        enum via_engine engine_type;
 
-       struct via_crtc iga[OPENCHROME_MAX_CRTC];
-
        bool spread_spectrum;
 
        /*
@@ -470,6 +468,7 @@ int openchrome_crtc_init(struct openchrome_drm_private 
*dev_private,
                                uint32_t index);
 void openchrome_crtc_param_init(
                        struct openchrome_drm_private *dev_private,
+                       struct drm_crtc *crtc,
                        uint32_t index);
 
 /* encoders */
_______________________________________________
openchrome-devel mailing list
openchrome-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/openchrome-devel

Reply via email to