Skip to contentSkip to conversation

xen: ARM HDLCD video driver

PATCH Superseded Stefano Stabellini 5 participants 26 messages Jan 8, 2013 – Jan 21, 2013 Arm/versatile express platform

v4 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

v4 cover xen: ARM HDLCD video driver

Hi all,
this patch series introduces a very simple driver for the ARM HDLCD Controller, that means that we can finally have something on the screen while Xen is booting on ARM :)

The driver is capable of reading the mode property on device tree and setting the HDLCD accordingly. It is also capable of setting the required OSC5 timer to the right frequency for the pixel clock.

In order to reduce code duplication with x86, I tried to generalize the existing vesa character rendering functions into a architecture agnostic framebuffer driver that can be used by vesa and the hdlcd drivers.

Changes in v4:
- rename flush_xen_data_tlb_range to flush_xen_data_tlb_range_va;
- replace all the calls to flush_xen_data_tlb_va, with calls to flush_xen_data_tlb_range_va;
- flush the entire 2MB mapping at BOOT_MISC_VIRT_START rather than just the first 4k;
- remove flush_xen_data_tlb_va;
- fix indentation;
- rename EARLY_VMAP_START/END to EARLY_VMAP_VIRT_START/END;
- mark early_ioremap as __init;
- reduce the amount of casts in early_ioremap;
- squash the vesa.c changes into this patch;
- rename fb* to lfb*;
- pass a pointer to fb_init;
- use %u for screen dimensions;
- specify loglevel in printk;
- call fb_free on error in fb_alloc;
- no __init on declarations;
- do not break messages to fit 80 columns;
- remove "preserve DTB mappings";
- introduce a new "move setup_mm right after setup_pagetables" patch;
- stop iterating over the DT nodes in device_tree_for_each_node if func returns a value != 0;
- return 1 from _find_compatible_node when a node is found;
- move the wait loop and the syscfg cfgctrl write into a separate function;
- fix comments;
- define all registers in write;
- move platform_vexpress.c to platforms/vexpress.c;
- move platform_vexpress.h to arm-arm/platforms/vexpress.h;
- use a lookup table to set the color masks;
- fix indentation;
- make sure mode_string is not NULL and is not bigger than 16 chars before continuing;
- introduce 2 separate error messages for !hdlcd_start and !framebuffer_start at the beginning of video_init;
- mark get_color_masks and set_pixclock as __init;
- check that we are running on a vexpress machine before calling vexpress_syscfg.

Changes in v3:
- rename fb_cr to fb_carriage_return.

Changes in v2:
- rebase on latest xen-unstable;
- add support for multiple resolutions;
- add support to dynamically change the OSC5 motherboard timer;
- add the patch "preserve DTB mappings".

Stefano Stabellini (7):
xen/arm: introduce early_ioremap
xen: infrastructure to have cross-platform video drivers
xen: introduce a generic framebuffer driver xen/arm: move setup_mm right after setup_pagetables xen/device_tree: introduce find_compatible_node xen/arm: introduce vexpress_syscfg
xen/arm: introduce a driver for the ARM HDLCD controller

 xen/arch/arm/Makefile                    |    1 +
 xen/arch/arm/Rules.mk                    |    2 +
 xen/arch/arm/mm.c                        |   40 ++++-
 xen/arch/arm/mode_switch.S               |    2 +-
 xen/arch/arm/platforms/vexpress.c        |  100 +++++++++++
 xen/arch/arm/setup.c                     |   10 +-
 xen/arch/x86/Rules.mk                    |    1 +
 xen/common/device_tree.c                 |   56 ++++++-
 xen/drivers/Makefile                     |    2 +-
 xen/drivers/char/console.c               |   12 +-
 xen/drivers/video/Makefile               |   12 +-
 xen/drivers/video/arm_hdlcd.c            |  280 ++++++++++++++++++++++++++++++
 xen/drivers/video/lfb.c                  |  206 ++++++++++++++++++++++
 xen/drivers/video/lfb.h                  |   49 +++++
 xen/drivers/video/modelines.h            |   77 ++++++++
 xen/drivers/video/vesa.c                 |  179 +++----------------
 xen/drivers/video/vga.c                  |   12 +-
 xen/include/asm-arm/config.h             |    6 +
 xen/include/asm-arm/mm.h                 |    3 +-
 xen/include/asm-arm/page.h               |   24 ++-
 xen/include/asm-arm/platform_vexpress.h  |   17 --
 xen/include/asm-arm/platforms/vexpress.h |   40 +++++
 xen/include/asm-x86/config.h             |    1 +
 xen/include/xen/device_tree.h            |    3 +
 xen/include/xen/vga.h                    |    9 +-
 xen/include/xen/video.h                  |   24 +++
 26 files changed, 951 insertions(+), 217 deletions(-)

Cheers,

Stefano

#1 lore raw

PATCH v4 1/7 xen/arm: introduce early_ioremap

Introduce a function to map a range of physical memory into Xen virtual memory.
It doesn't need domheap to be setup.
It is going to be used to map the videoram.

Add flush_xen_data_tlb_range_va, that flushes a range of virtual addresses. Replace all the calls to flush_xen_data_tlb_va with calls to flush_xen_data_tlb_range_va and remove flush_xen_data_tlb_va.

In the case of the dest_va tlb flush at the beginning of setup_pagetables, flush the entire 2MB mapping rather than just the first 4K.

Changes in v4:
- rename flush_xen_data_tlb_range to flush_xen_data_tlb_range_va;
- replace all the calls to flush_xen_data_tlb_va, with calls to flush_xen_data_tlb_range_va;
- flush the entire 2MB mapping at BOOT_MISC_VIRT_START rather than just the first 4k;
- remove flush_xen_data_tlb_va;
- fix indentation;
- rename EARLY_VMAP_START/END to EARLY_VMAP_VIRT_START/END;
- mark early_ioremap as __init;
- reduce the amount of casts in early_ioremap.

---
 xen/arch/arm/mm.c            |   40 ++++++++++++++++++++++++++++++++++++----
 xen/include/asm-arm/config.h |    4 ++++
 xen/include/asm-arm/mm.h     |    3 ++-
 xen/include/asm-arm/page.h   |   24 +++++++++++++++++-------
 4 files changed, 59 insertions(+), 12 deletions(-)
xen/arch/arm/mm.c +36 -4
index 855f83d..ca66395 100644
@@ -112,7 +112,7 @@ void set_fixmap(unsigned map, unsigned long mfn, unsigned attributes)
     pte.pt.ai = attributes;
     pte.pt.xn = 1;
     write_pte(xen_fixmap + third_table_offset(FIXMAP_ADDR(map)), pte);
-    flush_xen_data_tlb_va(FIXMAP_ADDR(map));
+    flush_xen_data_tlb_range_va(FIXMAP_ADDR(map), PAGE_SIZE);
 }
 
 /* Remove a mapping from a fixmap entry */
@@ -120,7 +120,7 @@ void clear_fixmap(unsigned map)
 {
     lpae_t pte = {0};
     write_pte(xen_fixmap + third_table_offset(FIXMAP_ADDR(map)), pte);
-    flush_xen_data_tlb_va(FIXMAP_ADDR(map));
+    flush_xen_data_tlb_range_va(FIXMAP_ADDR(map), PAGE_SIZE);
 }
 
 /* Map a page of domheap memory */
@@ -184,7 +184,7 @@ void *map_domain_page(unsigned long mfn)
      * We may not have flushed this specific subpage at map time,
      * since we only flush the 4k page not the superpage
      */
-    flush_xen_data_tlb_va(va);
+    flush_xen_data_tlb_range_va(va, PAGE_SIZE);
 
     return (void *)va;
 }
@@ -219,7 +219,7 @@ void __init setup_pagetables(unsigned long boot_phys_offset, paddr_t xen_paddr)
     dest_va = BOOT_MISC_VIRT_START;
     pte = mfn_to_xen_entry(xen_paddr >> PAGE_SHIFT);
     write_pte(xen_second + second_table_offset(dest_va), pte);
-    flush_xen_data_tlb_va(dest_va);
+    flush_xen_data_tlb_range_va(dest_va, SECOND_SIZE);
 
     /* Calculate virt-to-phys offset for the new location */
     phys_offset = xen_paddr - (unsigned long) _start;
@@ -367,6 +367,38 @@ void __init setup_frametable_mappings(paddr_t ps, paddr_t pe)
     frametable_virt_end = FRAMETABLE_VIRT_START + (nr_pages * sizeof(struct page_info));
 }
 
+/* Map the physical memory range start -  start + len into virtual
+ * memory and return the virtual address of the mapping.
+ * start has to be 2MB aligned.
+ * len has to be < EARLY_VMAP_VIRT_END - EARLY_VMAP_VIRT_START.
+ */
+void* __init early_ioremap(paddr_t start, size_t len, unsigned attributes)
+{
+    static unsigned long virt_start = EARLY_VMAP_VIRT_START;
+    unsigned long ret_addr = virt_start;
+    paddr_t end = start + len;
+
+    ASSERT(!(start & (~SECOND_MASK)));
+    ASSERT(!(virt_start & (~SECOND_MASK)));
+
+    /* The range we need to map is too big */
+    if ( virt_start + len >= EARLY_VMAP_VIRT_END )
+        return NULL;
+
+    while ( start < end )
+    {
+        lpae_t e = mfn_to_xen_entry(start >> PAGE_SHIFT);
+        e.pt.ai = attributes;
+        write_pte(xen_second + second_table_offset(virt_start), e);
+
+        start += SECOND_SIZE;
+        virt_start += SECOND_SIZE;
+    }
+    flush_xen_data_tlb_range_va(ret_addr, len);
+
+    return (void*)ret_addr;
+}
+
 enum mg { mg_clear, mg_ro, mg_rw, mg_rx };
 static void set_pte_flags_on_range(const char *p, unsigned long l, enum mg mg)
 {
xen/include/asm-arm/config.h +4 -0
index 2a05539..e5dce5e 100644
@@ -60,6 +60,8 @@
  *  6M  -  8M   Early boot misc (see below)
  *
  * 32M - 128M   Frametable: 24 bytes per page for 16GB of RAM
+ * 256M -  1G   VMAP: ioremap and early_ioremap use this virtual address
+ *                    space
  *
  *  1G -   2G   Xenheap: always-mapped memory
  *  2G -   4G   Domheap: on-demand-mapped
@@ -73,9 +75,11 @@
 #define FIXMAP_ADDR(n)        (mk_unsigned_long(0x00400000) + (n) * PAGE_SIZE)
 #define BOOT_MISC_VIRT_START   mk_unsigned_long(0x00600000)
 #define FRAMETABLE_VIRT_START  mk_unsigned_long(0x02000000)
+#define EARLY_VMAP_VIRT_START  mk_unsigned_long(0x10000000)
 #define XENHEAP_VIRT_START     mk_unsigned_long(0x40000000)
 #define DOMHEAP_VIRT_START     mk_unsigned_long(0x80000000)
 
+#define EARLY_VMAP_VIRT_END    XENHEAP_VIRT_START
 #define HYPERVISOR_VIRT_START  XEN_VIRT_START
 
 #define DOMHEAP_ENTRIES        1024  /* 1024 2MB mapping slots */
xen/include/asm-arm/mm.h +2 -1
index e95ece1..4ed5df6 100644
@@ -150,7 +150,8 @@ extern void setup_frametable_mappings(paddr_t ps, paddr_t pe);
 extern void set_fixmap(unsigned map, unsigned long mfn, unsigned attributes);
 /* Remove a mapping from a fixmap entry */
 extern void clear_fixmap(unsigned map);
-
+/* map a 2MB aligned physical range in virtual memory. */
+void* early_ioremap(paddr_t start, size_t len, unsigned attributes);
 
 #define mfn_valid(mfn)        ({                                              \
     unsigned long __m_f_n = (mfn);                                            \
xen/include/asm-arm/page.h +17 -7
index d89261e..fb4febc 100644
@@ -316,16 +316,20 @@ static inline void flush_xen_data_tlb(void)
 }
 
 /*
- * Flush one VA's hypervisor mappings from the data TLB. This is not
+ * Flush a range of VA's hypervisor mappings from the data TLB. This is not
  * sufficient when changing code mappings or for self modifying code.
  */
-static inline void flush_xen_data_tlb_va(unsigned long va)
+static inline void flush_xen_data_tlb_range_va(unsigned long va, unsigned long size)
 {
-    asm volatile("dsb;" /* Ensure preceding are visible */
-                 STORE_CP32(0, TLBIMVAH)
-                 "dsb;" /* Ensure completion of the TLB flush */
-                 "isb;"
-                 : : "r" (va) : "memory");
+    unsigned long end = va + size;
+    while ( va < end ) {
+        asm volatile("dsb;" /* Ensure preceding are visible */
+                     STORE_CP32(0, TLBIMVAH)
+                     "dsb;" /* Ensure completion of the TLB flush */
+                     "isb;"
+                     : : "r" (va) : "memory");
+        va += PAGE_SIZE;
+    }
 }
 
 /* Flush all non-hypervisor mappings from the TLB */
@@ -418,8 +422,14 @@ static inline uint64_t gva_to_ipa(uint32_t va)
 #define LPAE_ENTRY_MASK (LPAE_ENTRIES - 1)
 
 #define THIRD_SHIFT  PAGE_SHIFT
+#define THIRD_SIZE   (1u << THIRD_SHIFT)
+#define THIRD_MASK   (~(THIRD_SIZE - 1))
 #define SECOND_SHIFT (THIRD_SHIFT + LPAE_SHIFT)
+#define SECOND_SIZE  (1u << SECOND_SHIFT)
+#define SECOND_MASK  (~(SECOND_SIZE - 1))
 #define FIRST_SHIFT  (SECOND_SHIFT + LPAE_SHIFT)
+#define FIRST_SIZE   (1u << FIRST_SHIFT)
+#define FIRST_MASK   (~(FIRST_SIZE - 1))
 
 /* Calculate the offsets into the pagetables for a given VA */
 #define first_linear_offset(va) (va >> FIRST_SHIFT)
Signature · 1 line
1.7.2.5
#2 lore raw

Re: [PATCH v4 1/7] xen/arm: introduce early_ioremap

Quoted 14 lines · Stefano Stabellini

Introduce a function to map a range of physical memory into Xen virtual memory.
It doesn't need domheap to be setup.
It is going to be used to map the videoram.

Add flush_xen_data_tlb_range_va, that flushes a range of virtual addresses. Replace all the calls to flush_xen_data_tlb_va with calls to flush_xen_data_tlb_range_va and remove flush_xen_data_tlb_va.

In the case of the dest_va tlb flush at the beginning of setup_pagetables, flush the entire 2MB mapping rather than just the first 4K.

Quoted 7 lines

Changes in v4:
- rename flush_xen_data_tlb_range to flush_xen_data_tlb_range_va;
- replace all the calls to flush_xen_data_tlb_va, with calls to flush_xen_data_tlb_range_va;
- flush the entire 2MB mapping at BOOT_MISC_VIRT_START rather than just the first 4k;
- remove flush_xen_data_tlb_va;

These all seem like a separate patch (or patches) to me.

Quoted 4 lines

- fix indentation;
- rename EARLY_VMAP_START/END to EARLY_VMAP_VIRT_START/END;
- mark early_ioremap as __init;
- reduce the amount of casts in early_ioremap.

[...]

Quoted 9 lines

/*
- * Flush one VA's hypervisor mappings from the data TLB. This is not
+ * Flush a range of VA's hypervisor mappings from the data TLB. This is not
* sufficient when changing code mappings or for self modifying code. */

xen/include/asm-arm/page.h +1 -2
-static inline void flush_xen_data_tlb_va(unsigned long va)
+static inline void flush_xen_data_tlb_range_va(unsigned long va, unsigned long size)
 {
-    asm volatile("dsb;" /* Ensure preceding are visible */

xen/include/asm-arm/page.h static inline void flush_xen_data_tlb(void) · line 329

Quoted 10 lines
xen/include/asm-arm/page.h +6 -4
-                 STORE_CP32(0, TLBIMVAH)
-                 "dsb;" /* Ensure completion of the TLB flush */
-                 "isb;"
-                 : : "r" (va) : "memory");
+    unsigned long end = va + size;
+    while ( va < end ) {
+        asm volatile("dsb;" /* Ensure preceding are visible */
+                     STORE_CP32(0, TLBIMVAH)
+                     "dsb;" /* Ensure completion of the TLB flush */
+                     "isb;"

You can hoist all the barriers here to above/below the loop I think.

Ian.

#3 lore raw

Re: [PATCH v4 1/7] xen/arm: introduce early_ioremap

Quoted 23 lines · Ian Campbell
Quoted 14 lines · Stefano Stabellini

Introduce a function to map a range of physical memory into Xen virtual memory.
It doesn't need domheap to be setup.
It is going to be used to map the videoram.

Add flush_xen_data_tlb_range_va, that flushes a range of virtual addresses. Replace all the calls to flush_xen_data_tlb_va with calls to flush_xen_data_tlb_range_va and remove flush_xen_data_tlb_va.

In the case of the dest_va tlb flush at the beginning of setup_pagetables, flush the entire 2MB mapping rather than just the first 4K.

Quoted 7 lines

Changes in v4:
- rename flush_xen_data_tlb_range to flush_xen_data_tlb_range_va;
- replace all the calls to flush_xen_data_tlb_va, with calls to flush_xen_data_tlb_range_va;
- flush the entire 2MB mapping at BOOT_MISC_VIRT_START rather than just the first 4k;
- remove flush_xen_data_tlb_va;

Quoted 1 line

These all seem like a separate patch (or patches) to me.

I created three other patches: one to introduce flush_xen_data_tlb_range_va and replace all the calls to flush_xen_data_tlb_va with calls to flush_xen_data_tlb_range_va; a second one to fix the 2MB flush at the beginning of setup_pagetables; and a third one to introduce the missing FIRST, SECOND and THIRD MASK and SIZE definitions.

Quoted 19 lines
Quoted 4 lines

- fix indentation;
- rename EARLY_VMAP_START/END to EARLY_VMAP_VIRT_START/END;
- mark early_ioremap as __init;
- reduce the amount of casts in early_ioremap.

[...]

Quoted 13 lines

/*
- * Flush one VA's hypervisor mappings from the data TLB. This is not
+ * Flush a range of VA's hypervisor mappings from the data TLB. This is not
* sufficient when changing code mappings or for self modifying code. */

xen/include/asm-arm/page.h +1 -6
-static inline void flush_xen_data_tlb_va(unsigned long va)
+static inline void flush_xen_data_tlb_range_va(unsigned long va, unsigned long size)
 {
-    asm volatile("dsb;" /* Ensure preceding are visible */
-                 STORE_CP32(0, TLBIMVAH)
-                 "dsb;" /* Ensure completion of the TLB flush */
-                 "isb;"
-                 : : "r" (va) : "memory");
Quoted 8 lines

xen/include/asm-arm/page.h static inline void flush_xen_data_tlb(void) · line 329

Quoted 6 lines
xen/include/asm-arm/page.h +6 -0
+    unsigned long end = va + size;
+    while ( va < end ) {
+        asm volatile("dsb;" /* Ensure preceding are visible */
+                     STORE_CP32(0, TLBIMVAH)
+                     "dsb;" /* Ensure completion of the TLB flush */
+                     "isb;"

You can hoist all the barriers here to above/below the loop I think.

OK

#4 lore raw

PATCH v4 2/7 xen: infrastructure to have cross-platform video drivers

In reply to Stefano Stabellini

- introduce a new HAS_VIDEO config variable;
- build xen/drivers/video/font* if HAS_VIDEO;
- rename vga_puts to video_puts;
- rename vga_init to video_init;
- rename vga_endboot to video_endboot.

---
 xen/arch/arm/Rules.mk        |    1 +
 xen/arch/x86/Rules.mk        |    1 +
 xen/drivers/Makefile         |    2 +-
 xen/drivers/char/console.c   |   12 ++++++------
 xen/drivers/video/Makefile   |   10 +++++-----
 xen/drivers/video/vesa.c     |    4 ++--
 xen/drivers/video/vga.c      |   12 ++++++------
 xen/include/asm-x86/config.h |    1 +
 xen/include/xen/vga.h        |    9 +--------
 xen/include/xen/video.h      |   24 ++++++++++++++++++++++++
 10 files changed, 48 insertions(+), 28 deletions(-)
 create mode 100644 xen/include/xen/video.h
xen/arch/arm/Rules.mk +1 -0
index a45c654..fa9f9c1 100644
@@ -7,6 +7,7 @@
 #
 
 HAS_DEVICE_TREE := y
+HAS_VIDEO := y
 
 CFLAGS += -fno-builtin -fno-common -Wredundant-decls
 CFLAGS += -iwithprefix include -Werror -Wno-pointer-arith -pipe
xen/arch/x86/Rules.mk +1 -0
index 963850f..0a9d68d 100644
@@ -3,6 +3,7 @@
 
 HAS_ACPI := y
 HAS_VGA  := y
+HAS_VIDEO  := y
 HAS_CPUFREQ := y
 HAS_PCI := y
 HAS_PASSTHROUGH := y
xen/drivers/Makefile +1 -1
index 7239375..9c70f20 100644
@@ -3,4 +3,4 @@ subdir-$(HAS_CPUFREQ) += cpufreq
 subdir-$(HAS_PCI) += pci
 subdir-$(HAS_PASSTHROUGH) += passthrough
 subdir-$(HAS_ACPI) += acpi
-subdir-$(HAS_VGA) += video
+subdir-$(HAS_VIDEO) += video
xen/drivers/char/console.c +6 -6
index ff360fe..1b7a593 100644
@@ -21,7 +21,7 @@
 #include <xen/delay.h>
 #include <xen/guest_access.h>
 #include <xen/shutdown.h>
-#include <xen/vga.h>
+#include <xen/video.h>
 #include <xen/kexec.h>
 #include <asm/debugger.h>
 #include <asm/div64.h>
@@ -297,7 +297,7 @@ static void dump_console_ring_key(unsigned char key)
     buf[sofar] = '\0';
 
     sercon_puts(buf);
-    vga_puts(buf);
+    video_puts(buf);
 
     free_xenheap_pages(buf, order);
 }
@@ -383,7 +383,7 @@ static long guest_console_write(XEN_GUEST_HANDLE_PARAM(char) buffer, int count)
         spin_lock_irq(&console_lock);
 
         sercon_puts(kbuf);
-        vga_puts(kbuf);
+        video_puts(kbuf);
 
         if ( opt_console_to_ring )
         {
@@ -464,7 +464,7 @@ static void __putstr(const char *str)
     ASSERT(spin_is_locked(&console_lock));
 
     sercon_puts(str);
-    vga_puts(str);
+    video_puts(str);
 
     if ( !console_locks_busted )
     {
@@ -592,7 +592,7 @@ void __init console_init_preirq(void)
         if ( *p == ',' )
             p++;
         if ( !strncmp(p, "vga", 3) )
-            vga_init();
+            video_init();
         else if ( !strncmp(p, "none", 4) )
             continue;
         else if ( (sh = serial_parse_handle(p)) >= 0 )
@@ -694,7 +694,7 @@ void __init console_endboot(void)
         printk("\n");
     }
 
-    vga_endboot();
+    video_endboot();
 
     /*
      * If user specifies so, we fool the switch routine to redirect input
xen/drivers/video/Makefile +5 -5
index 6c3e5b4..2993c39 100644
@@ -1,5 +1,5 @@
-obj-y := vga.o
-obj-$(CONFIG_X86) += font_8x14.o
-obj-$(CONFIG_X86) += font_8x16.o
-obj-$(CONFIG_X86) += font_8x8.o
-obj-$(CONFIG_X86) += vesa.o
+obj-$(HAS_VGA) := vga.o
+obj-$(HAS_VIDEO) += font_8x14.o
+obj-$(HAS_VIDEO) += font_8x16.o
+obj-$(HAS_VIDEO) += font_8x8.o
+obj-$(HAS_VGA) += vesa.o
xen/drivers/video/vesa.c +2 -2
index d0a83ff..aaf8b23 100644
@@ -108,7 +108,7 @@ void __init vesa_init(void)
 
     memset(lfb, 0, vram_remap);
 
-    vga_puts = vesa_redraw_puts;
+    video_puts = vesa_redraw_puts;
 
     printk(XENLOG_INFO "vesafb: framebuffer at %#x, mapped to 0x%p, "
            "using %uk, total %uk\n",
@@ -193,7 +193,7 @@ void __init vesa_endboot(bool_t keep)
     if ( keep )
     {
         xpos = 0;
-        vga_puts = vesa_scroll_puts;
+        video_puts = vesa_scroll_puts;
     }
     else
     {
xen/drivers/video/vga.c +6 -6
index a98bd00..40e5963 100644
@@ -21,7 +21,7 @@ static unsigned char *video;
 
 static void vga_text_puts(const char *s);
 static void vga_noop_puts(const char *s) {}
-void (*vga_puts)(const char *) = vga_noop_puts;
+void (*video_puts)(const char *) = vga_noop_puts;
 
 /*
  * 'vga=<mode-specifier>[,keep]' where <mode-specifier> is one of:
@@ -62,7 +62,7 @@ void vesa_endboot(bool_t keep);
 #define vesa_endboot(x)   ((void)0)
 #endif
 
-void __init vga_init(void)
+void __init video_init(void)
 {
     char *p;
 
@@ -85,7 +85,7 @@ void __init vga_init(void)
         columns = vga_console_info.u.text_mode_3.columns;
         lines   = vga_console_info.u.text_mode_3.rows;
         memset(video, 0, columns * lines * 2);
-        vga_puts = vga_text_puts;
+        video_puts = vga_text_puts;
         break;
     case XEN_VGATYPE_VESA_LFB:
     case XEN_VGATYPE_EFI_LFB:
@@ -97,16 +97,16 @@ void __init vga_init(void)
     }
 }
 
-void __init vga_endboot(void)
+void __init video_endboot(void)
 {
-    if ( vga_puts == vga_noop_puts )
+    if ( video_puts == vga_noop_puts )
         return;
 
     printk("Xen is %s VGA console.\n",
            vgacon_keep ? "keeping" : "relinquishing");
 
     if ( !vgacon_keep )
-        vga_puts = vga_noop_puts;
+        video_puts = vga_noop_puts;
     else
     {
         int bus, devfn;
xen/include/asm-x86/config.h +1 -0
index 0c4868c..e8da4f7 100644
@@ -38,6 +38,7 @@
 #define CONFIG_ACPI_CSTATE 1
 
 #define CONFIG_VGA 1
+#define CONFIG_VIDEO 1
 
 #define CONFIG_HOTPLUG 1
 #define CONFIG_HOTPLUG_CPU 1
xen/include/xen/vga.h +1 -8
index cc690b9..f72b63d 100644
@@ -9,17 +9,10 @@
 #ifndef _XEN_VGA_H
 #define _XEN_VGA_H
 
-#include <public/xen.h>
+#include <xen/video.h>
 
 #ifdef CONFIG_VGA
 extern struct xen_vga_console_info vga_console_info;
-void vga_init(void);
-void vga_endboot(void);
-extern void (*vga_puts)(const char *);
-#else
-#define vga_init()    ((void)0)
-#define vga_endboot() ((void)0)
-#define vga_puts(s)   ((void)0)
 #endif
 
 #endif /* _XEN_VGA_H */
xen/include/xen/video.h new file +24 -0
new file mode 100644
index 0000000..2e897f9
@@ -0,0 +1,24 @@
+/*
+ *  video.h
+ *
+ *  This file is subject to the terms and conditions of the GNU General Public
+ *  License.  See the file COPYING in the main directory of this archive
+ *  for more details.
+ */
+
+#ifndef _XEN_VIDEO_H
+#define _XEN_VIDEO_H
+
+#include <public/xen.h>
+
+#ifdef CONFIG_VIDEO
+void video_init(void);
+extern void (*video_puts)(const char *);
+void video_endboot(void);
+#else
+#define video_init()    ((void)0)
+#define video_puts(s)   ((void)0)
+#define video_endboot() ((void)0)
+#endif
+
+#endif /* _XEN_VIDEO_H */
Signature · 1 line
1.7.2.5
#5 lore raw

Re: [PATCH v4 2/7] xen: infrastructure to have cross-platform video drivers

Quoted 9 lines · Stefano Stabellini

- introduce a new HAS_VIDEO config variable;
- build xen/drivers/video/font* if HAS_VIDEO;
- rename vga_puts to video_puts;
- rename vga_init to video_init;
- rename vga_endboot to video_endboot.

Jan, do you want to apply this or shall I take it along with the ARM bits?

AIUI it has no dependency on patch 1/7.

Ian.

#6 lore raw

Re: [PATCH v4 2/7] xen: infrastructure to have cross-platform video drivers

Quoted 8 lines
Quoted 1 line
Quoted 1 line · Ian Campbell
Quoted 6 lines · Stefano Stabellini

- introduce a new HAS_VIDEO config variable;
- build xen/drivers/video/font* if HAS_VIDEO;
- rename vga_puts to video_puts;
- rename vga_init to video_init;
- rename vga_endboot to video_endboot.

Quoted 8 lines
Quoted 3 lines

Jan, do you want to apply this or shall I take it along with the ARM bits?

AIUI it has no dependency on patch 1/7.

Neither you nor I can validly apply this without Keir's ack, I'm afraid.

Jan

#7 lore raw

Re: [PATCH v4 2/7] xen: infrastructure to have cross-platform video drivers

Quoted 12 lines · Jan Beulich
Quoted 12 lines
Quoted 1 line
Quoted 1 line · Ian Campbell
Quoted 9 lines · Stefano Stabellini

- introduce a new HAS_VIDEO config variable;
- build xen/drivers/video/font* if HAS_VIDEO;
- rename vga_puts to video_puts;
- rename vga_init to video_init;
- rename vga_endboot to video_endboot.

Quoted 7 lines
Quoted 4 lines

Jan, do you want to apply this or shall I take it along with the ARM bits?

AIUI it has no dependency on patch 1/7.

Neither you nor I can validly apply this without Keir's ack, I'm afraid.

True. I've CCd him into the original mail.

Ian,

Acked-by
#8 lore raw

Re: [PATCH v4 2/7] xen: infrastructure to have cross-platform video drivers

In reply to Jan Beulich
Quoted 12 lines · Jan Beulich
Quoted 12 lines
Quoted 1 line
Quoted 1 line · Ian Campbell
Quoted 9 lines · Stefano Stabellini

- introduce a new HAS_VIDEO config variable;
- build xen/drivers/video/font* if HAS_VIDEO;
- rename vga_puts to video_puts;
- rename vga_init to video_init;
- rename vga_endboot to video_endboot.

Quoted 7 lines
Quoted 4 lines

Jan, do you want to apply this or shall I take it along with the ARM bits?

AIUI it has no dependency on patch 1/7.

Neither you nor I can validly apply this without Keir's ack, I'm afraid.

Looks like just trivial renaming of stuff.

Quoted 7 lines

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#9 lore raw

Re: [PATCH v4 2/7] xen: infrastructure to have cross-platform video drivers

Quoted 17 lines · Keir Fraser
Quoted 15 lines · Jan Beulich
Quoted 15 lines
Quoted 1 line
Quoted 1 line · Ian Campbell
Quoted 9 lines · Stefano Stabellini

- introduce a new HAS_VIDEO config variable;
- build xen/drivers/video/font* if HAS_VIDEO;
- rename vga_puts to video_puts;
- rename vga_init to video_init;
- rename vga_endboot to video_endboot.

Jan, do you want to apply this or shall I take it along with the ARM bits?

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

AIUI it has no dependency on patch 1/7.

Neither you nor I can validly apply this without Keir's ack, I'm afraid.

Looks like just trivial renaming of stuff.

Are you also OK with the following patch "xen: introduce a generic framebuffer driver" (latest is v6 in <1358276756-6189-6-git-send-email-stefano.stabellini@eu.citrix.com>)

AFAIK it is also largely code motion (from vesa.c to lfb.c)

Ian.

#10 lore raw

Re: [PATCH v4 2/7] xen: infrastructure to have cross-platform video drivers

In reply to Stefano Stabellini
Quoted 9 lines · Stefano Stabellini

- introduce a new HAS_VIDEO config variable;
- build xen/drivers/video/font* if HAS_VIDEO;
- rename vga_puts to video_puts;
- rename vga_init to video_init;
- rename vga_endboot to video_endboot.

Adding Keir for his ack/nack too.

Quoted 259 lines
---
 xen/arch/arm/Rules.mk        |    1 +
 xen/arch/x86/Rules.mk        |    1 +
 xen/drivers/Makefile         |    2 +-
 xen/drivers/char/console.c   |   12 ++++++------
 xen/drivers/video/Makefile   |   10 +++++-----
 xen/drivers/video/vesa.c     |    4 ++--
 xen/drivers/video/vga.c      |   12 ++++++------
 xen/include/asm-x86/config.h |    1 +
 xen/include/xen/vga.h        |    9 +--------
 xen/include/xen/video.h      |   24 ++++++++++++++++++++++++
 10 files changed, 48 insertions(+), 28 deletions(-)
 create mode 100644 xen/include/xen/video.h
xen/arch/arm/Rules.mk +1 -0
index a45c654..fa9f9c1 100644
@@ -7,6 +7,7 @@
 #
 
 HAS_DEVICE_TREE := y
+HAS_VIDEO := y
 
 CFLAGS += -fno-builtin -fno-common -Wredundant-decls
 CFLAGS += -iwithprefix include -Werror -Wno-pointer-arith -pipe
xen/arch/x86/Rules.mk +1 -0
index 963850f..0a9d68d 100644
@@ -3,6 +3,7 @@
 
 HAS_ACPI := y
 HAS_VGA  := y
+HAS_VIDEO  := y
 HAS_CPUFREQ := y
 HAS_PCI := y
 HAS_PASSTHROUGH := y
xen/drivers/Makefile +1 -1
index 7239375..9c70f20 100644
@@ -3,4 +3,4 @@ subdir-$(HAS_CPUFREQ) += cpufreq
 subdir-$(HAS_PCI) += pci
 subdir-$(HAS_PASSTHROUGH) += passthrough
 subdir-$(HAS_ACPI) += acpi
-subdir-$(HAS_VGA) += video
+subdir-$(HAS_VIDEO) += video
xen/drivers/char/console.c +6 -6
index ff360fe..1b7a593 100644
@@ -21,7 +21,7 @@
 #include <xen/delay.h>
 #include <xen/guest_access.h>
 #include <xen/shutdown.h>
-#include <xen/vga.h>
+#include <xen/video.h>
 #include <xen/kexec.h>
 #include <asm/debugger.h>
 #include <asm/div64.h>
@@ -297,7 +297,7 @@ static void dump_console_ring_key(unsigned char key)
     buf[sofar] = '\0';
 
     sercon_puts(buf);
-    vga_puts(buf);
+    video_puts(buf);
 
     free_xenheap_pages(buf, order);
 }
@@ -383,7 +383,7 @@ static long guest_console_write(XEN_GUEST_HANDLE_PARAM(char) buffer, int count)
         spin_lock_irq(&console_lock);
 
         sercon_puts(kbuf);
-        vga_puts(kbuf);
+        video_puts(kbuf);
 
         if ( opt_console_to_ring )
         {
@@ -464,7 +464,7 @@ static void __putstr(const char *str)
     ASSERT(spin_is_locked(&console_lock));
 
     sercon_puts(str);
-    vga_puts(str);
+    video_puts(str);
 
     if ( !console_locks_busted )
     {
@@ -592,7 +592,7 @@ void __init console_init_preirq(void)
         if ( *p == ',' )
             p++;
         if ( !strncmp(p, "vga", 3) )
-            vga_init();
+            video_init();
         else if ( !strncmp(p, "none", 4) )
             continue;
         else if ( (sh = serial_parse_handle(p)) >= 0 )
@@ -694,7 +694,7 @@ void __init console_endboot(void)
         printk("\n");
     }
 
-    vga_endboot();
+    video_endboot();
 
     /*
      * If user specifies so, we fool the switch routine to redirect input
xen/drivers/video/Makefile +5 -5
index 6c3e5b4..2993c39 100644
@@ -1,5 +1,5 @@
-obj-y := vga.o
-obj-$(CONFIG_X86) += font_8x14.o
-obj-$(CONFIG_X86) += font_8x16.o
-obj-$(CONFIG_X86) += font_8x8.o
-obj-$(CONFIG_X86) += vesa.o
+obj-$(HAS_VGA) := vga.o
+obj-$(HAS_VIDEO) += font_8x14.o
+obj-$(HAS_VIDEO) += font_8x16.o
+obj-$(HAS_VIDEO) += font_8x8.o
+obj-$(HAS_VGA) += vesa.o
xen/drivers/video/vesa.c +2 -2
index d0a83ff..aaf8b23 100644
@@ -108,7 +108,7 @@ void __init vesa_init(void)
 
     memset(lfb, 0, vram_remap);
 
-    vga_puts = vesa_redraw_puts;
+    video_puts = vesa_redraw_puts;
 
     printk(XENLOG_INFO "vesafb: framebuffer at %#x, mapped to 0x%p, "
            "using %uk, total %uk\n",
@@ -193,7 +193,7 @@ void __init vesa_endboot(bool_t keep)
     if ( keep )
     {
         xpos = 0;
-        vga_puts = vesa_scroll_puts;
+        video_puts = vesa_scroll_puts;
     }
     else
     {
xen/drivers/video/vga.c +6 -6
index a98bd00..40e5963 100644
@@ -21,7 +21,7 @@ static unsigned char *video;
 
 static void vga_text_puts(const char *s);
 static void vga_noop_puts(const char *s) {}
-void (*vga_puts)(const char *) = vga_noop_puts;
+void (*video_puts)(const char *) = vga_noop_puts;
 
 /*
  * 'vga=<mode-specifier>[,keep]' where <mode-specifier> is one of:
@@ -62,7 +62,7 @@ void vesa_endboot(bool_t keep);
 #define vesa_endboot(x)   ((void)0)
 #endif
 
-void __init vga_init(void)
+void __init video_init(void)
 {
     char *p;
 
@@ -85,7 +85,7 @@ void __init vga_init(void)
         columns = vga_console_info.u.text_mode_3.columns;
         lines   = vga_console_info.u.text_mode_3.rows;
         memset(video, 0, columns * lines * 2);
-        vga_puts = vga_text_puts;
+        video_puts = vga_text_puts;
         break;
     case XEN_VGATYPE_VESA_LFB:
     case XEN_VGATYPE_EFI_LFB:
@@ -97,16 +97,16 @@ void __init vga_init(void)
     }
 }
 
-void __init vga_endboot(void)
+void __init video_endboot(void)
 {
-    if ( vga_puts == vga_noop_puts )
+    if ( video_puts == vga_noop_puts )
         return;
 
     printk("Xen is %s VGA console.\n",
            vgacon_keep ? "keeping" : "relinquishing");
 
     if ( !vgacon_keep )
-        vga_puts = vga_noop_puts;
+        video_puts = vga_noop_puts;
     else
     {
         int bus, devfn;
xen/include/asm-x86/config.h +1 -0
index 0c4868c..e8da4f7 100644
@@ -38,6 +38,7 @@
 #define CONFIG_ACPI_CSTATE 1
 
 #define CONFIG_VGA 1
+#define CONFIG_VIDEO 1
 
 #define CONFIG_HOTPLUG 1
 #define CONFIG_HOTPLUG_CPU 1
xen/include/xen/vga.h +1 -8
index cc690b9..f72b63d 100644
@@ -9,17 +9,10 @@
 #ifndef _XEN_VGA_H
 #define _XEN_VGA_H
 
-#include <public/xen.h>
+#include <xen/video.h>
 
 #ifdef CONFIG_VGA
 extern struct xen_vga_console_info vga_console_info;
-void vga_init(void);
-void vga_endboot(void);
-extern void (*vga_puts)(const char *);
-#else
-#define vga_init()    ((void)0)
-#define vga_endboot() ((void)0)
-#define vga_puts(s)   ((void)0)
 #endif
 
 #endif /* _XEN_VGA_H */
xen/include/xen/video.h new file +24 -0
new file mode 100644
index 0000000..2e897f9
@@ -0,0 +1,24 @@
+/*
+ *  video.h
+ *
+ *  This file is subject to the terms and conditions of the GNU General Public
+ *  License.  See the file COPYING in the main directory of this archive
+ *  for more details.
+ */
+
+#ifndef _XEN_VIDEO_H
+#define _XEN_VIDEO_H
+
+#include <public/xen.h>
+
+#ifdef CONFIG_VIDEO
+void video_init(void);
+extern void (*video_puts)(const char *);
+void video_endboot(void);
+#else
+#define video_init()    ((void)0)
+#define video_puts(s)   ((void)0)
+#define video_endboot() ((void)0)
+#endif
+
+#endif /* _XEN_VIDEO_H */
#11 lore raw

PATCH v4 3/7 xen: introduce a generic framebuffer driver

In reply to Stefano Stabellini

Abstract away from vesa.c the funcions to handle a linear framebuffer and print characters to it.
Make use of the new functions in vesa.c.

Changes in v4:
- squash the vesa.c changes into this patch;
- rename fb* to lfb*;
- pass a pointer to fb_init;
- use %u for screen dimensions;
- specify loglevel in printk;
- call fb_free on error in fb_alloc;
- no __init on declarations;
- do not break messages to fit 80 columns.

---
 xen/drivers/video/Makefile |    1 +
 xen/drivers/video/lfb.c    |  206 ++++++++++++++++++++++++++++++++++++++++++++
 xen/drivers/video/lfb.h    |   49 +++++++++++
 xen/drivers/video/vesa.c   |  179 ++++++--------------------------------
 4 files changed, 282 insertions(+), 153 deletions(-)
 create mode 100644 xen/drivers/video/lfb.c
 create mode 100644 xen/drivers/video/lfb.h
xen/drivers/video/Makefile +1 -0
index 2993c39..77f9d5d 100644
@@ -2,4 +2,5 @@ obj-$(HAS_VGA) := vga.o
 obj-$(HAS_VIDEO) += font_8x14.o
 obj-$(HAS_VIDEO) += font_8x16.o
 obj-$(HAS_VIDEO) += font_8x8.o
+obj-$(HAS_VIDEO) += lfb.o
 obj-$(HAS_VGA) += vesa.o
xen/drivers/video/lfb.c new file +206 -0

206 lines not on this page · raw message

xen/drivers/video/lfb.h new file +49 -0

49 lines not on this page · raw message

xen/drivers/video/vesa.c +26 -153

229 lines not on this page · raw message

Signature · 1 line
1.7.2.5
#12 lore raw

Re: [PATCH v4 3/7] xen: introduce a generic framebuffer driver

Quoted 16 lines
Quoted 1 line
Quoted 1 line · Stefano Stabellini
xen/drivers/video/lfb.c new file +12 -0
@@ -0,0 +1,206 @@
+/******************************************************************************
+ * lfb.c
+ *
+ * linear frame buffer handling.
+ */
+
+#include <xen/config.h>
+#include <xen/kernel.h>
+#include <xen/lib.h>
+#include <xen/errno.h>
+#include "lfb.h"
+#include "font.h"

xen/drivers/video/lfb.c line 22

Quoted 10 lines
xen/drivers/video/lfb.c new file +10 -0
+
+#define MAX_XRES 1900
+#define MAX_YRES 1200
+#define MAX_BPP 4
+#define MAX_FONT_W 8
+#define MAX_FONT_H 16
+static __initdata unsigned int line_len[MAX_XRES / MAX_FONT_W];
+static __initdata unsigned char lbuf[MAX_XRES * MAX_BPP];
+static __initdata unsigned char text_buf[(MAX_XRES / MAX_FONT_W) * \
+                          (MAX_YRES / MAX_FONT_H)];

Imo it would be better to move all these __initdata definitions do to where the using __init functions actually live, to make sure unintended use of them in non-__init ones is noticed.

Quoted 104 lines
xen/drivers/video/lfb.c new file +104 -0
+
+struct lfb_status {
+    struct lfb_prop lfbp;
+
+    unsigned char *lbuf, *text_buf;
+    unsigned int *line_len;
+    unsigned int xpos, ypos;
+};
+static struct lfb_status lfb;
+
+static void lfb_show_line(
+    const unsigned char *text_line,
+    unsigned char *video_line,
+    unsigned int nr_chars,
+    unsigned int nr_cells)
+{
+    unsigned int i, j, b, bpp, pixel;
+
+    bpp = (lfb.lfbp.bits_per_pixel + 7) >> 3;
+
+    for ( i = 0; i < lfb.lfbp.font->height; i++ )
+    {
+        unsigned char *ptr = lfb.lbuf;
+
+        for ( j = 0; j < nr_chars; j++ )
+        {
+            const unsigned char *bits = lfb.lfbp.font->data;
+            bits += ((text_line[j] * lfb.lfbp.font->height + i) *
+                     ((lfb.lfbp.font->width + 7) >> 3));
+            for ( b = lfb.lfbp.font->width; b--; )
+            {
+                pixel = (*bits & (1u<<b)) ? lfb.lfbp.pixel_on : 0;
+                memcpy(ptr, &pixel, bpp);
+                ptr += bpp;
+            }
+        }
+
+        memset(ptr, 0, (lfb.lfbp.width - nr_chars * lfb.lfbp.font->width) * bpp);
+        memcpy(video_line, lfb.lbuf, nr_cells * lfb.lfbp.font->width * bpp);
+        video_line += lfb.lfbp.bytes_per_line;
+    }
+}
+
+/* Fast mode which redraws all modified parts of a 2D text buffer. */
+void lfb_redraw_puts(const char *s)
+{
+    unsigned int i, min_redraw_y = lfb.ypos;
+    char c;
+
+    /* Paste characters into text buffer. */
+    while ( (c = *s++) != '\0' )
+    {
+        if ( (c == '\n') || (lfb.xpos >= lfb.lfbp.text_columns) )
+        {
+            if ( ++lfb.ypos >= lfb.lfbp.text_rows )
+            {
+                min_redraw_y = 0;
+                lfb.ypos = lfb.lfbp.text_rows - 1;
+                memmove(lfb.text_buf, lfb.text_buf + lfb.lfbp.text_columns,
+                        lfb.ypos * lfb.lfbp.text_columns);
+                memset(lfb.text_buf + lfb.ypos * lfb.lfbp.text_columns, 0, lfb.xpos);
+            }
+            lfb.xpos = 0;
+        }
+
+        if ( c != '\n' )
+            lfb.text_buf[lfb.xpos++ + lfb.ypos * lfb.lfbp.text_columns] = c;
+    }
+
+    /* Render modified section of text buffer to VESA linear framebuffer. */
+    for ( i = min_redraw_y; i <= lfb.ypos; i++ )
+    {
+        const unsigned char *line = lfb.text_buf + i * lfb.lfbp.text_columns;
+        unsigned int width;
+
+        for ( width = lfb.lfbp.text_columns; width; --width )
+            if ( line[width - 1] )
+                 break;
+        lfb_show_line(line,
+                       lfb.lfbp.lfb + i * lfb.lfbp.font->height * lfb.lfbp.bytes_per_line,
+                       width, max(lfb.line_len[i], width));
+        lfb.line_len[i] = width;
+    }
+
+    lfb.lfbp.flush();
+}
+
+/* Slower line-based scroll mode which interacts better with dom0. */
+void lfb_scroll_puts(const char *s)
+{
+    unsigned int i;
+    char c;
+
+    while ( (c = *s++) != '\0' )
+    {
+        if ( (c == '\n') || (lfb.xpos >= lfb.lfbp.text_columns) )
+        {
+            unsigned int bytes = (lfb.lfbp.width *
+                                  ((lfb.lfbp.bits_per_pixel + 7) >> 3));
+            unsigned char *src = lfb.lfbp.lfb + lfb.lfbp.font->height * lfb.lfbp.bytes_per_line;
+            unsigned char *dst = lfb.lfbp.lfb;
+
+            /* New line: scroll all previous rows up one line. */
+            for ( i = lfb.lfbp.font->height; i < lfb.lfbp.height; i++ )

xen/drivers/video/lfb.c line 136

Quoted 10 lines
xen/drivers/video/lfb.c new file +10 -0
+            {
+                memcpy(dst, src, bytes);
+                src += lfb.lfbp.bytes_per_line;
+                dst += lfb.lfbp.bytes_per_line;
+            }
+
+            /* Render new line. */
+            lfb_show_line(
+                lfb.text_buf,
+                lfb.lfbp.lfb + (lfb.lfbp.text_rows-1) * lfb.lfbp.font->height * lfb.lfbp.bytes_per_line,

Long line?

Quoted 13 lines
xen/drivers/video/lfb.c new file +13 -0
+                lfb.xpos, lfb.lfbp.text_columns);
+
+            lfb.xpos = 0;
+        }
+
+        if ( c != '\n' )
+            lfb.text_buf[lfb.xpos++] = c;
+    }
+
+    lfb.lfbp.flush();
+}
+
+void lfb_carriage_return(void)

xen/drivers/video/lfb.c line 159

Quoted 10 lines
xen/drivers/video/lfb.c new file +10 -0
+{
+    lfb.xpos = 0;
+}
+
+int __init lfb_init(struct lfb_prop *lfbp)
+{
+    if ( lfbp->width > MAX_XRES || lfbp->height > MAX_YRES )
+    {
+        printk(XENLOG_WARNING "Couldn't initialize a %ux%u framebuffer early.\n",
+                        lfbp->width, lfbp->height);

Indentation?

Quoted 37 lines
xen/drivers/video/lfb.c new file +37 -0
+        return -EINVAL;
+    }
+
+    lfb.lfbp = *lfbp;
+    lfb.lbuf = lbuf;
+    lfb.text_buf = text_buf;
+    lfb.line_len = line_len;
+    return 0;
+}
+
+int __init lfb_alloc(void)
+{
+    lfb.lbuf = NULL;
+    lfb.text_buf = NULL;
+    lfb.line_len = NULL;
+
+    lfb.lbuf = xmalloc_bytes(lfb.lfbp.bytes_per_line);
+    if ( !lfb.lbuf )
+        goto fail;
+
+    lfb.text_buf = xzalloc_bytes(lfb.lfbp.text_columns * lfb.lfbp.text_rows);
+    if ( !lfb.text_buf )
+        goto fail;
+
+    lfb.line_len = xzalloc_array(unsigned int, lfb.lfbp.text_columns);
+    if ( !lfb.line_len )
+        goto fail;
+
+    memcpy(lfb.lbuf, lbuf, lfb.lfbp.bytes_per_line);
+    memcpy(lfb.text_buf, text_buf, lfb.lfbp.text_columns * lfb.lfbp.text_rows);
+    memcpy(lfb.line_len, line_len, lfb.lfbp.text_columns);
+
+    return 0;
+
+fail:
+    printk(XENLOG_ERR "Couldn't allocate enough memory to drive the framebuffer\n");
+    lfb_free();

xen/drivers/video/lfb.c line 206

Quoted 10 lines
xen/drivers/video/lfb.c new file +10 -0
+
+    return -ENOMEM;
+}
+
+void lfb_free(void)
+{
+    xfree(lfb.lbuf);
+    xfree(lfb.text_buf);
+    xfree(lfb.line_len);
+}

This function would then perhaps better go before the __init stuff.

Quoted 8 lines
xen/drivers/video/lfb.c new file +1 -1
@@ -139,15 +131,14 @@ void __init vesa_init(void)
     else
     {
         /* White(ish) in default pseudocolor palette. */
-        pixel_on = 7;
+        fbp.pixel_on = 7;
     }
 

xen/drivers/video/lfb.c void __init vesa_init(void) · line 140

Quoted 10 lines
xen/drivers/video/lfb.c new file +4 -6
-    return;
-
- fail:
-    xfree(lbuf);
-    xfree(text_buf);
-    xfree(line_len);
+    if ( lfb_init(&lfbp) < 0 )
+        return;
+    if ( lfb_alloc() < 0 )
+        return;

What's the point of calling lfb_alloc() right after lfb_init()? The static buffers set up by lfb_init() will get replaced by dynamically allocated ones right away. Or in other words - what do you need the static buffers for in the first place?

Jan

Quoted 4 lines
xen/drivers/video/lfb.c new file +1 -0
+    video_puts = lfb_redraw_puts;
 }
 
 #include <asm/mtrr.h>
#13 lore raw

Re: [PATCH v4 3/7] xen: introduce a generic framebuffer driver

Quoted 22 lines · Jan Beulich
Quoted 22 lines
Quoted 1 line
Quoted 1 line · Stefano Stabellini
xen/drivers/video/lfb.c new file +18 -0
@@ -0,0 +1,206 @@
+/******************************************************************************
+ * lfb.c
+ *
+ * linear frame buffer handling.
+ */
+
+#include <xen/config.h>
+#include <xen/kernel.h>
+#include <xen/lib.h>
+#include <xen/errno.h>
+#include "lfb.h"
+#include "font.h"
+
+#define MAX_XRES 1900
+#define MAX_YRES 1200
+#define MAX_BPP 4
+#define MAX_FONT_W 8
+#define MAX_FONT_H 16
Quoted 8 lines

xen/drivers/video/lfb.c line 22

Quoted 4 lines
xen/drivers/video/lfb.c new file +4 -0
+static __initdata unsigned int line_len[MAX_XRES / MAX_FONT_W];
+static __initdata unsigned char lbuf[MAX_XRES * MAX_BPP];
+static __initdata unsigned char text_buf[(MAX_XRES / MAX_FONT_W) * \
+                          (MAX_YRES / MAX_FONT_H)];

Imo it would be better to move all these __initdata definitions do to where the using __init functions actually live, to make sure unintended use of them in non-__init ones is noticed.

OK

Quoted 108 lines
Quoted 108 lines
xen/drivers/video/lfb.c new file +108 -0
+
+struct lfb_status {
+    struct lfb_prop lfbp;
+
+    unsigned char *lbuf, *text_buf;
+    unsigned int *line_len;
+    unsigned int xpos, ypos;
+};
+static struct lfb_status lfb;
+
+static void lfb_show_line(
+    const unsigned char *text_line,
+    unsigned char *video_line,
+    unsigned int nr_chars,
+    unsigned int nr_cells)
+{
+    unsigned int i, j, b, bpp, pixel;
+
+    bpp = (lfb.lfbp.bits_per_pixel + 7) >> 3;
+
+    for ( i = 0; i < lfb.lfbp.font->height; i++ )
+    {
+        unsigned char *ptr = lfb.lbuf;
+
+        for ( j = 0; j < nr_chars; j++ )
+        {
+            const unsigned char *bits = lfb.lfbp.font->data;
+            bits += ((text_line[j] * lfb.lfbp.font->height + i) *
+                     ((lfb.lfbp.font->width + 7) >> 3));
+            for ( b = lfb.lfbp.font->width; b--; )
+            {
+                pixel = (*bits & (1u<<b)) ? lfb.lfbp.pixel_on : 0;
+                memcpy(ptr, &pixel, bpp);
+                ptr += bpp;
+            }
+        }
+
+        memset(ptr, 0, (lfb.lfbp.width - nr_chars * lfb.lfbp.font->width) * bpp);
+        memcpy(video_line, lfb.lbuf, nr_cells * lfb.lfbp.font->width * bpp);
+        video_line += lfb.lfbp.bytes_per_line;
+    }
+}
+
+/* Fast mode which redraws all modified parts of a 2D text buffer. */
+void lfb_redraw_puts(const char *s)
+{
+    unsigned int i, min_redraw_y = lfb.ypos;
+    char c;
+
+    /* Paste characters into text buffer. */
+    while ( (c = *s++) != '\0' )
+    {
+        if ( (c == '\n') || (lfb.xpos >= lfb.lfbp.text_columns) )
+        {
+            if ( ++lfb.ypos >= lfb.lfbp.text_rows )
+            {
+                min_redraw_y = 0;
+                lfb.ypos = lfb.lfbp.text_rows - 1;
+                memmove(lfb.text_buf, lfb.text_buf + lfb.lfbp.text_columns,
+                        lfb.ypos * lfb.lfbp.text_columns);
+                memset(lfb.text_buf + lfb.ypos * lfb.lfbp.text_columns, 0, lfb.xpos);
+            }
+            lfb.xpos = 0;
+        }
+
+        if ( c != '\n' )
+            lfb.text_buf[lfb.xpos++ + lfb.ypos * lfb.lfbp.text_columns] = c;
+    }
+
+    /* Render modified section of text buffer to VESA linear framebuffer. */
+    for ( i = min_redraw_y; i <= lfb.ypos; i++ )
+    {
+        const unsigned char *line = lfb.text_buf + i * lfb.lfbp.text_columns;
+        unsigned int width;
+
+        for ( width = lfb.lfbp.text_columns; width; --width )
+            if ( line[width - 1] )
+                 break;
+        lfb_show_line(line,
+                       lfb.lfbp.lfb + i * lfb.lfbp.font->height * lfb.lfbp.bytes_per_line,
+                       width, max(lfb.line_len[i], width));
+        lfb.line_len[i] = width;
+    }
+
+    lfb.lfbp.flush();
+}
+
+/* Slower line-based scroll mode which interacts better with dom0. */
+void lfb_scroll_puts(const char *s)
+{
+    unsigned int i;
+    char c;
+
+    while ( (c = *s++) != '\0' )
+    {
+        if ( (c == '\n') || (lfb.xpos >= lfb.lfbp.text_columns) )
+        {
+            unsigned int bytes = (lfb.lfbp.width *
+                                  ((lfb.lfbp.bits_per_pixel + 7) >> 3));
+            unsigned char *src = lfb.lfbp.lfb + lfb.lfbp.font->height * lfb.lfbp.bytes_per_line;
+            unsigned char *dst = lfb.lfbp.lfb;
+
+            /* New line: scroll all previous rows up one line. */
+            for ( i = lfb.lfbp.font->height; i < lfb.lfbp.height; i++ )
+            {
+                memcpy(dst, src, bytes);
+                src += lfb.lfbp.bytes_per_line;
+                dst += lfb.lfbp.bytes_per_line;
Quoted 8 lines

xen/drivers/video/lfb.c line 136

Quoted 6 lines
xen/drivers/video/lfb.c new file +6 -0
+            }
+
+            /* Render new line. */
+            lfb_show_line(
+                lfb.text_buf,
+                lfb.lfbp.lfb + (lfb.lfbp.text_rows-1) * lfb.lfbp.font->height * lfb.lfbp.bytes_per_line,

Long line?

Right

Quoted 17 lines
Quoted 17 lines
xen/drivers/video/lfb.c new file +17 -0
+                lfb.xpos, lfb.lfbp.text_columns);
+
+            lfb.xpos = 0;
+        }
+
+        if ( c != '\n' )
+            lfb.text_buf[lfb.xpos++] = c;
+    }
+
+    lfb.lfbp.flush();
+}
+
+void lfb_carriage_return(void)
+{
+    lfb.xpos = 0;
+}
+
Quoted 8 lines

xen/drivers/video/lfb.c line 159

Quoted 6 lines
xen/drivers/video/lfb.c new file +6 -0
+int __init lfb_init(struct lfb_prop *lfbp)
+{
+    if ( lfbp->width > MAX_XRES || lfbp->height > MAX_YRES )
+    {
+        printk(XENLOG_WARNING "Couldn't initialize a %ux%u framebuffer early.\n",
+                        lfbp->width, lfbp->height);

Indentation?

OK

Quoted 59 lines
Quoted 37 lines
xen/drivers/video/lfb.c new file +37 -0
+        return -EINVAL;
+    }
+
+    lfb.lfbp = *lfbp;
+    lfb.lbuf = lbuf;
+    lfb.text_buf = text_buf;
+    lfb.line_len = line_len;
+    return 0;
+}
+
+int __init lfb_alloc(void)
+{
+    lfb.lbuf = NULL;
+    lfb.text_buf = NULL;
+    lfb.line_len = NULL;
+
+    lfb.lbuf = xmalloc_bytes(lfb.lfbp.bytes_per_line);
+    if ( !lfb.lbuf )
+        goto fail;
+
+    lfb.text_buf = xzalloc_bytes(lfb.lfbp.text_columns * lfb.lfbp.text_rows);
+    if ( !lfb.text_buf )
+        goto fail;
+
+    lfb.line_len = xzalloc_array(unsigned int, lfb.lfbp.text_columns);
+    if ( !lfb.line_len )
+        goto fail;
+
+    memcpy(lfb.lbuf, lbuf, lfb.lfbp.bytes_per_line);
+    memcpy(lfb.text_buf, text_buf, lfb.lfbp.text_columns * lfb.lfbp.text_rows);
+    memcpy(lfb.line_len, line_len, lfb.lfbp.text_columns);
+
+    return 0;
+
+fail:
+    printk(XENLOG_ERR "Couldn't allocate enough memory to drive the framebuffer\n");
+    lfb_free();

xen/drivers/video/lfb.c line 206

Quoted 10 lines
xen/drivers/video/lfb.c new file +10 -0
+
+    return -ENOMEM;
+}
+
+void lfb_free(void)
+{
+    xfree(lfb.lbuf);
+    xfree(lfb.text_buf);
+    xfree(lfb.line_len);
+}

This function would then perhaps better go before the __init stuff.

Quoted 8 lines
xen/drivers/video/lfb.c new file +1 -1
@@ -139,15 +131,14 @@ void __init vesa_init(void)
     else
     {
         /* White(ish) in default pseudocolor palette. */
-        pixel_on = 7;
+        fbp.pixel_on = 7;
     }
 
Quoted 15 lines

xen/drivers/video/lfb.c void __init vesa_init(void) · line 140

Quoted 10 lines
xen/drivers/video/lfb.c new file +4 -6
-    return;
-
- fail:
-    xfree(lbuf);
-    xfree(text_buf);
-    xfree(line_len);
+    if ( lfb_init(&lfbp) < 0 )
+        return;
+    if ( lfb_alloc() < 0 )
+        return;

What's the point of calling lfb_alloc() right after lfb_init()? The static buffers set up by lfb_init() will get replaced by dynamically allocated ones right away. Or in other words - what do you need the static buffers for in the first place?

The idea was that you could have output on the screen before xmalloc works.

Given that vesa_init is always called after xmalloc is available we call lfb_alloc() right away. Thanks to the fact that I moved setup_mm() earlier in the ARM version of start_xen, that should be now possible for the arm_hdlcd driver too. I'll to remove lfb_alloc.

#14 lore raw

Re: [PATCH v4 3/7] xen: introduce a generic framebuffer driver

Quoted 148 lines · Stefano Stabellini
Quoted 21 lines · Jan Beulich
Quoted 21 lines
Quoted 1 line
Quoted 1 line · Stefano Stabellini
xen/drivers/video/lfb.c new file +17 -0
@@ -0,0 +1,206 @@
+/******************************************************************************
+ * lfb.c
+ *
+ * linear frame buffer handling.
+ */
+
+#include <xen/config.h>
+#include <xen/kernel.h>
+#include <xen/lib.h>
+#include <xen/errno.h>
+#include "lfb.h"
+#include "font.h"
+
+#define MAX_XRES 1900
+#define MAX_YRES 1200
+#define MAX_BPP 4
+#define MAX_FONT_W 8
Quoted 8 lines

xen/drivers/video/lfb.c line 22

Quoted 5 lines
xen/drivers/video/lfb.c new file +5 -0
+#define MAX_FONT_H 16
+static __initdata unsigned int line_len[MAX_XRES / MAX_FONT_W];
+static __initdata unsigned char lbuf[MAX_XRES * MAX_BPP];
+static __initdata unsigned char text_buf[(MAX_XRES / MAX_FONT_W) * \
+                          (MAX_YRES / MAX_FONT_H)];

Imo it would be better to move all these __initdata definitions do to where the using __init functions actually live, to make sure unintended use of them in non-__init ones is noticed.

OK

Quoted 107 lines
Quoted 107 lines
xen/drivers/video/lfb.c new file +107 -0
+
+struct lfb_status {
+    struct lfb_prop lfbp;
+
+    unsigned char *lbuf, *text_buf;
+    unsigned int *line_len;
+    unsigned int xpos, ypos;
+};
+static struct lfb_status lfb;
+
+static void lfb_show_line(
+    const unsigned char *text_line,
+    unsigned char *video_line,
+    unsigned int nr_chars,
+    unsigned int nr_cells)
+{
+    unsigned int i, j, b, bpp, pixel;
+
+    bpp = (lfb.lfbp.bits_per_pixel + 7) >> 3;
+
+    for ( i = 0; i < lfb.lfbp.font->height; i++ )
+    {
+        unsigned char *ptr = lfb.lbuf;
+
+        for ( j = 0; j < nr_chars; j++ )
+        {
+            const unsigned char *bits = lfb.lfbp.font->data;
+            bits += ((text_line[j] * lfb.lfbp.font->height + i) *
+                     ((lfb.lfbp.font->width + 7) >> 3));
+            for ( b = lfb.lfbp.font->width; b--; )
+            {
+                pixel = (*bits & (1u<<b)) ? lfb.lfbp.pixel_on : 0;
+                memcpy(ptr, &pixel, bpp);
+                ptr += bpp;
+            }
+        }
+
+        memset(ptr, 0, (lfb.lfbp.width - nr_chars * lfb.lfbp.font->width) * bpp);
+        memcpy(video_line, lfb.lbuf, nr_cells * lfb.lfbp.font->width * bpp);
+        video_line += lfb.lfbp.bytes_per_line;
+    }
+}
+
+/* Fast mode which redraws all modified parts of a 2D text buffer. */
+void lfb_redraw_puts(const char *s)
+{
+    unsigned int i, min_redraw_y = lfb.ypos;
+    char c;
+
+    /* Paste characters into text buffer. */
+    while ( (c = *s++) != '\0' )
+    {
+        if ( (c == '\n') || (lfb.xpos >= lfb.lfbp.text_columns) )
+        {
+            if ( ++lfb.ypos >= lfb.lfbp.text_rows )
+            {
+                min_redraw_y = 0;
+                lfb.ypos = lfb.lfbp.text_rows - 1;
+                memmove(lfb.text_buf, lfb.text_buf + lfb.lfbp.text_columns,
+                        lfb.ypos * lfb.lfbp.text_columns);
+                memset(lfb.text_buf + lfb.ypos * lfb.lfbp.text_columns, 0, lfb.xpos);
+            }
+            lfb.xpos = 0;
+        }
+
+        if ( c != '\n' )
+            lfb.text_buf[lfb.xpos++ + lfb.ypos * lfb.lfbp.text_columns] = c;
+    }
+
+    /* Render modified section of text buffer to VESA linear framebuffer. */
+    for ( i = min_redraw_y; i <= lfb.ypos; i++ )
+    {
+        const unsigned char *line = lfb.text_buf + i * lfb.lfbp.text_columns;
+        unsigned int width;
+
+        for ( width = lfb.lfbp.text_columns; width; --width )
+            if ( line[width - 1] )
+                 break;
+        lfb_show_line(line,
+                       lfb.lfbp.lfb + i * lfb.lfbp.font->height * lfb.lfbp.bytes_per_line,
+                       width, max(lfb.line_len[i], width));
+        lfb.line_len[i] = width;
+    }
+
+    lfb.lfbp.flush();
+}
+
+/* Slower line-based scroll mode which interacts better with dom0. */
+void lfb_scroll_puts(const char *s)
+{
+    unsigned int i;
+    char c;
+
+    while ( (c = *s++) != '\0' )
+    {
+        if ( (c == '\n') || (lfb.xpos >= lfb.lfbp.text_columns) )
+        {
+            unsigned int bytes = (lfb.lfbp.width *
+                                  ((lfb.lfbp.bits_per_pixel + 7) >> 3));
+            unsigned char *src = lfb.lfbp.lfb + lfb.lfbp.font->height * lfb.lfbp.bytes_per_line;
+            unsigned char *dst = lfb.lfbp.lfb;
+
+            /* New line: scroll all previous rows up one line. */
+            for ( i = lfb.lfbp.font->height; i < lfb.lfbp.height; i++ )
+            {
+                memcpy(dst, src, bytes);
+                src += lfb.lfbp.bytes_per_line;
Quoted 8 lines

xen/drivers/video/lfb.c line 136

Quoted 7 lines
xen/drivers/video/lfb.c new file +7 -0
+                dst += lfb.lfbp.bytes_per_line;
+            }
+
+            /* Render new line. */
+            lfb_show_line(
+                lfb.text_buf,
+                lfb.lfbp.lfb + (lfb.lfbp.text_rows-1) * lfb.lfbp.font->height * lfb.lfbp.bytes_per_line,

Long line?

Quoted 2 lines

Right

The calculation of

lfb.lfbp.lfb + lfb.lfbp.font->height * lfb.lfbp.bytes_per_line;

is done twice in the above section - surely that's constant over time, so could be stored in another local variable - thus making the line shorter and at the same time more obvious that "it's the same thing".

--
Mats

#15 lore raw

Re: [PATCH v4 3/7] xen: introduce a generic framebuffer driver

Quoted 149 lines · Mats Petersson
Quoted 148 lines · Stefano Stabellini
Quoted 21 lines · Jan Beulich
Quoted 21 lines
Quoted 1 line
Quoted 1 line · Stefano Stabellini
xen/drivers/video/lfb.c new file +17 -0
@@ -0,0 +1,206 @@
+/******************************************************************************
+ * lfb.c
+ *
+ * linear frame buffer handling.
+ */
+
+#include <xen/config.h>
+#include <xen/kernel.h>
+#include <xen/lib.h>
+#include <xen/errno.h>
+#include "lfb.h"
+#include "font.h"
+
+#define MAX_XRES 1900
+#define MAX_YRES 1200
+#define MAX_BPP 4
+#define MAX_FONT_W 8
Quoted 8 lines

xen/drivers/video/lfb.c line 22

Quoted 5 lines
xen/drivers/video/lfb.c new file +5 -0
+#define MAX_FONT_H 16
+static __initdata unsigned int line_len[MAX_XRES / MAX_FONT_W];
+static __initdata unsigned char lbuf[MAX_XRES * MAX_BPP];
+static __initdata unsigned char text_buf[(MAX_XRES / MAX_FONT_W) * \
+                          (MAX_YRES / MAX_FONT_H)];

Imo it would be better to move all these __initdata definitions do to where the using __init functions actually live, to make sure unintended use of them in non-__init ones is noticed.

OK

Quoted 115 lines
Quoted 104 lines
xen/drivers/video/lfb.c new file +104 -0
+
+struct lfb_status {
+    struct lfb_prop lfbp;
+
+    unsigned char *lbuf, *text_buf;
+    unsigned int *line_len;
+    unsigned int xpos, ypos;
+};
+static struct lfb_status lfb;
+
+static void lfb_show_line(
+    const unsigned char *text_line,
+    unsigned char *video_line,
+    unsigned int nr_chars,
+    unsigned int nr_cells)
+{
+    unsigned int i, j, b, bpp, pixel;
+
+    bpp = (lfb.lfbp.bits_per_pixel + 7) >> 3;
+
+    for ( i = 0; i < lfb.lfbp.font->height; i++ )
+    {
+        unsigned char *ptr = lfb.lbuf;
+
+        for ( j = 0; j < nr_chars; j++ )
+        {
+            const unsigned char *bits = lfb.lfbp.font->data;
+            bits += ((text_line[j] * lfb.lfbp.font->height + i) *
+                     ((lfb.lfbp.font->width + 7) >> 3));
+            for ( b = lfb.lfbp.font->width; b--; )
+            {
+                pixel = (*bits & (1u<<b)) ? lfb.lfbp.pixel_on : 0;
+                memcpy(ptr, &pixel, bpp);
+                ptr += bpp;
+            }
+        }
+
+        memset(ptr, 0, (lfb.lfbp.width - nr_chars * lfb.lfbp.font->width) * bpp);
+        memcpy(video_line, lfb.lbuf, nr_cells * lfb.lfbp.font->width * bpp);
+        video_line += lfb.lfbp.bytes_per_line;
+    }
+}
+
+/* Fast mode which redraws all modified parts of a 2D text buffer. */
+void lfb_redraw_puts(const char *s)
+{
+    unsigned int i, min_redraw_y = lfb.ypos;
+    char c;
+
+    /* Paste characters into text buffer. */
+    while ( (c = *s++) != '\0' )
+    {
+        if ( (c == '\n') || (lfb.xpos >= lfb.lfbp.text_columns) )
+        {
+            if ( ++lfb.ypos >= lfb.lfbp.text_rows )
+            {
+                min_redraw_y = 0;
+                lfb.ypos = lfb.lfbp.text_rows - 1;
+                memmove(lfb.text_buf, lfb.text_buf + lfb.lfbp.text_columns,
+                        lfb.ypos * lfb.lfbp.text_columns);
+                memset(lfb.text_buf + lfb.ypos * lfb.lfbp.text_columns, 0, lfb.xpos);
+            }
+            lfb.xpos = 0;
+        }
+
+        if ( c != '\n' )
+            lfb.text_buf[lfb.xpos++ + lfb.ypos * lfb.lfbp.text_columns] = c;
+    }
+
+    /* Render modified section of text buffer to VESA linear framebuffer. */
+    for ( i = min_redraw_y; i <= lfb.ypos; i++ )
+    {
+        const unsigned char *line = lfb.text_buf + i * lfb.lfbp.text_columns;
+        unsigned int width;
+
+        for ( width = lfb.lfbp.text_columns; width; --width )
+            if ( line[width - 1] )
+                 break;
+        lfb_show_line(line,
+                       lfb.lfbp.lfb + i * lfb.lfbp.font->height * lfb.lfbp.bytes_per_line,
+                       width, max(lfb.line_len[i], width));
+        lfb.line_len[i] = width;
+    }
+
+    lfb.lfbp.flush();
+}
+
+/* Slower line-based scroll mode which interacts better with dom0. */
+void lfb_scroll_puts(const char *s)
+{
+    unsigned int i;
+    char c;
+
+    while ( (c = *s++) != '\0' )
+    {
+        if ( (c == '\n') || (lfb.xpos >= lfb.lfbp.text_columns) )
+        {
+            unsigned int bytes = (lfb.lfbp.width *
+                                  ((lfb.lfbp.bits_per_pixel + 7) >> 3));
+            unsigned char *src = lfb.lfbp.lfb + lfb.lfbp.font->height * lfb.lfbp.bytes_per_line;
+            unsigned char *dst = lfb.lfbp.lfb;
+
+            /* New line: scroll all previous rows up one line. */
+            for ( i = lfb.lfbp.font->height; i < lfb.lfbp.height; i++ )

xen/drivers/video/lfb.c line 136

Quoted 10 lines
xen/drivers/video/lfb.c new file +10 -0
+            {
+                memcpy(dst, src, bytes);
+                src += lfb.lfbp.bytes_per_line;
+                dst += lfb.lfbp.bytes_per_line;
+            }
+
+            /* Render new line. */
+            lfb_show_line(
+                lfb.text_buf,
+                lfb.lfbp.lfb + (lfb.lfbp.text_rows-1) * lfb.lfbp.font->height * lfb.lfbp.bytes_per_line,

Long line?

Quoted 7 lines
Quoted 2 lines

Right

The calculation of

lfb.lfbp.lfb + lfb.lfbp.font->height * lfb.lfbp.bytes_per_line;

is done twice in the above section - surely that's constant over time, so could be stored in another local variable - thus making the line shorter and at the same time more obvious that "it's the same thing".

No, it isn't! I started out with

lfb.lfbp.font->height * lfb.lfbp.bytes_per_line

being calculated twice. Then mistakenly thought that it was MORE of the same, missing out that the second calculation is different. Sorry for that. But the font->hight * bytes_per_line calculation is definitely the same in both places.

--
Mats

Quoted 12 lines

--
Mats

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#16 lore raw

Re: [PATCH v4 3/7] xen: introduce a generic framebuffer driver

Quoted 154 lines · Mats Petersson
Quoted 153 lines · Mats Petersson
Quoted 148 lines · Stefano Stabellini
Quoted 21 lines · Jan Beulich
Quoted 21 lines
Quoted 1 line
Quoted 1 line · Stefano Stabellini
xen/drivers/video/lfb.c new file +17 -0
@@ -0,0 +1,206 @@
+/******************************************************************************
+ * lfb.c
+ *
+ * linear frame buffer handling.
+ */
+
+#include <xen/config.h>
+#include <xen/kernel.h>
+#include <xen/lib.h>
+#include <xen/errno.h>
+#include "lfb.h"
+#include "font.h"
+
+#define MAX_XRES 1900
+#define MAX_YRES 1200
+#define MAX_BPP 4
+#define MAX_FONT_W 8
Quoted 8 lines

xen/drivers/video/lfb.c line 22

Quoted 5 lines
xen/drivers/video/lfb.c new file +5 -0
+#define MAX_FONT_H 16
+static __initdata unsigned int line_len[MAX_XRES / MAX_FONT_W];
+static __initdata unsigned char lbuf[MAX_XRES * MAX_BPP];
+static __initdata unsigned char text_buf[(MAX_XRES / MAX_FONT_W) * \
+                          (MAX_YRES / MAX_FONT_H)];

Imo it would be better to move all these __initdata definitions do to where the using __init functions actually live, to make sure unintended use of them in non-__init ones is noticed.

OK

Quoted 107 lines
Quoted 107 lines
xen/drivers/video/lfb.c new file +107 -0
+
+struct lfb_status {
+    struct lfb_prop lfbp;
+
+    unsigned char *lbuf, *text_buf;
+    unsigned int *line_len;
+    unsigned int xpos, ypos;
+};
+static struct lfb_status lfb;
+
+static void lfb_show_line(
+    const unsigned char *text_line,
+    unsigned char *video_line,
+    unsigned int nr_chars,
+    unsigned int nr_cells)
+{
+    unsigned int i, j, b, bpp, pixel;
+
+    bpp = (lfb.lfbp.bits_per_pixel + 7) >> 3;
+
+    for ( i = 0; i < lfb.lfbp.font->height; i++ )
+    {
+        unsigned char *ptr = lfb.lbuf;
+
+        for ( j = 0; j < nr_chars; j++ )
+        {
+            const unsigned char *bits = lfb.lfbp.font->data;
+            bits += ((text_line[j] * lfb.lfbp.font->height + i) *
+                     ((lfb.lfbp.font->width + 7) >> 3));
+            for ( b = lfb.lfbp.font->width; b--; )
+            {
+                pixel = (*bits & (1u<<b)) ? lfb.lfbp.pixel_on : 0;
+                memcpy(ptr, &pixel, bpp);
+                ptr += bpp;
+            }
+        }
+
+        memset(ptr, 0, (lfb.lfbp.width - nr_chars * lfb.lfbp.font->width) * bpp);
+        memcpy(video_line, lfb.lbuf, nr_cells * lfb.lfbp.font->width * bpp);
+        video_line += lfb.lfbp.bytes_per_line;
+    }
+}
+
+/* Fast mode which redraws all modified parts of a 2D text buffer. */
+void lfb_redraw_puts(const char *s)
+{
+    unsigned int i, min_redraw_y = lfb.ypos;
+    char c;
+
+    /* Paste characters into text buffer. */
+    while ( (c = *s++) != '\0' )
+    {
+        if ( (c == '\n') || (lfb.xpos >= lfb.lfbp.text_columns) )
+        {
+            if ( ++lfb.ypos >= lfb.lfbp.text_rows )
+            {
+                min_redraw_y = 0;
+                lfb.ypos = lfb.lfbp.text_rows - 1;
+                memmove(lfb.text_buf, lfb.text_buf + lfb.lfbp.text_columns,
+                        lfb.ypos * lfb.lfbp.text_columns);
+                memset(lfb.text_buf + lfb.ypos * lfb.lfbp.text_columns, 0, lfb.xpos);
+            }
+            lfb.xpos = 0;
+        }
+
+        if ( c != '\n' )
+            lfb.text_buf[lfb.xpos++ + lfb.ypos * lfb.lfbp.text_columns] = c;
+    }
+
+    /* Render modified section of text buffer to VESA linear framebuffer. */
+    for ( i = min_redraw_y; i <= lfb.ypos; i++ )
+    {
+        const unsigned char *line = lfb.text_buf + i * lfb.lfbp.text_columns;
+        unsigned int width;
+
+        for ( width = lfb.lfbp.text_columns; width; --width )
+            if ( line[width - 1] )
+                 break;
+        lfb_show_line(line,
+                       lfb.lfbp.lfb + i * lfb.lfbp.font->height * lfb.lfbp.bytes_per_line,
+                       width, max(lfb.line_len[i], width));
+        lfb.line_len[i] = width;
+    }
+
+    lfb.lfbp.flush();
+}
+
+/* Slower line-based scroll mode which interacts better with dom0. */
+void lfb_scroll_puts(const char *s)
+{
+    unsigned int i;
+    char c;
+
+    while ( (c = *s++) != '\0' )
+    {
+        if ( (c == '\n') || (lfb.xpos >= lfb.lfbp.text_columns) )
+        {
+            unsigned int bytes = (lfb.lfbp.width *
+                                  ((lfb.lfbp.bits_per_pixel + 7) >> 3));
+            unsigned char *src = lfb.lfbp.lfb + lfb.lfbp.font->height * lfb.lfbp.bytes_per_line;
+            unsigned char *dst = lfb.lfbp.lfb;
+
+            /* New line: scroll all previous rows up one line. */
+            for ( i = lfb.lfbp.font->height; i < lfb.lfbp.height; i++ )
+            {
+                memcpy(dst, src, bytes);
+                src += lfb.lfbp.bytes_per_line;
Quoted 8 lines

xen/drivers/video/lfb.c line 136

Quoted 7 lines
xen/drivers/video/lfb.c new file +7 -0
+                dst += lfb.lfbp.bytes_per_line;
+            }
+
+            /* Render new line. */
+            lfb_show_line(
+                lfb.text_buf,
+                lfb.lfbp.lfb + (lfb.lfbp.text_rows-1) * lfb.lfbp.font->height * lfb.lfbp.bytes_per_line,

Long line?

Quoted 2 lines

Right

The calculation of

Quoted 8 lines
Quoted 3 lines

lfb.lfbp.lfb + lfb.lfbp.font->height * lfb.lfbp.bytes_per_line;

is done twice in the above section - surely that's constant over time, so could be stored in another local variable - thus making the line shorter and at the same time more obvious that "it's the same thing".

No, it isn't! I started out with

lfb.lfbp.font->height * lfb.lfbp.bytes_per_line

being calculated twice. Then mistakenly thought that it was MORE of the same, missing out that the second calculation is different. Sorry for that. But the font->hight * bytes_per_line calculation is definitely the same in both places.

Thanks for the review!

lfb_scroll_puts and lfb_show_line are just vesa_scroll_puts and vesa_show_line renamed and with some basic variable name changes. I would be reticent to change them in this patch unless necessary.

#17 lore raw

PATCH v4 4/7 xen/arm: move setup_mm right after setup_pagetables

In reply to Stefano Stabellini

At the moment we destroy the DTB mappings we have in setup_pagetables and we restore them only in setup_mm.

Move setup_mm right after setup_pagetables so that we don't leave over portions of the initialization code without a working DTB mapping.

---
 xen/arch/arm/setup.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
xen/arch/arm/setup.c +1 -2
index 2076724..8882514 100644
@@ -212,6 +212,7 @@ void __init start_xen(unsigned long boot_phys_offset,
     cmdline_parse(device_tree_bootargs(fdt));
 
     setup_pagetables(boot_phys_offset, get_xen_paddr());
+    setup_mm(atag_paddr, fdt_size);
 
 #ifdef EARLY_UART_ADDRESS
     /* TODO Need to get device tree or command line for UART address */
@@ -229,8 +230,6 @@ void __init start_xen(unsigned long boot_phys_offset,
 
     init_xen_time();
 
-    setup_mm(atag_paddr, fdt_size);
-
     /* Setup Hyp vector base */
     WRITE_CP32((uint32_t) hyp_traps_vector, HVBAR);
     printk("Set hyp vector base to %"PRIx32" (expected %p)\n",
Signature · 1 line
1.7.2.5
#18 lore raw

Re: [PATCH v4 4/7] xen/arm: move setup_mm right after setup_pagetables

Quoted 5 lines · Stefano Stabellini

At the moment we destroy the DTB mappings we have in setup_pagetables and we restore them only in setup_mm.

Move setup_mm right after setup_pagetables so that we don't leave over portions of the initialization code without a working DTB mapping.

"leave over"? I think you just mean to say "This ensures we have a valid DTB mapping while running the subsequent initialization code" or something like that.

Do you still get the :
printk("Xen heap: %lu pages Dom heap: %lu pages\n
message with this change? Or do all the printks in this function need to become early_printk/early_panic?

Actually, this function has 1x early_printk, 1x printk and 1x panic, it's a bit confused I think ;-)

Quoted 27 lines
---
 xen/arch/arm/setup.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
xen/arch/arm/setup.c +1 -2
index 2076724..8882514 100644
@@ -212,6 +212,7 @@ void __init start_xen(unsigned long boot_phys_offset,
     cmdline_parse(device_tree_bootargs(fdt));
 
     setup_pagetables(boot_phys_offset, get_xen_paddr());
+    setup_mm(atag_paddr, fdt_size);
 
 #ifdef EARLY_UART_ADDRESS
     /* TODO Need to get device tree or command line for UART address */
@@ -229,8 +230,6 @@ void __init start_xen(unsigned long boot_phys_offset,
 
     init_xen_time();
 
-    setup_mm(atag_paddr, fdt_size);
-
     /* Setup Hyp vector base */
     WRITE_CP32((uint32_t) hyp_traps_vector, HVBAR);
     printk("Set hyp vector base to %"PRIx32" (expected %p)\n",
#19 lore raw

Re: [PATCH v4 4/7] xen/arm: move setup_mm right after setup_pagetables

Quoted 10 lines · Ian Campbell
Quoted 5 lines · Stefano Stabellini

At the moment we destroy the DTB mappings we have in setup_pagetables and we restore them only in setup_mm.

Move setup_mm right after setup_pagetables so that we don't leave over portions of the initialization code without a working DTB mapping.

"leave over"? I think you just mean to say "This ensures we have a valid DTB mapping while running the subsequent initialization code" or something like that.

right

Quoted 4 lines

Do you still get the :
printk("Xen heap: %lu pages Dom heap: %lu pages\n
message with this change? Or do all the printks in this function need to become early_printk/early_panic?

Well spotted! I'll turn it into an early_printk.

Quoted 2 lines

Actually, this function has 1x early_printk, 1x printk and 1x panic, it's a bit confused I think ;-)

After the update there are going to be 2 early_printk, but I don't see the panic you are referring to.

Quoted 29 lines
Quoted 26 lines
---
 xen/arch/arm/setup.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
xen/arch/arm/setup.c +1 -2
index 2076724..8882514 100644
@@ -212,6 +212,7 @@ void __init start_xen(unsigned long boot_phys_offset,
     cmdline_parse(device_tree_bootargs(fdt));
 
     setup_pagetables(boot_phys_offset, get_xen_paddr());
+    setup_mm(atag_paddr, fdt_size);
 
 #ifdef EARLY_UART_ADDRESS
     /* TODO Need to get device tree or command line for UART address */
@@ -229,8 +230,6 @@ void __init start_xen(unsigned long boot_phys_offset,
 
     init_xen_time();
 
-    setup_mm(atag_paddr, fdt_size);
-
     /* Setup Hyp vector base */
     WRITE_CP32((uint32_t) hyp_traps_vector, HVBAR);
     printk("Set hyp vector base to %"PRIx32" (expected %p)\n",
#20 lore raw

Re: [PATCH v4 4/7] xen/arm: move setup_mm right after setup_pagetables

Quoted 6 lines · Stefano Stabellini
Quoted 3 lines

Actually, this function has 1x early_printk, 1x printk and 1x panic, it's a bit confused I think ;-)

After the update there are going to be 2 early_printk, but I don't see the panic you are referring to.

AH, it was in my boot-wrapper branch only:

    if ( ! e )
        panic("Not not enough space for xenheap\n");

Sorry about that.

I'll take care of that in my eventual rebasing.

Ian.

#21 lore raw

PATCH v4 5/7 xen/device_tree: introduce find_compatible_node

In reply to Stefano Stabellini

Introduce a find_compatible_node function that can be used by device drivers to find the node corresponding to their device in the device tree.

Initialize device_tree_flattened early in start_xen, so that it is available before setup_mm. Get rid of fdt in the process.

Also add device_tree_node_compatible to device_tree.h, that is currently missing.

Changes in v4:
- stop iterating over the DT nodes in device_tree_for_each_node if func returns a value != 0;
- return 1 from _find_compatible_node when a node is found.

Changes in v2:
- remove fdt;
- return early from _find_compatible_node, if a node has already been found.

---
 xen/arch/arm/setup.c          |    7 ++---
 xen/common/device_tree.c      |   56 +++++++++++++++++++++++++++++++++++++++-
 xen/include/xen/device_tree.h |    3 ++
 3 files changed, 60 insertions(+), 6 deletions(-)
xen/arch/arm/setup.c +3 -4
index 8882514..89ef3df 100644
@@ -196,7 +196,6 @@ void __init start_xen(unsigned long boot_phys_offset,
                       unsigned long atag_paddr,
                       unsigned long cpuid)
 {
-    void *fdt;
     size_t fdt_size;
     int cpus, i;
 
@@ -204,12 +203,12 @@ void __init start_xen(unsigned long boot_phys_offset,
 
     smp_clear_cpu_maps();
 
-    fdt = (void *)BOOT_MISC_VIRT_START
+    device_tree_flattened = (void *)BOOT_MISC_VIRT_START
         + (atag_paddr & ((1 << SECOND_SHIFT) - 1));
-    fdt_size = device_tree_early_init(fdt);
+    fdt_size = device_tree_early_init(device_tree_flattened);
 
     cpus = smp_get_max_cpus();
-    cmdline_parse(device_tree_bootargs(fdt));
+    cmdline_parse(device_tree_bootargs(device_tree_flattened));
 
     setup_pagetables(boot_phys_offset, get_xen_paddr());
     setup_mm(atag_paddr, fdt_size);
xen/common/device_tree.c +54 -2

73 lines not on this page · raw message

xen/include/xen/device_tree.h +3 -0
index a0e3a97..5a75f0e 100644
@@ -54,6 +54,9 @@ void device_tree_set_reg(u32 **cell, u32 address_cells, u32 size_cells,
                          u64 start, u64 size);
 u32 device_tree_get_u32(const void *fdt, int node, const char *prop_name);
 bool_t device_tree_node_matches(const void *fdt, int node, const char *match);
+bool_t device_tree_node_compatible(const void *fdt, int node, const char *match);
+int find_compatible_node(const char *compatible, int *node, int *depth,
+                u32 *address_cells, u32 *size_cells);
 int device_tree_for_each_node(const void *fdt,
                               device_tree_node_func func, void *data);
 const char *device_tree_bootargs(const void *fdt);
Signature · 1 line
1.7.2.5
#22 lore raw

PATCH v4 6/7 xen/arm: introduce vexpress_syscfg

In reply to Stefano Stabellini

Introduce a Versatile Express specific function to read/write motherboard settings.

Changes in v4:
- move the wait loop and the syscfg cfgctrl write into a separate function;
- fix comments;
- define all registers in write;
- move platform_vexpress.c to platforms/vexpress.c;
- move platform_vexpress.h to arm-arm/platforms/vexpress.h.

---
 xen/arch/arm/Makefile                    |    1 +
 xen/arch/arm/mode_switch.S               |    2 +-
 xen/arch/arm/platforms/vexpress.c        |  100 ++++++++++++++++++++++++++++++
 xen/include/asm-arm/platform_vexpress.h  |   17 -----
 xen/include/asm-arm/platforms/vexpress.h |   40 ++++++++++++
 5 files changed, 142 insertions(+), 18 deletions(-)
 create mode 100644 xen/arch/arm/platforms/vexpress.c
 delete mode 100644 xen/include/asm-arm/platform_vexpress.h
 create mode 100644 xen/include/asm-arm/platforms/vexpress.h
xen/arch/arm/Makefile +1 -0
index 4c61b04..781e022 100644
@@ -1,4 +1,5 @@
 subdir-y += lib
+subdir-y += platforms
 
 obj-y += dummy.o
 obj-y += early_printk.o
xen/arch/arm/mode_switch.S +1 -1
index 7c3b357..ba42898 100644
@@ -19,7 +19,7 @@
 
 #include <asm/config.h>
 #include <asm/page.h>
-#include <asm/platform_vexpress.h>
+#include <asm/platforms/vexpress.h>
 #include <asm/asm_defns.h>
 #include "gic.h"
 
xen/arch/arm/platforms/vexpress.c new file +100 -0

100 lines not on this page · raw message

xen/include/asm-arm/platform_vexpress.h deleted +0 -17
deleted file mode 100644
index 3556af3..0000000
@@ -1,17 +0,0 @@
-#ifndef __ASM_ARM_PLATFORM_H
-#define __ASM_ARM_PLATFORM_H
-
-/* V2M */
-#define V2M_SYS_MMIO_BASE     (0x1c010000)
-#define V2M_SYS_FLAGSSET      (0x30)
-#define V2M_SYS_FLAGSCLR      (0x34)
-
-#endif /* __ASM_ARM_PLATFORM_H */
-/*
- * Local variables:
- * mode: C
- * c-set-style: "BSD"
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- */
xen/include/asm-arm/platforms/vexpress.h new file +40 -0
new file mode 100644
index 0000000..e464913
@@ -0,0 +1,40 @@
+#ifndef __ASM_ARM_PLATFORMS_VEXPRESS_H
+#define __ASM_ARM_PLATFORMS_VEXPRESS_H
+
+/* V2M */
+#define V2M_SYS_MMIO_BASE     (0x1c010000)
+#define V2M_SYS_FLAGSSET      (0x30)
+#define V2M_SYS_FLAGSCLR      (0x34)
+
+#define V2M_SYS_CFGDATA       (0x00A0)
+#define V2M_SYS_CFGCTRL       (0x00A4)
+#define V2M_SYS_CFGSTAT       (0x00A8)
+
+#define V2M_SYS_CFG_START     (1<<31)
+#define V2M_SYS_CFG_WRITE     (1<<30)
+#define V2M_SYS_CFG_ERROR     (1<<1)
+#define V2M_SYS_CFG_COMPLETE  (1<<0)
+
+#define V2M_SYS_CFG_OSC_FUNC  1
+#define V2M_SYS_CFG_OSC0      0
+#define V2M_SYS_CFG_OSC1      1
+#define V2M_SYS_CFG_OSC2      2
+#define V2M_SYS_CFG_OSC3      3
+#define V2M_SYS_CFG_OSC4      4
+#define V2M_SYS_CFG_OSC5      5
+
+#ifndef __ASSEMBLY__
+#include <xen/inttypes.h>
+
+int vexpress_syscfg(int write, int function, int device, uint32_t *data);
+#endif
+
+#endif /* __ASM_ARM_PLATFORMS_VEXPRESS_H */
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
Signature · 1 line
1.7.2.5
#23 lore raw

Re: [PATCH v4 6/7] xen/arm: introduce vexpress_syscfg

Quoted 11 lines · Stefano Stabellini

Introduce a Versatile Express specific function to read/write motherboard settings.

Changes in v4:
- move the wait loop and the syscfg cfgctrl write into a separate function;
- fix comments;
- define all registers in write;
- move platform_vexpress.c to platforms/vexpress.c;
- move platform_vexpress.h to arm-arm/platforms/vexpress.h.

Quoted 5 lines
---
 xen/arch/arm/Makefile                    |    1 +
 xen/arch/arm/mode_switch.S               |    2 +-
 xen/arch/arm/platforms/vexpress.c        |  100 ++++++++++++++++++++++++++++++

Did you forget to git add xen/arch/arm/platforms/Makefile ?

Quoted 2 lines
 xen/include/asm-arm/platform_vexpress.h  |   17 -----
 xen/include/asm-arm/platforms/vexpress.h |   40 ++++++++++++

git send-email/format-patch -M is your friend here.

#24 lore raw

Re: [PATCH v4 6/7] xen/arm: introduce vexpress_syscfg

Quoted 12 lines · Ian Campbell
Quoted 11 lines · Stefano Stabellini

Introduce a Versatile Express specific function to read/write motherboard settings.

Changes in v4:
- move the wait loop and the syscfg cfgctrl write into a separate function;
- fix comments;
- define all registers in write;
- move platform_vexpress.c to platforms/vexpress.c;
- move platform_vexpress.h to arm-arm/platforms/vexpress.h.

Quoted 7 lines
Quoted 5 lines
---
 xen/arch/arm/Makefile                    |    1 +
 xen/arch/arm/mode_switch.S               |    2 +-
 xen/arch/arm/platforms/vexpress.c        |  100 ++++++++++++++++++++++++++++++

Did you forget to git add xen/arch/arm/platforms/Makefile ?

oops

Quoted 5 lines
Quoted 2 lines
 xen/include/asm-arm/platform_vexpress.h  |   17 -----
 xen/include/asm-arm/platforms/vexpress.h |   40 ++++++++++++

git send-email/format-patch -M is your friend here.

Ah! I'll use it next time.

#25 lore raw

PATCH v4 7/7 xen/arm: introduce a driver for the ARM HDLCD controller

In reply to Stefano Stabellini

Read the screen resolution setting from device tree, find the corresponding modeline in a small table of standard video modes, set the hardware accordingly.

Use vexpress_syscfg to configure the pixel clock.

Use the generic framebuffer functions to print on the screen.

Changes in v4:
- use a lookup table to set the color masks;
- fix indentation;
- make sure mode_string is not NULL and is not bigger than 16 chars before continuing;
- introduce 2 separate error messages for !hdlcd_start and !framebuffer_start at the beginning of video_init;
- mark get_color_masks and set_pixclock as __init;
- check that we are running on a vexpress machine before calling vexpress_syscfg.

Changes in v2:
- read mode from DT;
- support multiple resolutions;
- use vexpress_syscfg to set the pixclock.

---
 xen/arch/arm/Rules.mk         |    1 +
 xen/drivers/video/Makefile    |    1 +
 xen/drivers/video/arm_hdlcd.c |  280 +++++++++++++++++++++++++++++++++++++++++
 xen/drivers/video/modelines.h |   77 +++++++++++
 xen/include/asm-arm/config.h  |    2 +
 5 files changed, 361 insertions(+), 0 deletions(-)
 create mode 100644 xen/drivers/video/arm_hdlcd.c
 create mode 100644 xen/drivers/video/modelines.h
xen/arch/arm/Rules.mk +1 -0
index fa9f9c1..9580e6b 100644
@@ -8,6 +8,7 @@
 
 HAS_DEVICE_TREE := y
 HAS_VIDEO := y
+HAS_ARM_HDLCD := y
 
 CFLAGS += -fno-builtin -fno-common -Wredundant-decls
 CFLAGS += -iwithprefix include -Werror -Wno-pointer-arith -pipe
xen/drivers/video/Makefile +1 -0
index 77f9d5d..a756292 100644
@@ -4,3 +4,4 @@ obj-$(HAS_VIDEO) += font_8x16.o
 obj-$(HAS_VIDEO) += font_8x8.o
 obj-$(HAS_VIDEO) += lfb.o
 obj-$(HAS_VGA) += vesa.o
+obj-$(HAS_ARM_HDLCD) += arm_hdlcd.o
xen/drivers/video/arm_hdlcd.c new file +280 -0

280 lines not on this page · raw message

xen/drivers/video/modelines.h new file +77 -0

77 lines not on this page · raw message

xen/include/asm-arm/config.h +2 -0
index e5dce5e..8e934a4 100644
@@ -19,6 +19,8 @@
 
 #define CONFIG_DOMAIN_PAGE 1
 
+#define CONFIG_VIDEO 1
+
 #define OPT_CONSOLE_STR "com1"
 
 #ifdef MAX_PHYS_CPUS
Signature · 1 line
1.7.2.5