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/include/linux i915: more passes



details:   https://anonhg.NetBSD.org/src/rev/8c61ca3ff4fc
branches:  trunk
changeset: 1028667:8c61ca3ff4fc
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Dec 19 11:38:26 2021 +0000

description:
i915: more passes

diffstat:

 sys/external/bsd/drm2/dist/drm/i915/display/intel_display_types.h |    7 +-
 sys/external/bsd/drm2/dist/drm/i915/display/intel_dp.c            |   20 +-
 sys/external/bsd/drm2/dist/drm/i915/display/intel_dpll_mgr.c      |    6 +-
 sys/external/bsd/drm2/dist/drm/i915/display/intel_dsb.c           |    6 +-
 sys/external/bsd/drm2/dist/drm/i915/display/intel_hdcp.c          |   13 +-
 sys/external/bsd/drm2/i915drm/files.i915drmkms                    |    4 +-
 sys/external/bsd/drm2/include/linux/hdmi.h                        |  122 +++++++--
 7 files changed, 120 insertions(+), 58 deletions(-)

diffs (truncated from 366 to 300 lines):

diff -r d2b5b0f877c4 -r 8c61ca3ff4fc sys/external/bsd/drm2/dist/drm/i915/display/intel_display_types.h
--- a/sys/external/bsd/drm2/dist/drm/i915/display/intel_display_types.h Sun Dec 19 11:38:03 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/display/intel_display_types.h Sun Dec 19 11:38:26 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: intel_display_types.h,v 1.3 2021/12/19 11:11:11 riastradh Exp $        */
+/*     $NetBSD: intel_display_types.h,v 1.4 2021/12/19 11:38:26 riastradh Exp $        */
 
 /*
  * Copyright (c) 2006 Dave Airlie <airlied%linux.ie@localhost>
@@ -387,11 +387,8 @@
         * Work queue to signal the CP_IRQ. Used for the waiters to read the
         * available information from HDCP DP sink.
         */
-#ifdef __linux__
-       wait_queue_head_t cp_irq_queue;
-#else
+       spinlock_t cp_irq_lock;
        drm_waitqueue_t cp_irq_queue;
-#endif
        atomic_t cp_irq_count;
        int cp_irq_count_cached;
 
diff -r d2b5b0f877c4 -r 8c61ca3ff4fc sys/external/bsd/drm2/dist/drm/i915/display/intel_dp.c
--- a/sys/external/bsd/drm2/dist/drm/i915/display/intel_dp.c    Sun Dec 19 11:38:03 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/display/intel_dp.c    Sun Dec 19 11:38:26 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: intel_dp.c,v 1.3 2021/12/19 11:38:03 riastradh Exp $   */
+/*     $NetBSD: intel_dp.c,v 1.4 2021/12/19 11:38:26 riastradh Exp $   */
 
 /*
  * Copyright © 2008 Intel Corporation
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intel_dp.c,v 1.3 2021/12/19 11:38:03 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intel_dp.c,v 1.4 2021/12/19 11:38:26 riastradh Exp $");
 
 #include <linux/export.h>
 #include <linux/i2c.h>
@@ -4776,7 +4776,7 @@
         * Packet Type 80h + Non-audio INFOFRAME Type value
         * HDMI_INFOFRAME_TYPE_DRM: 0x87,
         */
-       infoframe_sdp.sdp_header.HB1 = drm_infoframe.type;
+       infoframe_sdp.sdp_header.HB1 = drm_infoframe.header.type;
        /*
         * Least Significant Eight Bits of (Data Byte Count – 1)
         * infoframe_size - 1,
@@ -4785,9 +4785,9 @@
        /* INFOFRAME SDP Version Number */
        infoframe_sdp.sdp_header.HB3 = (0x13 << 2);
        /* CTA Header Byte 2 (INFOFRAME Version Number) */
-       infoframe_sdp.db[0] = drm_infoframe.version;
+       infoframe_sdp.db[0] = drm_infoframe.header.version;
        /* CTA Header Byte 3 (Length of INFOFRAME): HDMI_DRM_INFOFRAME_SIZE */
