Add support for USB display link adapters to the FB and VT drivers.

The vtophys() function is used to get the physical page address for
the virtually allocated frame buffers when a physically continuous
memory area is not available. This change also allows removing the
masking of the FB_FLAG_NOMMAP flag in the PS3 syscons driver.

The FB and VT drivers were tested using X.org/xf86-video-scfb and
syscons.
This commit is contained in:
Hans Petter Selasky 2015-03-07 20:45:15 +00:00
parent c3e2821f5f
commit a985ae9b4a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=279752
3 changed files with 22 additions and 9 deletions

View File

@ -51,6 +51,9 @@ __FBSDID("$FreeBSD$");
#include <dev/vt/vt.h>
#include <dev/vt/hw/fb/vt_fb.h>
#include <vm/vm.h>
#include <vm/pmap.h>
#include "fb_if.h"
LIST_HEAD(fb_list_head_t, fb_list_entry) fb_list_head =
@ -167,11 +170,14 @@ fb_mmap(struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr, int nprot,
info = dev->si_drv1;
if ((info->fb_flags & FB_FLAG_NOMMAP) || info->fb_pbase == 0)
if (info->fb_flags & FB_FLAG_NOMMAP)
return (ENODEV);
if (offset < info->fb_size) {
*paddr = info->fb_pbase + offset;
if (offset >= 0 && offset < info->fb_size) {
if (info->fb_pbase == 0)
*paddr = vtophys((uint8_t *)info->fb_vbase + offset);
else
*paddr = info->fb_pbase + offset;
return (0);
}
return (EINVAL);
@ -356,5 +362,6 @@ devclass_t fbd_devclass;
DRIVER_MODULE(fbd, fb, fbd_driver, fbd_devclass, 0, 0);
DRIVER_MODULE(fbd, drmn, fbd_driver, fbd_devclass, 0, 0);
DRIVER_MODULE(fbd, udl, fbd_driver, fbd_devclass, 0, 0);
MODULE_VERSION(fbd, 1);

View File

@ -41,6 +41,9 @@ __FBSDID("$FreeBSD$");
#include <dev/vt/hw/fb/vt_fb.h>
#include <dev/vt/colors/vt_termcolors.h>
#include <vm/vm.h>
#include <vm/pmap.h>
static struct vt_driver vt_fb_driver = {
.vd_name = "fb",
.vd_init = vt_fb_init,
@ -136,10 +139,14 @@ vt_fb_mmap(struct vt_device *vd, vm_ooffset_t offset, vm_paddr_t *paddr,
return (ENODEV);
if (offset >= 0 && offset < info->fb_size) {
*paddr = info->fb_pbase + offset;
#ifdef VM_MEMATTR_WRITE_COMBINING
*memattr = VM_MEMATTR_WRITE_COMBINING;
#endif
if (info->fb_pbase == 0) {
*paddr = vtophys((uint8_t *)info->fb_vbase + offset);
} else {
*paddr = info->fb_pbase + offset;
#ifdef VM_MEMATTR_WRITE_COMBINING
*memattr = VM_MEMATTR_WRITE_COMBINING;
#endif
}
return (0);
}
@ -425,7 +432,7 @@ vt_fb_init(struct vt_device *vd)
if (info->fb_size == 0)
return (CN_DEAD);
if (info->fb_pbase == 0)
if (info->fb_pbase == 0 && info->fb_vbase == 0)
info->fb_flags |= FB_FLAG_NOMMAP;
if (info->fb_cmsize <= 0) {

View File

@ -191,7 +191,6 @@ ps3fb_init(struct vt_device *vd)
L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_FLIP, 1, 0, 0, 0);
vt_fb_init(vd);
sc->fb_info.fb_flags &= ~FB_FLAG_NOMMAP; /* Set wrongly by vt_fb_init */
return (CN_INTERNAL);
}