Source-Changes-HG archive

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

[src/trunk]: src/sys/external/bsd/drm2 amdgpu: amdgpu_dm.c, amdgpu_dm_hdcp.c,...



details:   https://anonhg.NetBSD.org/src/rev/dd874a9352f6
branches:  trunk
changeset: 1028786:dd874a9352f6
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Dec 19 12:01:30 2021 +0000

description:
amdgpu: amdgpu_dm.c, amdgpu_dm_hdcp.c, amdgpu_dm_helpers.c

diffstat:

 sys/external/bsd/drm2/amdgpu/files.amdgpu                                |   8 +-
 sys/external/bsd/drm2/dist/drm/amd/display/amdgpu_dm/amdgpu_dm.c         |  51 ++++++---
 sys/external/bsd/drm2/dist/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c    |   8 +-
 sys/external/bsd/drm2/dist/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c |  14 +-
 4 files changed, 49 insertions(+), 32 deletions(-)

diffs (truncated from 305 to 300 lines):

diff -r 3a611ada4492 -r dd874a9352f6 sys/external/bsd/drm2/amdgpu/files.amdgpu
--- a/sys/external/bsd/drm2/amdgpu/files.amdgpu Sun Dec 19 12:01:21 2021 +0000
+++ b/sys/external/bsd/drm2/amdgpu/files.amdgpu Sun Dec 19 12:01:30 2021 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.amdgpu,v 1.19 2021/12/19 12:00:00 riastradh Exp $
+#      $NetBSD: files.amdgpu,v 1.20 2021/12/19 12:01:30 riastradh Exp $
 
 version        20180827
 
@@ -31,8 +31,10 @@
 makeoptions    amdgpu  "CPPFLAGS.amdgpu"+="-I$S/external/bsd/drm2/dist/drm/amd/display/amdgpu_dm"
 makeoptions    amdgpu  "CPPFLAGS.amdgpu"+="-I$S/external/bsd/drm2/dist/drm/amd/display/dmub/inc"
 
-makeoptions    amdgpu  "CPPFLAGS.amdgpu"+="-DCONFIG_DRM_AMD_ACP"
-makeoptions    amdgpu  "CPPFLAGS.amdgpu"+="-DCONFIG_DRM_AMD_DC_DCN"
+makeoptions    amdgpu  "CPPFLAGS.amdgpu"+="-DCONFIG_DRM_AMD_ACP=1"
+makeoptions    amdgpu  "CPPFLAGS.amdgpu"+="-DCONFIG_DRM_AMD_DC_DCN=1"
+makeoptions    amdgpu  "CPPFLAGS.amdgpu"+="-DCONFIG_DRM_AMD_DC_HDCP=1"
+makeoptions    amdgpu  "CPPFLAGS.amdgpu"+="-DCONFIG_PERF_EVENTS=0"
 
 makeoptions    amdgpu  "CWARNFLAGS.amdgpu"+="-Wno-missing-field-initializers"
 makeoptions    amdgpu  "CWARNFLAGS.amdgpu"+="-Wno-missing-prototypes"
diff -r 3a611ada4492 -r dd874a9352f6 sys/external/bsd/drm2/dist/drm/amd/display/amdgpu_dm/amdgpu_dm.c
--- a/sys/external/bsd/drm2/dist/drm/amd/display/amdgpu_dm/amdgpu_dm.c  Sun Dec 19 12:01:21 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/amd/display/amdgpu_dm/amdgpu_dm.c  Sun Dec 19 12:01:30 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amdgpu_dm.c,v 1.2 2021/12/18 23:45:00 riastradh Exp $  */
+/*     $NetBSD: amdgpu_dm.c,v 1.3 2021/12/19 12:01:30 riastradh Exp $  */
 
 /*
  * Copyright 2015 Advanced Micro Devices, Inc.
@@ -27,7 +27,7 @@
 
 /* The caprices of the preprocessor require that this be declared right here */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_dm.c,v 1.2 2021/12/18 23:45:00 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_dm.c,v 1.3 2021/12/19 12:01:30 riastradh Exp $");
 
 #define CREATE_TRACE_POINTS
 
@@ -97,6 +97,8 @@
 #include "modules/power/power_helpers.h"
 #include "modules/inc/mod_info_packet.h"
 
+#include <linux/nbsd-namespace.h>
+
 #define FIRMWARE_RENOIR_DMUB "amdgpu/renoir_dmcub.bin"
 MODULE_FIRMWARE(FIRMWARE_RENOIR_DMUB);
 
@@ -617,6 +619,7 @@
 
 }
 
+#ifndef __NetBSD__             /* XXX amdgpu audio */
 static int amdgpu_dm_audio_component_get_eld(struct device *kdev, int port,
                                          int pipe, bool *enabled,
                                          unsigned char *buf, int max_bytes)
@@ -687,6 +690,7 @@
        .bind   = amdgpu_dm_audio_component_bind,
        .unbind = amdgpu_dm_audio_component_unbind,
 };
+#endif
 
 static int amdgpu_dm_audio_init(struct amdgpu_device *adev)
 {
@@ -711,9 +715,13 @@
                adev->mode_info.audio.pin[i].offset = 0;
        }
 
+#ifdef __NetBSD__              /* XXX amdgpu audio */
+       __USE(ret);
+#else
        ret = component_add(adev->dev, &amdgpu_dm_audio_component_bind_ops);
        if (ret < 0)
                return ret;
+#endif
 
        adev->dm.audio_registered = true;
 
@@ -729,7 +737,9 @@
                return;
 
        if (adev->dm.audio_registered) {
+#ifndef __NetBSD__             /* XXX amdgpu audio */
                component_del(adev->dev, &amdgpu_dm_audio_component_bind_ops);
+#endif
                adev->dm.audio_registered = false;
        }
 
@@ -2448,7 +2458,7 @@
 
        adev->mode_info.mode_config_initialized = true;
 
-       adev->ddev->mode_config.funcs = (void *)&amdgpu_dm_mode_funcs;
+       adev->ddev->mode_config.funcs = &amdgpu_dm_mode_funcs;
        adev->ddev->mode_config.helper_private = &amdgpu_dm_mode_config_helperfuncs;
 
        adev->ddev->mode_config.max_width = 16384;
@@ -2492,12 +2502,12 @@
 #define AMDGPU_DM_DEFAULT_MIN_BACKLIGHT 12
 #define AMDGPU_DM_DEFAULT_MAX_BACKLIGHT 255
 
