Re: [PATCH v2 1/2] drm: Remove plane hsub/vsub alignment requirement for core helpers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Carlos,

On 9/26/23 16:15, Carlos Eduardo Gallo Filho wrote:
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@xxxxxxxxxxxxxxx
[2] https://patchwork.freedesktop.org/patch/msgid/20211026225105.2783797-2-imre.deak@xxxxxxxxx

Prefer to use lore:

https://lore.kernel.org/dri-devel/20170321181218.10042-3-ville.syrjala@xxxxxxxxxxxxxxx/

https://lore.kernel.org/intel-gfx/20211026225105.2783797-2-imre.deak@xxxxxxxxx/


Other than that,

Reviewed-by: André Almeida <andrealmeid@xxxxxxxxxx>


Signed-off-by: Carlos Eduardo Gallo Filho <gcarlos@xxxxxxxxxxx>
---
  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);



[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux