[okl4-developer] Starting with graphic output
Remy Gottschalk
rgottschalk at linagora.com
Tue May 6 22:10:50 EST 2008
Hi Geoffrey,
First thing thank you again for your support, I am now able to mmap my
dear framebuffer.
> > So if I understand well I got two solutions :
> >
> > The quick'n dirty is to force the mapping by hard checking values in
> > eas_map().
> > And the proper one is to add the right memory region in the
> > configuration files.
> >
> > For the quick one I must admit that I am a little lost and need a little
> > more help about how to do.
>
> I do something like this, but of course we'd rather you do it properly:
>
> + if (!ms) {
> + if ((base >= 0xf0000000)) /* fb phys */
> + badfb = 1;
> + else {
> + printf("%s: base 0x%lx end 0x%lx\n", __func__, base, end);
> + return -1;
> + }
> + }
>
> /*
> * XXX: we need to check the attribs and rights
> */
> - attrib &= ms->attributes;
> + if (ms)
> + attrib &= ms->attributes;
> rwx = L4_Rights(src_fpage);
>
> /*
> * XXX: we map 4k fpages even when bigger mappings are possible
> */
> for (virt = base; virt < end; virt += BASE_PAGESIZE) {
> - if (!memsection_lookup_phys(ms, virt, &phys, &size,
> &iguana_pd))
> - continue;
> + if (!badfb) {
> + if (!memsection_lookup_phys(ms, virt, &phys, &size,
> &iguana_pd))
> + continue;
> + } else {
> + phys = base;
> + size = L4_Size(src_fpage);
> + }
>
>
It tried this and it works like a charm.
>
>
> >
> > Concerning the proper, is it something similar to what is done for the
> > vga memory ? ie adding something like :
> > memory['fb'] = [Region(0xF0000000L, 0xF0400000L, "dedicated")]
> > to the class ia32_pc99_fb in platform/pc99/tools/machines.py
> > and/or a linux_fb flag with the right stuff
> > in ./projects/iguana/SConstruct to add a memsection to Linux.
>
>
> Yes, that's right. This would be the preferred solution.
>
Since I am someone clean :) I also tried this way and it worked too. I
have copied what is done for the VGA memory and did this :
in platform/pc99/tools/machines.py :
class ia32_pc99_fb(ia32_pc99_vga):
+ linux_fb = True
memory = ia32_pc99_vga.memory.copy()
+ memory['fb'] = [Region(0xF0000000L, 0xF2001000L, "dedicated")]
And in projects/iguana/SConstruct :
addressing = addressing
)
linux_env.weaver(wombat).add_memsection(vga_area)
+
+ if getattr(linux_env.machine, "linux_fb", False):
+ addressing = linux_env.WeaverAddressing(physpool='fb',
virt_addr = 0xf0000000)
+ fb_area = linux_env.IguanaMemSection(
+ name = 'fb',
+ base = 0xf0000000,
+ size = 0x2001000,
+ flags = 0x02, # MEM_USER | MEM_FIXED
+ cache_policy = "default",
+ addressing = addressing,
+ zero = False
+ )
+ linux_env.weaver(wombat).add_memsection(fb_area)
Since it was mostly done by instinct could you confirm (or correct of
course) that I have understood of the process.
All those modification end end up in weaver.xml and thus change the
image built and the behavior of iguana letting it know a specific memory
region will be used in a special way.
What was done in platform/pc99/tools/machines.py correspond to
<physical_memory name="fb">
<region base="0xf0000000" size="0x2001000" type="dedicated" />
in the machine section of weaver.xml and only declare the region.
What was done in projects/iguana/SConstruct correspond to
<memsection name="fb" size="0x2001000" virt_addr="0xf0000000"
physpool="fb" zero="false" cache_policy="default" />
and link OKLinux to the region defined informing iguana that it has the
right to access it, the mapping to do and some attributes.
Last thing that bothers me a little, compared to the VGA memory I had to
add the zero = False to avoid a roottask pagefault at initialization
time. (ie roottask write pagefault at f0000000, ip=090035dc - deny) I
"felt" that it was the thing to do but don't clearly understand what it
involves. I seems pretty clear that it disable a "zeroing" at
initialization but why has it to be done ? and is it right and secure to
do so ?
Regards,
--
Remy Gottschalk - rgottschalk at linagora.com
Ingénieur informatique embarquée
Groupe LINAGORA - http://www.linagora.com
Tél.: +33(0)1 58 18 68 28 - Fax : +33(0)1 58 18 68 29
More information about the Developer
mailing list