From: "Michał Grzelak" <michal.grzelak@intel.com>
To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Cc: "Jani Nikula" <jani.nikula@intel.com>,
"Suraj Kandpal" <suraj.kandpal@intel.com>,
"Michał Grzelak" <michal.grzelak@intel.com>
Subject: [PATCH v10 4/8] drm/i915/bios: de/allocate VS/PE-O buffers for each port
Date: Thu, 2 Jul 2026 20:58:35 +0200 [thread overview]
Message-ID: <20260702185839.4042397-5-michal.grzelak@intel.com> (raw)
In-Reply-To: <20260702185839.4042397-1-michal.grzelak@intel.com>
Every devdata needs a VS/PE-O dedicated buffers since each port can
request an override. Add intel_ddi_buf_trans{,_entry} pointers into
intel_bios_encoder_data.
Allocate struct intel_ddi_buf_trans{,_entry} for the port if VS/PE-O was
requested and is supported. Keep NULL in vspeo if any allocation failed
or VS/PE-O was not requested. It will be used later for checking if
override should actually take place.
Note that we theoretically could store intel_ddi_buf_trans_entry inside
`entries` field of newly allocated intel_ddi_buf_trans. However it will
be impossible to overwrite the buffer during intel_ddi_get_buf_trans()
without discarding const qualifier of `entries` field. This would
involve either void casting or deconstifying entries field and in turn
all predefined tables as well. Thus add a separate non-const qualified
field into intel_bios_encoder_data for the buffer, which after
overwriting will be promoted to be const qualified.
Deallocate the buffer as well as entries if requested.
v9->v10
- add separate non-const field for `entries` caching
- cache `entries` into const field after data is overwritten (Jani)
v4->v5
- set devdata->vspeo->num_entries in intel_bios.c
Signed-off-by: Michał Grzelak <michal.grzelak@intel.com>
Reviewed-by: Suraj Kandpal <suraj.kandpal@intel.com>
---
drivers/gpu/drm/i915/display/intel_bios.c | 32 +++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i915/display/intel_bios.c
index 9610b794bc14..a491b8500611 100644
--- a/drivers/gpu/drm/i915/display/intel_bios.c
+++ b/drivers/gpu/drm/i915/display/intel_bios.c
@@ -34,6 +34,7 @@
#include <drm/drm_fixed.h>
#include <drm/drm_print.h>
+#include "intel_ddi_buf_trans.h"
#include "intel_display.h"
#include "intel_display_core.h"
#include "intel_display_rpm.h"
@@ -72,6 +73,8 @@
struct intel_bios_encoder_data {
struct intel_display *display;
+ struct intel_ddi_buf_trans *vspeo;
+ union intel_ddi_buf_trans_entry *entries;
struct child_device_config child;
struct dsc_compression_parameters_entry *dsc;
struct list_head node;
@@ -2648,6 +2651,29 @@ static void sanitize_device_type(struct intel_bios_encoder_data *devdata,
devdata->child.device_type |= DEVICE_TYPE_NOT_HDMI_OUTPUT;
}
+static void allocate_vswing_preemph_override(struct intel_bios_encoder_data *devdata)
+{
+ int num_rows = devdata->display->vbt.vspeo.num_rows;
+ union intel_ddi_buf_trans_entry *entries;
+ struct intel_ddi_buf_trans *vspeo;
+
+ if (!intel_bios_encoder_requests_vspeo(devdata))
+ return;
+
+ vspeo = kzalloc_obj(*vspeo);
+ if (!vspeo)
+ return;
+
+ entries = kzalloc_objs(*entries, num_rows);
+ if (!entries) {
+ kfree(vspeo);
+ return;
+ }
+
+ devdata->vspeo = vspeo;
+ devdata->entries = entries;
+}
+
static void sanitize_hdmi_level_shift(struct intel_bios_encoder_data *devdata,
enum port port)
{
@@ -2866,6 +2892,7 @@ static void parse_ddi_port(struct intel_bios_encoder_data *devdata)
sanitize_dedicated_external(devdata, port);
sanitize_device_type(devdata, port);
sanitize_hdmi_level_shift(devdata, port);
+ allocate_vswing_preemph_override(devdata);
}
static bool has_ddi_port_info(struct intel_display *display)
@@ -3403,6 +3430,11 @@ void intel_bios_driver_remove(struct intel_display *display)
list_for_each_entry_safe(devdata, nd, &display->vbt.display_devices,
node) {
list_del(&devdata->node);
+
+ if (devdata->vspeo)
+ kfree(devdata->vspeo->entries);
+
+ kfree(devdata->vspeo);
kfree(devdata->dsc);
kfree(devdata);
}
--
2.45.2
next prev parent reply other threads:[~2026-07-02 18:58 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-02 18:58 [PATCH v10 0/8] Vswing / Pre-emphasis Override Michał Grzelak
2026-07-02 18:58 ` [PATCH v10 1/8] drm/i915/bios: search for VBT #57 by default Michał Grzelak
2026-07-02 18:58 ` [PATCH v10 2/8] drm/i915/bios: store VBT #57's metadata in intel_vbt_data Michał Grzelak
2026-07-02 18:58 ` [PATCH v10 3/8] drm/i915/bios: print VS/PE-O port info Michał Grzelak
2026-07-02 18:58 ` Michał Grzelak [this message]
2026-07-02 18:58 ` [PATCH v10 5/8] drm/i915/buf_trans: add vfunc for VS/PE-O Michał Grzelak
2026-07-06 6:12 ` Kandpal, Suraj
2026-07-02 18:58 ` [PATCH v10 6/8] drm/i915: override Snps's VS/PE when requested Michał Grzelak
2026-08-11 15:48 ` Jani Nikula
2026-08-13 15:52 ` Michał Grzelak
2026-07-02 18:58 ` [PATCH v10 7/8] drm/i915: override Combo's " Michał Grzelak
2026-08-11 15:51 ` Jani Nikula
2026-07-02 18:58 ` [PATCH v10 8/8] drm/i915/bios: remove VS/PE-O warning Michał Grzelak
2026-07-02 19:06 ` ✗ CI.checkpatch: warning for Vswing / Pre-emphasis Override (rev5) Patchwork
2026-07-02 19:07 ` ✓ CI.KUnit: success " Patchwork
2026-07-02 20:07 ` ✓ Xe.CI.BAT: " Patchwork
2026-07-02 20:07 ` ✓ i915.CI.BAT: " Patchwork
2026-07-03 13:55 ` ✓ Xe.CI.FULL: " Patchwork
2026-07-03 15:39 ` ✗ i915.CI.Full: failure " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260702185839.4042397-5-michal.grzelak@intel.com \
--to=michal.grzelak@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=jani.nikula@intel.com \
--cc=suraj.kandpal@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.