aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/console/softcursor.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video/console/softcursor.c')
-rw-r--r--drivers/video/console/softcursor.c31
1 files changed, 21 insertions, 10 deletions
diff --git a/drivers/video/console/softcursor.c b/drivers/video/console/softcursor.c
index 557c563e4aed..7d07d8383569 100644
--- a/drivers/video/console/softcursor.c
+++ b/drivers/video/console/softcursor.c
@@ -20,11 +20,12 @@
20 20
21int soft_cursor(struct fb_info *info, struct fb_cursor *cursor) 21int soft_cursor(struct fb_info *info, struct fb_cursor *cursor)
22{ 22{
23 struct fbcon_ops *ops = info->fbcon_par;
23 unsigned int scan_align = info->pixmap.scan_align - 1; 24 unsigned int scan_align = info->pixmap.scan_align - 1;
24 unsigned int buf_align = info->pixmap.buf_align - 1; 25 unsigned int buf_align = info->pixmap.buf_align - 1;
25 unsigned int i, size, dsize, s_pitch, d_pitch; 26 unsigned int i, size, dsize, s_pitch, d_pitch;
26 struct fb_image *image; 27 struct fb_image *image;
27 u8 *dst, *src; 28 u8 *dst;
28 29
29 if (info->state != FBINFO_STATE_RUNNING) 30 if (info->state != FBINFO_STATE_RUNNING)
30 return 0; 31 return 0;
@@ -32,11 +33,19 @@ int soft_cursor(struct fb_info *info, struct fb_cursor *cursor)
32 s_pitch = (cursor->image.width + 7) >> 3; 33 s_pitch = (cursor->image.width + 7) >> 3;
33 dsize = s_pitch * cursor->image.height; 34 dsize = s_pitch * cursor->image.height;
34 35
35 src = kmalloc(dsize + sizeof(struct fb_image), GFP_ATOMIC); 36 if (dsize + sizeof(struct fb_image) != ops->cursor_size) {
36 if (!src) 37 if (ops->cursor_src != NULL)
37 return -ENOMEM; 38 kfree(ops->cursor_src);
39 ops->cursor_size = dsize + sizeof(struct fb_image);
38 40
39 image = (struct fb_image *) (src + dsize); 41 ops->cursor_src = kmalloc(ops->cursor_size, GFP_ATOMIC);
42 if (!ops->cursor_src) {
43 ops->cursor_size = 0;
44 return -ENOMEM;
45 }
46 }
47
48 image = (struct fb_image *) (ops->cursor_src + dsize);
40 *image = cursor->image; 49 *image = cursor->image;
41 d_pitch = (s_pitch + scan_align) & ~scan_align; 50 d_pitch = (s_pitch + scan_align) & ~scan_align;
42 51
@@ -48,21 +57,23 @@ int soft_cursor(struct fb_info *info, struct fb_cursor *cursor)
48 switch (cursor->rop) { 57 switch (cursor->rop) {
49 case ROP_XOR: 58 case ROP_XOR:
50 for (i = 0; i < dsize; i++) 59 for (i = 0; i < dsize; i++)
51 src[i] = image->data[i] ^ cursor->mask[i]; 60 ops->cursor_src[i] = image->data[i] ^
61 cursor->mask[i];
52 break; 62 break;
53 case ROP_COPY: 63 case ROP_COPY:
54 default: 64 default:
55 for (i = 0; i < dsize; i++) 65 for (i = 0; i < dsize; i++)
56 src[i] = image->data[i] & cursor->mask[i]; 66 ops->cursor_src[i] = image->data[i] &
67 cursor->mask[i];
57 break; 68 break;
58 } 69 }
59 } else 70 } else
60 memcpy(src, image->data, dsize); 71 memcpy(ops->cursor_src, image->data, dsize);
61 72
62 fb_pad_aligned_buffer(dst, d_pitch, src, s_pitch, image->height); 73 fb_pad_aligned_buffer(dst, d_pitch, ops->cursor_src, s_pitch,
74 image->height);
63 image->data = dst; 75 image->data = dst;
64 info->fbops->fb_imageblit(info, image); 76 info->fbops->fb_imageblit(info, image);
65 kfree(src);
66 return 0; 77 return 0;
67} 78}
68 79