[Openpvrsgx-devgroup] Building the 1.7.862890 branch for x86

H. Nikolaus Schaller hns at goldelico.com
Sat May 25 12:22:11 CEST 2024


Hi,

> Am 25.05.2024 um 01:13 schrieb Julius Schwartzenberg <julius.vrijheid at freedom.nl>:
> 
> Hi all,
> 
> I have been trying to build the 1.7.862890 branch which has the Cedarview version.

Great!

> I added the missing files and managed to solve quite a few build errors by looking at the same files from a newer branch (I checked 1.17.4948957), but now I'm running into an error I'm not quickly sure how to solve:
> 
>  CC [M] drivers/gpu/drm/pvrsgx/1.7.862890/pvr/services4/srvkm/env/linux/osfunc.o
> In file included from ./include/linux/workqueue.h:9,
>                 from ./include/linux/srcu.h:21,
>                 from ./include/linux/notifier.h:16,
>                 from ./arch/x86/include/asm/uprobes.h:13,
>                 from ./include/linux/uprobes.h:49,
>                 from ./include/linux/mm_types.h:16,
>                 from ./include/linux/mmzone.h:22,
>                 from ./include/linux/gfp.h:7,
>                 from ./include/linux/mm.h:7,
>                 from ./arch/x86/include/asm/cacheflush.h:5,
>                 from drivers/gpu/drm/pvrsgx/1.7.862890/pvr/services4/srvkm/env/linux/osfunc.c:40:
> drivers/gpu/drm/pvrsgx/1.7.862890/pvr/services4/srvkm/env/linux/osfunc.c: In function ‘OSAddTimer’:
> ./include/linux/timer.h:111:34: error: passing argument 2 of ‘init_timer_key’ from incompatible pointer type [-Werror=incompatible-pointer-types]
>  111 |         init_timer_key((_timer), (_fn), (_flags), NULL, NULL)
>      |                                  ^~~~~
>      |                                  |
>      |                                  IMG_VOID (*)(IMG_UINT32) {aka void (*)(unsigned int)}
> ./include/linux/timer.h:127:9: note: in expansion of macro ‘__init_timer’
>  127 |         __init_timer((timer), (callback), (flags))
>      |         ^~~~~~~~~~~~
> drivers/gpu/drm/pvrsgx/1.7.862890/pvr/services4/srvkm/env/linux/osfunc.c:1917:5: note: in expansion of macro ‘timer_setup’
> 1917 |     timer_setup(&psTimerCBData->sTimer, OSTimerCallbackWrapper, 0);
>      |     ^~~~~~~~~~~
> ./include/linux/timer.h:77:28: note: expected ‘void (*)(struct timer_list *)’ but argument is of type ‘IMG_VOID (*)(IMG_UINT32)’ {aka ‘void (*)(unsigned int)’}
>   77 |                     void (*func)(struct timer_list *), unsigned int flags,
>      |                     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
> cc1: all warnings being treated as errors
> 
> The code is matching up with the 1.17.4948957 version now. You can find my branch here:
> https://github.com/jschwartzenberg/linux_openpvrsgx/tree/letux/pvrsrvkm-1.7.862890

I've tried to get it compiled but it fails with:

  MAKE    drivers/gpu/drm/pvrsgx: cedarview
scripts/Makefile.build:41: drivers/gpu/drm/pvrsgx/1.7.862890/pvr/Makefile: No such file or directory
make[8]: *** No rule to make target 'drivers/gpu/drm/pvrsgx/1.7.862890/pvr/Makefile'.  Stop.
drivers/gpu/drm/pvrsgx/Makefile:64: recipe for target 'drivers/gpu/drm/pvrsgx/pvr' failed
make[7]: *** [drivers/gpu/drm/pvrsgx/pvr] Error 2
scripts/Makefile.build:481: recipe for target 'drivers/gpu/drm/pvrsgx' failed

So is drivers/gpu/drm/pvrsgx/1.7.862890/pvr/Makefile missing?

> 
> 
> Any idea what I could try to get past this one?

I have an idea, but to really verify I would need to do some compile tests.
Basically it appears that init_timer_key() got a new parameter in v4.15-rc1
(found by browsing through bootlin elixir and searching for init_timer_key).

This is now a function pointer with signature void (*)(struct timer_list *).
In our case it is currently

static IMG_VOID OSTimerCallbackWrapper(IMG_UINT32 ui32Data)

which should become

static IMG_VOID OSTimerCallbackWrapper(struct timer_list *list)

Now we have to find out how to derive IMG_UINT32 ui32Data from
the list. This needs a deeper look inside since apparently the ui32Data
is simply used as a generic pointer.

In the pre-4.15 variant this callback data is provided by

    psTimerCBData->sTimer.data = (IMG_UINT32)psTimerCBData;

But I have no good idea so far how to pass callback data to timer_setup() or
through struct timer_list Maybe this is even wrong in our later DDK's...
Or they do something which are missing.

I find there in commit 3fc279b1feaece:
(https://github.com/openpvrsgx-devgroup/linux_openpvrsgx/commit/3fc279b1feaece#diff-779a9b52fd43b5261a9282182343eec3268b141b457fb5a467282eb1728cadbeR2808)

+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0))
+ /*!
+ ******************************************************************************
+
+ @Function      OSTimerCallbackWrapper
+
+ @Description   OS specific timer callback wrapper function
+
+ @Input         psTimer    Timer list structure
  +*/ /**************************************************************************/
+static void OSTimerCallbackWrapper(struct timer_list *psTimer)
+{
+       TIMER_CALLBACK_DATA *psTimerCBData = from_timer(psTimerCBData, psTimer, sTimer);
+#else

So essentially it means to backport the 1.17 code for OSTimerCallbackWrapper
to make this compile. The trick is to provide a private struct which has the
struct timer_list as its first element and then using the from_timer() macro.
Sort of subclassing with additional variables in the subclass.

> 
> Many thanks in advance!!

Hope this helps. And making me able to compile your code would allow me to
even verify my theory.

> 
> Best regards,
> Julius

Best regards,
Nikolaus



More information about the openpvrsgx-devgroup mailing list