Re: [hatari-devel] Falcon upper and lower borders added

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Hi,

I thought about optimizing the code, but it will come after my current changes. The current code becomes quite hard to read with all these loops and variables everywhere.

I've nearly finished to add the left/right borders. It works for all resolutions but one for now.

I'll check again for the TT too.

I'll try to upload before the end of the week.

 Please take the borders setting (ConfigureParams.Screen.bAllowOverscan)

OK, I didn't think about this one, but I will do so.

Thanks for the tests.

Laurent


Le 22/02/2012 20:36, Eero Tamminen a écrit :
Hi,

On tiistai 21 helmikuu 2012, Laurent Sallafranque wrote:
I've just committed a patch for VIDEL upper and lower borders.
Please take the borders setting (ConfigureParams.Screen.bAllowOverscan)
into account like the ST emulation does and don't show borders unless
so requested by the user.


It seems to work well, I've tested all Falcon resolutions, and few demos.
Could you optize it a bit?

---------
                                 for (h = 0; h<  vh_clip; h++) {
                                         Uint16 *fvram_column = fvram_line;
                                         Uint8 *hvram_column = hvram_line;
                                         int w;

                                         /* Render the upper border */
                                         if (h<  videl.upperBorderSize) {
                                                 for (w = 0; w<  vw_clip;
w++) {
                                                         *hvram_column++ =
HostScreen_getPaletteColor(0);
                                                 }
                                         }
                                         /* Render the graphical area */
                                         else if (h<  videl.upperBorderSize +
videl.YSize) {
...
                                         /* Render the bottom border */
                                         else {
                                                 for (w = 0; w<  vw_clip;
w++) {
                                                         *hvram_column++ =
HostScreen_getPaletteColor(0);
                                                 }
                                         }

                                         hvram_line += scrpitch;
                                 }

---------

There's no point in calling constantly HostScreen_getPaletteColor(0) to
get the same color again, instead of simply memset()ing what's needed.

And instead of having ifs for bordersize, you could just have three
separate loops for top border, middle part and bottom border.  Or even
just one memset for the borders, something like this:
	memset(hvram_line,
		HostScreen_getPaletteColor(0),
		videl.upperBorderSize * srcpitch * sizeof(*hvram_line));
	hvram_line += videl.upperBorderSize * srcpitch;


It works for both new and old cpu.

If someone could try it also with TT emulation, as the rendering
routines are the same.
(I can't start hatari in TT mode, both old and new CPU). I use TOS 3.06
fr. Maybe I should erase the desktop.ini file ? (I haven't tested).
Problem seems to be due to your changes.  Before those TOS 3.06
boots up fine, after those, it doesn't.

If you go back to version without them:
	hg update b75097826a3c
	make

And try again, TT emulation works...


This check for drawing the middle part is bogus:
	(h<  (videl.upperBorderSize + videl.YSize)

You cannot check some videl struct values for that because
TT screen update calls the videl.c screen conversions routines
directly with correct screen size:
-------------
         /* Yes, we are abusing the Videl routines for rendering the TT
modes! */
         if (!HostScreen_renderBegin())
                 return false;
         if (nScreenZoomX * nScreenZoomY != 1)
                 VIDEL_ConvertScreenZoom(width, height, bpp, width * bpp /
16);
         else
                 VIDEL_ConvertScreenNoZoom(width, height, bpp, width * bpp /
16);
         HostScreen_renderEnd();
         HostScreen_update1(false);
-------------


I'll upload soon the Falcon left/right borders too.

	- Eero







Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/