Fix mmap'ing size for LUNA framebuffer.

LUNA's video memory has 'linebytes * fPtr->info.height' bytes per 1
plane and the real visible area begins at 'offset' within that video
memory area, so it does not need to add 'offset' when mmap'ing video
memory.

Noticed by nono emulator.

ok miod@
master
aoyama 2023-08-01 11:06:13 +00:00
parent cd47a6bf03
commit 16c1375008
1 changed files with 8 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $OpenBSD: wsfb_driver.c,v 1.43 2022/11/10 17:38:58 matthieu Exp $ */
/* $OpenBSD: wsfb_driver.c,v 1.44 2023/08/01 11:06:13 aoyama Exp $ */
/*
* Copyright © 2001-2012 Matthieu Herrb
* All rights reserved.
@ -891,14 +891,19 @@ WsfbScreenInit(SCREEN_INIT_ARGS_DECL)
strerror(errno));
return FALSE;
}
fPtr->fbmem = wsfb_mmap(len + fPtr->info.offset, 0, fPtr->fd);
/* On LUNA, no need to add 'offset' bytes, it is included in len */
if (fPtr->wstype != WSDISPLAY_TYPE_LUNA)
len += fPtr->info.offset;
fPtr->fbmem = wsfb_mmap(len, 0, fPtr->fd);
if (fPtr->fbmem == NULL) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"wsfb_mmap: %s\n", strerror(errno));
return FALSE;
}
fPtr->fbmem_len = len + fPtr->info.offset;
fPtr->fbmem_len = len;
WsfbSave(pScrn);
pScrn->vtSema = TRUE;