Help with hardware blitting in fbcon

Hi,

I’m trying to implement hardware-accelerated in SDL on the
gp2x handheld. The current implementation uses fbcon and
only uses the software blitting functions.

The blitter is capable of HW_SURFACE to HW_SURFACE transfers
and also SW_SURFACE to HW_SURFACE transfers via a fifo
memory-mapped reister.

Right now i managed to accelerate the SDL_FillRect function,
but my blitting functions are not called. It appears that
the problem lies in the SDL_CalculateBlit function in
SDL_blit.c which does not even call video->CheckHWBlit() if
it finds that the source (or target?) surface is not an HW_SURFACE.

A similar check is also performed in SDL_LowerBlit in
SDL_surface.c.

Now, I’m quite confused about all this. Mainly, I don’t
understand at all what the function SDL_MapSurface in
SDL_pixels.c does (this is where SDL_CalculateBlit is
called), and what really a SDL_BlitMap is.

If someone could shed some light, I would be most grateful.–
Oscar Lazzarino


TISCALI ADSL Web&Mail
Solo con Tiscali Adsl navighi e telefoni senza canone Telecom a partire da
14,95 Euro/mese. Attivala subito!
Per te 500 MB inclusi per navigare, inviare e ricevere messaggi e-mail, foto
ed mp3.
http://abbonati.tiscali.it/adsl/sa/2wam_tc/

Oscar Lazzarino wrote:

Hi,

I’m trying to implement hardware-accelerated in SDL on the
gp2x handheld. The current implementation uses fbcon and
only uses the software blitting functions.

The blitter is capable of HW_SURFACE to HW_SURFACE transfers
and also SW_SURFACE to HW_SURFACE transfers via a fifo
memory-mapped reister.

Right now i managed to accelerate the SDL_FillRect function,
but my blitting functions are not called. It appears that
the problem lies in the SDL_CalculateBlit function in
SDL_blit.c which does not even call video->CheckHWBlit() if
it finds that the source (or target?) surface is not an HW_SURFACE.

Did you set the blit_fill flag in the info member of the SDL_VideoDevice
structure ?

Stephane

Stephane Marchesin wrote:

Did you set the blit_fill flag in the info member of the SDL_VideoDevice

structure ?

Yep, I wrote a function FB_Gp2xAccel(_THIS, __u32 card)
which is called in FB_VideoInit (in SDL_fbvideo.c). I set
these flags

/* The GP2X has an accelerated color fill */
this->info.blit_fill = 1;
this->FillHWRect = FillGp2xRect;

/* Blitting is accelerated, but not for alpha blending */
this->info.blit_hw = 1;
this->CheckHWBlit = CheckGp2xBlit;

this->info.blit_hw_CC = 1;
this->SetHWColorKey = SetGp2xColorKey;

this->info.blit_hw_A = 0;
this->SetHWAlpha = NULL;

but my CheckGp2xBlit() is not called, for the reasons i said
before (maybe). Problem is, i don’t know how to fix this,
because i don’t understand what SDL expects from al the
SDL_BlitMap data in SDL_MapSurface, in SDL_CalculateBlit and
in SDL_LowerBlit…–
Oscar Lazzarino


TISCALI ADSL Web&Mail
Solo con Tiscali Adsl navighi e telefoni senza canone Telecom a partire da
14,95 Euro/mese. Attivala subito!
Per te 500 MB inclusi per navigare, inviare e ricevere messaggi e-mail, foto
ed mp3.
http://abbonati.tiscali.it/adsl/sa/2wam_tc/

Oscar Lazzarino wrote:

Hi,

I’m trying to implement hardware-accelerated in SDL on the
gp2x handheld. [CUT]

If someone could shed some light, I would be most grateful.

No one? :frowning:

Oscar Lazzarino wrote:

Hi,

I’m trying to implement hardware-accelerated in SDL on the
gp2x handheld. The current implementation uses fbcon and
only uses the software blitting functions.

The blitter is capable of HW_SURFACE to HW_SURFACE transfers
and also SW_SURFACE to HW_SURFACE transfers via a fifo
memory-mapped reister.

Right now i managed to accelerate the SDL_FillRect function,
but my blitting functions are not called. It appears that
the problem lies in the SDL_CalculateBlit function in
SDL_blit.c which does not even call video->CheckHWBlit() if
it finds that the source (or target?) surface is not an HW_SURFACE.

I just re-read your post. Yes, SDL will not call the hw acceleration
functions on non HW_SURFACEs.

A similar check is also performed in SDL_LowerBlit in
SDL_surface.c.

Now, I’m quite confused about all this. Mainly, I don’t
understand at all what the function SDL_MapSurface in
SDL_pixels.c does (this is where SDL_CalculateBlit is
called), and what really a SDL_BlitMap is.

It creates a “mapping” between a source surface A, and a destination
surface B. This mapping can be kept until the surface A is blit to
another surface C. This mapping contains information such as palette
mapping, what blit function to call and so on…

Stephane