Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Information: The Microchip PIC32MZDA's GPU may also be GC200 #19

Open
ReimuNotMoe opened this issue Dec 27, 2021 · 4 comments
Open

Information: The Microchip PIC32MZDA's GPU may also be GC200 #19

ReimuNotMoe opened this issue Dec 27, 2021 · 4 comments

Comments

@ReimuNotMoe
Copy link

Hello. These days I'm trying to understand how the GPU of Microchip PIC32MZDA works by reverse engineering its "nano2d" closed source driver. I googled the strings found in the static library and then found this repo (wow). After some peeking, I suspect it is actually a GC200. Is there a way to confirm this?

The strings I found in this driver:
image

Symbols in this driver:

➜  ~ nm libnano2d.a|grep -E '(n2d|gco)'
         U gcoHARDWARE_Clear2D
         U gcoHARDWARE_ConvertFormat
         U gcoHARDWARE_FilterBlit
         U gcoHARDWARE_GetStretchFactor
         U gcoHARDWARE_SetDither2D
         U gcoHARDWARE_StartDE
         U gcoHARDWARE_StartDELine
00000f8c T n2d_allocate
000016c0 T n2d_blit
00000000 t _n2d_check_context
000012f8 T n2d_commit
0000259c T n2d_dither
000011fc T n2d_draw_state
000013a4 T n2d_fill
000025fc T n2d_init_hardware
         U n2d_kernel_hardware_commit
         U n2d_kernel_hardware_query_chip_identity
         U n2d_kernel_os_allocate_contiguous
         U n2d_kernel_os_get_hardware_address
00001f60 T n2d_line
0000244c T n2d_load_palette
00000e04 T n2d_open
00002344 T n2d_set_global_alpha
         U n2d_user_hardware_initialize
000001f8 C s_gco2D
000022f0 T gcoHARDWARE_Clear2D
000051cc T gcoHARDWARE_ColorConvertFromARGB8
000054d0 T gcoHARDWARE_ColorConvertToARGB8
00004b64 T gcoHARDWARE_ConvertFormat
00003e44 T gcoHARDWARE_DisableAlphaBlend
00003ea8 T gcoHARDWARE_EnableAlphaBlend
000072d8 T gcoHARDWARE_End2DFrame
00006cc4 T gcoHARDWARE_FilterBlit
00003980 T gcoHARDWARE_Get2DResourceUsage
00004288 T gcoHARDWARE_GetStretchFactor
00003674 T gcoHARDWARE_Load2DState
000036d0 T gcoHARDWARE_Load2DState32
00005868 T gcoHARDWARE_LoadColorPattern
000079b4 T gcoHARDWARE_LoadPalette
000050a4 T gcoHARDWARE_LoadSolidColorPattern
0000740c T gcoHARDWARE_Reset2DCmdBuffer
00003720 T gcoHARDWARE_Set2DClearColor
0000239c t gcoHARDWARE_Set2DState
00003768 T gcoHARDWARE_SetBitBlitMirror
0000357c T gcoHARDWARE_SetClipping
00006440 T gcoHARDWARE_SetColorSource
000038d0 T gcoHARDWARE_SetDither2D
00006a54 T gcoHARDWARE_SetMonochromeSource
00003cc4 T gcoHARDWARE_SetMultiplyModes
00005cb4 T gcoHARDWARE_SetSource
00004430 T gcoHARDWARE_SetSourceColorKeyRange
0000454c T gcoHARDWARE_SetSourceGlobalColor
00004210 T gcoHARDWARE_SetStretchFactors
00004350 T gcoHARDWARE_SetSuperTileVersion
00005d70 T gcoHARDWARE_SetTarget
000044c0 T gcoHARDWARE_SetTargetColorKeyRange
000045ac T gcoHARDWARE_SetTargetGlobalColor
00004c70 T gcoHARDWARE_SetTransparencyModesEx
00003004 T gcoHARDWARE_StartDE
0000744c T gcoHARDWARE_StartDELine
000047a4 T gcoHARDWARE_TranslateAlphaFactorMode
00003bb8 T gcoHARDWARE_TranslateCommand
000061f0 T gcoHARDWARE_TranslateDestinationFormat
00006380 T gcoHARDWARE_TranslateDestinationRotation
00004f4c T gcoHARDWARE_TranslateDestinationTransparency
00004e78 T gcoHARDWARE_TranslateDFBColorKeyMode
00004a48 T gcoHARDWARE_TranslateGlobalAlphaMode
0000460c T gcoHARDWARE_TranslateGlobalColorMultiplyMode
00006994 T gcoHARDWARE_TranslateMonoPack
00005bd8 T gcoHARDWARE_TranslatePatternFormat
00004ed0 T gcoHARDWARE_TranslatePatternTransparency
00004ae8 T gcoHARDWARE_TranslatePixelAlphaMode
00004728 T gcoHARDWARE_TranslatePixelColorMode
000046ac T gcoHARDWARE_TranslatePixelColorMultiplyMode
000059b8 T gcoHARDWARE_TranslateSourceFormat
000068d4 T gcoHARDWARE_TranslateSourceRotation
00004fc8 T gcoHARDWARE_TranslateSourceTransparency
00005068 T gcoHARDWARE_TranslateTransparencies
         U n2d_allocate
