The type struct fbcon_ops contains fbcon state and callbacks. As the
callbacks will be removed from struct fbcon_ops, rename the data type
to struct fbcon_par. Also rename the variables from ops to par.
The _par postfix ("private access registers") is used throughout the
fbdev subsystem for per-driver state. The fbcon pointer within struct
fb_info is also named fbcon_par. Hence, the new naming fits existing
practice.
v2:
- rename struct fbcon_ops to struct fbcon_par
- fix build for CONFIG_FB_TILEBITTING=n (kernel test robot)
- fix indention
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://lore.kernel.org/r/20250909124616.143365-3-tzimmermann@suse.de
77 lines
1.9 KiB
C
77 lines
1.9 KiB
C
/*
|
|
* linux/drivers/video/console/softcursor.c
|
|
*
|
|
* Generic software cursor for frame buffer devices
|
|
*
|
|
* Created 14 Nov 2002 by James Simmons
|
|
*
|
|
* This file is subject to the terms and conditions of the GNU General
|
|
* Public License. See the file COPYING in the main directory of this
|
|
* archive for more details.
|
|
*/
|
|
|
|
#include <linux/module.h>
|
|
#include <linux/string.h>
|
|
#include <linux/fb.h>
|
|
#include <linux/slab.h>
|
|
|
|
#include <asm/io.h>
|
|
|
|
#include "fbcon.h"
|
|
|
|
int soft_cursor(struct fb_info *info, struct fb_cursor *cursor)
|
|
{
|
|
struct fbcon_par *par = info->fbcon_par;
|
|
unsigned int scan_align = info->pixmap.scan_align - 1;
|
|
unsigned int buf_align = info->pixmap.buf_align - 1;
|
|
unsigned int i, size, dsize, s_pitch, d_pitch;
|
|
struct fb_image *image;
|
|
u8 *src, *dst;
|
|
|
|
if (info->state != FBINFO_STATE_RUNNING)
|
|
return 0;
|
|
|
|
s_pitch = (cursor->image.width + 7) >> 3;
|
|
dsize = s_pitch * cursor->image.height;
|
|
|
|
if (dsize + sizeof(struct fb_image) != par->cursor_size) {
|
|
kfree(par->cursor_src);
|
|
par->cursor_size = dsize + sizeof(struct fb_image);
|
|
|
|
par->cursor_src = kmalloc(par->cursor_size, GFP_ATOMIC);
|
|
if (!par->cursor_src) {
|
|
par->cursor_size = 0;
|
|
return -ENOMEM;
|
|
}
|
|
}
|
|
|
|
src = par->cursor_src + sizeof(struct fb_image);
|
|
image = (struct fb_image *)par->cursor_src;
|
|
*image = cursor->image;
|
|
d_pitch = (s_pitch + scan_align) & ~scan_align;
|
|
|
|
size = d_pitch * image->height + buf_align;
|
|
size &= ~buf_align;
|
|
dst = fb_get_buffer_offset(info, &info->pixmap, size);
|
|
|
|
if (cursor->enable) {
|
|
switch (cursor->rop) {
|
|
case ROP_XOR:
|
|
for (i = 0; i < dsize; i++)
|
|
src[i] = image->data[i] ^ cursor->mask[i];
|
|
break;
|
|
case ROP_COPY:
|
|
default:
|
|
for (i = 0; i < dsize; i++)
|
|
src[i] = image->data[i] & cursor->mask[i];
|
|
break;
|
|
}
|
|
} else
|
|
memcpy(src, image->data, dsize);
|
|
|
|
fb_pad_aligned_buffer(dst, d_pitch, src, s_pitch, image->height);
|
|
image->data = dst;
|
|
info->fbops->fb_imageblit(info, image);
|
|
return 0;
|
|
}
|