Re: [PATCH 01/14] drm/ast: Move cursor functions to ast_cursor.c

2020-07-02 Thread Thomas Zimmermann
Hi Sam

Am 24.06.20 um 08:24 schrieb Thomas Zimmermann:
> Hi Sam
> 
> Am 23.06.20 um 18:55 schrieb Sam Ravnborg:
>> Hi Thomas.
>>
>> On Tue, Jun 23, 2020 at 10:18:48AM +0200, Thomas Zimmermann wrote:
>>> The cursor manipulation functions are unrelated to modesetting. Move
>>> them into their own file.
>>>
>>> Signed-off-by: Thomas Zimmermann 
>>> ---
>>>  drivers/gpu/drm/ast/Makefile |   3 +-
>>>  drivers/gpu/drm/ast/ast_cursor.c | 218 +++
>>>  drivers/gpu/drm/ast/ast_drv.h|   9 ++
>>>  drivers/gpu/drm/ast/ast_mode.c   | 195 ---
>>>  4 files changed, 229 insertions(+), 196 deletions(-)
>>>  create mode 100644 drivers/gpu/drm/ast/ast_cursor.c
>>>
>>> diff --git a/drivers/gpu/drm/ast/Makefile b/drivers/gpu/drm/ast/Makefile
>>> index 561f7c4199e4..6a5b3b247316 100644
>>> --- a/drivers/gpu/drm/ast/Makefile
>>> +++ b/drivers/gpu/drm/ast/Makefile
>>> @@ -3,6 +3,7 @@
>>>  # Makefile for the drm device driver.  This driver provides support for the
>>>  # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
>>>  
>>> -ast-y := ast_drv.o ast_main.o ast_mode.o ast_ttm.o ast_post.o ast_dp501.o
>>> +ast-y := ast_cursor.o ast_drv.o ast_main.o ast_mode.o ast_ttm.o ast_post.o 
>>> \
>>> +ast_dp501.o
>>>  
>>>  obj-$(CONFIG_DRM_AST) := ast.o
>>> diff --git a/drivers/gpu/drm/ast/ast_cursor.c 
>>> b/drivers/gpu/drm/ast/ast_cursor.c
>>> new file mode 100644
>>> index ..53bb6eebc7cd
>>> --- /dev/null
>>> +++ b/drivers/gpu/drm/ast/ast_cursor.c
>>> @@ -0,0 +1,218 @@
>>> +/*
>>> + * Copyright 2012 Red Hat Inc.
>>> + * Parts based on xf86-video-ast
>>> + * Copyright (c) 2005 ASPEED Technology Inc.
>>> + *
>>> + * Permission is hereby granted, free of charge, to any person obtaining a
>>> + * copy of this software and associated documentation files (the
>>> + * "Software"), to deal in the Software without restriction, including
>>> + * without limitation the rights to use, copy, modify, merge, publish,
>>> + * distribute, sub license, and/or sell copies of the Software, and to
>>> + * permit persons to whom the Software is furnished to do so, subject to
>>> + * the following conditions:
>>> + *
>>> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 
>>> OR
>>> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
>>> + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
>>> + * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY 
>>> CLAIM,
>>> + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
>>> + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR 
>>> THE
>>> + * USE OR OTHER DEALINGS IN THE SOFTWARE.
>>> + *
>>> + * The above copyright notice and this permission notice (including the
>>> + * next paragraph) shall be included in all copies or substantial portions
>>> + * of the Software.
>>
>> SPDX for new files?
>> I guess this boilerplate was copied from the old file.
> 
> Yes, I copied the license text from the old file. I wasn't sure if I can
> just add the SPDX tag. If that's not a problem, I'll add it in the next
> iteration.

I found that it's the MIT license, but not quite. Paragraphs are in
different order and some words are spelled differently. I don't know
what the legal implications are, so I don't want to put the SPDX tag
onto it. It might be better addressed in a separate patchset.

Best regards
Thomas

> 
> Best regards
> Thomas
> 
>>
>> Acked-by: Sam Ravnborg 
>>
>>> + */
>>> +/*
>>> + * Authors: Dave Airlie 
>>> + */
>>> +
>>> +#include 
>>> +
>>> +#include "ast_drv.h"
>>> +
>>> +/*
>>> + * Allocate cursor BOs and pins them at the end of VRAM.
>>> + */
>>> +int ast_cursor_init(struct drm_device *dev)
>>> +{
>>> +   struct ast_private *ast = to_ast_private(dev);
>>> +   size_t size, i;
>>> +   struct drm_gem_vram_object *gbo;
>>> +   int ret;
>>> +
>>> +   size = roundup(AST_HWC_SIZE + AST_HWC_SIGNATURE_SIZE, PAGE_SIZE);
>>> +
>>> +   for (i = 0; i < ARRAY_SIZE(ast->cursor.gbo); ++i) {
>>> +   gbo = drm_gem_vram_create(dev, size, 0);
>>> +   if (IS_ERR(gbo)) {
>>> +   ret = PTR_ERR(gbo);
>>> +   goto err_drm_gem_vram_put;
>>> +   }
>>> +   ret = drm_gem_vram_pin(gbo, DRM_GEM_VRAM_PL_FLAG_VRAM |
>>> +   DRM_GEM_VRAM_PL_FLAG_TOPDOWN);
>>> +   if (ret) {
>>> +   drm_gem_vram_put(gbo);
>>> +   goto err_drm_gem_vram_put;
>>> +   }
>>> +
>>> +   ast->cursor.gbo[i] = gbo;
>>> +   }
>>> +
>>> +   return 0;
>>> +
>>> +err_drm_gem_vram_put:
>>> +   while (i) {
>>> +   --i;
>>> +   gbo = ast->cursor.gbo[i];
>>> +   drm_gem_vram_unpin(gbo);
>>> +   drm_gem_vram_put(gbo);
>>> +   ast->cursor.gbo[i] = NULL;
>>> +   }
>>> +   return ret;
>>> +}
>>> +
>>> +void ast_cursor_fini(struct drm_device *dev)
>>> +{
>>> +   s

Re: [PATCH 01/14] drm/ast: Move cursor functions to ast_cursor.c

2020-06-23 Thread Thomas Zimmermann
Hi Sam

Am 23.06.20 um 18:55 schrieb Sam Ravnborg:
> Hi Thomas.
> 
> On Tue, Jun 23, 2020 at 10:18:48AM +0200, Thomas Zimmermann wrote:
>> The cursor manipulation functions are unrelated to modesetting. Move
>> them into their own file.
>>
>> Signed-off-by: Thomas Zimmermann 
>> ---
>>  drivers/gpu/drm/ast/Makefile |   3 +-
>>  drivers/gpu/drm/ast/ast_cursor.c | 218 +++
>>  drivers/gpu/drm/ast/ast_drv.h|   9 ++
>>  drivers/gpu/drm/ast/ast_mode.c   | 195 ---
>>  4 files changed, 229 insertions(+), 196 deletions(-)
>>  create mode 100644 drivers/gpu/drm/ast/ast_cursor.c
>>
>> diff --git a/drivers/gpu/drm/ast/Makefile b/drivers/gpu/drm/ast/Makefile
>> index 561f7c4199e4..6a5b3b247316 100644
>> --- a/drivers/gpu/drm/ast/Makefile
>> +++ b/drivers/gpu/drm/ast/Makefile
>> @@ -3,6 +3,7 @@
>>  # Makefile for the drm device driver.  This driver provides support for the
>>  # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
>>  
>> -ast-y := ast_drv.o ast_main.o ast_mode.o ast_ttm.o ast_post.o ast_dp501.o
>> +ast-y := ast_cursor.o ast_drv.o ast_main.o ast_mode.o ast_ttm.o ast_post.o \
>> + ast_dp501.o
>>  
>>  obj-$(CONFIG_DRM_AST) := ast.o
>> diff --git a/drivers/gpu/drm/ast/ast_cursor.c 
>> b/drivers/gpu/drm/ast/ast_cursor.c
>> new file mode 100644
>> index ..53bb6eebc7cd
>> --- /dev/null
>> +++ b/drivers/gpu/drm/ast/ast_cursor.c
>> @@ -0,0 +1,218 @@
>> +/*
>> + * Copyright 2012 Red Hat Inc.
>> + * Parts based on xf86-video-ast
>> + * Copyright (c) 2005 ASPEED Technology Inc.
>> + *
>> + * Permission is hereby granted, free of charge, to any person obtaining a
>> + * copy of this software and associated documentation files (the
>> + * "Software"), to deal in the Software without restriction, including
>> + * without limitation the rights to use, copy, modify, merge, publish,
>> + * distribute, sub license, and/or sell copies of the Software, and to
>> + * permit persons to whom the Software is furnished to do so, subject to
>> + * the following conditions:
>> + *
>> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 
>> OR
>> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
>> + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
>> + * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY 
>> CLAIM,
>> + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
>> + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
>> + * USE OR OTHER DEALINGS IN THE SOFTWARE.
>> + *
>> + * The above copyright notice and this permission notice (including the
>> + * next paragraph) shall be included in all copies or substantial portions
>> + * of the Software.
> 
> SPDX for new files?
> I guess this boilerplate was copied from the old file.

Yes, I copied the license text from the old file. I wasn't sure if I can
just add the SPDX tag. If that's not a problem, I'll add it in the next
iteration.

Best regards
Thomas

> 
> Acked-by: Sam Ravnborg 
> 
>> + */
>> +/*
>> + * Authors: Dave Airlie 
>> + */
>> +
>> +#include 
>> +
>> +#include "ast_drv.h"
>> +
>> +/*
>> + * Allocate cursor BOs and pins them at the end of VRAM.
>> + */
>> +int ast_cursor_init(struct drm_device *dev)
>> +{
>> +struct ast_private *ast = to_ast_private(dev);
>> +size_t size, i;
>> +struct drm_gem_vram_object *gbo;
>> +int ret;
>> +
>> +size = roundup(AST_HWC_SIZE + AST_HWC_SIGNATURE_SIZE, PAGE_SIZE);
>> +
>> +for (i = 0; i < ARRAY_SIZE(ast->cursor.gbo); ++i) {
>> +gbo = drm_gem_vram_create(dev, size, 0);
>> +if (IS_ERR(gbo)) {
>> +ret = PTR_ERR(gbo);
>> +goto err_drm_gem_vram_put;
>> +}
>> +ret = drm_gem_vram_pin(gbo, DRM_GEM_VRAM_PL_FLAG_VRAM |
>> +DRM_GEM_VRAM_PL_FLAG_TOPDOWN);
>> +if (ret) {
>> +drm_gem_vram_put(gbo);
>> +goto err_drm_gem_vram_put;
>> +}
>> +
>> +ast->cursor.gbo[i] = gbo;
>> +}
>> +
>> +return 0;
>> +
>> +err_drm_gem_vram_put:
>> +while (i) {
>> +--i;
>> +gbo = ast->cursor.gbo[i];
>> +drm_gem_vram_unpin(gbo);
>> +drm_gem_vram_put(gbo);
>> +ast->cursor.gbo[i] = NULL;
>> +}
>> +return ret;
>> +}
>> +
>> +void ast_cursor_fini(struct drm_device *dev)
>> +{
>> +struct ast_private *ast = to_ast_private(dev);
>> +size_t i;
>> +struct drm_gem_vram_object *gbo;
>> +
>> +for (i = 0; i < ARRAY_SIZE(ast->cursor.gbo); ++i) {
>> +gbo = ast->cursor.gbo[i];
>> +drm_gem_vram_unpin(gbo);
>> +drm_gem_vram_put(gbo);
>> +}
>> +}
>> +
>> +static u32 copy_cursor_image(u8 *src, u8 *dst, int width, int height)
>> +{
>> +union {
>> +u32 ul;
>> +u8 b[4];
>> +   

Re: [PATCH 01/14] drm/ast: Move cursor functions to ast_cursor.c

2020-06-23 Thread Sam Ravnborg
Hi Thomas.

On Tue, Jun 23, 2020 at 10:18:48AM +0200, Thomas Zimmermann wrote:
> The cursor manipulation functions are unrelated to modesetting. Move
> them into their own file.
> 
> Signed-off-by: Thomas Zimmermann 
> ---
>  drivers/gpu/drm/ast/Makefile |   3 +-
>  drivers/gpu/drm/ast/ast_cursor.c | 218 +++
>  drivers/gpu/drm/ast/ast_drv.h|   9 ++
>  drivers/gpu/drm/ast/ast_mode.c   | 195 ---
>  4 files changed, 229 insertions(+), 196 deletions(-)
>  create mode 100644 drivers/gpu/drm/ast/ast_cursor.c
> 
> diff --git a/drivers/gpu/drm/ast/Makefile b/drivers/gpu/drm/ast/Makefile
> index 561f7c4199e4..6a5b3b247316 100644
> --- a/drivers/gpu/drm/ast/Makefile
> +++ b/drivers/gpu/drm/ast/Makefile
> @@ -3,6 +3,7 @@
>  # Makefile for the drm device driver.  This driver provides support for the
>  # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
>  
> -ast-y := ast_drv.o ast_main.o ast_mode.o ast_ttm.o ast_post.o ast_dp501.o
> +ast-y := ast_cursor.o ast_drv.o ast_main.o ast_mode.o ast_ttm.o ast_post.o \
> +  ast_dp501.o
>  
>  obj-$(CONFIG_DRM_AST) := ast.o
> diff --git a/drivers/gpu/drm/ast/ast_cursor.c 
> b/drivers/gpu/drm/ast/ast_cursor.c
> new file mode 100644
> index ..53bb6eebc7cd
> --- /dev/null
> +++ b/drivers/gpu/drm/ast/ast_cursor.c
> @@ -0,0 +1,218 @@
> +/*
> + * Copyright 2012 Red Hat Inc.
> + * Parts based on xf86-video-ast
> + * Copyright (c) 2005 ASPEED Technology Inc.
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the
> + * "Software"), to deal in the Software without restriction, including
> + * without limitation the rights to use, copy, modify, merge, publish,
> + * distribute, sub license, and/or sell copies of the Software, and to
> + * permit persons to whom the Software is furnished to do so, subject to
> + * the following conditions:
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
> + * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY 
> CLAIM,
> + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
> + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
> + * USE OR OTHER DEALINGS IN THE SOFTWARE.
> + *
> + * The above copyright notice and this permission notice (including the
> + * next paragraph) shall be included in all copies or substantial portions
> + * of the Software.

SPDX for new files?
I guess this boilerplate was copied from the old file.

Acked-by: Sam Ravnborg 

> + */
> +/*
> + * Authors: Dave Airlie 
> + */
> +
> +#include 
> +
> +#include "ast_drv.h"
> +
> +/*
> + * Allocate cursor BOs and pins them at the end of VRAM.
> + */
> +int ast_cursor_init(struct drm_device *dev)
> +{
> + struct ast_private *ast = to_ast_private(dev);
> + size_t size, i;
> + struct drm_gem_vram_object *gbo;
> + int ret;
> +
> + size = roundup(AST_HWC_SIZE + AST_HWC_SIGNATURE_SIZE, PAGE_SIZE);
> +
> + for (i = 0; i < ARRAY_SIZE(ast->cursor.gbo); ++i) {
> + gbo = drm_gem_vram_create(dev, size, 0);
> + if (IS_ERR(gbo)) {
> + ret = PTR_ERR(gbo);
> + goto err_drm_gem_vram_put;
> + }
> + ret = drm_gem_vram_pin(gbo, DRM_GEM_VRAM_PL_FLAG_VRAM |
> + DRM_GEM_VRAM_PL_FLAG_TOPDOWN);
> + if (ret) {
> + drm_gem_vram_put(gbo);
> + goto err_drm_gem_vram_put;
> + }
> +
> + ast->cursor.gbo[i] = gbo;
> + }
> +
> + return 0;
> +
> +err_drm_gem_vram_put:
> + while (i) {
> + --i;
> + gbo = ast->cursor.gbo[i];
> + drm_gem_vram_unpin(gbo);
> + drm_gem_vram_put(gbo);
> + ast->cursor.gbo[i] = NULL;
> + }
> + return ret;
> +}
> +
> +void ast_cursor_fini(struct drm_device *dev)
> +{
> + struct ast_private *ast = to_ast_private(dev);
> + size_t i;
> + struct drm_gem_vram_object *gbo;
> +
> + for (i = 0; i < ARRAY_SIZE(ast->cursor.gbo); ++i) {
> + gbo = ast->cursor.gbo[i];
> + drm_gem_vram_unpin(gbo);
> + drm_gem_vram_put(gbo);
> + }
> +}
> +
> +static u32 copy_cursor_image(u8 *src, u8 *dst, int width, int height)
> +{
> + union {
> + u32 ul;
> + u8 b[4];
> + } srcdata32[2], data32;
> + union {
> + u16 us;
> + u8 b[2];
> + } data16;
> + u32 csum = 0;
> + s32 alpha_dst_delta, last_alpha_dst_delta;
> + u8 *srcxor, *dstxor;
> + int i, j;
> + u32 per_pixel_copy, two_pixel_copy;
> +
> + alpha_dst_delta = AST_MAX_HWC_WIDTH << 1;
> + l

[PATCH 01/14] drm/ast: Move cursor functions to ast_cursor.c

2020-06-23 Thread Thomas Zimmermann
The cursor manipulation functions are unrelated to modesetting. Move
them into their own file.

Signed-off-by: Thomas Zimmermann 
---
 drivers/gpu/drm/ast/Makefile |   3 +-
 drivers/gpu/drm/ast/ast_cursor.c | 218 +++
 drivers/gpu/drm/ast/ast_drv.h|   9 ++
 drivers/gpu/drm/ast/ast_mode.c   | 195 ---
 4 files changed, 229 insertions(+), 196 deletions(-)
 create mode 100644 drivers/gpu/drm/ast/ast_cursor.c

diff --git a/drivers/gpu/drm/ast/Makefile b/drivers/gpu/drm/ast/Makefile
index 561f7c4199e4..6a5b3b247316 100644
--- a/drivers/gpu/drm/ast/Makefile
+++ b/drivers/gpu/drm/ast/Makefile
@@ -3,6 +3,7 @@
 # Makefile for the drm device driver.  This driver provides support for the
 # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
 
-ast-y := ast_drv.o ast_main.o ast_mode.o ast_ttm.o ast_post.o ast_dp501.o
+ast-y := ast_cursor.o ast_drv.o ast_main.o ast_mode.o ast_ttm.o ast_post.o \
+ast_dp501.o
 
 obj-$(CONFIG_DRM_AST) := ast.o
diff --git a/drivers/gpu/drm/ast/ast_cursor.c b/drivers/gpu/drm/ast/ast_cursor.c
new file mode 100644
index ..53bb6eebc7cd
--- /dev/null
+++ b/drivers/gpu/drm/ast/ast_cursor.c
@@ -0,0 +1,218 @@
+/*
+ * Copyright 2012 Red Hat Inc.
+ * Parts based on xf86-video-ast
+ * Copyright (c) 2005 ASPEED Technology Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ */
+/*
+ * Authors: Dave Airlie 
+ */
+
+#include 
+
+#include "ast_drv.h"
+
+/*
+ * Allocate cursor BOs and pins them at the end of VRAM.
+ */
+int ast_cursor_init(struct drm_device *dev)
+{
+   struct ast_private *ast = to_ast_private(dev);
+   size_t size, i;
+   struct drm_gem_vram_object *gbo;
+   int ret;
+
+   size = roundup(AST_HWC_SIZE + AST_HWC_SIGNATURE_SIZE, PAGE_SIZE);
+
+   for (i = 0; i < ARRAY_SIZE(ast->cursor.gbo); ++i) {
+   gbo = drm_gem_vram_create(dev, size, 0);
+   if (IS_ERR(gbo)) {
+   ret = PTR_ERR(gbo);
+   goto err_drm_gem_vram_put;
+   }
+   ret = drm_gem_vram_pin(gbo, DRM_GEM_VRAM_PL_FLAG_VRAM |
+   DRM_GEM_VRAM_PL_FLAG_TOPDOWN);
+   if (ret) {
+   drm_gem_vram_put(gbo);
+   goto err_drm_gem_vram_put;
+   }
+
+   ast->cursor.gbo[i] = gbo;
+   }
+
+   return 0;
+
+err_drm_gem_vram_put:
+   while (i) {
+   --i;
+   gbo = ast->cursor.gbo[i];
+   drm_gem_vram_unpin(gbo);
+   drm_gem_vram_put(gbo);
+   ast->cursor.gbo[i] = NULL;
+   }
+   return ret;
+}
+
+void ast_cursor_fini(struct drm_device *dev)
+{
+   struct ast_private *ast = to_ast_private(dev);
+   size_t i;
+   struct drm_gem_vram_object *gbo;
+
+   for (i = 0; i < ARRAY_SIZE(ast->cursor.gbo); ++i) {
+   gbo = ast->cursor.gbo[i];
+   drm_gem_vram_unpin(gbo);
+   drm_gem_vram_put(gbo);
+   }
+}
+
+static u32 copy_cursor_image(u8 *src, u8 *dst, int width, int height)
+{
+   union {
+   u32 ul;
+   u8 b[4];
+   } srcdata32[2], data32;
+   union {
+   u16 us;
+   u8 b[2];
+   } data16;
+   u32 csum = 0;
+   s32 alpha_dst_delta, last_alpha_dst_delta;
+   u8 *srcxor, *dstxor;
+   int i, j;
+   u32 per_pixel_copy, two_pixel_copy;
+
+   alpha_dst_delta = AST_MAX_HWC_WIDTH << 1;
+   last_alpha_dst_delta = alpha_dst_delta - (width << 1);
+
+   srcxor = src;
+   dstxor = (u8 *)dst + last_alpha_dst_delta + (AST_MAX_HWC_HEIGHT - 
height) * alpha_dst_delta;
+   per_pixel_copy = width & 1;
+   two_pixel_copy = width >> 1;
+
+   for (j = 0; j < height; j++) {
+   for (i = 0; i < two_pixel_copy; i++) {
+