00007cf8 T n2d_user_hardware_deinitialize
00007b1c T n2d_user_hardware_initialize
00002140 T n2d_user_hardware_load_2d_state
00000b58 T n2d_kernel_hardware_commit
0000070c T n2d_kernel_hardware_deinitialize
00000de0 T n2d_kernel_hardware_dump_gpu_state
00000af0 T n2d_kernel_hardware_end
00000730 T n2d_kernel_hardware_event
000003e4 T n2d_kernel_hardware_initialize
000009cc T n2d_kernel_hardware_link
00000a74 T n2d_kernel_hardware_nop
000002ac T n2d_kernel_hardware_query_chip_identity
000008d4 T n2d_kernel_hardware_wait_link
         U n2d_kernel_os_allocate_contiguous
         U n2d_kernel_os_delay
         U n2d_kernel_os_get_base_address
         U n2d_kernel_os_get_hardware_address
         U n2d_kernel_os_peek
         U n2d_kernel_os_poke
         U n2d_kernel_os_print
         U n2d_kernel_os_trace
         U n2d_kernel_os_wait_interrupt
         U n2d_kernel_hardware_initialize
00000000 T n2d_kernel_os_allocate
00000144 T n2d_kernel_os_allocate_contiguous
00000100 T n2d_kernel_os_delay
0000002c T n2d_kernel_os_free
000001a4 T n2d_kernel_os_free_contiguous
00000340 T n2d_kernel_os_get_base_address
000001d0 T n2d_kernel_os_get_hardware_address
0000020c T n2d_kernel_os_map
00000270 T n2d_kernel_os_peek
000002a8 T n2d_kernel_os_poke
0000039c T n2d_kernel_os_print
0000036c T n2d_kernel_os_trace
00000240 T n2d_kernel_os_unmap
000002e8 T n2d_kernel_os_wait_interrupt
@austriancoder
Copy link

After some minutes of googling I found one source telling that it is a gc200 - https://www.eejournal.com/article/add-glamour-to-your-product/

If Linux runs on add the needed DTS nodes for the GPU and it should work out-of-the-box.

Btw. we are a clean room reverse engineering project.

@ReimuNotMoe
Copy link
Author

Thank you for the information. Because unlike all other peripherals, there are almost no information about this GPU in the datasheets, and Microchip staffs won't say a word about it.

I googled some etnaviv device tree snippets, and TBH I'm not very familiar with Linux DRM subsystem. Do I need to specify a memory location for framebuffer? Or the driver will allocate one in RAM automatically? Anyway I have to tell this memory location to the LCD controller (which is a separate peripheral) for the graphics to be actually displayed on screen.

Your project is awesome indeed.

@austriancoder
Copy link

Here is the dts binding: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/gpu/vivante,gc.yaml?h=v5.16-rc7

Here is one of many examples in the mainline linux kernel: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm/boot/dts/imx6qdl.dtsi?h=v5.16-rc7#n215

Keep in mind that Vivnate GPUs are render-only GPUs and you need a KMS driver that does the actual scanout. So you do not need to specify a memory location for a framebuffer etc. If there is no KMS driver you can just use a simple test program to interact with the 2d GPU: https://cgit.freedesktop.org/mesa/drm/tree/tests/etnaviv/etnaviv_2d_test.c?h=main

@ReimuNotMoe
Copy link
Author

Thank you very much for the information!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants