From: Carlos Eduardo Gallo Filho <gcarlos@disroot.org>
To: "André Almeida" <andrealmeid@igalia.com>,
"Maira Canal" <mairacanal@riseup.net>,
"Arthur Grillo" <arthurgrillo@riseup.net>,
"Tales Aparecida" <tales.aparecida@gmail.com>,
"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
"Maxime Ripard" <mripard@kernel.org>,
"Thomas Zimmermann" <tzimmermann@suse.de>,
"David Airlie" <airlied@gmail.com>,
"Daniel Vetter" <daniel@ffwll.ch>,
"Jani Nikula" <jani.nikula@linux.intel.com>,
"Joonas Lahtinen" <joonas.lahtinen@linux.intel.com>,
"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
"Tvrtko Ursulin" <tvrtko.ursulin@linux.intel.com>,
"Juha-Pekka Heikkila" <juhapekka.heikkila@gmail.com>,
"Ville Syrjälä" <ville.syrjala@linux.intel.com>,
"Matt Roper" <matthew.d.roper@intel.com>,
"Clint Taylor" <clinton.a.taylor@intel.com>,
"Carlos Eduardo Gallo Filho" <gcarlos@disroot.org>,
"Niranjana Vishwanathapura" <niranjana.vishwanathapura@intel.com>
Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: [Intel-gfx] [PATCH v2 1/2] drm: Remove plane hsub/vsub alignment requirement for core helpers
Date: Wed, 19 Jul 2023 23:19:36 -0300 [thread overview]
Message-ID: <20230720021937.27124-2-gcarlos@disroot.org> (raw)
In-Reply-To: <20230720021937.27124-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-07-20 2:22 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Carlos Eduardo Gallo Filho [this message]
2023-07-20 2:19 ` [Intel-gfx] [PATCH v2 2/2] drm: Replace drm_framebuffer plane size functions with its equivalents Carlos Eduardo Gallo Filho
2023-07-20 2:55 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm: Refactor plane size calculation by core helper functions Patchwork
2023-07-20 2:55 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2023-07-20 3:08 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2023-07-20 4:36 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
-- strict thread matches above, loose matches on Subject: below --
2023-09-26 14:15 [Intel-gfx] [RESEND PATCH v2 0/2] " Carlos Eduardo Gallo Filho
2023-09-26 14:15 ` [Intel-gfx] [PATCH v2 1/2] drm: Remove plane hsub/vsub alignment requirement for core helpers Carlos Eduardo Gallo Filho
2023-10-01 9:09 ` André Almeida
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=20230720021937.27124-2-gcarlos@disroot.org \
--to=gcarlos@disroot.org \
--cc=airlied@gmail.com \
--cc=andrealmeid@igalia.com \
--cc=arthurgrillo@riseup.net \
--cc=clinton.a.taylor@intel.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=joonas.lahtinen@linux.intel.com \
--cc=juhapekka.heikkila@gmail.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mairacanal@riseup.net \
--cc=matthew.d.roper@intel.com \
--cc=mripard@kernel.org \
--cc=niranjana.vishwanathapura@intel.com \
--cc=rodrigo.vivi@intel.com \
--cc=tales.aparecida@gmail.com \
--cc=tvrtko.ursulin@linux.intel.com \
--cc=tzimmermann@suse.de \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox