* [Qemu-devel] Patch: arm versatile video mode support
@ 2007-03-09 0:48 dmlist
0 siblings, 0 replies; 4+ messages in thread
From: dmlist @ 2007-03-09 0:48 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 539 bytes --]
Hi,
The attached patch examines the kernel command line passed to
qemu-system-arm,
and changes the clcd register to match the CLCD video modes currently
supported by then linux kernel:
video=640x480
video=240x320
video=320x240
Perhaps someone has a more general or a better way of doing this.
Before this patch, the only ways I found to change the video mode of
qemu versatile was to
change the default clcd mode in the kernel code or change the clcd mode
in the qemu code.
The patch applies to 0.9.0 and current CVS.
-Don Mahurin
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: qemu-0.9.0-arm-vga.patch --]
[-- Type: text/x-patch; name="qemu-0.9.0-arm-vga.patch", Size: 3148 bytes --]
diff -ru qemu-0.9.0/hw/arm_sysctl.c qemu-0.9.0-arm-vga/hw/arm_sysctl.c
--- qemu-0.9.0/hw/arm_sysctl.c 2007-02-05 15:01:54.000000000 -0800
+++ qemu-0.9.0-arm-vga/hw/arm_sysctl.c 2007-03-08 11:56:48.000000000 -0800
@@ -22,6 +22,7 @@
uint32_t flags;
uint32_t nvflags;
uint32_t resetlevel;
+ uint32_t clcd;
} arm_sysctl_state;
static uint32_t arm_sysctl_read(void *opaque, target_phys_addr_t offset)
@@ -65,7 +66,7 @@
case 0x4c: /* FLASH */
return 0;
case 0x50: /* CLCD */
- return 0x1000;
+ return s->clcd;
case 0x54: /* CLCDSER */
return 0;
case 0x58: /* BOOTCS */
@@ -157,6 +158,8 @@
break;
case 0x4c: /* FLASH */
case 0x50: /* CLCD */
+ s->clcd = val;
+ break;
case 0x54: /* CLCDSER */
case 0x64: /* DMAPSR0 */
case 0x68: /* DMAPSR1 */
@@ -190,6 +193,35 @@
arm_sysctl_write
};
+static int arm_clcd = -1;
+
+void arm_sysctl_parse_video_preinit(const char *kernel_cmdline)
+{
+#ifndef NO_ARM_VIDEO_PARSE
+ int video = -1;
+ char *video_cmd;
+
+ video_cmd = strstr(kernel_cmdline, "video=");
+ if(video_cmd != NULL)
+ {
+ int video_cmd_len;
+ char *end_video_cmd;
+ video_cmd+=6;
+ end_video_cmd = strchr(video_cmd, ' ');
+ if(end_video_cmd != NULL)
+ video_cmd_len = (int) (end_video_cmd - video_cmd);
+ else
+ video_cmd_len = strlen(video_cmd);
+ if(!strncmp(video_cmd, "320x240", video_cmd_len))
+ arm_clcd = 0x0;
+ else if(!strncmp(video_cmd, "240x320", video_cmd_len))
+ arm_clcd = 0x700;
+ else if(!strncmp(video_cmd, "640x480", video_cmd_len))
+ arm_clcd = 0x1f00;
+ }
+#endif
+}
+
void arm_sysctl_init(uint32_t base, uint32_t sys_id)
{
arm_sysctl_state *s;
@@ -200,6 +232,7 @@
return;
s->base = base;
s->sys_id = sys_id;
+ s->clcd = (arm_clcd >= 0) ? arm_clcd : 0x1000;
iomemtype = cpu_register_io_memory(0, arm_sysctl_readfn,
arm_sysctl_writefn, s);
cpu_register_physical_memory(base, 0x00000fff, iomemtype);
diff -ru qemu-0.9.0/hw/versatilepb.c qemu-0.9.0-arm-vga/hw/versatilepb.c
--- qemu-0.9.0/hw/versatilepb.c 2007-02-05 15:01:54.000000000 -0800
+++ qemu-0.9.0-arm-vga/hw/versatilepb.c 2007-03-08 11:56:34.000000000 -0800
@@ -171,6 +171,10 @@
/* SDRAM at address zero. */
cpu_register_physical_memory(0, ram_size, IO_MEM_RAM);
+#ifndef NO_ARM_VIDEO_PARSE
+ arm_sysctl_parse_video_preinit(kernel_cmdline);
+#endif
+
arm_sysctl_init(0x10000000, 0x41007004);
pic = arm_pic_init_cpu(env);
pic = pl190_init(0x10140000, pic, ARM_PIC_CPU_IRQ, ARM_PIC_CPU_FIQ);
diff -ru qemu-0.9.0/vl.h qemu-0.9.0-arm-vga/vl.h
--- qemu-0.9.0/vl.h 2007-02-05 15:01:54.000000000 -0800
+++ qemu-0.9.0-arm-vga/vl.h 2007-03-08 11:56:24.000000000 -0800
@@ -1327,6 +1327,7 @@
void icp_pit_init(uint32_t base, void *pic, int irq);
/* arm_sysctl.c */
+void arm_sysctl_parse_video_preinit(const char *kernel_cmdline);
void arm_sysctl_init(uint32_t base, uint32_t sys_id);
/* arm_gic.c */
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Qemu-devel] Patch: arm versatile video mode support
@ 2007-03-09 1:44 dmlist
2007-03-09 2:08 ` Paul Brook
0 siblings, 1 reply; 4+ messages in thread
From: dmlist @ 2007-03-09 1:44 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 539 bytes --]
Hi,
The attached patch examines the kernel command line passed to
qemu-system-arm,
and changes the clcd register to match the CLCD video modes currently
supported by then linux kernel:
video=640x480
video=240x320
video=320x240
Perhaps someone has a more general or a better way of doing this.
Before this patch, the only ways I found to change the video mode of
qemu versatile was to
change the default clcd mode in the kernel code or change the clcd mode
in the qemu code.
The patch applies to 0.9.0 and current CVS.
-Don Mahurin
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: qemu-0.9.0-arm-vga.patch --]
[-- Type: text/x-patch; name="qemu-0.9.0-arm-vga.patch", Size: 3148 bytes --]
diff -ru qemu-0.9.0/hw/arm_sysctl.c qemu-0.9.0-arm-vga/hw/arm_sysctl.c
--- qemu-0.9.0/hw/arm_sysctl.c 2007-02-05 15:01:54.000000000 -0800
+++ qemu-0.9.0-arm-vga/hw/arm_sysctl.c 2007-03-08 11:56:48.000000000 -0800
@@ -22,6 +22,7 @@
uint32_t flags;
uint32_t nvflags;
uint32_t resetlevel;
+ uint32_t clcd;
} arm_sysctl_state;
static uint32_t arm_sysctl_read(void *opaque, target_phys_addr_t offset)
@@ -65,7 +66,7 @@
case 0x4c: /* FLASH */
return 0;
case 0x50: /* CLCD */
- return 0x1000;
+ return s->clcd;
case 0x54: /* CLCDSER */
return 0;
case 0x58: /* BOOTCS */
@@ -157,6 +158,8 @@
break;
case 0x4c: /* FLASH */
case 0x50: /* CLCD */
+ s->clcd = val;
+ break;
case 0x54: /* CLCDSER */
case 0x64: /* DMAPSR0 */
case 0x68: /* DMAPSR1 */
@@ -190,6 +193,35 @@
arm_sysctl_write
};
+static int arm_clcd = -1;
+
+void arm_sysctl_parse_video_preinit(const char *kernel_cmdline)
+{
+#ifndef NO_ARM_VIDEO_PARSE
+ int video = -1;
+ char *video_cmd;
+
+ video_cmd = strstr(kernel_cmdline, "video=");
+ if(video_cmd != NULL)
+ {
+ int video_cmd_len;
+ char *end_video_cmd;
+ video_cmd+=6;
+ end_video_cmd = strchr(video_cmd, ' ');
+ if(end_video_cmd != NULL)
+ video_cmd_len = (int) (end_video_cmd - video_cmd);
+ else
+ video_cmd_len = strlen(video_cmd);
+ if(!strncmp(video_cmd, "320x240", video_cmd_len))
+ arm_clcd = 0x0;
+ else if(!strncmp(video_cmd, "240x320", video_cmd_len))
+ arm_clcd = 0x700;
+ else if(!strncmp(video_cmd, "640x480", video_cmd_len))
+ arm_clcd = 0x1f00;
+ }
+#endif
+}
+
void arm_sysctl_init(uint32_t base, uint32_t sys_id)
{
arm_sysctl_state *s;
@@ -200,6 +232,7 @@
return;
s->base = base;
s->sys_id = sys_id;
+ s->clcd = (arm_clcd >= 0) ? arm_clcd : 0x1000;
iomemtype = cpu_register_io_memory(0, arm_sysctl_readfn,
arm_sysctl_writefn, s);
cpu_register_physical_memory(base, 0x00000fff, iomemtype);
diff -ru qemu-0.9.0/hw/versatilepb.c qemu-0.9.0-arm-vga/hw/versatilepb.c
--- qemu-0.9.0/hw/versatilepb.c 2007-02-05 15:01:54.000000000 -0800
+++ qemu-0.9.0-arm-vga/hw/versatilepb.c 2007-03-08 11:56:34.000000000 -0800
@@ -171,6 +171,10 @@
/* SDRAM at address zero. */
cpu_register_physical_memory(0, ram_size, IO_MEM_RAM);
+#ifndef NO_ARM_VIDEO_PARSE
+ arm_sysctl_parse_video_preinit(kernel_cmdline);
+#endif
+
arm_sysctl_init(0x10000000, 0x41007004);
pic = arm_pic_init_cpu(env);
pic = pl190_init(0x10140000, pic, ARM_PIC_CPU_IRQ, ARM_PIC_CPU_FIQ);
diff -ru qemu-0.9.0/vl.h qemu-0.9.0-arm-vga/vl.h
--- qemu-0.9.0/vl.h 2007-02-05 15:01:54.000000000 -0800
+++ qemu-0.9.0-arm-vga/vl.h 2007-03-08 11:56:24.000000000 -0800
@@ -1327,6 +1327,7 @@
void icp_pit_init(uint32_t base, void *pic, int irq);
/* arm_sysctl.c */
+void arm_sysctl_parse_video_preinit(const char *kernel_cmdline);
void arm_sysctl_init(uint32_t base, uint32_t sys_id);
/* arm_gic.c */
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] Patch: arm versatile video mode support
2007-03-09 1:44 [Qemu-devel] Patch: arm versatile video mode support dmlist
@ 2007-03-09 2:08 ` Paul Brook
2007-03-09 17:22 ` dmlist
0 siblings, 1 reply; 4+ messages in thread
From: Paul Brook @ 2007-03-09 2:08 UTC (permalink / raw)
To: qemu-devel; +Cc: dmlist
> Perhaps someone has a more general or a better way of doing this.
> Before this patch, the only ways I found to change the video mode of
> qemu versatile was to
> change the default clcd mode in the kernel code or change the clcd mode
> in the qemu code.
Use fbset.
Paul
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] Patch: arm versatile video mode support
2007-03-09 2:08 ` Paul Brook
@ 2007-03-09 17:22 ` dmlist
0 siblings, 0 replies; 4+ messages in thread
From: dmlist @ 2007-03-09 17:22 UTC (permalink / raw)
To: qemu-devel
Hi Paul,
I wanted a way to change the resolution with a kernel argument. But vga=
or video= didn't seem to have any effect.
My qemu change is admittedly a hack, and a better fix would be to add
video= support to the arm frame buffer support in the kernel.
fbset is usually omitted on an embedded system, and I was trying not to
add anything new to the rootfs.
-Don
On Fri, 9 Mar 2007 02:08:12 +0000, "Paul Brook" <paul@codesourcery.com>
said:
> > Perhaps someone has a more general or a better way of doing this.
> > Before this patch, the only ways I found to change the video mode of
> > qemu versatile was to
> > change the default clcd mode in the kernel code or change the clcd mode
> > in the qemu code.
>
> Use fbset.
>
> Paul
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-03-09 17:23 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-09 1:44 [Qemu-devel] Patch: arm versatile video mode support dmlist
2007-03-09 2:08 ` Paul Brook
2007-03-09 17:22 ` dmlist
-- strict thread matches above, loose matches on Subject: below --
2007-03-09 0:48 dmlist
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).