freezy / dmd-extensions

A toolbox for virtual pinball dot matrix displays.
GNU General Public License v2.0
129 stars 55 forks source link

PIN2DMD XL support. #233

Closed Bandicoot37 closed 4 years ago

Bandicoot37 commented 4 years ago

Hello I'm trying to use DmdExt with a Pin2Dmd-XL , the software see it but doesn't diplay anything. I try the nonXL firmware to see , it work ( display isn't good lol but it work) Do you think you will add 192x64 Pin2Dmd working? Thanks

freezy commented 4 years ago

Good question. @lucky01, any way I can recognize these? Frame format is the same I suppose, with just more pixels?

lucky01 commented 4 years ago

Code how you recognize them is in my dmddevice source you already have.

freezy commented 4 years ago

Gotcha, thanks :)

freezy commented 4 years ago

So how do you render normal 128x32 games? Center the image, or stretch somehow?

lucky01 commented 4 years ago

Center

Am Di., 12. Mai 2020 um 20:09 Uhr schrieb freezy notifications@github.com:

So how do you render normal 128x32 games? Center the image, or stretch somehow?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/freezy/dmd-extensions/issues/233#issuecomment-627505493, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADRZGKWWXPHYI4ZXSSYXUYDRRGGFZANCNFSM4M45Q3WA .

freezy commented 4 years ago

@Bandicoot37 or @lucky01 could you try this build and paste the log please? And also tell me what's happening, it should actually work.

EDIT: By "try" I mean just a dmdext test -d pin2dmd.

Bandicoot37 commented 4 years ago

like other version when i launch it , the DMD go to red https://streamable.com/12wprk

EDIT : with VPINMAME it's communicate a little , not with other version https://streamable.com/fsnhwp

[1] 2020/05/12 22:43:26.975 INFO | Successfully loaded config from E:\VPinMame\DmdDevice.ini. [1] 2020/05/12 22:43:27.102 INFO | Determined color path from assembly path: E:\VPinMame\altcolor [1] 2020/05/12 22:43:27.102 INFO | Starting VPinMAME API 1.8.1-PIN2DMDXL-r11 (aeb3bc8) through Setup.exe. [1] 2020/05/12 22:43:27.102 INFO | Assembly located at E:\VPinMame\DmdDevice.dll [1] 2020/05/12 22:43:27.102 INFO | [vpm] Open() [1] 2020/05/12 22:43:27.102 INFO | [vpm] Set_4_Colors_Palette() [1] 2020/05/12 22:43:27.102 INFO | Setting palette to 4 colors... [1] 2020/05/12 22:43:27.102 INFO | [vpm] PM_GameSettings(1) [1] 2020/05/12 22:43:27.116 INFO | Enabling game colorization [1] 2020/05/12 22:43:27.116 INFO | Setting game name: twenty4_150 [1] 2020/05/12 22:43:27.116 INFO | No palette file found at E:\VPinMame\altcolor\twenty4_150\pin2dmd.pal. [1] 2020/05/12 22:43:27.116 INFO | Setting color: #FFFFFF80 [1] 2020/05/12 22:43:27.116 INFO | No palette file found at E:\VPinMame\altcolor\twenty4_150\pin2dmd.pal. [1] 2020/05/12 22:43:27.116 INFO | Opening virtual display... [8] 2020/05/12 22:43:27.370 INFO | Found device PIN2DMD XL at 192x64. [8] 2020/05/12 22:43:27.370 INFO | Added PIN2DMD renderer. [8] 2020/05/12 22:43:27.370 INFO | Added VirtualDMD renderer. [8] 2020/05/12 22:43:27.370 INFO | Transformation options: Resize=Fit, HFlip=False, VFlip=False [8] 2020/05/12 22:43:27.370 INFO | Applying palette to render graphs. [8] 2020/05/12 22:43:27.450 INFO | Resizing virtual DMD to 128x32 [8] 2020/05/12 22:43:27.450 INFO | Setting up 2-bit VPM Graph for 2 destination(s) [8] 2020/05/12 22:43:27.461 INFO | Connecting VPM 2-bit Source to PIN2DMD (Gray2 => Gray2) [8] 2020/05/12 22:43:27.461 INFO | Connecting VPM 2-bit Source to Dmd (Gray2 => Rgb24) [8] 2020/05/12 22:43:27.475 INFO | Setting up 4-bit VPM Graph for 2 destination(s) [8] 2020/05/12 22:43:27.475 INFO | Connecting VPM 4-bit Source to PIN2DMD (Gray4 => Gray4) [8] 2020/05/12 22:43:27.475 INFO | Connecting VPM 4-bit Source to Dmd (Gray4 => Rgb24) [8] 2020/05/12 22:43:27.475 INFO | Setting up RGB24-bit VPM Graph for 2 destination(s) [8] 2020/05/12 22:43:27.475 INFO | Connecting VPM RGB24 Source to PIN2DMD (Rgb24 => Rgb24) [8] 2020/05/12 22:43:27.475 INFO | Connecting VPM RGB24 Source to Dmd (Rgb24 => Rgb24) [8] 2020/05/12 22:43:27.475 INFO | Setting up Alphanumeric VPM Graph for 2 destination(s) [1] 2020/05/12 22:43:33.639 INFO | [vpm] Close() [1] 2020/05/12 22:43:33.639 INFO | Closing up. [1] 2020/05/12 22:43:33.773 INFO | Source for 2 renderer(s) stopped. [1] 2020/05/12 22:43:33.811 INFO | Source for 2 renderer(s) stopped. [1] 2020/05/12 22:43:33.811 INFO | Source for 2 renderer(s) stopped. [1] 2020/05/12 22:43:33.811 INFO | Source for 0 renderer(s) stopped.

