|
| 1 | +construct: linux-next (drm-intel-next), for 7.4: VS/PE-O, patch 4 of 8 (see 0008). |
| 2 | + |
| 3 | +From a138a81d7805a025a778035c0850642381d1fdf9 Mon Sep 17 00:00:00 2001 |
| 4 | +From: Michał Grzelak <michal.grzelak@intel.com> |
| 5 | +Date: Fri, 4 Sep 2026 14:31:44 +0200 |
| 6 | +Subject: drm/i915/bios: de/allocate VS/PE-O buffers for each port |
| 7 | +MIME-Version: 1.0 |
| 8 | +Content-Type: text/plain; charset=UTF-8 |
| 9 | +Content-Transfer-Encoding: 8bit |
| 10 | + |
| 11 | +Every devdata needs VS/PE-O dedicated buffers since each port can |
| 12 | +request an override. Add intel_ddi_buf_trans{,_entry} pointers into |
| 13 | +intel_bios_encoder_data. |
| 14 | + |
| 15 | +Allocate struct intel_ddi_buf_trans{,_entry} for the port if VS/PE-O was |
| 16 | +requested and is supported. Keep NULL in vspeo if any allocation failed |
| 17 | +or VS/PE-O was not requested. It will be used later for checking if |
| 18 | +override should actually take place. |
| 19 | + |
| 20 | +Note that we theoretically could store intel_ddi_buf_trans_entry inside |
| 21 | +`entries` field of newly allocated intel_ddi_buf_trans. However it will |
| 22 | +be impossible to overwrite the buffer during intel_ddi_get_buf_trans() |
| 23 | +without discarding const qualifier of `entries` field. This would |
| 24 | +involve either void casting or deconstifying entries field and in turn |
| 25 | +all predefined tables as well. Thus add a separate non-const qualified |
| 26 | +field into intel_bios_encoder_data for the buffer, which after |
| 27 | +overwriting will be promoted to be const qualified. |
| 28 | + |
| 29 | +Deallocate the buffer as well as entries if requested. |
| 30 | + |
| 31 | +v11->v12 |
| 32 | +- set vspeo->num_entries once (Sashiko) |
| 33 | +- free allocated vspeo->entries (Sashiko) |
| 34 | + |
| 35 | +v9->v10 |
| 36 | +- add separate non-const field for `entries` caching |
| 37 | +- cache `entries` into const field after data is overwritten (Jani) |
| 38 | + |
| 39 | +v4->v5 |
| 40 | +- set devdata->vspeo->num_entries in intel_bios.c |
| 41 | + |
| 42 | +Signed-off-by: Michał Grzelak <michal.grzelak@intel.com> |
| 43 | +Reviewed-by: Suraj Kandpal <suraj.kandpal@intel.com> |
| 44 | +Acked-by: Jani Nikula <jani.nikula@intel.com> |
| 45 | +Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com> |
| 46 | +Link: https://patch.msgid.link/20260904123148.2165596-5-michal.grzelak@intel.com |
| 47 | +--- |
| 48 | + drivers/gpu/drm/i915/display/intel_bios.c | 31 +++++++++++++++++++++++++++++++ |
| 49 | + 1 file changed, 31 insertions(+) |
| 50 | + |
| 51 | +diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i915/display/intel_bios.c |
| 52 | +index 9610b794bc147..1a09f7933e491 100644 |
| 53 | +--- a/drivers/gpu/drm/i915/display/intel_bios.c |
| 54 | ++++ b/drivers/gpu/drm/i915/display/intel_bios.c |
| 55 | +@@ -34,6 +34,7 @@ |
| 56 | + #include <drm/drm_fixed.h> |
| 57 | + #include <drm/drm_print.h> |
| 58 | + |
| 59 | ++#include "intel_ddi_buf_trans.h" |
| 60 | + #include "intel_display.h" |
| 61 | + #include "intel_display_core.h" |
| 62 | + #include "intel_display_rpm.h" |
| 63 | +@@ -72,6 +73,8 @@ |
| 64 | + struct intel_bios_encoder_data { |
| 65 | + struct intel_display *display; |
| 66 | + |
| 67 | ++ struct intel_ddi_buf_trans *vspeo; |
| 68 | ++ union intel_ddi_buf_trans_entry *entries; |
| 69 | + struct child_device_config child; |
| 70 | + struct dsc_compression_parameters_entry *dsc; |
| 71 | + struct list_head node; |
| 72 | +@@ -2648,6 +2651,30 @@ static void sanitize_device_type(struct intel_bios_encoder_data *devdata, |
| 73 | + devdata->child.device_type |= DEVICE_TYPE_NOT_HDMI_OUTPUT; |
| 74 | + } |
| 75 | + |
| 76 | ++static void allocate_vswing_preemph_override(struct intel_bios_encoder_data *devdata) |
| 77 | ++{ |
| 78 | ++ int num_rows = devdata->display->vbt.vspeo.num_rows; |
| 79 | ++ union intel_ddi_buf_trans_entry *entries; |
| 80 | ++ struct intel_ddi_buf_trans *vspeo; |
| 81 | ++ |
| 82 | ++ if (!intel_bios_encoder_requests_vspeo(devdata)) |
| 83 | ++ return; |
| 84 | ++ |
| 85 | ++ vspeo = kzalloc_obj(*vspeo); |
| 86 | ++ if (!vspeo) |
| 87 | ++ return; |
| 88 | ++ |
| 89 | ++ entries = kzalloc_objs(*entries, num_rows); |
| 90 | ++ if (!entries) { |
| 91 | ++ kfree(vspeo); |
| 92 | ++ return; |
| 93 | ++ } |
| 94 | ++ |
| 95 | ++ devdata->entries = entries; |
| 96 | ++ devdata->vspeo = vspeo; |
| 97 | ++ devdata->vspeo->num_entries = num_rows; |
| 98 | ++} |
| 99 | ++ |
| 100 | + static void sanitize_hdmi_level_shift(struct intel_bios_encoder_data *devdata, |
| 101 | + enum port port) |
| 102 | + { |
| 103 | +@@ -2866,6 +2893,7 @@ static void parse_ddi_port(struct intel_bios_encoder_data *devdata) |
| 104 | + sanitize_dedicated_external(devdata, port); |
| 105 | + sanitize_device_type(devdata, port); |
| 106 | + sanitize_hdmi_level_shift(devdata, port); |
| 107 | ++ allocate_vswing_preemph_override(devdata); |
| 108 | + } |
| 109 | + |
| 110 | + static bool has_ddi_port_info(struct intel_display *display) |
| 111 | +@@ -3403,6 +3431,9 @@ void intel_bios_driver_remove(struct intel_display *display) |
| 112 | + list_for_each_entry_safe(devdata, nd, &display->vbt.display_devices, |
| 113 | + node) { |
| 114 | + list_del(&devdata->node); |
| 115 | ++ |
| 116 | ++ kfree(devdata->entries); |
| 117 | ++ kfree(devdata->vspeo); |
| 118 | + kfree(devdata->dsc); |
| 119 | + kfree(devdata); |
| 120 | + } |
| 121 | +-- |
| 122 | +cgit 1.3.1-korg |
| 123 | + |
0 commit comments