AROS icon indicating copy to clipboard operation
AROS copied to clipboard

CGX : AllocCModeListTags issues

Open watsonmw opened this issue 4 years ago • 4 comments

Describe the bug

UWORD ModelArrayLUT8[] = {PIXFMT_LUT8, ~0};
struct List* list = AllocCModeListTags(CYBRMREQ_CModelArray, (ULONG) ModelArrayLUT8, TAG_END);

Returns a 1 node list, with a bogus/unitialized node, instead of all the 8 bit display modes.

To Reproduce

Compile & run:

https://github.com/watsonmw/aros-tests/blob/master/cybergraphx/listmodes.c

Expected behavior

Should list 8 bit display modes, without garbage characters at the end of the mode names.

There's a workaround, this bug report is more just for backwards compatibility with AOS / ease of use.

Architecture Amiga WINUAE,

Version AROS VISION nightly, kick 51.51 wb 40.0

Additional context

workbench/libs/cgfx/alloccmodelisttaglist.c

watsonmw avatar Feb 21 '20 07:02 watsonmw

Your printModeList function is incorrect, and tries to display the list head dummy node as an actual entry, in an empty list.

I am not sure if ModeText is a null terminated string (it has a fixed length, so names using the full size may not be terminated) - Please test this on a real cybergfx install in e.g. WinUAE and if possible attach the output.

Kalamatee avatar Feb 21 '20 08:02 Kalamatee

commit e001309 should fix the termination check of the pixfmt array.

Kalamatee avatar Feb 21 '20 10:02 Kalamatee

Thanks, corrected the mistake in the code I think.

On kick 40.63 + CGXv3 (41.4) here's the output:

(1 extra mode thanks to your suggestion 👍 )

