aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/fb
Commit message (Collapse)AuthorAgeFilesLines
* Revert r327828, r327949, r327953, r328016-r328026, r328041:Pedro F. Giffuni2018-01-211-2/+2
| | | | | | | | | | | | | | | | | | Uses of mallocarray(9). The use of mallocarray(9) has rocketed the required swap to build FreeBSD. This is likely caused by the allocation size attributes which put extra pressure on the compiler. Given that most of these checks are superfluous we have to choose better where to use mallocarray(9). We still have more uses of mallocarray(9) but hopefully this is enough to bring swap usage to a reasonable level. Reported by: wosch PR: 225197 Notes: svn path=/head/; revision=328218
* dev: make some use of mallocarray(9).Pedro F. Giffuni2018-01-131-2/+2
| | | | | | | | | | | | | | Focus on code where we are doing multiplications within malloc(9). None of these is likely to overflow, however the change is still useful as some static checkers can benefit from the allocation attributes we use for mallocarray. This initial sweep only covers malloc(9) calls with M_NOWAIT. No good reason but I started doing the changes before r327796 and at that time it was convenient to make sure the sorrounding code could handle NULL values. Notes: svn path=/head/; revision=327949
* SPDX: Consider code from Carnegie-Mellon University.Pedro F. Giffuni2017-11-301-0/+2
| | | | | | | Interesting cases, most likely from CMU Mach sources. Notes: svn path=/head/; revision=326403
* sys/dev: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-2716-0/+32
| | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Notes: svn path=/head/; revision=326255
* sys/dev: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-201-0/+2
| | | | | | | | | | | | | | | | | Mainly focus on files that use BSD 3-Clause license. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Special thanks to Wind River for providing access to "The Duke of Highlander" tool: an older (2014) run over FreeBSD tree was useful as a starting point. Notes: svn path=/head/; revision=326022
* Write-combine framebuffer writes through user-space mappings, if possible.Konstantin Belousov2017-04-201-0/+3
| | | | | | | | | | | | | | Note that KVA mapping of the framebuffer already uses write-combining mode, so the change, besides improving speed of user mode writes, also satisfies requirement of the IA32 architecture of using consistent caching modes for multiple mappings of the same page. Reported and tested by: bde Sponsored by: The FreeBSD Foundation MFC after: 1 week Notes: svn path=/head/; revision=317196
* Attempt to determine the modes in which 8-bit wide characters are actuallyBruce Evans2017-04-202-0/+27
| | | | | | | | | | | | | | | | | | | 9 wide. I only need this to improve the mouse cursor, but it has always been needed to select and/or adjust fonts. This is complicated because there are no standard parameter tables giving this bit of information directly, and the device register bit giving the information can't be trusted even if it is read from the hardware. Use a heuristic to guess if the device register can be trusted. (The device register is normally read from the BIOS mode table, but on my system where the device register is wrong, the mode table doesn't match the hardware and is not used; the device registers are used in this case.) Notes: svn path=/head/; revision=317190
* When we don't use the parameter table in the BIOS, also don't use mostBruce Evans2017-04-191-5/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | of our tweaked modes based on it. In practice, this means limiting the tweaked modes to at most 80x50 based on 80x25, so there are no 90-column, 80x30 or 80x60 modes. This happens when the the initial mode is is not in the parameter table. We always detected this case, but assumed that the (necessarily nonstandard) parameters of the initial mode could be tweaked just as blindly as the probably-standard parameters of initial modes in the table. On 1 laptop system with near-VGA where the initial mode is nonstandard, this is because the hardware apparently doesn't support 9-bit mode, but otherwise has standard timing. The initial mode has 8-bit mode CRTC horizontal parameters similar to those in syscons' 90-column modes and in EGA modes. Tweaking these values for the 90-column modes has little effect except to print the extra 10 columns off the screen. Tweaking from 80x25 to 80x30 requires changing from 400 scan lines to 480. This can probably be made to work, but syscons blindly applies values based on standard timing. This gives blank output. Tweaking from 80x25 to 80x50 doesn't change the CRTC timing and works. Notes: svn path=/head/; revision=317142
* Reset the DAC to 6-bit mode before calling the BIOS to set the screenBruce Evans2017-04-021-6/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mode. This works around bugs in at least 2 Intel BIOSes for our subsequent setting of the DAC back to 8-bit mode. The bug caused dark (mostly 1/4-intensity) colors for all except the first setting to a VESA graphics mode (including for settings to the current mode). Remove restoration (with less bits) of the palette in vesa_unload() after resetting the DAC to 6-bit mode. Depend on the BIOS to keep the palette consistent with the DAC for the simpler reset case like we do everywhere else in places that are actually important. Setting the video mode should reset everything to defaults, although we usually don't want that. Even the buggy BIOSes set the DAC to the default 6-bit mode, and set the palette to a default that matches the DAC. We don't undo the reset for most things, but we do undo it for the DAC (more precisely, we change to an 8-bit DAC if possible, and this is the only way that we set to an 8-bit DAC; it is accidental that if the DAC was in 8-bit mode from a previous mode switch then setting it to 8-bit mode is an undo). The buggy BIOSes are confused by our setting of the DAC to 8-bit mode in the "undo" case. They should multiply palette entries by 4 to match, but they actually leave all palette entries except #2 (green) and #248-255 (unused) untouched. Green is mysteriously scaled from 0x2a to 0x6a, and #248-255 are scaled correctly. Our support for the 8-bit DAC had almost no effect except to enable bugs. Syscons barely supports 16 colors, so it doesn't benefit much from having a palette with 16 million colors instead of only 256K. Applications can manage the palette using FBIO_{GET,SET}PALETTE, but the palette managed by this is only used in the less interesting modes (text and non-truecolor graphics modes up to 8 bits wide), and the kernel loses the changes on any mode switch (including to another vt in a different mode). Notes: svn path=/head/; revision=316396
* Fix 3 entries in mode tables related to mono and 90-column text modes.Bruce Evans2017-03-261-3/+3
| | | | | | | | | | | Newer VGAs don't support any mono modes, but bugs in the tables created 2 virtual mono modes (#45 90x43 and #112 80x43) that behaved more strangely than crashing. 90-column modes are tweaked 80-column ones and also fail to work on newer VGAs. #45 did crash (hang) on some hardware. Notes: svn path=/head/; revision=315986
* Remove pc98 support completely.Yoshihiro Takahashi2017-01-282-44/+0
| | | | | | | | | I thank all developers and contributors for pc98. Relnotes: yes Notes: svn path=/head/; revision=312910
* Provide way for framebuffer driver to request mmap(2) mapping typeOleksandr Tymoshenko2016-10-011-0/+2
| | | | | | | | | | | | | | | | | | | | On ARM if memattr is not overriden mmap(2) maps framebuffer memory as WBWA which means part of changes to content in userland end up in cache and appear on screen gradually as cache lines are evicted. This change adds configurable memattr that hardware fb implementation can set to get the memory mapping type it requires: - Add new flag FB_FLAG_MEMATTR that indicates that framebuffer driver overrides default memattr - Add new field fb_memattr to struct fb_info to specify requested memattr Reviewed by: ray Differential Revision: https://reviews.freebsd.org/D8064 Notes: svn path=/head/; revision=306555
* Use MTX_SYSINIT for the VESA lock.John Baldwin2016-07-231-17/+3
| | | | | | | | | | | | | | vesa_init_done isn't a reliable guard for the mutex init. If vesa_configure() doesn't find valid VESA info it will not set vesa_init_done, but the lock will remain initialized. Revert r303076 and use MTX_SYSINIT to deterministically init the lock. Reviewed by: royger MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D7290 Notes: svn path=/head/; revision=303225
* vesa: fix panic on suspendRoger Pau Monné2016-07-201-2/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix the following panic seen when migrating a FreeBSD guest on Xen: panic: mtx_lock() of destroyed mutex @ /usr/src/sys/dev/fb/vesa.c:541 cpuid = 0 KDB: stack backtrace: db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe001d2fa4f0 vpanic() at vpanic+0x182/frame 0xfffffe001d2fa570 kassert_panic() at kassert_panic+0x126/frame 0xfffffe001d2fa5e0 __mtx_lock_flags() at __mtx_lock_flags+0x15b/frame 0xfffffe001d2fa630 vesa_bios_save_restore() at vesa_bios_save_restore+0x78/frame 0xfffffe001d2fa680 vga_suspend() at vga_suspend+0xa3/frame 0xfffffe001d2fa6b0 isavga_suspend() at isavga_suspend+0x1d/frame 0xfffffe001d2fa6d0 bus_generic_suspend_child() at bus_generic_suspend_child+0x44/frame [...] This is caused because vga_sub_configure (which is called if the VGA adapter is attached after VESA tried to initialize), points to vesa_configure, which doesn't initialize the VESA mutex. In order to fix it, make sure vga_sub_configure points to vesa_load, so that all the needed vesa components are properly initialized. Sponsored by: Citrix Systems R&D MFC after: 3 days PR: 209203 Reviewed by: dumbbell Differential revision: https://reviews.freebsd.org/D7196 Notes: svn path=/head/; revision=303076
* Fix NULL-dereference panic if VESA reports zero modes.Alexander Motin2016-05-171-1/+2
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=300072
* sys/dev: minor spelling fixes.Pedro F. Giffuni2016-05-033-4/+4
| | | | | | | Most affect comments, very few have user-visible effects. Notes: svn path=/head/; revision=298955
* sys: Make use of our rounddown() macro when sys/param.h is available.Pedro F. Giffuni2016-04-303-3/+3
| | | | | | | No functional change. Notes: svn path=/head/; revision=298848
* sys/dev: extend use of the howmany() macro when available.Pedro F. Giffuni2016-04-261-2/+2
| | | | | | | | We have a howmany() macro in the <sys/param.h> header that is convenient to re-use as it makes things easier to read. Notes: svn path=/head/; revision=298646
* sys: use our nitems() macro when param.h is available.Pedro F. Giffuni2016-04-215-15/+14
| | | | | | | | | This should cover all the remaining cases in the kernel. Discussed in: freebsd-current Notes: svn path=/head/; revision=298431
* As <machine/pmap.h> is included from <vm/pmap.h>, there is no need toSvatopluk Kraus2016-02-221-1/+0
| | | | | | | | | | include it explicitly when <vm/pmap.h> is already included. Reviewed by: alc, kib Differential Revision: https://reviews.freebsd.org/D5373 Notes: svn path=/head/; revision=295880
* Replace several bus_alloc_resource() calls using default arguments with ↵Justin Hibbits2016-02-191-4/+4
| | | | | | | | | | | | bus_alloc_resource_any() Since these calls only use default arguments, bus_alloc_resource_any() is the right call. Differential Revision: https://reviews.freebsd.org/D5306 Notes: svn path=/head/; revision=295790
* Add support for USB display link adapters to the FB and VT drivers.Hans Petter Selasky2015-03-071-3/+10
| | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=279752
* vt(4): Add support to "downgrade" from eg. vt_fb to vt_vgaJean-Sébastien Pédron2015-03-011-0/+2
| | | | | | | | | | | | | | | | | The main purpose of this feature is to be able to unload a KMS driver. When going back from the current vt(4) backend to the previous backend, the previous backend is reinitialized with the special VDF_DOWNGRADE flag set. Then the current driver is terminated with the new "vd_fini" callback. In the case of vt_fb and vt_vga, this allows the former to pass the vgapci device vt_fb used to vt_vga so the device can be rePOSTed. Differential Revision: https://reviews.freebsd.org/D687 Notes: svn path=/head/; revision=279488
* Forward the FBIO_BLANK IOCTL to framebuffer clients. Bump the FreeBSDHans Petter Selasky2015-02-161-1/+2
| | | | | | | | | | version to force re-compilation of external video driver kernel modules. Discussed with: ray @ Notes: svn path=/head/; revision=278846
* vt(4): Use power_{suspend,resume} event handlers to implementAndriy Gapon2015-01-271-18/+0
| | | | | | | | | | | | | | | | | | | suspend/resume The goal is to avoid that the vt(4) resume happens before the video display is resumed. The original patch was provided by Andriy Gapon. This new patch registers the handlers in vt_upgrade(). This is done once, thanks to the VDF_ASYNC flag. I abused this flag because it was already abused by the keyboard allocation. The event handlers then call the backend if it provides callbacks for suspend/resume. Differential Revision: https://reviews.freebsd.org/D1004 On behalf of: dumbbell MFC after: 2 weeks Notes: svn path=/head/; revision=277795
* vt(4): Fix mouse cursor handling in vt_fb/creator_vt/ofwfbJean-Sébastien Pédron2014-08-271-17/+13
| | | | | | | | | | | | | | | There were two issues: 1. The area given to vt_is_cursor_in_area() was adding the drawable area offset, something already handled by this function. 2. The cursor was shifted on the screen by the offset of this area and thus was misplaced or not erased. Furthermore, when reaching the bottom or right borders, the cursor was either totally removed or not erased correctly. MFC after: 1 week Notes: svn path=/head/; revision=270720
* vt(4): Store a rectangle for the drawable area, not just the top-left cornerJean-Sébastien Pédron2014-08-251-6/+8
| | | | | | | | | | | This allows backends to verify they do not draw outside of this area. This fixes a bug in vt_vga where the text was happily drawn over the right and bottom margins, when using the Gallant font. MFC after: 1 week Notes: svn path=/head/; revision=270613
* vt(4): Add vd_bitblt_bmp_t callbackJean-Sébastien Pédron2014-08-231-0/+2
| | | | | | | | | | The code was already there in all backends, we just expose it. This is used to display the splash screen. MFC after: 1 week Notes: svn path=/head/; revision=270431
* creator_fb: Implement vd_bitblt_text_tJean-Sébastien Pédron2014-08-231-8/+62
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=270412
* vt(4): Colors are indexed against a console palette, not a VGA paletteJean-Sébastien Pédron2014-08-101-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rename vt_generate_vga_palette() to vt_generate_cons_palette() and change it to build a palette where the color index is the same than in terminal escape codes, not the VGA index. That's what TCHAR_CREATE() uses and passes to vt(4). The main differences between both orders are: o Blue and red are swapped (1 <-> 4) o Yellow and cyan are swapped (3 <-> 6) The problem remained unnoticed, because the RGB bit indexes passed to vt_generate_vga_palette() were reversed. This inversion was cancelled by the colors inversions in the generated palette. For instance, red (0xff0000) and blue (0x0000ff) have bytes in opposite order, but were swapped in the palette. But after changing the value of blue (see last paragraph), the modified color was in fact the red one. This commit includes a fix to creator_vt.c, submitted by Nathan Whitehorn: fb_cmsize is set to 16. Before this, the generated palette would be overwritte. This fixes colors on sparc64 with a Creator3D adapter. While here, tune the palette to better match console colors and improve the readability (especially the dark blue). Submitted by: nwhitehorn (fix to creator_vt.c) MFC after: 1 week Notes: svn path=/head/; revision=269783
* fbd: Fix a bug where vt_fb_attach() success would be considered a failureJean-Sébastien Pédron2014-08-101-2/+3
| | | | | | | | | | | | | | | | vt_fb_attach() currently always returns 0, but it could return a code defined in errno.h. However, it doesn't return a CN_* code. So checking its return value against CN_DEAD (which is 0) is incorrect, and in this case, a success becomes a failure. The consequence was unimportant, because the caller (drm_fb_helper.c) would only log an error message in this case. The console would still work. Approved by: nwhitehorn Notes: svn path=/head/; revision=269779
* Retire vd_maskbitbltchr. The same functionality can be obtained by testingNathan Whitehorn2014-08-071-1/+0
| | | | | | | | for mask != NULL in vd_bitbltchr, which all implementations of vd_bitbltchr() were doing anyway. Notes: svn path=/head/; revision=269685
* Retire various intertwined bits of fbd(4) and vt_fb, in particular theNathan Whitehorn2014-08-061-103/+8
| | | | | | | | pixel modification indirection. No actual drivers use it and those that might (e.g. creatorfb) use custom implementations of vd_bitbltchr(). Notes: svn path=/head/; revision=269620
* Add a simple unaccelerated vt(4) framebuffer driver for Sun framebuffersNathan Whitehorn2014-08-051-0/+220
| | | | | | | | | | | | | handled by creator(4) (Sun Creator 3D, Elite 3D, etc.). This provides vt(4) consoles on all devices currently supported by syscons on sparc64. The driver should also be easily adaptable to support newer Sun framebuffers such as the XVR-500 and higher. Many thanks to dumbbell@ (Jean-Sebastien Pedron) for testing this remotely during development. Notes: svn path=/head/; revision=269601
* Allow console drivers active from early boot to be used with xf86-video-scfb,Nathan Whitehorn2014-07-161-7/+0
| | | | | | | | | | | rather than only drivers attached later on. This involves a small amount of code duplication with dev/fb/fbd.c, which will fixed later on. Also improve performance of vt_blank() by making it not read from the framebuffer unnecessarily. Notes: svn path=/head/; revision=268771
* Should check fb_read method presence instead of double check for fb_write.Aleksandr Rybalko2014-07-091-1/+1
| | | | | | | | | Pointed by: emaste Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=268472
* Remove ia64.Marcel Moolenaar2014-07-071-22/+2
| | | | | | | | | | | | | | | | | | | | This includes: o All directories named *ia64* o All files named *ia64* o All ia64-specific code guarded by __ia64__ o All ia64-specific makefile logic o Mention of ia64 in comments and documentation This excludes: o Everything under contrib/ o Everything under crypto/ o sys/xen/interface o sys/sys/elf_common.h Discussed at: BSDcan Notes: svn path=/head/; revision=268351
* Pull in r267961 and r267973 again. Fix for issues reported will follow.Hans Petter Selasky2014-06-281-1/+0
| | | | Notes: svn path=/head/; revision=267992
* Revert r267961, r267973:Glen Barber2014-06-271-0/+1
| | | | | | | | | | | | | These changes prevent sysctl(8) from returning proper output, such as: 1) no output from sysctl(8) 2) erroneously returning ENOMEM with tools like truss(1) or uname(1) truss: can not get etype: Cannot allocate memory Notes: svn path=/head/; revision=267985
* Extend the meaning of the CTLFLAG_TUN flag to automatically check ifHans Petter Selasky2014-06-271-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | there is an environment variable which shall initialize the SYSCTL during early boot. This works for all SYSCTL types both statically and dynamically created ones, except for the SYSCTL NODE type and SYSCTLs which belong to VNETs. A new flag, CTLFLAG_NOFETCH, has been added to be used in the case a tunable sysctl has a custom initialisation function allowing the sysctl to still be marked as a tunable. The kernel SYSCTL API is mostly the same, with a few exceptions for some special operations like iterating childrens of a static/extern SYSCTL node. This operation should probably be made into a factored out common macro, hence some device drivers use this. The reason for changing the SYSCTL API was the need for a SYSCTL parent OID pointer and not only the SYSCTL parent OID list pointer in order to quickly generate the sysctl path. The motivation behind this patch is to avoid parameter loading cludges inside the OFED driver subsystem. Instead of adding special code to the OFED driver subsystem to post-load tunables into dynamically created sysctls, we generalize this in the kernel. Other changes: - Corrected a possibly incorrect sysctl name from "hw.cbb.intr_mask" to "hw.pcic.intr_mask". - Removed redundant TUNABLE statements throughout the kernel. - Some minor code rewrites in connection to removing not needed TUNABLE statements. - Added a missing SYSCTL_DECL(). - Wrapped two very long lines. - Avoid malloc()/free() inside sysctl string handling, in case it is called to initialize a sysctl from a tunable, hence malloc()/free() is not ready when sysctls from the sysctl dataset are registered. - Bumped FreeBSD version to indicate SYSCTL API change. MFC after: 2 weeks Sponsored by: Mellanox Technologies Notes: svn path=/head/; revision=267961
* Remove more superfluous const specifiers.Dimitry Andric2014-02-232-8/+8
| | | | Notes: svn path=/projects/clang-sparc64/; revision=262376
* Clean up license textEd Maste2013-12-292-8/+1
| | | | | | | | - Renumber Regents clauses - Remove clause 3 and 4 from TNF license, following upstream change Notes: svn path=/head/; revision=260047
* o Add virtual terminal mmap request handler.Aleksandr Rybalko2013-12-231-1/+10
| | | | | | | | | | | o Forward termianl framebuffer ioctl to fbd. o Forward terminal mmap request to fbd. o Move inclusion of sys/conf.h to vt.h. Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=259777
* Merge VT(9) project (a.k.a. newcons).Aleksandr Rybalko2013-12-052-0/+480
| | | | | | | | | | Reviewed by: nwhitehorn MFC_to_10_after: re approval Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=259016
* Reduce diff against stable/9 slightly.Jung-uk Kim2013-08-281-3/+2
| | | | Notes: svn path=/head/; revision=255004
* Do not save/restore video memory if we are not using linear frame buffer.Jung-uk Kim2013-08-281-22/+15
| | | | | | | Note this partially revert r233896. Notes: svn path=/head/; revision=254999
* Make sure to free stale buffer before allocating new one for safety.Jung-uk Kim2013-08-281-2/+6
| | | | Notes: svn path=/head/; revision=254998
* Avoid unnecessary signedness conversion.Jung-uk Kim2013-08-281-3/+3
| | | | Notes: svn path=/head/; revision=254997
* Limit the amount of video memory we map for the driver to the maximum value.Jung-uk Kim2013-03-271-5/+6
| | | | | | | | | | | | | This basically restores the spirit of r203535, which was partially reverted in r205557, while we still map fixed amount to work around transient issues we experienced with r203535. Prodded by: avg Tested by: avg MFC after: 1 week Notes: svn path=/head/; revision=248799
* Piggyback MIPS changes and add ARM syscons support for devices withOleksandr Tymoshenko2012-08-251-1/+6
| | | | | | | | | framebuffer While here - sort #if defined() order alphabetically Notes: svn path=/head/; revision=239696