The happiest screenshot of my entire OS-dev life!

This forums is for OS project announcements including project openings, new releases, update notices, test requests, and job openings (both paying and volunteer).
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

The happiest screenshot of my entire OS-dev life!

Post by JamesM »

Hi,

Title is no joke - I finally got my nvidia 2D acceleration driver working! It took 3-4 days of solid work, but now I have hardware bitblitting and rectangle drawing. Hardware cursors soon to follow!

The screenshow below was generated by the following code (after switching modes with my VBE driver).

Code: Select all

  // Pink background to make sure we see any effects - engine may accidentally blit black pixels for example, and we won't pick that
  // up on a black background.
  for (int x = 0; x < 512; x++)
  {
    for (int y = 0; y < 512; y++)
    {
      pFb->write16(0xF00F, (y * 1024 + x) * 2);
    }
  }

  // Draw an image.
  for (int x = 0; x < 128; x++)
  {
    for (int y = 256; y < 128+256; y++)
    {
      pFb->write16(0xFFFF, (y * 1024 + x) * 2);
    }
  }

  // Card detection is done but not coded yet - hardcoded to the device class in my testbed.
  Dma *pDma = new Dma(pRegs, pFb, NV30A, NV34, 0x300000 /* Card RAM - hardcoded for now */);
  pDma->init();

  pDma->screenToScreenBlit(0, 256, 400, 100, 100, 100);

  pDma->fillRectangle(600, 600, 100, 100);

  for(;;);
}

EDIT - linked to it instead because it's HUUGEE!!!
http://www.jamesmolloy.co.uk/rubbish-bin/nvidia1.jpg
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Re: The happiest screenshot of my entire OS-dev life!

Post by AJ »

Congratulations! I'm already looking forward to the "3D modelling with bump mapping" screen shot =D> I'd top up that glass :)

Cheers,
Adam
DeletedAccount
Member
Member
Posts: 566
Joined: Tue Jun 20, 2006 9:17 am

Re: The happiest screenshot of my entire OS-dev life!

Post by DeletedAccount »

Well done =D>

Regards
Shrek
User avatar
stephenj
Member
Member
Posts: 140
Joined: Wed Jul 23, 2008 1:37 am
Location: Canada

Re: The happiest screenshot of my entire OS-dev life!

Post by stephenj »

Nice!

GUI stuff is the best because you can show it to people who don't know how to code.

You should do a youtube demo to really show off :)
clange
Member
Member
Posts: 163
Joined: Sun Oct 05, 2008 5:00 am
Location: Copenhagen, Denmark
Contact:

Re: The happiest screenshot of my entire OS-dev life!

Post by clange »

Cool achievement - congratulation.

clange
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: The happiest screenshot of my entire OS-dev life!

Post by Combuster »

I see you also succesfully tackled the challenge of implementing hardware acceleration =D> :D

You mind telling us where you got the necessary documentation from?
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
Creature
Member
Member
Posts: 548
Joined: Sat Dec 27, 2008 2:34 pm
Location: Belgium

Re: The happiest screenshot of my entire OS-dev life!

Post by Creature »

Graphics-related programming has always been my favourite subject, so I have the same question as Combuster.

Congratulations!
When the chance of succeeding is 99%, there is still a 50% chance of that success happening.
eddyb
Member
Member
Posts: 248
Joined: Fri Aug 01, 2008 7:52 am

Re: The happiest screenshot of my entire OS-dev life!

Post by eddyb »

Combuster wrote:You mind telling us where you got the necessary documentation from?
as he said in #osdev and #exclaim: reverse engineering and some open source drivers :P
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Re: The happiest screenshot of my entire OS-dev life!

Post by JamesM »

Combuster wrote:I see you also succesfully tackled the challenge of implementing hardware acceleration =D> :D

You mind telling us where you got the necessary documentation from?
Hey Combuster,

Mainly the Haiku nvidia driver and the nouveau driver. The haiku one is based on the nouveau one but has more comments so reads better. I also found that a lot of the code there relates to coldstarting the card - copying VGA BIOSes and suchlike around, which you don't really need to do.

Cheers,

James
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Re: The happiest screenshot of my entire OS-dev life!

Post by JamesM »

berkus wrote:
JamesM wrote:I also found that a lot of the code there relates to coldstarting the card - copying VGA BIOSes and suchlike around, which you don't really need to do.
Why are they doing it though?
A poignant question that I can't answer. I assume it must be needed for something. What is a different matter - remember that both these drivers are based on reverse engineered code.

All I know is that my code works without doing the coldstart/bios copy.

James
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Re: The happiest screenshot of my entire OS-dev life!

Post by AJ »

Hi,

Just guesswork, but perhaps the Video BIOS copy is just a version of Video BIOS Shadowing - the author of the driver just wanted a speed increase so copied the BIOS from the video ROM in to main memory?

As for the cold start - is it possible that unflushed video RAM could cause wierdness if the PC was reset? If so, perhaps it's just to make ensure that the GPU/video RAM are in a known state. If so, it would be wise to include the coldstart code because you'll never know what set of circumstances could make it go for a burton in future.

Cheers,
Adam
jal
Member
Member
Posts: 1385
Joined: Wed Oct 31, 2007 9:09 am

Re: The happiest screenshot of my entire OS-dev life!

Post by jal »

berkus wrote:Why are they doing it though?
A while ago I read an article about some Linux guys using vm86 or an emulator of sorts to set video modes using the BIOS. For some reason, though I would assume it's the easiest thing to reverse engineer, setting modes is considered to be difficult to do without BIOS help. Or something.


JAL
earlz
Member
Member
Posts: 1546
Joined: Thu Jul 07, 2005 11:00 pm
Contact:

Re: The happiest screenshot of my entire OS-dev life!

Post by earlz »

nice work.. not just getting an accelerated driver working, but a closed documentation one as well! if you happen to reverse engineer a driver that works better than those linux drivers you should share it! maybe people have been looking for good updated drivers for nvidia cards
User avatar
stephenj
Member
Member
Posts: 140
Joined: Wed Jul 23, 2008 1:37 am
Location: Canada

Re: The happiest screenshot of my entire OS-dev life!

Post by stephenj »

Earlz, you might want to look at Nouveau
blackoil
Member
Member
Posts: 146
Joined: Mon Feb 12, 2007 4:45 am

Re: The happiest screenshot of my entire OS-dev life!

Post by blackoil »

well, I expect a ASM / C seperated version, that we can share to use in own OS.

from PCI32 tool, my gfx card info
Bus 1 (AGP), Device Number 0, Device Function 0
Vendor 10DEh Nvidia Corp
Device 0110h GeForce2 MX/MX 400 [NV11]
Command 0007h (I/O Access, Memory Access, BusMaster)
Status 02B0h (Has Capabilities List, Supports 66MHz, Supports Back-To-Back Tra
s., Medium Timing)
Revision B2h, Header Type 00h, Bus Latency Timer F8h
Minimum Bus Grant 05h, Maximum Bus Latency 01h
Self test 00h (Self test not supported)
PCI Class Display, type VGA
Subsystem ID 009110DEh Unknown
Subsystem Vendor 10DEh Nvidia Corp
Address 0 is a Memory Address (anywhere in 0-4Gb) : FD000000h
Address 1 is a Memory Address (anywhere in 0-4Gb, Prefetchable) : E8000000h
System IRQ 16, INT# A
Expansion ROM of 64Kb decoded by this card (Currently disabled)
New Capabilities List Present:
Power Management Capability, Version 1.1
Does not support low power State D1 or D2
Does not support PME# signalling
Current Power State : D0 (Device operational, no power saving)
AGP Capability, Version 2.0 (AGP 4x and below support)
AGP Speed(s) Supported : 1x 2x 4x
FW Transfers Supported : No
>4Gb Address Space Supported : No
Sideband Addressing Supported : No
Maximum Command Queue Length : 32 bytes
AGP Speed Selected : 4x
FW Transfers Enabled : No
>4Gb Address Space Enabled : No
AGP Enabled : Yes
Sideband Addressing Enabled : No
Current Command Queue Length : 32 bytes

address FD000000h is for framebuffer
address E8000000h is for mmio
and PCI32 knows something of FIFO cmd queue.

register map & cmd code are needed to
unlock the engine
put src dest width height colormix in respective registers
then queue cmd code
Post Reply