On ma, 2016-12-12 at 11:53 +0000, Chris Wilson wrote: > For power-of-two alignments, we can avoid the 64bit divide and do a > simple bitwise add instead. > > Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> > --- > drivers/gpu/drm/drm_mm.c | 9 ++++++++- > include/drm/drm_mm.h | 1 + > 2 files changed, 9 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c > index eec0a46f5b38..7245483f1111 100644 > --- a/drivers/gpu/drm/drm_mm.c > +++ b/drivers/gpu/drm/drm_mm.c > @@ -741,8 +741,12 @@ void drm_mm_scan_init_with_range(struct drm_mm_scan *scan, > > scan->mm = mm; > > + if (alignment <= 1) > + alignment = 0; > + > scan->color = color; > scan->alignment = alignment; > + scan->alignment_mask = is_power_of_2(alignment) ? alignment - 1 : 0; One would assume alignment_mask to be the bit-opposite, really. reminder_mask should describe it better. And sprinkle a likely() for the POT case, because I think that's something to expect. With above comments; Reviewed-by: Joonas Lahtinen <joonas.lahtinen@xxxxxxxxxxxxxxx> Regards, Joonas -- Joonas Lahtinen Open Source Technology Center Intel Corporation _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx