From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Imre Deak <imre.deak@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH 18/23] drm/i915: Shrink the size of intel_remapped_plane_info struct
Date: Thu, 11 Mar 2021 21:45:14 +0200 [thread overview]
Message-ID: <YEpzSj9TVv1wFrSr@intel.com> (raw)
In-Reply-To: <20210310221736.2963264-19-imre.deak@intel.com>
On Thu, Mar 11, 2021 at 12:17:31AM +0200, Imre Deak wrote:
> Save some place in the GTT VMAs by using a u16 instead of unsigned int
> to store the view dimensions. The maximum FB stride is 256kB which is
> 4096 tiles in the worst case (yf-tiles), the maximum FB height is 16k
> pixels, which is 2048 tiles in the worst case (x-tiles).
Actually I think the worst case for height is remapping linear fbs
since we more or less treat it as 4kx1 tiles. But 16k is still< 64k
so should be all good.
Integer promotion stuff/etc. is what worried me the most here, but
looks like rotate_pages()/remap_pages() at least gets everything
passed in as unsigned int, so we're not in danger of sign bit
shenanigans there at least.
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Signed-off-by: Imre Deak <imre.deak@intel.com>
> ---
> drivers/gpu/drm/i915/display/intel_fb.c | 15 ++++++++++++---
> drivers/gpu/drm/i915/i915_vma_types.h | 12 ++++++++----
> 2 files changed, 20 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_fb.c b/drivers/gpu/drm/i915/display/intel_fb.c
> index 16a1b5c922bb..51c56f0a4a99 100644
> --- a/drivers/gpu/drm/i915/display/intel_fb.c
> +++ b/drivers/gpu/drm/i915/display/intel_fb.c
> @@ -619,13 +619,22 @@ static u32 calc_plane_remap_info(const struct intel_framebuffer *fb, int color_p
> unsigned int tile_width = dims->tile_width;
> unsigned int tile_height = dims->tile_height;
> unsigned int tile_size = intel_tile_size(i915);
> + unsigned int stride_tiles = plane_view_stride_tiles(fb, color_plane, dims);
> + unsigned int width_tiles = DIV_ROUND_UP(x + dims->width, dims->tile_width);
> + unsigned int height_tiles = plane_view_tile_rows(fb, color_plane, dims, y);
> unsigned int pitch_tiles;
> struct drm_rect r;
>
> + drm_WARN_ON(&i915->drm,
> + overflows_type(obj_offset, gtt_remap_info->offset) ||
> + overflows_type(stride_tiles, gtt_remap_info->stride) ||
> + overflows_type(width_tiles, gtt_remap_info->width) ||
> + overflows_type(height_tiles, gtt_remap_info->height));
> +
> gtt_remap_info->offset = obj_offset;
> - gtt_remap_info->width = DIV_ROUND_UP(x + dims->width, dims->tile_width);
> - gtt_remap_info->height = plane_view_tile_rows(fb, color_plane, dims, y);
> - gtt_remap_info->stride = plane_view_stride_tiles(fb, color_plane, dims);
> + gtt_remap_info->stride = stride_tiles;
> + gtt_remap_info->width = width_tiles;
> + gtt_remap_info->height = height_tiles;
>
> if (view_type == I915_GGTT_VIEW_ROTATED) {
> /* rotate the x/y offsets to match the GTT view */
> diff --git a/drivers/gpu/drm/i915/i915_vma_types.h b/drivers/gpu/drm/i915/i915_vma_types.h
> index f5cb848b7a7e..358b4306fc00 100644
> --- a/drivers/gpu/drm/i915/i915_vma_types.h
> +++ b/drivers/gpu/drm/i915/i915_vma_types.h
> @@ -97,12 +97,16 @@ enum i915_cache_level;
>
> struct intel_remapped_plane_info {
> /* in gtt pages */
> - unsigned int width, height, stride, offset;
> + u32 offset;
> + u16 width;
> + u16 height;
> + u16 stride;
> + u16 unused_mbz;
> } __packed;
>
> struct intel_remapped_info {
> struct intel_remapped_plane_info plane[2];
> - unsigned int unused_mbz;
> + u32 unused_mbz;
> } __packed;
>
> struct intel_rotation_info {
> @@ -123,9 +127,9 @@ enum i915_ggtt_view_type {
>
> static inline void assert_i915_gem_gtt_types(void)
> {
> - BUILD_BUG_ON(sizeof(struct intel_rotation_info) != 8*sizeof(unsigned int));
> + BUILD_BUG_ON(sizeof(struct intel_rotation_info) != 2 * sizeof(u32) + 8 * sizeof(u16));
> BUILD_BUG_ON(sizeof(struct intel_partial_info) != sizeof(u64) + sizeof(unsigned int));
> - BUILD_BUG_ON(sizeof(struct intel_remapped_info) != 9*sizeof(unsigned int));
> + BUILD_BUG_ON(sizeof(struct intel_remapped_info) != 3 * sizeof(u32) + 8 * sizeof(u16));
>
> /* Check that rotation/remapped shares offsets for simplicity */
> BUILD_BUG_ON(offsetof(struct intel_remapped_info, plane[0]) !=
> --
> 2.25.1
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2021-03-11 19:45 UTC|newest]
Thread overview: 64+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-10 22:17 [Intel-gfx] [PATCH 00/23] drm/i915: Add support for FBs requiring a POT stride padding Imre Deak
2021-03-10 22:17 ` [Intel-gfx] [PATCH 01/23] drm/i915: Fix rotation setup during plane HW readout Imre Deak
2021-03-11 16:04 ` Ville Syrjälä
2021-03-11 16:52 ` Imre Deak
2021-03-11 17:25 ` Ville Syrjälä
2021-03-10 22:17 ` [Intel-gfx] [PATCH 02/23] drm/i915/selftest: Fix error handling in igt_vma_remapped_gtt() Imre Deak
2021-03-11 16:05 ` Ville Syrjälä
2021-03-10 22:17 ` [Intel-gfx] [PATCH 03/23] drm/i915/selftest: Fix debug message " Imre Deak
2021-03-11 16:06 ` Ville Syrjälä
2021-03-10 22:17 ` [Intel-gfx] [PATCH 04/23] drm/i915: Make sure i915_ggtt_view is inited when creating an FB Imre Deak
2021-03-11 16:07 ` Ville Syrjälä
2021-03-10 22:17 ` [Intel-gfx] [PATCH 05/23] drm/i915/selftest: Make sure to init i915_ggtt_view in igt_vma_rotate_remap() Imre Deak
2021-03-11 16:11 ` Ville Syrjälä
2021-03-10 22:17 ` [Intel-gfx] [PATCH 06/23] drm/i915: Remove duplicate intel_surf_alignment() declaration Imre Deak
2021-03-11 16:12 ` Ville Syrjälä
2021-03-10 22:17 ` [Intel-gfx] [PATCH 07/23] drm/i915/intel_fb: Pull FB plane functions from intel_display_types.h Imre Deak
2021-03-11 16:15 ` Ville Syrjälä
2021-03-11 16:31 ` Imre Deak
2021-03-10 22:17 ` [Intel-gfx] [PATCH 08/23] drm/i915/intel_fb: Pull FB plane functions from skl_universal_plane.c Imre Deak
2021-03-11 16:18 ` Ville Syrjälä
2021-03-10 22:17 ` [Intel-gfx] [PATCH 09/23] drm/i915/intel_fb: Pull is_surface_linear() from intel_display.c/skl_universal_plane.c Imre Deak
2021-03-11 16:19 ` Ville Syrjälä
2021-03-10 22:17 ` [Intel-gfx] [PATCH 10/23] drm/i915/intel_fb: Pull FB plane functions from intel_sprite.c Imre Deak
2021-03-11 16:20 ` Ville Syrjälä
2021-03-10 22:17 ` [Intel-gfx] [PATCH 11/23] drm/i915/intel_fb: Pull FB plane functions from intel_display.c Imre Deak
2021-03-11 16:23 ` Ville Syrjälä
2021-03-10 22:17 ` [Intel-gfx] [PATCH 12/23] drm/i915/intel_fb: Unexport intel_fb_check_stride() Imre Deak
2021-03-11 16:23 ` Ville Syrjälä
2021-03-10 22:17 ` [Intel-gfx] [PATCH 13/23] drm/i915/intel_fb: s/dev_priv/i915/ Imre Deak
2021-03-11 16:23 ` Ville Syrjälä
2021-03-10 22:17 ` [Intel-gfx] [PATCH 14/23] drm/i915/intel_fb: Factor out convert_plane_offset_to_xy() Imre Deak
2021-03-11 16:32 ` Ville Syrjälä
2021-03-11 16:37 ` Ville Syrjälä
2021-03-11 16:57 ` Imre Deak
2021-03-10 22:17 ` [Intel-gfx] [PATCH 15/23] drm/i915/intel_fb: Factor out calc_plane_aligned_offset() Imre Deak
2021-03-11 16:39 ` Ville Syrjälä
2021-03-10 22:17 ` [Intel-gfx] [PATCH 16/23] drm/i915/intel_fb: Factor out calc_plane_normal_size() Imre Deak
2021-03-11 16:52 ` Ville Syrjälä
2021-03-11 17:02 ` Imre Deak
2021-03-11 17:26 ` Ville Syrjälä
2021-03-11 17:47 ` Imre Deak
2021-03-11 17:58 ` Ville Syrjälä
2021-03-10 22:17 ` [Intel-gfx] [PATCH 17/23] drm/i915/intel_fb: Factor out plane_calc_remap_info() Imre Deak
2021-03-11 17:21 ` Ville Syrjälä
2021-03-11 19:04 ` Imre Deak
2021-03-11 19:35 ` Ville Syrjälä
2021-03-10 22:17 ` [Intel-gfx] [PATCH 18/23] drm/i915: Shrink the size of intel_remapped_plane_info struct Imre Deak
2021-03-11 19:45 ` Ville Syrjälä [this message]
2021-03-11 22:19 ` Imre Deak
2021-03-12 18:09 ` Ville Syrjälä
2021-03-10 22:17 ` [Intel-gfx] [PATCH 19/23] drm/i915/selftest: Unify use of intel_remapped_plane_info in igt_vma_rotate_remap() Imre Deak
2021-03-11 21:17 ` Ville Syrjälä
2021-03-10 22:17 ` [Intel-gfx] [PATCH 20/23] drm/i915: s/stride/src_stride/ in the intel_remapped_plane_info struct Imre Deak
2021-03-12 17:51 ` Ville Syrjälä
2021-03-10 22:17 ` [Intel-gfx] [PATCH 21/23] drm/i915: Add support for FBs requiring a POT stride alignment Imre Deak
2021-03-12 18:02 ` Ville Syrjälä
2021-03-13 14:36 ` Imre Deak
2021-03-15 14:44 ` Ville Syrjälä
2021-03-10 22:17 ` [Intel-gfx] [PATCH 22/23] drm/i915/selftest: Add remap/rotate vma subtests when dst_stride!=width/height Imre Deak
2021-03-12 18:03 ` Ville Syrjälä
2021-03-10 22:17 ` [Intel-gfx] [PATCH 23/23] drm/i915: For-CI: Force remapping the FB with a POT aligned stride Imre Deak
2021-03-10 23:53 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Add support for FBs requiring a POT stride padding Patchwork
2021-03-10 23:54 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2021-03-11 0:22 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " 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=YEpzSj9TVv1wFrSr@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=imre.deak@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
/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