-       infoframe_sdp.db[1] = drm_infoframe.length;
+       infoframe_sdp.db[1] = drm_infoframe.header.length;
        /*
         * Copy HDMI_DRM_INFOFRAME_SIZE size from a buffer after
         * HDMI_INFOFRAME_HEADER_SIZE
@@ -5924,11 +5924,15 @@
        long ret;
 
 #define C (hdcp->cp_irq_count_cached != atomic_read(&hdcp->cp_irq_count))
-       ret = wait_event_interruptible_timeout(hdcp->cp_irq_queue, C,
-                                              msecs_to_jiffies(timeout));
-
+       unsigned long irqflags;
+       spin_lock_irqsave(&hdcp->cp_irq_lock, irqflags);
+       DRM_SPIN_TIMED_WAIT_UNTIL(ret, &hdcp->cp_irq_queue,
+           &hdcp->cp_irq_lock,
+           msecs_to_jiffies(timeout),
+           C);
        if (!ret)
                DRM_DEBUG_KMS("Timedout at waiting for CP_IRQ\n");
+       spin_unlock_irqrestore(&hdcp->cp_irq_lock, irqflags);
 }
 
 static
diff -r d2b5b0f877c4 -r 8c61ca3ff4fc sys/external/bsd/drm2/dist/drm/i915/display/intel_dpll_mgr.c
--- a/sys/external/bsd/drm2/dist/drm/i915/display/intel_dpll_mgr.c      Sun Dec 19 11:38:03 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/display/intel_dpll_mgr.c      Sun Dec 19 11:38:26 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: intel_dpll_mgr.c,v 1.2 2021/12/18 23:45:30 riastradh Exp $     */
+/*     $NetBSD: intel_dpll_mgr.c,v 1.3 2021/12/19 11:38:26 riastradh Exp $     */
 
 /*
  * Copyright © 2006-2016 Intel Corporation
@@ -24,12 +24,14 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intel_dpll_mgr.c,v 1.2 2021/12/18 23:45:30 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intel_dpll_mgr.c,v 1.3 2021/12/19 11:38:26 riastradh Exp $");
 
 #include "intel_display_types.h"
 #include "intel_dpio_phy.h"
 #include "intel_dpll_mgr.h"
 
+#include <linux/nbsd-namespace.h>
+
 /**
  * DOC: Display PLLs
  *
diff -r d2b5b0f877c4 -r 8c61ca3ff4fc sys/external/bsd/drm2/dist/drm/i915/display/intel_dsb.c
--- a/sys/external/bsd/drm2/dist/drm/i915/display/intel_dsb.c   Sun Dec 19 11:38:03 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/display/intel_dsb.c   Sun Dec 19 11:38:26 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: intel_dsb.c,v 1.2 2021/12/18 23:45:30 riastradh Exp $  */
+/*     $NetBSD: intel_dsb.c,v 1.3 2021/12/19 11:38:26 riastradh Exp $  */
 
 // SPDX-License-Identifier: MIT
 /*
@@ -7,11 +7,13 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intel_dsb.c,v 1.2 2021/12/18 23:45:30 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intel_dsb.c,v 1.3 2021/12/19 11:38:26 riastradh Exp $");
 
 #include "i915_drv.h"
 #include "intel_display_types.h"
 
+#include <linux/nbsd-namespace.h>
+
 #define DSB_BUF_SIZE    (2 * PAGE_SIZE)
 
 /**
diff -r d2b5b0f877c4 -r 8c61ca3ff4fc sys/external/bsd/drm2/dist/drm/i915/display/intel_hdcp.c
--- a/sys/external/bsd/drm2/dist/drm/i915/display/intel_hdcp.c  Sun Dec 19 11:38:03 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/display/intel_hdcp.c  Sun Dec 19 11:38:26 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: intel_hdcp.c,v 1.2 2021/12/18 23:45:30 riastradh Exp $ */
+/*     $NetBSD: intel_hdcp.c,v 1.3 2021/12/19 11:38:26 riastradh Exp $ */
 
 /* SPDX-License-Identifier: MIT */
 /*
@@ -11,7 +11,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intel_hdcp.c,v 1.2 2021/12/18 23:45:30 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intel_hdcp.c,v 1.3 2021/12/19 11:38:26 riastradh Exp $");
 
 #include <linux/component.h>
 #include <linux/i2c.h>
@@ -1939,10 +1939,11 @@
        }
 
        hdcp->shim = shim;
+       /* XXX destroy */
        mutex_init(&hdcp->mutex);
        INIT_DELAYED_WORK(&hdcp->check_work, intel_hdcp_check_work);
        INIT_WORK(&hdcp->prop_work, intel_hdcp_prop_work);
-       init_waitqueue_head(&hdcp->cp_irq_queue);
+       DRM_INIT_WAITQUEUE(&hdcp->cp_irq_queue, "hdcpirq");
 
        return 0;
 }
@@ -2087,8 +2088,12 @@
        if (!hdcp->shim)
                return;
 
+       unsigned long irqflags;
+       spin_lock_irqsave(&connector->hdcp.cp_irq_lock, irqflags);
        atomic_inc(&connector->hdcp.cp_irq_count);
-       wake_up_all(&connector->hdcp.cp_irq_queue);
+       DRM_SPIN_WAKEUP_ALL(&connector->hdcp.cp_irq_queue,
+           &connector->hdcp.cp_irq_lock);
+       spin_unlock_irqrestore(&connector->hdcp.cp_irq_lock, irqflags);
 
        schedule_delayed_work(&hdcp->check_work, 0);
 }
diff -r d2b5b0f877c4 -r 8c61ca3ff4fc sys/external/bsd/drm2/i915drm/files.i915drmkms
--- a/sys/external/bsd/drm2/i915drm/files.i915drmkms    Sun Dec 19 11:38:03 2021 +0000
+++ b/sys/external/bsd/drm2/i915drm/files.i915drmkms    Sun Dec 19 11:38:26 2021 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.i915drmkms,v 1.74 2021/12/19 11:38:04 riastradh Exp $
+#      $NetBSD: files.i915drmkms,v 1.75 2021/12/19 11:38:26 riastradh Exp $
 
 version        20180827
 
