Re: [PATCH] drm/omap: fix tiled buffer stride calculations

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

 



On Thu, May 18, 2017 at 02:14:35PM +0300, Tomi Valkeinen wrote:
> On 18/05/17 13:59, Laurent Pinchart wrote:
> > Hi Tomi,
> > 
> > Thank you for the patch.
> > 
> > On Thursday 18 May 2017 13:28:26 Tomi Valkeinen wrote:
> >> omap_gem uses page alignment for buffer stride. The related calculations
> >> are a bit off, though, as byte stride of 4096 gets aligned to 8192,
> >> instead of 4096. This patch fixes those calculations.
> >>
> >> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@xxxxxx>
> >> ---
> >>  drivers/gpu/drm/omapdrm/omap_gem.c | 4 ++--
> >>  1 file changed, 2 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/drivers/gpu/drm/omapdrm/omap_gem.c
> >> b/drivers/gpu/drm/omapdrm/omap_gem.c index 13abf221d153..4c41000ff4c4
> >> 100644
> >> --- a/drivers/gpu/drm/omapdrm/omap_gem.c
> >> +++ b/drivers/gpu/drm/omapdrm/omap_gem.c
> >> @@ -182,7 +182,7 @@ static void evict_entry(struct drm_gem_object *obj,
> >>  	size_t size = PAGE_SIZE * n;
> >>  	loff_t off = mmap_offset(obj) +
> >>  			(entry->obj_pgoff << PAGE_SHIFT);
> >> -	const int m = 1 + ((omap_obj->width << fmt) / PAGE_SIZE);
> >> +	const int m = 1 + (((omap_obj->width - 1) << fmt) / PAGE_SIZE);
> > 
> > How about 
> > 
> > 	int m = round_up(omap_obj->width << fmt, PAGE_SIZE);
> > 
> > instead of open-coding it ? I find that a bit easier to understand.
> 
> That should be:
> 
> round_up(omap_obj->width << fmt, PAGE_SIZE) / PAGE_SIZE;

Or a bit more optimally just DIV_ROUND_UP()

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[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