Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm/nvidia drm: Make tegra drm build again.
details: https://anonhg.NetBSD.org/src/rev/67681b6190db
branches: trunk
changeset: 1029021:67681b6190db
user: riastradh <riastradh%NetBSD.org@localhost>
date: Sun Dec 19 12:44:14 2021 +0000
description:
drm: Make tegra drm build again.
diffstat:
sys/arch/arm/nvidia/tegra_drm.c | 37 ++++---------------
sys/arch/arm/nvidia/tegra_drm.h | 3 +-
sys/arch/arm/nvidia/tegra_drm_fb.c | 26 +++++++------
sys/arch/arm/nvidia/tegra_drm_mode.c | 66 +++++++++++------------------------
sys/arch/arm/nvidia/tegra_fb.c | 7 +--
5 files changed, 48 insertions(+), 91 deletions(-)
diffs (truncated from 412 to 300 lines):
diff -r c6f89acf9611 -r 67681b6190db sys/arch/arm/nvidia/tegra_drm.c
--- a/sys/arch/arm/nvidia/tegra_drm.c Sun Dec 19 12:44:04 2021 +0000
+++ b/sys/arch/arm/nvidia/tegra_drm.c Sun Dec 19 12:44:14 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_drm.c,v 1.12 2021/12/19 11:01:21 riastradh Exp $ */
+/* $NetBSD: tegra_drm.c,v 1.13 2021/12/19 12:44:14 riastradh Exp $ */
/*-
* Copyright (c) 2015 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tegra_drm.c,v 1.12 2021/12/19 11:01:21 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tegra_drm.c,v 1.13 2021/12/19 12:44:14 riastradh Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -40,7 +40,8 @@
#include <uvm/uvm_extern.h>
#include <uvm/uvm_device.h>
-#include <drm/drmP.h>
+#include <drm/drm_drv.h>
+#include <drm/drm_encoder.h>
#include <arm/nvidia/tegra_reg.h>
#include <arm/nvidia/tegra_var.h>
@@ -51,10 +52,8 @@
static int tegra_drm_match(device_t, cfdata_t, void *);
static void tegra_drm_attach(device_t, device_t, void *);
-static int tegra_drm_set_busid(struct drm_device *, struct drm_master *);
-
static int tegra_drm_load(struct drm_device *, unsigned long);
-static int tegra_drm_unload(struct drm_device *);
+static void tegra_drm_unload(struct drm_device *);
static struct drm_driver tegra_drm_driver = {
.driver_features = DRIVER_MODESET | DRIVER_GEM,
@@ -67,8 +66,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 = tegra_drm_get_vblank_counter,
.enable_vblank = tegra_drm_enable_vblank,
@@ -80,8 +77,6 @@
.major = DRIVER_MAJOR,
.minor = DRIVER_MINOR,
.patchlevel = DRIVER_PATCHLEVEL,
-
- .set_busid = tegra_drm_set_busid,
};
CFATTACH_DECL_NEW(tegra_drm, sizeof(struct tegra_drm_softc),
@@ -211,7 +206,7 @@
error = -drm_dev_register(sc->sc_ddev, 0);
if (error) {
- drm_dev_unref(sc->sc_ddev);
+ drm_dev_put(sc->sc_ddev);
aprint_error_dev(self, "couldn't register DRM device: %d\n",
error);
return;
@@ -225,21 +220,6 @@
}
static int
-tegra_drm_set_busid(struct drm_device *ddev, struct drm_master *master)
-{
- const char *id = "platform:tegra:0";
-
- master->unique = kzalloc(strlen(id) + 1, GFP_KERNEL);
- if (master->unique == NULL)
- return -ENOMEM;
- strcpy(master->unique, id);
- master->unique_len = strlen(master->unique);
-
- return 0;
-}
-
-
-static int
tegra_drm_load(struct drm_device *ddev, unsigned long flags)
{
int error;
@@ -260,10 +240,9 @@
return error;
}
-static int
+static void
tegra_drm_unload(struct drm_device *ddev)
{
+
drm_mode_config_cleanup(ddev);
-
- return 0;
}
diff -r c6f89acf9611 -r 67681b6190db sys/arch/arm/nvidia/tegra_drm.h
--- a/sys/arch/arm/nvidia/tegra_drm.h Sun Dec 19 12:44:04 2021 +0000
+++ b/sys/arch/arm/nvidia/tegra_drm.h Sun Dec 19 12:44:14 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_drm.h,v 1.9 2018/08/27 15:31:51 riastradh Exp $ */
+/* $NetBSD: tegra_drm.h,v 1.10 2021/12/19 12:44:14 riastradh Exp $ */
/*-
* Copyright (c) 2015 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -29,6 +29,7 @@
#ifndef _ARM_TEGRA_DRM_H
#define _ARM_TEGRA_DRM_H
+#include <drm/drm_encoder.h>
#include <drm/drm_fb_helper.h>
#include <drm/drm_gem_cma_helper.h>
diff -r c6f89acf9611 -r 67681b6190db sys/arch/arm/nvidia/tegra_drm_fb.c
--- a/sys/arch/arm/nvidia/tegra_drm_fb.c Sun Dec 19 12:44:04 2021 +0000
+++ b/sys/arch/arm/nvidia/tegra_drm_fb.c Sun Dec 19 12:44:14 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_drm_fb.c,v 1.9 2021/08/07 16:18:44 thorpej Exp $ */
+/* $NetBSD: tegra_drm_fb.c,v 1.10 2021/12/19 12:44:14 riastradh Exp $ */
/*-
* Copyright (c) 2015 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,12 +27,13 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tegra_drm_fb.c,v 1.9 2021/08/07 16:18:44 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tegra_drm_fb.c,v 1.10 2021/12/19 12:44:14 riastradh Exp $");
-#include <drm/drmP.h>
#include <drm/drm_crtc.h>
+#include <drm/drm_crtc_helper.h>
+#include <drm/drm_drv.h>
#include <drm/drm_fb_helper.h>
-#include <drm/drm_crtc_helper.h>
+#include <drm/drm_fourcc.h>
#include <arm/nvidia/tegra_drm.h>
@@ -56,7 +57,7 @@
drm_fb_helper_prepare(ddev, &fbdev->helper, &tegra_fb_helper_funcs);
- error = drm_fb_helper_init(ddev, &fbdev->helper, 2, 1);
+ error = drm_fb_helper_init(ddev, &fbdev->helper, 1);
if (error) {
kmem_free(fbdev, sizeof(*fbdev));
return error;
@@ -131,13 +132,14 @@
if (tegra_fb->obj == NULL)
return -ENOMEM;
- fb->pitches[0] = pitch;
- fb->offsets[0] = 0;
- fb->width = width;
- fb->height = height;
- fb->pixel_format = DRM_FORMAT_XRGB8888;
- drm_fb_get_bpp_depth(fb->pixel_format, &fb->depth,
- &fb->bits_per_pixel);
+ fb->pitches[0] = pitch;
+ fb->offsets[0] = 0;
+ fb->width = width;
+ fb->height = height;
+ fb->modifier = 0;
+ fb->flags = 0;
+ fb->format = drm_format_info(DRM_FORMAT_XRGB8888); /* XXX endian? */
+ fb->dev = ddev;
tegra_drm_framebuffer_init(ddev, tegra_fb);
return 0;
diff -r c6f89acf9611 -r 67681b6190db sys/arch/arm/nvidia/tegra_drm_mode.c
--- a/sys/arch/arm/nvidia/tegra_drm_mode.c Sun Dec 19 12:44:04 2021 +0000
+++ b/sys/arch/arm/nvidia/tegra_drm_mode.c Sun Dec 19 12:44:14 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_drm_mode.c,v 1.20 2021/01/15 23:11:59 jmcneill Exp $ */
+/* $NetBSD: tegra_drm_mode.c,v 1.21 2021/12/19 12:44:14 riastradh Exp $ */
/*-
* Copyright (c) 2015 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,13 +27,15 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tegra_drm_mode.c,v 1.20 2021/01/15 23:11:59 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tegra_drm_mode.c,v 1.21 2021/12/19 12:44:14 riastradh Exp $");
-#include <drm/drmP.h>
#include <drm/drm_crtc.h>
#include <drm/drm_crtc_helper.h>
+#include <drm/drm_drv.h>
#include <drm/drm_edid.h>
#include <drm/drm_plane_helper.h>
+#include <drm/drm_probe_helper.h>
+#include <drm/drm_vblank.h>
#include <dev/i2c/ddcvar.h>
@@ -50,7 +52,7 @@
#include <external/bsd/drm2/dist/drm/drm_internal.h>
static struct drm_framebuffer *tegra_fb_create(struct drm_device *,
- struct drm_file *, struct drm_mode_fb_cmd2 *);
+ struct drm_file *, const struct drm_mode_fb_cmd2 *);
static const struct drm_mode_config_funcs tegra_mode_config_funcs = {
.fb_create = tegra_fb_create
@@ -146,12 +148,10 @@
static int tegra_connector_mode_valid(struct drm_connector *,
struct drm_display_mode *);
static int tegra_connector_get_modes(struct drm_connector *);
-static struct drm_encoder *tegra_connector_best_encoder(struct drm_connector *);
static const struct drm_connector_helper_funcs tegra_connector_helper_funcs = {
.mode_valid = tegra_connector_mode_valid,
.get_modes = tegra_connector_get_modes,
- .best_encoder = tegra_connector_best_encoder
};
static const struct tegra_hdmi_tmds_config {
@@ -218,7 +218,7 @@
static struct drm_framebuffer *
tegra_fb_create(struct drm_device *ddev, struct drm_file *file,
- struct drm_mode_fb_cmd2 *cmd)
+ const struct drm_mode_fb_cmd2 *cmd)
{
struct tegra_framebuffer *fb;
struct drm_gem_object *gem_obj;
@@ -231,19 +231,13 @@
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;
fb = kmem_zalloc(sizeof(*fb), KM_SLEEP);
+ drm_helper_mode_fill_fb_struct(ddev, &fb->base, cmd);
fb->obj = to_drm_gem_cma_obj(gem_obj);
- fb->base.pitches[0] = cmd->pitches[0];
- fb->base.offsets[0] = cmd->offsets[0];
- fb->base.width = cmd->width;
- fb->base.height = cmd->height;
- fb->base.pixel_format = cmd->pixel_format;
- drm_fb_get_bpp_depth(cmd->pixel_format, &fb->base.depth,
- &fb->base.bits_per_pixel);
error = tegra_drm_framebuffer_init(ddev, fb);
if (error)
@@ -254,7 +248,7 @@
drm_framebuffer_cleanup(&fb->base);
dealloc:
kmem_free(fb, sizeof(*fb));
- drm_gem_object_unreference_unlocked(gem_obj);
+ drm_gem_object_put_unlocked(gem_obj);
return NULL;
}
@@ -274,7 +268,7 @@
struct tegra_framebuffer *tegra_fb = to_tegra_framebuffer(fb);
drm_framebuffer_cleanup(fb);
- drm_gem_object_unreference_unlocked(&tegra_fb->obj->base);
+ drm_gem_object_put_unlocked(&tegra_fb->obj->base);
kmem_free(tegra_fb, sizeof(*tegra_fb));
}
@@ -321,7 +315,7 @@
crtc->size = size;
crtc->intr = intr;
crtc->ih = intr_establish_xname(intr, IPL_VM, IST_LEVEL | IST_MPSAFE,
- tegra_crtc_intr, crtc, device_xname(self)); /* XXX */
+ tegra_crtc_intr, crtc, device_xname(sc->sc_dev)); /* XXX */
if (crtc->ih == NULL) {
DRM_ERROR("failed to establish interrupt for crtc %d\n", index);
}
@@ -406,7 +400,7 @@
goto done;
}
- gem_obj = drm_gem_object_lookup(crtc->dev, file_priv, handle);
+ gem_obj = drm_gem_object_lookup(file_priv, handle);
if (gem_obj == NULL) {
DRM_ERROR("Cannot find cursor object %#x for crtc %d\n",
handle, tegra_crtc->index);
@@ -506,7 +500,7 @@
}
if (gem_obj) {
- drm_gem_object_unreference_unlocked(gem_obj);
+ drm_gem_object_put_unlocked(gem_obj);
}
Home |
Main Index |
Thread Index |
Old Index