Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/ast: Remove vaddr field from struct ast_plane

The vaddr field in struct ast_plane serves no purpose. Its value
can be calculated easily from the VRAM base plus the plane offset.
Do so and remove the field.

In ast_primary_plane_helper_get_scanout_buffer(), remove the test
for vaddr being NULL. This cannot legally happen.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Link: https://lore.kernel.org/r/20250324094520.192974-3-tzimmermann@suse.de

+17 -14
+3 -5
drivers/gpu/drm/ast/ast_cursor.c
··· 91 91 static void ast_set_cursor_image(struct ast_device *ast, const u8 *src, 92 92 unsigned int width, unsigned int height) 93 93 { 94 - u8 __iomem *dst = ast->cursor_plane.base.vaddr; 94 + u8 __iomem *dst = ast_plane_vaddr(&ast->cursor_plane.base); 95 95 u32 csum; 96 96 97 97 csum = ast_cursor_calculate_checksum(src, width, height); ··· 193 193 struct ast_device *ast = to_ast_device(plane->dev); 194 194 struct drm_rect damage; 195 195 u64 dst_off = ast_plane->offset; 196 - u8 __iomem *dst = ast_plane->vaddr; /* TODO: Use mapping abstraction properly */ 196 + u8 __iomem *dst = ast_plane_vaddr(ast_plane); /* TODO: Use mapping abstraction properly */ 197 197 u8 __iomem *sig = dst + AST_HWC_SIZE; /* TODO: Use mapping abstraction properly */ 198 198 unsigned int offset_x, offset_y; 199 199 u16 x, y; ··· 291 291 struct ast_plane *ast_plane = &ast_cursor_plane->base; 292 292 struct drm_plane *cursor_plane = &ast_plane->base; 293 293 unsigned long size; 294 - void __iomem *vaddr; 295 294 long offset; 296 295 int ret; 297 296 ··· 298 299 offset = ast_cursor_vram_offset(ast); 299 300 if (offset < 0) 300 301 return offset; 301 - vaddr = ast->vram + offset; 302 302 303 - ret = ast_plane_init(dev, ast_plane, vaddr, offset, size, 303 + ret = ast_plane_init(dev, ast_plane, offset, size, 304 304 0x01, &ast_cursor_plane_funcs, 305 305 ast_cursor_plane_formats, ARRAY_SIZE(ast_cursor_plane_formats), 306 306 NULL, DRM_PLANE_TYPE_CURSOR);
+2 -2
drivers/gpu/drm/ast/ast_drv.h
··· 122 122 struct ast_plane { 123 123 struct drm_plane base; 124 124 125 - void __iomem *vaddr; 126 125 u64 offset; 127 126 unsigned long size; 128 127 }; ··· 442 443 /* ast_mode.c */ 443 444 int ast_mode_config_init(struct ast_device *ast); 444 445 int ast_plane_init(struct drm_device *dev, struct ast_plane *ast_plane, 445 - void __iomem *vaddr, u64 offset, unsigned long size, 446 + u64 offset, unsigned long size, 446 447 uint32_t possible_crtcs, 447 448 const struct drm_plane_funcs *funcs, 448 449 const uint32_t *formats, unsigned int format_count, 449 450 const uint64_t *format_modifiers, 450 451 enum drm_plane_type type); 452 + void __iomem *ast_plane_vaddr(struct ast_plane *ast); 451 453 452 454 #endif
+12 -7
drivers/gpu/drm/ast/ast_mode.c
··· 457 457 */ 458 458 459 459 int ast_plane_init(struct drm_device *dev, struct ast_plane *ast_plane, 460 - void __iomem *vaddr, u64 offset, unsigned long size, 460 + u64 offset, unsigned long size, 461 461 uint32_t possible_crtcs, 462 462 const struct drm_plane_funcs *funcs, 463 463 const uint32_t *formats, unsigned int format_count, ··· 466 466 { 467 467 struct drm_plane *plane = &ast_plane->base; 468 468 469 - ast_plane->vaddr = vaddr; 470 469 ast_plane->offset = offset; 471 470 ast_plane->size = size; 472 471 473 472 return drm_universal_plane_init(dev, plane, possible_crtcs, funcs, 474 473 formats, format_count, format_modifiers, 475 474 type, NULL); 475 + } 476 + 477 + void __iomem *ast_plane_vaddr(struct ast_plane *ast_plane) 478 + { 479 + struct ast_device *ast = to_ast_device(ast_plane->base.dev); 480 + 481 + return ast->vram + ast_plane->offset; 476 482 } 477 483 478 484 /* ··· 527 521 struct drm_framebuffer *fb, 528 522 const struct drm_rect *clip) 529 523 { 530 - struct iosys_map dst = IOSYS_MAP_INIT_VADDR_IOMEM(ast_plane->vaddr); 524 + struct iosys_map dst = IOSYS_MAP_INIT_VADDR_IOMEM(ast_plane_vaddr(ast_plane)); 531 525 532 526 iosys_map_incr(&dst, drm_fb_clip_offset(fb->pitches[0], fb->format, clip)); 533 527 drm_fb_memcpy(&dst, fb->pitches, src, fb, clip); ··· 600 594 { 601 595 struct ast_plane *ast_plane = to_ast_plane(plane); 602 596 603 - if (plane->state && plane->state->fb && ast_plane->vaddr) { 597 + if (plane->state && plane->state->fb) { 604 598 sb->format = plane->state->fb->format; 605 599 sb->width = plane->state->fb->width; 606 600 sb->height = plane->state->fb->height; 607 601 sb->pitch[0] = plane->state->fb->pitches[0]; 608 - iosys_map_set_vaddr_iomem(&sb->map[0], ast_plane->vaddr); 602 + iosys_map_set_vaddr_iomem(&sb->map[0], ast_plane_vaddr(ast_plane)); 609 603 return 0; 610 604 } 611 605 return -ENODEV; ··· 632 626 struct drm_device *dev = &ast->base; 633 627 struct ast_plane *ast_primary_plane = &ast->primary_plane; 634 628 struct drm_plane *primary_plane = &ast_primary_plane->base; 635 - void __iomem *vaddr = ast->vram; 636 629 u64 offset = ast_fb_vram_offset(); 637 630 unsigned long size = ast_fb_vram_size(ast); 638 631 int ret; 639 632 640 - ret = ast_plane_init(dev, ast_primary_plane, vaddr, offset, size, 633 + ret = ast_plane_init(dev, ast_primary_plane, offset, size, 641 634 0x01, &ast_primary_plane_funcs, 642 635 ast_primary_plane_formats, ARRAY_SIZE(ast_primary_plane_formats), 643 636 NULL, DRM_PLANE_TYPE_PRIMARY);