Comment 8 for bug 63830

Revision history for this message
Misha Koshelev (misha680) wrote :

If in hw/xgl/glxext/xglglxext.c, in the function xglDrawArrays I make the following change (denoted by MISHA HACK in the comments) it no longer crashes although there are some redrawing problems:

static void
xglDrawArrays (GLenum mode,
               GLint first,
               GLsizei count)
{
    GLenum listMode;

    if (cctx->list)
    {
        glEndList ();
        xglStartList (XGL_LIST_OP_DRAW, GL_COMPILE);
        glDrawArrays (mode, first, count);
        glEndList ();

        listMode = cctx->listMode;
    }
    else
        listMode = GL_COMPILE_AND_EXECUTE;

    if (listMode == GL_COMPILE_AND_EXECUTE)
    {
        RegionRec region;
        BoxRec scissor, box;
        BoxPtr pBox;
        int nBox;

        XGL_GLX_DRAW_PROLOGUE (pBox, nBox, &scissor);

        while (nBox--)
        {
            XGL_GLX_DRAW_BOX (&box, pBox);

            pBox++;

            if (!cctx->framebuffer && cctx->attrib.scissorTest)
                XGL_GLX_INTERSECT_BOX (&box, &scissor);

            if (box.x1 < box.x2 && box.y1 < box.y2)
            {
                XGL_GLX_SET_SCISSOR_BOX (&box);

                /* !!! MISHA HACK START !!! */
                if (count < 1000)
                  glDrawArrays (mode, first, count);
                /* !!! MISHA HACK END !!! */

                XGL_GLX_DRAW_DAMAGE (&box, &region);
            }
        }
    }

    if (cctx->list)
        xglStartList (XGL_LIST_OP_CALLS, cctx->listMode);
}

I am in communication with David Reverman about the bug and hopefully he will suggest something a little cleaner (basically it seems
like there is aproblem with calls to glDrawArrays with a large count
in this function, but as I have no OpenGL experience I am not clear on what array is actually being used for this function, and thus cannot currently proceed further).

Misha