--- List all 8bit modes using CYBRMREQ_CModelArray 
list: 5253bc 0 5260ec
node: 5253bc uaegfx.card: 320x240 x 8 CLUT 0 2a751c
mode 320 240 8 1342246912 -uaegfx.card: 320x240 x 8 CLUT-
node: 5253fc uaegfx.card: 320x256 x 8 CLUT 0 5253bc
mode 320 256 8 1342771200 -uaegfx.card: 320x256 x 8 CLUT-
node: 52543c uaegfx.card: 640x360 x 8 CLUT 0 5253fc
mode 640 360 8 1358893056 -uaegfx.card: 640x360 x 8 CLUT-
node: 52547c uaegfx.card: 640x400 x 8 CLUT 0 52543c
mode 640 400 8 1342312448 -uaegfx.card: 640x400 x 8 CLUT-
node: 5254bc uaegfx.card: 640x480 x 8 CLUT 0 52547c
mode 640 480 8 1342377984 -uaegfx.card: 640x480 x 8 CLUT-
node: 5254fc uaegfx.card: 640x512 x 8 CLUT 0 5254bc
mode 640 512 8 1342836736 -uaegfx.card: 640x512 x 8 CLUT-
node: 52553c uaegfx.card: 672x540 x 8 CLUT 0 5254fc
mode 672 540 8 1358827520 -uaegfx.card: 672x540 x 8 CLUT-
node: 52557c uaegfx.card: 800x450 x 8 CLUT 0 52553c
mode 800 450 8 1358761984 -uaegfx.card: 800x450 x 8 CLUT-
node: 5255bc uaegfx.card: 800x500 x 8 CLUT 0 52557c
mode 800 500 8 1358696448 -uaegfx.card: 800x500 x 8 CLUT-
node: 5255fc uaegfx.card: 800x600 x 8 CLUT 0 5255bc
mode 800 600 8 1342443520 -uaegfx.card: 800x600 x 8 CLUT-
node: 52563c uaegfx.card: 960x540 x 8 CLUT 0 5255fc
mode 960 540 8 1358630912 -uaegfx.card: 960x540 x 8 CLUT-
node: 525fac uaegfx.card:1024x576 x 8 CLUT 0 52563c
mode 1024 576 8 1351290880 -uaegfx.card:1024x576 x 8 CLUT-
node: 525fec uaegfx.card:1024x600 x 8 CLUT 0 525fac
mode 1024 600 8 1358565376 -uaegfx.card:1024x600 x 8 CLUT-
node: 52602c uaegfx.card:1024x768 x 8 CLUT 0 525fec
mode 1024 768 8 1342509056 -uaegfx.card:1024x768 x 8 CLUT-
node: 52606c uaegfx.card:1280x720 x 8 CLUT 68 52602c
mode 1280 720 8 1351487488 -uaegfx.card:1280x720 x 8 CLUT-
node: 5260ac uaegfx.card:1280x1024x 8 CLUT 0 52606c
mode 1280 1024 8 1342640128 -uaegfx.card:1280x1024x 8 CLUT-
"--- List all 8bit modes using CYBRMREQ_Min/MaxDepth
list: 5253bc 0 5260ec
node: 5253bc uaegfx.card: 320x240 x 8 CLUT 0 2a751c
mode 320 240 8 1342246912 -uaegfx.card: 320x240 x 8 CLUT-
node: 5253fc uaegfx.card: 320x256 x 8 CLUT 0 5253bc
mode 320 256 8 1342771200 -uaegfx.card: 320x256 x 8 CLUT-
node: 52543c uaegfx.card: 640x360 x 8 CLUT 0 5253fc
mode 640 360 8 1358893056 -uaegfx.card: 640x360 x 8 CLUT-
node: 52547c uaegfx.card: 640x400 x 8 CLUT 0 52543c
mode 640 400 8 1342312448 -uaegfx.card: 640x400 x 8 CLUT-
node: 5254bc uaegfx.card: 640x480 x 8 CLUT 0 52547c
mode 640 480 8 1342377984 -uaegfx.card: 640x480 x 8 CLUT-
node: 5254fc uaegfx.card: 640x512 x 8 CLUT 0 5254bc
mode 640 512 8 1342836736 -uaegfx.card: 640x512 x 8 CLUT-
node: 52553c uaegfx.card: 672x540 x 8 CLUT 0 5254fc
mode 672 540 8 1358827520 -uaegfx.card: 672x540 x 8 CLUT-
node: 52557c uaegfx.card: 800x450 x 8 CLUT 0 52553c
mode 800 450 8 1358761984 -uaegfx.card: 800x450 x 8 CLUT-
node: 5255bc uaegfx.card: 800x500 x 8 CLUT 0 52557c
mode 800 500 8 1358696448 -uaegfx.card: 800x500 x 8 CLUT-
node: 5255fc uaegfx.card: 800x600 x 8 CLUT 0 5255bc
mode 800 600 8 1342443520 -uaegfx.card: 800x600 x 8 CLUT-
node: 52563c uaegfx.card: 960x540 x 8 CLUT 0 5255fc
mode 960 540 8 1358630912 -uaegfx.card: 960x540 x 8 CLUT-
node: 525fac uaegfx.card:1024x576 x 8 CLUT 0 52563c
mode 1024 576 8 1351290880 -uaegfx.card:1024x576 x 8 CLUT-
node: 525fec uaegfx.card:1024x600 x 8 CLUT 0 525fac
mode 1024 600 8 1358565376 -uaegfx.card:1024x600 x 8 CLUT-
node: 52602c uaegfx.card:1024x768 x 8 CLUT 0 525fec
mode 1024 768 8 1342509056 -uaegfx.card:1024x768 x 8 CLUT-
node: 52606c uaegfx.card:1280x720 x 8 CLUT 68 52602c
mode 1280 720 8 1351487488 -uaegfx.card:1280x720 x 8 CLUT-
node: 5260ac uaegfx.card:1280x1024x 8 CLUT 0 52606c
mode 1280 1024 8 1342640128 -uaegfx.card:1280x1024x 8 CLUT-
"--- List all modes
list: 5253bc 0 52841c
node: 5253bc uaegfx.card: 320x240 x 8 CLUT 0 2a751c
mode 320 240 8 1342246912 -uaegfx.card: 320x240 x 8 CLUT-
node: 5253fc uaegfx.card: 320x240 x16 RGBPC 0 5253bc
mode 320 240 16 1342247168 -uaegfx.card: 320x240 x16 RGBPC-
node: 52543c uaegfx.card: 320x240 x32 BGRA 0 5253fc
mode 320 240 32 1342247683 -uaegfx.card: 320x240 x32 BGRA-
node: 52547c uaegfx.card: 320x256 x 8 CLUT 0 52543c
mode 320 256 8 1342771200 -uaegfx.card: 320x256 x 8 CLUT-
node: 5254bc uaegfx.card: 320x256 x16 RGBPC 0 52547c
mode 320 256 16 1342771456 -uaegfx.card: 320x256 x16 RGBPC-
node: 5254fc uaegfx.card: 320x256 x32 BGRA 0 5254bc
mode 320 256 32 1342771971 -uaegfx.card: 320x256 x32 BGRA-
node: 52553c uaegfx.card: 640x360 x 8 CLUT 0 5254fc
mode 640 360 8 1358893056 -uaegfx.card: 640x360 x 8 CLUT-
node: 52557c uaegfx.card: 640x360 x16 RGBPC 0 52553c
mode 640 360 16 1358893312 -uaegfx.card: 640x360 x16 RGBPC-
node: 5255bc uaegfx.card: 640x360 x32 BGRA 0 52557c
mode 640 360 32 1358893827 -uaegfx.card: 640x360 x32 BGRA-
node: 5255fc uaegfx.card: 640x400 x 8 CLUT 0 5255bc
mode 640 400 8 1342312448 -uaegfx.card: 640x400 x 8 CLUT-
node: 52563c uaegfx.card: 640x400 x16 RGBPC 0 5255fc
mode 640 400 16 1342312704 -uaegfx.card: 640x400 x16 RGBPC-
node: 525fac uaegfx.card: 640x400 x32 BGRA 0 52563c
mode 640 400 32 1342313219 -uaegfx.card: 640x400 x32 BGRA-
node: 525fec uaegfx.card: 640x480 x 8 CLUT 0 525fac
mode 640 480 8 1342377984 -uaegfx.card: 640x480 x 8 CLUT-
node: 52602c uaegfx.card: 640x480 x16 RGBPC 0 525fec
mode 640 480 16 1342378240 -uaegfx.card: 640x480 x16 RGBPC-
node: 52606c uaegfx.card: 640x480 x32 BGRA 68 52602c
mode 640 480 32 1342378755 -uaegfx.card: 640x480 x32 BGRA-
node: 5260ac uaegfx.card: 640x512 x 8 CLUT 0 52606c
mode 640 512 8 1342836736 -uaegfx.card: 640x512 x 8 CLUT-
node: 5260ec uaegfx.card: 640x512 x16 RGBPC 5f 5260ac
mode 640 512 16 1342836992 -uaegfx.card: 640x512 x16 RGBPC-
node: 52612c uaegfx.card: 640x512 x32 BGRA 65 5260ec
mode 640 512 32 1342837507 -uaegfx.card: 640x512 x32 BGRA-
node: 52616c uaegfx.card: 672x540 x 8 CLUT 0 52612c
mode 672 540 8 1358827520 -uaegfx.card: 672x540 x 8 CLUT-
node: 5261ac uaegfx.card: 672x540 x16 RGBPC 4d 52616c
mode 672 540 16 1358827776 -uaegfx.card: 672x540 x16 RGBPC-
node: 5261ec uaegfx.card: 672x540 x32 BGRA 5f 5261ac
mode 672 540 32 1358828291 -uaegfx.card: 672x540 x32 BGRA-
node: 52622c uaegfx.card: 800x450 x 8 CLUT 0 5261ec
mode 800 450 8 1358761984 -uaegfx.card: 800x450 x 8 CLUT-
node: 52626c uaegfx.card: 800x450 x16 RGBPC 6e 52622c
mode 800 450 16 1358762240 -uaegfx.card: 800x450 x16 RGBPC-
node: 5262ac uaegfx.card: 800x450 x32 BGRA 65 52626c
mode 800 450 32 1358762755 -uaegfx.card: 800x450 x32 BGRA-
node: 5262ec uaegfx.card: 800x500 x 8 CLUT 6e 5262ac
mode 800 500 8 1358696448 -uaegfx.card: 800x500 x 8 CLUT-
node: 52632c uaegfx.card: 800x500 x16 RGBPC 34 5262ec
mode 800 500 16 1358696704 -uaegfx.card: 800x500 x16 RGBPC-
node: 52636c uaegfx.card: 800x500 x32 BGRA 0 52632c
mode 800 500 32 1358697219 -uaegfx.card: 800x500 x32 BGRA-
node: 526abc uaegfx.card: 800x600 x 8 CLUT 55 52636c
mode 800 600 8 1342443520 -uaegfx.card: 800x600 x 8 CLUT-
node: 526afc uaegfx.card: 800x600 x16 RGBPC 0 526abc
mode 800 600 16 1342443776 -uaegfx.card: 800x600 x16 RGBPC-
node: 526b3c uaegfx.card: 800x600 x32 BGRA 0 526afc
mode 800 600 32 1342444291 -uaegfx.card: 800x600 x32 BGRA-
node: 526b7c uaegfx.card: 960x540 x 8 CLUT 0 526b3c
mode 960 540 8 1358630912 -uaegfx.card: 960x540 x 8 CLUT-
node: 526bbc uaegfx.card: 960x540 x16 RGBPC 0 526b7c
mode 960 540 16 1358631168 -uaegfx.card: 960x540 x16 RGBPC-
node: 526bfc uaegfx.card: 960x540 x32 BGRA ff 526bbc
mode 960 540 32 1358631683 -uaegfx.card: 960x540 x32 BGRA-
node: 526c3c uaegfx.card:1024x576 x 8 CLUT ff 526bfc
mode 1024 576 8 1351290880 -uaegfx.card:1024x576 x 8 CLUT-
node: 526c7c uaegfx.card:1024x576 x16 RGBPC ff 526c3c
mode 1024 576 16 1351291136 -uaegfx.card:1024x576 x16 RGBPC-
node: 526cbc uaegfx.card:1024x576 x32 BGRA 65 526c7c
mode 1024 576 32 1351291651 -uaegfx.card:1024x576 x32 BGRA-
node: 526cfc uaegfx.card:1024x600 x 8 CLUT 55 526cbc
mode 1024 600 8 1358565376 -uaegfx.card:1024x600 x 8 CLUT-
node: 526d3c uaegfx.card:1024x600 x16 RGBPC 55 526cfc
mode 1024 600 16 1358565632 -uaegfx.card:1024x600 x16 RGBPC-
node: 526d7c uaegfx.card:1024x600 x32 BGRA 55 526d3c
mode 1024 600 32 1358566147 -uaegfx.card:1024x600 x32 BGRA-
node: 526dbc uaegfx.card:1024x768 x 8 CLUT 55 526d7c
mode 1024 768 8 1342509056 -uaegfx.card:1024x768 x 8 CLUT-
node: 526dfc uaegfx.card:1024x768 x16 RGBPC 55 526dbc
mode 1024 768 16 1342509312 -uaegfx.card:1024x768 x16 RGBPC-
node: 526e3c uaegfx.card:1024x768 x32 BGRA 55 526dfc
mode 1024 768 32 1342509827 -uaegfx.card:1024x768 x32 BGRA-
node: 526e7c uaegfx.card:1280x720 x 8 CLUT 63 526e3c
mode 1280 720 8 1351487488 -uaegfx.card:1280x720 x 8 CLUT-
node: 526ebc uaegfx.card:1280x720 x16 RGBPC 55 526e7c
mode 1280 720 16 1351487744 -uaegfx.card:1280x720 x16 RGBPC-
node: 526efc uaegfx.card:1280x720 x32 BGRA 55 526ebc
mode 1280 720 32 1351488259 -uaegfx.card:1280x720 x32 BGRA-
node: 526f3c uaegfx.card:1280x1024x 8 CLUT 0 526efc
mode 1280 1024 8 1342640128 -uaegfx.card:1280x1024x 8 CLUT-
node: 52831c uaegfx.card:1280x1024x16 RGBPC 0 526f3c
mode 1280 1024 16 1342640384 -uaegfx.card:1280x1024x16 RGBPC-
node: 52835c uaegfx.card:1280x1024x32 BGRA 55 52831c
mode 1280 1024 32 1342640899 -uaegfx.card:1280x1024x32 BGRA-
node: 52839c uaegfx.card:1344x1080x 8 CLUT 0 52835c
mode 1344 1080 8 1358499840 -uaegfx.card:1344x1080x 8 CLUT-
node: 5283dc uaegfx.card:1344x1080x16 RGBPC 55 52839c
mode 1344 1080 16 1358500096 -uaegfx.card:1344x1080x16 RGBPC-

On orig CGX - null is return instead of empty list btw.

watsonmw avatar Feb 22 '20 03:02 watsonmw

note i guess my actual original issue was

UWORD ModelArrayLUT8[] = {PIXFMT_LUT8, ~0};
struct List* list = AllocCModeListTags(CYBRMREQ_CModelArray, (ULONG) ModelArrayLUT8, TAG_END);

didn't return any 8bit modes.

Sorry these issues are minor, and thanks for help.

watsonmw avatar Feb 22 '20 03:02 watsonmw