summaryrefslogtreecommitdiffstats
path: root/src/interface/efi/efi_fbcon.c
diff options
context:
space:
mode:
authorMichael Brown2025-04-25 11:52:26 +0200
committerMichael Brown2025-04-25 13:44:28 +0200
commitaa3cc56ab20763eb1d8e04085ee6013636760606 (patch)
tree3f254c1d708b650eb78e94bfdb8f74b1aac807c7 /src/interface/efi/efi_fbcon.c
parent[efi] Remove userptr_t from EFI PE image parsing (diff)
downloadipxe-aa3cc56ab20763eb1d8e04085ee6013636760606.tar.gz
ipxe-aa3cc56ab20763eb1d8e04085ee6013636760606.tar.xz
ipxe-aa3cc56ab20763eb1d8e04085ee6013636760606.zip
[fbcon] Remove userptr_t from framebuffer console drivers
Simplify the framebuffer console drivers by assuming that the raw framebuffer, character cell array, background picture, and glyph data are all directly accessible via pointer dereferences. In particular, this avoids the need to copy each glyph during drawing: the VESA framebuffer driver can simply return a pointer to the glyph data stored in the video ROM. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/interface/efi/efi_fbcon.c')
-rw-r--r--src/interface/efi/efi_fbcon.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/src/interface/efi/efi_fbcon.c b/src/interface/efi/efi_fbcon.c
index 09cfde4c2..9c5d7063d 100644
--- a/src/interface/efi/efi_fbcon.c
+++ b/src/interface/efi/efi_fbcon.c
@@ -42,6 +42,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <ipxe/ansicol.h>
#include <ipxe/fbcon.h>
#include <ipxe/console.h>
+#include <ipxe/uaccess.h>
#include <ipxe/umalloc.h>
#include <ipxe/rotate.h>
#include <config/console.h>
@@ -91,7 +92,7 @@ struct efifb {
/** Font definition */
struct fbcon_font font;
/** Character glyph cache */
- userptr_t glyphs;
+ uint8_t *glyphs;
/** Dynamic characters in cache */
unsigned int dynamic[EFIFB_DYNAMIC];
/** Next dynamic character cache entry to evict */
@@ -117,14 +118,14 @@ static int efifb_draw ( unsigned int character, unsigned int index,
unsigned int height;
unsigned int x;
unsigned int y;
+ uint8_t *glyph;
uint8_t bitmask;
- size_t offset;
EFI_STATUS efirc;
int rc;
/* Clear existing glyph */
- offset = ( index * efifb.font.height );
- memset ( ( efifb.glyphs + offset ), 0, efifb.font.height );
+ glyph = &efifb.glyphs[ index * efifb.font.height ];
+ memset ( glyph, 0, efifb.font.height );
/* Get glyph */
blt = NULL;
@@ -157,8 +158,7 @@ static int efifb_draw ( unsigned int character, unsigned int index,
pixel++;
}
bitmask ^= toggle;
- copy_to_user ( efifb.glyphs, offset++, &bitmask,
- sizeof ( bitmask ) );
+ *(glyph++) = bitmask;
}
/* Free glyph */
@@ -223,11 +223,10 @@ static unsigned int efifb_dynamic ( unsigned int character ) {
* Get character glyph
*
* @v character Unicode character
- * @v glyph Character glyph to fill in
+ * @ret glyph Character glyph to fill in
*/
-static void efifb_glyph ( unsigned int character, uint8_t *glyph ) {
+static const uint8_t * efifb_glyph ( unsigned int character ) {
unsigned int index;
- size_t offset;
/* Identify glyph */
if ( character < EFIFB_ASCII ) {
@@ -241,9 +240,8 @@ static void efifb_glyph ( unsigned int character, uint8_t *glyph ) {
index = efifb_dynamic ( character );
}
- /* Copy cached glyph */
- offset = ( index * efifb.font.height );
- copy_from_user ( glyph, efifb.glyphs, offset, efifb.font.height );
+ /* Return cached glyph */
+ return &efifb.glyphs[ index * efifb.font.height ];
}
/**