xboxscene.org forums

Pages: 1 [2]

Author Topic: Large Openxdk Cvs Patch  (Read 284 times)

openxdkman

  • Archived User
  • Hero Member
  • *
  • Posts: 550
Large Openxdk Cvs Patch
« Reply #15 on: August 02, 2006, 12:59:00 AM »

You can get unpredictable results if you apply last CVS changes AFTER generating makefiles.
See post named "OpenXDK little help"
Logged

alg5

  • Archived User
  • Full Member
  • *
  • Posts: 162
Large Openxdk Cvs Patch
« Reply #16 on: August 08, 2006, 07:01:00 AM »

hello,

  i'm currently trying openXDK, and i would like to synchronize to the VBL in order to avaid graphics tearing and to have constant speed.
   is it possible in current openXDK ?
Logged

openxdkman

  • Archived User
  • Hero Member
  • *
  • Posts: 550
Large Openxdk Cvs Patch
« Reply #17 on: August 09, 2006, 11:32:00 AM »

I'm currently using the test program below in order to discover how to create a VBL interrupt
Logged

openxdkman

  • Archived User
  • Hero Member
  • *
  • Posts: 550
Large Openxdk Cvs Patch
« Reply #18 on: August 10, 2006, 02:50:00 AM »

Here you go! Working VBL interrupt for OpenXDK! (any volunteer to import this sample in cvs?)
Logged

openxdkman

  • Archived User
  • Hero Member
  • *
  • Posts: 550
Large Openxdk Cvs Patch
« Reply #19 on: August 10, 2006, 05:06:00 AM »

XBOX is a bit special. Its kernel is a simplified version of nt kernel. OpenXDK uses the standard, existing, XBOX kernel. Linux for XBOX wipes it with the floor at installation time and recreate its own kernel, so you can probably create multiple threads with it.
With standard XBOX kernel, normally, theoretically, you are allowed to run only one main thread.

Just plug the interrupt above somewhere in openxdk and export the vbl_counter variable.
(it's possible it will be officially done later by a person that have rights to insert new code in cvs)

Then you can make your sync function :

void WaitForVBlank()
{
static unsigned long old=0;
while(vbl_counter==old) {};//or any other waiting function
old=vbl_counter;
}

But expert game developers are not doing such waiting...
They work on several screen buffers, and let interruption handler switch display to the next buffer to show.
It's often known as triple buffering technic (first buffer is shown, second one is being finished, last one will be drawn soon... and three pointers rotate to points on them)
And if you detect you are in advance, you can dynamically raise the detail level of the scene...
or lower it if you detect you didn't finish in time last one...

Top graphic speed is not achieved with parallelism made with several threads in the CPU. It's achieved with parallelism between one thread in CPU and massive DMA access in order to provide prepared pushbuffers towards the GPU (fastest games don't even go thru directX or very lightly)

http://www.bringyou.to/games/PS2 is a very interesting article (at the bottom of it you have the description of the port of a very fast game from PS2 towards XBOX and it gives very essential clues)
Logged

openxdkman

  • Archived User
  • Hero Member
  • *
  • Posts: 550
Large Openxdk Cvs Patch
« Reply #20 on: August 16, 2006, 02:07:00 AM »

Ooops, sorry friedgold, I didn't recognize your nickname at first.

If you plan to introduce it officially as a clean cvs change, I would recommend to have an installation and uninstallation function added in hal/video.c
User should be able to register a callback (like in audio.c) that will be called by the vbl interrupt dpc.
About vbl_counter that is a nice way to provide programmer a quicky waitvblank function, you can either export it as global variable or let user register in a clean way his own counter (you pass &vbl_counter as parameter and vbl_counter is a global variable of programmer). In other words you allow the dpc to increment user's var instead of calling a callback...

But I think if we add in the list of samples, a sample that shows how to install and register programmers's callback, that should be enough.
In the sample, inside the callback we can put the vbl_counter++ instruction and vbl_counter will be a global variable of the sample. In the main loop of sample we call waitvblank which just tests counter.

Up to you to choose cleanest way to do it in openxdk, and put the remaining dirty stuff in sample.
But we need both.

And if we give up on vbl programmer's callback we will be screwed for the triple buffering technic.
Logged

openxdkman

  • Archived User
  • Hero Member
  • *
  • Posts: 550
Large Openxdk Cvs Patch
« Reply #21 on: October 26, 2006, 09:52:00 AM »

Logged
Pages: 1 [2]