drm/komeda: Expose bus_width to Komeda-CORE
authorjames qian wang (Arm Technology China) <james.qian.wang@arm.com>
Tue, 22 Jan 2019 11:12:02 +0000 (11:12 +0000)
committerLiviu Dudau <Liviu.Dudau@arm.com>
Tue, 7 May 2019 10:26:04 +0000 (11:26 +0100)
CHIP set bus_width according to the HW configuration, and CORE will use
it as buffer alignment.

v2: Rebase

Signed-off-by: James Qian Wang (Arm Technology China) <james.qian.wang@arm.com>
Signed-off-by: Liviu Dudau <liviu.dudau@arm.com>
drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c
drivers/gpu/drm/arm/display/komeda/komeda_kms.c

index b01b628019baa5ce7536f997c8b8a4c36e7ef7d7..34506ef7ad40695e41b02b66e3a185130e912ff6 100644 (file)
@@ -520,6 +520,7 @@ d71_identify(u32 __iomem *reg_base, struct komeda_chip_info *chip)
        chip->arch_id   = malidp_read32(reg_base, GLB_ARCH_ID);
        chip->core_id   = malidp_read32(reg_base, GLB_CORE_ID);
        chip->core_info = malidp_read32(reg_base, GLB_CORE_INFO);
+       chip->bus_width = D71_BUS_WIDTH_16_BYTES;
 
        return &d71_chip_funcs;
 }
index e8573b03021fc920d9e2dceede5b61991ec49703..86f6542afb40d130ca61c0d79b83ac0e4a1142e2 100644 (file)
@@ -26,10 +26,10 @@ static int komeda_gem_cma_dumb_create(struct drm_file *file,
                                      struct drm_device *dev,
                                      struct drm_mode_create_dumb *args)
 {
-       u32 alignment = 16; /* TODO get alignment from dev */
+       struct komeda_dev *mdev = dev->dev_private;
+       u32 pitch = DIV_ROUND_UP(args->width * args->bpp, 8);
 
-       args->pitch = ALIGN(DIV_ROUND_UP(args->width * args->bpp, 8),
-                           alignment);
+       args->pitch = ALIGN(pitch, mdev->chip.bus_width);
 
        return drm_gem_cma_dumb_create_internal(file, dev, args);
 }