示例#1
0
        public override bool InitServer()
        {
            System.Diagnostics.Debugger.Log(0, null, "Framebuffer driver started");

            /* Parse properties */
            foreach(var prop in root)
            {
                if (prop.Name == "pmem")
                    pmem = prop.Value as tysos.PhysicalMemoryResource64;
                else if (prop.Name == "vmem")
                    vmem = prop.Value as tysos.VirtualMemoryResource64;
                else if (prop.Name == "height")
                    h = (int)prop.Value;
                else if (prop.Name == "width")
                    w = (int)prop.Value;
                else if (prop.Name == "bpp")
                    bpp = (int)prop.Value;
                else if (prop.Name == "pformat")
                    pformat = (int)prop.Value;
                else if (prop.Name == "stride")
                    str = (int)prop.Value;
            }

            if (pmem == null)
            {
                System.Diagnostics.Debugger.Log(0, null, "pmem not provided");
                return false;
            }
            if (vmem == null)
            {
                System.Diagnostics.Debugger.Log(0, null, "vmem not provided");
                return false;
            }

            pmem.Map(vmem);
            buf = vmem.ToArray();

            System.Diagnostics.Debugger.Log(0, null, "Mode: " + w.ToString() +
                "x" + h.ToString() + "x" + bpp.ToString() + ", stride: " +
                str.ToString() + ", pformat: " + pformat.ToString() + ", paddr: " +
                pmem.Addr64.ToString("X") + ", vaddr: " + vmem.Addr64.ToString());

            if(bpp != 32)
            {
                System.Diagnostics.Debugger.Log(0, null, "BPP " + bpp.ToString() +
                    " not supported");
                return false;
            }

            for(int y = 0; y < h; y++)
            {
                for (int x = 0; x < w; x++)
                    SetPixel(x, y, 0x000000ff);
            }

            root.Add(new File.Property { Name = "class", Value = "framebuffer" });
            Tags.Add("class");

            return true;
        }
示例#2
0
 public void Map(PhysicalMemoryResource64 pmem)
 {
     pmem.Map(this);
 }