All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: Ville Syrjala <ville.syrjala@linux.intel.com>,
	intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v3 6/8] drm/i915: Overcome display engine stride limits via GTT remapping
Date: Tue, 23 Oct 2018 20:16:56 +0100	[thread overview]
Message-ID: <154032221683.9962.2032560963337898922@skylake-alporthouse-com> (raw)
In-Reply-To: <20180925193714.25280-7-ville.syrjala@linux.intel.com>

Quoting Ville Syrjala (2018-09-25 20:37:12)
> +static bool intel_plane_needs_remap(const struct intel_plane_state *plane_state)
> +{
> +       struct intel_plane *plane = to_intel_plane(plane_state->base.plane);
> +       struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
> +       const struct drm_framebuffer *fb = plane_state->base.fb;
> +       unsigned int rotation = plane_state->base.rotation;
> +       u32 stride, max_stride;
> +
> +       /* We don't want to deal with remapping with cursors */
> +       if (plane->id == PLANE_CURSOR)
> +               return false;
> +
> +       /* No fence for the remapped vma */

Should work now (with a minor tweak to plane_can_fence), right?

> +       if (INTEL_GEN(dev_priv) < 4)
> +               return false;
> +
> +       /* New CCS hash mode makes remapping impossible */
> +       if (is_ccs_modifier(fb->modifier))
> +               return false;
> +
> +       /* FIXME other color planes? */
> +       stride = intel_fb_pitch(fb, 0, rotation);
> +       max_stride = plane->max_stride(plane, fb->format->format,
> +                                      fb->modifier, rotation);
> +
> +       return stride > max_stride;
> +}
> +
>  static int
>  intel_fill_fb_info(struct drm_i915_private *dev_priv,
>                    struct drm_framebuffer *fb)
> @@ -2676,6 +2741,182 @@ intel_fill_fb_info(struct drm_i915_private *dev_priv,
>         return 0;
>  }
>  
> +static void
> +intel_plane_remap_gtt(struct intel_plane_state *plane_state)
> +{
> +       struct drm_i915_private *dev_priv =
> +               to_i915(plane_state->base.plane->dev);
> +       struct drm_framebuffer *fb = plane_state->base.fb;
> +       struct intel_framebuffer *intel_fb = to_intel_framebuffer(fb);
> +       struct intel_rotation_info *info = &plane_state->view.rotated;
> +       unsigned int rotation = plane_state->base.rotation;
> +       int i, num_planes = fb->format->num_planes;
> +       unsigned int tile_size = intel_tile_size(dev_priv);
> +       unsigned int tile_width, tile_height;
> +       unsigned int aligned_x, aligned_y;
> +       unsigned int aligned_w, aligned_h;
> +       unsigned int src_x, src_y;
> +       unsigned int src_w, src_h;
> +       unsigned int x, y;
> +       u32 gtt_offset = 0;
> +
> +       memset(&plane_state->view, 0, sizeof(plane_state->view));
> +       plane_state->view.type = drm_rotation_90_or_270(rotation) ?
> +               I915_GGTT_VIEW_ROTATED : I915_GGTT_VIEW_REMAPPED;
> +
> +       src_x = plane_state->base.src.x1 >> 16;
> +       src_y = plane_state->base.src.y1 >> 16;
> +       src_w = drm_rect_width(&plane_state->base.src) >> 16;
> +       src_h = drm_rect_height(&plane_state->base.src) >> 16;
> +
> +       WARN_ON(is_ccs_modifier(fb->modifier));
> +
> +       /* Align our viewport start to tile boundary */
> +       intel_tile_dims(fb, 0, &tile_width, &tile_height);
> +
> +       x = src_x & (tile_width - 1);
> +       y = src_y & (tile_height - 1);
> +
> +       aligned_x = src_x - x;
> +       aligned_y = src_y - y;
> +
> +       aligned_w = x + src_w;
> +       aligned_h = y + src_h;
> +
> +       /* Make src coordinates relative to the aligned viewport */
> +       drm_rect_translate(&plane_state->base.src,
> +                          -(aligned_x << 16), -(aligned_y << 16));
> +
> +       /* Rotate src coordinates to match rotated GTT view */
> +       if (drm_rotation_90_or_270(rotation))
> +               drm_rect_rotate(&plane_state->base.src,
> +                               aligned_w << 16, aligned_h << 16,
> +                               DRM_MODE_ROTATE_270);
> +
> +       for (i = 0; i < num_planes; i++) {
> +               unsigned int hsub = i ? fb->format->hsub : 1;
> +               unsigned int vsub = i ? fb->format->vsub : 1;
> +               unsigned int cpp = fb->format->cpp[i];
> +               unsigned int width, height;
> +               unsigned int pitch_tiles;
> +               unsigned int x, y;
> +               u32 offset;
> +
> +               intel_tile_dims(fb, i, &tile_width, &tile_height);
> +
> +               x = aligned_x / hsub;
> +               y = aligned_y / vsub;
> +               width = aligned_w / hsub;

aligned_w here seems to be just x2.

Did I miss aligned_w = ALIGN(aligned_w, tile_width) - aligned_x?

> +               height = aligned_h / vsub;
> +
> +               /*
> +                * First pixel of the aligned src viewport
> +                * from the start of the normal gtt mapping.
> +                */
> +               x += intel_fb->normal[i].x;
> +               y += intel_fb->normal[i].y;
> +
> +               offset = intel_compute_aligned_offset(dev_priv, &x, &y,
> +                                                     fb, i, fb->pitches[i],
> +                                                     DRM_MODE_ROTATE_0, tile_size);
> +               offset /= tile_size;
> +
> +               info->plane[i].offset = offset;
> +               info->plane[i].stride = DIV_ROUND_UP(fb->pitches[i],
> +                                                    tile_width * cpp);
> +               info->plane[i].width = DIV_ROUND_UP(x + width, tile_width);
> +               info->plane[i].height = DIV_ROUND_UP(y + height, tile_height);

I thought .width here would be in pages? Ok tile_width != fence_stride
and does produce pages just fine.

And shouldn't width here be adjusted for x? Similarly for height?
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2018-10-23 19:17 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-25 19:37 [PATCH v3 0/8] drm/i915: GTT remapping for display Ville Syrjala
2018-09-25 19:37 ` [PATCH v3 1/8] drm/i915: Make sure fb gtt offsets stay within 32bits Ville Syrjala
2018-09-25 20:29   ` Chris Wilson
2018-09-26  9:27     ` Ville Syrjälä
2018-09-26 20:09       ` Chris Wilson
2018-09-27 12:24         ` Ville Syrjälä
2018-10-23 16:02   ` [PATCH v4 " Ville Syrjala
2018-10-23 18:49     ` Chris Wilson
2018-10-23 19:16       ` Ville Syrjälä
2018-09-25 19:37 ` [PATCH v3 2/8] drm/i915: Decouple SKL stride units from intel_fb_stride_alignment() Ville Syrjala
2018-10-23 18:50   ` Chris Wilson
2018-09-25 19:37 ` [PATCH v3 3/8] drm/i915: Add a new "remapped" gtt_view Ville Syrjala
2018-09-26  7:50   ` Tvrtko Ursulin
2018-10-01 15:03     ` Ville Syrjälä
2018-10-01 15:12       ` Chris Wilson
2018-10-01 15:27         ` Ville Syrjälä
2018-10-01 15:37           ` Chris Wilson
2018-10-01 15:48             ` Tvrtko Ursulin
2018-10-05 18:42               ` Ville Syrjälä
2018-10-09  8:24                 ` Tvrtko Ursulin
2018-10-09  8:41                   ` Chris Wilson
2018-10-09 11:54                   ` Ville Syrjälä
2018-10-10  7:04                     ` Tvrtko Ursulin
2018-10-01 15:38           ` Tvrtko Ursulin
2018-10-01 15:35         ` Tvrtko Ursulin
2018-10-23 16:02   ` [PATCH v4 " Ville Syrjala
2018-10-23 18:56     ` Chris Wilson
2018-10-23 19:10       ` Ville Syrjälä
2018-10-26  9:19     ` Tvrtko Ursulin
2018-10-26 12:43       ` Ville Syrjälä
2018-10-26 12:48         ` Tvrtko Ursulin
2018-09-25 19:37 ` [PATCH v3 4/8] drm/i915/selftests: Add mock selftest for remapped vmas Ville Syrjala
2018-09-25 20:22   ` Chris Wilson
2018-09-26  9:28     ` Ville Syrjälä
2018-10-23 16:03   ` [PATCH v4 " Ville Syrjala
2018-10-23 19:02     ` Chris Wilson
2018-10-23 19:14       ` Ville Syrjälä
2018-09-25 19:37 ` [PATCH v3 5/8] drm/i915/selftests: Add live vma selftest Ville Syrjala
2018-09-25 20:19   ` Chris Wilson
2018-09-25 20:40   ` Chris Wilson
2018-09-26  9:33     ` Ville Syrjälä
2018-10-23 16:03   ` [PATCH v4 " Ville Syrjala
2018-10-23 19:05     ` Chris Wilson
2018-09-25 19:37 ` [PATCH v3 6/8] drm/i915: Overcome display engine stride limits via GTT remapping Ville Syrjala
2018-10-23 19:16   ` Chris Wilson [this message]
2018-10-25 13:45     ` Ville Syrjälä
2018-09-25 19:37 ` [PATCH v3 7/8] drm/i915: Bump gen4+ fb stride limit to 256KiB Ville Syrjala
2018-09-25 20:13   ` Chris Wilson
2018-09-28 19:19     ` Ville Syrjälä
2018-09-25 19:37 ` [PATCH v3 8/8] drm/i915: Bump gen7+ fb size limits to 16kx16k Ville Syrjala
2018-09-25 19:59   ` Chris Wilson
2018-09-26  9:25     ` Ville Syrjälä
2018-09-25 20:05 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: GTT remapping for display Patchwork
2018-09-25 20:08 ` ✗ Fi.CI.SPARSE: " Patchwork
2018-09-25 20:30 ` ✓ Fi.CI.BAT: success " Patchwork
2018-09-25 21:21 ` ✓ Fi.CI.IGT: " Patchwork
2018-10-23 16:21 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: GTT remapping for display (rev5) Patchwork
2018-10-23 16:24 ` ✗ Fi.CI.SPARSE: " Patchwork
2018-10-23 16:43 ` ✓ Fi.CI.BAT: success " Patchwork
2018-10-23 18:13 ` ✓ Fi.CI.IGT: " Patchwork
2019-01-09  9:45 ` [PATCH v3 0/8] drm/i915: GTT remapping for display Timo Aaltonen

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=154032221683.9962.2032560963337898922@skylake-alporthouse-com \
    --to=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=ville.syrjala@linux.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.