From: Jani Nikula <jani.nikula@intel.com>
To: Vandita Kulkarni <vandita.kulkarni@intel.com>,
intel-gfx@lists.freedesktop.org
Subject: Re: [RFC 3/7] drm/i915/dsi: Add vblank calculation for command mode
Date: Tue, 15 Oct 2019 21:45:20 +0300 [thread overview]
Message-ID: <87tv89alvj.fsf@intel.com> (raw)
In-Reply-To: <20191014110122.31923-4-vandita.kulkarni@intel.com>
On Mon, 14 Oct 2019, Vandita Kulkarni <vandita.kulkarni@intel.com> wrote:
> Transcoder timing calculation differ for command mode.
>
> Signed-off-by: Vandita Kulkarni <vandita.kulkarni@intel.com>
> ---
> drivers/gpu/drm/i915/display/icl_dsi.c | 56 +++++++++++++++++---------
> 1 file changed, 37 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/icl_dsi.c b/drivers/gpu/drm/i915/display/icl_dsi.c
> index 8e6c09a1db78..5dd9eebab6b1 100644
> --- a/drivers/gpu/drm/i915/display/icl_dsi.c
> +++ b/drivers/gpu/drm/i915/display/icl_dsi.c
> @@ -780,6 +780,7 @@ gen11_dsi_set_transcoder_timings(struct intel_encoder *encoder,
> u16 hback_porch;
> /* vertical timings */
> u16 vtotal, vactive, vsync_start, vsync_end, vsync_shift;
> + int bpp, line_time_us, byte_clk_period_ns;
>
> hactive = adjusted_mode->crtc_hdisplay;
> htotal = adjusted_mode->crtc_htotal;
> @@ -841,40 +842,57 @@ gen11_dsi_set_transcoder_timings(struct intel_encoder *encoder,
> }
>
> /* program TRANS_VTOTAL register */
> - for_each_dsi_port(port, intel_dsi->ports) {
> - dsi_trans = dsi_port_to_transcoder(port);
> - /*
> - * FIXME: Programing this by assuming progressive mode, since
> - * non-interlaced info from VBT is not saved inside
> - * struct drm_display_mode.
> - * For interlace mode: program required pixel minus 2
> - */
> - I915_WRITE(VTOTAL(dsi_trans),
> - (vactive - 1) | ((vtotal - 1) << 16));
> + if (intel_dsi->operation_mode == INTEL_DSI_VIDEO_MODE) {
There's is_vid_mode() and is_cmd_mode(). Use them throughout the series
instead of the above.
> + for_each_dsi_port(port, intel_dsi->ports) {
> + dsi_trans = dsi_port_to_transcoder(port);
> + /*
> + * FIXME: Programing this by assuming progressive mode,
> + * since non-interlaced info from VBT is not saved
> + * inside struct drm_display_mode.
> + * For interlace mode: program required pixel minus 2
> + */
> + I915_WRITE(VTOTAL(dsi_trans),
> + (vactive - 1) | ((vtotal - 1) << 16));
> + }
> + } else {
> + for_each_dsi_port(port, intel_dsi->ports) {
> + bpp = mipi_dsi_pixel_format_to_bpp(intel_dsi->pixel_format);
> + byte_clk_period_ns = 8 * 1000000 / intel_dsi->pclk;
> + htotal = hactive + 160;
> + line_time_us = (htotal * (bpp / 8) * byte_clk_period_ns) / (1000 * intel_dsi->lane_count);
> + vtotal = vactive + DIV_ROUND_UP(460, line_time_us);
This is a bit hand-wavy, but some of these seem suspicious. Someone(tm)
needs to go through these in detail.
> + I915_WRITE(VTOTAL(dsi_trans),
> + (vactive - 1) | ((vtotal - 1) << 16));
> + }
> }
As the I915_WRITE() is the same for both, albeit with changed values for
cmd mode, I think it would be better to have the mode check within the
for_each_dsi_port() block.
>
> +
> if (vsync_end < vsync_start || vsync_end > vtotal)
> DRM_ERROR("Invalid vsync_end value\n");
>
> if (vsync_start < vactive)
> DRM_ERROR("vsync_start less than vactive\n");
>
> - /* program TRANS_VSYNC register */
> - for_each_dsi_port(port, intel_dsi->ports) {
> - dsi_trans = dsi_port_to_transcoder(port);
> - I915_WRITE(VSYNC(dsi_trans),
> - (vsync_start - 1) | ((vsync_end - 1) << 16));
> + /* program TRANS_VSYNC register for video mode only */
> + if (intel_dsi->operation_mode == INTEL_DSI_VIDEO_MODE) {
> + for_each_dsi_port(port, intel_dsi->ports) {
> + dsi_trans = dsi_port_to_transcoder(port);
> + I915_WRITE(VSYNC(dsi_trans),
> + (vsync_start - 1) | ((vsync_end - 1) << 16));
> + }
> }
>
> /*
> - * FIXME: It has to be programmed only for interlaced
> + * FIXME: It has to be programmed only for video modes and interlaced
> * modes. Put the check condition here once interlaced
> * info available as described above.
> * program TRANS_VSYNCSHIFT register
> */
> - for_each_dsi_port(port, intel_dsi->ports) {
> - dsi_trans = dsi_port_to_transcoder(port);
> - I915_WRITE(VSYNCSHIFT(dsi_trans), vsync_shift);
> + if (intel_dsi->operation_mode == INTEL_DSI_VIDEO_MODE) {
> + for_each_dsi_port(port, intel_dsi->ports) {
> + dsi_trans = dsi_port_to_transcoder(port);
> + I915_WRITE(VSYNCSHIFT(dsi_trans), vsync_shift);
> + }
> }
>
> /* program TRANS_VBLANK register, should be same as vtotal programmed */
--
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2019-10-15 18:44 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-14 11:01 [RFC 0/7] Add mipi dsi command mode support Vandita Kulkarni
2019-10-14 11:01 ` [RFC 1/7] drm/i915/dsi: Define command mode registers Vandita Kulkarni
2019-10-14 16:18 ` Ramalingam C
2019-10-15 7:52 ` Kulkarni, Vandita
2019-10-15 7:07 ` Jani Nikula
2019-10-15 7:50 ` Kulkarni, Vandita
2019-10-14 11:01 ` [RFC 2/7] drm/i915/dsi: Configure transcoder operation for command mode Vandita Kulkarni
2019-10-15 18:35 ` Jani Nikula
2019-10-24 11:37 ` Jani Nikula
2019-10-24 11:37 ` [Intel-gfx] " Jani Nikula
2019-10-24 11:52 ` Kulkarni, Vandita
2019-10-24 11:52 ` [Intel-gfx] " Kulkarni, Vandita
2019-10-14 11:01 ` [RFC 3/7] drm/i915/dsi: Add vblank calculation " Vandita Kulkarni
2019-10-15 18:45 ` Jani Nikula [this message]
2019-10-14 11:01 ` [RFC 4/7] drm/i915/dsi: Helper to find dsi encoder in cmd mode Vandita Kulkarni
2019-10-15 19:20 ` Jani Nikula
2019-10-16 13:27 ` Kulkarni, Vandita
2019-10-24 9:07 ` Jani Nikula
2019-10-24 9:07 ` [Intel-gfx] " Jani Nikula
2019-10-24 9:11 ` Jani Nikula
2019-10-24 9:11 ` [Intel-gfx] " Jani Nikula
2019-10-14 11:01 ` [RFC 5/7] drm/i915/dsi: Configure TE interrupt for " Vandita Kulkarni
2019-10-16 9:56 ` Ramalingam C
2019-10-24 11:34 ` Jani Nikula
2019-10-24 11:34 ` [Intel-gfx] " Jani Nikula
2019-10-14 11:01 ` [RFC 6/7] drm/i915/dsi: Add TE handler for dsi " Vandita Kulkarni
2019-10-15 8:28 ` Kulkarni, Vandita
2019-10-16 10:24 ` Ramalingam C
2019-10-16 12:46 ` Kulkarni, Vandita
2019-10-14 11:01 ` [RFC 7/7] drm/i915/dsi: Initiate frame request in " Vandita Kulkarni
2019-10-16 10:14 ` Ramalingam C
2019-10-16 12:37 ` Kulkarni, Vandita
2019-10-14 16:21 ` ✗ Fi.CI.CHECKPATCH: warning for Add mipi dsi command mode support Patchwork
2019-10-14 16:24 ` ✗ Fi.CI.SPARSE: " Patchwork
2019-10-14 17:07 ` ✓ Fi.CI.BAT: success " Patchwork
2019-10-15 0:42 ` ✓ Fi.CI.IGT: " 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=87tv89alvj.fsf@intel.com \
--to=jani.nikula@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=vandita.kulkarni@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.