@@ -88,7 +88,7 @@
 file   external/bsd/drm2/dist/drm/i915/display/intel_dpio_phy.c        i915drmkms
 file   external/bsd/drm2/dist/drm/i915/display/intel_dpll_mgr.c        i915drmkms
 file   external/bsd/drm2/dist/drm/i915/display/intel_dsb.c     i915drmkms
-file   external/bsd/drm2/dist/drm/i915/display/intel_dsi.c     i915drmkms
+#file  external/bsd/drm2/dist/drm/i915/display/intel_dsi.c     i915drmkms
 file   external/bsd/drm2/dist/drm/i915/display/intel_dsi_dcs_backlight.c       i915drmkms
 file   external/bsd/drm2/dist/drm/i915/display/intel_dsi_vbt.c i915drmkms
 file   external/bsd/drm2/dist/drm/i915/display/intel_dvo.c     i915drmkms
diff -r d2b5b0f877c4 -r 8c61ca3ff4fc sys/external/bsd/drm2/include/linux/hdmi.h
--- a/sys/external/bsd/drm2/include/linux/hdmi.h        Sun Dec 19 11:38:03 2021 +0000
+++ b/sys/external/bsd/drm2/include/linux/hdmi.h        Sun Dec 19 11:38:26 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hdmi.h,v 1.10 2021/12/19 11:38:04 riastradh Exp $      */
+/*     $NetBSD: hdmi.h,v 1.11 2021/12/19 11:38:27 riastradh Exp $      */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -199,6 +199,18 @@
        HDMI_STATIC_METADATA_TYPE1 = 1,
 };
 
+struct hdmi_type1 {
+       enum hdmi_eotf                  eotf;
+       enum hdmi_metadata_type         metadata_type;
+       uint16_t                        min_cll;
+       uint16_t                        max_cll;
+       uint16_t                        max_fall;
+};
+
+struct hdr_sink_metadata {
+       struct hdmi_type1               hdmi_type1;
+};
+
 #define        HDMI_INFOFRAME_SIZE(TYPE)                                             \
        (HDMI_INFOFRAME_HEADER_SIZE + HDMI_##TYPE##_INFOFRAME_SIZE)
 
@@ -210,33 +222,6 @@
        /* checksum */
 };
 
-struct hdmi_type1 {
-       enum hdmi_eotf eotf;
-       enum hdmi_metadata_type metadata_type;
-       uint16_t min_cll;
-       uint16_t max_cll;
-       uint16_t max_fall;
-};
-
-struct hdr_sink_metadata {
-       struct hdmi_type1 hdmi_type1;
-};
-
-struct hdmi_drm_infoframe {
-       enum hdmi_eotf eotf;
-       enum hdmi_metadata_type metadata_type;
-       struct {
-               uint16_t x, y;
-       } display_primaries[3];
-       struct {
-               uint16_t x, y;
-       } white_point;
-       uint16_t max_display_mastering_luminance;
-       uint16_t min_display_mastering_luminance;
-       uint16_t max_cll;
-       uint16_t max_fall;
-};
-
 static inline void
 hdmi_infoframe_header_init(struct hdmi_infoframe_header *header,
     enum hdmi_infoframe_type type, uint8_t vers, uint8_t length)
@@ -499,6 +484,7 @@
        (void)memcpy(&p[0], frame->vendor, 8);
        (void)memcpy(&p[8], frame->product, 16);
        p[24] = frame->sdi;
+       CTASSERT(HDMI_SPD_INFOFRAME_SIZE == 25);
 
        hdmi_infoframe_checksum(buf, length);
 
@@ -583,9 +569,80 @@
        return length;
 }
 
+#define        HDMI_DRM_INFOFRAME_SIZE         26
+struct hdmi_drm_infoframe {
+       struct hdmi_infoframe_header    header;
+       enum hdmi_eotf                  eotf;
+       enum hdmi_metadata_type         metadata_type;
+       struct {
+               uint16_t        x, y;
+       }                               display_primaries[3];
+       struct {
+               uint16_t        x, y;
+       }                               white_point;
+       uint16_t                        max_display_mastering_luminance;
+       uint16_t                        min_display_mastering_luminance;
+       uint16_t                        max_cll;
+       uint16_t                        max_fall;
+};
+
+static inline int
+hdmi_drm_infoframe_init(struct hdmi_drm_infoframe *frame)
+{
+       static const struct hdmi_drm_infoframe zero_frame;
+
+       *frame = zero_frame;
+
+       hdmi_infoframe_header_init(&frame->header, HDMI_INFOFRAME_TYPE_DRM,
+           1, HDMI_DRM_INFOFRAME_SIZE);
+
+       return 0;
+}
+
+#define        hdmi_drm_infoframe_pack_only    hdmi_drm_infoframe_pack /* XXX */
+
+static inline int
+hdmi_drm_infoframe_pack(const struct hdmi_drm_infoframe *frame,


Home | Main Index | Thread Index | Old Index