From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Suraj Kandpal <suraj.kandpal@intel.com>
Cc: intel-xe@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
sowmiya.s@intel.com, uma.shankar@intel.com,
swati2.sharma@intel.com, chaitanya.kumar.borah@intel.com,
arun.r.murthy@intel.com
Subject: Re: [PATCH v3 18/26] drm/i915/writeback: Define writeback frame capture function
Date: Wed, 25 Mar 2026 14:33:49 +0200 [thread overview]
Message-ID: <acPWLdgT46MhXJL9@intel.com> (raw)
In-Reply-To: <20260325110744.1096786-19-suraj.kandpal@intel.com>
On Wed, Mar 25, 2026 at 04:37:36PM +0530, Suraj Kandpal wrote:
> Define the commit function to be called at atomic_commit_tail
> if drm_writeback_job is available. This function calls the
> capture function and queues the job to be called later via
> interrupt handler when the job is complete.
>
> Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
> ---
> drivers/gpu/drm/i915/display/intel_display.c | 3 +
> .../gpu/drm/i915/display/intel_writeback.c | 58 +++++++++++++++++++
> .../gpu/drm/i915/display/intel_writeback.h | 4 ++
> 3 files changed, 65 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index d433ffaadd65..4cc3e0779e8a 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -126,6 +126,7 @@
> #include "intel_vga.h"
> #include "intel_vrr.h"
> #include "intel_wm.h"
> +#include "intel_writeback.h"
> #include "skl_scaler.h"
> #include "skl_universal_plane.h"
> #include "skl_watermark.h"
> @@ -7564,6 +7565,8 @@ static void intel_atomic_commit_tail(struct intel_atomic_state *state)
> /* FIXME probably need to sequence this properly */
> intel_program_dpkgc_latency(state);
>
> + intel_writeback_atomic_commit(state);
> +
> intel_wait_for_vblank_workers(state);
>
> /* FIXME: We should call drm_atomic_helper_commit_hw_done() here
> diff --git a/drivers/gpu/drm/i915/display/intel_writeback.c b/drivers/gpu/drm/i915/display/intel_writeback.c
> index d45d5faaf7cc..c79e7330b81c 100644
> --- a/drivers/gpu/drm/i915/display/intel_writeback.c
> +++ b/drivers/gpu/drm/i915/display/intel_writeback.c
> @@ -51,6 +51,12 @@ static const u32 writeback_formats[] = {
> DRM_FORMAT_XBGR2101010,
> };
>
> +static struct intel_writeback_connector
> +*conn_to_intel_writeback_connector(struct intel_connector *connector)
> +{
> + return container_of(connector, struct intel_writeback_connector, connector);
> +}
> +
> static struct intel_writeback_connector
> *enc_to_intel_writeback_connector(struct intel_encoder *encoder)
> {
> @@ -224,6 +230,58 @@ static int intel_writeback_atomic_check(struct drm_connector *connector,
> return 0;
> }
>
> +static void intel_writeback_capture(struct intel_atomic_state *state,
> + struct intel_connector *connector)
> +{
> + struct intel_display *display = to_intel_display(connector);
> + struct intel_writeback_connector *wb_conn =
> + conn_to_intel_writeback_connector(connector);
> + enum transcoder trans = wb_conn->trans;
> + u32 val = 0;
> +
> + val |= START_TRIGGER_FRAME | WD_FRAME_NUMBER(wb_conn->frame_num);
> + intel_de_rmw(display, WD_TRANS_FUNC_CTL(trans),
> + START_TRIGGER_FRAME | WD_FRAME_NUMBER_MASK,
> + val);
> +
> + if (intel_de_wait_for_set_ms(display, WD_FRAME_STATUS(trans),
> + WD_FRAME_COMPLETE, 50)) {
I think we need to hook up the interrupts to avoid this kind of thing.
The trigger we should probably just do from intel_pipe_update_end().
> + drm_dbg_kms(display->drm,
> + "Frame was not captured after triggering a capture\n");
> + intel_de_rmw(display, WD_TRANS_FUNC_CTL(trans),
> + STOP_TRIGGER_FRAME,
> + STOP_TRIGGER_FRAME);
> + } else {
> + drm_writeback_signal_completion(&connector->base, 0);
> + intel_de_write(display, WD_FRAME_STATUS(trans), WD_FRAME_COMPLETE);
> + wb_conn->frame_num++;
> + if (wb_conn->frame_num > 7)
> + wb_conn->frame_num = 1;
> + wb_conn->job = NULL;
> + }
> +}
> +
> +void intel_writeback_atomic_commit(struct intel_atomic_state *state)
> +{
> + struct drm_connector *connector;
> + struct drm_connector_state *conn_state;
> + int i;
> +
> + for_each_new_connector_in_state(&state->base, connector, conn_state, i) {
> + struct intel_connector *intel_connector = to_intel_connector(connector);
> +
> + if (!conn_state)
> + return;
> +
> + if (conn_state->writeback_job && conn_state->writeback_job->fb) {
> + WARN_ON(connector->connector_type != DRM_MODE_CONNECTOR_WRITEBACK);
> +
> + drm_writeback_queue_job(connector, conn_state);
> + intel_writeback_capture(state, intel_connector);
> + }
> + }
> +}
> +
> static void intel_writeback_enable_encoder(struct intel_atomic_state *state,
> struct intel_encoder *encoder,
> const struct intel_crtc_state *crtc_state,
> diff --git a/drivers/gpu/drm/i915/display/intel_writeback.h b/drivers/gpu/drm/i915/display/intel_writeback.h
> index 5911684cb81a..3c145cf73e20 100644
> --- a/drivers/gpu/drm/i915/display/intel_writeback.h
> +++ b/drivers/gpu/drm/i915/display/intel_writeback.h
> @@ -8,10 +8,14 @@
>
> #include <linux/types.h>
>
> +#include "intel_display_types.h"
> +
> +struct intel_atomic_state;
> struct intel_display;
> struct intel_writeback_connector;
>
> int intel_writeback_init(struct intel_display *display);
> +void intel_writeback_atomic_commit(struct intel_atomic_state *state);
>
> #endif /* __INTEL_WRITEBACK_H__ */
>
> --
> 2.34.1
--
Ville Syrjälä
Intel
next prev parent reply other threads:[~2026-03-25 12:33 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-25 11:07 [PATCH v3 00/26] Enable Pipe writeback Suraj Kandpal
2026-03-25 11:07 ` [PATCH v3 DO NOT REVIEW 01/26] drm: writeback: rename drm_writeback_connector_init_with_encoder() Suraj Kandpal
2026-03-25 11:07 ` [PATCH v3 DO NOT REVIEW 02/26] drm: writeback: Refactor drm_writeback_connector structure Suraj Kandpal
2026-03-25 11:07 ` [PATCH v3 03/26] drm/i915/writeback: Add writeback registers Suraj Kandpal
2026-03-25 11:42 ` Ville Syrjälä
2026-03-26 2:31 ` Kandpal, Suraj
2026-03-25 11:07 ` [PATCH v3 04/26] drm/i915/writeback: Add some preliminary writeback definitions Suraj Kandpal
2026-03-25 11:52 ` Ville Syrjälä
2026-03-26 2:37 ` Kandpal, Suraj
2026-03-25 11:07 ` [PATCH v3 05/26] drm/i915/writeback: Init writeback connector Suraj Kandpal
2026-03-25 12:15 ` Ville Syrjälä
2026-03-26 2:52 ` Kandpal, Suraj
2026-03-25 11:07 ` [PATCH v3 06/26] drm/i915/writeback: Add function to get modes Suraj Kandpal
2026-03-25 11:07 ` [PATCH v3 07/26] drm/i915/writeback: Add hook to check modes Suraj Kandpal
2026-03-25 11:07 ` [PATCH v3 08/26] drm/i915/writeback: Define encoder->get_hw_state Suraj Kandpal
2026-03-25 12:08 ` Ville Syrjälä
2026-03-25 11:07 ` [PATCH v3 09/26] drm/i915/writeback: Fill encoder->get_config Suraj Kandpal
2026-03-25 12:15 ` Ville Syrjälä
2026-03-26 2:52 ` Kandpal, Suraj
2026-03-25 11:07 ` [PATCH v3 10/26] drm/i915/writeback: Add private structure for writeback job Suraj Kandpal
2026-03-25 12:17 ` Ville Syrjälä
2026-03-26 2:53 ` Kandpal, Suraj
2026-03-25 11:07 ` [PATCH v3 11/26] drm/i915/writeback: Define function for prepare and cleanup hooks Suraj Kandpal
2026-03-25 12:29 ` Ville Syrjälä
2026-03-25 11:07 ` [PATCH v3 12/26] drm/i915/writeback: Define compute_config for writeback Suraj Kandpal
2026-03-25 12:19 ` Ville Syrjälä
2026-03-26 3:38 ` Kandpal, Suraj
2026-03-25 11:07 ` [PATCH v3 13/26] drm/i915/writeback: Define function for connector function detect Suraj Kandpal
2026-03-25 12:22 ` Ville Syrjälä
2026-03-25 11:07 ` [PATCH v3 14/26] drm/i915/writeback: Define function to destroy writeback connector Suraj Kandpal
2026-03-25 12:23 ` Ville Syrjälä
2026-03-26 3:39 ` Kandpal, Suraj
2026-03-25 11:07 ` [PATCH v3 15/26] drm/i915/writeback: Add connector atomic check Suraj Kandpal
2026-03-25 12:25 ` Ville Syrjälä
2026-03-26 3:43 ` Kandpal, Suraj
2026-03-25 11:07 ` [PATCH v3 16/26] drm/i915/writeback: Add writeback to xe Makefile Suraj Kandpal
2026-03-25 12:25 ` Ville Syrjälä
2026-03-26 3:44 ` Kandpal, Suraj
2026-03-25 11:07 ` [PATCH v3 17/26] drm/i915/writeback: Add the enable sequence from writeback Suraj Kandpal
2026-03-25 12:31 ` Ville Syrjälä
2026-03-25 11:07 ` [PATCH v3 18/26] drm/i915/writeback: Define writeback frame capture function Suraj Kandpal
2026-03-25 12:33 ` Ville Syrjälä [this message]
2026-03-26 3:47 ` Kandpal, Suraj
2026-03-25 11:07 ` [PATCH v3 19/26] drm/{i915/xe}/writeback: Add a writeback helper to get ggtt address Suraj Kandpal
2026-03-25 11:07 ` [PATCH v3 20/26] drm/i915/writeback: Configure WD_STRIDE reg Suraj Kandpal
2026-03-25 12:35 ` Ville Syrjälä
2026-03-26 3:52 ` Kandpal, Suraj
2026-03-25 11:07 ` [PATCH v3 21/26] drm/i915/writeback: Configure WD_SURF register Suraj Kandpal
2026-03-25 11:07 ` [PATCH v3 22/26] drm/i915/writeback: Enable writeback interrupts Suraj Kandpal
2026-03-25 12:59 ` Ville Syrjälä
2026-03-25 11:07 ` [PATCH v3 23/26] drm/i915/writeback: Initialize writeback encoder Suraj Kandpal
2026-03-25 13:00 ` Ville Syrjälä
2026-03-26 4:01 ` Kandpal, Suraj
2026-03-25 11:07 ` [PATCH v3 24/26] drm/i915/writeback: Define the disable sequence for writeback Suraj Kandpal
2026-03-25 11:07 ` [PATCH v3 25/26] drm/i915/writeback: Make exception for writeback connector Suraj Kandpal
2026-03-25 11:07 ` [PATCH v3 26/26] drm/i915/writeback: Modify state verify function Suraj Kandpal
2026-03-25 13:01 ` Ville Syrjälä
2026-03-26 3:57 ` Kandpal, Suraj
2026-03-25 11:19 ` ✗ CI.checkpatch: warning for Enable Pipe writeback (rev3) Patchwork
2026-03-25 11:20 ` ✓ CI.KUnit: success " 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=acPWLdgT46MhXJL9@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=arun.r.murthy@intel.com \
--cc=chaitanya.kumar.borah@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=sowmiya.s@intel.com \
--cc=suraj.kandpal@intel.com \
--cc=swati2.sharma@intel.com \
--cc=uma.shankar@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox