Skia crash on Intel HD 3000

97 views
Skip to first unread message

trs

unread,
Sep 27, 2022, 6:34:42 AM9/27/22
to skia-discuss
Hi,

I came across this group whilst debugging a crash in a product I work on, which turns out to be a crash in Skia, which is reproducible in the HelloWorld project.

The HelloWorld project in Skia crashes in GrResourceProvider::createPatternedIndexBuffer on Windows 10 with Intel(R) HD Graphics 3000 GPU. The issue was reported by a different developer a while ago here:


The crash occurs in the following code snippet from GrResourceProvider.cpp:

    uint16_t* data = (uint16_t*) buffer->map();
    SkAutoTArray<uint16_t> temp;
    if (!data) {
        temp.reset(reps * patternSize);
        data = temp.get();
    }
    for (int i = 0; i < reps; ++i) {
        int baseIdx = i * patternSize;
        uint16_t baseVert = (uint16_t)(i * vertCount);
        for (int j = 0; j < patternSize; ++j) {
            data[baseIdx+j] = baseVert + pattern[j];
        }
    }


at the following line

data[baseIdx+j] = baseVert + pattern[j]

data is non-null, but points to memory that cannot be written.

Are there any fixes or known workarounds for this?



Brian Salomon

unread,
Sep 27, 2022, 9:00:48 AM9/27/22
to skia-d...@googlegroups.com
Is this on OpenGL (or GL over ANGLE)? I think that would mean that glMapBuffer returned an invalid address which would indicate a driver bug. I would try modifying GrGLCaps::applyDriverCorrectnessWorkarounds to set:


That will cause Skia to avoid using buffer mapping.

--
You received this message because you are subscribed to the Google Groups "skia-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/skia-discuss/fac9cc96-82e3-4c5e-90ad-07f7d2e5f952n%40googlegroups.com.


--

Brian Salomon | Office Hours: go/bsalomon-office | bsal...@google.com

Tom Sanham

unread,
Sep 27, 2022, 9:26:09 AM9/27/22
to skia-d...@googlegroups.com
Thank you very much for the response. I will make this modification and test it.

Tom Sanham

Silhouette Software

Plymouth Science Park.

Plymouth. Devon. PL6 8BT

 

tel:  01752 764 282 

www.silhouettesoftware.com

 

Silhouette Software is a trading name of Silhouette Research & Technology Limited Registered in England No 07166287

Registered Office: Plymouth Science Park, 17 Research Way, Plymouth, Devon, PL6 8BT

 

The content of this email is confidential and intended for the recipient specified in message only. It is strictly forbidden to share any part of this message with any third party, without a written consent of the sender. If you received this message by mistake, please reply to this message and follow with its deletion, so that we can ensure such a mistake does not occur in the future.



You received this message because you are subscribed to a topic in the Google Groups "skia-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/skia-discuss/dYV1blEAda0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to skia-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/skia-discuss/CAHOuer%3Dkyd-Xg9xbXCw%2Bjx8cT%3De_ZCxRbakz41_A8BUfz0WhNQ%40mail.gmail.com.

Brian Salomon

unread,
Sep 27, 2022, 9:35:46 AM9/27/22
to skia-d...@googlegroups.com
If it works we can help land a fix upstream. We may need some help with making sure we can identify the GPU correctly as we don't have a machine to test with locally.

Tom Sanham

unread,
Sep 30, 2022, 5:15:45 PM9/30/22
to skia-d...@googlegroups.com
Thank you very much for your help.

I applied the following patch to skia/1cfab57:

