Re: [PATCH v4 3/4] drm/i915: Use new CRC debugfs API
From: Emil Velikov
Date: Fri Sep 02 2016 - 11:18:30 EST
Hi Tomeu,
IMHO it would be better to split out the refactoring into preparatory
patch. It brings a minor change which (not 100% sure on that) should
not cause issues but is worth pointing out.
On 5 August 2016 at 11:45, Tomeu Vizoso <tomeu.vizoso@xxxxxxxxxxxxx> wrote:
> +static int do_set_crc_source(struct drm_device *dev, enum pipe pipe,
> + enum intel_pipe_crc_source source)
> +{
> + if (source == INTEL_PIPE_CRC_SOURCE_NONE) {
Nit: use !source here or sourse != INTEL_PIPE_CRC_SOURCE_NONE
elsewhere in the code ?
> @@ -693,10 +718,11 @@ static int pipe_crc_set_source(struct drm_device *dev, enum pipe pipe,
> spin_unlock_irq(&pipe_crc->lock);
> }
>
> - pipe_crc->source = source;
> + ret = do_set_crc_source(dev, pipe, source);
> + if (ret)
> + goto out;
>
We seem to have modified pipe_crc even if the new function fails.
Haven't check if it matters, but definatelly not ideal.
> @@ -720,15 +746,6 @@ static int pipe_crc_set_source(struct drm_device *dev, enum pipe pipe,
> spin_unlock_irq(&pipe_crc->lock);
>
> kfree(entries);
> -
> - if (IS_G4X(dev))
> - g4x_undo_pipe_scramble_reset(dev, pipe);
> - else if (IS_VALLEYVIEW(dev) || IS_CHERRYVIEW(dev))
> - vlv_undo_pipe_scramble_reset(dev, pipe);
> - else if (IS_HASWELL(dev) && pipe == PIPE_A)
> - hsw_trans_edp_pipe_A_crc_wa(dev, false);
> -
> - hsw_enable_ips(crtc);
The above is the piece I have in mind:
With the introduction of do_set_crc_source() the above are executed
prior to the intel_wait_for_vblank() call.
Afaics this will not cause any functional change, then again I'm not
that familiar with the i915 vblank code.
> +int intel_crtc_set_crc_source(struct drm_crtc *crtc, const char *source_name,
> + size_t *values_cnt)
> +{
> + ret = do_set_crc_source(crtc->dev, crtc->index, source);
> +
> + intel_display_power_put(dev_priv, power_domain);
> +
> + *values_cnt = 5;
> +
Please don't overwrite values_cnt if the function fails.
Regards,
Emil