Commit 932a62aa authored by Thomas Zimmermann's avatar Thomas Zimmermann

drm/ast: Update cursor image and checksum from same function

Cursor image and checksum go hand in hand. Update both in the same
place. The helper cannot fail, so remove the return type.
Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Acked-by: default avatarSam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200702115029.5281-5-tzimmermann@suse.de
parent dd004b9a
...@@ -84,7 +84,7 @@ void ast_cursor_fini(struct ast_private *ast) ...@@ -84,7 +84,7 @@ void ast_cursor_fini(struct ast_private *ast)
} }
} }
static u32 copy_cursor_image(u8 *src, u8 *dst, int width, int height) static void update_cursor_image(u8 __iomem *dst, const u8 *src, int width, int height)
{ {
union { union {
u32 ul; u32 ul;
...@@ -96,7 +96,8 @@ static u32 copy_cursor_image(u8 *src, u8 *dst, int width, int height) ...@@ -96,7 +96,8 @@ static u32 copy_cursor_image(u8 *src, u8 *dst, int width, int height)
} data16; } data16;
u32 csum = 0; u32 csum = 0;
s32 alpha_dst_delta, last_alpha_dst_delta; s32 alpha_dst_delta, last_alpha_dst_delta;
u8 *srcxor, *dstxor; u8 __iomem *dstxor;
const u8 *srcxor;
int i, j; int i, j;
u32 per_pixel_copy, two_pixel_copy; u32 per_pixel_copy, two_pixel_copy;
...@@ -137,16 +138,6 @@ static u32 copy_cursor_image(u8 *src, u8 *dst, int width, int height) ...@@ -137,16 +138,6 @@ static u32 copy_cursor_image(u8 *src, u8 *dst, int width, int height)
} }
dstxor += last_alpha_dst_delta; dstxor += last_alpha_dst_delta;
} }
return csum;
}
static int ast_cursor_update(void *dst, void *src, unsigned int width,
unsigned int height)
{
u32 csum;
/* do data transfer to cursor cache */
csum = copy_cursor_image(src, dst, width, height);
/* write checksum + signature */ /* write checksum + signature */
dst += AST_HWC_SIZE; dst += AST_HWC_SIZE;
...@@ -155,8 +146,6 @@ static int ast_cursor_update(void *dst, void *src, unsigned int width, ...@@ -155,8 +146,6 @@ static int ast_cursor_update(void *dst, void *src, unsigned int width,
writel(height, dst + AST_HWC_SIGNATURE_SizeY); writel(height, dst + AST_HWC_SIGNATURE_SizeY);
writel(0, dst + AST_HWC_SIGNATURE_HOTSPOTX); writel(0, dst + AST_HWC_SIGNATURE_HOTSPOTX);
writel(0, dst + AST_HWC_SIGNATURE_HOTSPOTY); writel(0, dst + AST_HWC_SIGNATURE_HOTSPOTY);
return 0;
} }
int ast_cursor_blit(struct ast_private *ast, struct drm_framebuffer *fb) int ast_cursor_blit(struct ast_private *ast, struct drm_framebuffer *fb)
...@@ -188,9 +177,8 @@ int ast_cursor_blit(struct ast_private *ast, struct drm_framebuffer *fb) ...@@ -188,9 +177,8 @@ int ast_cursor_blit(struct ast_private *ast, struct drm_framebuffer *fb)
goto err_drm_gem_vram_vunmap_src; goto err_drm_gem_vram_vunmap_src;
} }
ret = ast_cursor_update(dst, src, fb->width, fb->height); /* do data transfer to cursor BO */
if (ret) update_cursor_image(dst, src, fb->width, fb->height);
goto err_drm_gem_vram_vunmap_dst;
/* /*
* Always unmap buffers here. Destination buffers are * Always unmap buffers here. Destination buffers are
...@@ -203,8 +191,6 @@ int ast_cursor_blit(struct ast_private *ast, struct drm_framebuffer *fb) ...@@ -203,8 +191,6 @@ int ast_cursor_blit(struct ast_private *ast, struct drm_framebuffer *fb)
return 0; return 0;
err_drm_gem_vram_vunmap_dst:
drm_gem_vram_vunmap(ast->cursor.gbo[ast->cursor.next_index], dst);
err_drm_gem_vram_vunmap_src: err_drm_gem_vram_vunmap_src:
drm_gem_vram_vunmap(gbo, src); drm_gem_vram_vunmap(gbo, src);
err_drm_gem_vram_unpin: err_drm_gem_vram_unpin:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment