[PATCH 21/21] drm/i915: remove intel_memory_region_ops::flags

2024-02-15 Thread Jiri Slaby (SUSE)
intel_memory_region_ops::flags was never used since its addition in
commit 232a6ebae419 (drm/i915: introduce intel_memory_region). Drop it.

Found by https://github.com/jirislaby/clang-struct.

Signed-off-by: Jiri Slaby (SUSE) 
Cc: Jani Nikula 
Cc: Joonas Lahtinen 
Cc: Rodrigo Vivi 
Cc: Tvrtko Ursulin 
Cc: intel-gfx@lists.freedesktop.org
---
 drivers/gpu/drm/i915/intel_memory_region.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_memory_region.h 
b/drivers/gpu/drm/i915/intel_memory_region.h
index 40810cfb3fd9..8c927e303c4a 100644
--- a/drivers/gpu/drm/i915/intel_memory_region.h
+++ b/drivers/gpu/drm/i915/intel_memory_region.h
@@ -50,8 +50,6 @@ enum intel_region_id {
for_each_if((mr) = (i915)->mm.regions[id])
 
 struct intel_memory_region_ops {
-   unsigned int flags;
-
int (*init)(struct intel_memory_region *mem);
int (*release)(struct intel_memory_region *mem);
 
-- 
2.43.1



[PATCH 20/21] drm/i915: remove i915_vma::obj_hash

2024-02-15 Thread Jiri Slaby (SUSE)
i915_vma::obj_hash was never used since its addition in commit
4ff4b44cbb70 (drm/i915: Store a direct lookup from object handle to
vma). Drop it.

Found by https://github.com/jirislaby/clang-struct.

Signed-off-by: Jiri Slaby (SUSE) 
Cc: Jani Nikula 
Cc: Joonas Lahtinen 
Cc: Rodrigo Vivi 
Cc: Tvrtko Ursulin 
Cc: intel-gfx@lists.freedesktop.org
---
 drivers/gpu/drm/i915/i915_vma_types.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_vma_types.h 
b/drivers/gpu/drm/i915/i915_vma_types.h
index 64472b7f0e77..559de74d0b11 100644
--- a/drivers/gpu/drm/i915/i915_vma_types.h
+++ b/drivers/gpu/drm/i915/i915_vma_types.h
@@ -290,7 +290,6 @@ struct i915_vma {
 
struct list_head obj_link; /* Link in the object's VMA list */
struct rb_node obj_node;
-   struct hlist_node obj_hash;
 
/** This vma's place in the eviction list */
struct list_head evict_link;
-- 
2.43.1



[PATCH 19/21] drm/i915: remove execute_cb::signal

2024-02-15 Thread Jiri Slaby (SUSE)
execute_cb::signal is not used since commit 5ac545b8b014
(drm/i915/request: Remove the hook from await_execution). Drop it.

Found by https://github.com/jirislaby/clang-struct.

Signed-off-by: Jiri Slaby (SUSE) 
Cc: Jani Nikula 
Cc: Joonas Lahtinen 
Cc: Rodrigo Vivi 
Cc: Tvrtko Ursulin 
Cc: intel-gfx@lists.freedesktop.org
---
 drivers/gpu/drm/i915/i915_request.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_request.c 
b/drivers/gpu/drm/i915/i915_request.c
index f59081066a19..519e096c607c 100644
--- a/drivers/gpu/drm/i915/i915_request.c
+++ b/drivers/gpu/drm/i915/i915_request.c
@@ -52,7 +52,6 @@
 struct execute_cb {
struct irq_work work;
struct i915_sw_fence *fence;
-   struct i915_request *signal;
 };
 
 static struct kmem_cache *slab_requests;
-- 
2.43.1



[PATCH 18/21] drm/i915: remove intel_gvt_irq::pending_events

2024-02-15 Thread Jiri Slaby (SUSE)
intel_gvt_irq::pending_events was never used since its addition in
commit c8fe6a6811a7 (drm/i915/gvt: vGPU interrupt virtualization.).
Drop it.

Found by https://github.com/jirislaby/clang-struct.

Signed-off-by: Jiri Slaby (SUSE) 
Cc: Jani Nikula 
Cc: Joonas Lahtinen 
Cc: Rodrigo Vivi 
Cc: Tvrtko Ursulin 
Cc: intel-gfx@lists.freedesktop.org
---
 drivers/gpu/drm/i915/gvt/interrupt.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/gvt/interrupt.h 
b/drivers/gpu/drm/i915/gvt/interrupt.h
index b1fd6ed4e34a..cd214be98668 100644
--- a/drivers/gpu/drm/i915/gvt/interrupt.h
+++ b/drivers/gpu/drm/i915/gvt/interrupt.h
@@ -187,7 +187,6 @@ struct intel_gvt_irq {
struct intel_gvt_irq_info *info[INTEL_GVT_IRQ_INFO_MAX];
DECLARE_BITMAP(irq_info_bitmap, INTEL_GVT_IRQ_INFO_MAX);
struct intel_gvt_event_info events[INTEL_GVT_EVENT_MAX];
-   DECLARE_BITMAP(pending_events, INTEL_GVT_EVENT_MAX);
struct intel_gvt_irq_map *irq_map;
 };
 
-- 
2.43.1



[PATCH 17/21] drm/i915: remove intel_gvt_event_info::policy

2024-02-15 Thread Jiri Slaby (SUSE)
intel_gvt_event_info::policy was never used since its addition in
commit c8fe6a6811a7 (drm/i915/gvt: vGPU interrupt virtualization.).
Drop it.

Found by https://github.com/jirislaby/clang-struct.

Signed-off-by: Jiri Slaby (SUSE) 
Cc: Jani Nikula 
Cc: Joonas Lahtinen 
Cc: Rodrigo Vivi 
Cc: Tvrtko Ursulin 
Cc: intel-gfx@lists.freedesktop.org
---
 drivers/gpu/drm/i915/gvt/interrupt.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/gvt/interrupt.h 
b/drivers/gpu/drm/i915/gvt/interrupt.h
index e60ad476fe60..b1fd6ed4e34a 100644
--- a/drivers/gpu/drm/i915/gvt/interrupt.h
+++ b/drivers/gpu/drm/i915/gvt/interrupt.h
@@ -177,7 +177,6 @@ enum intel_gvt_irq_type {
 /* per-event information */
 struct intel_gvt_event_info {
int bit;/* map to register bit */
-   int policy; /* forwarding policy */
struct intel_gvt_irq_info *info;/* register info */
gvt_event_virt_handler_t v_handler; /* for v_event */
 };
-- 
2.43.1



[PATCH 16/21] drm/i915: remove intel_gvt_irq_info::warned

2024-02-15 Thread Jiri Slaby (SUSE)
intel_gvt_irq_info::warned was never used since its addition in commit
c8fe6a6811a7 (drm/i915/gvt: vGPU interrupt virtualization.). Drop it.

Found by https://github.com/jirislaby/clang-struct.

Signed-off-by: Jiri Slaby (SUSE) 
Cc: Jani Nikula 
Cc: Joonas Lahtinen 
Cc: Rodrigo Vivi 
Cc: Tvrtko Ursulin 
Cc: intel-gfx@lists.freedesktop.org
---
 drivers/gpu/drm/i915/gvt/interrupt.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/gvt/interrupt.c 
b/drivers/gpu/drm/i915/gvt/interrupt.c
index c8e7dfc9f791..336d079c4207 100644
--- a/drivers/gpu/drm/i915/gvt/interrupt.c
+++ b/drivers/gpu/drm/i915/gvt/interrupt.c
@@ -40,7 +40,6 @@ struct intel_gvt_irq_info {
char *name;
i915_reg_t reg_base;
enum intel_gvt_event_type bit_to_event[INTEL_GVT_IRQ_BITWIDTH];
-   unsigned long warned;
int group;
DECLARE_BITMAP(downstream_irq_bitmap, INTEL_GVT_IRQ_BITWIDTH);
bool has_upstream_irq;
-- 
2.43.1



[PATCH 15/21] drm/i915: remove gvt_mmio_block::device

2024-02-15 Thread Jiri Slaby (SUSE)
gvt_mmio_block::device is not used since commit e0f74ed4634d (i915/gvt:
Separate the MMIO tracking table from GVT-g). Drop it.

Found by https://github.com/jirislaby/clang-struct.

Signed-off-by: Jiri Slaby (SUSE) 
Cc: Jani Nikula 
Cc: Joonas Lahtinen 
Cc: Rodrigo Vivi 
Cc: Tvrtko Ursulin 
Cc: intel-gfx@lists.freedesktop.org
---
 drivers/gpu/drm/i915/gvt/gvt.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/gvt/gvt.h b/drivers/gpu/drm/i915/gvt/gvt.h
index b8b8ffe4d566..2c95aeef4e41 100644
--- a/drivers/gpu/drm/i915/gvt/gvt.h
+++ b/drivers/gpu/drm/i915/gvt/gvt.h
@@ -253,7 +253,6 @@ struct intel_gvt_fence {
 
 /* Special MMIO blocks. */
 struct gvt_mmio_block {
-   unsigned int device;
i915_reg_t   offset;
unsigned int size;
gvt_mmio_func read;
-- 
2.43.1



[PATCH 14/21] drm/i915: remove intel_vgpu::intx_trigger

2024-02-15 Thread Jiri Slaby (SUSE)
intel_vgpu::intx_trigger was never used since its addition in commit
f30437c5e7bf (drm/i915/gvt: add KVMGT support). Drop it.

Found by https://github.com/jirislaby/clang-struct.

Signed-off-by: Jiri Slaby (SUSE) 
Cc: Jani Nikula 
Cc: Joonas Lahtinen 
Cc: Rodrigo Vivi 
Cc: Tvrtko Ursulin 
Cc: intel-gfx@lists.freedesktop.org
---
 drivers/gpu/drm/i915/gvt/gvt.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/gvt/gvt.h b/drivers/gpu/drm/i915/gvt/gvt.h
index 8e5d696fc79c..b8b8ffe4d566 100644
--- a/drivers/gpu/drm/i915/gvt/gvt.h
+++ b/drivers/gpu/drm/i915/gvt/gvt.h
@@ -221,7 +221,6 @@ struct intel_vgpu {
 
struct vfio_region *region;
int num_regions;
-   struct eventfd_ctx *intx_trigger;
struct eventfd_ctx *msi_trigger;
 
/*
-- 
2.43.1



[PATCH 13/21] drm/i915: remove intel_vgpu_opregion::mapped

2024-02-15 Thread Jiri Slaby (SUSE)
intel_vgpu_opregion::mapped is not used since commit 367748066eeb
(drm/i915/gvt: remove enum hypervisor_type). Drop it.

Found by https://github.com/jirislaby/clang-struct.

Signed-off-by: Jiri Slaby (SUSE) 
Cc: Jani Nikula 
Cc: Joonas Lahtinen 
Cc: Rodrigo Vivi 
Cc: Tvrtko Ursulin 
Cc: intel-gfx@lists.freedesktop.org
---
 drivers/gpu/drm/i915/gvt/gvt.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/gvt/gvt.h b/drivers/gpu/drm/i915/gvt/gvt.h
index b6fe17f1a16f..8e5d696fc79c 100644
--- a/drivers/gpu/drm/i915/gvt/gvt.h
+++ b/drivers/gpu/drm/i915/gvt/gvt.h
@@ -118,7 +118,6 @@ struct intel_vgpu_irq {
 };
 
 struct intel_vgpu_opregion {
-   bool mapped;
void *va;
u32 gfn[INTEL_GVT_OPREGION_PAGES];
 };
-- 
2.43.1



[PATCH 12/21] drm/i915: remove intel_vgpu_fence::base

2024-02-15 Thread Jiri Slaby (SUSE)
intel_vgpu_fence::base was never used since its addition in commit
28a60dee2ce6 (drm/i915/gvt: vGPU HW resource management). Drop it.

Found by https://github.com/jirislaby/clang-struct.

Signed-off-by: Jiri Slaby (SUSE) 
Cc: Jani Nikula 
Cc: Joonas Lahtinen 
Cc: Rodrigo Vivi 
Cc: Tvrtko Ursulin 
Cc: intel-gfx@lists.freedesktop.org
---
 drivers/gpu/drm/i915/gvt/gvt.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/gvt/gvt.h b/drivers/gpu/drm/i915/gvt/gvt.h
index c57aba09091f..b6fe17f1a16f 100644
--- a/drivers/gpu/drm/i915/gvt/gvt.h
+++ b/drivers/gpu/drm/i915/gvt/gvt.h
@@ -89,7 +89,6 @@ struct intel_vgpu_gm {
 /* Fences owned by a vGPU */
 struct intel_vgpu_fence {
struct i915_fence_reg *regs[INTEL_GVT_MAX_NUM_FENCES];
-   u32 base;
u32 size;
 };
 
@@ -444,7 +443,6 @@ int intel_gvt_load_firmware(struct intel_gvt *gvt);
 #define vgpu_hidden_gmadr_end(vgpu) \
(vgpu_hidden_gmadr_base(vgpu) + vgpu_hidden_sz(vgpu) - 1)
 
-#define vgpu_fence_base(vgpu) (vgpu->fence.base)
 #define vgpu_fence_sz(vgpu) (vgpu->fence.size)
 
 /* ring context size i.e. the first 0x50 dwords*/
-- 
2.43.1



[PATCH 11/21] drm/i915: remove intel_vgpu_gtt::active_ppgtt_mm_bitmap

2024-02-15 Thread Jiri Slaby (SUSE)
intel_vgpu_gtt::active_ppgtt_mm_bitmap was never used since its
addition in commit 2707e4446688 (drm/i915/gvt: vGPU graphics memory
virtualization). Drop it.

Found by https://github.com/jirislaby/clang-struct.

Signed-off-by: Jiri Slaby (SUSE) 
Cc: Jani Nikula 
Cc: Joonas Lahtinen 
Cc: Rodrigo Vivi 
Cc: Tvrtko Ursulin 
Cc: intel-gfx@lists.freedesktop.org
---
 drivers/gpu/drm/i915/gvt/gtt.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/gvt/gtt.h b/drivers/gpu/drm/i915/gvt/gtt.h
index fb96ea454fd1..cb50700e6cc9 100644
--- a/drivers/gpu/drm/i915/gvt/gtt.h
+++ b/drivers/gpu/drm/i915/gvt/gtt.h
@@ -208,7 +208,6 @@ struct intel_vgpu_scratch_pt {
 
 struct intel_vgpu_gtt {
struct intel_vgpu_mm *ggtt_mm;
-   unsigned long active_ppgtt_mm_bitmap;
struct list_head ppgtt_mm_list_head;
struct radix_tree_root spt_tree;
struct list_head oos_page_list_head;
-- 
2.43.1



[PATCH 10/21] drm/i915: remove i915_perf_stream::size_exponent

2024-02-15 Thread Jiri Slaby (SUSE)
i915_perf_stream::size_exponent was never used since its addition in
commit a37f08a882b0 (drm/i915/perf: Refactor oa object to better manage
resources). Drop it.

Found by https://github.com/jirislaby/clang-struct.

Signed-off-by: Jiri Slaby (SUSE) 
Cc: Jani Nikula 
Cc: Joonas Lahtinen 
Cc: Rodrigo Vivi 
Cc: Tvrtko Ursulin 
Cc: intel-gfx@lists.freedesktop.org
---
 drivers/gpu/drm/i915/i915_perf_types.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_perf_types.h 
b/drivers/gpu/drm/i915/i915_perf_types.h
index 46445248d193..39fb6ce4a7ef 100644
--- a/drivers/gpu/drm/i915/i915_perf_types.h
+++ b/drivers/gpu/drm/i915/i915_perf_types.h
@@ -288,7 +288,6 @@ struct i915_perf_stream {
struct i915_vma *vma;
u8 *vaddr;
u32 last_ctx_id;
-   int size_exponent;
 
/**
 * @oa_buffer.ptr_lock: Locks reads and writes to all
-- 
2.43.1



[PATCH 09/21] drm/i915: remove i915_drm_client::id

2024-02-15 Thread Jiri Slaby (SUSE)
i915_drm_client::id is not used since commit e894b724c316 (drm/i915:
Use the fdinfo helper). Drop it.

Found by https://github.com/jirislaby/clang-struct.

Signed-off-by: Jiri Slaby (SUSE) 
Cc: Jani Nikula 
Cc: Joonas Lahtinen 
Cc: Rodrigo Vivi 
Cc: Tvrtko Ursulin 
Cc: intel-gfx@lists.freedesktop.org
---
 drivers/gpu/drm/i915/i915_drm_client.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drm_client.h 
b/drivers/gpu/drm/i915/i915_drm_client.h
index a439dd789936..2e7a50d16a88 100644
--- a/drivers/gpu/drm/i915/i915_drm_client.h
+++ b/drivers/gpu/drm/i915/i915_drm_client.h
@@ -24,8 +24,6 @@ struct drm_printer;
 struct i915_drm_client {
struct kref kref;
 
-   unsigned int id;
-
spinlock_t ctx_lock; /* For add/remove from ctx_list. */
struct list_head ctx_list; /* List of contexts belonging to client. */
 
-- 
2.43.1



[PATCH 07/21] drm/i915: remove intel_vbt_panel_data::edp::initialized

2024-02-15 Thread Jiri Slaby (SUSE)
intel_vbt_panel_data::edp::initialized is not used since commit
9f0e7ff4b366 (drm/i915: fetch eDP configuration data from the VBT).
Drop it.

Found by https://github.com/jirislaby/clang-struct.

Signed-off-by: Jiri Slaby (SUSE) 
Cc: Jani Nikula 
Cc: Joonas Lahtinen 
Cc: Rodrigo Vivi 
Cc: Tvrtko Ursulin 
Cc: intel-gfx@lists.freedesktop.org
---
 drivers/gpu/drm/i915/display/intel_display_types.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h 
b/drivers/gpu/drm/i915/display/intel_display_types.h
index 01eb6e4e6049..e0d291dd7d2d 100644
--- a/drivers/gpu/drm/i915/display/intel_display_types.h
+++ b/drivers/gpu/drm/i915/display/intel_display_types.h
@@ -327,7 +327,6 @@ struct intel_vbt_panel_data {
struct edp_power_seq pps;
u8 drrs_msa_timing_delay;
bool low_vswing;
-   bool initialized;
bool hobl;
} edp;
 
-- 
2.43.1



[PATCH 08/21] drm/i915: remove intel_guc::ads_engine_usage_size

2024-02-15 Thread Jiri Slaby (SUSE)
intel_guc::ads_engine_usage_size was never used since its addition in
commit 77cdd054dd2c (drm/i915/pmu: Connect engine busyness stats from
GuC to pmu). Drop it.

Found by https://github.com/jirislaby/clang-struct.

Signed-off-by: Jiri Slaby (SUSE) 
Cc: Jani Nikula 
Cc: Joonas Lahtinen 
Cc: Rodrigo Vivi 
Cc: Tvrtko Ursulin 
Cc: intel-gfx@lists.freedesktop.org
---
 drivers/gpu/drm/i915/gt/uc/intel_guc.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc.h 
b/drivers/gpu/drm/i915/gt/uc/intel_guc.h
index 813cc888e6fa..be70c46604b4 100644
--- a/drivers/gpu/drm/i915/gt/uc/intel_guc.h
+++ b/drivers/gpu/drm/i915/gt/uc/intel_guc.h
@@ -206,8 +206,6 @@ struct intel_guc {
u32 ads_golden_ctxt_size;
/** @ads_capture_size: size of register lists in the ADS used for error 
capture */
u32 ads_capture_size;
-   /** @ads_engine_usage_size: size of engine usage in the ADS */
-   u32 ads_engine_usage_size;
 
/** @lrc_desc_pool_v69: object allocated to hold the GuC LRC descriptor 
pool */
struct i915_vma *lrc_desc_pool_v69;
-- 
2.43.1



[PATCH 06/21] drm/i915: remove intel_vgpu_workload::{ring_context, restore_inhibit}

2024-02-15 Thread Jiri Slaby (SUSE)
intel_vgpu_workload::ring_context was never used since its addition in
commit 28c4c6ca7f79 (drm/i915/gvt: vGPU workload submission) and
::restore_inhibit since its addition in commit e473405783c0
(drm/i915/gvt: vGPU workload scheduler). Drop them.

Found by https://github.com/jirislaby/clang-struct.

Signed-off-by: Jiri Slaby (SUSE) 
Cc: Jani Nikula 
Cc: Joonas Lahtinen 
Cc: Rodrigo Vivi 
Cc: Tvrtko Ursulin 
Cc: intel-gfx@lists.freedesktop.org
---
 drivers/gpu/drm/i915/gvt/scheduler.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/gvt/scheduler.h 
b/drivers/gpu/drm/i915/gvt/scheduler.h
index 1f391b3da2cc..cd94993278b6 100644
--- a/drivers/gpu/drm/i915/gvt/scheduler.h
+++ b/drivers/gpu/drm/i915/gvt/scheduler.h
@@ -104,10 +104,8 @@ struct intel_vgpu_workload {
 
/* execlist context information */
struct execlist_ctx_descriptor_format ctx_desc;
-   struct execlist_ring_context *ring_context;
unsigned long rb_head, rb_tail, rb_ctl, rb_start, rb_len;
unsigned long guest_rb_head;
-   bool restore_inhibit;
struct intel_vgpu_elsp_dwords elsp_dwords;
bool emulate_schedule_in;
atomic_t shadow_ctx_active;
-- 
2.43.1



[PATCH 05/21] drm/i915: remove intel_gvt_mmio_info::{device, addr_range}

2024-02-15 Thread Jiri Slaby (SUSE)
intel_gvt_mmio_info::device is not used since commit e0f74ed4634d
(i915/gvt: Separate the MMIO tracking table from GVT-g) and ::addr_range
was never used since its addition in commit 12d14cc43b34 (drm/i915/gvt:
Introduce a framework for tracking HW registers.). Drop them.

Found by https://github.com/jirislaby/clang-struct.

Signed-off-by: Jiri Slaby (SUSE) 
Cc: Jani Nikula 
Cc: Joonas Lahtinen 
Cc: Rodrigo Vivi 
Cc: Tvrtko Ursulin 
Cc: intel-gfx@lists.freedesktop.org
---
 drivers/gpu/drm/i915/gvt/mmio.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/gvt/mmio.h b/drivers/gpu/drm/i915/gvt/mmio.h
index bba154e38705..32ebacb078e8 100644
--- a/drivers/gpu/drm/i915/gvt/mmio.h
+++ b/drivers/gpu/drm/i915/gvt/mmio.h
@@ -62,10 +62,8 @@ typedef int (*gvt_mmio_func)(struct intel_vgpu *, unsigned 
int, void *,
 struct intel_gvt_mmio_info {
u32 offset;
u64 ro_mask;
-   u32 device;
gvt_mmio_func read;
gvt_mmio_func write;
-   u32 addr_range;
struct hlist_node node;
 };
 
-- 
2.43.1



[PATCH 04/21] drm/i915: remove intel_gvt_gtt::{mm_alloc_page_table, mm_free_page_table}

2024-02-15 Thread Jiri Slaby (SUSE)
intel_gvt_gtt::{mm_alloc_page_table,mm_free_page_table} are not used
since commit ede9d0cfcb78 (drm/i915/gvt: Rework shadow graphic memory
management code). Drop them.

Found by https://github.com/jirislaby/clang-struct.

Signed-off-by: Jiri Slaby (SUSE) 
Cc: Jani Nikula 
Cc: Joonas Lahtinen 
Cc: Rodrigo Vivi 
Cc: Tvrtko Ursulin 
Cc: intel-gfx@lists.freedesktop.org
---
 drivers/gpu/drm/i915/gvt/gtt.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/gvt/gtt.h b/drivers/gpu/drm/i915/gvt/gtt.h
index 4cb183e06e95..fb96ea454fd1 100644
--- a/drivers/gpu/drm/i915/gvt/gtt.h
+++ b/drivers/gpu/drm/i915/gvt/gtt.h
@@ -93,8 +93,6 @@ struct intel_gvt_gtt_gma_ops {
 struct intel_gvt_gtt {
const struct intel_gvt_gtt_pte_ops *pte_ops;
const struct intel_gvt_gtt_gma_ops *gma_ops;
-   int (*mm_alloc_page_table)(struct intel_vgpu_mm *mm);
-   void (*mm_free_page_table)(struct intel_vgpu_mm *mm);
struct list_head oos_page_use_list_head;
struct list_head oos_page_free_list_head;
struct mutex ppgtt_mm_lock;
-- 
2.43.1



[PATCH 00/21] drm/i915: remove unused structure members

2024-02-15 Thread Jiri Slaby (SUSE)
Hi,

this series removes unused i915 structure members as found by
clang-struct (and manually checked by me).

Cc: intel-gfx@lists.freedesktop.org
Cc: Jani Nikula 
Cc: Joonas Lahtinen 
Cc: Rodrigo Vivi 
Cc: Tvrtko Ursulin 

Jiri Slaby (SUSE) (21):
  drm/i915: remove unused intel_dvo_dev_ops hooks
  drm/i915: remove structs intel_vgpu_pipe_format and
intel_vgpu_fb_format
  drm/i915: remove intel_dsi::{port_bits,hs}
  drm/i915: remove
intel_gvt_gtt::{mm_alloc_page_table,mm_free_page_table}
  drm/i915: remove intel_gvt_mmio_info::{device,addr_range}
  drm/i915: remove intel_vgpu_workload::{ring_context,restore_inhibit}
  drm/i915: remove intel_vbt_panel_data::edp::initialized
  drm/i915: remove intel_guc::ads_engine_usage_size
  drm/i915: remove i915_drm_client::id
  drm/i915: remove i915_perf_stream::size_exponent
  drm/i915: remove intel_vgpu_gtt::active_ppgtt_mm_bitmap
  drm/i915: remove intel_vgpu_fence::base
  drm/i915: remove intel_vgpu_opregion::mapped
  drm/i915: remove intel_vgpu::intx_trigger
  drm/i915: remove gvt_mmio_block::device
  drm/i915: remove intel_gvt_irq_info::warned
  drm/i915: remove intel_gvt_event_info::policy
  drm/i915: remove intel_gvt_irq::pending_events
  drm/i915: remove execute_cb::signal
  drm/i915: remove i915_vma::obj_hash
  drm/i915: remove intel_memory_region_ops::flags

 .../drm/i915/display/intel_display_types.h|  1 -
 drivers/gpu/drm/i915/display/intel_dsi.h  |  4 ---
 drivers/gpu/drm/i915/display/intel_dvo_dev.h  | 25 ---
 drivers/gpu/drm/i915/gt/uc/intel_guc.h|  2 --
 drivers/gpu/drm/i915/gvt/fb_decoder.h | 11 
 drivers/gpu/drm/i915/gvt/gtt.h|  3 ---
 drivers/gpu/drm/i915/gvt/gvt.h|  5 
 drivers/gpu/drm/i915/gvt/interrupt.c  |  1 -
 drivers/gpu/drm/i915/gvt/interrupt.h  |  2 --
 drivers/gpu/drm/i915/gvt/mmio.h   |  2 --
 drivers/gpu/drm/i915/gvt/scheduler.h  |  2 --
 drivers/gpu/drm/i915/i915_drm_client.h|  2 --
 drivers/gpu/drm/i915/i915_perf_types.h|  1 -
 drivers/gpu/drm/i915/i915_request.c   |  1 -
 drivers/gpu/drm/i915/i915_vma_types.h |  1 -
 drivers/gpu/drm/i915/intel_memory_region.h|  2 --
 16 files changed, 65 deletions(-)

-- 
2.43.1



[PATCH 02/21] drm/i915: remove structs intel_vgpu_pipe_format and intel_vgpu_fb_format

2024-02-15 Thread Jiri Slaby (SUSE)
Both struct intel_vgpu_pipe_format and intel_vgpu_fb_format were never
used since its addition in commit 9f31d1063b43 (drm/i915/gvt: Add
framebuffer decoder support). Drop them.

Found by https://github.com/jirislaby/clang-struct.

Signed-off-by: Jiri Slaby (SUSE) 
Cc: Jani Nikula 
Cc: Joonas Lahtinen 
Cc: Rodrigo Vivi 
Cc: Tvrtko Ursulin 
Cc: intel-gfx@lists.freedesktop.org
---
 drivers/gpu/drm/i915/gvt/fb_decoder.h | 11 ---
 1 file changed, 11 deletions(-)

diff --git a/drivers/gpu/drm/i915/gvt/fb_decoder.h 
b/drivers/gpu/drm/i915/gvt/fb_decoder.h
index 4eff44194439..fa6503900c84 100644
--- a/drivers/gpu/drm/i915/gvt/fb_decoder.h
+++ b/drivers/gpu/drm/i915/gvt/fb_decoder.h
@@ -152,17 +152,6 @@ struct intel_vgpu_cursor_plane_format {
u32 y_hot;  /* in pixels */
 };
 
-struct intel_vgpu_pipe_format {
-   struct intel_vgpu_primary_plane_format  primary;
-   struct intel_vgpu_sprite_plane_format   sprite;
-   struct intel_vgpu_cursor_plane_format   cursor;
-   enum DDI_PORT ddi_port;  /* the DDI port that pipe is connected to */
-};
-
-struct intel_vgpu_fb_format {
-   struct intel_vgpu_pipe_format   pipes[I915_MAX_PIPES];
-};
-
 int intel_vgpu_decode_primary_plane(struct intel_vgpu *vgpu,
struct intel_vgpu_primary_plane_format *plane);
 int intel_vgpu_decode_cursor_plane(struct intel_vgpu *vgpu,
-- 
2.43.1



[PATCH 01/21] drm/i915: remove unused intel_dvo_dev_ops hooks

2024-02-15 Thread Jiri Slaby (SUSE)
struct intel_dvo_dev_ops's ::create_resources(), ::prepare(),
::commit::, and get_modes() are all unused since their addition in
79e539453b34 (DRM: i915: add mode setting support). Drop all of them.

Found by https://github.com/jirislaby/clang-struct.

Signed-off-by: Jiri Slaby (SUSE) 
Cc: Jani Nikula 
Cc: Joonas Lahtinen 
Cc: Rodrigo Vivi 
Cc: Tvrtko Ursulin 
Cc: intel-gfx@lists.freedesktop.org
---
 drivers/gpu/drm/i915/display/intel_dvo_dev.h | 25 
 1 file changed, 25 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_dvo_dev.h 
b/drivers/gpu/drm/i915/display/intel_dvo_dev.h
index f7e98e1c6470..af7b04539b93 100644
--- a/drivers/gpu/drm/i915/display/intel_dvo_dev.h
+++ b/drivers/gpu/drm/i915/display/intel_dvo_dev.h
@@ -53,12 +53,6 @@ struct intel_dvo_dev_ops {
bool (*init)(struct intel_dvo_device *dvo,
 struct i2c_adapter *i2cbus);
 
-   /*
-* Called to allow the output a chance to create properties after the
-* RandR objects have been created.
-*/
-   void (*create_resources)(struct intel_dvo_device *dvo);
-
/*
 * Turn on/off output.
 *
@@ -79,16 +73,6 @@ struct intel_dvo_dev_ops {
enum drm_mode_status (*mode_valid)(struct intel_dvo_device *dvo,
   struct drm_display_mode *mode);
 
-   /*
-* Callback for preparing mode changes on an output
-*/
-   void (*prepare)(struct intel_dvo_device *dvo);
-
-   /*
-* Callback for committing mode changes on an output
-*/
-   void (*commit)(struct intel_dvo_device *dvo);
-
/*
 * Callback for setting up a video mode after fixups have been made.
 *
@@ -111,15 +95,6 @@ struct intel_dvo_dev_ops {
 */
bool (*get_hw_state)(struct intel_dvo_device *dev);
 
-   /**
-* Query the device for the modes it provides.
-*
-* This function may also update MonInfo, mm_width, and mm_height.
-*
-* \return singly-linked list of modes or NULL if no modes found.
-*/
-   struct drm_display_mode *(*get_modes)(struct intel_dvo_device *dvo);
-
/**
 * Clean up driver-specific bits of the output
 */
-- 
2.43.1



[PATCH 03/21] drm/i915: remove intel_dsi::{port_bits,hs}

2024-02-15 Thread Jiri Slaby (SUSE)
intel_dsi::port_bits is unused since commit 369602d370fa (drm/i915: Add
support for port enable/disable for dual link configuration) and ::hs is
unused likely since commit 063c86f60ad4 (drm/i915/dsi: remove
intel_dsi_cmd.c and the unused functions therein). Drop them.

Found by https://github.com/jirislaby/clang-struct.

Signed-off-by: Jiri Slaby (SUSE) 
Cc: Jani Nikula 
Cc: Joonas Lahtinen 
Cc: Rodrigo Vivi 
Cc: Tvrtko Ursulin 
Cc: intel-gfx@lists.freedesktop.org
---
 drivers/gpu/drm/i915/display/intel_dsi.h | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_dsi.h 
b/drivers/gpu/drm/i915/display/intel_dsi.h
index 083390e5e442..e99c94edfaae 100644
--- a/drivers/gpu/drm/i915/display/intel_dsi.h
+++ b/drivers/gpu/drm/i915/display/intel_dsi.h
@@ -57,9 +57,6 @@ struct intel_dsi {
u16 phys;   /* ICL DSI */
};
 
-   /* if true, use HS mode, otherwise LP */
-   bool hs;
-
/* virtual channel */
int channel;
 
@@ -93,7 +90,6 @@ struct intel_dsi {
bool bgr_enabled;
 
u8 pixel_overlap;
-   u32 port_bits;
u32 bw_timer;
u32 dphy_reg;
 
-- 
2.43.1



Re: [PATCH v6 1/5] drm: Stop using `select ACPI_VIDEO` in all drivers

2024-02-15 Thread kernel test robot
Hi Mario,

kernel test robot noticed the following build warnings:

[auto build test WARNING on drm-misc/drm-misc-next]
[also build test WARNING on drm-intel/for-linux-next-fixes drm-tip/drm-tip 
linus/master v6.8-rc4 next-20240215]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:
https://github.com/intel-lab-lkp/linux/commits/Mario-Limonciello/drm-Stop-using-select-ACPI_VIDEO-in-all-drivers/20240215-055936
base:   git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
patch link:
https://lore.kernel.org/r/20240214215756.6530-2-mario.limonciello%40amd.com
patch subject: [PATCH v6 1/5] drm: Stop using `select ACPI_VIDEO` in all drivers
config: alpha-kismet-CONFIG_FB_BACKLIGHT-CONFIG_FB_ATY128-0-0 
(https://download.01.org/0day-ci/archive/20240216/202402161205.v9d7iypg-...@intel.com/config)
reproduce: 
(https://download.01.org/0day-ci/archive/20240216/202402161205.v9d7iypg-...@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot 
| Closes: 
https://lore.kernel.org/oe-kbuild-all/202402161205.v9d7iypg-...@intel.com/

kismet warnings: (new ones prefixed by >>)
>> kismet: WARNING: unmet direct dependencies detected for FB_BACKLIGHT when 
>> selected by FB_ATY128
   .config:233:warning: symbol value 'n' invalid for SATA_MOBILE_LPM_POLICY
   .config:335:warning: symbol value 'n' invalid for AIC79XX_DEBUG_MASK
   .config:336:warning: symbol value 'n' invalid for PSTORE_BLK_MAX_REASON
   .config:437:warning: symbol value 'n' invalid for KFENCE_SAMPLE_INTERVAL
   .config:511:warning: symbol value 'n' invalid for INPUT_MOUSEDEV_SCREEN_Y
   .config:613:warning: symbol value 'n' invalid for DRM_XE_JOB_TIMEOUT_MIN
   .config:620:warning: symbol value 'n' invalid for CRYPTO_DEV_QCE_SW_MAX_LEN
   .config:705:warning: symbol value 'n' invalid for AIC79XX_CMDS_PER_DEVICE
   .config:719:warning: symbol value 'n' invalid for PANEL_LCD_CHARSET
   .config:766:warning: symbol value 'n' invalid for XEN_MEMORY_HOTPLUG_LIMIT
   .config:774:warning: symbol value 'n' invalid for PANEL_LCD_PIN_SDA
   .config:791:warning: symbol value 'n' invalid for SND_AC97_POWER_SAVE_DEFAULT
   .config:825:warning: symbol value 'n' invalid for MAGIC_SYSRQ_DEFAULT_ENABLE
   .config:840:warning: symbol value 'n' invalid for 
DRM_I915_MAX_REQUEST_BUSYWAIT
   .config:871:warning: symbol value 'n' invalid for 
USB_GADGET_STORAGE_NUM_BUFFERS
   .config:875:warning: symbol value 'n' invalid for SND_AT73C213_TARGET_BITRATE
   .config:894:warning: symbol value 'n' invalid for DRM_XE_PREEMPT_TIMEOUT_MIN
   .config:903:warning: symbol value 'n' invalid for NET_EMATCH_STACK
   .config:905:warning: symbol value 'n' invalid for VMCP_CMA_SIZE
   .config:1160:warning: symbol value 'n' invalid for MTDRAM_ERASE_SIZE
   .config:1246:warning: symbol value 'n' invalid for SERIAL_UARTLITE_NR_UARTS
   .config:1287:warning: symbol value 'n' invalid for PANEL_LCD_PIN_E
   .config:1411:warning: symbol value 'n' invalid for LEGACY_PTY_COUNT
   .config:1517:warning: symbol value 'n' invalid for 
SERIAL_ALTERA_UART_BAUDRATE
   .config:1543:warning: symbol value 'n' invalid for WATCHDOG_OPEN_TIMEOUT
   .config:1547:warning: symbol value 'n' invalid for AIC7XXX_RESET_DELAY_MS
   .config:1739:warning: symbol value 'n' invalid for IBM_EMAC_POLL_WEIGHT
   .config:1833:warning: symbol value 'n' invalid for DRM_I915_STOP_TIMEOUT
   .config:1972:warning: symbol value 'n' invalid for KCOV_IRQ_AREA_SIZE
   .config:2263:warning: symbol value 'n' invalid for DRM_XE_TIMESLICE_MAX
   .config:2304:warning: symbol value 'n' invalid for PANEL_LCD_BWIDTH
   .config:2383:warning: symbol value 'n' invalid for AIC79XX_RESET_DELAY_MS
   .config:2500:warning: symbol value 'n' invalid for 
SND_SOC_SOF_DEBUG_IPC_FLOOD_TEST_NUM
   .config:2535:warning: symbol value 'n' invalid for PANEL_PARPORT
   .config:2622:warning: symbol value 'n' invalid for NOUVEAU_DEBUG_DEFAULT
   .config:2808:warning: symbol value 'n' invalid for KCSAN_REPORT_ONCE_IN_MS
   .config:2904:warning: symbol value 'n' invalid for PSTORE_BLK_CONSOLE_SIZE
   .config:2906:warning: symbol value 'n' invalid for KCSAN_UDELAY_INTERRUPT
   .config:2928:warning: symbol value 'n' invalid for PANEL_LCD_PIN_BL
   .config:2945:warning: symbol value 'n' invalid for 
DEBUG_OBJECTS_ENABLE_DEFAULT
   .config:2952:warni

RE: [RFC 0/5] Introduce drm sharpening property

2024-02-15 Thread Garg, Nemesa
It is not intel specific and the goal is to have a generic API for configuring 
Sharpness, accessible to various vendors. Intel currently offers sharpness 
support through the Display Engine, while other vendors seem to support 
Sharpness through the GPU using GL shaders (Vulcan/Open GL based).
 
In terms of sharpness intensity adjustment, the plan is to provide users with 
the ability to customize and regulate sharpness levels. We suggest setting a 
minimum and maximum strength range from 1 to 255, where a value of 0 signifies 
that the sharpness feature is disabled, indicated by a u8 data type. 
For now we have mapped the strength value 0.0 to 14.9375 to 0-239 but as the 
datatype is u8 user can give value upto 255 which is gets clamped to 239.

We are also open to have alternative scales, such as 1-100 or 1-10, as long as 
a general consensus is reached within the community comprising OEMs and vendors.

> -Original Message-
> From: Simon Ser 
> Sent: Thursday, February 15, 2024 2:03 PM
> To: Garg, Nemesa 
> Cc: intel-gfx@lists.freedesktop.org; dri-de...@lists.freedesktop.org
> Subject: Re: [RFC 0/5] Introduce drm sharpening property
> 
> How much of this is Intel-specific? Are there any hardware vendors with a 
> similar
> feature? How much is the "sharpness" knob tied to Intel hardware?


Re: [PATCH 11/13] drm/i915/hdcp: Don't enable HDCP1.4 directly from check_link

2024-02-15 Thread Nautiyal, Ankit K



On 2/15/2024 4:29 PM, Suraj Kandpal wrote:

Whenever LIC fails instead of moving from ENABLED to DESIRED
CP property we directly enable HDCP1.4 without informing the userspace
of this failure in link integrity check.
Now we will just update the value to DESIRED send the event to
userspace and then continue with the normal flow of HDCP enablement.

Signed-off-by: Suraj Kandpal 



Reviewed-by: Ankit Nautiyal 



---
  drivers/gpu/drm/i915/display/intel_hdcp.c | 12 +++-
  1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_hdcp.c 
b/drivers/gpu/drm/i915/display/intel_hdcp.c
index 3bd783b8deac..ad05ab899706 100644
--- a/drivers/gpu/drm/i915/display/intel_hdcp.c
+++ b/drivers/gpu/drm/i915/display/intel_hdcp.c
@@ -1088,15 +1088,9 @@ static int intel_hdcp_check_link(struct intel_connector 
*connector)
goto out;
}
  
-	ret = intel_hdcp1_enable(connector);

-   if (ret) {
-   drm_err(&i915->drm, "Failed to enable hdcp (%d)\n", ret);
-   intel_hdcp_update_value(connector,
-   DRM_MODE_CONTENT_PROTECTION_DESIRED,
-   true);
-   goto out;
-   }
-
+   intel_hdcp_update_value(connector,
+   DRM_MODE_CONTENT_PROTECTION_DESIRED,
+   true);
  out:
mutex_unlock(&dig_port->hdcp_mutex);
mutex_unlock(&hdcp->mutex);


Re: [PATCH 10/13] drm/i915/hdcp: Don't enable HDCP2.2 directly from check_link

2024-02-15 Thread Nautiyal, Ankit K



On 2/15/2024 4:29 PM, Suraj Kandpal wrote:

Whenever LIC fails instead of moving from ENABLED to DESIRED
CP property we directly enable HDCP2.2 without informing the userspace
of this failure in link integrity check.
Now we will just update the value to DESIRED send the event to
userspace and then continue with the normal flow of HDCP enablement.

--v2
-Don't change the function prototype in this function [Ankit]

Signed-off-by: Suraj Kandpal 

Reviewed-by: Ankit Nautiyal 


---
  drivers/gpu/drm/i915/display/intel_hdcp.c | 25 ++-
  1 file changed, 2 insertions(+), 23 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_hdcp.c 
b/drivers/gpu/drm/i915/display/intel_hdcp.c
index 16b2b180563f..3bd783b8deac 100644
--- a/drivers/gpu/drm/i915/display/intel_hdcp.c
+++ b/drivers/gpu/drm/i915/display/intel_hdcp.c
@@ -2068,17 +2068,6 @@ static int intel_hdcp2_check_link(struct intel_connector 
*connector)
  
  		drm_dbg_kms(&i915->drm,

"HDCP2.2 Downstream topology change\n");
-   ret = hdcp2_authenticate_repeater_topology(connector);
-   if (!ret) {
-   intel_hdcp_update_value(connector,
-   DRM_MODE_CONTENT_PROTECTION_ENABLED,
-   true);
-   goto out;
-   }
-   drm_dbg_kms(&i915->drm,
-   "[CONNECTOR:%d:%s] Repeater topology auth 
failed.(%d)\n",
-   connector->base.base.id, connector->base.name,
-   ret);
} else {
drm_dbg_kms(&i915->drm,
"[CONNECTOR:%d:%s] HDCP2.2 link failed, retrying 
auth\n",
@@ -2095,18 +2084,8 @@ static int intel_hdcp2_check_link(struct intel_connector 
*connector)
goto out;
}
  
-	ret = _intel_hdcp2_enable(connector);

-   if (ret) {
-   drm_dbg_kms(&i915->drm,
-   "[CONNECTOR:%d:%s] Failed to enable hdcp2.2 (%d)\n",
-   connector->base.base.id, connector->base.name,
-   ret);
-   intel_hdcp_update_value(connector,
-   DRM_MODE_CONTENT_PROTECTION_DESIRED,
-   true);
-   goto out;
-   }
-
+   intel_hdcp_update_value(connector,
+   DRM_MODE_CONTENT_PROTECTION_DESIRED, true);
  out:
mutex_unlock(&dig_port->hdcp_mutex);
mutex_unlock(&hdcp->mutex);


Re: [PATCH 12/13] drm/i915/hdcp: Allocate stream id after HDCP AKE stage

2024-02-15 Thread Nautiyal, Ankit K



On 2/15/2024 4:29 PM, Suraj Kandpal wrote:

Allocate stream id after HDCP AKE stage and not before so that it
can also be done during link integrity check.
Right now for MST scenarios LIC fails after hdcp enablement for this
reason.

--v2
-no need for else block in prepare_streams function [Ankit]

Signed-off-by: Suraj Kandpal 
---
  drivers/gpu/drm/i915/display/intel_hdcp.c | 138 +++---
  1 file changed, 66 insertions(+), 72 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_hdcp.c 
b/drivers/gpu/drm/i915/display/intel_hdcp.c
index ad05ab899706..be7d5a3ce49d 100644
--- a/drivers/gpu/drm/i915/display/intel_hdcp.c
+++ b/drivers/gpu/drm/i915/display/intel_hdcp.c
@@ -30,7 +30,7 @@
  #define KEY_LOAD_TRIES5
  #define HDCP2_LC_RETRY_CNT3
  
-static int intel_conn_to_vcpi(struct drm_atomic_state *state,

+static int intel_conn_to_vcpi(struct intel_atomic_state *state,
  struct intel_connector *connector)
  {
struct drm_dp_mst_topology_mgr *mgr;
@@ -43,7 +43,7 @@ static int intel_conn_to_vcpi(struct drm_atomic_state *state,
return 0;
mgr = connector->port->mgr;
  
-	drm_modeset_lock(&mgr->base.lock, state->acquire_ctx);

+   drm_modeset_lock(&mgr->base.lock, state->base.acquire_ctx);
mst_state = to_drm_dp_mst_topology_state(mgr->base.state);
payload = drm_atomic_get_mst_payload_state(mst_state, connector->port);
if (drm_WARN_ON(mgr->dev, !payload))
@@ -68,19 +68,52 @@ static int intel_conn_to_vcpi(struct drm_atomic_state 
*state,
   * DP MST topology. Though it is not compulsory, security fw should change its
   * policy to mark different content_types for different streams.
   */
-static void
-intel_hdcp_required_content_stream(struct intel_digital_port *dig_port)
+static int
+intel_hdcp_required_content_stream(struct intel_atomic_state *state,
+  struct intel_hdcp *hdcp,


This still needs to be removed, since it is not used in the function.

With the above fixed, this is:

Reviewed-by: Ankit Nautiyal 



+  struct intel_digital_port *dig_port)
  {
+   struct drm_connector_list_iter conn_iter;
+   struct intel_digital_port *conn_dig_port;
+   struct intel_connector *connector;
+   struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev);
struct hdcp_port_data *data = &dig_port->hdcp_port_data;
bool enforce_type0 = false;
int k;
  
  	if (dig_port->hdcp_auth_status)

-   return;
+   return 0;
+
+   data->k = 0;
  
  	if (!dig_port->hdcp_mst_type1_capable)

enforce_type0 = true;
  
+	drm_connector_list_iter_begin(&i915->drm, &conn_iter);

+   for_each_intel_connector_iter(connector, &conn_iter) {
+   if (connector->base.status == connector_status_disconnected)
+   continue;
+
+   if (!intel_encoder_is_mst(intel_attached_encoder(connector)))
+   continue;
+
+   conn_dig_port = intel_attached_dig_port(connector);
+   if (conn_dig_port != dig_port)
+   continue;
+
+   data->streams[data->k].stream_id =
+   intel_conn_to_vcpi(state, connector);
+   data->k++;
+
+   /* if there is only one active stream */
+   if (dig_port->dp.active_mst_links <= 1)
+   break;
+   }
+   drm_connector_list_iter_end(&conn_iter);
+
+   if (drm_WARN_ON(&i915->drm, data->k > INTEL_NUM_PIPES(i915) || data->k 
== 0))
+   return -EINVAL;
+
/*
 * Apply common protection level across all streams in DP MST Topology.
 * Use highest supported content type for all streams in DP MST 
Topology.
@@ -88,19 +121,25 @@ intel_hdcp_required_content_stream(struct 
intel_digital_port *dig_port)
for (k = 0; k < data->k; k++)
data->streams[k].stream_type =
enforce_type0 ? DRM_MODE_HDCP_CONTENT_TYPE0 : 
DRM_MODE_HDCP_CONTENT_TYPE1;
+
+   return 0;
  }
  
-static void intel_hdcp_prepare_streams(struct intel_connector *connector)

+static int intel_hdcp_prepare_streams(struct intel_atomic_state *state,
+ struct intel_connector *connector)
  {
struct intel_digital_port *dig_port = 
intel_attached_dig_port(connector);
struct hdcp_port_data *data = &dig_port->hdcp_port_data;
struct intel_hdcp *hdcp = &connector->hdcp;
  
-	if (!intel_encoder_is_mst(intel_attached_encoder(connector))) {

-   data->streams[0].stream_type = hdcp->content_type;
-   } else {
-   intel_hdcp_required_content_stream(dig_port);
-   }
+   if (intel_encoder_is_mst(intel_attached_encoder(connector)))
+   return intel_hdcp_required_content_stream(state, hdcp, 
dig_port);
+
+   data->k = 1;
+

Re: [PULL] drm-intel-gt-next

2024-02-15 Thread Dave Airlie
On Thu, 15 Feb 2024 at 20:06, Tvrtko Ursulin
 wrote:
>
> Hi Dave, Daniel,
>
> First pull request for 6.9 with probably one more coming in one to two
> weeks.
>
> Nothing to interesting in this one, mostly a sprinkle of small fixes in
> GuC, HuC, Perf/OA, a tiny bit of prep work for future platforms and some
> code cleanups.
>
> One new uapi in the form of a GuC submission version query which Mesa
> wants for implementing Vulkan async compute queues.
>
> Regards,
>
> Tvrtko
>
> drm-intel-gt-next-2024-02-15:
> UAPI Changes:
>
> - Add GuC submission interface version query (Tvrtko Ursulin)
>
> Driver Changes:
>
> Fixes/improvements/new stuff:
>
> - Atomically invalidate userptr on mmu-notifier (Jonathan Cavitt)

I've pulled this, but the above patch is triggering my this seems
wrong spider sense.

This and probably the preceeding patch that this references seem to
move i915 to a long term pinning of userptr in memory with what I can
see no accounting, and away from what the desired behaviour for
drivers should be.

It also feels like the authorship on this might be lies which also worries me.

Dave.


Re: [PATCH 4/6] drm/i915/psr: Silence period and lfps half cycle

2024-02-15 Thread kernel test robot
Hi Jouni,

kernel test robot noticed the following build warnings:

[auto build test WARNING on drm-intel/for-linux-next]
[also build test WARNING on drm-tip/drm-tip next-20240215]
[cannot apply to drm-intel/for-linux-next-fixes drm/drm-next linus/master 
v6.8-rc4]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:
https://github.com/intel-lab-lkp/linux/commits/Jouni-H-gander/drm-display-Add-missing-aux-less-alpm-wake-related-bits/20240215-185209
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
patch link:
https://lore.kernel.org/r/20240215104934.2395239-5-jouni.hogander%40intel.com
patch subject: [PATCH 4/6] drm/i915/psr: Silence period and lfps half cycle
config: i386-buildonly-randconfig-004-20240215 
(https://download.01.org/0day-ci/archive/20240216/202402161056.o7ey8uvv-...@intel.com/config)
compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 
6009708b4367171ccdbf4b5905cb6a803753fe18)
reproduce (this is a W=1 build): 
(https://download.01.org/0day-ci/archive/20240216/202402161056.o7ey8uvv-...@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot 
| Closes: 
https://lore.kernel.org/oe-kbuild-all/202402161056.o7ey8uvv-...@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/gpu/drm/i915/display/intel_psr.c:1253:6: warning: variable 
>> 'silence_period' is uninitialized when used here [-Wuninitialized]
1253 | silence_period > 256 || silence_period < 0 ||
 | ^~
   drivers/gpu/drm/i915/display/intel_psr.c:1240:17: note: initialize the 
variable 'silence_period' to silence this warning
1240 | silence_period, lfps_half_cycle;
 |   ^
 |= 0
   1 warning generated.


vim +/silence_period +1253 drivers/gpu/drm/i915/display/intel_psr.c

  1234  
  1235  static int _lnl_compute_aux_less_alpm_params(struct intel_dp *intel_dp,
  1236   struct intel_crtc_state 
*crtc_state)
  1237  {
  1238  struct drm_i915_private *i915 = dp_to_i915(intel_dp);
  1239  int aux_less_wake_time, aux_less_wake_lines, 
switch_to_active_lines,
  1240  silence_period, lfps_half_cycle;
  1241  
  1242  aux_less_wake_time =
  1243  _lnl_compute_aux_less_wake_time(crtc_state->port_clock 
/ 1000);
  1244  aux_less_wake_lines = 
intel_usecs_to_scanlines(&crtc_state->hw.adjusted_mode,
  1245 
aux_less_wake_time);
  1246  
  1247  switch_to_active_lines =
  1248  intel_usecs_to_scanlines(
  1249  &crtc_state->hw.adjusted_mode,
  1250  
_lnl_compute_switch_to_active_time(crtc_state->port_clock / 1000));
  1251  
  1252  if (aux_less_wake_lines > 32 || switch_to_active_lines > 32 ||
> 1253  silence_period > 256 || silence_period < 0 ||
  1254  
!_lnl_get_silence_period_and_lfps_half_cycle(intel_dp->link_rate,
  1255   
&silence_period,
  1256   
&lfps_half_cycle))
  1257  return false;
  1258  
  1259  if (i915->display.params.psr_safest_params) {
  1260  aux_less_wake_lines = 32;
  1261  switch_to_active_lines = 32;
  1262  }
  1263  
  1264  intel_dp->psr.alpm_parameters.aux_less_wake_lines = 
aux_less_wake_lines;
  1265  intel_dp->psr.alpm_parameters.switch_to_active_lines = 
switch_to_active_lines;
  1266  intel_dp->psr.alpm_parameters.silence_period_sym_clocks = 
silence_period;
  1267  intel_dp->psr.alpm_parameters.lfps_half_cycle_num_of_syms = 
lfps_half_cycle;
  1268  
  1269  return true;
  1270  }
  1271  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


Re: [PATCH v6 1/5] drm: Stop using `select ACPI_VIDEO` in all drivers

2024-02-15 Thread kernel test robot
Hi Mario,

kernel test robot noticed the following build errors:

[auto build test ERROR on drm-misc/drm-misc-next]
[also build test ERROR on drm-intel/for-linux-next-fixes drm-tip/drm-tip 
linus/master v6.8-rc4 next-20240215]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:
https://github.com/intel-lab-lkp/linux/commits/Mario-Limonciello/drm-Stop-using-select-ACPI_VIDEO-in-all-drivers/20240215-055936
base:   git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
patch link:
https://lore.kernel.org/r/20240214215756.6530-2-mario.limonciello%40amd.com
patch subject: [PATCH v6 1/5] drm: Stop using `select ACPI_VIDEO` in all drivers
config: nios2-randconfig-r061-20240215 
(https://download.01.org/0day-ci/archive/20240216/202402160847.fdgskgjp-...@intel.com/config)
compiler: nios2-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): 
(https://download.01.org/0day-ci/archive/20240216/202402160847.fdgskgjp-...@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot 
| Closes: 
https://lore.kernel.org/oe-kbuild-all/202402160847.fdgskgjp-...@intel.com/

All errors (new ones prefixed by >>):

   nios2-linux-ld: drivers/video/fbdev/ssd1307fb.o: in function 
`ssd1307fb_remove':
   ssd1307fb.c:(.text+0x40c): undefined reference to 
`backlight_device_unregister'
>> ssd1307fb.c:(.text+0x40c): relocation truncated to fit: R_NIOS2_CALL26 
>> against `backlight_device_unregister'
   nios2-linux-ld: drivers/video/fbdev/ssd1307fb.o: in function 
`ssd1307fb_probe':
   ssd1307fb.c:(.text+0x1d98): undefined reference to 
`backlight_device_register'
>> ssd1307fb.c:(.text+0x1d98): relocation truncated to fit: R_NIOS2_CALL26 
>> against `backlight_device_register'

Kconfig warnings: (for reference only)
   WARNING: unmet direct dependencies detected for FB_BACKLIGHT
   Depends on [n]: HAS_IOMEM [=y] && FB [=y] && BACKLIGHT_CLASS_DEVICE [=n]
   Selected by [y]:
   - FB_SSD1307 [=y] && HAS_IOMEM [=y] && FB [=y] && I2C [=y] && (GPIOLIB [=y] 
|| COMPILE_TEST [=y])

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


Re: [PATCH v6 1/5] drm: Stop using `select ACPI_VIDEO` in all drivers

2024-02-15 Thread kernel test robot
Hi Mario,

kernel test robot noticed the following build warnings:

[auto build test WARNING on drm-misc/drm-misc-next]
[also build test WARNING on drm-intel/for-linux-next-fixes drm-tip/drm-tip 
linus/master v6.8-rc4 next-20240215]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:
https://github.com/intel-lab-lkp/linux/commits/Mario-Limonciello/drm-Stop-using-select-ACPI_VIDEO-in-all-drivers/20240215-055936
base:   git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
patch link:
https://lore.kernel.org/r/20240214215756.6530-2-mario.limonciello%40amd.com
patch subject: [PATCH v6 1/5] drm: Stop using `select ACPI_VIDEO` in all drivers
config: alpha-kismet-CONFIG_FB_BACKLIGHT-CONFIG_FB_ATY-0-0 
(https://download.01.org/0day-ci/archive/20240216/202402160822.2b7vxnn3-...@intel.com/config)
reproduce: 
(https://download.01.org/0day-ci/archive/20240216/202402160822.2b7vxnn3-...@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot 
| Closes: 
https://lore.kernel.org/oe-kbuild-all/202402160822.2b7vxnn3-...@intel.com/

kismet warnings: (new ones prefixed by >>)
>> kismet: WARNING: unmet direct dependencies detected for FB_BACKLIGHT when 
>> selected by FB_ATY
   .config:163:warning: symbol value 'n' invalid for 
USB_GADGET_STORAGE_NUM_BUFFERS
   .config:241:warning: symbol value 'n' invalid for SATA_MOBILE_LPM_POLICY
   .config:343:warning: symbol value 'n' invalid for PSTORE_BLK_MAX_REASON
   .config:432:warning: symbol value 'n' invalid for KFENCE_SAMPLE_INTERVAL
   .config:572:warning: symbol value 'n' invalid for PANEL_LCD_PIN_E
   .config:596:warning: symbol value 'n' invalid for AIC79XX_DEBUG_MASK
   .config:616:warning: symbol value 'n' invalid for DRM_XE_JOB_TIMEOUT_MIN
   .config:629:warning: symbol value 'n' invalid for CRYPTO_DEV_QCE_SW_MAX_LEN
   .config:738:warning: symbol value 'n' invalid for PANEL_LCD_CHARSET
   .config:794:warning: symbol value 'n' invalid for SND_AC97_POWER_SAVE_DEFAULT
   .config:852:warning: symbol value 'n' invalid for 
DRM_I915_MAX_REQUEST_BUSYWAIT
   .config:887:warning: symbol value 'n' invalid for SND_AT73C213_TARGET_BITRATE
   .config:902:warning: symbol value 'n' invalid for SERIAL_AR933X_NR_UARTS
   .config:903:warning: symbol value 'n' invalid for DRM_XE_PREEMPT_TIMEOUT_MIN
   .config:911:warning: symbol value 'n' invalid for NET_EMATCH_STACK
   .config:913:warning: symbol value 'n' invalid for VMCP_CMA_SIZE
   .config:986:warning: symbol value 'n' invalid for AIC79XX_CMDS_PER_DEVICE
   .config:1048:warning: symbol value 'n' invalid for PANEL_LCD_PIN_SDA
   .config:1170:warning: symbol value 'n' invalid for MTDRAM_ERASE_SIZE
   .config:1270:warning: symbol value 'n' invalid for SERIAL_UARTLITE_NR_UARTS
   .config:1434:warning: symbol value 'n' invalid for LEGACY_PTY_COUNT
   .config:1578:warning: symbol value 'n' invalid for AIC7XXX_RESET_DELAY_MS
   .config:1614:warning: symbol value 'n' invalid for AIC79XX_RESET_DELAY_MS
   .config:1753:warning: symbol value 'n' invalid for IBM_EMAC_POLL_WEIGHT
   .config:1867:warning: symbol value 'n' invalid for DRM_I915_STOP_TIMEOUT
   .config:2174:warning: symbol value 'n' invalid for RCU_FANOUT_LEAF
   .config:2220:warning: symbol value 'n' invalid for 
MTD_REDBOOT_DIRECTORY_BLOCK
   .config:2308:warning: symbol value 'n' invalid for DRM_XE_TIMESLICE_MAX
   .config:2320:warning: symbol value 'n' invalid for PANEL_LCD_BWIDTH
   .config:2339:warning: symbol value 'n' invalid for KCOV_IRQ_AREA_SIZE
   .config:2559:warning: symbol value 'n' invalid for PANEL_PARPORT
   .config:2646:warning: symbol value 'n' invalid for NOUVEAU_DEBUG_DEFAULT
   .config:2838:warning: symbol value 'n' invalid for KCSAN_REPORT_ONCE_IN_MS
   .config:2936:warning: symbol value 'n' invalid for KCSAN_UDELAY_INTERRUPT
   .config:2958:warning: symbol value 'n' invalid for PANEL_LCD_PIN_BL
   .config:2971:warning: symbol value 'n' invalid for 
SND_SOC_SOF_DEBUG_IPC_FLOOD_TEST_NUM
   .config:2976:warning: symbol value 'n' invalid for 
DEBUG_OBJECTS_ENABLE_DEFAULT
   .config:2984:warning: symbol value 'n' invalid for INITRAMFS_ROOT_GID
   .config:3090:warning: symbol value 'n' invalid for ATM_FORE200E_TX_RETRY
   .config:3124:warning: symbol value 'n' invalid for 
FB_OMAP2_DSS_MIN_FCK_PER_PCK
   .config:3301:warning: symbol value 'n&

Re: [PATCH 2/2] drm/i915/gt: Set default CCS mode '1'

2024-02-15 Thread John Harrison

On 2/15/2024 14:34, Andi Shyti wrote:

Hi John,

On Thu, Feb 15, 2024 at 01:23:24PM -0800, John Harrison wrote:

On 2/15/2024 05:59, Andi Shyti wrote:

Since CCS automatic load balancing is disabled, we will impose a
fixed balancing policy that involves setting all the CCS engines
to work together on the same load.

Simultaneously, the user will see only 1 CCS rather than the
actual number. As of now, this change affects only DG2.

These two paragraphs are mutually exclusive. You can't have four CCS engines
'working together' if only one engine exists. I think you are meaning that
we only export 1 CCS engine and that single engine is configured to control
all the EUs. As opposed to running in 4 CCS engine mode where the EUs are
(dynamically or statically) divided amongst those four engines.

The balancing is done statically. The dynamic balancing is
disabled in patch 1.

The 2 or 4 CCS engines will share the same workload.

But they don't.

In i915, we use 'engine' to refer to a command streamer and all the 
associated hardware. This is distinct from the EUs which sit behind and 
can be driven by one or more command streamers. Saying that multiple 
engines are sharing a workload implies that you are submitting the 
context to multiple command streamers in parallel. I.e. a similar 
process to media frame split where they have a set of LRCA contexts 
bound together which are submitted in parallel to two or more video 
decode engines (VCS0, VCS1, etc.). That is not what is happening here.


Here, you are submitting a single context with a singe ring buffer to a 
single engine - CCS0. That engine is configured to own all EUs. Which 
actually means that submitting a compute task to another CCS engine will 
achieve nothing because there are no EUs available to those other 
engines. They will simply hang when waiting for the walker instruction 
to complete.




Because the user won't be able anymore to select the CCS engine
he wants to use, he will see only one CCS.

I think we are saying the same thing using different words :)

But words are important.

John.


I can try in v2 to reword the commit better.

Thanks for looking into this.
Andi


John.


Fixes: d2eae8e98d59 ("drm/i915/dg2: Drop force_probe requirement")
Signed-off-by: Andi Shyti 
Cc: Chris Wilson 
Cc: Joonas Lahtinen 
Cc: Matt Roper 
Cc:  # v6.2+
---
   drivers/gpu/drm/i915/gt/intel_gt.c  | 11 +++
   drivers/gpu/drm/i915/gt/intel_gt_regs.h |  2 ++
   drivers/gpu/drm/i915/i915_drv.h | 17 +
   drivers/gpu/drm/i915/i915_query.c   |  5 +++--
   4 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_gt.c 
b/drivers/gpu/drm/i915/gt/intel_gt.c
index a425db5ed3a2..e19df4ef47f6 100644
--- a/drivers/gpu/drm/i915/gt/intel_gt.c
+++ b/drivers/gpu/drm/i915/gt/intel_gt.c
@@ -168,6 +168,14 @@ static void init_unused_rings(struct intel_gt *gt)
}
   }
+static void intel_gt_apply_ccs_mode(struct intel_gt *gt)
+{
+   if (!IS_DG2(gt->i915))
+   return;
+
+   intel_uncore_write(gt->uncore, XEHP_CCS_MODE, 0);
+}
+
   int intel_gt_init_hw(struct intel_gt *gt)
   {
struct drm_i915_private *i915 = gt->i915;
@@ -195,6 +203,9 @@ int intel_gt_init_hw(struct intel_gt *gt)
intel_gt_init_swizzling(gt);
+   /* Configure CCS mode */
+   intel_gt_apply_ccs_mode(gt);
+
/*
 * At least 830 can leave some of the unused rings
 * "active" (ie. head != tail) after resume which
diff --git a/drivers/gpu/drm/i915/gt/intel_gt_regs.h 
b/drivers/gpu/drm/i915/gt/intel_gt_regs.h
index cf709f6c05ae..c148113770ea 100644
--- a/drivers/gpu/drm/i915/gt/intel_gt_regs.h
+++ b/drivers/gpu/drm/i915/gt/intel_gt_regs.h
@@ -1605,6 +1605,8 @@
   #define   GEN12_VOLTAGE_MASK REG_GENMASK(10, 0)
   #define   GEN12_CAGF_MASKREG_GENMASK(19, 11)
+#define XEHP_CCS_MODE  _MMIO(0x14804)
+
   #define GEN11_GT_INTR_DW(x)  _MMIO(0x190018 + ((x) * 4))
   #define   GEN11_CSME (31)
   #define   GEN12_HECI_2   (30)
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index e81b3b2858ac..0853ffd3cb8d 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -396,6 +396,23 @@ static inline struct intel_gt *to_gt(const struct 
drm_i915_private *i915)
 (engine__); \
 (engine__) = rb_to_uabi_engine(rb_next(&(engine__)->uabi_node)))
+/*
+ * Exclude unavailable engines.
+ *
+ * Only the first CCS engine is utilized due to the disabling of CCS auto load
+ * balancing. As a result, all CCS engines operate collectively, functioning
+ * essentially as a single CCS engine, hence the count of active CCS engines is
+ * considered '1'.
+ * Currently, this applies to platforms with more than one CCS engine,
+ * specifically DG2.
+ */
+#define for_each_available_uabi_engine(engine__, i915

Re: [PATCH 2/2] drm/i915/gt: Set default CCS mode '1'

2024-02-15 Thread Andi Shyti
Hi John,

On Thu, Feb 15, 2024 at 01:23:24PM -0800, John Harrison wrote:
> On 2/15/2024 05:59, Andi Shyti wrote:
> > Since CCS automatic load balancing is disabled, we will impose a
> > fixed balancing policy that involves setting all the CCS engines
> > to work together on the same load.
> > 
> > Simultaneously, the user will see only 1 CCS rather than the
> > actual number. As of now, this change affects only DG2.
> These two paragraphs are mutually exclusive. You can't have four CCS engines
> 'working together' if only one engine exists. I think you are meaning that
> we only export 1 CCS engine and that single engine is configured to control
> all the EUs. As opposed to running in 4 CCS engine mode where the EUs are
> (dynamically or statically) divided amongst those four engines.

The balancing is done statically. The dynamic balancing is
disabled in patch 1.

The 2 or 4 CCS engines will share the same workload.

Because the user won't be able anymore to select the CCS engine
he wants to use, he will see only one CCS.

I think we are saying the same thing using different words :)
I can try in v2 to reword the commit better.

Thanks for looking into this.
Andi

> John.
> 
> > 
> > Fixes: d2eae8e98d59 ("drm/i915/dg2: Drop force_probe requirement")
> > Signed-off-by: Andi Shyti 
> > Cc: Chris Wilson 
> > Cc: Joonas Lahtinen 
> > Cc: Matt Roper 
> > Cc:  # v6.2+
> > ---
> >   drivers/gpu/drm/i915/gt/intel_gt.c  | 11 +++
> >   drivers/gpu/drm/i915/gt/intel_gt_regs.h |  2 ++
> >   drivers/gpu/drm/i915/i915_drv.h | 17 +
> >   drivers/gpu/drm/i915/i915_query.c   |  5 +++--
> >   4 files changed, 33 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/gt/intel_gt.c 
> > b/drivers/gpu/drm/i915/gt/intel_gt.c
> > index a425db5ed3a2..e19df4ef47f6 100644
> > --- a/drivers/gpu/drm/i915/gt/intel_gt.c
> > +++ b/drivers/gpu/drm/i915/gt/intel_gt.c
> > @@ -168,6 +168,14 @@ static void init_unused_rings(struct intel_gt *gt)
> > }
> >   }
> > +static void intel_gt_apply_ccs_mode(struct intel_gt *gt)
> > +{
> > +   if (!IS_DG2(gt->i915))
> > +   return;
> > +
> > +   intel_uncore_write(gt->uncore, XEHP_CCS_MODE, 0);
> > +}
> > +
> >   int intel_gt_init_hw(struct intel_gt *gt)
> >   {
> > struct drm_i915_private *i915 = gt->i915;
> > @@ -195,6 +203,9 @@ int intel_gt_init_hw(struct intel_gt *gt)
> > intel_gt_init_swizzling(gt);
> > +   /* Configure CCS mode */
> > +   intel_gt_apply_ccs_mode(gt);
> > +
> > /*
> >  * At least 830 can leave some of the unused rings
> >  * "active" (ie. head != tail) after resume which
> > diff --git a/drivers/gpu/drm/i915/gt/intel_gt_regs.h 
> > b/drivers/gpu/drm/i915/gt/intel_gt_regs.h
> > index cf709f6c05ae..c148113770ea 100644
> > --- a/drivers/gpu/drm/i915/gt/intel_gt_regs.h
> > +++ b/drivers/gpu/drm/i915/gt/intel_gt_regs.h
> > @@ -1605,6 +1605,8 @@
> >   #define   GEN12_VOLTAGE_MASK  REG_GENMASK(10, 0)
> >   #define   GEN12_CAGF_MASK REG_GENMASK(19, 11)
> > +#define XEHP_CCS_MODE  _MMIO(0x14804)
> > +
> >   #define GEN11_GT_INTR_DW(x)   _MMIO(0x190018 + ((x) * 
> > 4))
> >   #define   GEN11_CSME  (31)
> >   #define   GEN12_HECI_2(30)
> > diff --git a/drivers/gpu/drm/i915/i915_drv.h 
> > b/drivers/gpu/drm/i915/i915_drv.h
> > index e81b3b2858ac..0853ffd3cb8d 100644
> > --- a/drivers/gpu/drm/i915/i915_drv.h
> > +++ b/drivers/gpu/drm/i915/i915_drv.h
> > @@ -396,6 +396,23 @@ static inline struct intel_gt *to_gt(const struct 
> > drm_i915_private *i915)
> >  (engine__); \
> >  (engine__) = rb_to_uabi_engine(rb_next(&(engine__)->uabi_node)))
> > +/*
> > + * Exclude unavailable engines.
> > + *
> > + * Only the first CCS engine is utilized due to the disabling of CCS auto 
> > load
> > + * balancing. As a result, all CCS engines operate collectively, 
> > functioning
> > + * essentially as a single CCS engine, hence the count of active CCS 
> > engines is
> > + * considered '1'.
> > + * Currently, this applies to platforms with more than one CCS engine,
> > + * specifically DG2.
> > + */
> > +#define for_each_available_uabi_engine(engine__, i915__) \
> > +   for_each_uabi_engine(engine__, i915__) \
> > +   if ((IS_DG2(i915__)) && \
> > +   ((engine__)->uabi_class == I915_ENGINE_CLASS_COMPUTE) && \
> > +   ((engine__)->uabi_instance)) { } \
> > +   else
> > +
> >   #define INTEL_INFO(i915)  ((i915)->__info)
> >   #define RUNTIME_INFO(i915)(&(i915)->__runtime)
> >   #define DRIVER_CAPS(i915) (&(i915)->caps)
> > diff --git a/drivers/gpu/drm/i915/i915_query.c 
> > b/drivers/gpu/drm/i915/i915_query.c
> > index fa3e937ed3f5..2d41bda626a6 100644
> > --- a/drivers/gpu/drm/i915/i915_query.c
> > +++ b/drivers/gpu/drm/i915/i915_query.c
> > @@ -124,6 +124,7 @@ static int query_geometry_subslices(struct 
> > drm_i915_privat

Re: [PATCH 2/2] i915/pmu: Cleanup pending events on unbind

2024-02-15 Thread kernel test robot
Hi Umesh,

kernel test robot noticed the following build warnings:

[auto build test WARNING on drm-intel/for-linux-next]
[also build test WARNING on drm-intel/for-linux-next-fixes drm-tip/drm-tip 
linus/master v6.8-rc4 next-20240215]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:
https://github.com/intel-lab-lkp/linux/commits/Umesh-Nerlige-Ramappa/i915-pmu-Add-pmu_teardown-helper/20240214-020605
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
patch link:
https://lore.kernel.org/r/20240213180302.47266-3-umesh.nerlige.ramappa%40intel.com
patch subject: [PATCH 2/2] i915/pmu: Cleanup pending events on unbind
config: x86_64-randconfig-121-20240214 
(https://download.01.org/0day-ci/archive/20240216/202402160519.aioeunoj-...@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): 
(https://download.01.org/0day-ci/archive/20240216/202402160519.aioeunoj-...@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot 
| Closes: 
https://lore.kernel.org/oe-kbuild-all/202402160519.aioeunoj-...@intel.com/

sparse warnings: (new ones prefixed by >>)
>> drivers/gpu/drm/i915/i915_pmu.c:1405:44: sparse: sparse: incorrect type in 
>> initializer (different address spaces) @@ expected struct file *file @@  
>>got struct file [noderef] __rcu * @@
   drivers/gpu/drm/i915/i915_pmu.c:1405:44: sparse: expected struct file 
*file
   drivers/gpu/drm/i915/i915_pmu.c:1405:44: sparse: got struct file 
[noderef] __rcu *
   drivers/gpu/drm/i915/i915_pmu.c: note: in included file (through 
include/linux/preempt.h, include/linux/spinlock.h, include/linux/fdtable.h):
   include/linux/list.h:83:21: sparse: sparse: self-comparison always evaluates 
to true

vim +1405 drivers/gpu/drm/i915/i915_pmu.c

  1385  
  1386  static void close_event_file(struct perf_event *event)
  1387  {
  1388  unsigned int max_open_fds, fd;
  1389  struct files_struct *files;
  1390  struct task_struct *task;
  1391  struct fdtable *fdt;
  1392  
  1393  task = event->owner;
  1394  if (!task)
  1395  return;
  1396  
  1397  files = task->files;
  1398  if (!files)
  1399  return;
  1400  
  1401  spin_lock(&files->file_lock);
  1402  fdt = files_fdtable(files);
  1403  max_open_fds = __open_files(fdt);
  1404  for (fd = 0; fd < max_open_fds; fd++) {
> 1405  struct file *file = fdt->fd[fd];
  1406  
  1407  if (!file || file->private_data != event)
  1408  continue;
  1409  
  1410  rcu_assign_pointer(fdt->fd[fd], NULL);
  1411  __clear_bit(fd, fdt->open_fds);
  1412  __clear_bit(fd / BITS_PER_LONG, fdt->full_fds_bits);
  1413  if (fd < files->next_fd)
  1414  files->next_fd = fd;
  1415  filp_close(file, files);
  1416  break;
  1417  }
  1418  spin_unlock(&files->file_lock);
  1419  }
  1420  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


Re: [PATCH 2/2] drm/i915/gt: Set default CCS mode '1'

2024-02-15 Thread John Harrison

On 2/15/2024 05:59, Andi Shyti wrote:

Since CCS automatic load balancing is disabled, we will impose a
fixed balancing policy that involves setting all the CCS engines
to work together on the same load.

Simultaneously, the user will see only 1 CCS rather than the
actual number. As of now, this change affects only DG2.
These two paragraphs are mutually exclusive. You can't have four CCS 
engines 'working together' if only one engine exists. I think you are 
meaning that we only export 1 CCS engine and that single engine is 
configured to control all the EUs. As opposed to running in 4 CCS engine 
mode where the EUs are (dynamically or statically) divided amongst those 
four engines.


John.



Fixes: d2eae8e98d59 ("drm/i915/dg2: Drop force_probe requirement")
Signed-off-by: Andi Shyti 
Cc: Chris Wilson 
Cc: Joonas Lahtinen 
Cc: Matt Roper 
Cc:  # v6.2+
---
  drivers/gpu/drm/i915/gt/intel_gt.c  | 11 +++
  drivers/gpu/drm/i915/gt/intel_gt_regs.h |  2 ++
  drivers/gpu/drm/i915/i915_drv.h | 17 +
  drivers/gpu/drm/i915/i915_query.c   |  5 +++--
  4 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_gt.c 
b/drivers/gpu/drm/i915/gt/intel_gt.c
index a425db5ed3a2..e19df4ef47f6 100644
--- a/drivers/gpu/drm/i915/gt/intel_gt.c
+++ b/drivers/gpu/drm/i915/gt/intel_gt.c
@@ -168,6 +168,14 @@ static void init_unused_rings(struct intel_gt *gt)
}
  }
  
+static void intel_gt_apply_ccs_mode(struct intel_gt *gt)

+{
+   if (!IS_DG2(gt->i915))
+   return;
+
+   intel_uncore_write(gt->uncore, XEHP_CCS_MODE, 0);
+}
+
  int intel_gt_init_hw(struct intel_gt *gt)
  {
struct drm_i915_private *i915 = gt->i915;
@@ -195,6 +203,9 @@ int intel_gt_init_hw(struct intel_gt *gt)
  
  	intel_gt_init_swizzling(gt);
  
+	/* Configure CCS mode */

+   intel_gt_apply_ccs_mode(gt);
+
/*
 * At least 830 can leave some of the unused rings
 * "active" (ie. head != tail) after resume which
diff --git a/drivers/gpu/drm/i915/gt/intel_gt_regs.h 
b/drivers/gpu/drm/i915/gt/intel_gt_regs.h
index cf709f6c05ae..c148113770ea 100644
--- a/drivers/gpu/drm/i915/gt/intel_gt_regs.h
+++ b/drivers/gpu/drm/i915/gt/intel_gt_regs.h
@@ -1605,6 +1605,8 @@
  #define   GEN12_VOLTAGE_MASK  REG_GENMASK(10, 0)
  #define   GEN12_CAGF_MASK REG_GENMASK(19, 11)
  
+#define XEHP_CCS_MODE  _MMIO(0x14804)

+
  #define GEN11_GT_INTR_DW(x)   _MMIO(0x190018 + ((x) * 4))
  #define   GEN11_CSME  (31)
  #define   GEN12_HECI_2(30)
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index e81b3b2858ac..0853ffd3cb8d 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -396,6 +396,23 @@ static inline struct intel_gt *to_gt(const struct 
drm_i915_private *i915)
 (engine__); \
 (engine__) = rb_to_uabi_engine(rb_next(&(engine__)->uabi_node)))
  
+/*

+ * Exclude unavailable engines.
+ *
+ * Only the first CCS engine is utilized due to the disabling of CCS auto load
+ * balancing. As a result, all CCS engines operate collectively, functioning
+ * essentially as a single CCS engine, hence the count of active CCS engines is
+ * considered '1'.
+ * Currently, this applies to platforms with more than one CCS engine,
+ * specifically DG2.
+ */
+#define for_each_available_uabi_engine(engine__, i915__) \
+   for_each_uabi_engine(engine__, i915__) \
+   if ((IS_DG2(i915__)) && \
+   ((engine__)->uabi_class == I915_ENGINE_CLASS_COMPUTE) && \
+   ((engine__)->uabi_instance)) { } \
+   else
+
  #define INTEL_INFO(i915)  ((i915)->__info)
  #define RUNTIME_INFO(i915)(&(i915)->__runtime)
  #define DRIVER_CAPS(i915) (&(i915)->caps)
diff --git a/drivers/gpu/drm/i915/i915_query.c 
b/drivers/gpu/drm/i915/i915_query.c
index fa3e937ed3f5..2d41bda626a6 100644
--- a/drivers/gpu/drm/i915/i915_query.c
+++ b/drivers/gpu/drm/i915/i915_query.c
@@ -124,6 +124,7 @@ static int query_geometry_subslices(struct drm_i915_private 
*i915,
return fill_topology_info(sseu, query_item, 
sseu->geometry_subslice_mask);
  }
  
+

  static int
  query_engine_info(struct drm_i915_private *i915,
  struct drm_i915_query_item *query_item)
@@ -140,7 +141,7 @@ query_engine_info(struct drm_i915_private *i915,
if (query_item->flags)
return -EINVAL;
  
-	for_each_uabi_engine(engine, i915)

+   for_each_available_uabi_engine(engine, i915)
num_uabi_engines++;
  
  	len = struct_size(query_ptr, engines, num_uabi_engines);

@@ -155,7 +156,7 @@ query_engine_info(struct drm_i915_private *i915,
  
  	info_ptr = &query_ptr->engines[0];
  
-	for_each_uabi_engine(engine, i915) {

+   for_each_available_uabi_engine(engine, i915) {
info.engine.engin

Re: [PATCH v6 1/5] drm: Stop using `select ACPI_VIDEO` in all drivers

2024-02-15 Thread kernel test robot
Hi Mario,

kernel test robot noticed the following build warnings:

[auto build test WARNING on drm-misc/drm-misc-next]
[also build test WARNING on drm-intel/for-linux-next-fixes drm-tip/drm-tip 
linus/master v6.8-rc4 next-20240215]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:
https://github.com/intel-lab-lkp/linux/commits/Mario-Limonciello/drm-Stop-using-select-ACPI_VIDEO-in-all-drivers/20240215-055936
base:   git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
patch link:
https://lore.kernel.org/r/20240214215756.6530-2-mario.limonciello%40amd.com
patch subject: [PATCH v6 1/5] drm: Stop using `select ACPI_VIDEO` in all drivers
config: alpha-kismet-CONFIG_FB_BACKLIGHT-CONFIG_FB_ATMEL-0-0 
(https://download.01.org/0day-ci/archive/20240216/202402160459.dyhkpajy-...@intel.com/config)
reproduce: 
(https://download.01.org/0day-ci/archive/20240216/202402160459.dyhkpajy-...@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot 
| Closes: 
https://lore.kernel.org/oe-kbuild-all/202402160459.dyhkpajy-...@intel.com/

kismet warnings: (new ones prefixed by >>)
>> kismet: WARNING: unmet direct dependencies detected for FB_BACKLIGHT when 
>> selected by FB_ATMEL
   .config:166:warning: symbol value 'n' invalid for RAPIDIO_DISC_TIMEOUT
   .config:190:warning: symbol value 'n' invalid for FAT_DEFAULT_CODEPAGE
   .config:241:warning: symbol value 'n' invalid for SATA_MOBILE_LPM_POLICY
   .config:335:warning: symbol value 'n' invalid for AIC79XX_DEBUG_MASK
   .config:344:warning: symbol value 'n' invalid for PSTORE_BLK_MAX_REASON
   .config:426:warning: symbol value 'n' invalid for KFENCE_SAMPLE_INTERVAL
   .config:596:warning: symbol value 'n' invalid for DRM_XE_JOB_TIMEOUT_MIN
   .config:618:warning: symbol value 'n' invalid for CRYPTO_DEV_QCE_SW_MAX_LEN
   .config:712:warning: symbol value 'n' invalid for PANEL_LCD_CHARSET
   .config:752:warning: symbol value 'n' invalid for AIC79XX_CMDS_PER_DEVICE
   .config:770:warning: symbol value 'n' invalid for SND_AC97_POWER_SAVE_DEFAULT
   .config:790:warning: symbol value 'n' invalid for PANEL_LCD_PIN_SDA
   .config:810:warning: symbol value 'n' invalid for MAGIC_SYSRQ_DEFAULT_ENABLE
   .config:823:warning: symbol value 'n' invalid for 
DRM_I915_MAX_REQUEST_BUSYWAIT
   .config:860:warning: symbol value 'n' invalid for SND_AT73C213_TARGET_BITRATE
   .config:875:warning: symbol value 'n' invalid for DRM_XE_PREEMPT_TIMEOUT_MIN
   .config:884:warning: symbol value 'n' invalid for NET_EMATCH_STACK
   .config:886:warning: symbol value 'n' invalid for VMCP_CMA_SIZE
   .config:917:warning: symbol value 'n' invalid for INPUT_MOUSEDEV_SCREEN_Y
   .config:1139:warning: symbol value 'n' invalid for MTDRAM_ERASE_SIZE
   .config:1233:warning: symbol value 'n' invalid for SERIAL_UARTLITE_NR_UARTS
   .config:1245:warning: symbol value 'n' invalid for 
USB_GADGET_STORAGE_NUM_BUFFERS
   .config:1403:warning: symbol value 'n' invalid for LEGACY_PTY_COUNT
   .config:1541:warning: symbol value 'n' invalid for WATCHDOG_OPEN_TIMEOUT
   .config:1550:warning: symbol value 'n' invalid for AIC7XXX_RESET_DELAY_MS
   .config:1686:warning: symbol value 'n' invalid for PANEL_LCD_PIN_E
   .config:1717:warning: symbol value 'n' invalid for IBM_EMAC_POLL_WEIGHT
   .config:1805:warning: symbol value 'n' invalid for DRM_I915_STOP_TIMEOUT
   .config:1972:warning: symbol value 'n' invalid for KCOV_IRQ_AREA_SIZE
   .config:2126:warning: symbol value 'n' invalid for RCU_FANOUT_LEAF
   .config:2231:warning: symbol value 'n' invalid for DRM_XE_TIMESLICE_MAX
   .config:2274:warning: symbol value 'n' invalid for PANEL_LCD_BWIDTH
   .config:2465:warning: symbol value 'n' invalid for 
SND_SOC_SOF_DEBUG_IPC_FLOOD_TEST_NUM
   .config:2585:warning: symbol value 'n' invalid for NOUVEAU_DEBUG_DEFAULT
   .config:2775:warning: symbol value 'n' invalid for KCSAN_REPORT_ONCE_IN_MS
   .config:2836:warning: symbol value 'n' invalid for AIC79XX_RESET_DELAY_MS
   .config:2873:warning: symbol value 'n' invalid for KCSAN_UDELAY_INTERRUPT
   .config:2887:warning: symbol value 'n' invalid for PSTORE_BLK_CONSOLE_SIZE
   .config:2896:warning: symbol value 'n' invalid for PANEL_LCD_PIN_BL
   .config:2920:warning: symbol value 'n' invalid for INITRAMFS_ROOT_GID
   .config:3025:warning: symbol value 'n' i

Re: [PATCH v6 1/5] drm: Stop using `select ACPI_VIDEO` in all drivers

2024-02-15 Thread kernel test robot
Hi Mario,

kernel test robot noticed the following build errors:

[auto build test ERROR on drm-misc/drm-misc-next]
[also build test ERROR on drm-intel/for-linux-next-fixes drm-tip/drm-tip 
linus/master v6.8-rc4 next-20240215]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:
https://github.com/intel-lab-lkp/linux/commits/Mario-Limonciello/drm-Stop-using-select-ACPI_VIDEO-in-all-drivers/20240215-055936
base:   git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
patch link:
https://lore.kernel.org/r/20240214215756.6530-2-mario.limonciello%40amd.com
patch subject: [PATCH v6 1/5] drm: Stop using `select ACPI_VIDEO` in all drivers
config: openrisc-randconfig-r064-20240215 
(https://download.01.org/0day-ci/archive/20240216/202402160446.yalmybpi-...@intel.com/config)
compiler: or1k-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): 
(https://download.01.org/0day-ci/archive/20240216/202402160446.yalmybpi-...@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot 
| Closes: 
https://lore.kernel.org/oe-kbuild-all/202402160446.yalmybpi-...@intel.com/

All errors (new ones prefixed by >>):

   or1k-linux-ld: drivers/video/fbdev/nvidia/nv_backlight.o: in function 
`nvidia_bl_init':
>> nv_backlight.c:(.text+0x26c): undefined reference to 
>> `backlight_device_register'
>> nv_backlight.c:(.text+0x26c): relocation truncated to fit: 
>> R_OR1K_INSN_REL_26 against undefined symbol `backlight_device_register'
   or1k-linux-ld: drivers/video/fbdev/nvidia/nv_backlight.o: in function 
`nvidia_bl_exit':
>> nv_backlight.c:(.text+0x32c): undefined reference to 
>> `backlight_device_unregister'
>> nv_backlight.c:(.text+0x32c): relocation truncated to fit: 
>> R_OR1K_INSN_REL_26 against undefined symbol `backlight_device_unregister'
   or1k-linux-ld: drivers/video/fbdev/aty/aty128fb.o: in function 
`aty128_remove':
>> aty128fb.c:(.text+0x14c): undefined reference to 
>> `backlight_device_unregister'
>> aty128fb.c:(.text+0x14c): relocation truncated to fit: R_OR1K_INSN_REL_26 
>> against undefined symbol `backlight_device_unregister'
   or1k-linux-ld: drivers/video/fbdev/aty/aty128fb.o: in function `aty128_init':
>> aty128fb.c:(.text.unlikely+0x5bc): undefined reference to 
>> `backlight_device_register'
>> aty128fb.c:(.text.unlikely+0x5bc): relocation truncated to fit: 
>> R_OR1K_INSN_REL_26 against undefined symbol `backlight_device_register'
   or1k-linux-ld: drivers/auxdisplay/ht16k33.o: in function 
`ht16k33_fbdev_probe':
>> ht16k33.c:(.text+0x17f4): undefined reference to 
>> `devm_backlight_device_register'
>> ht16k33.c:(.text+0x17f4): relocation truncated to fit: R_OR1K_INSN_REL_26 
>> against undefined symbol `devm_backlight_device_register'

Kconfig warnings: (for reference only)
   WARNING: unmet direct dependencies detected for FB_BACKLIGHT
   Depends on [n]: HAS_IOMEM [=y] && FB [=y] && BACKLIGHT_CLASS_DEVICE [=n]
   Selected by [y]:
   - HT16K33 [=y] && AUXDISPLAY [=y] && FB [=y] && I2C [=y] && INPUT [=y]
   - FB_ATMEL [=y] && FB [=y] && OF [=y] && HAVE_CLK [=y] && HAS_IOMEM [=y] && 
(HAVE_FB_ATMEL [=n] || COMPILE_TEST [=y])
   - FB_NVIDIA [=y] && HAS_IOMEM [=y] && FB [=y] && PCI [=y] && 
FB_NVIDIA_BACKLIGHT [=y]
   - FB_ATY128 [=y] && HAS_IOMEM [=y] && FB [=y] && PCI [=y] && 
FB_ATY128_BACKLIGHT [=y]

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


[PATCH v5] drm/dp: add an API to indicate if sink supports VSC SDP

2024-02-15 Thread Abhinav Kumar
From: Paloma Arellano 

YUV420 format is supported only in the VSC SDP packet and not through
MSA. Hence add an API which indicates the sink support which can be used
by the rest of the DP programming.

changes in v5:
- rebased on top of drm-tip

changes in v4:
- bail out early if dpcd rev check fails

changes in v3:
- fix the commit title prefix to drm/dp
- get rid of redundant !!
- break out this change from series [1] to get acks from drm core
  maintainers

Changes in v2:
- Move VSC SDP support check API from dp_panel.c to
  drm_dp_helper.c

[1]: https://patchwork.freedesktop.org/series/129180/

Reviewed-by: Dmitry Baryshkov 
Signed-off-by: Paloma Arellano 
Signed-off-by: Abhinav Kumar 
---
 drivers/gpu/drm/display/drm_dp_helper.c | 23 +++
 include/drm/display/drm_dp_helper.h |  2 ++
 2 files changed, 25 insertions(+)

diff --git a/drivers/gpu/drm/display/drm_dp_helper.c 
b/drivers/gpu/drm/display/drm_dp_helper.c
index 8d6ce46471ae..61b11cb45245 100644
--- a/drivers/gpu/drm/display/drm_dp_helper.c
+++ b/drivers/gpu/drm/display/drm_dp_helper.c
@@ -2913,6 +2913,29 @@ void drm_dp_vsc_sdp_log(struct drm_printer *p, const 
struct drm_dp_vsc_sdp *vsc)
 }
 EXPORT_SYMBOL(drm_dp_vsc_sdp_log);
 
+/**
+ * drm_dp_vsc_sdp_supported() - check if vsc sdp is supported
+ * @aux: DisplayPort AUX channel
+ * @dpcd: DisplayPort configuration data
+ *
+ * Returns true if vsc sdp is supported, else returns false
+ */
+bool drm_dp_vsc_sdp_supported(struct drm_dp_aux *aux, const u8 
dpcd[DP_RECEIVER_CAP_SIZE])
+{
+   u8 rx_feature;
+
+   if (dpcd[DP_DPCD_REV] < DP_DPCD_REV_13)
+   return false;
+
+   if (drm_dp_dpcd_readb(aux, DP_DPRX_FEATURE_ENUMERATION_LIST, 
&rx_feature) != 1) {
+   drm_dbg_dp(aux->drm_dev, "failed to read 
DP_DPRX_FEATURE_ENUMERATION_LIST\n");
+   return false;
+   }
+
+   return (rx_feature & DP_VSC_SDP_EXT_FOR_COLORIMETRY_SUPPORTED);
+}
+EXPORT_SYMBOL(drm_dp_vsc_sdp_supported);
+
 /**
  * drm_dp_get_pcon_max_frl_bw() - maximum frl supported by PCON
  * @dpcd: DisplayPort configuration data
diff --git a/include/drm/display/drm_dp_helper.h 
b/include/drm/display/drm_dp_helper.h
index d02014a87f12..36351f3cdba9 100644
--- a/include/drm/display/drm_dp_helper.h
+++ b/include/drm/display/drm_dp_helper.h
@@ -100,6 +100,8 @@ struct drm_dp_vsc_sdp {
 
 void drm_dp_vsc_sdp_log(struct drm_printer *p, const struct drm_dp_vsc_sdp 
*vsc);
 
+bool drm_dp_vsc_sdp_supported(struct drm_dp_aux *aux, const u8 
dpcd[DP_RECEIVER_CAP_SIZE]);
+
 int drm_dp_psr_setup_time(const u8 psr_cap[EDP_PSR_RECEIVER_CAP_SIZE]);
 
 static inline int
-- 
2.34.1



[PATCH v2] drm/dp: move intel_dp_vsc_sdp_pack() to generic helper

2024-02-15 Thread Abhinav Kumar
intel_dp_vsc_sdp_pack() can be re-used by other DRM drivers as well.
Lets move this to drm_dp_helper to achieve this.

changes in v2:
- rebased on top of drm-tip

Acked-by: Dmitry Baryshkov 
Signed-off-by: Abhinav Kumar 
---
 drivers/gpu/drm/display/drm_dp_helper.c | 78 +
 drivers/gpu/drm/i915/display/intel_dp.c | 71 +-
 include/drm/display/drm_dp_helper.h |  3 +
 3 files changed, 83 insertions(+), 69 deletions(-)

diff --git a/drivers/gpu/drm/display/drm_dp_helper.c 
b/drivers/gpu/drm/display/drm_dp_helper.c
index 8d6ce46471ae..6c91f400ecb1 100644
--- a/drivers/gpu/drm/display/drm_dp_helper.c
+++ b/drivers/gpu/drm/display/drm_dp_helper.c
@@ -2913,6 +2913,84 @@ void drm_dp_vsc_sdp_log(struct drm_printer *p, const 
struct drm_dp_vsc_sdp *vsc)
 }
 EXPORT_SYMBOL(drm_dp_vsc_sdp_log);
 
+/**
+ * drm_dp_vsc_sdp_pack() - pack a given vsc sdp into generic dp_sdp
+ * @vsc: vsc sdp initialized according to its purpose as defined in
+ *   table 2-118 - table 2-120 in DP 1.4a specification
+ * @sdp: valid handle to the generic dp_sdp which will be packed
+ * @size: valid size of the passed sdp handle
+ *
+ * Returns length of sdp on success and error code on failure
+ */
+ssize_t drm_dp_vsc_sdp_pack(const struct drm_dp_vsc_sdp *vsc,
+   struct dp_sdp *sdp, size_t size)
+{
+   size_t length = sizeof(struct dp_sdp);
+
+   if (size < length)
+   return -ENOSPC;
+
+   memset(sdp, 0, size);
+
+   /*
+* Prepare VSC Header for SU as per DP 1.4a spec, Table 2-119
+* VSC SDP Header Bytes
+*/
+   sdp->sdp_header.HB0 = 0; /* Secondary-Data Packet ID = 0 */
+   sdp->sdp_header.HB1 = vsc->sdp_type; /* Secondary-data Packet Type */
+   sdp->sdp_header.HB2 = vsc->revision; /* Revision Number */
+   sdp->sdp_header.HB3 = vsc->length; /* Number of Valid Data Bytes */
+
+   if (vsc->revision == 0x6) {
+   sdp->db[0] = 1;
+   sdp->db[3] = 1;
+   }
+
+   /*
+* Revision 0x5 and revision 0x7 supports Pixel Encoding/Colorimetry
+* Format as per DP 1.4a spec and DP 2.0 respectively.
+*/
+   if (!(vsc->revision == 0x5 || vsc->revision == 0x7))
+   goto out;
+
+   /* VSC SDP Payload for DB16 through DB18 */
+   /* Pixel Encoding and Colorimetry Formats  */
+   sdp->db[16] = (vsc->pixelformat & 0xf) << 4; /* DB16[7:4] */
+   sdp->db[16] |= vsc->colorimetry & 0xf; /* DB16[3:0] */
+
+   switch (vsc->bpc) {
+   case 6:
+   /* 6bpc: 0x0 */
+   break;
+   case 8:
+   sdp->db[17] = 0x1; /* DB17[3:0] */
+   break;
+   case 10:
+   sdp->db[17] = 0x2;
+   break;
+   case 12:
+   sdp->db[17] = 0x3;
+   break;
+   case 16:
+   sdp->db[17] = 0x4;
+   break;
+   default:
+   WARN(1, "Missing case %d\n", vsc->bpc);
+   return -EINVAL;
+   }
+
+   /* Dynamic Range and Component Bit Depth */
+   if (vsc->dynamic_range == DP_DYNAMIC_RANGE_CTA)
+   sdp->db[17] |= 0x80;  /* DB17[7] */
+
+   /* Content Type */
+   sdp->db[18] = vsc->content_type & 0x7;
+
+out:
+   return length;
+}
+EXPORT_SYMBOL(drm_dp_vsc_sdp_pack);
+
 /**
  * drm_dp_get_pcon_max_frl_bw() - maximum frl supported by PCON
  * @dpcd: DisplayPort configuration data
diff --git a/drivers/gpu/drm/i915/display/intel_dp.c 
b/drivers/gpu/drm/i915/display/intel_dp.c
index 217196196e50..a9458df475e2 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -4089,73 +4089,6 @@ intel_dp_needs_vsc_sdp(const struct intel_crtc_state 
*crtc_state,
return false;
 }
 
-static ssize_t intel_dp_vsc_sdp_pack(const struct drm_dp_vsc_sdp *vsc,
-struct dp_sdp *sdp, size_t size)
-{
-   size_t length = sizeof(struct dp_sdp);
-
-   if (size < length)
-   return -ENOSPC;
-
-   memset(sdp, 0, size);
-
-   /*
-* Prepare VSC Header for SU as per DP 1.4a spec, Table 2-119
-* VSC SDP Header Bytes
-*/
-   sdp->sdp_header.HB0 = 0; /* Secondary-Data Packet ID = 0 */
-   sdp->sdp_header.HB1 = vsc->sdp_type; /* Secondary-data Packet Type */
-   sdp->sdp_header.HB2 = vsc->revision; /* Revision Number */
-   sdp->sdp_header.HB3 = vsc->length; /* Number of Valid Data Bytes */
-
-   if (vsc->revision == 0x6) {
-   sdp->db[0] = 1;
-   sdp->db[3] = 1;
-   }
-
-   /*
-* Revision 0x5 and revision 0x7 supports Pixel Encoding/Colorimetry
-* Format as per DP 1.4a spec and DP 2.0 respectively.
-*/
-   if (!(vsc->revision == 0x5 || vsc->revision == 0x7))
-   goto out;
-
-   /* VSC SDP Payload for DB16 through DB18 */
-   /* Pixel Encoding and Colorimetry Formats  */
- 

Re: [PATCH v6 3/5] drm: Add support to get EDID from ACPI

2024-02-15 Thread Mario Limonciello

On 2/15/2024 12:47, Ville Syrjälä wrote:

On Thu, Feb 15, 2024 at 12:20:56PM -0600, Mario Limonciello wrote:

On 2/14/2024 17:13, Ville Syrjälä wrote:

On Wed, Feb 14, 2024 at 03:57:54PM -0600, Mario Limonciello wrote:

Some manufacturers have intentionally put an EDID that differs from
the EDID on the internal panel on laptops.  Drivers that prefer to
fetch this EDID can set a bit on the drm_connector to indicate that
the DRM EDID helpers should try to fetch it and it is preferred if
it's present.

Signed-off-by: Mario Limonciello 
---
   drivers/gpu/drm/Kconfig |   1 +
   drivers/gpu/drm/drm_edid.c  | 109 +---
   include/drm/drm_connector.h |   6 ++
   include/drm/drm_edid.h  |   1 +
   4 files changed, 109 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 872edb47bb53..3db89e6af01d 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -8,6 +8,7 @@
   menuconfig DRM
tristate "Direct Rendering Manager (XFree86 4.1.0 and higher DRI 
support)"
depends on (AGP || AGP=n) && !EMULATED_CMPXCHG && HAS_DMA
+   depends on (ACPI_VIDEO || ACPI_VIDEO=n)
select DRM_PANEL_ORIENTATION_QUIRKS
select DRM_KMS_HELPER if DRM_FBDEV_EMULATION
select FB_CORE if DRM_FBDEV_EMULATION
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 923c4423151c..cdc30c6d05d5 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -28,6 +28,7 @@
* DEALINGS IN THE SOFTWARE.
*/
   
+#include 

   #include 
   #include 
   #include 
@@ -2188,6 +2189,58 @@ drm_do_probe_ddc_edid(void *data, u8 *buf, unsigned int 
block, size_t len)
return ret == xfers ? 0 : -1;
   }
   
+/**

+ * drm_do_probe_acpi_edid() - get EDID information via ACPI _DDC
+ * @data: struct drm_connector
+ * @buf: EDID data buffer to be filled
+ * @block: 128 byte EDID block to start fetching from
+ * @len: EDID data buffer length to fetch
+ *
+ * Try to fetch EDID information by calling acpi_video_get_edid() function.
+ *
+ * Return: 0 on success or error code on failure.
+ */
+static int
+drm_do_probe_acpi_edid(void *data, u8 *buf, unsigned int block, size_t len)
+{
+   struct drm_connector *connector = data;
+   struct drm_device *ddev = connector->dev;
+   struct acpi_device *acpidev = ACPI_COMPANION(ddev->dev);
+   unsigned char start = block * EDID_LENGTH;
+   void *edid;
+   int r;
+
+   if (!acpidev)
+   return -ENODEV;
+
+   switch (connector->connector_type) {
+   case DRM_MODE_CONNECTOR_LVDS:
+   case DRM_MODE_CONNECTOR_eDP:
+   break;
+   default:
+   return -EINVAL;
+   }


We could have other types of connectors that want this too.
I don't see any real benefit in having this check tbh. Drivers
should simply notset the flag on connectors where it won't work,
and only the driver can really know that.


Ack.




+   /* fetch the entire edid from BIOS */
+   r = acpi_video_get_edid(acpidev, ACPI_VIDEO_DISPLAY_LCD, -1, &edid);
+   if (r < 0) {
+   DRM_DEBUG_KMS("Failed to get EDID from ACPI: %d\n", r);
+   return r;
+   }
+   if (len > r || start > r || start + len > r) {
+   r = -EINVAL;
+   goto cleanup;
+   }
+
+   memcpy(buf, edid + start, len);
+   r = 0;
+
+cleanup:
+   kfree(edid);
+
+   return r;
+}
+
   static void connector_bad_edid(struct drm_connector *connector,
   const struct edid *edid, int num_blocks)
   {
@@ -2621,7 +2674,8 @@ EXPORT_SYMBOL(drm_probe_ddc);
* @connector: connector we're probing
* @adapter: I2C adapter to use for DDC
*
- * Poke the given I2C channel to grab EDID data if possible.  If found,
+ * If the connector allows it, try to fetch EDID data using ACPI. If not found
+ * poke the given I2C channel to grab EDID data if possible.  If found,
* attach it to the connector.
*
* Return: Pointer to valid EDID or NULL if we couldn't find any.
@@ -2629,20 +2683,50 @@ EXPORT_SYMBOL(drm_probe_ddc);
   struct edid *drm_get_edid(struct drm_connector *connector,
  struct i2c_adapter *adapter)
   {
-   struct edid *edid;
+   struct edid *edid = NULL;
   
   	if (connector->force == DRM_FORCE_OFF)

return NULL;
   
-	if (connector->force == DRM_FORCE_UNSPECIFIED && !drm_probe_ddc(adapter))

-   return NULL;
+   if (connector->acpi_edid_allowed)
+   edid = _drm_do_get_edid(connector, drm_do_probe_acpi_edid, 
connector, NULL);
+
+   if (!edid) {
+   if (connector->force == DRM_FORCE_UNSPECIFIED && 
!drm_probe_ddc(adapter))
+   return NULL;
+   edid = _drm_do_get_edid(connector, drm_do_probe_ddc_edid, 
adapter, NULL);
+   }
   
-	edid = _drm_do_get_edid(connector, drm_do_probe_ddc_edid, adapter, NULL);


Re: [PATCH v6 3/5] drm: Add support to get EDID from ACPI

2024-02-15 Thread Ville Syrjälä
On Thu, Feb 15, 2024 at 12:20:56PM -0600, Mario Limonciello wrote:
> On 2/14/2024 17:13, Ville Syrjälä wrote:
> > On Wed, Feb 14, 2024 at 03:57:54PM -0600, Mario Limonciello wrote:
> >> Some manufacturers have intentionally put an EDID that differs from
> >> the EDID on the internal panel on laptops.  Drivers that prefer to
> >> fetch this EDID can set a bit on the drm_connector to indicate that
> >> the DRM EDID helpers should try to fetch it and it is preferred if
> >> it's present.
> >>
> >> Signed-off-by: Mario Limonciello 
> >> ---
> >>   drivers/gpu/drm/Kconfig |   1 +
> >>   drivers/gpu/drm/drm_edid.c  | 109 +---
> >>   include/drm/drm_connector.h |   6 ++
> >>   include/drm/drm_edid.h  |   1 +
> >>   4 files changed, 109 insertions(+), 8 deletions(-)
> >>
> >> diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
> >> index 872edb47bb53..3db89e6af01d 100644
> >> --- a/drivers/gpu/drm/Kconfig
> >> +++ b/drivers/gpu/drm/Kconfig
> >> @@ -8,6 +8,7 @@
> >>   menuconfig DRM
> >>tristate "Direct Rendering Manager (XFree86 4.1.0 and higher DRI 
> >> support)"
> >>depends on (AGP || AGP=n) && !EMULATED_CMPXCHG && HAS_DMA
> >> +  depends on (ACPI_VIDEO || ACPI_VIDEO=n)
> >>select DRM_PANEL_ORIENTATION_QUIRKS
> >>select DRM_KMS_HELPER if DRM_FBDEV_EMULATION
> >>select FB_CORE if DRM_FBDEV_EMULATION
> >> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> >> index 923c4423151c..cdc30c6d05d5 100644
> >> --- a/drivers/gpu/drm/drm_edid.c
> >> +++ b/drivers/gpu/drm/drm_edid.c
> >> @@ -28,6 +28,7 @@
> >>* DEALINGS IN THE SOFTWARE.
> >>*/
> >>   
> >> +#include 
> >>   #include 
> >>   #include 
> >>   #include 
> >> @@ -2188,6 +2189,58 @@ drm_do_probe_ddc_edid(void *data, u8 *buf, unsigned 
> >> int block, size_t len)
> >>return ret == xfers ? 0 : -1;
> >>   }
> >>   
> >> +/**
> >> + * drm_do_probe_acpi_edid() - get EDID information via ACPI _DDC
> >> + * @data: struct drm_connector
> >> + * @buf: EDID data buffer to be filled
> >> + * @block: 128 byte EDID block to start fetching from
> >> + * @len: EDID data buffer length to fetch
> >> + *
> >> + * Try to fetch EDID information by calling acpi_video_get_edid() 
> >> function.
> >> + *
> >> + * Return: 0 on success or error code on failure.
> >> + */
> >> +static int
> >> +drm_do_probe_acpi_edid(void *data, u8 *buf, unsigned int block, size_t 
> >> len)
> >> +{
> >> +  struct drm_connector *connector = data;
> >> +  struct drm_device *ddev = connector->dev;
> >> +  struct acpi_device *acpidev = ACPI_COMPANION(ddev->dev);
> >> +  unsigned char start = block * EDID_LENGTH;
> >> +  void *edid;
> >> +  int r;
> >> +
> >> +  if (!acpidev)
> >> +  return -ENODEV;
> >> +
> >> +  switch (connector->connector_type) {
> >> +  case DRM_MODE_CONNECTOR_LVDS:
> >> +  case DRM_MODE_CONNECTOR_eDP:
> >> +  break;
> >> +  default:
> >> +  return -EINVAL;
> >> +  }
> > 
> > We could have other types of connectors that want this too.
> > I don't see any real benefit in having this check tbh. Drivers
> > should simply notset the flag on connectors where it won't work,
> > and only the driver can really know that.
> 
> Ack.
> 
> > 
> >> +  /* fetch the entire edid from BIOS */
> >> +  r = acpi_video_get_edid(acpidev, ACPI_VIDEO_DISPLAY_LCD, -1, &edid);
> >> +  if (r < 0) {
> >> +  DRM_DEBUG_KMS("Failed to get EDID from ACPI: %d\n", r);
> >> +  return r;
> >> +  }
> >> +  if (len > r || start > r || start + len > r) {
> >> +  r = -EINVAL;
> >> +  goto cleanup;
> >> +  }
> >> +
> >> +  memcpy(buf, edid + start, len);
> >> +  r = 0;
> >> +
> >> +cleanup:
> >> +  kfree(edid);
> >> +
> >> +  return r;
> >> +}
> >> +
> >>   static void connector_bad_edid(struct drm_connector *connector,
> >>   const struct edid *edid, int num_blocks)
> >>   {
> >> @@ -2621,7 +2674,8 @@ EXPORT_SYMBOL(drm_probe_ddc);
> >>* @connector: connector we're probing
> >>* @adapter: I2C adapter to use for DDC
> >>*
> >> - * Poke the given I2C channel to grab EDID data if possible.  If found,
> >> + * If the connector allows it, try to fetch EDID data using ACPI. If not 
> >> found
> >> + * poke the given I2C channel to grab EDID data if possible.  If found,
> >>* attach it to the connector.
> >>*
> >>* Return: Pointer to valid EDID or NULL if we couldn't find any.
> >> @@ -2629,20 +2683,50 @@ EXPORT_SYMBOL(drm_probe_ddc);
> >>   struct edid *drm_get_edid(struct drm_connector *connector,
> >>  struct i2c_adapter *adapter)
> >>   {
> >> -  struct edid *edid;
> >> +  struct edid *edid = NULL;
> >>   
> >>if (connector->force == DRM_FORCE_OFF)
> >>return NULL;
> >>   
> >> -  if (connector->force == DRM_FORCE_UNSPECIFIED && 
> >> !drm_probe_ddc(adapter))
> >> -  return NULL;
> >> +  if (connector->acpi_edid_allowed)
> >> +  edid = _drm_do_get_edid(connector, drm_do_probe

Re: [PATCH v6 3/5] drm: Add support to get EDID from ACPI

2024-02-15 Thread Mario Limonciello

On 2/14/2024 17:13, Ville Syrjälä wrote:

On Wed, Feb 14, 2024 at 03:57:54PM -0600, Mario Limonciello wrote:

Some manufacturers have intentionally put an EDID that differs from
the EDID on the internal panel on laptops.  Drivers that prefer to
fetch this EDID can set a bit on the drm_connector to indicate that
the DRM EDID helpers should try to fetch it and it is preferred if
it's present.

Signed-off-by: Mario Limonciello 
---
  drivers/gpu/drm/Kconfig |   1 +
  drivers/gpu/drm/drm_edid.c  | 109 +---
  include/drm/drm_connector.h |   6 ++
  include/drm/drm_edid.h  |   1 +
  4 files changed, 109 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 872edb47bb53..3db89e6af01d 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -8,6 +8,7 @@
  menuconfig DRM
tristate "Direct Rendering Manager (XFree86 4.1.0 and higher DRI 
support)"
depends on (AGP || AGP=n) && !EMULATED_CMPXCHG && HAS_DMA
+   depends on (ACPI_VIDEO || ACPI_VIDEO=n)
select DRM_PANEL_ORIENTATION_QUIRKS
select DRM_KMS_HELPER if DRM_FBDEV_EMULATION
select FB_CORE if DRM_FBDEV_EMULATION
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 923c4423151c..cdc30c6d05d5 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -28,6 +28,7 @@
   * DEALINGS IN THE SOFTWARE.
   */
  
+#include 

  #include 
  #include 
  #include 
@@ -2188,6 +2189,58 @@ drm_do_probe_ddc_edid(void *data, u8 *buf, unsigned int 
block, size_t len)
return ret == xfers ? 0 : -1;
  }
  
+/**

+ * drm_do_probe_acpi_edid() - get EDID information via ACPI _DDC
+ * @data: struct drm_connector
+ * @buf: EDID data buffer to be filled
+ * @block: 128 byte EDID block to start fetching from
+ * @len: EDID data buffer length to fetch
+ *
+ * Try to fetch EDID information by calling acpi_video_get_edid() function.
+ *
+ * Return: 0 on success or error code on failure.
+ */
+static int
+drm_do_probe_acpi_edid(void *data, u8 *buf, unsigned int block, size_t len)
+{
+   struct drm_connector *connector = data;
+   struct drm_device *ddev = connector->dev;
+   struct acpi_device *acpidev = ACPI_COMPANION(ddev->dev);
+   unsigned char start = block * EDID_LENGTH;
+   void *edid;
+   int r;
+
+   if (!acpidev)
+   return -ENODEV;
+
+   switch (connector->connector_type) {
+   case DRM_MODE_CONNECTOR_LVDS:
+   case DRM_MODE_CONNECTOR_eDP:
+   break;
+   default:
+   return -EINVAL;
+   }


We could have other types of connectors that want this too.
I don't see any real benefit in having this check tbh. Drivers
should simply notset the flag on connectors where it won't work,
and only the driver can really know that.


Ack.




+   /* fetch the entire edid from BIOS */
+   r = acpi_video_get_edid(acpidev, ACPI_VIDEO_DISPLAY_LCD, -1, &edid);
+   if (r < 0) {
+   DRM_DEBUG_KMS("Failed to get EDID from ACPI: %d\n", r);
+   return r;
+   }
+   if (len > r || start > r || start + len > r) {
+   r = -EINVAL;
+   goto cleanup;
+   }
+
+   memcpy(buf, edid + start, len);
+   r = 0;
+
+cleanup:
+   kfree(edid);
+
+   return r;
+}
+
  static void connector_bad_edid(struct drm_connector *connector,
   const struct edid *edid, int num_blocks)
  {
@@ -2621,7 +2674,8 @@ EXPORT_SYMBOL(drm_probe_ddc);
   * @connector: connector we're probing
   * @adapter: I2C adapter to use for DDC
   *
- * Poke the given I2C channel to grab EDID data if possible.  If found,
+ * If the connector allows it, try to fetch EDID data using ACPI. If not found
+ * poke the given I2C channel to grab EDID data if possible.  If found,
   * attach it to the connector.
   *
   * Return: Pointer to valid EDID or NULL if we couldn't find any.
@@ -2629,20 +2683,50 @@ EXPORT_SYMBOL(drm_probe_ddc);
  struct edid *drm_get_edid(struct drm_connector *connector,
  struct i2c_adapter *adapter)
  {
-   struct edid *edid;
+   struct edid *edid = NULL;
  
  	if (connector->force == DRM_FORCE_OFF)

return NULL;
  
-	if (connector->force == DRM_FORCE_UNSPECIFIED && !drm_probe_ddc(adapter))

-   return NULL;
+   if (connector->acpi_edid_allowed)
+   edid = _drm_do_get_edid(connector, drm_do_probe_acpi_edid, 
connector, NULL);
+
+   if (!edid) {
+   if (connector->force == DRM_FORCE_UNSPECIFIED && 
!drm_probe_ddc(adapter))
+   return NULL;
+   edid = _drm_do_get_edid(connector, drm_do_probe_ddc_edid, 
adapter, NULL);
+   }
  
-	edid = _drm_do_get_edid(connector, drm_do_probe_ddc_edid, adapter, NULL);

drm_connector_update_edid_property(connector, edid);
return edid;
  }
  EXPORT_SYMBOL(drm_get_edid);
  
+/**

+ * drm_edid_rea

Re: [PATCH 1/2] drm/i915/gt: Disable HW load balancing for CCS

2024-02-15 Thread Matt Roper
On Thu, Feb 15, 2024 at 02:59:23PM +0100, Andi Shyti wrote:
> The hardware should not dynamically balance the load between CCS
> engines. Wa_16016805146 recommends disabling it across all

Is this the right workaround number?  When I check the database, this
workaround was rejected on both DG2-G10 and DG2-G11, and doesn't even
have an entry for DG2-G12.

There are other workarounds that sound somewhat related to load
balancing (e.g., part 3 of Wa_14019159160), but what's asked there is
more involved than just setting one register bit and conflicts a bit
with the second patch of this series.


Matt

> platforms.
> 
> Fixes: d2eae8e98d59 ("drm/i915/dg2: Drop force_probe requirement")
> Signed-off-by: Andi Shyti 
> Cc: Chris Wilson 
> Cc: Joonas Lahtinen 
> Cc: Matt Roper 
> Cc:  # v6.2+
> ---
>  drivers/gpu/drm/i915/gt/intel_gt_regs.h | 1 +
>  drivers/gpu/drm/i915/gt/intel_workarounds.c | 6 ++
>  2 files changed, 7 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/gt/intel_gt_regs.h 
> b/drivers/gpu/drm/i915/gt/intel_gt_regs.h
> index 50962cfd1353..cf709f6c05ae 100644
> --- a/drivers/gpu/drm/i915/gt/intel_gt_regs.h
> +++ b/drivers/gpu/drm/i915/gt/intel_gt_regs.h
> @@ -1478,6 +1478,7 @@
>  
>  #define GEN12_RCU_MODE   _MMIO(0x14800)
>  #define   GEN12_RCU_MODE_CCS_ENABLE  REG_BIT(0)
> +#define   XEHP_RCU_MODE_FIXED_SLICE_CCS_MODE REG_BIT(1)
>  
>  #define CHV_FUSE_GT  _MMIO(VLV_GUNIT_BASE + 0x2168)
>  #define   CHV_FGT_DISABLE_SS0(1 << 10)
> diff --git a/drivers/gpu/drm/i915/gt/intel_workarounds.c 
> b/drivers/gpu/drm/i915/gt/intel_workarounds.c
> index d67d44611c28..7f42c8015f71 100644
> --- a/drivers/gpu/drm/i915/gt/intel_workarounds.c
> +++ b/drivers/gpu/drm/i915/gt/intel_workarounds.c
> @@ -2988,6 +2988,12 @@ general_render_compute_wa_init(struct intel_engine_cs 
> *engine, struct i915_wa_li
>   wa_mcr_masked_en(wal, GEN8_HALF_SLICE_CHICKEN1,
>GEN7_PSD_SINGLE_PORT_DISPATCH_ENABLE);
>   }
> +
> + /*
> +  * Wa_16016805146: disable the CCS load balancing
> +  * indiscriminately for all the platforms
> +  */
> + wa_masked_en(wal, GEN12_RCU_MODE, XEHP_RCU_MODE_FIXED_SLICE_CCS_MODE);
>  }
>  
>  static void
> -- 
> 2.43.0
> 

-- 
Matt Roper
Graphics Software Engineer
Linux GPU Platform Enablement
Intel Corporation


Re: [RFC 0/5] Introduce drm sharpening property

2024-02-15 Thread Ville Syrjälä
On Thu, Feb 15, 2024 at 11:37:54AM -0500, Harry Wentland wrote:
> Adding a couple of compositor devs as they might be interested in this.
> 
> On 2024-02-14 06:24, Nemesa Garg wrote:
> > Many a times images are blurred or upscaled content is also not as
> > crisp as original rendered image. Traditional sharpening techniques often
> > apply a uniform level of enhancement across entire image, which sometimes
> > result in over-sharpening of some areas and potential loss of natural 
> > details. 
> > 
> > Intel has come up with Display Engine based adaptive sharpening filter 
> > with minimal power and performance impact. From LNL onwards, the Display
> > hardware can use one of the pipe scaler for adaptive sharpness filter.
> > This can be used for both gaming and non-gaming use cases like photos,
> > image viewing. It works on a region of pixels depending on the tap size.
> > 
> > This RFC is an attempt to introduce an adaptive sharpness solution which
> > helps in improving the image quality. For this new CRTC property is added.
> 
> I don't think CRTC is the right place for this. Scaling tends to be more
> of a plane thing. Planes can be scaled independently, or is that not the
> case for Intel? Or does Intel HW do this sharpening operation independent
> of any scaling, on the entire output?

We can scale either individual planes, or the entire crtc.

> 
> > The user can set this property with desired sharpness strength value with
> > 0-255. A value of 1 representing minimum sharpening strength and 255
> > representing maximum sharpness strength. A strength value of 0 means no
> > sharpening or sharpening feature disabled.
> > It works on a region of pixels depending on the tap size. The coefficients
> > are used to generate an alpha value which is used to blend the sharpened
> > image to original image.
> >  
> > Userspace implementation for sharpening feature and IGT implementation
> > is in progress.
> 
> It would be very helpful to have an idea how this looks in userspace, and
> which compositors will implement this.

Someone will probably need to spend some real time thinking
how this interacts with the scaling filter propery (eg. if
we want to extend that property with new values) and
the laptop panel scaling mode property. We also want to
implement the margin properties for external displays
which also involves scaling. Ie. we need some kind of
consistent story how all those things will work together.

> 
> Harry
> 
> > 
> > Nemesa Garg (5):
> >   drm: Introduce sharpeness mode property
> >   drm/i915/display/: Compute the scaler filter coefficients
> >   drm/i915/dispaly/: Enable the second scaler
> >   drm/i915/display/: Add registers and compute the strength
> >   drm/i915/display: Load the lut values and enable sharpness
> > 
> >  drivers/gpu/drm/drm_atomic_uapi.c |   4 +
> >  drivers/gpu/drm/drm_crtc.c|  17 ++
> >  drivers/gpu/drm/i915/Makefile |   1 +
> >  drivers/gpu/drm/i915/display/intel_crtc.c |   3 +
> >  drivers/gpu/drm/i915/display/intel_display.c  |  20 +-
> >  .../drm/i915/display/intel_display_types.h|  11 +
> >  .../drm/i915/display/intel_modeset_verify.c   |   1 +
> >  .../drm/i915/display/intel_sharpen_filter.c   | 214 ++
> >  .../drm/i915/display/intel_sharpen_filter.h   |  31 +++
> >  drivers/gpu/drm/i915/display/skl_scaler.c |  86 ++-
> >  drivers/gpu/drm/i915/display/skl_scaler.h |   1 +
> >  drivers/gpu/drm/i915/i915_reg.h   |  19 ++
> >  drivers/gpu/drm/xe/Makefile   |   1 +
> >  include/drm/drm_crtc.h|  17 ++
> >  14 files changed, 416 insertions(+), 10 deletions(-)
> >  create mode 100644 drivers/gpu/drm/i915/display/intel_sharpen_filter.c
> >  create mode 100644 drivers/gpu/drm/i915/display/intel_sharpen_filter.h
> > 

-- 
Ville Syrjälä
Intel


Re: Re: [PULL] drm-misc-fixes

2024-02-15 Thread Geert Uytterhoeven
Hi Maxime,

On Thu, Feb 15, 2024 at 5:09 PM Maxime Ripard  wrote:
 On Thu, Feb 15, 2024 at 01:41:24PM +0100, Geert Uytterhoeven wrote:
> > On Thu, 15 Feb 2024, Maxime Ripard wrote:
> > > Matthew Auld (1):
> > >  drm/tests/drm_buddy: add alloc_contiguous test
> >
> > Please drop this one.
> >
> > nore...@ellerman.id.au reported a build failure on m68k (and presumably
> > other 32-bit platforms) in next-20240215:
> >
> > ERROR: modpost: "__umoddi3" [drivers/gpu/drm/tests/drm_buddy_test.ko] 
> > undefined!
> > ERROR: modpost: "__moddi3" [drivers/gpu/drm/tests/drm_buddy_test.ko] 
> > undefined!
> >
> > Reverting commit a64056bb5a3215bd ("drm/tests/drm_buddy: add
> > alloc_contiguous test") fixes the issue.
>
> From a quick cross-compile test with arm(32), it seems to work there
> interestingly:
>
> ./tools/testing/kunit/kunit.py run \
> --kunitconfig=drivers/gpu/drm//tests \
> --cross_compile arm-linux-gnu- --arch arm

shmobile_defconfig + CONFIG_DRM_KUNIT_TEST=y + CONFIG_KUNIT=y:

arm-linux-gnueabihf-ld: drivers/gpu/drm/tests/drm_buddy_test.o: in
function `drm_test_buddy_alloc_contiguous':
drm_buddy_test.c:(.text+0xe0): undefined reference to `__aeabi_uldivmod'

> But I agree, with should wait for a fix or a revert before merging this.

Great, thanks!

Gr{oetje,eeting}s,

Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


[PATCH 12/12] drm/i915: Create the printer only once in intel_pipe_config_compare()

2024-02-15 Thread Ville Syrjala
From: Ville Syrjälä 

Create the drm_printer at the start of intel_pipe_config_compare()
and pass it on to all the mismatch() functions.

Signed-off-by: Ville Syrjälä 
---
 drivers/gpu/drm/i915/display/intel_display.c | 101 +--
 1 file changed, 46 insertions(+), 55 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display.c 
b/drivers/gpu/drm/i915/display/intel_display.c
index 26580d4aef2d..69c9693dcc8d 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -4787,11 +4787,11 @@ intel_compare_buffer(const u8 *a, const u8 *b, size_t 
len)
return memcmp(a, b, len) == 0;
 }
 
-static void __printf(4, 5)
-pipe_config_mismatch(bool fastset, const struct intel_crtc *crtc,
+static void __printf(5, 6)
+pipe_config_mismatch(struct drm_printer *p, bool fastset,
+const struct intel_crtc *crtc,
 const char *name, const char *format, ...)
 {
-   struct drm_i915_private *i915 = to_i915(crtc->base.dev);
struct va_format vaf;
va_list args;
 
@@ -4800,65 +4800,55 @@ pipe_config_mismatch(bool fastset, const struct 
intel_crtc *crtc,
vaf.va = &args;
 
if (fastset)
-   drm_dbg_kms(&i915->drm,
-   "[CRTC:%d:%s] fastset requirement not met in %s 
%pV\n",
-   crtc->base.base.id, crtc->base.name, name, &vaf);
+   drm_printf(p, "[CRTC:%d:%s] fastset requirement not met in %s 
%pV\n",
+  crtc->base.base.id, crtc->base.name, name, &vaf);
else
-   drm_err(&i915->drm, "[CRTC:%d:%s] mismatch in %s %pV\n",
-   crtc->base.base.id, crtc->base.name, name, &vaf);
+   drm_printf(p, "[CRTC:%d:%s] mismatch in %s %pV\n",
+  crtc->base.base.id, crtc->base.name, name, &vaf);
 
va_end(args);
 }
 
 static void
-pipe_config_infoframe_mismatch(bool fastset, const struct intel_crtc *crtc,
+pipe_config_infoframe_mismatch(struct drm_printer *p, bool fastset,
+  const struct intel_crtc *crtc,
   const char *name,
   const union hdmi_infoframe *a,
   const union hdmi_infoframe *b)
 {
struct drm_i915_private *i915 = to_i915(crtc->base.dev);
-   struct drm_printer p;
const char *loglevel;
 
if (fastset) {
if (!drm_debug_enabled(DRM_UT_KMS))
return;
 
-   p = drm_dbg_printer(&i915->drm, DRM_UT_KMS, NULL);
loglevel = KERN_DEBUG;
} else {
-   p = drm_err_printer(&i915->drm, NULL);
loglevel = KERN_ERR;
}
 
-   pipe_config_mismatch(fastset, crtc, name, "infoframe");
+   pipe_config_mismatch(p, fastset, crtc, name, "infoframe");
 
-   drm_printf(&p, "expected:\n");
+   drm_printf(p, "expected:\n");
hdmi_infoframe_log(loglevel, i915->drm.dev, a);
-   drm_printf(&p, "found:\n");
+   drm_printf(p, "found:\n");
hdmi_infoframe_log(loglevel, i915->drm.dev, b);
 }
 
 static void
-pipe_config_dp_vsc_sdp_mismatch(bool fastset, const struct intel_crtc *crtc,
+pipe_config_dp_vsc_sdp_mismatch(struct drm_printer *p, bool fastset,
+   const struct intel_crtc *crtc,
const char *name,
const struct drm_dp_vsc_sdp *a,
const struct drm_dp_vsc_sdp *b)
 {
-   struct drm_i915_private *i915 = to_i915(crtc->base.dev);
-   struct drm_printer p;
+   pipe_config_mismatch(p, fastset, crtc, name, "dp sdp");
 
-   if (fastset)
-   p = drm_dbg_printer(&i915->drm, DRM_UT_KMS, NULL);
-   else
-   p = drm_err_printer(&i915->drm, NULL);
-
-   pipe_config_mismatch(fastset, crtc, name, "dp sdp");
-
-   drm_printf(&p, "expected:\n");
-   drm_dp_vsc_sdp_log(&p, a);
-   drm_printf(&p, "found:\n");
-   drm_dp_vsc_sdp_log(&p, b);
+   drm_printf(p, "expected:\n");
+   drm_dp_vsc_sdp_log(p, a);
+   drm_printf(p, "found:\n");
+   drm_dp_vsc_sdp_log(p, b);
 }
 
 /* Returns the length up to and including the last differing byte */
@@ -4876,7 +4866,8 @@ memcmp_diff_len(const u8 *a, const u8 *b, size_t len)
 }
 
 static void
-pipe_config_buffer_mismatch(bool fastset, const struct intel_crtc *crtc,
+pipe_config_buffer_mismatch(struct drm_printer *p, bool fastset,
+   const struct intel_crtc *crtc,
const char *name,
const u8 *a, const u8 *b, size_t len)
 {
@@ -4891,7 +4882,7 @@ pipe_config_buffer_mismatch(bool fastset, const struct 
intel_crtc *crtc,
loglevel = KERN_ERR;
}
 
-   pipe_config_mismatch(fastset, crtc, name, "buffer");
+   pipe_config_mismatch(p, fastset, crtc, na

[PATCH 11/12] drm/i915: Reuse pipe_config_mismatch() more

2024-02-15 Thread Ville Syrjala
From: Ville Syrjälä 

Just call pipe_config_mismatch() from all the more specialized
mismatch() functions instead of hand rolling the same printfs
all over.

Signed-off-by: Ville Syrjälä 
---
 drivers/gpu/drm/i915/display/intel_display.c | 45 +---
 1 file changed, 10 insertions(+), 35 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display.c 
b/drivers/gpu/drm/i915/display/intel_display.c
index a9dd3632898c..26580d4aef2d 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -4826,17 +4826,13 @@ pipe_config_infoframe_mismatch(bool fastset, const 
struct intel_crtc *crtc,
 
p = drm_dbg_printer(&i915->drm, DRM_UT_KMS, NULL);
loglevel = KERN_DEBUG;
-
-   drm_printf(&p, "[CRTC:%d:%s] fastset requirement not met in %s 
infoframe\n",
-  crtc->base.base.id, crtc->base.name, name);
} else {
p = drm_err_printer(&i915->drm, NULL);
loglevel = KERN_ERR;
-
-   drm_printf(&p, "[CRTC:%d:%s] mismatch in %s infoframe\n",
-  crtc->base.base.id, crtc->base.name, name);
}
 
+   pipe_config_mismatch(fastset, crtc, name, "infoframe");
+
drm_printf(&p, "expected:\n");
hdmi_infoframe_log(loglevel, i915->drm.dev, a);
drm_printf(&p, "found:\n");
@@ -4852,17 +4848,12 @@ pipe_config_dp_vsc_sdp_mismatch(bool fastset, const 
struct intel_crtc *crtc,
struct drm_i915_private *i915 = to_i915(crtc->base.dev);
struct drm_printer p;
 
-   if (fastset) {
+   if (fastset)
p = drm_dbg_printer(&i915->drm, DRM_UT_KMS, NULL);
-
-   drm_printf(&p, "[CRTC:%d:%s] fastset requirement not met in %s 
dp sdp\n",
-  crtc->base.base.id, crtc->base.name, name);
-   } else {
+   else
p = drm_err_printer(&i915->drm, NULL);
 
-   drm_printf(&p, "[CRTC:%d:%s] mismatch in %s dp sdp\n",
-  crtc->base.base.id, crtc->base.name, name);
-   }
+   pipe_config_mismatch(fastset, crtc, name, "dp sdp");
 
drm_printf(&p, "expected:\n");
drm_dp_vsc_sdp_log(&p, a);
@@ -4889,27 +4880,19 @@ pipe_config_buffer_mismatch(bool fastset, const struct 
intel_crtc *crtc,
const char *name,
const u8 *a, const u8 *b, size_t len)
 {
-   struct drm_i915_private *i915 = to_i915(crtc->base.dev);
-   struct drm_printer p;
const char *loglevel;
 
if (fastset) {
if (!drm_debug_enabled(DRM_UT_KMS))
return;
 
-   p = drm_dbg_printer(&i915->drm, DRM_UT_KMS, NULL);
loglevel = KERN_DEBUG;
-
-   drm_printf(&p, "[CRTC:%d:%s] fastset requirement not met in %s 
buffer\n",
-  crtc->base.base.id, crtc->base.name, name);
} else {
-   p = drm_err_printer(&i915->drm, NULL);
loglevel = KERN_ERR;
-
-   drm_printf(&p, "[CRTC:%d:%s] mismatch in %s buffer\n",
-  crtc->base.base.id, crtc->base.name, name);
}
 
+   pipe_config_mismatch(fastset, crtc, name, "buffer");
+
/* only dump up to the last difference */
len = memcmp_diff_len(a, b, len);
 
@@ -4929,20 +4912,12 @@ pipe_config_pll_mismatch(bool fastset,
struct drm_i915_private *i915 = to_i915(crtc->base.dev);
struct drm_printer p;
 
-   if (fastset) {
-   if (!drm_debug_enabled(DRM_UT_KMS))
-   return;
-
+   if (fastset)
p = drm_dbg_printer(&i915->drm, DRM_UT_KMS, NULL);
-
-   drm_printf(&p, "[CRTC:%d:%s] fastset requirement not met in 
%s\n",
-  crtc->base.base.id, crtc->base.name, name);
-   } else {
+   else
p = drm_err_printer(&i915->drm, NULL);
 
-   drm_printf(&p, "[CRTC:%d:%s] mismatch in %s\n",
-  crtc->base.base.id, crtc->base.name, name);
-   }
+   pipe_config_mismatch(fastset, crtc, name, " "); /* stupid 
-Werror=format-zero-length */
 
drm_dbg_kms(&i915->drm, "expected:\n");
intel_dpll_dump_hw_state(i915, &p, a);
-- 
2.43.0



[PATCH 10/12] drm/i915: Relocate pipe_config_mismatch()

2024-02-15 Thread Ville Syrjala
From: Ville Syrjälä 

Hoist pipe_config_mismatch() upwards a bit so that it can get
reused by the other mismatch() functions.

Signed-off-by: Ville Syrjälä 
---
 drivers/gpu/drm/i915/display/intel_display.c | 46 ++--
 1 file changed, 23 insertions(+), 23 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display.c 
b/drivers/gpu/drm/i915/display/intel_display.c
index d7f39ad84138..a9dd3632898c 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -4787,6 +4787,29 @@ intel_compare_buffer(const u8 *a, const u8 *b, size_t 
len)
return memcmp(a, b, len) == 0;
 }
 
+static void __printf(4, 5)
+pipe_config_mismatch(bool fastset, const struct intel_crtc *crtc,
+const char *name, const char *format, ...)
+{
+   struct drm_i915_private *i915 = to_i915(crtc->base.dev);
+   struct va_format vaf;
+   va_list args;
+
+   va_start(args, format);
+   vaf.fmt = format;
+   vaf.va = &args;
+
+   if (fastset)
+   drm_dbg_kms(&i915->drm,
+   "[CRTC:%d:%s] fastset requirement not met in %s 
%pV\n",
+   crtc->base.base.id, crtc->base.name, name, &vaf);
+   else
+   drm_err(&i915->drm, "[CRTC:%d:%s] mismatch in %s %pV\n",
+   crtc->base.base.id, crtc->base.name, name, &vaf);
+
+   va_end(args);
+}
+
 static void
 pipe_config_infoframe_mismatch(bool fastset, const struct intel_crtc *crtc,
   const char *name,
@@ -4896,29 +4919,6 @@ pipe_config_buffer_mismatch(bool fastset, const struct 
intel_crtc *crtc,
   16, 0, b, len, false);
 }
 
-static void __printf(4, 5)
-pipe_config_mismatch(bool fastset, const struct intel_crtc *crtc,
-const char *name, const char *format, ...)
-{
-   struct drm_i915_private *i915 = to_i915(crtc->base.dev);
-   struct va_format vaf;
-   va_list args;
-
-   va_start(args, format);
-   vaf.fmt = format;
-   vaf.va = &args;
-
-   if (fastset)
-   drm_dbg_kms(&i915->drm,
-   "[CRTC:%d:%s] fastset requirement not met in %s 
%pV\n",
-   crtc->base.base.id, crtc->base.name, name, &vaf);
-   else
-   drm_err(&i915->drm, "[CRTC:%d:%s] mismatch in %s %pV\n",
-   crtc->base.base.id, crtc->base.name, name, &vaf);
-
-   va_end(args);
-}
-
 static void
 pipe_config_pll_mismatch(bool fastset,
 const struct intel_crtc *crtc,
-- 
2.43.0



[PATCH 09/12] drm/i915: Skip intel_crtc_state_dump() if debugs aren't enabled

2024-02-15 Thread Ville Syrjala
From: Ville Syrjälä 

intel_crtc_state_dump() does a whole boatload of string formatting
which is all wasted energy if the debugs aren't even enabled. Skip
the whole thing in that case.

Signed-off-by: Ville Syrjälä 
---
 drivers/gpu/drm/i915/display/intel_crtc_state_dump.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/intel_crtc_state_dump.c 
b/drivers/gpu/drm/i915/display/intel_crtc_state_dump.c
index b5b9b99213cf..cd78c200d483 100644
--- a/drivers/gpu/drm/i915/display/intel_crtc_state_dump.c
+++ b/drivers/gpu/drm/i915/display/intel_crtc_state_dump.c
@@ -192,6 +192,9 @@ void intel_crtc_state_dump(const struct intel_crtc_state 
*pipe_config,
char buf[64];
int i;
 
+   if (!drm_debug_enabled(DRM_UT_KMS))
+   return;
+
p = drm_dbg_printer(&i915->drm, DRM_UT_KMS, NULL);
 
drm_printf(&p, "[CRTC:%d:%s] enable: %s [%s]\n",
-- 
2.43.0



[PATCH 08/12] drm/i915: Convert the remaining state dump to drm_printer

2024-02-15 Thread Ville Syrjala
From: Ville Syrjälä 

Plumb the drm_printer to all the little helpers called
by intel_crtc_state_dump() and use it there as well.

The exceptions are the ELD and infoframe stuff as they
call helpers outside of the drm and thus can't use
drm_printer.

Signed-off-by: Ville Syrjälä 
---
 .../drm/i915/display/intel_crtc_state_dump.c  | 137 --
 1 file changed, 60 insertions(+), 77 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_crtc_state_dump.c 
b/drivers/gpu/drm/i915/display/intel_crtc_state_dump.c
index b34fb0e6e46d..b5b9b99213cf 100644
--- a/drivers/gpu/drm/i915/display/intel_crtc_state_dump.c
+++ b/drivers/gpu/drm/i915/display/intel_crtc_state_dump.c
@@ -12,33 +12,31 @@
 #include "intel_hdmi.h"
 #include "intel_vrr.h"
 
-static void intel_dump_crtc_timings(struct drm_i915_private *i915,
+static void intel_dump_crtc_timings(struct drm_printer *p,
const struct drm_display_mode *mode)
 {
-   drm_dbg_kms(&i915->drm, "crtc timings: clock=%d, "
-   "hd=%d hb=%d-%d hs=%d-%d ht=%d, "
-   "vd=%d vb=%d-%d vs=%d-%d vt=%d, "
-   "flags=0x%x\n",
-   mode->crtc_clock,
-   mode->crtc_hdisplay, mode->crtc_hblank_start, 
mode->crtc_hblank_end,
-   mode->crtc_hsync_start, mode->crtc_hsync_end, 
mode->crtc_htotal,
-   mode->crtc_vdisplay, mode->crtc_vblank_start, 
mode->crtc_vblank_end,
-   mode->crtc_vsync_start, mode->crtc_vsync_end, 
mode->crtc_vtotal,
-   mode->flags);
+   drm_printf(p, "crtc timings: clock=%d, "
+  "hd=%d hb=%d-%d hs=%d-%d ht=%d, "
+  "vd=%d vb=%d-%d vs=%d-%d vt=%d, "
+  "flags=0x%x\n",
+  mode->crtc_clock,
+  mode->crtc_hdisplay, mode->crtc_hblank_start, 
mode->crtc_hblank_end,
+  mode->crtc_hsync_start, mode->crtc_hsync_end, 
mode->crtc_htotal,
+  mode->crtc_vdisplay, mode->crtc_vblank_start, 
mode->crtc_vblank_end,
+  mode->crtc_vsync_start, mode->crtc_vsync_end, 
mode->crtc_vtotal,
+  mode->flags);
 }
 
 static void
-intel_dump_m_n_config(const struct intel_crtc_state *pipe_config,
+intel_dump_m_n_config(struct drm_printer *p,
+ const struct intel_crtc_state *pipe_config,
  const char *id, unsigned int lane_count,
  const struct intel_link_m_n *m_n)
 {
-   struct drm_i915_private *i915 = to_i915(pipe_config->uapi.crtc->dev);
-
-   drm_dbg_kms(&i915->drm,
-   "%s: lanes: %i; data_m: %u, data_n: %u, link_m: %u, link_n: 
%u, tu: %u\n",
-   id, lane_count,
-   m_n->data_m, m_n->data_n,
-   m_n->link_m, m_n->link_n, m_n->tu);
+   drm_printf(p, "%s: lanes: %i; data_m: %u, data_n: %u, link_m: %u, 
link_n: %u, tu: %u\n",
+  id, lane_count,
+  m_n->data_m, m_n->data_n,
+  m_n->link_m, m_n->link_n, m_n->tu);
 }
 
 static void
@@ -52,17 +50,7 @@ intel_dump_infoframe(struct drm_i915_private *i915,
 }
 
 static void
-intel_dump_dp_vsc_sdp(struct drm_i915_private *i915,
- const struct drm_dp_vsc_sdp *vsc)
-{
-   struct drm_printer p = drm_dbg_printer(&i915->drm, DRM_UT_KMS, NULL);
-
-   drm_dp_vsc_sdp_log(&p, vsc);
-}
-
-static void
-intel_dump_buffer(struct drm_i915_private *i915,
- const char *prefix, const u8 *buf, size_t len)
+intel_dump_buffer(const char *prefix, const u8 *buf, size_t len)
 {
if (!drm_debug_enabled(DRM_UT_KMS))
return;
@@ -130,71 +118,66 @@ const char *intel_output_format_name(enum 
intel_output_format format)
return output_format_str[format];
 }
 
-static void intel_dump_plane_state(const struct intel_plane_state *plane_state)
+static void intel_dump_plane_state(struct drm_printer *p,
+  const struct intel_plane_state *plane_state)
 {
struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
-   struct drm_i915_private *i915 = to_i915(plane->base.dev);
const struct drm_framebuffer *fb = plane_state->hw.fb;
 
if (!fb) {
-   drm_dbg_kms(&i915->drm,
-   "[PLANE:%d:%s] fb: [NOFB], visible: %s\n",
-   plane->base.base.id, plane->base.name,
-   str_yes_no(plane_state->uapi.visible));
+   drm_printf(p, "[PLANE:%d:%s] fb: [NOFB], visible: %s\n",
+  plane->base.base.id, plane->base.name,
+  str_yes_no(plane_state->uapi.visible));
return;
}
 
-   drm_dbg_kms(&i915->drm,
-   "[PLANE:%d:%s] fb: [FB:%d] %ux%u format = %p4cc modifier = 
0x%llx, visible: %s\n",
-   plane->base.base.id, plane->base.name,
-   fb

[PATCH 07/12] drm/i915: Use drm_printer more extensively in intel_crtc_state_dump()

2024-02-15 Thread Ville Syrjala
From: Ville Syrjälä 

Convert all the direct drm_dbg_kms() stuff in intel_crtc_state_dump()
over to drm_printf() since we now have the drm_printer around.

Signed-off-by: Ville Syrjälä 
---
 .../drm/i915/display/intel_crtc_state_dump.c  | 185 --
 1 file changed, 87 insertions(+), 98 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_crtc_state_dump.c 
b/drivers/gpu/drm/i915/display/intel_crtc_state_dump.c
index 59d2b3d39951..b34fb0e6e46d 100644
--- a/drivers/gpu/drm/i915/display/intel_crtc_state_dump.c
+++ b/drivers/gpu/drm/i915/display/intel_crtc_state_dump.c
@@ -211,43 +211,40 @@ void intel_crtc_state_dump(const struct intel_crtc_state 
*pipe_config,
 
p = drm_dbg_printer(&i915->drm, DRM_UT_KMS, NULL);
 
-   drm_dbg_kms(&i915->drm, "[CRTC:%d:%s] enable: %s [%s]\n",
-   crtc->base.base.id, crtc->base.name,
-   str_yes_no(pipe_config->hw.enable), context);
+   drm_printf(&p, "[CRTC:%d:%s] enable: %s [%s]\n",
+  crtc->base.base.id, crtc->base.name,
+  str_yes_no(pipe_config->hw.enable), context);
 
if (!pipe_config->hw.enable)
goto dump_planes;
 
snprintf_output_types(buf, sizeof(buf), pipe_config->output_types);
-   drm_dbg_kms(&i915->drm,
-   "active: %s, output_types: %s (0x%x), output format: %s, 
sink format: %s\n",
-   str_yes_no(pipe_config->hw.active),
-   buf, pipe_config->output_types,
-   intel_output_format_name(pipe_config->output_format),
-   intel_output_format_name(pipe_config->sink_format));
+   drm_printf(&p, "active: %s, output_types: %s (0x%x), output format: %s, 
sink format: %s\n",
+  str_yes_no(pipe_config->hw.active),
+  buf, pipe_config->output_types,
+  intel_output_format_name(pipe_config->output_format),
+  intel_output_format_name(pipe_config->sink_format));
 
-   drm_dbg_kms(&i915->drm,
-   "cpu_transcoder: %s, pipe bpp: %i, dithering: %i\n",
-   transcoder_name(pipe_config->cpu_transcoder),
-   pipe_config->pipe_bpp, pipe_config->dither);
+   drm_printf(&p, "cpu_transcoder: %s, pipe bpp: %i, dithering: %i\n",
+  transcoder_name(pipe_config->cpu_transcoder),
+  pipe_config->pipe_bpp, pipe_config->dither);
 
-   drm_dbg_kms(&i915->drm, "MST master transcoder: %s\n",
-   transcoder_name(pipe_config->mst_master_transcoder));
+   drm_printf(&p, "MST master transcoder: %s\n",
+  transcoder_name(pipe_config->mst_master_transcoder));
 
-   drm_dbg_kms(&i915->drm,
-   "port sync: master transcoder: %s, slave transcoder bitmask 
= 0x%x\n",
-   transcoder_name(pipe_config->master_transcoder),
-   pipe_config->sync_mode_slaves_mask);
+   drm_printf(&p, "port sync: master transcoder: %s, slave transcoder 
bitmask = 0x%x\n",
+  transcoder_name(pipe_config->master_transcoder),
+  pipe_config->sync_mode_slaves_mask);
 
-   drm_dbg_kms(&i915->drm, "bigjoiner: %s, pipes: 0x%x\n",
-   intel_crtc_is_bigjoiner_slave(pipe_config) ? "slave" :
-   intel_crtc_is_bigjoiner_master(pipe_config) ? "master" : 
"no",
-   pipe_config->bigjoiner_pipes);
+   drm_printf(&p, "bigjoiner: %s, pipes: 0x%x\n",
+  intel_crtc_is_bigjoiner_slave(pipe_config) ? "slave" :
+  intel_crtc_is_bigjoiner_master(pipe_config) ? "master" : 
"no",
+  pipe_config->bigjoiner_pipes);
 
-   drm_dbg_kms(&i915->drm, "splitter: %s, link count %d, overlap %d\n",
-   str_enabled_disabled(pipe_config->splitter.enable),
-   pipe_config->splitter.link_count,
-   pipe_config->splitter.pixel_overlap);
+   drm_printf(&p, "splitter: %s, link count %d, overlap %d\n",
+  str_enabled_disabled(pipe_config->splitter.enable),
+  pipe_config->splitter.link_count,
+  pipe_config->splitter.pixel_overlap);
 
if (pipe_config->has_pch_encoder)
intel_dump_m_n_config(pipe_config, "fdi",
@@ -261,32 +258,30 @@ void intel_crtc_state_dump(const struct intel_crtc_state 
*pipe_config,
intel_dump_m_n_config(pipe_config, "dp m2_n2",
  pipe_config->lane_count,
  &pipe_config->dp_m2_n2);
-   drm_dbg_kms(&i915->drm, "fec: %s, enhanced framing: %s\n",
-   str_enabled_disabled(pipe_config->fec_enable),
-   
str_enabled_disabled(pipe_config->enhanced_framing));
+   drm_printf(&p, "fec: %s, enhanced framing: %s\n",
+  str_enabled_disabled(pipe_config->fec_enable),
+

[PATCH 06/12] drm/i915: Convert intel_dpll_dump_hw_state() to drm_printer

2024-02-15 Thread Ville Syrjala
From: Ville Syrjälä 

Utilize drm_printer in pipe_config_pll_mismatch() to avoid
a bit of code duplication.

To achieve this we need to plumb the printer all way to the
dpll_mgr .dump_hw_state() functions. Those are also used by
intel_crtc_state_dump() which needs to be adjusted as well.

Signed-off-by: Ville Syrjälä 
---
 .../drm/i915/display/intel_crtc_state_dump.c  |   5 +-
 drivers/gpu/drm/i915/display/intel_display.c  |  27 ++---
 drivers/gpu/drm/i915/display/intel_dpll_mgr.c | 105 --
 drivers/gpu/drm/i915/display/intel_dpll_mgr.h |   2 +
 4 files changed, 67 insertions(+), 72 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_crtc_state_dump.c 
b/drivers/gpu/drm/i915/display/intel_crtc_state_dump.c
index 4bcf446c75f4..59d2b3d39951 100644
--- a/drivers/gpu/drm/i915/display/intel_crtc_state_dump.c
+++ b/drivers/gpu/drm/i915/display/intel_crtc_state_dump.c
@@ -205,9 +205,12 @@ void intel_crtc_state_dump(const struct intel_crtc_state 
*pipe_config,
struct drm_i915_private *i915 = to_i915(crtc->base.dev);
const struct intel_plane_state *plane_state;
struct intel_plane *plane;
+   struct drm_printer p;
char buf[64];
int i;
 
+   p = drm_dbg_printer(&i915->drm, DRM_UT_KMS, NULL);
+
drm_dbg_kms(&i915->drm, "[CRTC:%d:%s] enable: %s [%s]\n",
crtc->base.base.id, crtc->base.name,
str_yes_no(pipe_config->hw.enable), context);
@@ -356,7 +359,7 @@ void intel_crtc_state_dump(const struct intel_crtc_state 
*pipe_config,
pipe_config->ips_enabled, pipe_config->double_wide,
pipe_config->has_drrs);
 
-   intel_dpll_dump_hw_state(i915, &pipe_config->dpll_hw_state);
+   intel_dpll_dump_hw_state(i915, &p, &pipe_config->dpll_hw_state);
 
if (IS_CHERRYVIEW(i915))
drm_dbg_kms(&i915->drm,
diff --git a/drivers/gpu/drm/i915/display/intel_display.c 
b/drivers/gpu/drm/i915/display/intel_display.c
index e5010049d52e..d7f39ad84138 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -4927,26 +4927,27 @@ pipe_config_pll_mismatch(bool fastset,
 const struct intel_dpll_hw_state *b)
 {
struct drm_i915_private *i915 = to_i915(crtc->base.dev);
+   struct drm_printer p;
 
if (fastset) {
if (!drm_debug_enabled(DRM_UT_KMS))
return;
 
-   drm_dbg_kms(&i915->drm,
-   "[CRTC:%d:%s] fastset requirement not met in %s\n",
-   crtc->base.base.id, crtc->base.name, name);
-   drm_dbg_kms(&i915->drm, "expected:\n");
-   intel_dpll_dump_hw_state(i915, a);
-   drm_dbg_kms(&i915->drm, "found:\n");
-   intel_dpll_dump_hw_state(i915, b);
+   p = drm_dbg_printer(&i915->drm, DRM_UT_KMS, NULL);
+
+   drm_printf(&p, "[CRTC:%d:%s] fastset requirement not met in 
%s\n",
+  crtc->base.base.id, crtc->base.name, name);
} else {
-   drm_err(&i915->drm, "[CRTC:%d:%s] mismatch in %s buffer\n",
-   crtc->base.base.id, crtc->base.name, name);
-   drm_err(&i915->drm, "expected:\n");
-   intel_dpll_dump_hw_state(i915, a);
-   drm_err(&i915->drm, "found:\n");
-   intel_dpll_dump_hw_state(i915, b);
+   p = drm_err_printer(&i915->drm, NULL);
+
+   drm_printf(&p, "[CRTC:%d:%s] mismatch in %s\n",
+  crtc->base.base.id, crtc->base.name, name);
}
+
+   drm_dbg_kms(&i915->drm, "expected:\n");
+   intel_dpll_dump_hw_state(i915, &p, a);
+   drm_dbg_kms(&i915->drm, "found:\n");
+   intel_dpll_dump_hw_state(i915, &p, b);
 }
 
 bool
diff --git a/drivers/gpu/drm/i915/display/intel_dpll_mgr.c 
b/drivers/gpu/drm/i915/display/intel_dpll_mgr.c
index ff480f171f75..9542e62186e2 100644
--- a/drivers/gpu/drm/i915/display/intel_dpll_mgr.c
+++ b/drivers/gpu/drm/i915/display/intel_dpll_mgr.c
@@ -107,7 +107,7 @@ struct intel_dpll_mgr {
   struct intel_crtc *crtc,
   struct intel_encoder *encoder);
void (*update_ref_clks)(struct drm_i915_private *i915);
-   void (*dump_hw_state)(struct drm_i915_private *i915,
+   void (*dump_hw_state)(struct drm_printer *p,
  const struct intel_dpll_hw_state *hw_state);
bool (*compare_hw_state)(const struct intel_dpll_hw_state *a,
 const struct intel_dpll_hw_state *b);
@@ -634,16 +634,15 @@ static int ibx_get_dpll(struct intel_atomic_state *state,
return 0;
 }
 
-static void ibx_dump_hw_state(struct drm_i915_private *i915,
+static void ibx_dump_hw_state(struct drm_printer *p,
  const struct intel_dpll_hw_state *hw_state)
 {
-   drm_dbg_kms(

[PATCH 05/12] drm/i915: Convert pipe_config_buffer_mismatch() to drm_printer

2024-02-15 Thread Ville Syrjala
From: Ville Syrjälä 

Utilize drm_printer in pipe_config_infoframe_mismatch() to avoid
a bit of code duplication.

print_hex_dump() doesn't know anything about the printer so
it still needs the DRM_UT_KMS check and special handling for
the loglevel. But at least we end up with a bit less copy-pasta.

Signed-off-by: Ville Syrjälä 
---
 drivers/gpu/drm/i915/display/intel_display.c | 37 ++--
 1 file changed, 19 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display.c 
b/drivers/gpu/drm/i915/display/intel_display.c
index 0292c49e0dad..e5010049d52e 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -4866,33 +4866,34 @@ pipe_config_buffer_mismatch(bool fastset, const struct 
intel_crtc *crtc,
const char *name,
const u8 *a, const u8 *b, size_t len)
 {
-   struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
+   struct drm_i915_private *i915 = to_i915(crtc->base.dev);
+   struct drm_printer p;
+   const char *loglevel;
 
if (fastset) {
if (!drm_debug_enabled(DRM_UT_KMS))
return;
 
-   /* only dump up to the last difference */
-   len = memcmp_diff_len(a, b, len);
+   p = drm_dbg_printer(&i915->drm, DRM_UT_KMS, NULL);
+   loglevel = KERN_DEBUG;
 
-   drm_dbg_kms(&dev_priv->drm,
-   "[CRTC:%d:%s] fastset requirement not met in %s 
buffer\n",
-   crtc->base.base.id, crtc->base.name, name);
-   print_hex_dump(KERN_DEBUG, "expected: ", DUMP_PREFIX_NONE,
-  16, 0, a, len, false);
-   print_hex_dump(KERN_DEBUG, "found: ", DUMP_PREFIX_NONE,
-  16, 0, b, len, false);
+   drm_printf(&p, "[CRTC:%d:%s] fastset requirement not met in %s 
buffer\n",
+  crtc->base.base.id, crtc->base.name, name);
} else {
-   /* only dump up to the last difference */
-   len = memcmp_diff_len(a, b, len);
+   p = drm_err_printer(&i915->drm, NULL);
+   loglevel = KERN_ERR;
 
-   drm_err(&dev_priv->drm, "[CRTC:%d:%s] mismatch in %s buffer\n",
-   crtc->base.base.id, crtc->base.name, name);
-   print_hex_dump(KERN_ERR, "expected: ", DUMP_PREFIX_NONE,
-  16, 0, a, len, false);
-   print_hex_dump(KERN_ERR, "found: ", DUMP_PREFIX_NONE,
-  16, 0, b, len, false);
+   drm_printf(&p, "[CRTC:%d:%s] mismatch in %s buffer\n",
+  crtc->base.base.id, crtc->base.name, name);
}
+
+   /* only dump up to the last difference */
+   len = memcmp_diff_len(a, b, len);
+
+   print_hex_dump(loglevel, "expected: ", DUMP_PREFIX_NONE,
+  16, 0, a, len, false);
+   print_hex_dump(loglevel, "found: ", DUMP_PREFIX_NONE,
+  16, 0, b, len, false);
 }
 
 static void __printf(4, 5)
-- 
2.43.0



[PATCH 04/12] drm/i915: Convert pipe_config_infoframe_mismatch() to drm_printer

2024-02-15 Thread Ville Syrjala
From: Ville Syrjälä 

Utilize drm_printer in pipe_config_infoframe_mismatch() to avoid
a bit of code duplication.

hdmi_infoframe_log() can't use the printer of course, but for that
we can just figure out which loglevel to use. And we do need to keep
the explicit drm_debug_enabled(DRM_UT_KMS) since hdmi_infoframe_log()
won't do it for us.

Signed-off-by: Ville Syrjälä 
---
 drivers/gpu/drm/i915/display/intel_display.c | 32 +++-
 1 file changed, 18 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display.c 
b/drivers/gpu/drm/i915/display/intel_display.c
index 2aabfa154d8a..0292c49e0dad 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -4793,27 +4793,31 @@ pipe_config_infoframe_mismatch(bool fastset, const 
struct intel_crtc *crtc,
   const union hdmi_infoframe *a,
   const union hdmi_infoframe *b)
 {
-   struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
+   struct drm_i915_private *i915 = to_i915(crtc->base.dev);
+   struct drm_printer p;
+   const char *loglevel;
 
if (fastset) {
if (!drm_debug_enabled(DRM_UT_KMS))
return;
 
-   drm_dbg_kms(&dev_priv->drm,
-   "[CRTC:%d:%s] fastset requirement not met in %s 
infoframe\n",
-   crtc->base.base.id, crtc->base.name, name);
-   drm_dbg_kms(&dev_priv->drm, "expected:\n");
-   hdmi_infoframe_log(KERN_DEBUG, dev_priv->drm.dev, a);
-   drm_dbg_kms(&dev_priv->drm, "found:\n");
-   hdmi_infoframe_log(KERN_DEBUG, dev_priv->drm.dev, b);
+   p = drm_dbg_printer(&i915->drm, DRM_UT_KMS, NULL);
+   loglevel = KERN_DEBUG;
+
+   drm_printf(&p, "[CRTC:%d:%s] fastset requirement not met in %s 
infoframe\n",
+  crtc->base.base.id, crtc->base.name, name);
} else {
-   drm_err(&dev_priv->drm, "[CRTC:%d:%s] mismatch in %s 
infoframe\n",
-   crtc->base.base.id, crtc->base.name, name);
-   drm_err(&dev_priv->drm, "expected:\n");
-   hdmi_infoframe_log(KERN_ERR, dev_priv->drm.dev, a);
-   drm_err(&dev_priv->drm, "found:\n");
-   hdmi_infoframe_log(KERN_ERR, dev_priv->drm.dev, b);
+   p = drm_err_printer(&i915->drm, NULL);
+   loglevel = KERN_ERR;
+
+   drm_printf(&p, "[CRTC:%d:%s] mismatch in %s infoframe\n",
+  crtc->base.base.id, crtc->base.name, name);
}
+
+   drm_printf(&p, "expected:\n");
+   hdmi_infoframe_log(loglevel, i915->drm.dev, a);
+   drm_printf(&p, "found:\n");
+   hdmi_infoframe_log(loglevel, i915->drm.dev, b);
 }
 
 static void
-- 
2.43.0



[PATCH 03/12] drm/i915: Include CRTC info in VSC SDP mismatch prints

2024-02-15 Thread Ville Syrjala
From: Ville Syrjälä 

Most crtc state mismatches include the CRTC id+name in the
prints. Also include it in the VSC SDP mismatches.

Signed-off-by: Ville Syrjälä 
---
 drivers/gpu/drm/i915/display/intel_display.c | 13 -
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display.c 
b/drivers/gpu/drm/i915/display/intel_display.c
index e3520a3da468..2aabfa154d8a 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -4817,21 +4817,24 @@ pipe_config_infoframe_mismatch(bool fastset, const 
struct intel_crtc *crtc,
 }
 
 static void
-pipe_config_dp_vsc_sdp_mismatch(struct drm_i915_private *i915,
-   bool fastset, const char *name,
+pipe_config_dp_vsc_sdp_mismatch(bool fastset, const struct intel_crtc *crtc,
+   const char *name,
const struct drm_dp_vsc_sdp *a,
const struct drm_dp_vsc_sdp *b)
 {
+   struct drm_i915_private *i915 = to_i915(crtc->base.dev);
struct drm_printer p;
 
if (fastset) {
p = drm_dbg_printer(&i915->drm, DRM_UT_KMS, NULL);
 
-   drm_printf(&p, "fastset requirement not met in %s dp sdp\n", 
name);
+   drm_printf(&p, "[CRTC:%d:%s] fastset requirement not met in %s 
dp sdp\n",
+  crtc->base.base.id, crtc->base.name, name);
} else {
p = drm_err_printer(&i915->drm, NULL);
 
-   drm_printf(&p, "mismatch in %s dp sdp\n", name);
+   drm_printf(&p, "[CRTC:%d:%s] mismatch in %s dp sdp\n",
+  crtc->base.base.id, crtc->base.name, name);
}
 
drm_printf(&p, "expected:\n");
@@ -5086,7 +5089,7 @@ intel_pipe_config_compare(const struct intel_crtc_state 
*current_config,
 #define PIPE_CONF_CHECK_DP_VSC_SDP(name) do { \
if (!intel_compare_dp_vsc_sdp(¤t_config->infoframes.name, \
  &pipe_config->infoframes.name)) { \
-   pipe_config_dp_vsc_sdp_mismatch(dev_priv, fastset, 
__stringify(name), \
+   pipe_config_dp_vsc_sdp_mismatch(fastset, crtc, 
__stringify(name), \

¤t_config->infoframes.name, \
&pipe_config->infoframes.name); 
\
ret = false; \
-- 
2.43.0



[PATCH 01/12] drm/i915: Indicate which pipe failed the fastset check overall

2024-02-15 Thread Ville Syrjala
From: Ville Syrjälä 

intel_crtc_check_fastset() is done per-pipe, so it would be nice
to know which pipe it was that failed its checkup.

Signed-off-by: Ville Syrjälä 
---
 drivers/gpu/drm/i915/display/intel_display.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display.c 
b/drivers/gpu/drm/i915/display/intel_display.c
index 00ac65a14029..a7f487f5c2b2 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -5562,14 +5562,16 @@ static int intel_modeset_checks(struct 
intel_atomic_state *state)
 static void intel_crtc_check_fastset(const struct intel_crtc_state 
*old_crtc_state,
 struct intel_crtc_state *new_crtc_state)
 {
-   struct drm_i915_private *i915 = to_i915(old_crtc_state->uapi.crtc->dev);
+   struct intel_crtc *crtc = to_intel_crtc(new_crtc_state->uapi.crtc);
+   struct drm_i915_private *i915 = to_i915(crtc->base.dev);
 
/* only allow LRR when the timings stay within the VRR range */
if (old_crtc_state->vrr.in_range != new_crtc_state->vrr.in_range)
new_crtc_state->update_lrr = false;
 
if (!intel_pipe_config_compare(old_crtc_state, new_crtc_state, true))
-   drm_dbg_kms(&i915->drm, "fastset requirement not met, forcing 
full modeset\n");
+   drm_dbg_kms(&i915->drm, "[CRTC:%d:%s] fastset requirement not 
met, forcing full modeset\n",
+   crtc->base.base.id, crtc->base.name);
else
new_crtc_state->uapi.mode_changed = false;
 
-- 
2.43.0



[PATCH 02/12] drm/i915: Include CRTC info in infoframe mismatch prints

2024-02-15 Thread Ville Syrjala
From: Ville Syrjälä 

Most crtc state mismatches include the CRTC id+name in the
prints. Also include it in the infoframe mismatches.

Signed-off-by: Ville Syrjälä 
---
 drivers/gpu/drm/i915/display/intel_display.c | 14 +-
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display.c 
b/drivers/gpu/drm/i915/display/intel_display.c
index a7f487f5c2b2..e3520a3da468 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -4788,23 +4788,27 @@ intel_compare_buffer(const u8 *a, const u8 *b, size_t 
len)
 }
 
 static void
-pipe_config_infoframe_mismatch(struct drm_i915_private *dev_priv,
-  bool fastset, const char *name,
+pipe_config_infoframe_mismatch(bool fastset, const struct intel_crtc *crtc,
+  const char *name,
   const union hdmi_infoframe *a,
   const union hdmi_infoframe *b)
 {
+   struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
+
if (fastset) {
if (!drm_debug_enabled(DRM_UT_KMS))
return;
 
drm_dbg_kms(&dev_priv->drm,
-   "fastset requirement not met in %s infoframe\n", 
name);
+   "[CRTC:%d:%s] fastset requirement not met in %s 
infoframe\n",
+   crtc->base.base.id, crtc->base.name, name);
drm_dbg_kms(&dev_priv->drm, "expected:\n");
hdmi_infoframe_log(KERN_DEBUG, dev_priv->drm.dev, a);
drm_dbg_kms(&dev_priv->drm, "found:\n");
hdmi_infoframe_log(KERN_DEBUG, dev_priv->drm.dev, b);
} else {
-   drm_err(&dev_priv->drm, "mismatch in %s infoframe\n", name);
+   drm_err(&dev_priv->drm, "[CRTC:%d:%s] mismatch in %s 
infoframe\n",
+   crtc->base.base.id, crtc->base.name, name);
drm_err(&dev_priv->drm, "expected:\n");
hdmi_infoframe_log(KERN_ERR, dev_priv->drm.dev, a);
drm_err(&dev_priv->drm, "found:\n");
@@ -5072,7 +5076,7 @@ intel_pipe_config_compare(const struct intel_crtc_state 
*current_config,
 #define PIPE_CONF_CHECK_INFOFRAME(name) do { \
if (!intel_compare_infoframe(¤t_config->infoframes.name, \
 &pipe_config->infoframes.name)) { \
-   pipe_config_infoframe_mismatch(dev_priv, fastset, 
__stringify(name), \
+   pipe_config_infoframe_mismatch(fastset, crtc, 
__stringify(name), \
   
¤t_config->infoframes.name, \
   &pipe_config->infoframes.name); \
ret = false; \
-- 
2.43.0



[PATCH 00/12] drm/i915: Use drm_printer more

2024-02-15 Thread Ville Syrjala
From: Ville Syrjälä 

Convert the entire state dumper and state checker to
use drm_printer.

One can perhaps consider this as the first step towards
hooking into .atomic_print_state(). Unfortunately that
stuff is a full blown midlayer currently, so we'd first
have to demidlayer it to make it work for us. The other
annoying thing there is the format in which it currently
prints stuff. Whoever wrote that had some kind of allergy
towards whitespace, making the output not so great for
human consumption, which is the primary use case for us.

Ville Syrjälä (12):
  drm/i915: Indicate which pipe failed the fastset check overall
  drm/i915: Include CRTC info in infoframe mismatch prints
  drm/i915: Include CRTC info in VSC SDP mismatch prints
  drm/i915: Convert pipe_config_infoframe_mismatch() to drm_printer
  drm/i915: Convert pipe_config_buffer_mismatch() to drm_printer
  drm/i915: Convert intel_dpll_dump_hw_state() to drm_printer
  drm/i915: Use drm_printer more extensively in intel_crtc_state_dump()
  drm/i915: Convert the remaining state dump to drm_printer
  drm/i915: Skip intel_crtc_state_dump() if debugs aren't enabled
  drm/i915: Relocate pipe_config_mismatch()
  drm/i915: Reuse pipe_config_mismatch() more
  drm/i915: Create the printer only once in intel_pipe_config_compare()

 .../drm/i915/display/intel_crtc_state_dump.c  | 330 --
 drivers/gpu/drm/i915/display/intel_display.c  | 189 +-
 drivers/gpu/drm/i915/display/intel_dpll_mgr.c | 105 +++---
 drivers/gpu/drm/i915/display/intel_dpll_mgr.h |   2 +
 4 files changed, 288 insertions(+), 338 deletions(-)

-- 
2.43.0



Re: [RFC 0/5] Introduce drm sharpening property

2024-02-15 Thread Harry Wentland
Adding a couple of compositor devs as they might be interested in this.

On 2024-02-14 06:24, Nemesa Garg wrote:
>   Many a times images are blurred or upscaled content is also not as
> crisp as original rendered image. Traditional sharpening techniques often
> apply a uniform level of enhancement across entire image, which sometimes
> result in over-sharpening of some areas and potential loss of natural 
> details. 
> 
> Intel has come up with Display Engine based adaptive sharpening filter 
> with minimal power and performance impact. From LNL onwards, the Display
> hardware can use one of the pipe scaler for adaptive sharpness filter.
> This can be used for both gaming and non-gaming use cases like photos,
> image viewing. It works on a region of pixels depending on the tap size.
> 
> This RFC is an attempt to introduce an adaptive sharpness solution which
> helps in improving the image quality. For this new CRTC property is added.

I don't think CRTC is the right place for this. Scaling tends to be more
of a plane thing. Planes can be scaled independently, or is that not the
case for Intel? Or does Intel HW do this sharpening operation independent
of any scaling, on the entire output?

> The user can set this property with desired sharpness strength value with
> 0-255. A value of 1 representing minimum sharpening strength and 255
> representing maximum sharpness strength. A strength value of 0 means no
> sharpening or sharpening feature disabled.
> It works on a region of pixels depending on the tap size. The coefficients
> are used to generate an alpha value which is used to blend the sharpened
> image to original image.
>  
> Userspace implementation for sharpening feature and IGT implementation
> is in progress.

It would be very helpful to have an idea how this looks in userspace, and
which compositors will implement this.

Harry

> 
> Nemesa Garg (5):
>   drm: Introduce sharpeness mode property
>   drm/i915/display/: Compute the scaler filter coefficients
>   drm/i915/dispaly/: Enable the second scaler
>   drm/i915/display/: Add registers and compute the strength
>   drm/i915/display: Load the lut values and enable sharpness
> 
>  drivers/gpu/drm/drm_atomic_uapi.c |   4 +
>  drivers/gpu/drm/drm_crtc.c|  17 ++
>  drivers/gpu/drm/i915/Makefile |   1 +
>  drivers/gpu/drm/i915/display/intel_crtc.c |   3 +
>  drivers/gpu/drm/i915/display/intel_display.c  |  20 +-
>  .../drm/i915/display/intel_display_types.h|  11 +
>  .../drm/i915/display/intel_modeset_verify.c   |   1 +
>  .../drm/i915/display/intel_sharpen_filter.c   | 214 ++
>  .../drm/i915/display/intel_sharpen_filter.h   |  31 +++
>  drivers/gpu/drm/i915/display/skl_scaler.c |  86 ++-
>  drivers/gpu/drm/i915/display/skl_scaler.h |   1 +
>  drivers/gpu/drm/i915/i915_reg.h   |  19 ++
>  drivers/gpu/drm/xe/Makefile   |   1 +
>  include/drm/drm_crtc.h|  17 ++
>  14 files changed, 416 insertions(+), 10 deletions(-)
>  create mode 100644 drivers/gpu/drm/i915/display/intel_sharpen_filter.c
>  create mode 100644 drivers/gpu/drm/i915/display/intel_sharpen_filter.h
> 



Re: Re: [PULL] drm-misc-fixes

2024-02-15 Thread Maxime Ripard
Hi,

On Thu, Feb 15, 2024 at 01:41:24PM +0100, Geert Uytterhoeven wrote:
>   Hi Maxime,
> 
> On Thu, 15 Feb 2024, Maxime Ripard wrote:
> > Here's this week drm-misc-fixes PR
> > 
> > Maxime
> > 
> > drm-misc-fixes-2024-02-15:
> > A suspend/resume error fix for ivpu, a couple of scheduler fixes for
> > nouveau, a patch to support large page arrays in prime, a uninitialized
> > variable fix in crtc, a locking fix in rockchip/vop2 and a buddy
> > allocator error reporting fix.
> > The following changes since commit 5f8408aca66772d3aa9b4831577b2ac5ec41bcd9:
> > 
> >  accel/ivpu: Add job status for jobs aborted by the driver (2024-02-06 
> > 13:37:34 +0100)
> > 
> > are available in the Git repository at:
> > 
> >  git://anongit.freedesktop.org/drm/drm-misc tags/drm-misc-fixes-2024-02-15
> > 
> > for you to fetch changes up to a64056bb5a3215bd31c8ce17d609ba0f4d5c55ea:
> > 
> >  drm/tests/drm_buddy: add alloc_contiguous test (2024-02-14 15:22:21 +0100)
> > 
> > 
> > A suspend/resume error fix for ivpu, a couple of scheduler fixes for
> > nouveau, a patch to support large page arrays in prime, a uninitialized
> > variable fix in crtc, a locking fix in rockchip/vop2 and a buddy
> > allocator error reporting fix.
> 
> > Matthew Auld (1):
> >  drm/tests/drm_buddy: add alloc_contiguous test
> 
> Please drop this one.
> 
> nore...@ellerman.id.au reported a build failure on m68k (and presumably
> other 32-bit platforms) in next-20240215:
> 
> ERROR: modpost: "__umoddi3" [drivers/gpu/drm/tests/drm_buddy_test.ko] 
> undefined!
> ERROR: modpost: "__moddi3" [drivers/gpu/drm/tests/drm_buddy_test.ko] 
> undefined!
> 
> Reverting commit a64056bb5a3215bd ("drm/tests/drm_buddy: add
> alloc_contiguous test") fixes the issue.

From a quick cross-compile test with arm(32), it seems to work there
interestingly:

./tools/testing/kunit/kunit.py run \
--kunitconfig=drivers/gpu/drm//tests \
--cross_compile arm-linux-gnu- --arch arm

But I agree, with should wait for a fix or a revert before merging this.

Maxime


signature.asc
Description: PGP signature


2024 X.Org Board of Directors Elections Nomination period is NOW

2024-02-15 Thread Christopher Michael
We are seeking nominations for candidates for election to the X.Org 
Foundation Board of Directors. All X.Org Foundation members are eligible 
for election to the board.


Nominations for the 2024 election are now open and will remain open 
until 23:59 UTC on 26 February 2024.


The Board consists of directors elected from the membership. Each year, 
an election is held to bring the total number of directors to eight. The 
four members receiving the highest vote totals will serve as directors 
for two year terms.


The directors who received two year terms starting in 2023 were 
Arkadiusz Hiler, Christopher Michael, Lyude Paul, and Daniel Vetter. 
They will continue to serve until their term ends in 2024. Current 
directors whose term expires in 2024 are Emma Anholt, Mark Filion, 
Ricardo Garcia, and Alyssa Rosenzweig.



A director is expected to participate in the fortnightly IRC meeting to 
discuss current business and to attend the annual meeting of the X.Org 
Foundation, which will be held at a location determined in advance by 
the Board of Directors.


A member may nominate themselves or any other member they feel is 
qualified. Nominations should be sent to the Election Committee at 
electi...@x.org.


Nominees shall be required to be current members of the X.Org 
Foundation, and submit a personal statement of up to 200 words that will 
be provided to prospective voters. The collected statements, along with 
the statement of contribution to the X.Org Foundation in the member's 
account page on http://members.x.org, will be made available to all 
voters to help them make their voting decisions.


Nominations, membership applications or renewals and completed personal 
statements must be received no later than 23:59 UTC on 26 February 2024.


The slate of candidates will be published 04 March 2024 and candidate 
Q&A will begin then. The deadline for Xorg membership applications and 
renewals is 07 March 2024.



Cheers,

Christopher Michael, on behalf of the X.Org BoD



Re: [PATCH 2/6] drm/i915/psr: Calculate aux less wake time

2024-02-15 Thread Ville Syrjälä
On Thu, Feb 15, 2024 at 12:49:30PM +0200, Jouni Högander wrote:
> Calculate aux less wake time and store it into alpm_params struct
> 
> Bspec: 71477
> 
> Signed-off-by: Jouni Högander 
> ---
>  .../drm/i915/display/intel_display_types.h|  1 +
>  drivers/gpu/drm/i915/display/intel_psr.c  | 53 +++
>  2 files changed, 54 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h 
> b/drivers/gpu/drm/i915/display/intel_display_types.h
> index 0d4012097db1..a531c1e5af20 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_types.h
> +++ b/drivers/gpu/drm/i915/display/intel_display_types.h
> @@ -1721,6 +1721,7 @@ struct intel_psr {
>  
>   /* LNL and beyond */
>   u8 check_entry_lines;
> + u8 aux_less_wake_lines;
>   } alpm_parameters;
>  
>   ktime_t last_entry_attempt;
> diff --git a/drivers/gpu/drm/i915/display/intel_psr.c 
> b/drivers/gpu/drm/i915/display/intel_psr.c
> index 72cadad09db5..b139db67df55 100644
> --- a/drivers/gpu/drm/i915/display/intel_psr.c
> +++ b/drivers/gpu/drm/i915/display/intel_psr.c
> @@ -1126,6 +1126,56 @@ static bool 
> _compute_psr2_sdp_prior_scanline_indication(struct intel_dp *intel_d
>   return true;
>  }
>  
> +/*
> + * AUX-Less Wake Time = CEILING( ((PHY P2 to P0) + tLFPS_Period, Max+
> + * tSilence, Max+ tPHY Establishment + tCDS) / tline)
> + * For the "PHY P2 to P0" latency see the PHY Power Control page
> + * (PHY P2 to P0) : https://gfxspecs.intel.com/Predator/Home/Index/68965
> + * : 12 us
> + * The tLFPS_Period, Max term is 800ns
> + * The tSilence, Max term is 180ns
> + * The tPHY Establishment (a.k.a. t1) term is 50us
> + * The tCDS term is 1 or 2 times t2
> + * t2 = Number ML_PHY_LOCK * tML_PHY_LOCK
> + * Number ML_PHY_LOCK = ( 7 + CEILING( 6.5us / tML_PHY_LOCK ) + 1)
> + * Rounding up the 6.5us padding to the next ML_PHY_LOCK boundary and
> + * adding the "+ 1" term ensures all ML_PHY_LOCK sequences that start
> + * within the CDS period complete within the CDS period regardless of
> + * entry into the period
> + * tML_PHY_LOCK = TPS4 Length * ( 10 / (Link Rate in MHz) )
> + * TPS4 Length = 252 Symbols
> + */
> +static int _lnl_compute_aux_less_wake_time(int port_clock)
> +{
> + int tml_phy_lock = 1000 * 252 * (10 / port_clock);
> + int num_ml_phy_lock = 7 + DIV_ROUND_UP(6500, tml_phy_lock) + 1;
> +
> + return DIV_ROUND_UP(12 * 1000 + 800 + 180 + 50 * 1000 +

Would be much clearer to have a properly named variable for each magic
number. I don't really want to have to read the comment to understand
what the code is calculating.

> + num_ml_phy_lock * tml_phy_lock, 1000);
> +}
> +
> +static int _lnl_compute_aux_less_alpm_params(struct intel_dp *intel_dp,
> +  struct intel_crtc_state 
> *crtc_state)
> +{
> + struct drm_i915_private *i915 = dp_to_i915(intel_dp);
> + int aux_less_wake_time, aux_less_wake_lines;
> +
> + aux_less_wake_time =
> + _lnl_compute_aux_less_wake_time(crtc_state->port_clock / 1000);
> + aux_less_wake_lines = 
> intel_usecs_to_scanlines(&crtc_state->hw.adjusted_mode,
> +aux_less_wake_time);
> +
> + if (aux_less_wake_lines > 32)
> + return false;
> +
> + if (i915->display.params.psr_safest_params)
> + aux_less_wake_lines = 32;
> +
> + intel_dp->psr.alpm_parameters.aux_less_wake_lines = aux_less_wake_lines;
> +
> + return true;
> +}
> +
>  static bool _lnl_compute_alpm_params(struct intel_dp *intel_dp,
>struct intel_crtc_state *crtc_state)
>  {
> @@ -1142,6 +1192,9 @@ static bool _lnl_compute_alpm_params(struct intel_dp 
> *intel_dp,
>   if (check_entry_lines > 15)
>   return false;
>  
> + if (!_lnl_compute_aux_less_alpm_params(intel_dp, crtc_state))
> + return false;
> +
>   if (i915->display.params.psr_safest_params)
>   check_entry_lines = 15;
>  
> -- 
> 2.34.1

-- 
Ville Syrjälä
Intel


Re: [PATCH v2 2/6] drm/i915/mst: improve debug logging of DP MST mode detect

2024-02-15 Thread Ville Syrjälä
On Thu, Feb 15, 2024 at 01:46:48PM +0200, Jani Nikula wrote:
> On Wed, 14 Feb 2024, Ville Syrjälä  wrote:
> > On Tue, Feb 13, 2024 at 01:30:57PM +0200, Jani Nikula wrote:
> >> Rename intel_dp_can_mst() to intel_dp_mst_detect(), and move all DP MST
> >> detect debug logging there. Debug log the sink's MST capability,
> >> including single-stream sideband messaging support, and the decision
> >> whether to enable MST mode or not. Do this regardless of whether we're
> >> actually enabling MST or not.
> >> 
> >> Cc: Arun R Murthy 
> >> Cc: Ville Syrjälä 
> >> Signed-off-by: Jani Nikula 
> >> ---
> >>  drivers/gpu/drm/i915/display/intel_dp.c | 45 +
> >>  1 file changed, 31 insertions(+), 14 deletions(-)
> >> 
> >> diff --git a/drivers/gpu/drm/i915/display/intel_dp.c 
> >> b/drivers/gpu/drm/i915/display/intel_dp.c
> >> index a1c304f451bd..944f566525dd 100644
> >> --- a/drivers/gpu/drm/i915/display/intel_dp.c
> >> +++ b/drivers/gpu/drm/i915/display/intel_dp.c
> >> @@ -4007,31 +4007,48 @@ intel_dp_get_dpcd(struct intel_dp *intel_dp)
> >>   intel_dp->downstream_ports) == 0;
> >>  }
> >>  
> >> +static const char *intel_dp_mst_mode_str(enum drm_dp_mst_mode mst_mode)
> >> +{
> >> +  if (mst_mode == DRM_DP_SST_SIDEBAND_MSG)
> >> +  return "single-stream sideband messaging";
> >> +  else
> >> +  return str_yes_no(mst_mode == DRM_DP_MST);
> >
> > I wonder if this should also just say "sst"/"mst"/"sst sideband" etc.
> > Shrug.
> >
> > Reviewed-by: Ville Syrjälä 
> 
> I realize there's an issue here.
> 
> intel_dp_detect_dpcd() bails out early for !drm_dp_is_branch(), before
> the intel_dp_can_mst() call. (Renamed intel_dp_mst_detect() here.)
> 
> We'll still happily call intel_dp_configure_mst() later also for
> !branch.
> 
> We'll need to call intel_dp_mst_detect() earlier and/or somehow combine
> these together. I don't think branch devices need to support MST, but I
> think MST devices need to support branching. And single-stream sideband
> support does not mean branching.
> 
> The intention of this patch was to improve MST debug logging, but the
> end result is that it reduces it! Auch.
> 
> I wonder if we should branch (eh) the detect earlier for eDP, SST and
> MST/branch paths. Just to make it easier for our poor brains to follow.

Hmm. The sink count check is another case as well. If the device
has a local sink, or somehting connected to its DFP(s) it should
declare sink count >= 1.

-- 
Ville Syrjälä
Intel


✗ Fi.CI.BAT: failure for Disable automatic load CCS load balancing

2024-02-15 Thread Patchwork
== Series Details ==

Series: Disable automatic load CCS load balancing
URL   : https://patchwork.freedesktop.org/series/129951/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_14278 -> Patchwork_129951v1


Summary
---

  **FAILURE**

  Serious unknown changes coming with Patchwork_129951v1 absolutely need to be
  verified manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in Patchwork_129951v1, please notify your bug team 
(i915-ci-in...@lists.freedesktop.org) to allow them
  to document this new failure mode, which will reduce false positives in CI.

  External URL: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129951v1/index.html

Participating hosts (36 -> 35)
--

  Additional (1): bat-mtlp-8 
  Missing(2): bat-kbl-2 fi-snb-2520m 

Possible new issues
---

  Here are the unknown changes that may have been introduced in 
Patchwork_129951v1:

### IGT changes ###

 Possible regressions 

  * igt@i915_module_load@load:
- fi-skl-6600u:   [PASS][1] -> [ABORT][2]
   [1]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_14278/fi-skl-6600u/igt@i915_module_l...@load.html
   [2]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129951v1/fi-skl-6600u/igt@i915_module_l...@load.html
- fi-glk-j4005:   [PASS][3] -> [ABORT][4]
   [3]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_14278/fi-glk-j4005/igt@i915_module_l...@load.html
   [4]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129951v1/fi-glk-j4005/igt@i915_module_l...@load.html
- fi-skl-guc: [PASS][5] -> [ABORT][6]
   [5]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_14278/fi-skl-guc/igt@i915_module_l...@load.html
   [6]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129951v1/fi-skl-guc/igt@i915_module_l...@load.html
- fi-kbl-7567u:   [PASS][7] -> [ABORT][8]
   [7]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_14278/fi-kbl-7567u/igt@i915_module_l...@load.html
   [8]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129951v1/fi-kbl-7567u/igt@i915_module_l...@load.html
- fi-cfl-8700k:   [PASS][9] -> [ABORT][10]
   [9]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_14278/fi-cfl-8700k/igt@i915_module_l...@load.html
   [10]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129951v1/fi-cfl-8700k/igt@i915_module_l...@load.html
- fi-bsw-nick:[PASS][11] -> [ABORT][12]
   [11]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_14278/fi-bsw-nick/igt@i915_module_l...@load.html
   [12]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129951v1/fi-bsw-nick/igt@i915_module_l...@load.html
- fi-cfl-guc: [PASS][13] -> [ABORT][14]
   [13]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_14278/fi-cfl-guc/igt@i915_module_l...@load.html
   [14]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129951v1/fi-cfl-guc/igt@i915_module_l...@load.html
- fi-kbl-x1275:   [PASS][15] -> [ABORT][16]
   [15]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_14278/fi-kbl-x1275/igt@i915_module_l...@load.html
   [16]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129951v1/fi-kbl-x1275/igt@i915_module_l...@load.html
- fi-cfl-8109u:   [PASS][17] -> [ABORT][18]
   [17]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_14278/fi-cfl-8109u/igt@i915_module_l...@load.html
   [18]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129951v1/fi-cfl-8109u/igt@i915_module_l...@load.html
- fi-ivb-3770:[PASS][19] -> [ABORT][20]
   [19]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_14278/fi-ivb-3770/igt@i915_module_l...@load.html
   [20]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129951v1/fi-ivb-3770/igt@i915_module_l...@load.html
- fi-kbl-guc: [PASS][21] -> [ABORT][22]
   [21]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_14278/fi-kbl-guc/igt@i915_module_l...@load.html
   [22]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129951v1/fi-kbl-guc/igt@i915_module_l...@load.html

  * igt@i915_selftest@live@client:
- fi-elk-e7500:   [PASS][23] -> [DMESG-WARN][24] +42 other tests 
dmesg-warn
   [23]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_14278/fi-elk-e7500/igt@i915_selftest@l...@client.html
   [24]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129951v1/fi-elk-e7500/igt@i915_selftest@l...@client.html

  * igt@i915_selftest@live@coherency:
- bat-jsl-3:  [PASS][25] -> [DMESG-WARN][26] +41 other tests 
dmesg-warn
   [25]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_14278/bat-jsl-3/igt@i915_selftest@l...@coherency.html
   [26]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129951v1/bat-jsl-3/igt@i915_selftest@l...@coherency.html

  * igt@i915_selftest@live@gt_contexts:
- fi-ilk-650: [PASS][27] -> [DMESG-WARN][28] +42 other tests 
dmesg-warn
   [27]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_14278/fi-ilk-65

✗ Fi.CI.SPARSE: warning for Disable automatic load CCS load balancing

2024-02-15 Thread Patchwork
== Series Details ==

Series: Disable automatic load CCS load balancing
URL   : https://patchwork.freedesktop.org/series/129951/
State : warning

== Summary ==

Error: dim sparse failed
Sparse version: v0.6.2
Fast mode used, each commit won't be checked separately.




✗ Fi.CI.CHECKPATCH: warning for Disable automatic load CCS load balancing

2024-02-15 Thread Patchwork
== Series Details ==

Series: Disable automatic load CCS load balancing
URL   : https://patchwork.freedesktop.org/series/129951/
State : warning

== Summary ==

Error: dim checkpatch failed
36e5f8a455e7 drm/i915/gt: Disable HW load balancing for CCS
f1bfa29b3219 drm/i915/gt: Set default CCS mode '1'
-:80: ERROR:COMPLEX_MACRO: Macros with complex values should be enclosed in 
parentheses
#80: FILE: drivers/gpu/drm/i915/i915_drv.h:409:
+#define for_each_available_uabi_engine(engine__, i915__) \
+   for_each_uabi_engine(engine__, i915__) \
+   if ((IS_DG2(i915__)) && \
+   ((engine__)->uabi_class == I915_ENGINE_CLASS_COMPUTE) && \
+   ((engine__)->uabi_instance)) { } \
+   else

-:80: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'engine__' - possible 
side-effects?
#80: FILE: drivers/gpu/drm/i915/i915_drv.h:409:
+#define for_each_available_uabi_engine(engine__, i915__) \
+   for_each_uabi_engine(engine__, i915__) \
+   if ((IS_DG2(i915__)) && \
+   ((engine__)->uabi_class == I915_ENGINE_CLASS_COMPUTE) && \
+   ((engine__)->uabi_instance)) { } \
+   else

-:80: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'i915__' - possible 
side-effects?
#80: FILE: drivers/gpu/drm/i915/i915_drv.h:409:
+#define for_each_available_uabi_engine(engine__, i915__) \
+   for_each_uabi_engine(engine__, i915__) \
+   if ((IS_DG2(i915__)) && \
+   ((engine__)->uabi_class == I915_ENGINE_CLASS_COMPUTE) && \
+   ((engine__)->uabi_instance)) { } \
+   else

-:82: ERROR:TRAILING_STATEMENTS: trailing statements should be on next line
#82: FILE: drivers/gpu/drm/i915/i915_drv.h:411:
+   if ((IS_DG2(i915__)) && \
[...]
+   ((engine__)->uabi_instance)) { } \

-:98: CHECK:LINE_SPACING: Please don't use multiple blank lines
#98: FILE: drivers/gpu/drm/i915/i915_query.c:127:
 
+

total: 2 errors, 0 warnings, 3 checks, 77 lines checked




Re: [PATCH 0/6 V4] fdinfo shared stats

2024-02-15 Thread Alex Deucher
On Thu, Feb 15, 2024 at 9:18 AM Christian König
 wrote:
>
> Am 12.02.24 um 22:04 schrieb Alex Deucher:
> > We had a request to add shared buffer stats to fdinfo for amdgpu and
> > while implementing that, Christian mentioned that just looking at
> > the GEM handle count doesn't take into account buffers shared with other
> > subsystems like V4L or RDMA.  Those subsystems don't use GEM, so it
> > doesn't really matter from a GPU top perspective, but it's more
> > correct if you actually want to see shared buffers.
> >
> > After further discussions, add a helper and update all fdinfo
> > implementations to use that helper for consistency.
> >
> > v4: switch drm_gem_object_is_shared_for_memory_stats() to an inline function
>
> I'm still not sure if looking at the actual handle count is the right
> approach, but it's certainly better than before.

Well, it's consistent across drivers.

>
> So Reviewed-by: Christian König  for the
> entire series.
>
> Should I take this through drm-misc-next?

Yes, please.

Thanks,

Alex

>
> Regards,
> Christian.
>
> >
> > Alex Deucher (6):
> >Documentation/gpu: Update documentation on drm-shared-*
> >drm: add drm_gem_object_is_shared_for_memory_stats() helper
> >drm: update drm_show_memory_stats() for dma-bufs
> >drm/amdgpu: add shared fdinfo stats
> >drm/i915: Update shared stats to use the new gem helper
> >drm/xe: Update shared stats to use the new gem helper
> >
> >   Documentation/gpu/drm-usage-stats.rst  |  2 +-
> >   drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c |  4 
> >   drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 11 +++
> >   drivers/gpu/drm/amd/amdgpu/amdgpu_object.h |  6 ++
> >   drivers/gpu/drm/drm_file.c |  2 +-
> >   drivers/gpu/drm/i915/i915_drm_client.c |  2 +-
> >   drivers/gpu/drm/xe/xe_drm_client.c |  2 +-
> >   include/drm/drm_gem.h  | 13 +
> >   8 files changed, 38 insertions(+), 4 deletions(-)
> >
>


Re: [PATCH v6 3/5] drm: Add support to get EDID from ACPI

2024-02-15 Thread Jani Nikula
On Thu, 15 Feb 2024, Ville Syrjälä  wrote:
> On Wed, Feb 14, 2024 at 03:57:54PM -0600, Mario Limonciello wrote:
>> +static int
>> +drm_do_probe_acpi_edid(void *data, u8 *buf, unsigned int block, size_t len)
>> +{
>> +struct drm_connector *connector = data;
>> +struct drm_device *ddev = connector->dev;
>> +struct acpi_device *acpidev = ACPI_COMPANION(ddev->dev);
>> +unsigned char start = block * EDID_LENGTH;
>> +void *edid;
>> +int r;
>> +
>> +if (!acpidev)
>> +return -ENODEV;
>> +
>> +switch (connector->connector_type) {
>> +case DRM_MODE_CONNECTOR_LVDS:
>> +case DRM_MODE_CONNECTOR_eDP:
>> +break;
>> +default:
>> +return -EINVAL;
>> +}
>
> We could have other types of connectors that want this too.
> I don't see any real benefit in having this check tbh. Drivers
> should simply notset the flag on connectors where it won't work,
> and only the driver can really know that.

Agreed.

>>  const struct drm_edid *drm_edid_read(struct drm_connector *connector)
>>  {
>> +const struct drm_edid *drm_edid = NULL;
>> +
>>  if (drm_WARN_ON(connector->dev, !connector->ddc))
>>  return NULL;
>>  
>> -return drm_edid_read_ddc(connector, connector->ddc);
>> +if (connector->acpi_edid_allowed)
>
> That should probably be called 'prefer_acpi_edid' or something
> since it's the first choice when the flag is set.
>
> But I'm not so sure there's any real benefit in having this
> flag at all. You anyway have to modify the driver to use this,
> so why not just have the driver do the call directly instead of
> adding this extra detour via the flag?

Heh, round and round we go [1].


BR,
Jani.

[1] https://lore.kernel.org/r/87sf23auxv@intel.com


-- 
Jani Nikula, Intel


Re: [PATCH 0/6 V4] fdinfo shared stats

2024-02-15 Thread Christian König

Am 12.02.24 um 22:04 schrieb Alex Deucher:

We had a request to add shared buffer stats to fdinfo for amdgpu and
while implementing that, Christian mentioned that just looking at
the GEM handle count doesn't take into account buffers shared with other
subsystems like V4L or RDMA.  Those subsystems don't use GEM, so it
doesn't really matter from a GPU top perspective, but it's more
correct if you actually want to see shared buffers.

After further discussions, add a helper and update all fdinfo
implementations to use that helper for consistency.

v4: switch drm_gem_object_is_shared_for_memory_stats() to an inline function


I'm still not sure if looking at the actual handle count is the right 
approach, but it's certainly better than before.


So Reviewed-by: Christian König  for the 
entire series.


Should I take this through drm-misc-next?

Regards,
Christian.



Alex Deucher (6):
   Documentation/gpu: Update documentation on drm-shared-*
   drm: add drm_gem_object_is_shared_for_memory_stats() helper
   drm: update drm_show_memory_stats() for dma-bufs
   drm/amdgpu: add shared fdinfo stats
   drm/i915: Update shared stats to use the new gem helper
   drm/xe: Update shared stats to use the new gem helper

  Documentation/gpu/drm-usage-stats.rst  |  2 +-
  drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c |  4 
  drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 11 +++
  drivers/gpu/drm/amd/amdgpu/amdgpu_object.h |  6 ++
  drivers/gpu/drm/drm_file.c |  2 +-
  drivers/gpu/drm/i915/i915_drm_client.c |  2 +-
  drivers/gpu/drm/xe/xe_drm_client.c |  2 +-
  include/drm/drm_gem.h  | 13 +
  8 files changed, 38 insertions(+), 4 deletions(-)





Re: [PATCH v6 3/5] drm: Add support to get EDID from ACPI

2024-02-15 Thread Jani Nikula
On Wed, 14 Feb 2024, Mario Limonciello  wrote:
> Some manufacturers have intentionally put an EDID that differs from
> the EDID on the internal panel on laptops.  Drivers that prefer to
> fetch this EDID can set a bit on the drm_connector to indicate that
> the DRM EDID helpers should try to fetch it and it is preferred if
> it's present.

I just replied to a previous version of the patch [1]. Looks like all
the comments there still hold.

BR,
Jani.


[1] https://lore.kernel.org/r/87eddd6d41@intel.com


>
> Signed-off-by: Mario Limonciello 
> ---
>  drivers/gpu/drm/Kconfig |   1 +
>  drivers/gpu/drm/drm_edid.c  | 109 +---
>  include/drm/drm_connector.h |   6 ++
>  include/drm/drm_edid.h  |   1 +
>  4 files changed, 109 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
> index 872edb47bb53..3db89e6af01d 100644
> --- a/drivers/gpu/drm/Kconfig
> +++ b/drivers/gpu/drm/Kconfig
> @@ -8,6 +8,7 @@
>  menuconfig DRM
>   tristate "Direct Rendering Manager (XFree86 4.1.0 and higher DRI 
> support)"
>   depends on (AGP || AGP=n) && !EMULATED_CMPXCHG && HAS_DMA
> + depends on (ACPI_VIDEO || ACPI_VIDEO=n)
>   select DRM_PANEL_ORIENTATION_QUIRKS
>   select DRM_KMS_HELPER if DRM_FBDEV_EMULATION
>   select FB_CORE if DRM_FBDEV_EMULATION
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index 923c4423151c..cdc30c6d05d5 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -28,6 +28,7 @@
>   * DEALINGS IN THE SOFTWARE.
>   */
>  
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -2188,6 +2189,58 @@ drm_do_probe_ddc_edid(void *data, u8 *buf, unsigned 
> int block, size_t len)
>   return ret == xfers ? 0 : -1;
>  }
>  
> +/**
> + * drm_do_probe_acpi_edid() - get EDID information via ACPI _DDC
> + * @data: struct drm_connector
> + * @buf: EDID data buffer to be filled
> + * @block: 128 byte EDID block to start fetching from
> + * @len: EDID data buffer length to fetch
> + *
> + * Try to fetch EDID information by calling acpi_video_get_edid() function.
> + *
> + * Return: 0 on success or error code on failure.
> + */
> +static int
> +drm_do_probe_acpi_edid(void *data, u8 *buf, unsigned int block, size_t len)
> +{
> + struct drm_connector *connector = data;
> + struct drm_device *ddev = connector->dev;
> + struct acpi_device *acpidev = ACPI_COMPANION(ddev->dev);
> + unsigned char start = block * EDID_LENGTH;
> + void *edid;
> + int r;
> +
> + if (!acpidev)
> + return -ENODEV;
> +
> + switch (connector->connector_type) {
> + case DRM_MODE_CONNECTOR_LVDS:
> + case DRM_MODE_CONNECTOR_eDP:
> + break;
> + default:
> + return -EINVAL;
> + }
> +
> + /* fetch the entire edid from BIOS */
> + r = acpi_video_get_edid(acpidev, ACPI_VIDEO_DISPLAY_LCD, -1, &edid);
> + if (r < 0) {
> + DRM_DEBUG_KMS("Failed to get EDID from ACPI: %d\n", r);
> + return r;
> + }
> + if (len > r || start > r || start + len > r) {
> + r = -EINVAL;
> + goto cleanup;
> + }
> +
> + memcpy(buf, edid + start, len);
> + r = 0;
> +
> +cleanup:
> + kfree(edid);
> +
> + return r;
> +}
> +
>  static void connector_bad_edid(struct drm_connector *connector,
>  const struct edid *edid, int num_blocks)
>  {
> @@ -2621,7 +2674,8 @@ EXPORT_SYMBOL(drm_probe_ddc);
>   * @connector: connector we're probing
>   * @adapter: I2C adapter to use for DDC
>   *
> - * Poke the given I2C channel to grab EDID data if possible.  If found,
> + * If the connector allows it, try to fetch EDID data using ACPI. If not 
> found
> + * poke the given I2C channel to grab EDID data if possible.  If found,
>   * attach it to the connector.
>   *
>   * Return: Pointer to valid EDID or NULL if we couldn't find any.
> @@ -2629,20 +2683,50 @@ EXPORT_SYMBOL(drm_probe_ddc);
>  struct edid *drm_get_edid(struct drm_connector *connector,
> struct i2c_adapter *adapter)
>  {
> - struct edid *edid;
> + struct edid *edid = NULL;
>  
>   if (connector->force == DRM_FORCE_OFF)
>   return NULL;
>  
> - if (connector->force == DRM_FORCE_UNSPECIFIED && 
> !drm_probe_ddc(adapter))
> - return NULL;
> + if (connector->acpi_edid_allowed)
> + edid = _drm_do_get_edid(connector, drm_do_probe_acpi_edid, 
> connector, NULL);
> +
> + if (!edid) {
> + if (connector->force == DRM_FORCE_UNSPECIFIED && 
> !drm_probe_ddc(adapter))
> + return NULL;
> + edid = _drm_do_get_edid(connector, drm_do_probe_ddc_edid, 
> adapter, NULL);
> + }
>  
> - edid = _drm_do_get_edid(connector, drm_do_probe_ddc_edid, adapter, 
> NULL);
>   drm_connector_update_edid_property(connector, edid);
>   return edid;
>  }
>  EXPORT_SYMBOL(drm_get_edid);

[PATCH 2/2] drm/i915/gt: Set default CCS mode '1'

2024-02-15 Thread Andi Shyti
Since CCS automatic load balancing is disabled, we will impose a
fixed balancing policy that involves setting all the CCS engines
to work together on the same load.

Simultaneously, the user will see only 1 CCS rather than the
actual number. As of now, this change affects only DG2.

Fixes: d2eae8e98d59 ("drm/i915/dg2: Drop force_probe requirement")
Signed-off-by: Andi Shyti 
Cc: Chris Wilson 
Cc: Joonas Lahtinen 
Cc: Matt Roper 
Cc:  # v6.2+
---
 drivers/gpu/drm/i915/gt/intel_gt.c  | 11 +++
 drivers/gpu/drm/i915/gt/intel_gt_regs.h |  2 ++
 drivers/gpu/drm/i915/i915_drv.h | 17 +
 drivers/gpu/drm/i915/i915_query.c   |  5 +++--
 4 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_gt.c 
b/drivers/gpu/drm/i915/gt/intel_gt.c
index a425db5ed3a2..e19df4ef47f6 100644
--- a/drivers/gpu/drm/i915/gt/intel_gt.c
+++ b/drivers/gpu/drm/i915/gt/intel_gt.c
@@ -168,6 +168,14 @@ static void init_unused_rings(struct intel_gt *gt)
}
 }
 
+static void intel_gt_apply_ccs_mode(struct intel_gt *gt)
+{
+   if (!IS_DG2(gt->i915))
+   return;
+
+   intel_uncore_write(gt->uncore, XEHP_CCS_MODE, 0);
+}
+
 int intel_gt_init_hw(struct intel_gt *gt)
 {
struct drm_i915_private *i915 = gt->i915;
@@ -195,6 +203,9 @@ int intel_gt_init_hw(struct intel_gt *gt)
 
intel_gt_init_swizzling(gt);
 
+   /* Configure CCS mode */
+   intel_gt_apply_ccs_mode(gt);
+
/*
 * At least 830 can leave some of the unused rings
 * "active" (ie. head != tail) after resume which
diff --git a/drivers/gpu/drm/i915/gt/intel_gt_regs.h 
b/drivers/gpu/drm/i915/gt/intel_gt_regs.h
index cf709f6c05ae..c148113770ea 100644
--- a/drivers/gpu/drm/i915/gt/intel_gt_regs.h
+++ b/drivers/gpu/drm/i915/gt/intel_gt_regs.h
@@ -1605,6 +1605,8 @@
 #define   GEN12_VOLTAGE_MASK   REG_GENMASK(10, 0)
 #define   GEN12_CAGF_MASK  REG_GENMASK(19, 11)
 
+#define XEHP_CCS_MODE  _MMIO(0x14804)
+
 #define GEN11_GT_INTR_DW(x)_MMIO(0x190018 + ((x) * 4))
 #define   GEN11_CSME   (31)
 #define   GEN12_HECI_2 (30)
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index e81b3b2858ac..0853ffd3cb8d 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -396,6 +396,23 @@ static inline struct intel_gt *to_gt(const struct 
drm_i915_private *i915)
 (engine__); \
 (engine__) = rb_to_uabi_engine(rb_next(&(engine__)->uabi_node)))
 
+/*
+ * Exclude unavailable engines.
+ *
+ * Only the first CCS engine is utilized due to the disabling of CCS auto load
+ * balancing. As a result, all CCS engines operate collectively, functioning
+ * essentially as a single CCS engine, hence the count of active CCS engines is
+ * considered '1'.
+ * Currently, this applies to platforms with more than one CCS engine,
+ * specifically DG2.
+ */
+#define for_each_available_uabi_engine(engine__, i915__) \
+   for_each_uabi_engine(engine__, i915__) \
+   if ((IS_DG2(i915__)) && \
+   ((engine__)->uabi_class == I915_ENGINE_CLASS_COMPUTE) && \
+   ((engine__)->uabi_instance)) { } \
+   else
+
 #define INTEL_INFO(i915)   ((i915)->__info)
 #define RUNTIME_INFO(i915) (&(i915)->__runtime)
 #define DRIVER_CAPS(i915)  (&(i915)->caps)
diff --git a/drivers/gpu/drm/i915/i915_query.c 
b/drivers/gpu/drm/i915/i915_query.c
index fa3e937ed3f5..2d41bda626a6 100644
--- a/drivers/gpu/drm/i915/i915_query.c
+++ b/drivers/gpu/drm/i915/i915_query.c
@@ -124,6 +124,7 @@ static int query_geometry_subslices(struct drm_i915_private 
*i915,
return fill_topology_info(sseu, query_item, 
sseu->geometry_subslice_mask);
 }
 
+
 static int
 query_engine_info(struct drm_i915_private *i915,
  struct drm_i915_query_item *query_item)
@@ -140,7 +141,7 @@ query_engine_info(struct drm_i915_private *i915,
if (query_item->flags)
return -EINVAL;
 
-   for_each_uabi_engine(engine, i915)
+   for_each_available_uabi_engine(engine, i915)
num_uabi_engines++;
 
len = struct_size(query_ptr, engines, num_uabi_engines);
@@ -155,7 +156,7 @@ query_engine_info(struct drm_i915_private *i915,
 
info_ptr = &query_ptr->engines[0];
 
-   for_each_uabi_engine(engine, i915) {
+   for_each_available_uabi_engine(engine, i915) {
info.engine.engine_class = engine->uabi_class;
info.engine.engine_instance = engine->uabi_instance;
info.flags = I915_ENGINE_INFO_HAS_LOGICAL_INSTANCE;
-- 
2.43.0



[PATCH 1/2] drm/i915/gt: Disable HW load balancing for CCS

2024-02-15 Thread Andi Shyti
The hardware should not dynamically balance the load between CCS
engines. Wa_16016805146 recommends disabling it across all
platforms.

Fixes: d2eae8e98d59 ("drm/i915/dg2: Drop force_probe requirement")
Signed-off-by: Andi Shyti 
Cc: Chris Wilson 
Cc: Joonas Lahtinen 
Cc: Matt Roper 
Cc:  # v6.2+
---
 drivers/gpu/drm/i915/gt/intel_gt_regs.h | 1 +
 drivers/gpu/drm/i915/gt/intel_workarounds.c | 6 ++
 2 files changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/i915/gt/intel_gt_regs.h 
b/drivers/gpu/drm/i915/gt/intel_gt_regs.h
index 50962cfd1353..cf709f6c05ae 100644
--- a/drivers/gpu/drm/i915/gt/intel_gt_regs.h
+++ b/drivers/gpu/drm/i915/gt/intel_gt_regs.h
@@ -1478,6 +1478,7 @@
 
 #define GEN12_RCU_MODE _MMIO(0x14800)
 #define   GEN12_RCU_MODE_CCS_ENABLEREG_BIT(0)
+#define   XEHP_RCU_MODE_FIXED_SLICE_CCS_MODE   REG_BIT(1)
 
 #define CHV_FUSE_GT_MMIO(VLV_GUNIT_BASE + 0x2168)
 #define   CHV_FGT_DISABLE_SS0  (1 << 10)
diff --git a/drivers/gpu/drm/i915/gt/intel_workarounds.c 
b/drivers/gpu/drm/i915/gt/intel_workarounds.c
index d67d44611c28..7f42c8015f71 100644
--- a/drivers/gpu/drm/i915/gt/intel_workarounds.c
+++ b/drivers/gpu/drm/i915/gt/intel_workarounds.c
@@ -2988,6 +2988,12 @@ general_render_compute_wa_init(struct intel_engine_cs 
*engine, struct i915_wa_li
wa_mcr_masked_en(wal, GEN8_HALF_SLICE_CHICKEN1,
 GEN7_PSD_SINGLE_PORT_DISPATCH_ENABLE);
}
+
+   /*
+* Wa_16016805146: disable the CCS load balancing
+* indiscriminately for all the platforms
+*/
+   wa_masked_en(wal, GEN12_RCU_MODE, XEHP_RCU_MODE_FIXED_SLICE_CCS_MODE);
 }
 
 static void
-- 
2.43.0



[PATCH 0/2] Disable automatic load CCS load balancing

2024-02-15 Thread Andi Shyti
Hi,

this series does basically two things:

1. Disables automatic load balancing as adviced by the hardware
   workaround.

2. Forces the sharing of the load submitted to CCS among all the
   CCS available (as of now only DG2 has more than one CCS). This
   way the user, when sending a query, will see only one CCS
   available.

Andi

Andi Shyti (2):
  drm/i915/gt: Disable HW load balancing for CCS
  drm/i915/gt: Set default CCS mode '1'

 drivers/gpu/drm/i915/gt/intel_gt.c  | 11 +++
 drivers/gpu/drm/i915/gt/intel_gt_regs.h |  3 +++
 drivers/gpu/drm/i915/gt/intel_workarounds.c |  6 ++
 drivers/gpu/drm/i915/i915_drv.h | 17 +
 drivers/gpu/drm/i915/i915_query.c   |  5 +++--
 5 files changed, 40 insertions(+), 2 deletions(-)

-- 
2.43.0



[PULL] drm-misc-next

2024-02-15 Thread Thomas Zimmermann
Hi Dave, Sima,

here's the drm-misc-next PR for this week. The majority of changes
comes from Jani's update of the internal EDID callbacks, which the bridge
code now uses. There are also stability fixes for lima, improvements to
print helpers, correct parent devices for firmware framebuffers, and of
course various fixes.

Best regards
Thomas

drm-misc-next-2024-02-15:
drm-misc-next for v6.9:

UAPI Changes:

Cross-subsystem Changes:

arch:
- powerpc/ps3: select CONFIG_VIDEO

Core Changes:

ci:
- msm: fix apq8016 runner

display:
- use newer DRM print helpers

documentation:
- fix typos

print:
- add device-specific error and debug printers

sysfb:
- set Linux parent device for firmware framebuffer

tests:
- mm: use newer DRM print helpers

Driver Changes:

bridge:
- switch to ->read_edid callback throughout the bridge
drivers
- remove old ->get_edid callback

i915:
- use newer DRM print helpers

lima:
- improve stability by fixes to error handling and recovery

mediathek:
- switch to ->read_edid callback

msm:
- switch to ->read_edid callback

omap:
- switch to ->read_edid callback

panel:
- add Powkiddy RGB10MAX3 plus DT bindings
- st7703: support panel rotation plus DT bindings

rockchip:
- DT bindings: remove port, add power-domains

xe:
- use newer DRM print helpers

xlnx:
- switch to ->read_edid callback
The following changes since commit 3ce7384048fa1793db0eae013fa377d89256b76f:

  drm/bridge: remove drm_bridge_get_edid() in favour of drm_bridge_edid_read() 
(2024-02-08 17:12:33 +0200)

are available in the Git repository at:

  git://anongit.freedesktop.org/drm/drm-misc tags/drm-misc-next-2024-02-15

for you to fetch changes up to aa1267e673fe5307cf00d02add4017d2878598b6:

  drm: ci: use clk_ignore_unused for apq8016 (2024-02-14 11:23:56 -0300)


drm-misc-next for v6.9:

UAPI Changes:

Cross-subsystem Changes:

arch:
- powerpc/ps3: select CONFIG_VIDEO

Core Changes:

ci:
- msm: fix apq8016 runner

display:
- use newer DRM print helpers

documentation:
- fix typos

print:
- add device-specific error and debug printers

sysfb:
- set Linux parent device for firmware framebuffer

tests:
- mm: use newer DRM print helpers

Driver Changes:

bridge:
- switch to ->read_edid callback throughout the bridge
drivers
- remove old ->get_edid callback

i915:
- use newer DRM print helpers

lima:
- improve stability by fixes to error handling and recovery

mediathek:
- switch to ->read_edid callback

msm:
- switch to ->read_edid callback

omap:
- switch to ->read_edid callback

panel:
- add Powkiddy RGB10MAX3 plus DT bindings
- st7703: support panel rotation plus DT bindings

rockchip:
- DT bindings: remove port, add power-domains

xe:
- use newer DRM print helpers

xlnx:
- switch to ->read_edid callback


Chris Morgan (4):
  dt-bindings: display: Add Powkiddy RGB10MAX3 panel
  drm/panel: st7703: Add Powkiddy RGB10MAX3 Panel Support
  dt-bindings: display: rocktech,jh057n00900: Document panel rotation
  drm/panel: st7703: Add Panel Rotation Support

Dmitry Baryshkov (1):
  drm: ci: use clk_ignore_unused for apq8016

Erico Nunes (8):
  drm/lima: reset async_reset on pp hard reset
  drm/lima: reset async_reset on gp hard reset
  drm/lima: set pp bus_stop bit before hard reset
  drm/lima: set gp bus_stop bit before hard reset
  drm/lima: handle spurious timeouts due to high irq latency
  drm/lima: remove guilty drm_sched context handling
  drm/lima: increase default job timeout to 10s
  drm/lima: standardize debug messages by ip name

Jani Nikula (37):
  drm/bridge: anx7625: switch to ->edid_read callback
  drm/bridge: cdns-mhdp8546: switch to ->edid_read callback
  drm/bridge: cdns-mhdp8546: clear the EDID property on failures
  drm/bridge: display-connector: switch to ->edid_read callback
  drm/bridge: it6505: switch to ->edid_read callback
  drm: bridge: it66121: switch to ->edid_read callback
  drm/bridge: lt9611: switch to ->edid_read callback
  drm/bridge: lt9611uxc: switch to ->edid_read callback
  drm/bridge: megachips: switch to ->edid_read callback
  drm/bridge: nxp-ptn3460: switch to ->edid_read callback
  drm/bridge: sii902x: use display info is_hdmi
  drm/bridge: sii902x: switch to ->edid_read callback
  drm/mediatek/dp: switch to ->edid_read callback
  drm/mediatek/hdmi: switch to ->edid_read callback
  drm/msm/hdmi: fix indent
  drm/msm/hdmi: switch to ->edid_read callback
  drm/omap/hdmi4: switch to ->edid_read callback
  drm/omap/hdmi5: switch to ->edid_read callback
  drm: xlnx: zynqmp_dpsub: switch to ->edid_read callback
  drm: adv7511: switch to ->edid_read callback
  drm: bridge: dw_hdmi: switch to ->edid_read callback
  drm: bridge: dw_hdmi: clear the EDID property and CEC address on failures
  drm/bridge: tc358767: update the EDID

Re: [PULL] drm-misc-fixes

2024-02-15 Thread Geert Uytterhoeven

Hi Maxime,

On Thu, 15 Feb 2024, Maxime Ripard wrote:

Here's this week drm-misc-fixes PR

Maxime

drm-misc-fixes-2024-02-15:
A suspend/resume error fix for ivpu, a couple of scheduler fixes for
nouveau, a patch to support large page arrays in prime, a uninitialized
variable fix in crtc, a locking fix in rockchip/vop2 and a buddy
allocator error reporting fix.
The following changes since commit 5f8408aca66772d3aa9b4831577b2ac5ec41bcd9:

 accel/ivpu: Add job status for jobs aborted by the driver (2024-02-06 13:37:34 
+0100)

are available in the Git repository at:

 git://anongit.freedesktop.org/drm/drm-misc tags/drm-misc-fixes-2024-02-15

for you to fetch changes up to a64056bb5a3215bd31c8ce17d609ba0f4d5c55ea:

 drm/tests/drm_buddy: add alloc_contiguous test (2024-02-14 15:22:21 +0100)


A suspend/resume error fix for ivpu, a couple of scheduler fixes for
nouveau, a patch to support large page arrays in prime, a uninitialized
variable fix in crtc, a locking fix in rockchip/vop2 and a buddy
allocator error reporting fix.



Matthew Auld (1):
 drm/tests/drm_buddy: add alloc_contiguous test


Please drop this one.

nore...@ellerman.id.au reported a build failure on m68k (and presumably
other 32-bit platforms) in next-20240215:

ERROR: modpost: "__umoddi3" [drivers/gpu/drm/tests/drm_buddy_test.ko] undefined!
ERROR: modpost: "__moddi3" [drivers/gpu/drm/tests/drm_buddy_test.ko] undefined!

Reverting commit a64056bb5a3215bd ("drm/tests/drm_buddy: add
alloc_contiguous test") fixes the issue.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


[PULL] drm-xe-fixes

2024-02-15 Thread Thomas Hellstrom
Hi Dave, Sima!

The xe fixes pull request for -rc5.
drm-xe-fixes-2024-02-15:
Driver Changes:
- Fix an out-of-bounds shift.
- Fix the display code thinking xe uses shmem
- Fix a warning about index out-of-bound
- Fix a clang-16 compilation warning

Thanks,
Thomas

The following changes since commit bf4c27b8267d7848bb81fd41e6aa07aa662f07fb:

  drm/xe: Remove TEST_VM_ASYNC_OPS_ERROR (2024-02-08 09:51:19 +0100)

are available in the Git repository at:

  https://gitlab.freedesktop.org/drm/xe/kernel.git tags/drm-xe-fixes-2024-02-15

for you to fetch changes up to 455dae7549aed709707feda5d6b3e085b37d33f7:

  drm/xe: avoid function cast warnings (2024-02-15 09:53:38 +0100)


Driver Changes:
- Fix an out-of-bounds shift.
- Fix the display code thinking xe uses shmem
- Fix a warning about index out-of-bound
- Fix a clang-16 compilation warning


Arnd Bergmann (1):
  drm/xe: avoid function cast warnings

Matthew Auld (1):
  drm/xe/display: fix i915_gem_object_is_shmem() wrapper

Thomas Hellström (2):
  drm/xe/vm: Avoid reserving zero fences
  drm/xe/pt: Allow for stricter type- and range checking

 .../xe/compat-i915-headers/gem/i915_gem_object.h   |  2 +-
 drivers/gpu/drm/xe/xe_pt.c | 39 ++
 drivers/gpu/drm/xe/xe_pt_walk.c|  2 +-
 drivers/gpu/drm/xe/xe_pt_walk.h| 19 ++-
 drivers/gpu/drm/xe/xe_range_fence.c|  7 +++-
 drivers/gpu/drm/xe/xe_vm.c | 13 ++--
 6 files changed, 46 insertions(+), 36 deletions(-)


✓ Fi.CI.BAT: success for HDCP MST Type1 fixes (rev2)

2024-02-15 Thread Patchwork
== Series Details ==

Series: HDCP MST Type1 fixes (rev2)
URL   : https://patchwork.freedesktop.org/series/129925/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_14277 -> Patchwork_129925v2


Summary
---

  **SUCCESS**

  No regressions found.

  External URL: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129925v2/index.html

Participating hosts (35 -> 35)
--

  Additional (2): bat-kbl-2 bat-mtlp-8 
  Missing(2): fi-glk-j4005 fi-snb-2520m 

Known issues


  Here are the changes found in Patchwork_129925v2 that come from known issues:

### IGT changes ###

 Issues hit 

  * igt@debugfs_test@basic-hwmon:
- bat-mtlp-8: NOTRUN -> [SKIP][1] ([i915#9318])
   [1]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129925v2/bat-mtlp-8/igt@debugfs_t...@basic-hwmon.html

  * igt@fbdev@info:
- bat-kbl-2:  NOTRUN -> [SKIP][2] ([fdo#109271] / [i915#1849])
   [2]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129925v2/bat-kbl-2/igt@fb...@info.html

  * igt@gem_lmem_swapping@parallel-random-engines:
- bat-kbl-2:  NOTRUN -> [SKIP][3] ([fdo#109271]) +35 other tests 
skip
   [3]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129925v2/bat-kbl-2/igt@gem_lmem_swapp...@parallel-random-engines.html

  * igt@gem_lmem_swapping@verify-random:
- bat-mtlp-8: NOTRUN -> [SKIP][4] ([i915#4613]) +3 other tests skip
   [4]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129925v2/bat-mtlp-8/igt@gem_lmem_swapp...@verify-random.html

  * igt@gem_mmap@basic:
- bat-mtlp-8: NOTRUN -> [SKIP][5] ([i915#4083])
   [5]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129925v2/bat-mtlp-8/igt@gem_m...@basic.html

  * igt@gem_mmap_gtt@basic:
- bat-mtlp-8: NOTRUN -> [SKIP][6] ([i915#4077]) +2 other tests skip
   [6]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129925v2/bat-mtlp-8/igt@gem_mmap_...@basic.html

  * igt@gem_render_tiled_blits@basic:
- bat-mtlp-8: NOTRUN -> [SKIP][7] ([i915#4079]) +1 other test skip
   [7]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129925v2/bat-mtlp-8/igt@gem_render_tiled_bl...@basic.html

  * igt@i915_pm_rps@basic-api:
- bat-mtlp-8: NOTRUN -> [SKIP][8] ([i915#6621])
   [8]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129925v2/bat-mtlp-8/igt@i915_pm_...@basic-api.html

  * igt@kms_addfb_basic@addfb25-y-tiled-small-legacy:
- bat-mtlp-8: NOTRUN -> [SKIP][9] ([i915#5190])
   [9]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129925v2/bat-mtlp-8/igt@kms_addfb_ba...@addfb25-y-tiled-small-legacy.html

  * igt@kms_addfb_basic@basic-y-tiled-legacy:
- bat-mtlp-8: NOTRUN -> [SKIP][10] ([i915#4212]) +8 other tests skip
   [10]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129925v2/bat-mtlp-8/igt@kms_addfb_ba...@basic-y-tiled-legacy.html

  * igt@kms_cursor_legacy@basic-busy-flip-before-cursor-legacy:
- bat-mtlp-8: NOTRUN -> [SKIP][11] ([i915#4213]) +1 other test skip
   [11]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129925v2/bat-mtlp-8/igt@kms_cursor_leg...@basic-busy-flip-before-cursor-legacy.html

  * igt@kms_dsc@dsc-basic:
- bat-mtlp-8: NOTRUN -> [SKIP][12] ([i915#3555] / [i915#3840] / 
[i915#9159])
   [12]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129925v2/bat-mtlp-8/igt@kms_...@dsc-basic.html

  * igt@kms_force_connector_basic@force-load-detect:
- bat-mtlp-8: NOTRUN -> [SKIP][13] ([fdo#109285])
   [13]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129925v2/bat-mtlp-8/igt@kms_force_connector_ba...@force-load-detect.html

  * igt@kms_force_connector_basic@prune-stale-modes:
- bat-mtlp-8: NOTRUN -> [SKIP][14] ([i915#5274])
   [14]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129925v2/bat-mtlp-8/igt@kms_force_connector_ba...@prune-stale-modes.html

  * igt@kms_setmode@basic-clone-single-crtc:
- bat-mtlp-8: NOTRUN -> [SKIP][15] ([i915#3555] / [i915#8809])
   [15]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129925v2/bat-mtlp-8/igt@kms_setm...@basic-clone-single-crtc.html

  * igt@prime_vgem@basic-fence-mmap:
- bat-mtlp-8: NOTRUN -> [SKIP][16] ([i915#3708] / [i915#4077]) +1 
other test skip
   [16]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129925v2/bat-mtlp-8/igt@prime_v...@basic-fence-mmap.html

  * igt@prime_vgem@basic-fence-read:
- bat-mtlp-8: NOTRUN -> [SKIP][17] ([i915#3708]) +2 other tests skip
   [17]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129925v2/bat-mtlp-8/igt@prime_v...@basic-fence-read.html

  
 Possible fixes 

  * igt@gem_exec_create@basic@smem:
- {bat-arls-1}:   [DMESG-WARN][18] ([i915#10194]) -> [PASS][19]
   [18]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_14277/bat-arls-1/igt@gem_exec_create@ba...@smem.html
   [19]: 
https://intel-gfx-ci.0

✗ Fi.CI.SPARSE: warning for HDCP MST Type1 fixes (rev2)

2024-02-15 Thread Patchwork
== Series Details ==

Series: HDCP MST Type1 fixes (rev2)
URL   : https://patchwork.freedesktop.org/series/129925/
State : warning

== Summary ==

Error: dim sparse failed
Sparse version: v0.6.2
Fast mode used, each commit won't be checked separately.
+./arch/x86/include/asm/bitops.h:116:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:116:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:116:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:116:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:116:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:116:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:116:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:116:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:116:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:116:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:116:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:116:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:116:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:116:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:116:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:116:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:116:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:116:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:116:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:116:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:116:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:116:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:116:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:116:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:116:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:116:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:116:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:116:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:116:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:116:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:116:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:116:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:116:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:116:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:116:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:116:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:116:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:116:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:116:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:116:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:116:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:116:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:116:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:116:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:116:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:116:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:116:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:116:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:116:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:116:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:116:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:116:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:116:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:116:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:116:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:116:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:116:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:116:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:116:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:116:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:116:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:116:1: warning: unreplaced symbol 'return'
+./arch/x86/include/asm/bitops.h:11

✓ Fi.CI.BAT: success for ALPM AUX-Less

2024-02-15 Thread Patchwork
== Series Details ==

Series: ALPM AUX-Less
URL   : https://patchwork.freedesktop.org/series/129938/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_14277 -> Patchwork_129938v1


Summary
---

  **SUCCESS**

  No regressions found.

  External URL: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129938v1/index.html

Participating hosts (35 -> 34)
--

  Missing(1): fi-snb-2520m 

Known issues


  Here are the changes found in Patchwork_129938v1 that come from known issues:

### CI changes ###

 Possible fixes 

  * boot:
- fi-cfl-8109u:   [FAIL][1] ([i915#8293]) -> [PASS][2]
   [1]: 
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_14277/fi-cfl-8109u/boot.html
   [2]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129938v1/fi-cfl-8109u/boot.html

  

### IGT changes ###

 Issues hit 

  * igt@gem_huc_copy@huc-copy:
- fi-cfl-8109u:   NOTRUN -> [SKIP][3] ([fdo#109271] / [i915#2190])
   [3]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129938v1/fi-cfl-8109u/igt@gem_huc_c...@huc-copy.html

  * igt@gem_lmem_swapping@verify-random:
- fi-cfl-8109u:   NOTRUN -> [SKIP][4] ([fdo#109271] / [i915#4613]) +3 
other tests skip
   [4]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129938v1/fi-cfl-8109u/igt@gem_lmem_swapp...@verify-random.html

  * igt@kms_pipe_crc_basic@nonblocking-crc:
- bat-dg2-11: NOTRUN -> [SKIP][5] ([i915#9197])
   [5]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129938v1/bat-dg2-11/igt@kms_pipe_crc_ba...@nonblocking-crc.html

  * igt@kms_pm_backlight@basic-brightness:
- fi-cfl-8109u:   NOTRUN -> [SKIP][6] ([fdo#109271]) +7 other tests skip
   [6]: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129938v1/fi-cfl-8109u/igt@kms_pm_backli...@basic-brightness.html

  
  {name}: This element is suppressed. This means it is ignored when computing
  the status of the difference (SUCCESS, WARNING, or FAILURE).

  [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
  [i915#2190]: https://gitlab.freedesktop.org/drm/intel/issues/2190
  [i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
  [i915#8293]: https://gitlab.freedesktop.org/drm/intel/issues/8293
  [i915#9197]: https://gitlab.freedesktop.org/drm/intel/issues/9197


Build changes
-

  * Linux: CI_DRM_14277 -> Patchwork_129938v1

  CI-20190529: 20190529
  CI_DRM_14277: 0b36e01cb22c6d9d541f379253b4b2ab0c805646 @ 
git://anongit.freedesktop.org/gfx-ci/linux
  IGT_7714: 7714
  Patchwork_129938v1: 0b36e01cb22c6d9d541f379253b4b2ab0c805646 @ 
git://anongit.freedesktop.org/gfx-ci/linux


### Linux commits

8bbfc8eb7528 drm/i915/psr: Enable ALPM for eDP Panel replay
01a62a4b1959 drm/i915/psr: Add missing ALPM AUX-Less register defintions
0c6014822948 drm/i915/psr: Silence period and lfps half cycle
6320d1ce02a1 drm/i915/psr: Calculate aux less switch to active latency
831a3465fb0a drm/i915/psr: Calculate aux less wake time
3bcdf3f36909 drm/display: Add missing aux less alpm wake related bits

== Logs ==

For more details see: 
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129938v1/index.html


[PULL] drm-intel-fixes

2024-02-15 Thread Joonas Lahtinen
Hi Dave & Sima,

Here goes drm-intel-fixes towards v6.8-rc5. Two fixes.

Fix for #10172 (blank screen on JSL Chromebooks) and limiting SST link
rate within supported range.

Best Regards, Joonas

***

drm-intel-fixes-2024-02-15:

Fix for #10172: Blank screen on JSL Chromebooks. Stable fix to limit DP SST 
link rate to <=8.1Gbps.

The following changes since commit 841c35169323cd833294798e58b9bf63fa4fa1de:

  Linux 6.8-rc4 (2024-02-11 12:18:13 -0800)

are available in the Git repository at:

  git://anongit.freedesktop.org/drm/drm-intel tags/drm-intel-fixes-2024-02-15

for you to fetch changes up to ad26d56d080780bbfcc1696ca0c0cce3e2124ef6:

  drm/i915/dp: Limit SST link rate to <=8.1Gbps (2024-02-12 11:39:19 +0200)


Fix for #10172: Blank screen on JSL Chromebooks. Stable fix to limit DP SST 
link rate to <=8.1Gbps.


Manasi Navare (1):
  drm/i915/dsc: Fix the macro that calculates DSCC_/DSCA_ PPS reg address

Ville Syrjälä (1):
  drm/i915/dp: Limit SST link rate to <=8.1Gbps

 drivers/gpu/drm/i915/display/intel_dp.c| 3 +++
 drivers/gpu/drm/i915/display/intel_vdsc_regs.h | 4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)


Re: [PATCH v2 2/6] drm/i915/mst: improve debug logging of DP MST mode detect

2024-02-15 Thread Jani Nikula
On Wed, 14 Feb 2024, Ville Syrjälä  wrote:
> On Tue, Feb 13, 2024 at 01:30:57PM +0200, Jani Nikula wrote:
>> Rename intel_dp_can_mst() to intel_dp_mst_detect(), and move all DP MST
>> detect debug logging there. Debug log the sink's MST capability,
>> including single-stream sideband messaging support, and the decision
>> whether to enable MST mode or not. Do this regardless of whether we're
>> actually enabling MST or not.
>> 
>> Cc: Arun R Murthy 
>> Cc: Ville Syrjälä 
>> Signed-off-by: Jani Nikula 
>> ---
>>  drivers/gpu/drm/i915/display/intel_dp.c | 45 +
>>  1 file changed, 31 insertions(+), 14 deletions(-)
>> 
>> diff --git a/drivers/gpu/drm/i915/display/intel_dp.c 
>> b/drivers/gpu/drm/i915/display/intel_dp.c
>> index a1c304f451bd..944f566525dd 100644
>> --- a/drivers/gpu/drm/i915/display/intel_dp.c
>> +++ b/drivers/gpu/drm/i915/display/intel_dp.c
>> @@ -4007,31 +4007,48 @@ intel_dp_get_dpcd(struct intel_dp *intel_dp)
>> intel_dp->downstream_ports) == 0;
>>  }
>>  
>> +static const char *intel_dp_mst_mode_str(enum drm_dp_mst_mode mst_mode)
>> +{
>> +if (mst_mode == DRM_DP_SST_SIDEBAND_MSG)
>> +return "single-stream sideband messaging";
>> +else
>> +return str_yes_no(mst_mode == DRM_DP_MST);
>
> I wonder if this should also just say "sst"/"mst"/"sst sideband" etc.
> Shrug.
>
> Reviewed-by: Ville Syrjälä 

I realize there's an issue here.

intel_dp_detect_dpcd() bails out early for !drm_dp_is_branch(), before
the intel_dp_can_mst() call. (Renamed intel_dp_mst_detect() here.)

We'll still happily call intel_dp_configure_mst() later also for
!branch.

We'll need to call intel_dp_mst_detect() earlier and/or somehow combine
these together. I don't think branch devices need to support MST, but I
think MST devices need to support branching. And single-stream sideband
support does not mean branching.

The intention of this patch was to improve MST debug logging, but the
end result is that it reduces it! Auch.

I wonder if we should branch (eh) the detect earlier for eDP, SST and
MST/branch paths. Just to make it easier for our poor brains to follow.


BR,
Jani.


>
>> +}
>> +
>>  static bool
>> -intel_dp_can_mst(struct intel_dp *intel_dp)
>> +intel_dp_mst_detect(struct intel_dp *intel_dp)
>>  {
>>  struct drm_i915_private *i915 = dp_to_i915(intel_dp);
>> +struct intel_encoder *encoder = &dp_to_dig_port(intel_dp)->base;
>> +enum drm_dp_mst_mode sink_mst_mode;
>> +enum drm_dp_mst_mode mst_detect;
>> +
>> +sink_mst_mode = drm_dp_read_mst_cap(&intel_dp->aux, intel_dp->dpcd);
>> +
>> +if (i915->display.params.enable_dp_mst &&
>> +intel_dp_mst_source_support(intel_dp) &&
>> +sink_mst_mode == DRM_DP_MST)
>> +mst_detect = DRM_DP_MST;
>> +else
>> +mst_detect = DRM_DP_SST;
>>  
>> -return i915->display.params.enable_dp_mst &&
>> -intel_dp_mst_source_support(intel_dp) &&
>> -drm_dp_read_mst_cap(&intel_dp->aux, intel_dp->dpcd) == 
>> DRM_DP_MST;
>> +drm_dbg_kms(&i915->drm,
>> +"[ENCODER:%d:%s] MST support: port: %s, sink: %s, modparam: 
>> %s -> enable: %s\n",
>> +encoder->base.base.id, encoder->base.name,
>> +str_yes_no(intel_dp_mst_source_support(intel_dp)),
>> +intel_dp_mst_mode_str(sink_mst_mode),
>> +str_yes_no(i915->display.params.enable_dp_mst),
>> +intel_dp_mst_mode_str(mst_detect));
>> +
>> +return mst_detect != DRM_DP_SST;
>>  }
>>  
>>  static void
>>  intel_dp_configure_mst(struct intel_dp *intel_dp)
>>  {
>>  struct drm_i915_private *i915 = dp_to_i915(intel_dp);
>> -struct intel_encoder *encoder =
>> -&dp_to_dig_port(intel_dp)->base;
>>  bool sink_can_mst = drm_dp_read_mst_cap(&intel_dp->aux, intel_dp->dpcd) 
>> == DRM_DP_MST;
>>  
>> -drm_dbg_kms(&i915->drm,
>> -"[ENCODER:%d:%s] MST support: port: %s, sink: %s, modparam: 
>> %s\n",
>> -encoder->base.base.id, encoder->base.name,
>> -str_yes_no(intel_dp_mst_source_support(intel_dp)),
>> -str_yes_no(sink_can_mst),
>> -str_yes_no(i915->display.params.enable_dp_mst));
>> -
>>  if (!intel_dp_mst_source_support(intel_dp))
>>  return;
>>  
>> @@ -5390,7 +5407,7 @@ intel_dp_detect_dpcd(struct intel_dp *intel_dp)
>>  connector_status_connected : connector_status_disconnected;
>>  }
>>  
>> -if (intel_dp_can_mst(intel_dp))
>> +if (intel_dp_mst_detect(intel_dp))
>>  return connector_status_connected;
>>  
>>  /* If no HPD, poke DDC gently */
>> -- 
>> 2.39.2

-- 
Jani Nikula, Intel


✗ Fi.CI.SPARSE: warning for ALPM AUX-Less

2024-02-15 Thread Patchwork
== Series Details ==

Series: ALPM AUX-Less
URL   : https://patchwork.freedesktop.org/series/129938/
State : warning

== Summary ==

Error: dim sparse failed
Sparse version: v0.6.2
Fast mode used, each commit won't be checked separately.




✗ Fi.CI.CHECKPATCH: warning for ALPM AUX-Less

2024-02-15 Thread Patchwork
== Series Details ==

Series: ALPM AUX-Less
URL   : https://patchwork.freedesktop.org/series/129938/
State : warning

== Summary ==

Error: dim checkpatch failed
eb5c1bef7e0e drm/display: Add missing aux less alpm wake related bits
cc91271b2064 drm/i915/psr: Calculate aux less wake time
d67ae1130d2c drm/i915/psr: Calculate aux less switch to active latency
-:62: CHECK:OPEN_ENDED_LINE: Lines should not end with a '('
#62: FILE: drivers/gpu/drm/i915/display/intel_psr.c:1181:
+   intel_usecs_to_scanlines(

total: 0 errors, 0 warnings, 1 checks, 54 lines checked
aa108461a8c6 drm/i915/psr: Silence period and lfps half cycle
e9a1ac053d41 drm/i915/psr: Add missing ALPM AUX-Less register defintions
-:4: WARNING:TYPO_SPELLING: 'defintions' may be misspelled - perhaps 
'definitions'?
#4: 
Subject: [PATCH] drm/i915/psr: Add missing ALPM AUX-Less register defintions
  ^^

-:27: WARNING:LONG_LINE: line length of 169 exceeds 100 columns
#27: FILE: drivers/gpu/drm/i915/display/intel_psr_regs.h:352:
+#define  PORT_ALPM_LFPS_CTL_LFPS_CYCLE_COUNT(val)  
REG_FIELD_PREP(PORT_ALPM_LFPS_CTL_LFPS_CYCLE_COUNT_MASK, (val) - 
PORT_ALPM_LFPS_CTL_LFPS_CYCLE_COUNT_MIN)

-:29: WARNING:LONG_LINE: line length of 133 exceeds 100 columns
#29: FILE: drivers/gpu/drm/i915/display/intel_psr_regs.h:354:
+#define  PORT_ALPM_LFPS_CTL_LFPS_HALF_CYCLE_DURATION(val)  
REG_FIELD_PREP(PORT_ALPM_LFPS_CTL_LFPS_HALF_CYCLE_DURATION_MASK, val)

-:31: WARNING:LONG_LINE: line length of 133 exceeds 100 columns
#31: FILE: drivers/gpu/drm/i915/display/intel_psr_regs.h:356:
+#define  PORT_ALPM_LFPS_CTL_FIRST_LFPS_HALF_CYCLE_DURATION(val)
REG_FIELD_PREP(PORT_ALPM_LFPS_CTL_LFPS_HALF_CYCLE_DURATION_MASK, val)

-:33: WARNING:LONG_LINE: line length of 133 exceeds 100 columns
#33: FILE: drivers/gpu/drm/i915/display/intel_psr_regs.h:358:
+#define  PORT_ALPM_LFPS_CTL_LAST_LFPS_HALF_CYCLE_DURATION(val) 
REG_FIELD_PREP(PORT_ALPM_LFPS_CTL_LFPS_HALF_CYCLE_DURATION_MASK, val)

total: 0 errors, 5 warnings, 0 checks, 17 lines checked
c088b6e411f6 drm/i915/psr: Enable ALPM for eDP Panel replay
-:41: CHECK:OPEN_ENDED_LINE: Lines should not end with a '('
#41: FILE: drivers/gpu/drm/i915/display/intel_psr.c:1721:
+  ALPM_CTL2_SWITCH_TO_ACTIVE_LATENCY(

-:47: CHECK:OPEN_ENDED_LINE: Lines should not end with a '('
#47: FILE: drivers/gpu/drm/i915/display/intel_psr.c:1727:
+  PORT_ALPM_CTL_SILENCE_PERIOD(

-:52: CHECK:OPEN_ENDED_LINE: Lines should not end with a '('
#52: FILE: drivers/gpu/drm/i915/display/intel_psr.c:1732:
+  PORT_ALPM_LFPS_CTL_LFPS_HALF_CYCLE_DURATION(

-:54: CHECK:OPEN_ENDED_LINE: Lines should not end with a '('
#54: FILE: drivers/gpu/drm/i915/display/intel_psr.c:1734:
+  
PORT_ALPM_LFPS_CTL_FIRST_LFPS_HALF_CYCLE_DURATION(

-:56: CHECK:OPEN_ENDED_LINE: Lines should not end with a '('
#56: FILE: drivers/gpu/drm/i915/display/intel_psr.c:1736:
+  PORT_ALPM_LFPS_CTL_LAST_LFPS_HALF_CYCLE_DURATION(

total: 0 errors, 0 warnings, 5 checks, 58 lines checked




[PATCH 13/13] drm/i915/hdcp: Read Rxcaps for robustibility

2024-02-15 Thread Suraj Kandpal
We see some monitors and docks report incorrect hdcp version
and capability in first few reads so we read rx_caps three times
before we conclude the monitor's or docks HDCP capability

--v2
-Add comment to justify the 3 time read loop for hdcp capability[Ankit]

Signed-off-by: Suraj Kandpal 
Reviewed-by: Ankit Nautiyal 
---
 drivers/gpu/drm/i915/display/intel_dp_hdcp.c | 29 ++--
 1 file changed, 20 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c 
b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c
index ed7afde417bc..bddc2e5f329e 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c
@@ -640,18 +640,29 @@ int _intel_dp_hdcp2_get_capability(struct drm_dp_aux *aux,
   bool *capable)
 {
u8 rx_caps[3];
-   int ret;
+   int ret, i;
 
*capable = false;
-   ret = drm_dp_dpcd_read(aux,
-  DP_HDCP_2_2_REG_RX_CAPS_OFFSET,
-  rx_caps, HDCP_2_2_RXCAPS_LEN);
-   if (ret != HDCP_2_2_RXCAPS_LEN)
-   return ret >= 0 ? -EIO : ret;
 
-   if (rx_caps[0] == HDCP_2_2_RX_CAPS_VERSION_VAL &&
-   HDCP_2_2_DP_HDCP_CAPABLE(rx_caps[2]))
-   *capable = true;
+   /*
+* Some HDCP monitors act really shady by not giving the correct hdcp
+* capability on the first rx_caps read and usually take an extra read
+* to give the capability. We read rx_caps three times before we
+* declare a monitor not capable of HDCP 2.2.
+*/
+   for (i = 0; i < 3; i++) {
+   ret = drm_dp_dpcd_read(aux,
+  DP_HDCP_2_2_REG_RX_CAPS_OFFSET,
+  rx_caps, HDCP_2_2_RXCAPS_LEN);
+   if (ret != HDCP_2_2_RXCAPS_LEN)
+   return ret >= 0 ? -EIO : ret;
+
+   if (rx_caps[0] == HDCP_2_2_RX_CAPS_VERSION_VAL &&
+   HDCP_2_2_DP_HDCP_CAPABLE(rx_caps[2])) {
+   *capable = true;
+   break;
+   }
+   }
 
return 0;
 }
-- 
2.25.1



[PATCH 12/13] drm/i915/hdcp: Allocate stream id after HDCP AKE stage

2024-02-15 Thread Suraj Kandpal
Allocate stream id after HDCP AKE stage and not before so that it
can also be done during link integrity check.
Right now for MST scenarios LIC fails after hdcp enablement for this
reason.

--v2
-no need for else block in prepare_streams function [Ankit]

Signed-off-by: Suraj Kandpal 
---
 drivers/gpu/drm/i915/display/intel_hdcp.c | 138 +++---
 1 file changed, 66 insertions(+), 72 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_hdcp.c 
b/drivers/gpu/drm/i915/display/intel_hdcp.c
index ad05ab899706..be7d5a3ce49d 100644
--- a/drivers/gpu/drm/i915/display/intel_hdcp.c
+++ b/drivers/gpu/drm/i915/display/intel_hdcp.c
@@ -30,7 +30,7 @@
 #define KEY_LOAD_TRIES 5
 #define HDCP2_LC_RETRY_CNT 3
 
-static int intel_conn_to_vcpi(struct drm_atomic_state *state,
+static int intel_conn_to_vcpi(struct intel_atomic_state *state,
  struct intel_connector *connector)
 {
struct drm_dp_mst_topology_mgr *mgr;
@@ -43,7 +43,7 @@ static int intel_conn_to_vcpi(struct drm_atomic_state *state,
return 0;
mgr = connector->port->mgr;
 
-   drm_modeset_lock(&mgr->base.lock, state->acquire_ctx);
+   drm_modeset_lock(&mgr->base.lock, state->base.acquire_ctx);
mst_state = to_drm_dp_mst_topology_state(mgr->base.state);
payload = drm_atomic_get_mst_payload_state(mst_state, connector->port);
if (drm_WARN_ON(mgr->dev, !payload))
@@ -68,19 +68,52 @@ static int intel_conn_to_vcpi(struct drm_atomic_state 
*state,
  * DP MST topology. Though it is not compulsory, security fw should change its
  * policy to mark different content_types for different streams.
  */
-static void
-intel_hdcp_required_content_stream(struct intel_digital_port *dig_port)
+static int
+intel_hdcp_required_content_stream(struct intel_atomic_state *state,
+  struct intel_hdcp *hdcp,
+  struct intel_digital_port *dig_port)
 {
+   struct drm_connector_list_iter conn_iter;
+   struct intel_digital_port *conn_dig_port;
+   struct intel_connector *connector;
+   struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev);
struct hdcp_port_data *data = &dig_port->hdcp_port_data;
bool enforce_type0 = false;
int k;
 
if (dig_port->hdcp_auth_status)
-   return;
+   return 0;
+
+   data->k = 0;
 
if (!dig_port->hdcp_mst_type1_capable)
enforce_type0 = true;
 
+   drm_connector_list_iter_begin(&i915->drm, &conn_iter);
+   for_each_intel_connector_iter(connector, &conn_iter) {
+   if (connector->base.status == connector_status_disconnected)
+   continue;
+
+   if (!intel_encoder_is_mst(intel_attached_encoder(connector)))
+   continue;
+
+   conn_dig_port = intel_attached_dig_port(connector);
+   if (conn_dig_port != dig_port)
+   continue;
+
+   data->streams[data->k].stream_id =
+   intel_conn_to_vcpi(state, connector);
+   data->k++;
+
+   /* if there is only one active stream */
+   if (dig_port->dp.active_mst_links <= 1)
+   break;
+   }
+   drm_connector_list_iter_end(&conn_iter);
+
+   if (drm_WARN_ON(&i915->drm, data->k > INTEL_NUM_PIPES(i915) || data->k 
== 0))
+   return -EINVAL;
+
/*
 * Apply common protection level across all streams in DP MST Topology.
 * Use highest supported content type for all streams in DP MST 
Topology.
@@ -88,19 +121,25 @@ intel_hdcp_required_content_stream(struct 
intel_digital_port *dig_port)
for (k = 0; k < data->k; k++)
data->streams[k].stream_type =
enforce_type0 ? DRM_MODE_HDCP_CONTENT_TYPE0 : 
DRM_MODE_HDCP_CONTENT_TYPE1;
+
+   return 0;
 }
 
-static void intel_hdcp_prepare_streams(struct intel_connector *connector)
+static int intel_hdcp_prepare_streams(struct intel_atomic_state *state,
+ struct intel_connector *connector)
 {
struct intel_digital_port *dig_port = 
intel_attached_dig_port(connector);
struct hdcp_port_data *data = &dig_port->hdcp_port_data;
struct intel_hdcp *hdcp = &connector->hdcp;
 
-   if (!intel_encoder_is_mst(intel_attached_encoder(connector))) {
-   data->streams[0].stream_type = hdcp->content_type;
-   } else {
-   intel_hdcp_required_content_stream(dig_port);
-   }
+   if (intel_encoder_is_mst(intel_attached_encoder(connector)))
+   return intel_hdcp_required_content_stream(state, hdcp, 
dig_port);
+
+   data->k = 1;
+   data->streams[0].stream_id = 0;
+   data->streams[0].stream_type = hdcp->content_type;
+
+   return 0;
 }
 
 static
@@ -1895,7 +1934,8 @@ hdcp2_propagate_stream_management_info

[PATCH 11/13] drm/i915/hdcp: Don't enable HDCP1.4 directly from check_link

2024-02-15 Thread Suraj Kandpal
Whenever LIC fails instead of moving from ENABLED to DESIRED
CP property we directly enable HDCP1.4 without informing the userspace
of this failure in link integrity check.
Now we will just update the value to DESIRED send the event to
userspace and then continue with the normal flow of HDCP enablement.

Signed-off-by: Suraj Kandpal 
---
 drivers/gpu/drm/i915/display/intel_hdcp.c | 12 +++-
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_hdcp.c 
b/drivers/gpu/drm/i915/display/intel_hdcp.c
index 3bd783b8deac..ad05ab899706 100644
--- a/drivers/gpu/drm/i915/display/intel_hdcp.c
+++ b/drivers/gpu/drm/i915/display/intel_hdcp.c
@@ -1088,15 +1088,9 @@ static int intel_hdcp_check_link(struct intel_connector 
*connector)
goto out;
}
 
-   ret = intel_hdcp1_enable(connector);
-   if (ret) {
-   drm_err(&i915->drm, "Failed to enable hdcp (%d)\n", ret);
-   intel_hdcp_update_value(connector,
-   DRM_MODE_CONTENT_PROTECTION_DESIRED,
-   true);
-   goto out;
-   }
-
+   intel_hdcp_update_value(connector,
+   DRM_MODE_CONTENT_PROTECTION_DESIRED,
+   true);
 out:
mutex_unlock(&dig_port->hdcp_mutex);
mutex_unlock(&hdcp->mutex);
-- 
2.25.1



[PATCH 09/13] drm/i915/hdcp: Extract hdcp structure from correct connector

2024-02-15 Thread Suraj Kandpal
Currently intel_hdcp is not being extracted from primary connector
this patch fixes that.

Fixes: 524240b231ea ("drm/i915/hdcp: Propagate aux info in DP HDCP functions")
Signed-off-by: Suraj Kandpal 
Reviewed-by: Ankit Nautiyal 
---
 drivers/gpu/drm/i915/display/intel_dp_hdcp.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c 
b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c
index 9a82a3a5dfec..ed7afde417bc 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c
@@ -391,7 +391,9 @@ intel_dp_hdcp2_wait_for_msg(struct intel_connector 
*connector,
const struct hdcp2_dp_msg_data *hdcp2_msg_data)
 {
struct drm_i915_private *i915 = to_i915(connector->base.dev);
-   struct intel_hdcp *hdcp = &connector->hdcp;
+   struct intel_digital_port *dig_port = 
intel_attached_dig_port(connector);
+   struct intel_dp *dp = &dig_port->dp;
+   struct intel_hdcp *hdcp = &dp->attached_connector->hdcp;
u8 msg_id = hdcp2_msg_data->msg_id;
int ret, timeout;
bool msg_ready = false;
@@ -507,8 +509,9 @@ int intel_dp_hdcp2_read_msg(struct intel_connector 
*connector,
 {
struct intel_digital_port *dig_port = 
intel_attached_dig_port(connector);
struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev);
-   struct intel_hdcp *hdcp = &connector->hdcp;
struct drm_dp_aux *aux = &dig_port->dp.aux;
+   struct intel_dp *dp = &dig_port->dp;
+   struct intel_hdcp *hdcp = &dp->attached_connector->hdcp;
unsigned int offset;
u8 *byte = buf;
ssize_t ret, bytes_to_recv, len;
-- 
2.25.1



[PATCH 10/13] drm/i915/hdcp: Don't enable HDCP2.2 directly from check_link

2024-02-15 Thread Suraj Kandpal
Whenever LIC fails instead of moving from ENABLED to DESIRED
CP property we directly enable HDCP2.2 without informing the userspace
of this failure in link integrity check.
Now we will just update the value to DESIRED send the event to
userspace and then continue with the normal flow of HDCP enablement.

--v2
-Don't change the function prototype in this function [Ankit]

Signed-off-by: Suraj Kandpal 
---
 drivers/gpu/drm/i915/display/intel_hdcp.c | 25 ++-
 1 file changed, 2 insertions(+), 23 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_hdcp.c 
b/drivers/gpu/drm/i915/display/intel_hdcp.c
index 16b2b180563f..3bd783b8deac 100644
--- a/drivers/gpu/drm/i915/display/intel_hdcp.c
+++ b/drivers/gpu/drm/i915/display/intel_hdcp.c
@@ -2068,17 +2068,6 @@ static int intel_hdcp2_check_link(struct intel_connector 
*connector)
 
drm_dbg_kms(&i915->drm,
"HDCP2.2 Downstream topology change\n");
-   ret = hdcp2_authenticate_repeater_topology(connector);
-   if (!ret) {
-   intel_hdcp_update_value(connector,
-   DRM_MODE_CONTENT_PROTECTION_ENABLED,
-   true);
-   goto out;
-   }
-   drm_dbg_kms(&i915->drm,
-   "[CONNECTOR:%d:%s] Repeater topology auth 
failed.(%d)\n",
-   connector->base.base.id, connector->base.name,
-   ret);
} else {
drm_dbg_kms(&i915->drm,
"[CONNECTOR:%d:%s] HDCP2.2 link failed, retrying 
auth\n",
@@ -2095,18 +2084,8 @@ static int intel_hdcp2_check_link(struct intel_connector 
*connector)
goto out;
}
 
-   ret = _intel_hdcp2_enable(connector);
-   if (ret) {
-   drm_dbg_kms(&i915->drm,
-   "[CONNECTOR:%d:%s] Failed to enable hdcp2.2 (%d)\n",
-   connector->base.base.id, connector->base.name,
-   ret);
-   intel_hdcp_update_value(connector,
-   DRM_MODE_CONTENT_PROTECTION_DESIRED,
-   true);
-   goto out;
-   }
-
+   intel_hdcp_update_value(connector,
+   DRM_MODE_CONTENT_PROTECTION_DESIRED, true);
 out:
mutex_unlock(&dig_port->hdcp_mutex);
mutex_unlock(&hdcp->mutex);
-- 
2.25.1



[PATCH 08/13] drm/i915/hdcp: Remove additional timing for reading mst hdcp message

2024-02-15 Thread Suraj Kandpal
Now that we have moved back to direct reads the additional timing
is not required hence this can be removed.

--v2
-Add Fixes tag [Ankit]

Fixes: 3974f9c17bb9 ("drm/i915/hdcp: Adjust timeout for read in DPMST Scenario")
Signed-off-by: Suraj Kandpal 
Reviewed-by: Ankit Nautiyal 
---
 drivers/gpu/drm/i915/display/intel_dp_hdcp.c | 9 ++---
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c 
b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c
index c32303e7a059..9a82a3a5dfec 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c
@@ -551,13 +551,8 @@ int intel_dp_hdcp2_read_msg(struct intel_connector 
*connector,
 
/* Entire msg read timeout since initiate of msg read */
if (bytes_to_recv == size - 1 && 
hdcp2_msg_data->msg_read_timeout > 0) {
-   if (intel_encoder_is_mst(connector->encoder))
-   msg_end = ktime_add_ms(ktime_get_raw(),
-  
hdcp2_msg_data->msg_read_timeout *
-  
connector->port->parent->num_ports);
-   else
-   msg_end = ktime_add_ms(ktime_get_raw(),
-  
hdcp2_msg_data->msg_read_timeout);
+   msg_end = ktime_add_ms(ktime_get_raw(),
+  
hdcp2_msg_data->msg_read_timeout);
}
 
ret = drm_dp_dpcd_read(aux, offset,
-- 
2.25.1



[PATCH 06/13] drm/i915/hdcp: Add new remote capability check shim function

2024-02-15 Thread Suraj Kandpal
Create a remote HDCP capability shim function which can read the
remote monitor HDCP capability when in MST configuration.

--v2
-Add an assertion to make sure only mst encoder call this remote_cap
function [Ankit]

--v3
-rename remote_hdcp_cap to remote_hdcp_capability [Jani]

Signed-off-by: Suraj Kandpal 
Reviewed-by: Ankit Nautiyal 
---
 .../drm/i915/display/intel_display_types.h|  4 +++
 drivers/gpu/drm/i915/display/intel_dp_hdcp.c  | 27 +++
 drivers/gpu/drm/i915/display/intel_hdcp.c | 16 +++
 drivers/gpu/drm/i915/display/intel_hdcp.h |  3 +++
 4 files changed, 50 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h 
b/drivers/gpu/drm/i915/display/intel_display_types.h
index b77070d0897c..9becc5da8731 100644
--- a/drivers/gpu/drm/i915/display/intel_display_types.h
+++ b/drivers/gpu/drm/i915/display/intel_display_types.h
@@ -532,6 +532,10 @@ struct intel_hdcp_shim {
/* HDCP2.2 Link Integrity Check */
int (*check_2_2_link)(struct intel_digital_port *dig_port,
  struct intel_connector *connector);
+
+   /* HDCP remote sink cap */
+   int (*get_remote_hdcp_capability)(struct intel_connector *connector,
+ bool *hdcp_capable, bool 
*hdcp2_capable);
 };
 
 struct intel_hdcp {
diff --git a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c 
b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c
index 91736c7e3c83..c32303e7a059 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c
@@ -668,6 +668,32 @@ int intel_dp_hdcp2_get_capability(struct intel_connector 
*connector,
return _intel_dp_hdcp2_get_capability(aux, capable);
 }
 
+static
+int intel_dp_hdcp_get_remote_capability(struct intel_connector *connector,
+   bool *hdcp_capable,
+   bool *hdcp2_capable)
+{
+   struct drm_i915_private *i915 = to_i915(connector->base.dev);
+   struct drm_dp_aux *aux = &connector->port->aux;
+   u8 bcaps;
+   int ret;
+
+   if (!intel_encoder_is_mst(connector->encoder))
+   return -EINVAL;
+
+   ret =  _intel_dp_hdcp2_get_capability(aux, hdcp2_capable);
+   if (ret)
+   return ret;
+
+   ret = intel_dp_hdcp_read_bcaps(aux, i915, &bcaps);
+   if (ret)
+   return ret;
+
+   *hdcp_capable = bcaps & DP_BCAPS_HDCP_CAPABLE;
+
+   return 0;
+}
+
 static const struct intel_hdcp_shim intel_dp_hdcp_shim = {
.write_an_aksv = intel_dp_hdcp_write_an_aksv,
.read_bksv = intel_dp_hdcp_read_bksv,
@@ -685,6 +711,7 @@ static const struct intel_hdcp_shim intel_dp_hdcp_shim = {
.config_stream_type = intel_dp_hdcp2_config_stream_type,
.check_2_2_link = intel_dp_hdcp2_check_link,
.hdcp_2_2_get_capability = intel_dp_hdcp2_get_capability,
+   .get_remote_hdcp_capability = intel_dp_hdcp_get_remote_capability,
.protocol = HDCP_PROTOCOL_DP,
 };
 
diff --git a/drivers/gpu/drm/i915/display/intel_hdcp.c 
b/drivers/gpu/drm/i915/display/intel_hdcp.c
index c1a32f9f1199..16b2b180563f 100644
--- a/drivers/gpu/drm/i915/display/intel_hdcp.c
+++ b/drivers/gpu/drm/i915/display/intel_hdcp.c
@@ -205,6 +205,22 @@ bool intel_hdcp2_get_capability(struct intel_connector 
*connector)
return capable;
 }
 
+void intel_hdcp_get_remote_capability(struct intel_connector *connector,
+ bool *hdcp_capable,
+ bool *hdcp2_capable)
+{
+   struct intel_hdcp *hdcp = &connector->hdcp;
+
+   if (!hdcp->shim->get_remote_hdcp_capability)
+   return;
+
+   hdcp->shim->get_remote_hdcp_capability(connector, hdcp_capable,
+  hdcp2_capable);
+
+   if (intel_hdcp2_prerequisite(connector))
+   *hdcp2_capable = false;
+}
+
 static bool intel_hdcp_in_use(struct drm_i915_private *i915,
  enum transcoder cpu_transcoder, enum port port)
 {
diff --git a/drivers/gpu/drm/i915/display/intel_hdcp.h 
b/drivers/gpu/drm/i915/display/intel_hdcp.h
index aeefb3c13d2c..477f2d2bb120 100644
--- a/drivers/gpu/drm/i915/display/intel_hdcp.h
+++ b/drivers/gpu/drm/i915/display/intel_hdcp.h
@@ -40,6 +40,9 @@ void intel_hdcp_update_pipe(struct intel_atomic_state *state,
 bool is_hdcp_supported(struct drm_i915_private *i915, enum port port);
 bool intel_hdcp_get_capability(struct intel_connector *connector);
 bool intel_hdcp2_get_capability(struct intel_connector *connector);
+void intel_hdcp_get_remote_capability(struct intel_connector *connector,
+ bool *hdcp_capable,
+ bool *hdcp2_capable);
 void intel_hdcp_component_init(struct drm_i915_private *i915);
 void intel_hdcp_component_fini(struct drm_i915_private *i915);
 void intel_hdcp_cleanup(struct intel_connecto

[PATCH 07/13] drm/i915/hdcp: HDCP Capability for the downstream device

2024-02-15 Thread Suraj Kandpal
Currently we are only checking capability of remote device and not
immediate downstream device but during capability check we need are
concerned with only the HDCP capability of downstream device.
During i915_display_info reporting we need HDCP Capability for both
the monitors and downstream branch device if any this patch adds that.

--v2
-Use MST Hub HDCP version [Ankit]

--v3
-Redefined how we seprate remote and direct read to make sure HDMI
shim functions are not touched [Ankit]

--v4
- Fix the conditions so that hdcp_info with remote_req true is sent
only when encoder is mst [Ankit]

--v5
-No need to have the MST Hub version in i915_hdcp_sink_capability[Ankit]

Signed-off-by: Suraj Kandpal 
Reviewed-by: Ankit Nautiyal 
---
 .../drm/i915/display/intel_display_debugfs.c  | 21 ++-
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display_debugfs.c 
b/drivers/gpu/drm/i915/display/intel_display_debugfs.c
index 676ad082f0f5..8bc29a6f7c33 100644
--- a/drivers/gpu/drm/i915/display/intel_display_debugfs.c
+++ b/drivers/gpu/drm/i915/display/intel_display_debugfs.c
@@ -188,7 +188,8 @@ static void intel_panel_info(struct seq_file *m,
 }
 
 static void intel_hdcp_info(struct seq_file *m,
-   struct intel_connector *intel_connector)
+   struct intel_connector *intel_connector,
+   bool remote_req)
 {
bool hdcp_cap, hdcp2_cap;
 
@@ -197,8 +198,14 @@ static void intel_hdcp_info(struct seq_file *m,
goto out;
}
 
-   hdcp_cap = intel_hdcp_get_capability(intel_connector);
-   hdcp2_cap = intel_hdcp2_get_capability(intel_connector);
+   if (remote_req) {
+   intel_hdcp_get_remote_capability(intel_connector,
+&hdcp_cap,
+&hdcp2_cap);
+   } else {
+   hdcp_cap = intel_hdcp_get_capability(intel_connector);
+   hdcp2_cap = intel_hdcp2_get_capability(intel_connector);
+   }
 
if (hdcp_cap)
seq_puts(m, "HDCP1.4 ");
@@ -285,7 +292,11 @@ static void intel_connector_info(struct seq_file *m,
}
 
seq_puts(m, "\tHDCP version: ");
-   intel_hdcp_info(m, intel_connector);
+   if (intel_encoder_is_mst(encoder)) {
+   intel_hdcp_info(m, intel_connector, true);
+   seq_puts(m, "\tMST Hub HDCP version: ");
+   }
+   intel_hdcp_info(m, intel_connector, false);
 
seq_printf(m, "\tmax bpc: %u\n", connector->display_info.bpc);
 
@@ -1131,7 +1142,7 @@ static int i915_hdcp_sink_capability_show(struct seq_file 
*m, void *data)
 
seq_printf(m, "%s:%d HDCP version: ", connector->base.name,
   connector->base.base.id);
-   intel_hdcp_info(m, connector);
+   intel_hdcp_info(m, connector, false);
 
 out:
drm_modeset_unlock(&i915->drm.mode_config.connection_mutex);
-- 
2.25.1



[PATCH 05/13] drm/i915/hdcp: Rename hdcp capable functions

2024-02-15 Thread Suraj Kandpal
Rename hdcp_capable and hdcp_2_2_capable to hdcp_get_capability
and hdcp_2_2_get_capability to properly reflect what these functions
are doing.

Signed-off-by: Suraj Kandpal 
---
 .../drm/i915/display/intel_display_debugfs.c  |  4 ++--
 .../drm/i915/display/intel_display_types.h|  8 +++
 drivers/gpu/drm/i915/display/intel_dp_hdcp.c  | 22 +--
 drivers/gpu/drm/i915/display/intel_hdcp.c | 18 +++
 drivers/gpu/drm/i915/display/intel_hdcp.h |  4 ++--
 drivers/gpu/drm/i915/display/intel_hdmi.c |  6 ++---
 6 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display_debugfs.c 
b/drivers/gpu/drm/i915/display/intel_display_debugfs.c
index 6f2d13c8ccf7..676ad082f0f5 100644
--- a/drivers/gpu/drm/i915/display/intel_display_debugfs.c
+++ b/drivers/gpu/drm/i915/display/intel_display_debugfs.c
@@ -197,8 +197,8 @@ static void intel_hdcp_info(struct seq_file *m,
goto out;
}
 
-   hdcp_cap = intel_hdcp_capable(intel_connector);
-   hdcp2_cap = intel_hdcp2_capable(intel_connector);
+   hdcp_cap = intel_hdcp_get_capability(intel_connector);
+   hdcp2_cap = intel_hdcp2_get_capability(intel_connector);
 
if (hdcp_cap)
seq_puts(m, "HDCP1.4 ");
diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h 
b/drivers/gpu/drm/i915/display/intel_display_types.h
index ae2e8cff9d69..b77070d0897c 100644
--- a/drivers/gpu/drm/i915/display/intel_display_types.h
+++ b/drivers/gpu/drm/i915/display/intel_display_types.h
@@ -499,15 +499,15 @@ struct intel_hdcp_shim {
   struct intel_connector *connector);
 
/* Detects panel's hdcp capability. This is optional for HDMI. */
-   int (*hdcp_capable)(struct intel_digital_port *dig_port,
-   bool *hdcp_capable);
+   int (*hdcp_get_capability)(struct intel_digital_port *dig_port,
+  bool *hdcp_capable);
 
/* HDCP adaptation(DP/HDMI) required on the port */
enum hdcp_wired_protocol protocol;
 
/* Detects whether sink is HDCP2.2 capable */
-   int (*hdcp_2_2_capable)(struct intel_connector *connector,
-   bool *capable);
+   int (*hdcp_2_2_get_capability)(struct intel_connector *connector,
+  bool *capable);
 
/* Write HDCP2.2 messages */
int (*write_2_2_msg)(struct intel_connector *connector,
diff --git a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c 
b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c
index ef1a4c90c225..91736c7e3c83 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c
@@ -266,8 +266,8 @@ bool intel_dp_hdcp_check_link(struct intel_digital_port 
*dig_port,
 }
 
 static
-int intel_dp_hdcp_capable(struct intel_digital_port *dig_port,
- bool *hdcp_capable)
+int intel_dp_hdcp_get_capability(struct intel_digital_port *dig_port,
+bool *hdcp_capable)
 {
struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev);
ssize_t ret;
@@ -638,8 +638,8 @@ int intel_dp_hdcp2_check_link(struct intel_digital_port 
*dig_port,
 }
 
 static
-int _intel_dp_hdcp2_capable(struct drm_dp_aux *aux,
-   bool *capable)
+int _intel_dp_hdcp2_get_capability(struct drm_dp_aux *aux,
+  bool *capable)
 {
u8 rx_caps[3];
int ret;
@@ -659,13 +659,13 @@ int _intel_dp_hdcp2_capable(struct drm_dp_aux *aux,
 }
 
 static
-int intel_dp_hdcp2_capable(struct intel_connector *connector,
-  bool *capable)
+int intel_dp_hdcp2_get_capability(struct intel_connector *connector,
+ bool *capable)
 {
struct intel_digital_port *dig_port = 
intel_attached_dig_port(connector);
struct drm_dp_aux *aux = &dig_port->dp.aux;
 
-   return _intel_dp_hdcp2_capable(aux, capable);
+   return _intel_dp_hdcp2_get_capability(aux, capable);
 }
 
 static const struct intel_hdcp_shim intel_dp_hdcp_shim = {
@@ -679,12 +679,12 @@ static const struct intel_hdcp_shim intel_dp_hdcp_shim = {
.read_v_prime_part = intel_dp_hdcp_read_v_prime_part,
.toggle_signalling = intel_dp_hdcp_toggle_signalling,
.check_link = intel_dp_hdcp_check_link,
-   .hdcp_capable = intel_dp_hdcp_capable,
+   .hdcp_get_capability = intel_dp_hdcp_get_capability,
.write_2_2_msg = intel_dp_hdcp2_write_msg,
.read_2_2_msg = intel_dp_hdcp2_read_msg,
.config_stream_type = intel_dp_hdcp2_config_stream_type,
.check_2_2_link = intel_dp_hdcp2_check_link,
-   .hdcp_2_2_capable = intel_dp_hdcp2_capable,
+   .hdcp_2_2_get_capability = intel_dp_hdcp2_get_capability,
.protocol = HDCP_PROTOCOL_DP,
 };
 
@@ -809,13 +809,13 @@ static const struct intel_hdcp_shim 
intel_dp_mst_hdcp_shim = {
 

[PATCH 03/13] drm/i915/hdcp: Refactor intel_dp_hdcp2_capable

2024-02-15 Thread Suraj Kandpal
Break intel_dp_hdcp2_capable so that the common the code can be
reused for the remote capability check.

Signed-off-by: Suraj Kandpal 
Reviewed-by: Ankit Nautiyal 
---
 drivers/gpu/drm/i915/display/intel_dp_hdcp.c | 14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c 
b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c
index defc90936317..9aeee6b49b3d 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c
@@ -636,8 +636,8 @@ int intel_dp_hdcp2_check_link(struct intel_digital_port 
*dig_port,
 }
 
 static
-int intel_dp_hdcp2_capable(struct intel_connector *connector,
-  bool *capable)
+int _intel_dp_hdcp2_capable(struct drm_dp_aux *aux,
+   bool *capable)
 {
struct intel_digital_port *dig_port = 
intel_attached_dig_port(connector);
struct drm_dp_aux *aux = &dig_port->dp.aux;
@@ -658,6 +658,16 @@ int intel_dp_hdcp2_capable(struct intel_connector 
*connector,
return 0;
 }
 
+static
+int intel_dp_hdcp2_capable(struct intel_connector *connector,
+  bool *capable)
+{
+   struct intel_digital_port *dig_port = 
intel_attached_dig_port(connector);
+   struct drm_dp_aux *aux = &dig_port->dp.aux;
+
+   return _intel_dp_hdcp2_capable(aux, capable);
+}
+
 static const struct intel_hdcp_shim intel_dp_hdcp_shim = {
.write_an_aksv = intel_dp_hdcp_write_an_aksv,
.read_bksv = intel_dp_hdcp_read_bksv,
-- 
2.25.1



[PATCH 04/13] drm/i915/hdcp: Pass drm_dp_aux to read_bcaps function

2024-02-15 Thread Suraj Kandpal
Pass drm_dp_aux to intel_dp_hdcp_read_bcaps function
so as to aid in reading the bcaps for the remote monitor
later on.

Signed-off-by: Suraj Kandpal 
Reviewed-by: Ankit Nautiyal 
---
 drivers/gpu/drm/i915/display/intel_dp_hdcp.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c 
b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c
index 9aeee6b49b3d..ef1a4c90c225 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c
@@ -122,13 +122,13 @@ static int intel_dp_hdcp_read_bstatus(struct 
intel_digital_port *dig_port,
 }
 
 static
-int intel_dp_hdcp_read_bcaps(struct intel_digital_port *dig_port,
+int intel_dp_hdcp_read_bcaps(struct drm_dp_aux *aux,
+struct drm_i915_private *i915,
 u8 *bcaps)
 {
-   struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev);
ssize_t ret;
 
-   ret = drm_dp_dpcd_read(&dig_port->dp.aux, DP_AUX_HDCP_BCAPS,
+   ret = drm_dp_dpcd_read(aux, DP_AUX_HDCP_BCAPS,
   bcaps, 1);
if (ret != 1) {
drm_dbg_kms(&i915->drm,
@@ -143,10 +143,11 @@ static
 int intel_dp_hdcp_repeater_present(struct intel_digital_port *dig_port,
   bool *repeater_present)
 {
+   struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev);
ssize_t ret;
u8 bcaps;
 
-   ret = intel_dp_hdcp_read_bcaps(dig_port, &bcaps);
+   ret = intel_dp_hdcp_read_bcaps(&dig_port->dp.aux, i915,  &bcaps);
if (ret)
return ret;
 
@@ -268,10 +269,11 @@ static
 int intel_dp_hdcp_capable(struct intel_digital_port *dig_port,
  bool *hdcp_capable)
 {
+   struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev);
ssize_t ret;
u8 bcaps;
 
-   ret = intel_dp_hdcp_read_bcaps(dig_port, &bcaps);
+   ret = intel_dp_hdcp_read_bcaps(&dig_port->dp.aux, i915, &bcaps);
if (ret)
return ret;
 
@@ -639,8 +641,6 @@ static
 int _intel_dp_hdcp2_capable(struct drm_dp_aux *aux,
bool *capable)
 {
-   struct intel_digital_port *dig_port = 
intel_attached_dig_port(connector);
-   struct drm_dp_aux *aux = &dig_port->dp.aux;
u8 rx_caps[3];
int ret;
 
-- 
2.25.1



[PATCH 02/13] drm/i915/hdcp: Move source hdcp2 checks into its own function

2024-02-15 Thread Suraj Kandpal
Move checks on the source side for HDCP2.2 into its own function
so that they can be used in the HDCP remote capability check
function.

Signed-off-by: Suraj Kandpal 
Reviewed-by: Ankit Nautiyal 
---
 drivers/gpu/drm/i915/display/intel_hdcp.c | 20 +---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_hdcp.c 
b/drivers/gpu/drm/i915/display/intel_hdcp.c
index c3e692e7f790..4593ac10e2fa 100644
--- a/drivers/gpu/drm/i915/display/intel_hdcp.c
+++ b/drivers/gpu/drm/i915/display/intel_hdcp.c
@@ -160,12 +160,14 @@ bool intel_hdcp_capable(struct intel_connector *connector)
return capable;
 }
 
-/* Is HDCP2.2 capable on Platform and Sink */
-bool intel_hdcp2_capable(struct intel_connector *connector)
+/*
+ * Check if the source has all the building blocks ready to make
+ * HDCP 2.2 work
+ */
+static bool intel_hdcp2_prerequisite(struct intel_connector *connector)
 {
struct drm_i915_private *i915 = to_i915(connector->base.dev);
struct intel_hdcp *hdcp = &connector->hdcp;
-   bool capable = false;
 
/* I915 support for HDCP2.2 */
if (!hdcp->hdcp2_supported)
@@ -185,6 +187,18 @@ bool intel_hdcp2_capable(struct intel_connector *connector)
}
mutex_unlock(&i915->display.hdcp.hdcp_mutex);
 
+   return true;
+}
+
+/* Is HDCP2.2 capable on Platform and Sink */
+bool intel_hdcp2_capable(struct intel_connector *connector)
+{
+   struct intel_hdcp *hdcp = &connector->hdcp;
+   bool capable = false;
+
+   if (!intel_hdcp2_prerequisite(connector))
+   return false;
+
/* Sink's capability for HDCP2.2 */
hdcp->shim->hdcp_2_2_capable(connector, &capable);
 
-- 
2.25.1



[PATCH 00/13] HDCP MST Type1 fixes

2024-02-15 Thread Suraj Kandpal
We were seeing a blank screen whenever Type1 content was played.
This was due to extra timing which was taken as we had moved to
remote read and writes previously for MST scenario, which in turn
was done as we were not able to do direct read and writes to the
immediate downstream device.
The correct flow should be that we talk only to the immediate
downstream device and the rest needs to be taken care by that device.
With this patch series we move back to direct reads and writes,
fix the fastset setting because of which direct reads and writes to
HDCP related DPCD register stopped working, derive hdcp structure
correctly and increase robustability if rxcaps HDCP capability
reporting.

Signed-off-by: Suraj Kandpal 

Suraj Kandpal (13):
  drm/i915/hdcp: Move to direct reads for HDCP
  drm/i915/hdcp: Move source hdcp2 checks into its own function
  drm/i915/hdcp: Refactor intel_dp_hdcp2_capable
  drm/i915/hdcp: Pass drm_dp_aux to read_bcaps function
  drm/i915/hdcp: Rename hdcp capable functions
  drm/i915/hdcp: Add new remote capability check shim function
  drm/i915/hdcp: HDCP Capability for the downstream device
  drm/i915/hdcp: Remove additional timing for reading mst hdcp message
  drm/i915/hdcp: Extract hdcp structure from correct connector
  drm/i915/hdcp: Don't enable HDCP2.2 directly from check_link
  drm/i915/hdcp: Don't enable HDCP1.4 directly from check_link
  drm/i915/hdcp: Allocate stream id after HDCP AKE stage
  drm/i915/hdcp: Read Rxcaps for robustibility

 .../drm/i915/display/intel_display_debugfs.c  |  21 +-
 .../drm/i915/display/intel_display_types.h|  12 +-
 drivers/gpu/drm/i915/display/intel_dp_hdcp.c  | 137 +++
 drivers/gpu/drm/i915/display/intel_hdcp.c | 227 +-
 drivers/gpu/drm/i915/display/intel_hdcp.h |   7 +-
 drivers/gpu/drm/i915/display/intel_hdmi.c |   6 +-
 6 files changed, 229 insertions(+), 181 deletions(-)

-- 
2.25.1



[PATCH 01/13] drm/i915/hdcp: Move to direct reads for HDCP

2024-02-15 Thread Suraj Kandpal
Even for MST scenarios we need to do direct reads only on the
immediate downstream device the rest of the authentication is taken
care by that device. Remote reads will only be used to check
capability of the monitors in MST topology.

--v2
-Add fixes tag [Ankit]
-Derive aux where needed rather than through a function [Ankit]

Fixes: ae4f902bb344 ("drm/i915/hdcp: Send the correct aux for DPMST HDCP 
scenario")
Signed-off-by: Suraj Kandpal 
Reviewed-by: Ankit Nautiyal 
---
 drivers/gpu/drm/i915/display/intel_dp_hdcp.c | 31 ++--
 1 file changed, 9 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c 
b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c
index 3a595cd433d4..defc90936317 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c
@@ -330,23 +330,13 @@ static const struct hdcp2_dp_msg_data hdcp2_dp_msg_data[] 
= {
  0, 0 },
 };
 
-static struct drm_dp_aux *
-intel_dp_hdcp_get_aux(struct intel_connector *connector)
-{
-   struct intel_digital_port *dig_port = 
intel_attached_dig_port(connector);
-
-   if (intel_encoder_is_mst(connector->encoder))
-   return &connector->port->aux;
-   else
-   return &dig_port->dp.aux;
-}
-
 static int
 intel_dp_hdcp2_read_rx_status(struct intel_connector *connector,
  u8 *rx_status)
 {
struct drm_i915_private *i915 = to_i915(connector->base.dev);
-   struct drm_dp_aux *aux = intel_dp_hdcp_get_aux(connector);
+   struct intel_digital_port *dig_port = 
intel_attached_dig_port(connector);
+   struct drm_dp_aux *aux = &dig_port->dp.aux;
ssize_t ret;
 
ret = drm_dp_dpcd_read(aux,
@@ -454,8 +444,9 @@ int intel_dp_hdcp2_write_msg(struct intel_connector 
*connector,
unsigned int offset;
u8 *byte = buf;
ssize_t ret, bytes_to_write, len;
+   struct intel_digital_port *dig_port = 
intel_attached_dig_port(connector);
+   struct drm_dp_aux *aux = &dig_port->dp.aux;
const struct hdcp2_dp_msg_data *hdcp2_msg_data;
-   struct drm_dp_aux *aux;
 
hdcp2_msg_data = get_hdcp2_dp_msg_data(*byte);
if (!hdcp2_msg_data)
@@ -463,8 +454,6 @@ int intel_dp_hdcp2_write_msg(struct intel_connector 
*connector,
 
offset = hdcp2_msg_data->offset;
 
-   aux = intel_dp_hdcp_get_aux(connector);
-
/* No msg_id in DP HDCP2.2 msgs */
bytes_to_write = size - 1;
byte++;
@@ -490,7 +479,8 @@ static
 ssize_t get_receiver_id_list_rx_info(struct intel_connector *connector,
 u32 *dev_cnt, u8 *byte)
 {
-   struct drm_dp_aux *aux = intel_dp_hdcp_get_aux(connector);
+   struct intel_digital_port *dig_port = 
intel_attached_dig_port(connector);
+   struct drm_dp_aux *aux = &dig_port->dp.aux;
ssize_t ret;
u8 *rx_info = byte;
 
@@ -516,7 +506,7 @@ int intel_dp_hdcp2_read_msg(struct intel_connector 
*connector,
struct intel_digital_port *dig_port = 
intel_attached_dig_port(connector);
struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev);
struct intel_hdcp *hdcp = &connector->hdcp;
-   struct drm_dp_aux *aux;
+   struct drm_dp_aux *aux = &dig_port->dp.aux;
unsigned int offset;
u8 *byte = buf;
ssize_t ret, bytes_to_recv, len;
@@ -530,8 +520,6 @@ int intel_dp_hdcp2_read_msg(struct intel_connector 
*connector,
return -EINVAL;
offset = hdcp2_msg_data->offset;
 
-   aux = intel_dp_hdcp_get_aux(connector);
-
ret = intel_dp_hdcp2_wait_for_msg(connector, hdcp2_msg_data);
if (ret < 0)
return ret;
@@ -651,12 +639,11 @@ static
 int intel_dp_hdcp2_capable(struct intel_connector *connector,
   bool *capable)
 {
-   struct drm_dp_aux *aux;
+   struct intel_digital_port *dig_port = 
intel_attached_dig_port(connector);
+   struct drm_dp_aux *aux = &dig_port->dp.aux;
u8 rx_caps[3];
int ret;
 
-   aux = intel_dp_hdcp_get_aux(connector);
-
*capable = false;
ret = drm_dp_dpcd_read(aux,
   DP_HDCP_2_2_REG_RX_CAPS_OFFSET,
-- 
2.25.1



[PATCH 4/6] drm/i915/psr: Silence period and lfps half cycle

2024-02-15 Thread Jouni Högander
Add get function for silence period and lfps half cycle. Values are taken
from the tables in bspec.

Bspec: 71632

Signed-off-by: Jouni Högander 
---
 .../drm/i915/display/intel_display_types.h|  2 +
 drivers/gpu/drm/i915/display/intel_psr.c  | 77 ++-
 2 files changed, 77 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h 
b/drivers/gpu/drm/i915/display/intel_display_types.h
index df82551a3f42..1bb72e606367 100644
--- a/drivers/gpu/drm/i915/display/intel_display_types.h
+++ b/drivers/gpu/drm/i915/display/intel_display_types.h
@@ -1723,6 +1723,8 @@ struct intel_psr {
u8 check_entry_lines;
u8 aux_less_wake_lines;
u8 switch_to_active_lines;
+   u8 silence_period_sym_clocks;
+   u8 lfps_half_cycle_num_of_syms;
} alpm_parameters;
 
ktime_t last_entry_attempt;
diff --git a/drivers/gpu/drm/i915/display/intel_psr.c 
b/drivers/gpu/drm/i915/display/intel_psr.c
index 4cefb9ada5db..8385d8172b27 100644
--- a/drivers/gpu/drm/i915/display/intel_psr.c
+++ b/drivers/gpu/drm/i915/display/intel_psr.c
@@ -1126,6 +1126,72 @@ static bool 
_compute_psr2_sdp_prior_scanline_indication(struct intel_dp *intel_d
return true;
 }
 
+/*
+ * See Bspec: 71632 for the table
+ *
+ * Silence_period = tSilence,Min + ((tSilence,Max - tSilence,Min) / 2)
+ *
+ * Half cycle duration:
+ *
+ * Link rates 1.62 - 4.32 and tLFPS = 70 ns
+ * FLOOR( (Link Rate * tLFPS_Cycle) / (2 * 10) )
+ *
+ * Link rates 5.4 - 8.1
+ * FLOOR( LFPS Period in Symbol clocks /
+ * (2 * PORT_ALPM_LFPS_CTL[ LFPS Cycle Count ]) )
+ */
+static bool _lnl_get_silence_period_and_lfps_half_cycle(int link_rate,
+   int *silence_period,
+   int *lfps_half_cycle)
+{
+   switch (link_rate) {
+   case 162000:
+   *silence_period = 20;
+   *lfps_half_cycle = 5;
+   break;
+   case 216000:
+   *silence_period = 27;
+   *lfps_half_cycle = 7;
+   break;
+   case 243000:
+   *silence_period = 31;
+   *lfps_half_cycle = 8;
+   break;
+   case 27:
+   *silence_period = 34;
+   *lfps_half_cycle = 9;
+   break;
+   case 324000:
+   *silence_period = 41;
+   *lfps_half_cycle = 11;
+   break;
+   case 432000:
+   *silence_period = 56;
+   *lfps_half_cycle = 15;
+   break;
+   case 54:
+   *silence_period = 69;
+   *lfps_half_cycle = 12;
+   break;
+   case 648000:
+   *silence_period = 84;
+   *lfps_half_cycle = 15;
+   break;
+   case 675000:
+   *silence_period = 87;
+   *lfps_half_cycle = 15;
+   break;
+   case 81:
+   *silence_period = 104;
+   *lfps_half_cycle = 19;
+   break;
+   default:
+   *silence_period = *lfps_half_cycle = -1;
+   return false;
+   }
+   return true;
+}
+
 /*
  * AUX-Less Wake Time = CEILING( ((PHY P2 to P0) + tLFPS_Period, Max+
  * tSilence, Max+ tPHY Establishment + tCDS) / tline)
@@ -1170,7 +1236,8 @@ static int _lnl_compute_aux_less_alpm_params(struct 
intel_dp *intel_dp,
 struct intel_crtc_state 
*crtc_state)
 {
struct drm_i915_private *i915 = dp_to_i915(intel_dp);
-   int aux_less_wake_time, aux_less_wake_lines, switch_to_active_lines;
+   int aux_less_wake_time, aux_less_wake_lines, switch_to_active_lines,
+   silence_period, lfps_half_cycle;
 
aux_less_wake_time =
_lnl_compute_aux_less_wake_time(crtc_state->port_clock / 1000);
@@ -1182,7 +1249,11 @@ static int _lnl_compute_aux_less_alpm_params(struct 
intel_dp *intel_dp,
&crtc_state->hw.adjusted_mode,

_lnl_compute_switch_to_active_time(crtc_state->port_clock / 1000));
 
-   if (aux_less_wake_lines > 32 || switch_to_active_lines > 32)
+   if (aux_less_wake_lines > 32 || switch_to_active_lines > 32 ||
+   silence_period > 256 || silence_period < 0 ||
+   !_lnl_get_silence_period_and_lfps_half_cycle(intel_dp->link_rate,
+&silence_period,
+&lfps_half_cycle))
return false;
 
if (i915->display.params.psr_safest_params) {
@@ -1192,6 +1263,8 @@ static int _lnl_compute_aux_less_alpm_params(struct 
intel_dp *intel_dp,
 
intel_dp->psr.alpm_parameters.aux_less_wake_lines = aux_less_wake_lines;
intel_dp->psr.alpm_parameters.switch_to_active_lines = 
switch_to_active_lines;
+   intel_dp->psr.alpm_p

[PATCH 6/6] drm/i915/psr: Enable ALPM for eDP Panel replay

2024-02-15 Thread Jouni Högander
Enable ALPM AUX-Less for Panel Replay eDP. Also write all calculated
AUX-Less configuration values accordingly.

Bspec: 71477

Signed-off-by: Jouni Högander 
---
 drivers/gpu/drm/i915/display/intel_psr.c | 42 +---
 1 file changed, 38 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_psr.c 
b/drivers/gpu/drm/i915/display/intel_psr.c
index 8385d8172b27..a7faea61952e 100644
--- a/drivers/gpu/drm/i915/display/intel_psr.c
+++ b/drivers/gpu/drm/i915/display/intel_psr.c
@@ -1705,14 +1705,39 @@ static void lnl_alpm_configure(struct intel_dp 
*intel_dp)
struct drm_i915_private *dev_priv = dp_to_i915(intel_dp);
enum transcoder cpu_transcoder = intel_dp->psr.transcoder;
struct intel_psr *psr = &intel_dp->psr;
+   u32 alpm_ctl;
 
if (DISPLAY_VER(dev_priv) < 20)
return;
 
-   intel_de_write(dev_priv, ALPM_CTL(cpu_transcoder),
-  ALPM_CTL_EXTENDED_FAST_WAKE_ENABLE |
-  
ALPM_CTL_ALPM_ENTRY_CHECK(psr->alpm_parameters.check_entry_lines) |
-  
ALPM_CTL_EXTENDED_FAST_WAKE_TIME(psr->alpm_parameters.fast_wake_lines));
+   alpm_ctl = ALPM_CTL_EXTENDED_FAST_WAKE_ENABLE |
+   
ALPM_CTL_ALPM_ENTRY_CHECK(psr->alpm_parameters.check_entry_lines) |
+   
ALPM_CTL_EXTENDED_FAST_WAKE_TIME(psr->alpm_parameters.fast_wake_lines);
+
+   if (intel_dp->psr.panel_replay_enabled && intel_dp_is_edp(intel_dp)) {
+   alpm_ctl |= ALPM_CTL_ALPM_ENABLE | 
ALPM_CTL_ALPM_AUX_LESS_ENABLE;
+
+   intel_de_write(dev_priv, ALPM_CTL2(cpu_transcoder),
+  ALPM_CTL2_SWITCH_TO_ACTIVE_LATENCY(
+  
psr->alpm_parameters.switch_to_active_lines));
+
+   intel_de_write(dev_priv, PORT_ALPM_CTL(cpu_transcoder),
+  PORT_ALPM_CTL_ALPM_AUX_LESS_ENABLE |
+  PORT_ALPM_CTL_MAX_PHY_SWING_SETUP(15) |
+  PORT_ALPM_CTL_SILENCE_PERIOD(
+  
psr->alpm_parameters.silence_period_sym_clocks));
+
+   intel_de_write(dev_priv, PORT_ALPM_LFPS_CTL(cpu_transcoder),
+  PORT_ALPM_LFPS_CTL_LFPS_CYCLE_COUNT(10) |
+  PORT_ALPM_LFPS_CTL_LFPS_HALF_CYCLE_DURATION(
+  
psr->alpm_parameters.lfps_half_cycle_num_of_syms) |
+  
PORT_ALPM_LFPS_CTL_FIRST_LFPS_HALF_CYCLE_DURATION(
+  
psr->alpm_parameters.lfps_half_cycle_num_of_syms) |
+  PORT_ALPM_LFPS_CTL_LAST_LFPS_HALF_CYCLE_DURATION(
+  
psr->alpm_parameters.lfps_half_cycle_num_of_syms));
+   }
+
+   intel_de_write(dev_priv, ALPM_CTL(cpu_transcoder), alpm_ctl);
 }
 
 static void intel_psr_enable_source(struct intel_dp *intel_dp,
@@ -1983,6 +2008,15 @@ static void intel_psr_disable_locked(struct intel_dp 
*intel_dp)
 
intel_snps_phy_update_psr_power_state(dev_priv, phy, false);
 
+   if (intel_dp->psr.panel_replay_enabled && intel_dp_is_edp(intel_dp)) {
+   intel_de_rmw(dev_priv, ALPM_CTL(cpu_transcoder),
+ALPM_CTL_ALPM_ENABLE |
+ALPM_CTL_ALPM_AUX_LESS_ENABLE, 0);
+
+   intel_de_rmw(dev_priv, PORT_ALPM_CTL(cpu_transcoder),
+PORT_ALPM_CTL_ALPM_AUX_LESS_ENABLE, 0);
+   }
+
/* Disable PSR on Sink */
drm_dp_dpcd_writeb(&intel_dp->aux, DP_PSR_EN_CFG, 0);
 
-- 
2.34.1



[PATCH 1/6] drm/display: Add missing aux less alpm wake related bits

2024-02-15 Thread Jouni Högander
eDP1.5 adds some more bits into DP_RECEIVER_ALPM_CAP and
DP_RECEIVER_ALPM_CONFIG registers. Add definitions for these.

Signed-off-by: Jouni Högander 
---
 include/drm/display/drm_dp.h | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/include/drm/display/drm_dp.h b/include/drm/display/drm_dp.h
index 281afff6ee4e..fcee8d7c4717 100644
--- a/include/drm/display/drm_dp.h
+++ b/include/drm/display/drm_dp.h
@@ -232,6 +232,8 @@
 
 #define DP_RECEIVER_ALPM_CAP   0x02e   /* eDP 1.4 */
 # define DP_ALPM_CAP   (1 << 0)
+# define DP_ALPM_PM_STATE_2A_SUPPORT   (1 << 1) /* eDP 1.5 */
+# define DP_ALPM_AUX_LESS_CAP  (1 << 2) /* eDP 1.5 */
 
 #define DP_SINK_DEVICE_AUX_FRAME_SYNC_CAP   0x02f   /* eDP 1.4 */
 # define DP_AUX_FRAME_SYNC_CAP (1 << 0)
@@ -677,7 +679,8 @@
 
 #define DP_RECEIVER_ALPM_CONFIG0x116   /* eDP 1.4 */
 # define DP_ALPM_ENABLE(1 << 0)
-# define DP_ALPM_LOCK_ERROR_IRQ_HPD_ENABLE  (1 << 1)
+# define DP_ALPM_LOCK_ERROR_IRQ_HPD_ENABLE  (1 << 1) /* eDP 1.5 */
+# define DP_ALPM_MODE_AUX_LESS (1 << 2) /* eDP 1.5 */
 
 #define DP_SINK_DEVICE_AUX_FRAME_SYNC_CONF  0x117   /* eDP 1.4 */
 # define DP_AUX_FRAME_SYNC_ENABLE  (1 << 0)
-- 
2.34.1



  1   2   >