|Re: [hatari-devel] defaulting to SMALL_MEM|
[ Thread Index |
| More lists.tuxfamily.org/hatari-devel Archives
- To: hatari-devel@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [hatari-devel] defaulting to SMALL_MEM
- From: Thomas Huth <th.huth@xxxxxxxxx>
- Date: Fri, 18 Feb 2022 20:33:23 +0000
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1645216406; bh=LhSBiT3/ACQKH4sS/NVMt7fo+5ek8YYgjdsGs7ITGWY=; h=Date:From:To:Subject:From; b=bXCg0AxTGtwku71VlVM9shMRCDjq0lfbeWWiIR8ApHifDhbmz0RnML8myHdPdxaN+ I2NVkm7LgWp/3Zr1+c361QT+SAeIUwRe7aN79ojUikr1keDSaaxeNe30rEA42qYW1g LEwau6ifCd+rYgRSBuUfgHLVZogI+kf1UfKqbXkldl4YuQ9TXb6k30/706xjXAUemI LxtM/XF3VNv2zLwE7X/1N1kd8RtlSY0m6az1oS0F/6m0yhi6dJhzH3F9ta6rweb94t baomvdUgSaqpFcD4MW3rDsTd293khJIvjjnpIbl3VFs62dN5H1UmXGojUVt7gHClk8 G9kWcDYjm2pHQ==
Am Thu, 17 Feb 2022 11:14:25 +0100
schrieb Nicolas Pomarède <npomarede@xxxxxxxxxxxx>:
> Le 16/02/2022 à 22:02, Eero Tamminen a écrit :
> > Hi,
> > On 15.2.2022 21.01, Thomas Huth wrote:
> >> Am Sun, 13 Feb 2022 19:10:44 +0200
> >> schrieb Eero Tamminen <oak@xxxxxxxxxxxxxx>:
> >>> I.e. if screen pointer would be in such RAM area, should the other
> >>> video related counters still change or not?
> >> Well, likely yes, but in this case I wonder if that'd buy us much.
> >> It certainly would make the current ST-low rendering code (which is
> >> already quite complex) way more complicated (and likely slower) if
> >> we add checks there all over the place. And for what? As long as
> >> we don't know of any program that relies on such weird behavior,
> >> it does not have any benefit for us, does it?
> > For the mono function it's trivial, but I hadn't realized how much
> > things would need to be changed or the color one before actually
> > looking into it.
> > Attached is patch handling all the memcpy() cases,
> > which is already quite large. However, that is missing all the
> > additional word accesses through pVideoRasterEndLine pointer, used
> > for STE special cases, which would be even trickier to handle.
> > => I concur that it's not really workable for
> > Video_CopyScreenLineColor().
> > (That function really is one scary monster. Would be nice if
> > somebody were able to split it into more manageable smaller
> > functions.)
> I agree this function is rather complicated in the "color" case due
> to all the possible overscan tricks to handle. I'm planning to
> rewrite it differently one day to handle cases that are even not
> supported today (such as mixing low res and med res on the same line).
> In the meantime, I'm not sure it would be wise to apply your patch,
> it makes it even harder to read the code.
I agree, this is getting very ugly that way.
> Regarding this possibility of reading after end of ram when
> converting screen pixels, maybe a simpler solution could be to add a
> "security margin" buffer after end of STRam in case we compile with
> SMALL_MEM ?
> That is, instead of allocating STRamEnd bytes for STRam, we
> allocate STRamEnd + SCREENBYTES_LINE*10 bytes and fill this extra
> space of SCREENBYTES_LINE*10 bytes with 0.
After thinking about this for a while, I agree, it's like the best
solution to add some margin to the allocation for this instead, to
avoid that the code gets too ugly and to avoid regressions with the
performance of the rendering functions.
But shouldn't we rather allocate NUM_VISIBLE_LINE_PIXELS *
NUM_VISIBLE_LINES / 2 bytes instead? ... in case a program sets the
memory base to the very end of the RAM and then does some fullscreen
Anyway, we should add a proper comment to the allocation, otherwise
we'll wonder in a couple of years why we did that change ;-)