Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys Get drm to build on arm64 again.



details:   https://anonhg.NetBSD.org/src/rev/b9a4de4e60e7
branches:  trunk
changeset: 1028420:b9a4de4e60e7
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Dec 19 11:00:46 2021 +0000

description:
Get drm to build on arm64 again.


Author: Jared McNeill <jmcneill%NetBSD.org@localhost>
Committer: Taylor R Campbell <riastradh%NetBSD.org@localhost>

diffstat:

 sys/arch/arm/rockchip/rk_anxdp.c   |   8 +-
 sys/arch/arm/rockchip/rk_drm.c     |  46 +++++++-------------
 sys/arch/arm/rockchip/rk_dwhdmi.c  |  10 ++--
 sys/arch/arm/rockchip/rk_fb.c      |   6 +-
 sys/arch/arm/rockchip/rk_vop.c     |  18 +++++---
 sys/arch/arm/sunxi/sunxi_drm.c     |  44 +++++++------------
 sys/arch/arm/sunxi/sunxi_dwhdmi.c  |  11 ++--
 sys/arch/arm/sunxi/sunxi_fb.c      |   6 +-
 sys/arch/arm/sunxi/sunxi_hdmiphy.h |   4 +-
 sys/arch/arm/sunxi/sunxi_lcdc.c    |  11 ++--
 sys/arch/arm/sunxi/sunxi_mixer.c   |  51 ++++++++++++----------
 sys/dev/fdt/fdt_panel.c            |   8 +-
 sys/dev/fdt/hdmi_connector.c       |  35 +++------------
 sys/dev/i2c/anxedp.c               |  43 +++++--------------
 sys/dev/ic/anx_dp.c                |  83 ++++++++++++++++++++-----------------
 sys/dev/ic/anx_dp.h                |   7 ++-
 sys/dev/ic/dw_hdmi.c               |  42 ++++--------------
 sys/dev/ic/dw_hdmi.h               |  15 ++++--
 sys/dev/ic/dw_hdmi_phy.c           |  13 +++--
 sys/external/bsd/dwc2/dwc2.h       |   5 +-
 20 files changed, 201 insertions(+), 265 deletions(-)

diffs (truncated from 1458 to 300 lines):

diff -r 6cf591734849 -r b9a4de4e60e7 sys/arch/arm/rockchip/rk_anxdp.c
--- a/sys/arch/arm/rockchip/rk_anxdp.c  Sun Dec 19 11:00:36 2021 +0000
+++ b/sys/arch/arm/rockchip/rk_anxdp.c  Sun Dec 19 11:00:46 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rk_anxdp.c,v 1.4 2021/07/25 11:14:15 jmcneill Exp $ */
+/* $NetBSD: rk_anxdp.c,v 1.5 2021/12/19 11:00:46 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2019 Jonathan A. Kollasch <jakllsch%kollasch.net@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rk_anxdp.c,v 1.4 2021/07/25 11:14:15 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rk_anxdp.c,v 1.5 2021/12/19 11:00:46 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -37,7 +37,7 @@
 #include <sys/kernel.h>
 #include <sys/conf.h>
 
-#include <drm/drmP.h>
+#include <drm/drm_drv.h>
 #include <drm/drm_crtc_helper.h>
 
 #include <dev/fdt/fdtvar.h>
@@ -174,7 +174,7 @@
 
        sc->sc_encoder.possible_crtcs = 0x2; /* VOPB only */
        drm_encoder_init(crtc->dev, &sc->sc_encoder, &rk_anxdp_encoder_funcs,
-           DRM_MODE_ENCODER_TMDS);
+           DRM_MODE_ENCODER_TMDS, NULL);
        drm_encoder_helper_add(&sc->sc_encoder, &rk_anxdp_encoder_helper_funcs);
 
        out_ep = fdt_endpoint_get_from_index(&sc->sc_ports, ANXDP_PORT_OUTPUT, 0);