-#if defined(CONFIG_BACKLIGHT_CLASS_DEVICE) ||\
-       defined(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE)
+#if IS_ENABLED(CONFIG_BACKLIGHT_CLASS_DEVICE) ||\
+       IS_ENABLED(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE)
 
 static void amdgpu_dm_update_backlight_caps(struct amdgpu_display_manager *dm)
 {
-#if defined(CONFIG_ACPI)
+#if IS_ENABLED(CONFIG_ACPI)
        struct amdgpu_dm_backlight_caps caps;
 
        if (dm->backlight_caps.caps_valid)
@@ -2640,8 +2650,8 @@
 static void register_backlight_device(struct amdgpu_display_manager *dm,
                                      struct dc_link *link)
 {
-#if defined(CONFIG_BACKLIGHT_CLASS_DEVICE) ||\
-       defined(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE)
+#if IS_ENABLED(CONFIG_BACKLIGHT_CLASS_DEVICE) ||\
+       IS_ENABLED(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE)
 
        if ((link->connector_signal & (SIGNAL_TYPE_EDP | SIGNAL_TYPE_LVDS)) &&
            link->type != dc_connection_none) {
@@ -3759,7 +3769,7 @@
 {
        struct dc_crtc_timing *timing_out = &stream->timing;
        const struct drm_display_info *info = &connector->display_info;
-       struct amdgpu_dm_connector *aconnector = to_amdgpu_dm_connector(connector);
+       const struct amdgpu_dm_connector *aconnector = const_container_of(connector, struct amdgpu_dm_connector, base);
        struct hdmi_vendor_infoframe hv_frame;
        struct hdmi_avi_infoframe avi_frame;
 
@@ -3803,9 +3813,9 @@
        }
 
        if (stream->signal == SIGNAL_TYPE_HDMI_TYPE_A) {
-               drm_hdmi_avi_infoframe_from_display_mode(&avi_frame, (struct drm_connector *)connector, mode_in);
+               drm_hdmi_avi_infoframe_from_display_mode(&avi_frame, __UNCONST(connector), mode_in);
                timing_out->vic = avi_frame.video_code;
-               drm_hdmi_vendor_infoframe_from_display_mode(&hv_frame, (struct drm_connector *)connector, mode_in);
+               drm_hdmi_vendor_infoframe_from_display_mode(&hv_frame, __UNCONST(connector), mode_in);
                timing_out->hdmi_vic = hv_frame.vic;
        }
 
@@ -4365,8 +4375,8 @@
 {
        struct drm_device *dev = connector->dev;
        struct amdgpu_device *adev = dev->dev_private;
-       struct dm_connector_state *dm_state =
-               to_dm_connector_state(state);
+       const struct dm_connector_state *dm_state =
+               const_container_of(state, struct dm_connector_state, base);
        int ret = -EINVAL;
 
        if (property == dev->mode_config.scaling_mode_property) {
@@ -4417,8 +4427,8 @@
        struct amdgpu_device *adev = connector->dev->dev_private;
        struct amdgpu_display_manager *dm = &adev->dm;
 
-#if defined(CONFIG_BACKLIGHT_CLASS_DEVICE) ||\
-       defined(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE)
+#if IS_ENABLED(CONFIG_BACKLIGHT_CLASS_DEVICE) ||\
+       IS_ENABLED(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE)
 
        if ((link->connector_signal & (SIGNAL_TYPE_EDP | SIGNAL_TYPE_LVDS)) &&
            link->type != dc_connection_none &&
@@ -4426,6 +4436,9 @@
                backlight_device_unregister(dm->backlight_dev);
                dm->backlight_dev = NULL;
        }
+#else
+       __USE(dm);
+       __USE(link);
 #endif
 
        if (aconnector->dc_em_sink)
@@ -4968,7 +4981,7 @@
 {
        struct dc_stream_state *stream = NULL;
        struct drm_connector *connector;
-       struct drm_connector_state *new_con_state, *old_con_state;
+       struct drm_connector_state *new_con_state, *old_con_state __unused;
        struct amdgpu_dm_connector *aconnector;
        struct dm_connector_state *dm_conn_state;
        int i, j, clock, bpp;
@@ -5773,7 +5786,7 @@
                return NULL;
        i2c->base.owner = THIS_MODULE;
        i2c->base.class = I2C_CLASS_DDC;
-       i2c->base.dev.parent = &adev->pdev->dev;
+       i2c->base.dev.parent = pci_dev_dev(adev->pdev);
        i2c->base.algo = &amdgpu_dm_i2c_algo;
        snprintf(i2c->base.name, sizeof(i2c->base.name), "AMDGPU DM i2c hw bus %d", link_index);
        i2c_set_adapdata(&i2c->base, i2c);
@@ -5960,7 +5973,7 @@
                                            const struct drm_connector_state *old_state,
                                            const struct drm_connector *connector, struct hdcp_workqueue *hdcp_w)
 {
-       struct amdgpu_dm_connector *aconnector = to_amdgpu_dm_connector(connector);
+       const struct amdgpu_dm_connector *aconnector = const_container_of(connector, struct amdgpu_dm_connector, base);
 
        if (old_state->hdcp_content_type != state->hdcp_content_type &&
            state->content_protection != DRM_MODE_CONTENT_PROTECTION_UNDESIRED) {
@@ -6300,7 +6313,7 @@
 static void amdgpu_dm_commit_cursors(struct drm_atomic_state *state)
 {
        struct drm_plane *plane;
-       struct drm_plane_state *old_plane_state, *new_plane_state;
+       struct drm_plane_state *old_plane_state, *new_plane_state __unused;
        int i;
 
        /*
diff -r 3a611ada4492 -r dd874a9352f6 sys/external/bsd/drm2/dist/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c
--- a/sys/external/bsd/drm2/dist/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c     Sun Dec 19 12:01:21 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c     Sun Dec 19 12:01:30 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amdgpu_dm_hdcp.c,v 1.2 2021/12/18 23:45:00 riastradh Exp $     */
+/*     $NetBSD: amdgpu_dm_hdcp.c,v 1.3 2021/12/19 12:01:30 riastradh Exp $     */
 
 /*
  * Copyright 2019 Advanced Micro Devices, Inc.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_dm_hdcp.c,v 1.2 2021/12/18 23:45:00 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_dm_hdcp.c,v 1.3 2021/12/19 12:01:30 riastradh Exp $");
 
 #include "amdgpu_dm_hdcp.h"
 #include "amdgpu.h"
@@ -34,12 +34,14 @@
 #include "dm_helpers.h"
 #include <drm/drm_hdcp.h>
 
+#include <linux/nbsd-namespace.h>
+
 static bool
 lp_write_i2c(void *handle, uint32_t address, const uint8_t *data, uint32_t size)
 {
 
        struct dc_link *link = handle;
-       struct i2c_payload i2c_payloads[] = {{true, address, size, (void *)data} };
+       struct i2c_payload i2c_payloads[] = {{true, address, size, __UNCONST(data)} };
        struct i2c_command cmd = {i2c_payloads, 1, I2C_COMMAND_ENGINE_HW, link->dc->caps.i2c_speed_in_khz};
 
        return dm_helpers_submit_i2c(link->ctx, link, &cmd);
diff -r 3a611ada4492 -r dd874a9352f6 sys/external/bsd/drm2/dist/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
--- a/sys/external/bsd/drm2/dist/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c  Sun Dec 19 12:01:21 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c  Sun Dec 19 12:01:30 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amdgpu_dm_helpers.c,v 1.2 2021/12/18 23:45:00 riastradh Exp $  */
+/*     $NetBSD: amdgpu_dm_helpers.c,v 1.3 2021/12/19 12:01:30 riastradh Exp $  */
 
 /*
  * Copyright 2015 Advanced Micro Devices, Inc.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_dm_helpers.c,v 1.2 2021/12/18 23:45:00 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_dm_helpers.c,v 1.3 2021/12/19 12:01:30 riastradh Exp $");
 
 #include <linux/string.h>
 #include <linux/acpi.h>
@@ -60,7 +60,7 @@
                const struct dc_edid *edid,
                struct dc_edid_caps *edid_caps)
 {
-       struct edid *edid_buf = (struct edid *) edid->raw_edid;
+       struct edid *edid_buf = (struct edid *) __UNCONST(edid->raw_edid);
        struct cea_sad *sads;
        int sad_count = -1;
        int sadb_count = -1;
@@ -100,9 +100,9 @@
        }
 
        edid_caps->edid_hdmi = drm_detect_hdmi_monitor(
-                       (struct edid *) edid->raw_edid);
+                       (struct edid *) __UNCONST(edid->raw_edid));
 
-       sad_count = drm_edid_to_sad((struct edid *) edid->raw_edid, &sads);
+       sad_count = drm_edid_to_sad((struct edid *) __UNCONST(edid->raw_edid), &sads);
        if (sad_count <= 0)
                return result;
 
@@ -116,7 +116,7 @@
                edid_caps->audio_modes[i].sample_size = sad->byte2;
        }
 
-       sadb_count = drm_edid_to_speaker_allocation((struct edid *) edid->raw_edid, &sadb);
+       sadb_count = drm_edid_to_speaker_allocation((struct edid *) __UNCONST(edid->raw_edid), &sadb);
 
        if (sadb_count < 0) {
                DRM_ERROR("Couldn't read Speaker Allocation Data Block: %d\n", sadb_count);
@@ -473,7 +473,7 @@
        }
 
        return drm_dp_dpcd_write(&aconnector->dm_dp_aux.aux,



Home | Main Index | Thread Index | Old Index