a44e8effa764d02584b413f39295608a58a72579
[AGL/meta-agl-devel.git] / meta-agl-lxc / dynamic-layers / meta-rcar-gen3 / recipes-kernel / kernel-module-gles / kernel-module-gles / 0001-Fix-fw-download-issue.patch
1 From d7a7ad476dee136e21fc7de112003528f7675007 Mon Sep 17 00:00:00 2001
2 From: Naoto Yamaguchi <naoto.yamaguchi@aisin.co.jp>
3 Date: Wed, 1 Dec 2021 08:16:24 +0900
4 Subject: [PATCH] Fix fw download issue
5
6 ---
7  services/server/env/linux/module_common.c | 26 ++++++++++++++++-------
8  1 file changed, 18 insertions(+), 8 deletions(-)
9
10 diff --git a/services/server/env/linux/module_common.c b/services/server/env/linux/module_common.c
11 index 5822dab..3c97b28 100644
12 --- a/services/server/env/linux/module_common.c
13 +++ b/services/server/env/linux/module_common.c
14 @@ -416,6 +416,10 @@ int PVRSRVDeviceResume(PVRSRV_DEVICE_NODE *psDeviceNode)
15         return 0;
16  }
17  
18 +//HACK
19 +static DEFINE_MUTEX(rgx_initialize_mutex);
20 +//HACK
21 +
22  /**************************************************************************/ /*!
23  @Function     PVRSRVDeviceOpen
24  @Description  Common device open.
25 @@ -455,18 +459,24 @@ int PVRSRVDeviceOpen(PVRSRV_DEVICE_NODE *psDeviceNode,
26  
27         if (psDeviceNode->eDevState == PVRSRV_DEVICE_STATE_INIT)
28         {
29 -               eError = PVRSRVCommonDeviceInitialise(psDeviceNode);
30 -               if (eError != PVRSRV_OK)
31 +               mutex_lock(&rgx_initialize_mutex);
32 +               if (psDeviceNode->eDevState == PVRSRV_DEVICE_STATE_INIT)
33                 {
34 -                       PVR_DPF((PVR_DBG_ERROR, "%s: Failed to initialise device (%s)",
35 -                                        __func__, PVRSRVGetErrorString(eError)));
36 -                       iErr = -ENODEV;
37 -                       goto out;
38 -               }
39 +                       eError = PVRSRVCommonDeviceInitialise(psDeviceNode);
40 +                       if (eError != PVRSRV_OK)
41 +                       {
42 +                               PVR_DPF((PVR_DBG_ERROR, "%s: Failed to initialise device (%s)",
43 +                                                __func__, PVRSRVGetErrorString(eError)));
44 +                               iErr = -ENODEV;
45 +                               mutex_unlock(&rgx_initialize_mutex);
46 +                               goto out;
47 +                       }
48  
49  #if defined(SUPPORT_RGX)
50 -               PVRGpuTraceInitIfEnabled(psDeviceNode);
51 +                       PVRGpuTraceInitIfEnabled(psDeviceNode);
52  #endif
53 +               }
54 +               mutex_unlock(&rgx_initialize_mutex);
55         }
56  
57         sPrivData.psDevNode = psDeviceNode;
58 -- 
59 2.25.1
60