[Intel-gfx] [PATCH v2 2/2] drm/i915/skl: distribute DDB based on panel resolution

Chris Wilson chris at chris-wilson.co.uk
Tue Jul 31 21:53:18 UTC 2018


Quoting Mahesh Kumar (2018-07-31 15:24:45)
> +       for_each_new_crtc_in_state(state, crtc, crtc_state, i) {
> +               const struct drm_display_mode *adjusted_mode;
> +               int hdisplay, vdisplay;
> +               enum pipe pipe;
> +
> +               if (!crtc_state->enable)
> +                       continue;
> +
> +               pipe = to_intel_crtc(crtc)->pipe;
> +               adjusted_mode = &crtc_state->adjusted_mode;
> +               drm_mode_get_hv_timing(adjusted_mode, &hdisplay, &vdisplay);

You should check with Ville whether the adjusted_mode is already
adjusted. But at any rate hdisplay is not affected by hv_timing.

> +               total_width += hdisplay;
> +
> +               if (pipe < for_pipe)
> +                       width_before_pipe += hdisplay;
> +               else if (pipe == for_pipe)
> +                       pipe_width = hdisplay;
> +       }
> +
> +       ddb_size_before_pipe = (ddb_size * width_before_pipe) / total_width;

ddb_size_before_pipe can just be alloc->start.
(brackets here) are redundant, so have a discussion as to whether they
aide or hinder comprehension.

> +       pipe_size = (ddb_size * pipe_width) / total_width;
> +       alloc->start = ddb_size_before_pipe;
>         alloc->end = alloc->start + pipe_size;

To avoid truncation fun (and prev_crtc->end != this_crtc->start), use
alloc->end = ddb_size * (width_before_pipe + pipe_width) / total_width;
-Chris


More information about the Intel-gfx mailing list