diff --git a/src/gpu/ganesh/gl/GrGLCaps.cpp b/src/gpu/ganesh/gl/GrGLCaps.cpp
index fd23f5fa15..981a753652 100644
--- a/src/gpu/ganesh/gl/GrGLCaps.cpp
+++ b/src/gpu/ganesh/gl/GrGLCaps.cpp
@@ -3687,6 +3687,9 @@ void GrGLCaps::applyDriverCorrectnessWorkarounds(const GrGLContextInfo& ctxInfo,
                                                  const GrGLInterface* glInterface,
                                                  GrShaderCaps* shaderCaps,
                                                  FormatWorkarounds* formatWorkarounds) {
+    fMapBufferFlags = kNone_MapFlags;
+    fMapBufferType = kNone_MapBufferType;
+
     // A driver bug on the nexus 6 causes incorrect dst copies when invalidate is called beforehand.
     // Thus we are disabling this extension for now on Adreno4xx devices.
     if (ctxInfo.renderer() == GrGLRenderer::kAdreno430       ||


Now, instead of crashing in GrResourceProvider.cpp: the program now crashes at skia\src\gpu\ganesh\gl\builders\GrGLShaderStringBuilder.cpp:94

The following string prints to the console:

Shader compilation error
------------------------
   1    #version 140
   2
   3    uniform vec4 sk_RTAdjust;
   4    uniform mat3 umatrix_S1_c0_c1;
   5    in vec2 inPosition;
   6    in vec4 inColor;
   7    in vec4 inCircleEdge;
   8    noperspective out vec4 vinCircleEdge_S0;
   9    noperspective out vec4 vinColor_S0;
  10    noperspective out vec2 vTransformedCoords_5_S0;
  11    void main() {
  12        vinCircleEdge_S0 = inCircleEdge;
  13        vinColor_S0 = inColor;
  14        vec2 _tmp_0_inPosition = inPosition;
  15        vec2 _tmp_2_inPosition = inPosition;
  16        gl_Position = vec4(_tmp_0_inPosition, 0.0, 1.0);
  17        {
  18            vTransformedCoords_5_S0 = mat3x2(umatrix_S1_c0_c1) * vec3(_tmp_2_inPosition, 1.0);
  19        }
  20        gl_Position = vec4(gl_Position.xy * sk_RTAdjust.xz + gl_Position.ww * sk_RTAdjust.yw, 0.0, gl_Position.w);
  21    }
  22
Errors:
ERROR: 0:18: 'assign' :  cannot convert from '3-component vector of float' to 'varying 2-component vector of float'


Do you have any further insight?

Tom

Tom Sanham

Silhouette Software

Plymouth Science Park.

Plymouth. Devon. PL6 8BT

 

tel:  01752 764 282 

www.silhouettesoftware.com

 

Silhouette Software is a trading name of Silhouette Research & Technology Limited Registered in England No 07166287

Registered Office: Plymouth Science Park, 17 Research Way, Plymouth, Devon, PL6 8BT

 

The content of this email is confidential and intended for the recipient specified in message only. It is strictly forbidden to share any part of this message with any third party, without a written consent of the sender. If you received this message by mistake, please reply to this message and follow with its deletion, so that we can ensure such a mistake does not occur in the future.


Brian Salomon

unread,
Sep 30, 2022, 5:26:36 PM9/30/22
to skia-d...@googlegroups.com
Hm, maybe try also setting
shaderCaps->fNonsquareMatrixSupport = false

in the same place?

Tom Sanham

unread,
Sep 30, 2022, 6:09:55 PM9/30/22
to skia-d...@googlegroups.com
Wow - that got it working! Thank you very much for the help.

Please let me know how to gather any information needed for Skia to identify this GPU and I will look at doing so over the weekend.


Tom Sanham

Silhouette Software

Plymouth Science Park.

Plymouth. Devon. PL6 8BT

 

tel:  01752 764 282 

www.silhouettesoftware.com

 

Silhouette Software is a trading name of Silhouette Research & Technology Limited Registered in England No 07166287

Registered Office: Plymouth Science Park, 17 Research Way, Plymouth, Devon, PL6 8BT

 

The content of this email is confidential and intended for the recipient specified in message only. It is strictly forbidden to share any part of this message with any third party, without a written consent of the sender. If you received this message by mistake, please reply to this message and follow with its deletion, so that we can ensure such a mistake does not occur in the future.


Brian Salomon

unread,
Sep 30, 2022, 7:55:40 PM9/30/22
to skia-d...@googlegroups.com
Glad it worked! If you apply this patch and initialize a GL GrDirectContext it should log more than enough info to stderr to be able identify the GPU.

log.diff

Tom Sanham

unread,
Oct 1, 2022, 5:32:38 AM10/1/22
to skia-d...@googlegroups.com
Thanks for the tip.

I applied the patch. It produces the following output:

VER: 3.1.0 - Build 9.17.10.4459
VEN: Intel
REN: Intel(R) HD Graphics 2000

glv: 00030001
slv: 00010028
ven: 3
ren: 15

abck: 0
aven: 7
aren: 40
adri: 9
adrv: 00000000

VER: 3.1.0 - Build 9.17.10.4459
VEN: Intel
REN: Intel(R) HD Graphics 2000

glv: 00030001
slv: 00010028
ven: 3
ren: 15

abck: 0
aven: 7
aren: 40
adri: 9
adrv: 00000000

VER: 3.1.0 - Build 9.17.10.4459
VEN: Intel
REN: Intel(R) HD Graphics 2000

glv: 00030001
slv: 00010028
ven: 3
ren: 15

abck: 0
aven: 7
aren: 40
adri: 9
adrv: 00000000


Tom

Tom Sanham

Silhouette Software

Plymouth Science Park.

Plymouth. Devon. PL6 8BT

 

tel:  01752 764 282 

www.silhouettesoftware.com

 

Silhouette Software is a trading name of Silhouette Research & Technology Limited Registered in England No 07166287

Registered Office: Plymouth Science Park, 17 Research Way, Plymouth, Devon, PL6 8BT

 

The content of this email is confidential and intended for the recipient specified in message only. It is strictly forbidden to share any part of this message with any third party, without a written consent of the sender. If you received this message by mistake, please reply to this message and follow with its deletion, so that we can ensure such a mistake does not occur in the future.


Brian Salomon

unread,
Oct 3, 2022, 11:22:10 AM10/3/22
to skia-d...@googlegroups.com

Tom Sanham

unread,
Oct 7, 2022, 10:57:37 AM10/7/22
to skia-d...@googlegroups.com
Thank you for making this change. It fixes the issue when running HelloWorld.cpp on the PC in question.

Once we integrate this update into our application I will test again and report back.



Tom Sanham

Silhouette Software

Plymouth Science Park.

Plymouth. Devon. PL6 8BT

 

tel:  01752 764 282 

www.silhouettesoftware.com

 

Silhouette Software is a trading name of Silhouette Research & Technology Limited Registered in England No 07166287

Registered Office: Plymouth Science Park, 17 Research Way, Plymouth, Devon, PL6 8BT

 

The content of this email is confidential and intended for the recipient specified in message only. It is strictly forbidden to share any part of this message with any third party, without a written consent of the sender. If you received this message by mistake, please reply to this message and follow with its deletion, so that we can ensure such a mistake does not occur in the future.


trs

unread,
Nov 10, 2022, 3:41:51 AM11/10/22
to skia-discuss
Reporting back: The fix is now in our release build and all is working. Thank you very much for your help.
Reply all
Reply to author
Forward
0 new messages