Use copy method which maybe defined by framebuffer provider, but not just

memmove.

Sponsored by:	The FreeBSD Foundation
This commit is contained in:
ray 2013-10-23 19:45:14 +00:00
parent baa491bf97
commit b5d885c5f9
3 changed files with 24 additions and 3 deletions

View File

@ -153,6 +153,15 @@ vt_fb_mem_wr4(struct fb_info *sc, uint32_t o, uint32_t v)
*(uint32_t *)(sc->fb_vbase + o) = v;
}
static void
vt_fb_mem_copy(struct fb_info *sc, uint32_t offset_to, uint32_t offset_from,
uint32_t size)
{
memmove((void *)(sc->fb_vbase + offset_to), (void *)(sc->fb_vbase +
offset_from), size);
}
static void
vt_fb_indir_wr1(struct fb_info *sc, uint32_t o, uint8_t v)
{
@ -177,6 +186,14 @@ vt_fb_indir_wr4(struct fb_info *sc, uint32_t o, uint32_t v)
sc->fb_write(sc->fb_priv, o, &v, 4);
}
static void
vt_fb_indir_copy(struct fb_info *sc, uint32_t offset_to, uint32_t offset_from,
uint32_t size)
{
sc->copy(sc->fb_priv, offset_to, offset_from, size);
}
static int
fb_probe(struct fb_info *info)
{
@ -192,12 +209,14 @@ fb_probe(struct fb_info *info)
info->wr1 = &vt_fb_indir_wr1;
info->wr2 = &vt_fb_indir_wr2;
info->wr4 = &vt_fb_indir_wr4;
info->copy = &vt_fb_indir_copy;
} else if (info->fb_vbase != 0) {
if (info->fb_pbase == 0)
info->fb_flags |= FB_FLAG_NOMMAP;
info->wr1 = &vt_fb_mem_wr1;
info->wr2 = &vt_fb_mem_wr2;
info->wr4 = &vt_fb_mem_wr4;
info->copy = &vt_fb_mem_copy;
} else
return (ENXIO);

View File

@ -90,9 +90,8 @@ vt_fb_blank(struct vt_device *vd, term_color_t color)
}
/* Copy line0 to all other lines. */
/* XXX will copy with borders. */
for (o = 1; o < info->fb_height; o++) {
memmove((void *)(info->fb_vbase + o * info->fb_stride),
(void *)info->fb_vbase, info->fb_stride);
for (o = info->fb_stride; o < info->fb_size; o += info->fb_stride) {
info->copy(info, o, 0, info->fb_stride);
}
}

View File

@ -119,6 +119,8 @@ typedef int fb_write_t(void *priv, int offset, void *data, int size);
typedef int fb_read_t(void *priv, int offset, void *data, int size);
/* XXX: should use priv instead of fb_info too. */
typedef void fb_copy_t(struct fb_info *sc, uint32_t offset_to, uint32_t offset_from,
uint32_t size);
typedef void fb_wr1_t(struct fb_info *sc, uint32_t offset, uint8_t value);
typedef void fb_wr2_t(struct fb_info *sc, uint32_t offset, uint16_t value);
typedef void fb_wr4_t(struct fb_info *sc, uint32_t offset, uint32_t value);
@ -139,6 +141,7 @@ struct fb_info {
fb_wr1_t *wr1;
fb_wr2_t *wr2;
fb_wr4_t *wr4;
fb_copy_t *copy;
fb_enter_t *enter;
fb_leave_t *leave;