freezy commented 4 years ago

Thanks! Actually, I think XL doesn't support RGBA24, but there's obviously still a bug with 2/4 bit.

Can you try dmdext test -d pin2dmd --format=gray4 while I try to figure this out?

Bandicoot37 commented 4 years ago

20200512-230912-1

freezy commented 4 years ago

Thanks! This one please, sorry I'm kind of blind here and we'll need to do this incrementally.

If you can take a screenshot of the entire DMD that'd be great!

freezy commented 4 years ago

And both --format gray2 and gray4 would be interesting.

Bandicoot37 commented 4 years ago

gray4 https://ibb.co/f9wF0CH gray2 https://ibb.co/Ns1hhzb coloredgray4 https://ibb.co/svhZHgX coloredgray2 https://ibb.co/KwcpV8q just RGB24 not working :) :) :)

freezy commented 4 years ago

Huh, what were the ones before then? The 1.8.1-PIN2DMDXL-r11 build?

BTW you can drag and drop images directly into the text box here

Bandicoot37 commented 4 years ago

i try to delete the first comment with no command send cause i haven't seen your buil r12 the r12 work not the r11 But no RGB24 in R12

freezy commented 4 years ago

And the colors for the non-colored grays seem to be off. Just to be clear, this is the "inefficient" method of always sending 192x64 pixels, I just noticed that PIN2DMD XL can receive "normal" 128x32 pixel frames and it'll just center them.

freezy commented 4 years ago

Yeah, it seems like there is no 192x64 RGB24 mode.

If I want to do all that efficiently, I need to change the render pipeline design a bit.

Bandicoot37 commented 4 years ago

ok take your time i need to go sleeping .. Thanks a lot for your work :) :)

freezy commented 4 years ago

@lucky01 just to confirm and before I refactor everything:

The only case where XL is different is when the source is 192x64? In that case the frame buffer is larger, and byte 2 and 3 are different. Otherwise you're sending normal 128x32 frames?

Also, in your code, why don't you exit the Render_Shades_with_Raw function once you've sent a 192x64 frame via libusb_bulk_transfer() (lines 1950/1952)?

Bandicoot37 commented 4 years ago

