Crash in SkSurface::MakeFromBackendRenderTarget

82 views
Skip to first unread message

pearleye

unread,
May 24, 2023, 11:26:29 AM5/24/23
to skia-discuss
Hi All

I'm working on developing an sample android application which does some rendering via SKIA using GPU and I see a crash from the native part (jni) with the below message,
    signal 6 (SIGABRT), code -1 (SI_QUEUE), fault addr --------
    Abort message: 'Pure virtual function called!
From the native crash stack, I see it's happening within
    SkColorTypeAndFormatToGrColorType
    SkSurface::MakeFromBackendRenderTarget

I believe the crash is happening while executing the below within SkColorTypeAndFormatToGrColorType,
    if (caps->isFormatSRGB(format)) {

Below is the piece of native code where I try to get the surface and the crash happens,
    sk_sp<const GrGLInterface> glInterface = GrGLMakeNativeInterface();

    GrContextOptions options;
    options.fDisableDistanceFieldPaths = true;
    sk_sp<GrContext> grContext = GrContext::MakeGL(std::move(glInterface), options);

    GrGLFramebufferInfo fbInfo;
    fbInfo.fFBOID = 0;
    fbInfo.fFormat = GR_GL_RGBA8;
    colorType = kN32_SkColorType;

    GrBackendRenderTarget backendRT(width, height, 0, STENCIL_BUFFER_SIZE, fbInfo);
        SkSurfaceProps props(0, kUnknown_SkPixelGeometry);

    sk_sp<SkSurface> renderTarget(SkSurface::MakeFromBackendRenderTarget(
        grContext, backendRT, kBottomLeft_GrSurfaceOrigin, colorType, nullptr, &props));

Just incase if it matters, below is the egl setup I do in java before I get the surface and draw in the native side via jni ,
    egl = (EGL10) EGLContext.getEGL();

    eglDisplay = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);

    int[] eglVersion = new int[2];
    egl.eglInitialize(eglDisplay, eglVersion))

    EGLConfig[] eglConfigs = new EGLConfig[1];
    int[] eglConfigsCount = new int[1];
    egl.eglChooseConfig(
                eglDisplay,
                getEglConfigAttribList(),
                eglConfigs,
                1,
                eglConfigsCount);

    int[] attributeList = {
                EGL_CONTEXT_CLIENT_VERSION,
                2,
                EGL10.EGL_NONE};
    eglContext = egl.eglCreateContext(eglDisplay, eglConfigs[0],       
        EGL10.EGL_NO_CONTEXT, attributeList);

    eglSurface = egl.eglCreateWindowSurface(eglDisplay, eglConfigs[0], 
        surfaceView.getHolder(), null);

    egl.eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglContext);

Does anyone know why do I see this crash?

Platform - ARM chipset, AOSP 11.

Thank you.

pearleye

unread,
May 25, 2023, 11:10:55 AM5/25/23
to skia-discuss
Earlier I had been using the main UI thread for setting up EGL & creating GrContext natively and now I tried doing this in a different thread but still, I see the same crash!
Reply all
Reply to author
Forward
0 new messages