<html><head><meta http-equiv="content-type" content="text/html; charset=us-ascii"></head><body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">Hi Julius,<div><br></div><div>I did go through the DDK file tree and made a first draft of an analysis what I think/guess the files are good for.</div><div><br></div><div>This is added as a text document on top of the pvrsgx-history branch.</div><div><br></div><div><a href="https://github.com/goldelico/letux-kernel/commit/e9fb2c3a7396014a74eec00b5aa60e579dd429c3">https://github.com/goldelico/letux-kernel/commit/e9fb2c3a7396014a74eec00b5aa60e579dd429c3</a></div><div><br></div><div>Hope this helps to decide which files to update and which to keep as is.</div><div><br></div><div>BR,</div><div>Nikolaus</div><div><br></div><div><div><br><blockquote type="cite"><div>Am 28.05.2024 um 16:57 schrieb H. Nikolaus Schaller <hns@goldelico.com>:</div><br class="Apple-interchange-newline"><div><div>Hi Julius,<br><br><blockquote type="cite">Am 27.05.2024 um 22:53 schrieb Julius Schwartzenberg <julius.vrijheid@freedom.nl>:<br><br>Hi Nikolaus,<br><br>On 27.05.24 11:59, H. Nikolaus Schaller wrote:<br><blockquote type="cite">My defconfig uses CONFIG_SGX_CEDARVIEW=m and I wasn't aware so far that you have introduced<br>a new CONFIG variable for the same purpose.<br></blockquote><br>So I wasn't aware of CONFIG_SGX_CEDARVIEW! Does that mean I'm using the wrong branch?<br></blockquote><br><br>Hm. To me it appeared that you are on the right one. But there are two branches:<br>a) letux/pvrsrvkm-1.7.862890 - which is (currently) based on upstream v6.8-rc4<br>b) pvrsrvkm-6.8-rc4 - which merges everything into a full branch, including the core driver and letux_defconfig<br><br><blockquote type="cite">The CONFIG variable used by my branch is the one that Intel's developers chose (CONFIG_DRM_INTEL_CDV).<br></blockquote><br>Ah, I see. Well, we have a scheme that tries to combine all architectures and therefor isn't focussed on Intel&Cedarview.<br>Hence all CONFIG variables start with CONFIG_SGX_.<br><br><blockquote type="cite"><br><br><blockquote type="cite">letux_defconfig has also a CONFIG_SGX_DEBUG controlling the same as the choice between<br>DRM_CDV_RELEASE and DRM_CDV_DEBUG would do. Only DRM_PVR_PDUMP and DRM_PVR_TRACE are not<br>directly avaiable.<br>So we do not really need to introduce a new drivers/gpu/drm/pvrsgx/1.7.862890/Kconfig.<br>And drivers/gpu/drm/pvrsgx/1.7.862890/Makefile can be moved to drivers/gpu/drm/pvrsgx/1.7.862890/pvr/Makefile<br>After fixing this (see below) I could (also) compile and confirm your error messages.<br></blockquote><br>Do you have a branch for this? I will switch to your branch then.<br></blockquote><br><span class="Apple-tab-span" style="white-space:pre">  </span>https://git.goldelico.com/?p=letux-kernel.git;a=shortlog;h=refs/heads/work-pvrsrvkm-6.8-rc4-x86-1.7.862890<br><br><blockquote type="cite"><br><br><blockquote type="cite"><blockquote type="cite">Note that I'm using a 32-bit system. I have no idea if the driver could be compiled for 64-bit too, there were never any AMD64 binaries for the userspace part.<br></blockquote>The same is for ARM/ARM64 that there is no 64 bit build and no user-space code.<br></blockquote><br>I see. Did you get the kernel part to work on any 64-bit system?<br></blockquote><br>Haven't ever tried... The problem is also that each SoC architecture seems to have some services4/system/ subdirectory.<br><br><blockquote type="cite"><br><br><blockquote type="cite">But I wonder about the structure. Especially the introduction of new CONFIGs for doing the same.<br></blockquote><br>I just dumped the files I couldn't find from the Intel driver in the branch with the matching version. I was already wondering whether I was using the right path. Just in case the full package with that is here:<br>https://archive.org/details/PowerVR-Graphics-Media-Drivers-for-Linux-Intel-GMA3600-3650-GPU<br><br>I also found a 1.0.1 package somewhere and a Meego image that is supposed to work.<br><br><br><blockquote type="cite">Basically the idea of the OpenPVRSGX driver is to separate decision on platform (e.g. omap3 or omap4<br>or jz480 or cedarview etc.) and the DDK version to be built. In theory every DDK should be buildable<br>for every plaform.<br></blockquote><br>That would be really great. I was already hoping we could look at building Cedarview also with a newer DDK and see where to go from there.<br><br><br><blockquote type="cite">So choosing CONFIG_SGX_CEDARVIEW or CONFIG_SGX_POULSBO should generates gma500 or gma3600 kernel modules<br>(potentially both) and the idea is that some installation or boot mechanism outside the kernel decides which kernel<br>module to load.<br></blockquote><br>I did a grep on CONFIG_SGX_CEDARVIEW with my branch and it doesn't return any results, so I need to switch to your branch :)<br></blockquote><br><blockquote type="cite"><br><br><blockquote type="cite">One general thought: Tracing down all these fixes and backporting to 1.7.862890 seems to be quite a lot of work<br>and may introduce errors...<br>So I thought about something like<br>cp drivers/gpu/drm/pvrsgx/1.17.4948957/eurasia_km/services4/srvkm/env/linux/* drivers/gpu/drm/pvrsgx/1.7.862890/pvr/services4/srvkm/env/linux<br></blockquote><br>Yeah I was thinking about something like that too, but I have no idea how tightly coupled those things are. I was even thinking I might be changing too much already. My goal would be to boot and get at least working output and the kernel part with /proc/pvr loaded. Then see whether any userspace driver could work.<br></blockquote><br>Well, I think they are quite tightly coupled. Especially I assume that the firmware binary is built from including include4/sgxapi_km.h.<br>So kernel and user space must be synchronized.<br><br>I had tried that with DDK 1.14 and DDK 1.17 on the TI AM335x (which is an architeture where we have different choices). But the user-space even asks the /proc/pvr directory for the kernel driver version and rejects operation with an error.<br><br>This means unless you find a DDK 1.17 build of the firmware and user-space libraries, there is no chance.<br>Well, there is a minor one by faking the driver to report an older version. And somehow map the command code enum values which have changed in sgxapi_km.h.<br><br>For CI20/JZ4780 it is even worse that I don't even have a compatible firmware. I had experimented with QEMU at least to get the firmware of the ARM build loaded into the MIPS based processor but had not much success...<br><br><blockquote type="cite"><br><br><blockquote type="cite">Despite some initial success we run into problems with this approach. We need header files not available in 1.7.862890.<br>Many files are identical (except adding comments and new functions), but some do really subtle changes.<br></blockquote><br>It seems that Intel actually used a crappy algorithm to strip comments. It removed everything after /* up to */ and some whitespace. The whitespace before the /* consistently remained, so there's all kinds of loose whitespace exactly in spots where other DDK versions have comments. Maybe you saw I put some back.<br></blockquote><br>Yes, there seems to be a master repository at Imagination including kernel driver, firmware and user-space libraries. From where they package everything and hand it over to the SoC vendors. Those added some additional code to make the SoC integration work and build binaries only for firmware and libraries (usually compiled with assumptions for versions of other system libraries). And then they removed what they were not allowed to or willing to publish. This was then published under GPL.<br><br>Therefore each release we have collected is different...<br><br><blockquote type="cite"><br><br><blockquote type="cite">Obvious are the changes to pvrversion.h. More subtle is that for example include4/sgxapi_km.h changes the<br>_SGX_MISC_INFO_REQUEST_ enum constants which are very likely hard baked into the firmware. So taking this<br>file simply from DDK 1.17 makes DDK 1.7 certainly broken. But this could be handled by #ifdef but this needs<br>a careful analysis.<br></blockquote><br>Ah interesting, there are also multiple firmware versions matching with different kernel DDKs?<br></blockquote><br>Yes, as far as I see there is always a firmware version with same version number as the DDK.<br><blockquote type="cite"><br><br><blockquote type="cite">Some idea to analyse this would be to pile up all DDK revisions in one git branch and use git to detect the<br>changes for each one. This is sort of reconstructing the version control system contents where we have<br>snapshots from.<br></blockquote><br>Yeah this would be helpful :)<br><br><br><blockquote type="cite">Some far distance goal could be to merge all SGX revisions into a single tree and have these differences<br>covered by #ifdefs...<br></blockquote><br>Hopefully we could simply move everything to the latest DDK instead? :)<br></blockquote><br>Well it may be possible but isn't simple either :)<br><br>Basically we have to find out what really has changed between the DDK releases and cover with #ifdef or even dynamic tables. So that the latest DDK code + extensions can report and handle any version user-space code is asking for...<br><br>This also involves to decide what is important (for user-space and firmware interaction, i.e. sgxapi_km.h) and what is only code cosmetics (white space/comments) and what Linux adaptations (API changes) and what is a code improvement not changing the functions.<br><br>In any case a complex approach... But puzzle pieces are there.<br><br><blockquote type="cite"><br>Many thanks!!<br>Julius<br><br>PS: I'm getting all the messages sent to the list, no need to add another address.<br></blockquote><br>Great!<br><br>Best regards,<br>Nikolaus</div></div></blockquote></div><br></div></body></html>