From: Carlos Eduardo Gallo Filho <gcarlos@disroot.org>
To: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Cc: "Matt Roper" <matthew.d.roper@intel.com>,
"André Almeida" <andrealmeid@igalia.com>,
"Daniel Vetter" <daniel@ffwll.ch>,
"Tales Aparecida" <tales.aparecida@gmail.com>,
"Carlos Eduardo Gallo Filho" <gcarlos@disroot.org>,
"Maxime Ripard" <mripard@kernel.org>,
"Maira Canal" <mairacanal@riseup.net>,
"Thomas Zimmermann" <tzimmermann@suse.de>,
"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
"David Airlie" <airlied@gmail.com>,
"Arthur Grillo" <arthurgrillo@riseup.net>
Subject: [Intel-gfx] [PATCH v2 1/2] drm: Remove plane hsub/vsub alignment requirement for core helpers
Date: Tue, 26 Sep 2023 11:15:18 -0300 [thread overview]
Message-ID: <20230926141519.9315-2-gcarlos@disroot.org> (raw)
In-Reply-To: <20230926141519.9315-1-gcarlos@disroot.org>
The drm_format_info_plane_{height,width} functions was implemented using
regular division for the plane size calculation, which cause issues [1][2]
when used on contexts where the dimensions are misaligned with relation
to the subsampling factors. So, replace the regular division by the
DIV_ROUND_UP macro.
This allows these functions to be used in more drivers, making further
work to bring more core presence on them possible.
[1] http://patchwork.freedesktop.org/patch/msgid/20170321181218.10042-3-ville.syrjala@linux.intel.com
[2] https://patchwork.freedesktop.org/patch/msgid/20211026225105.2783797-2-imre.deak@intel.com
Signed-off-by: Carlos Eduardo Gallo Filho <gcarlos@disroot.org>
---
include/drm/drm_fourcc.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/include/drm/drm_fourcc.h b/include/drm/drm_fourcc.h
index 532ae78ca747..ccf91daa4307 100644
--- a/include/drm/drm_fourcc.h
+++ b/include/drm/drm_fourcc.h
@@ -22,6 +22,7 @@
#ifndef __DRM_FOURCC_H__
#define __DRM_FOURCC_H__
+#include <linux/math.h>
#include <linux/types.h>
#include <uapi/drm/drm_fourcc.h>
@@ -279,7 +280,7 @@ int drm_format_info_plane_width(const struct drm_format_info *info, int width,
if (plane == 0)
return width;
- return width / info->hsub;
+ return DIV_ROUND_UP(width, info->hsub);
}
/**
@@ -301,7 +302,7 @@ int drm_format_info_plane_height(const struct drm_format_info *info, int height,
if (plane == 0)
return height;
- return height / info->vsub;
+ return DIV_ROUND_UP(height, info->vsub);
}
const struct drm_format_info *__drm_format_info(u32 format);
--
2.41.0
next prev parent reply other threads:[~2023-09-26 14:15 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-26 14:15 [Intel-gfx] [RESEND PATCH v2 0/2] drm: Refactor plane size calculation by core helper functions Carlos Eduardo Gallo Filho
2023-09-26 14:15 ` Carlos Eduardo Gallo Filho [this message]
2023-10-01 9:09 ` [Intel-gfx] [PATCH v2 1/2] drm: Remove plane hsub/vsub alignment requirement for core helpers André Almeida
2023-09-26 14:15 ` [Intel-gfx] [PATCH v2 2/2] drm: Replace drm_framebuffer plane size functions with its equivalents Carlos Eduardo Gallo Filho
2023-10-01 9:10 ` André Almeida
2023-09-26 14:33 ` [Intel-gfx] [RESEND PATCH v2 0/2] drm: Refactor plane size calculation by core helper functions Helen Koike
2023-09-26 14:46 ` Thomas Zimmermann
2023-09-26 21:19 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm: Refactor plane size calculation by core helper functions (rev2) Patchwork
2023-09-26 21:19 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2023-09-26 21:36 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
-- strict thread matches above, loose matches on Subject: below --
2023-07-20 2:19 [Intel-gfx] [PATCH v2 0/2] drm: Refactor plane size calculation by core helper functions Carlos Eduardo Gallo Filho
2023-07-20 2:19 ` [Intel-gfx] [PATCH v2 1/2] drm: Remove plane hsub/vsub alignment requirement for core helpers Carlos Eduardo Gallo Filho
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=20230926141519.9315-2-gcarlos@disroot.org \
--to=gcarlos@disroot.org \
--cc=airlied@gmail.com \
--cc=andrealmeid@igalia.com \
--cc=arthurgrillo@riseup.net \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=mairacanal@riseup.net \
--cc=matthew.d.roper@intel.com \
--cc=mripard@kernel.org \
--cc=rodrigo.vivi@intel.com \
--cc=tales.aparecida@gmail.com \
--cc=tzimmermann@suse.de \
/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