diff -r 6cf591734849 -r b9a4de4e60e7 sys/arch/arm/rockchip/rk_drm.c
--- a/sys/arch/arm/rockchip/rk_drm.c    Sun Dec 19 11:00:36 2021 +0000
+++ b/sys/arch/arm/rockchip/rk_drm.c    Sun Dec 19 11:00:46 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rk_drm.c,v 1.7 2021/08/07 16:18:45 thorpej Exp $ */
+/* $NetBSD: rk_drm.c,v 1.8 2021/12/19 11:00:46 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rk_drm.c,v 1.7 2021/08/07 16:18:45 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rk_drm.c,v 1.8 2021/12/19 11:00:46 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -41,9 +41,12 @@
 #include <uvm/uvm_object.h>
 #include <uvm/uvm_device.h>
 
-#include <drm/drmP.h>
+#include <drm/drm_auth.h>
+#include <drm/drm_drv.h>
 #include <drm/drm_crtc_helper.h>
 #include <drm/drm_fb_helper.h>
+#include <drm/drm_fourcc.h>
+#include <drm/drm_vblank.h>
 
 #include <dev/fdt/fdtvar.h>
 #include <dev/fdt/fdt_port.h>
@@ -79,10 +82,10 @@
 static void    rk_drm_disable_vblank(struct drm_device *, unsigned int);
 
 static int     rk_drm_load(struct drm_device *, unsigned long);
-static int     rk_drm_unload(struct drm_device *);
+static void    rk_drm_unload(struct drm_device *);
 
 static struct drm_driver rk_drm_driver = {
-       .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME,
+       .driver_features = DRIVER_MODESET | DRIVER_GEM,
        .dev_priv_size = 0,
        .load = rk_drm_load,
        .unload = rk_drm_unload,
@@ -92,7 +95,6 @@
        .gem_uvm_ops = &drm_gem_cma_uvm_ops,
 
        .dumb_create = drm_gem_cma_dumb_create,
-       .dumb_map_offset = drm_gem_cma_dumb_map_offset,
        .dumb_destroy = drm_gem_dumb_destroy,
 
        .get_vblank_counter = rk_drm_get_vblank_counter,
@@ -168,7 +170,6 @@
 
        error = -drm_dev_register(sc->sc_ddev, 0);
        if (error) {
-               drm_dev_unref(sc->sc_ddev);
                aprint_error_dev(dev, "couldn't register DRM device: %d\n",
                    error);
                return;
@@ -230,7 +231,7 @@
        struct rk_drm_framebuffer *sfb = to_rk_drm_framebuffer(fb);
 
        drm_framebuffer_cleanup(fb);
-       drm_gem_object_unreference_unlocked(&sfb->obj->base);
+       drm_gem_object_put_unlocked(&sfb->obj->base);
        kmem_free(sfb, sizeof(*sfb));
 }
 
@@ -241,7 +242,7 @@
 
 static struct drm_framebuffer *
 rk_drm_fb_create(struct drm_device *ddev, struct drm_file *file,
-    struct drm_mode_fb_cmd2 *cmd)
+    const struct drm_mode_fb_cmd2 *cmd)
 {
        struct rk_drm_framebuffer *fb;
        struct drm_gem_object *gem_obj;
@@ -250,7 +251,7 @@
        if (cmd->flags)
                return NULL;
 
-       gem_obj = drm_gem_object_lookup(ddev, file, cmd->handles[0]);
+       gem_obj = drm_gem_object_lookup(file, cmd->handles[0]);
        if (gem_obj == NULL)
                return NULL;
 
@@ -264,17 +265,7 @@
        fb->base.offsets[2] = cmd->offsets[1];
        fb->base.width = cmd->width;
        fb->base.height = cmd->height;
-       fb->base.pixel_format = cmd->pixel_format;
-       fb->base.bits_per_pixel = drm_format_plane_cpp(fb->base.pixel_format, 0) * 8;
-
-       switch (fb->base.pixel_format) {
-       case DRM_FORMAT_XRGB8888:
-       case DRM_FORMAT_ARGB8888:
-               fb->base.depth = 32;
-               break;
-       default:
-               break;
-       }
+       fb->base.format = drm_format_info(cmd->pixel_format);
 
        error = drm_framebuffer_init(ddev, &fb->base, &rk_drm_framebuffer_funcs);
        if (error != 0)
@@ -285,7 +276,7 @@
 dealloc:
        drm_framebuffer_cleanup(&fb->base);
        kmem_free(fb, sizeof(*fb));
-       drm_gem_object_unreference_unlocked(gem_obj);
+       drm_gem_object_put_unlocked(gem_obj);
 
        return NULL;
 }
@@ -331,11 +322,10 @@
        fb->width = width;
        fb->height = height;
 #ifdef __ARM_BIG_ENDIAN
-       fb->pixel_format = DRM_FORMAT_BGRX8888;
+       fb->format = drm_format_info(DRM_FORMAT_BGRX8888);
 #else
-       fb->pixel_format = DRM_FORMAT_XRGB8888;
+       fb->format = drm_format_info(DRM_FORMAT_XRGB8888);
 #endif
-       drm_fb_get_bpp_depth(fb->pixel_format, &fb->depth, &fb->bits_per_pixel);
 
        error = drm_framebuffer_init(ddev, fb, &rk_drm_framebuffer_funcs);
        if (error != 0) {
@@ -414,7 +404,7 @@
 
        drm_fb_helper_prepare(ddev, &fbdev->helper, &rk_drm_fb_helper_funcs);
 
-       error = drm_fb_helper_init(ddev, &fbdev->helper, num_crtc, num_crtc);
+       error = drm_fb_helper_init(ddev, &fbdev->helper, num_crtc);
        if (error)
                goto allocerr;
 
@@ -484,12 +474,10 @@
        sc->sc_vbl[crtc].disable_vblank(sc->sc_vbl[crtc].priv);
 }
 
-static int
+static void
 rk_drm_unload(struct drm_device *ddev)
 {
        drm_mode_config_cleanup(ddev);
-
-       return 0;
 }
 
 int
diff -r 6cf591734849 -r b9a4de4e60e7 sys/arch/arm/rockchip/rk_dwhdmi.c
--- a/sys/arch/arm/rockchip/rk_dwhdmi.c Sun Dec 19 11:00:36 2021 +0000
+++ b/sys/arch/arm/rockchip/rk_dwhdmi.c Sun Dec 19 11:00:46 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rk_dwhdmi.c,v 1.5 2021/01/27 03:10:19 thorpej Exp $ */
+/* $NetBSD: rk_dwhdmi.c,v 1.6 2021/12/19 11:00:46 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rk_dwhdmi.c,v 1.5 2021/01/27 03:10:19 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rk_dwhdmi.c,v 1.6 2021/12/19 11:00:46 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -37,7 +37,7 @@
 #include <sys/kernel.h>
 #include <sys/conf.h>
 
-#include <drm/drmP.h>
+#include <drm/drm_drv.h>
 #include <drm/drm_crtc_helper.h>
 
 #include <dev/fdt/fdtvar.h>
@@ -189,7 +189,7 @@
 
        sc->sc_encoder.possible_crtcs = 3; // 1U << drm_crtc_index(crtc); /* XXX */
        drm_encoder_init(crtc->dev, &sc->sc_encoder, &rk_dwhdmi_encoder_funcs,
-           DRM_MODE_ENCODER_TMDS);
+           DRM_MODE_ENCODER_TMDS, NULL);
        drm_encoder_helper_add(&sc->sc_encoder, &rk_dwhdmi_encoder_helper_funcs);
 
        sc->sc_base.sc_connector.base.connector_type = DRM_MODE_CONNECTOR_HDMIA;
@@ -230,7 +230,7 @@
 
 static void
 rk_dwhdmi_mode_set(struct dwhdmi_softc *dsc,
-    struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode)
+    const struct drm_display_mode *mode, const struct drm_display_mode *adjusted_mode)
 {
        struct rk_dwhdmi_softc * const sc = to_rk_dwhdmi_softc(dsc);
        int error;
diff -r 6cf591734849 -r b9a4de4e60e7 sys/arch/arm/rockchip/rk_fb.c
--- a/sys/arch/arm/rockchip/rk_fb.c     Sun Dec 19 11:00:36 2021 +0000
+++ b/sys/arch/arm/rockchip/rk_fb.c     Sun Dec 19 11:00:46 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rk_fb.c,v 1.2 2021/05/21 09:33:27 jmcneill Exp $ */
+/* $NetBSD: rk_fb.c,v 1.3 2021/12/19 11:00:46 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2015-2019 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -29,7 +29,7 @@
 #include "opt_wsdisplay_compat.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rk_fb.c,v 1.2 2021/05/21 09:33:27 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rk_fb.c,v 1.3 2021/12/19 11:00:46 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -37,7 +37,7 @@
 
 #include <dev/fdt/fdtvar.h>
 
-#include <drm/drmP.h>
+#include <drm/drm_drv.h>
 #include <drm/drmfb.h>
 
 #include <arm/rockchip/rk_drm.h>
diff -r 6cf591734849 -r b9a4de4e60e7 sys/arch/arm/rockchip/rk_vop.c
--- a/sys/arch/arm/rockchip/rk_vop.c    Sun Dec 19 11:00:36 2021 +0000
+++ b/sys/arch/arm/rockchip/rk_vop.c    Sun Dec 19 11:00:46 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rk_vop.c,v 1.10 2021/01/27 03:10:19 thorpej Exp $ */
+/* $NetBSD: rk_vop.c,v 1.11 2021/12/19 11:00:46 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rk_vop.c,v 1.10 2021/01/27 03:10:19 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rk_vop.c,v 1.11 2021/12/19 11:00:46 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -38,9 +38,10 @@
 #include <sys/conf.h>
 #include <sys/sysctl.h>
 
-#include <drm/drmP.h>
+#include <drm/drm_drv.h>
 #include <drm/drm_crtc.h>
 #include <drm/drm_crtc_helper.h>
+#include <drm/drm_fourcc.h>
 #include <drm/drm_plane_helper.h>
 
 #include <dev/fdt/fdtvar.h>
@@ -241,7 +242,7 @@
 
 
        paddr += y * sfb->base.pitches[0];
-       paddr += x * drm_format_plane_cpp(sfb->base.pixel_format, 0);
+       paddr += x * sfb->base.format->cpp[0];
 
        KASSERT((paddr & ~0xffffffff) == 0);
 



Home | Main Index | Thread Index | Old Index