diff mbox series

[PATCHv4,17/36] drm/komeda: Free komeda_fb_afbc_size_check from framebuffer dependency

Message ID 20191213155907.16581-18-andrzej.p@collabora.com (mailing list archive)
State New, archived
Headers show
Series AFBC support for Rockchip | expand

Commit Message

Andrzej Pietrasiewicz Dec. 13, 2019, 3:58 p.m. UTC
It does still depend on komeda_fb, but only for komeda-specific parameters.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
---
 .../drm/arm/display/komeda/komeda_framebuffer.c   | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c b/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c
index 4e29fa5bd342..cc9dc8588e8d 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c
@@ -43,19 +43,18 @@  komeda_fb_afbc_size_check(struct komeda_fb *kfb,
 			  struct drm_file *file,
 			  const struct drm_mode_fb_cmd2 *mode_cmd)
 {
-	struct drm_framebuffer *fb = &kfb->base;
 	struct drm_gem_object *obj;
 	u32 alignment_w = 0, alignment_h = 0, alignment_header, n_blocks, bpp;
 	u64 min_size;
 
 	obj = objs[0];
 
-	if (!drm_afbc_get_superblock_wh(fb->modifier,
+	if (!drm_afbc_get_superblock_wh(mode_cmd->modifier[0],
 					&alignment_w, &alignment_h))
 		return -EINVAL;
 
 	/* tiled header afbc */
-	if (fb->modifier & AFBC_FORMAT_MOD_TILED) {
+	if (mode_cmd->modifier[0] & AFBC_FORMAT_MOD_TILED) {
 		alignment_w *= AFBC_TH_LAYOUT_ALIGNMENT;
 		alignment_h *= AFBC_TH_LAYOUT_ALIGNMENT;
 		alignment_header = AFBC_TH_BODY_START_ALIGNMENT;
@@ -63,10 +62,10 @@  komeda_fb_afbc_size_check(struct komeda_fb *kfb,
 		alignment_header = AFBC_BODY_START_ALIGNMENT;
 	}
 
-	kfb->aligned_w = ALIGN(fb->width, alignment_w);
-	kfb->aligned_h = ALIGN(fb->height, alignment_h);
+	kfb->aligned_w = ALIGN(mode_cmd->width, alignment_w);
+	kfb->aligned_h = ALIGN(mode_cmd->height, alignment_h);
 
-	if (fb->offsets[0] % alignment_header) {
+	if (mode_cmd->offsets[0] % alignment_header) {
 		DRM_DEBUG_KMS("afbc offset alignment check failed.\n");
 		return -EINVAL;
 	}
@@ -75,11 +74,11 @@  komeda_fb_afbc_size_check(struct komeda_fb *kfb,
 	kfb->offset_payload = ALIGN(n_blocks * AFBC_HEADER_SIZE,
 				    alignment_header);
 
-	bpp = komeda_get_afbc_format_bpp(info, fb->modifier);
+	bpp = komeda_get_afbc_format_bpp(info, mode_cmd->modifier[0]);
 	kfb->afbc_size = kfb->offset_payload + n_blocks *
 			 ALIGN(bpp * AFBC_SUPERBLK_PIXELS / 8,
 			       AFBC_SUPERBLK_ALIGNMENT);
-	min_size = kfb->afbc_size + fb->offsets[0];
+	min_size = kfb->afbc_size + mode_cmd->offsets[0];
 	if (min_size > obj->size) {
 		DRM_DEBUG_KMS("afbc size check failed, obj_size: 0x%zx. min_size 0x%llx.\n",
 			      obj->size, min_size);