What did you put in you updaterects func ?
I took some of the code from the nanox port and massaged it a bit (my code
is below). Although the XBOX supports several video modes, to keep things
simple I keep it in the default 640x480 mode and then centre it based on
the requested resolution when calling SDL_SetVideoMode(). Once I am happy
that everything works, I will look at supporting other modes. Apologies
for the quality of the code… it has been a few years since I have done
any serious C programming.
Wild guess : sdldoom uses a single buffered surface, and thus tries to
draw directly to the video memory. This is very bad (and very slow) to
the point that this could explain the speed problem you’re seeing.
That is exactly what I am doing, and I thought it would be very slow
too… however, my timing info indicates that each frame (sdldoom seems to
ask for the whole screen to be redrawn every time) takes about 18-19ms to
draw.
Depending on which API you have access to, that might be possible
(windib ? directx ? what APIs can you use if you don’t have the devkit
?).
I don’t have access to any APIs Nearly all functions supplied by the
XBOX kernel are memory/disk/io related.
If you don’t have access to an API doing this, you can do it directly
through mmio (like is done in the fbcon backend). If you know the base
address of the mmio registers I can help you for the rest.
This I do know and is what I plan to use to support more video modes in
the future. I freely admit that I don’t know much about mmio, so I may
take you up on your offer at some stage
Thanks very much for the thoughts. Last night after I posted I inserted
some tracing info into the sdldoom code and found that I am only really
getting about 2 fps - yikes! I have found a function that is called a
lot (NetUpdate()) that takes between 100-300ms each time. I will put my
tracing statements in that guy tonight and see how we go. Thanks again
// center the screen - dodgy!!!
int VIDEO_BUFFER_ADDR = 0xF0040240 + (((SCREEN_HEIGHT -
this->screen->h)/2) * (SCREEN_WIDTH *
SCREEN_PIXELWIDTH)) + (((SCREEN_WIDTH - this->screen->w)/2) *
SCREEN_PIXELWIDTH);
// These are the values for the incoming image
xinc = this->screen->format->BytesPerPixel ;
yinc = this->screen->pitch ;
for (i = 0; i < numrects; ++ i)
{
int start = times(NULL);
int x = rects[i].x;
int y = rects[i].y;
int w = rects[i].w;
int h = rects[i].h;
src = this->screen->pixels + yyinc + xxinc;
dest = (unsigned char*)VIDEO_BUFFER_ADDR;
destinc = SCREEN_WIDTH * SCREEN_PIXELWIDTH;
unsigned char *ptrsrc, *ptrdst;
for (j = h; j > 0; --j, src += yinc, dest += destinc)
{
ptrsrc = src;
ptrdst = dest;
for (k = w; k > 0; --k)
{
unsigned char r, g, b;
if (this->screen->format->BytesPerPixel == 1)
SDL_GetRGB(ptrsrc, this->screen->format, &r, &g, &b);
else if (this->screen->format->BytesPerPixel == 2)
SDL_GetRGB((unsigned short )ptrsrc, this->screen->format, &r,
&g, &b);
else
SDL_GetRGB((unsigned int *)ptrsrc, this->screen->format, &r, &g,
&b);
*ptrdst++ = b;
*ptrdst++ = g;
*ptrdst++ = r;
*ptrdst++ = 0; ptrsrc += xinc;
}
}
printf(“BLAH Updating screen x=%d y=%d w=%d h=%d time=%d\n”, x, y, w, h,
times(NULL)-start);
}On Sun, 05 Sep 2004 19:25:00 +0200, Stephane Marchesin <stephane.marchesin at wanadoo.fr> wrote:
–
Craig Edwards