lkml.org 
[lkml]   [2018]   [Apr]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 4.4 113/190] drm/omap: fix tiled buffer stride calculations
    Date
    4.4-stable review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Tomi Valkeinen <tomi.valkeinen@ti.com>


    [ Upstream commit cc8dd7661ccc2d8dc88921da8e6cc7c2fcdb0341 ]

    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 changes the code to use DIV_ROUND_UP(), which fixes those
    calculations and makes them more readable.

    Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ---
    drivers/gpu/drm/omapdrm/omap_gem.c | 4 ++--
    1 file changed, 2 insertions(+), 2 deletions(-)

    --- a/drivers/gpu/drm/omapdrm/omap_gem.c
    +++ b/drivers/gpu/drm/omapdrm/omap_gem.c
    @@ -158,7 +158,7 @@ static void evict_entry(struct drm_gem_o
    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 = DIV_ROUND_UP(omap_obj->width << fmt, PAGE_SIZE);

    if (m > 1) {
    int i;
    @@ -415,7 +415,7 @@ static int fault_2d(struct drm_gem_objec
    * into account in some of the math, so figure out virtual stride
    * in pages
    */
    - const int m = 1 + ((omap_obj->width << fmt) / PAGE_SIZE);
    + const int m = DIV_ROUND_UP(omap_obj->width << fmt, PAGE_SIZE);

    /* We don't use vmf->pgoff since that has the fake offset: */
    pgoff = ((unsigned long)vmf->virtual_address -

    \
     
     \ /
      Last update: 2018-04-11 22:38    [W:2.111 / U:0.020 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site