@freezy it seems i got ghosting with some ROM 128x64 coud it be a reason of what you say

lucky01 commented 4 years ago

I already told to Bandicoot37 that actually the 192x64 support has never been used since I implemented it about 2 years ago. From a short look at the code it seems you are right about the sending of the frames. You are also right about the missing "return".

lucky01 commented 4 years ago

I installed a little test environment and can reproduce the ghosting problem. I need to figure out how to fix this.

freezy commented 4 years ago

@lucky01 Ghosting maybe because I'm sending 192x64 frames for 128x32 content?

freezy commented 4 years ago

Well, that was quite some refactoring. 2.5k lines changed, so there might be other issues, but 128x32 frames are now sent as 128x32 and not upscaled anymore. Also, scaling in general should now work correctly, if you get anything larger than 128x32, the frame format goes up to 192x64, with proper resizing still in place (i.e. if you send 256x64, it will be resized as configured with the resize parameter).

Anyway, please try it out!

Oh, and it's a new driver, pin2dmdxl instead of pin2dmd. So you'll have to:

dmdext test -d pin2dmdxl
Bandicoot37 commented 4 years ago

DMDext test -d pin2dmdxl [1] 2020/05/16 10:12:22.407 INFO | Launching console tool v1.8.1-PIN2DMDXL-r22 (7873cae) [1] 2020/05/16 10:12:22.468 ERROR | No output devices available.

freezy commented 4 years ago

Bugger.

Try this one.

Bandicoot37 commented 4 years ago

ok , it 's launch but display still red and no dmdext text appear 20200516_111505 1 With Vpinmame , sometime it crashed and when it launch it look like this for 128x32 https://streamable.com/tid9to 192x64 seems OK

freezy commented 4 years ago

Can you compare with r13 and also with the different formats, please?

dmdext test -d pin2dmdxl --format gray2

Formats are gray2, gray4, coloredgray2, coloredgray4 and rgb24. gray4 and rgb24 being the most important ones.

freezy commented 4 years ago

I'm mainly interested in dmdext test, we can try VPM later once that's working.

Bandicoot37 commented 4 years ago

20200516_114309 20200516_114322 20200516_114350 20200516_114404 20200516_114422 RGB 24 crash the pin2dmdXL can't do anything after and black screen no difference between R13 and R24 ( no missing line in COLOREDGRAY 4 it's just due to framerate)

freezy commented 4 years ago

Can you label which is which? And having them rotated correctly would help too ;)

I suppose the first one is gray2? @lucky01 any idea why there is an outer border? That's definitely not something I'm sending. Also there seems to be something wrong with the colors, but it's hard to see with this kind of contrast in broad daylight.

In general it doesn't look to bad apart from RGB24 crashing completely and coloredgray4 having black blocks.

Could you post a log of RGB24? I'll probably have to add more logs but let's go ahead like that.

Bandicoot37 commented 4 years ago

the gray2 is the first one yes the red border is when i launch the test for begin , if i reload gra2 after other format there's no border Coloredgray4 haven't got black blocks it's just the picture who make it things ( delay of capture )

Bandicoot37 commented 4 years ago

i don't find log file in test mode

freezy commented 4 years ago

Ok cool, I'll provide another build with more logs later tonight.

When running in the console, the log is what's printed in the console.

Bandicoot37 commented 4 years ago

20200516_131921

freezy commented 4 years ago

Can you paste the log from r25 when running:

dmdext test -d pin2dmdxl --format rgb24

(still assuming it's black, of course)

Bandicoot37 commented 4 years ago

20200517_065607 R26 says samething 20200517_065941 something is strange when i flash the nucleo with non XL firmware i can use dmdext in RGB24 mode

freezy commented 4 years ago

when i flash the nucleo with non XL firmware i can use dmdext in RGB24 mode

Okay, that's re-assuring, because dmdext is using the exact same code for both XL and non-XL for RGB24. @lucky01 possible bug?

@Bandicoot37 can we say it works for dmdext test and gray modes then? If so, what about VPM?

Bandicoot37 commented 4 years ago

https://streamable.com/xyd1vp with lucky's dll https://streamable.com/cryn9y ( excuse the video is not in the right position :) ) with your dll , when i can launch a ROM cause with your dll VPM crash with lot of ROM

freezy commented 4 years ago

Okay, can you post a log please? Preferably with a crash.

Bandicoot37 commented 4 years ago

DmdDevice.log

freezy commented 4 years ago

Thanks, though no idea what's going on. Could you set the log level to Debug and post the log again with r27 please?

Check here how to set the log level, basically open DmdDevice.log.config and set <logger name="*" minlevel="Info" writeTo="file" /> to <logger name="*" minlevel="Debug" writeTo="file" />.

freezy commented 4 years ago

Actually, rather take r28 when it's built, added a few more logs.

Bandicoot37 commented 4 years ago

DmdDevice.log

freezy commented 4 years ago

Great, thanks. Obviously something on my side that happens before frames actually reach the display. Will debug and keep you posted!

freezy commented 4 years ago

r29 should fix the crashes (at least the ones you were having).

Bandicoot37 commented 4 years ago

you've done it :) :) :) :) It doesn't crash good job. thanks man. Now i think we need Lucky01 to upgrade FIRMWARE for other probleme like ghosting and RGB24 support I really appreciate your work thanks thanks a lot

Total HS : Vous etes suisse ? un moyen de faire une donation si petite soit elle? ( moi francais :) )

freezy commented 4 years ago

Nan c'est sympa, ça fait partie du plaisir ;)

Bandicoot37 commented 4 years ago

et en bonus tu as regler les problemes d'affichage tout fonctionne appart le RGB24 bien jouer monsieur bon on va reparler Anglais pour LUCKY01 :) :)

Bandicoot37 commented 4 years ago

au cas ou erreur en RGB24

Exception non gérée : System.InvalidOperationException: The calling thread cannot access this object because a different thread owns it.
   at System.Windows.Threading.Dispatcher.VerifyAccess()
   at System.Windows.Media.Imaging.BitmapSource.get_PixelWidth()
   at LibDmd.Common.ImageUtil.ConvertToRgb24(BitmapSource bmp, Double lum) in C:\projects\dmd-extensions\LibDmd\Common\ImageUtil.cs:line 167
   at LibDmd.Frame.BmpFrame.ConvertToRgb24() in C:\projects\dmd-extensions\LibDmd\Frame\BmpFrame.cs:line 46
   at LibDmd.RenderGraph.<>c__DisplayClass55_0.<Connect>b__13(BmpFrame frame) in C:\projects\dmd-extensions\LibDmd\RenderGraph.cs:line 690
   at System.Reactive.Linq.ObservableImpl.Select`2._.OnNext(TSource value)
--- End of stack trace from previous location where exception was thrown ---
   at System.Reactive.PlatformServices.DefaultExceptionServices.Rethrow(Exception exception)
   at System.Reactive.Stubs.<.cctor>b__1(Exception ex)
   at System.Reactive.AnonymousSafeObserver`1.OnError(Exception error)
   at System.Reactive.Linq.ObservableImpl.Select`2._.OnNext(TSource value)
   at System.Reactive.Linq.ObservableImpl.Select`2._.OnNext(TSource value)
   at System.Reactive.ScheduledObserver`1.Dispatch(ICancelable cancel)
   at System.Reactive.Concurrency.Scheduler.<ScheduleLongRunning>b__72(Action`1 a, ICancelable c)
   at System.Reactive.Concurrency.DefaultScheduler.LongRunning.<>c__DisplayClassc`1.<ScheduleLongRunning>b__b(Object arg)
   at System.Reactive.Concurrency.DefaultConcurrencyAbstractionLayer.<>c__DisplayClass5.<StartThread>b__4()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()
freezy commented 4 years ago

Hmm, can you post the entire log please?