Thanks for the response mr. Daniel.<br><br>According to my understanding KDrive has been developed with more focus on embedded systems. So why do u want me to go for XOrg ( u mean XAA??) instead of KDrive??<br><br>I think the code which handles whether to call a hardware accelerated operation or software callback lies inside Kdrive code itself know. That code is already present in the Xserver/hw/kdrive/src folder.<br>
<br>Anyway for you reference i am posting the perticular code block below. In that i have added my hw accelerated blit call in (*pKaaScr-&gt;info-&gt;Copy)  callback which will get called from KaaCopyNtoN() function.<br><br>
Do u have any ided why the mapping    pScreen-&gt;PaintWindowBackground = kaaPaintWindow;<br>has been removed in the next versions?? and <br>why is the function kaaFillRegionTiled() is left unimplemented and commented??<br>
<br>please let me know if u want any more specific information.<br><br>#ifdef HAVE_CONFIG_H<br>#include &lt;config.h&gt;<br>#endif<br>#include &quot;kdrive.h&quot;<br>#include &quot;kaa.h&quot;<br>#include &quot;dixfontstr.h&quot;<br>
<br>#define DEBUG_MIGRATE 0<br>#define DEBUG_PIXMAP 0<br>#if DEBUG_MIGRATE<br>#define DBG_MIGRATE(a) ErrorF a<br>#else<br>#define DBG_MIGRATE(a)<br>#endif<br>#if DEBUG_PIXMAP<br>#define DBG_PIXMAP(a) ErrorF a<br>#else<br>
#define DBG_PIXMAP(a)<br>#endif<br> <br>int kaaGeneration;<br>int kaaScreenPrivateIndex;<br>int kaaPixmapPrivateIndex;<br><br>#define KAA_PIXMAP_SCORE_MOVE_IN    10<br>#define KAA_PIXMAP_SCORE_MAX        20<br>#define KAA_PIXMAP_SCORE_MOVE_OUT   -10<br>
#define KAA_PIXMAP_SCORE_MIN        -20<br>#define KAA_PIXMAP_SCORE_PINNED        1000<br>#define KAA_PIXMAP_SCORE_INIT        1001<br><br>void<br>kaaDrawableDirty (DrawablePtr pDrawable)<br>{<br>    PixmapPtr pPixmap;<br>
    KaaPixmapPrivPtr pKaaPixmap;<br><br>    if (pDrawable-&gt;type == DRAWABLE_WINDOW)<br>    pPixmap = (*pDrawable-&gt;pScreen-&gt;GetWindowPixmap)((WindowPtr) pDrawable);<br>    else<br>    pPixmap = (PixmapPtr)pDrawable;<br>
<br>    pKaaPixmap = KaaGetPixmapPriv(pPixmap);<br>    if (pKaaPixmap != NULL)<br>    pKaaPixmap-&gt;dirty = TRUE;<br>}<br><br>static void<br>kaaPixmapSave (ScreenPtr pScreen, KdOffscreenArea *area)<br>{<br>    PixmapPtr pPixmap = area-&gt;privData;<br>
    KaaPixmapPriv(pPixmap);<br>    int dst_pitch, src_pitch, bytes;<br>    unsigned char *dst, *src;<br>    int i; <br>    <br>    DBG_MIGRATE ((&quot;Save 0x%08x (0x%x) (%dx%d)\n&quot;,<br>          pPixmap-&gt;<a href="http://drawable.id">drawable.id</a>,<br>
          KaaGetPixmapPriv(pPixmap)-&gt;area ? <br>          KaaGetPixmapPriv(pPixmap)-&gt;area-&gt;offset : -1,<br>          pPixmap-&gt;drawable.width,<br>          pPixmap-&gt;drawable.height));<br>          <br>    src_pitch = pPixmap-&gt;devKind;<br>
    dst_pitch = pKaaPixmap-&gt;devKind;<br><br>    src = pPixmap-&gt;devPrivate.ptr;<br>    dst = pKaaPixmap-&gt;devPrivate.ptr;<br>    <br>    pPixmap-&gt;devKind = dst_pitch;<br>    pPixmap-&gt;devPrivate.ptr = dst;<br>
    pPixmap-&gt;drawable.serialNumber = NEXT_SERIAL_NUMBER;<br>    pKaaPixmap-&gt;area = NULL;<br><br>#if 0<br>    if (!pKaaPixmap-&gt;dirty)<br>    return;<br>#endif<br><br>    kaaWaitSync (pPixmap-&gt;drawable.pScreen);<br>
<br>    bytes = src_pitch &lt; dst_pitch ? src_pitch : dst_pitch;<br><br>    i = pPixmap-&gt;drawable.height;<br>    while (i--) {<br>    memcpy (dst, src, bytes);<br>    dst += dst_pitch;<br>    src += src_pitch;<br>    }<br>
}<br><br>static int<br>kaaLog2(int val)<br>{<br>    int bits;<br><br>    if (!val)<br>    return 0;<br>    for (bits = 0; val != 0; bits++)<br>    val &gt;&gt;= 1;<br>    return bits - 1;<br>}<br><br>static Bool<br>kaaPixmapAllocArea (PixmapPtr pPixmap)<br>
{<br>    ScreenPtr    pScreen = pPixmap-&gt;drawable.pScreen;<br>    KaaScreenPriv (pScreen);<br>    KaaPixmapPriv (pPixmap);<br>    KdScreenPriv  (pScreen);<br>    int        bpp = pPixmap-&gt;drawable.bitsPerPixel;<br>    CARD16    h = pPixmap-&gt;drawable.height;<br>
    CARD16    w = pPixmap-&gt;drawable.width;<br>    int        pitch;<br><br>    if (pKaaScr-&gt;info-&gt;flags &amp; KAA_OFFSCREEN_ALIGN_POT &amp;&amp; w != 1)<br>    w = 1 &lt;&lt; (kaaLog2(w - 1) + 1);<br>    pitch = (w * bpp / 8 + pKaaScr-&gt;info-&gt;pitchAlign - 1) &amp;<br>
            ~(pKaaScr-&gt;info-&gt;pitchAlign - 1);<br>    <br>    pKaaPixmap-&gt;devKind = pPixmap-&gt;devKind;<br>    pKaaPixmap-&gt;devPrivate = pPixmap-&gt;devPrivate;<br>    pKaaPixmap-&gt;area = KdOffscreenAlloc (pScreen, pitch * h,<br>
                     pKaaScr-&gt;info-&gt;offsetAlign,<br>                     FALSE, <br>                     kaaPixmapSave, (pointer) pPixmap);<br>    if (!pKaaPixmap-&gt;area)<br>    return FALSE;<br>    <br>    DBG_PIXMAP((&quot;++ 0x%08x (0x%x) (%dx%d)\n&quot;,<br>
          pPixmap-&gt;<a href="http://drawable.id">drawable.id</a>,<br>          KaaGetPixmapPriv(pPixmap)-&gt;area ? <br>          KaaGetPixmapPriv(pPixmap)-&gt;area-&gt;offset : -1,<br>          pPixmap-&gt;drawable.width,<br>
          pPixmap-&gt;drawable.height));<br>    pPixmap-&gt;devKind = pitch;<br>    pPixmap-&gt;devPrivate.ptr = (pointer) ((CARD8 *) pScreenPriv-&gt;screen-&gt;memory_base + pKaaPixmap-&gt;area-&gt;offset);<br>    pPixmap-&gt;drawable.serialNumber = NEXT_SERIAL_NUMBER;<br>
    return TRUE;<br>}<br><br>void<br>kaaMoveInPixmap (PixmapPtr pPixmap)<br>{<br>    ScreenPtr    pScreen = pPixmap-&gt;drawable.pScreen;<br>    KaaScreenPriv (pScreen);<br>    KaaPixmapPriv (pPixmap);<br>    int dst_pitch, src_pitch, bytes;<br>
    unsigned char *dst, *src;<br>    int i;<br><br>    DBG_MIGRATE ((&quot;-&gt; 0x%08x (0x%x) (%dx%d)\n&quot;,<br>          pPixmap-&gt;<a href="http://drawable.id">drawable.id</a>,<br>          KaaGetPixmapPriv(pPixmap)-&gt;area ? <br>
          KaaGetPixmapPriv(pPixmap)-&gt;area-&gt;offset : -1,<br>          pPixmap-&gt;drawable.width,<br>          pPixmap-&gt;drawable.height));<br><br>    src = pPixmap-&gt;devPrivate.ptr;<br>    src_pitch = pPixmap-&gt;devKind;<br>
    <br>    if (!kaaPixmapAllocArea (pPixmap))<br>    return;<br><br>    pKaaPixmap-&gt;dirty = FALSE;<br><br>    if (pKaaScr-&gt;info-&gt;UploadToScreen)<br>    {<br>    if (pKaaScr-&gt;info-&gt;UploadToScreen(pPixmap, src, src_pitch))<br>
        return;<br>    }<br><br>    dst = pPixmap-&gt;devPrivate.ptr;<br>    dst_pitch = pPixmap-&gt;devKind;<br>    <br>    bytes = src_pitch &lt; dst_pitch ? src_pitch : dst_pitch;<br><br>    kaaWaitSync (pPixmap-&gt;drawable.pScreen);<br>
<br>    i = pPixmap-&gt;drawable.height;<br>    while (i--) {<br>    memcpy (dst, src, bytes);<br>    dst += dst_pitch;<br>    src += src_pitch;<br>    }<br>}<br><br>static void<br>kaaMoveOutPixmap (PixmapPtr pPixmap)<br>
{<br>    KaaPixmapPriv (pPixmap);<br>    KdOffscreenArea *area = pKaaPixmap-&gt;area;<br><br>    DBG_MIGRATE ((&quot;&lt;- 0x%08x (0x%x) (%dx%d)\n&quot;,<br>          pPixmap-&gt;<a href="http://drawable.id">drawable.id</a>,<br>
          KaaGetPixmapPriv(pPixmap)-&gt;area ? <br>          KaaGetPixmapPriv(pPixmap)-&gt;area-&gt;offset : -1,<br>          pPixmap-&gt;drawable.width,<br>          pPixmap-&gt;drawable.height));<br>    if (area)<br>    {<br>
    kaaPixmapSave (pPixmap-&gt;drawable.pScreen, area);<br>    KdOffscreenFree (pPixmap-&gt;drawable.pScreen, area);<br>    }<br>}<br><br>void<br>kaaPixmapUseScreen (PixmapPtr pPixmap)<br>{<br>    KaaPixmapPriv (pPixmap);<br>
<br>    if (pKaaPixmap == NULL)<br>           return;<br><br>    if (pKaaPixmap-&gt;score == KAA_PIXMAP_SCORE_PINNED)<br>    return;<br><br>    if (pKaaPixmap-&gt;score == KAA_PIXMAP_SCORE_INIT) {<br>    kaaMoveInPixmap(pPixmap);<br>
    pKaaPixmap-&gt;score = 0;<br>    }<br><br>    if (pKaaPixmap-&gt;score &lt; KAA_PIXMAP_SCORE_MAX)<br>    {<br>    pKaaPixmap-&gt;score++;<br>    if (!kaaPixmapIsOffscreen(pPixmap) &amp;&amp;<br>        pKaaPixmap-&gt;score &gt;= KAA_PIXMAP_SCORE_MOVE_IN)<br>
        kaaMoveInPixmap (pPixmap);<br>    }<br>    KdOffscreenMarkUsed (pPixmap);<br>}<br><br>void<br>kaaPixmapUseMemory (PixmapPtr pPixmap)<br>{<br>    KaaPixmapPriv (pPixmap);<br><br>    if (pKaaPixmap == NULL)<br>           return;<br>
<br>    if (pKaaPixmap-&gt;score == KAA_PIXMAP_SCORE_PINNED)<br>    return;<br><br>    if (pKaaPixmap-&gt;score == KAA_PIXMAP_SCORE_INIT)<br>    pKaaPixmap-&gt;score = 0;<br><br>    if (pKaaPixmap-&gt;score &gt; KAA_PIXMAP_SCORE_MIN)<br>
    {<br>    pKaaPixmap-&gt;score--;<br>    if (pKaaPixmap-&gt;area &amp;&amp;<br>        pKaaPixmap-&gt;score &lt;= KAA_PIXMAP_SCORE_MOVE_OUT)<br>        kaaMoveOutPixmap (pPixmap);<br>    }<br>}<br><br>static Bool<br>kaaDestroyPixmap (PixmapPtr pPixmap)<br>
{<br>    if (pPixmap-&gt;refcnt == 1)<br>    {<br>    KaaPixmapPriv (pPixmap);<br>    if (pKaaPixmap-&gt;area)<br>    {<br>        DBG_PIXMAP((&quot;-- 0x%08x (0x%x) (%dx%d)\n&quot;,<br>             pPixmap-&gt;<a href="http://drawable.id">drawable.id</a>,<br>
             KaaGetPixmapPriv(pPixmap)-&gt;area-&gt;offset,<br>             pPixmap-&gt;drawable.width,<br>             pPixmap-&gt;drawable.height));<br>        /* Free the offscreen area */<br>        KdOffscreenFree (pPixmap-&gt;drawable.pScreen, pKaaPixmap-&gt;area);<br>
        pPixmap-&gt;devPrivate = pKaaPixmap-&gt;devPrivate;<br>        pPixmap-&gt;devKind = pKaaPixmap-&gt;devKind;<br>    }<br>    }<br>    return fbDestroyPixmap (pPixmap);<br>}<br><br>static PixmapPtr <br>kaaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth)<br>
{<br>    PixmapPtr        pPixmap;<br>    KaaPixmapPrivPtr    pKaaPixmap;<br>    int            bpp;<br>    <br>    bpp = BitsPerPixel (depth);<br>    if (bpp == 32 &amp;&amp; depth == 24)<br>    {<br>    int fb;<br>    KdScreenPriv (pScreen);<br>
    <br>    for (fb = 0; fb &lt; KD_MAX_FB &amp;&amp; pScreenPriv-&gt;screen-&gt;fb[fb].depth; fb++)<br>        if (pScreenPriv-&gt;screen-&gt;fb[fb].depth == 24)<br>        {<br>        bpp = pScreenPriv-&gt;screen-&gt;fb[fb].bitsPerPixel;<br>
        break;<br>        }<br>    }<br><br>    pPixmap = fbCreatePixmapBpp (pScreen, w, h, depth, bpp);<br>    if (!pPixmap)<br>    return NULL;<br>    pKaaPixmap = KaaGetPixmapPriv(pPixmap);<br>    if (!w || !h)<br>    pKaaPixmap-&gt;score = KAA_PIXMAP_SCORE_PINNED;<br>
    else<br>    pKaaPixmap-&gt;score = KAA_PIXMAP_SCORE_INIT;<br>    <br>    pKaaPixmap-&gt;area = NULL;<br>    pKaaPixmap-&gt;dirty = FALSE;<br><br>    return pPixmap;<br>}<br><br>Bool<br>kaaPixmapIsOffscreen(PixmapPtr p)<br>
{<br>    ScreenPtr    pScreen = p-&gt;drawable.pScreen;<br>    KdScreenPriv(pScreen);<br><br>    return ((unsigned long) ((CARD8 *) p-&gt;devPrivate.ptr - <br>                 (CARD8 *) pScreenPriv-&gt;screen-&gt;memory_base) &lt;<br>
        pScreenPriv-&gt;screen-&gt;memory_size);<br>}<br><br>PixmapPtr<br>kaaGetOffscreenPixmap (DrawablePtr pDrawable, int *xp, int *yp)<br>{<br>    PixmapPtr    pPixmap;<br>    int        x, y;<br>    <br>    if (pDrawable-&gt;type == DRAWABLE_WINDOW) {<br>
    pPixmap = (*pDrawable-&gt;pScreen-&gt;GetWindowPixmap) ((WindowPtr) pDrawable);<br>#ifdef COMPOSITE<br>    x = -pPixmap-&gt;screen_x;<br>    y = -pPixmap-&gt;screen_y;<br>#else<br>    x = 0;<br>    y = 0;<br>#endif<br>
    }<br>    else<br>    {<br>    pPixmap = (PixmapPtr) pDrawable;<br>    x = 0;<br>    y = 0;<br>    }<br>    *xp = x;<br>    *yp = y;<br>    if (kaaPixmapIsOffscreen (pPixmap))<br>    return pPixmap;<br>    else<br>    return NULL;<br>
}<br><br>Bool<br>kaaDrawableIsOffscreen (DrawablePtr pDrawable)<br>{<br>    PixmapPtr    pPixmap;<br>    if (pDrawable-&gt;type == DRAWABLE_WINDOW)<br>    pPixmap = (*pDrawable-&gt;pScreen-&gt;GetWindowPixmap) ((WindowPtr) pDrawable);<br>
    else<br>    pPixmap = (PixmapPtr) pDrawable;<br>    return kaaPixmapIsOffscreen (pPixmap);<br>}<br><br>#if 0<br>static void<br>kaaFillTiled(int    dst_x,<br>         int    dst_y,<br>         int    width,<br>         int    height,<br>
         int    src_x,<br>         int    src_y,<br>         int    src_width,<br>         int    src_height,<br>         void    (*Copy) (int    srcX,<br>                 int    srcY,<br>                 int    dstX,<br>
                 int    dstY,<br>                 int    width,<br>                 int    height))<br>{<br>    modulus (src_x, src_width, src_x);<br>    modulus (src_y, src_height, src_y);<br>    <br>    while (height)<br>
    {<br>    int dst_x_tmp = dst_x;<br>    int src_x_tmp = src_x;<br>    int width_tmp = width;<br>    int height_left = src_height - src_y;<br>    int height_this = min (height, height_left);<br>    <br>    while (width_tmp)<br>
    {<br>        int width_left = src_width - src_x_tmp;<br>        int width_this = min (width_tmp, width_left);<br><br>        (*Copy) (src_x_tmp, src_y,<br>             dst_x_tmp, dst_y,<br>             width_this, height_this);<br>
<br>        width_tmp -= width_this;<br>        dst_x_tmp += width_this;<br>    }<br>    height -= height_this;<br>    dst_y += height_this;<br>    src_y = 0;<br>    }<br>}<br>#endif<br><br>static void<br>kaaFillSpans(DrawablePtr pDrawable, GCPtr pGC, int n, <br>
         DDXPointPtr ppt, int *pwidth, int fSorted)<br>{<br>    ScreenPtr        pScreen = pDrawable-&gt;pScreen;<br>    KdScreenPriv (pScreen);<br>    KaaScreenPriv (pScreen);<br>    RegionPtr        pClip = fbGetCompositeClip(pGC);<br>
    PixmapPtr        pPixmap;    <br>    BoxPtr        pextent, pbox;<br>    int            nbox;<br>    int            extentX1, extentX2, extentY1, extentY2;<br>    int            fullX1, fullX2, fullY1;<br>    int            partX1, partX2;<br>
    int            off_x, off_y;<br><br>    if (!pScreenPriv-&gt;enabled ||<br>    pGC-&gt;fillStyle != FillSolid ||<br>    !(pPixmap = kaaGetOffscreenPixmap (pDrawable, &amp;off_x, &amp;off_y)) ||<br>    !(*pKaaScr-&gt;info-&gt;PrepareSolid) (pPixmap,<br>
                     pGC-&gt;alu,<br>                     pGC-&gt;planemask,<br>                     pGC-&gt;fgPixel))<br>    {<br>    KdCheckFillSpans (pDrawable, pGC, n, ppt, pwidth, fSorted);<br>    return;<br>    }<br>
    <br>    pextent = REGION_EXTENTS(pGC-&gt;pScreen, pClip);<br>    extentX1 = pextent-&gt;x1;<br>    extentY1 = pextent-&gt;y1;<br>    extentX2 = pextent-&gt;x2;<br>    extentY2 = pextent-&gt;y2;<br>    while (n--)<br>    {<br>
    fullX1 = ppt-&gt;x;<br>    fullY1 = ppt-&gt;y;<br>    fullX2 = fullX1 + (int) *pwidth;<br>    ppt++;<br>    pwidth++;<br>    <br>    if (fullY1 &lt; extentY1 || extentY2 &lt;= fullY1)<br>        continue;<br>    <br>    if (fullX1 &lt; extentX1)<br>
        fullX1 = extentX1;<br><br>    if (fullX2 &gt; extentX2)<br>        fullX2 = extentX2;<br>    <br>    if (fullX1 &gt;= fullX2)<br>        continue;<br>    <br>    nbox = REGION_NUM_RECTS (pClip);<br>    if (nbox == 1)<br>
    {<br>        (*pKaaScr-&gt;info-&gt;Solid) (fullX1 + off_x, fullY1 + off_y,<br>                     fullX2 + off_x, fullY1 + 1 + off_y);<br>    }<br>    else<br>    {<br>        pbox = REGION_RECTS(pClip);<br>        while(nbox--)<br>
        {<br>        if (pbox-&gt;y1 &lt;= fullY1 &amp;&amp; fullY1 &lt; pbox-&gt;y2)<br>        {<br>            partX1 = pbox-&gt;x1;<br>            if (partX1 &lt; fullX1)<br>            partX1 = fullX1;<br>            partX2 = pbox-&gt;x2;<br>
            if (partX2 &gt; fullX2)<br>            partX2 = fullX2;<br>            if (partX2 &gt; partX1)<br>            (*pKaaScr-&gt;info-&gt;Solid) (partX1 + off_x, fullY1 + off_y,<br>                         partX2 + off_x, fullY1 + 1 + off_y);<br>
        }<br>        pbox++;<br>        }<br>    }<br>    }<br>    (*pKaaScr-&gt;info-&gt;DoneSolid) ();<br>    kaaDrawableDirty (pDrawable);<br>    kaaMarkSync (pDrawable-&gt;pScreen);<br>}<br><br>void<br>kaaCopyNtoN (DrawablePtr    pSrcDrawable,<br>
         DrawablePtr    pDstDrawable,<br>         GCPtr        pGC,<br>         BoxPtr        pbox,<br>         int        nbox,<br>         int        dx,<br>         int        dy,<br>         Bool        reverse,<br>         Bool        upsidedown,<br>
         Pixel        bitplane,<br>         void        *closure)<br>{<br>    KdScreenPriv (pDstDrawable-&gt;pScreen);<br>    KaaScreenPriv (pDstDrawable-&gt;pScreen);<br>    PixmapPtr pSrcPixmap, pDstPixmap;<br>    int        src_off_x, src_off_y;<br>
    int        dst_off_x, dst_off_y;<br><br>    /* Migrate pixmaps to same place as destination */<br>    if (pScreenPriv-&gt;enabled &amp;&amp; pSrcDrawable-&gt;type == DRAWABLE_PIXMAP) {<br>    if (kaaDrawableIsOffscreen (pDstDrawable))<br>
        kaaPixmapUseScreen ((PixmapPtr) pSrcDrawable);<br>    else<br>        kaaPixmapUseMemory ((PixmapPtr) pSrcDrawable);<br>    }<br><br>    if (pScreenPriv-&gt;enabled &amp;&amp;<br>    (pSrcPixmap = kaaGetOffscreenPixmap (pSrcDrawable, &amp;src_off_x, &amp;src_off_y)) &amp;&amp;<br>
    (pDstPixmap = kaaGetOffscreenPixmap (pDstDrawable, &amp;dst_off_x, &amp;dst_off_y)) &amp;&amp; <br>    (*pKaaScr-&gt;info-&gt;PrepareCopy) (pSrcPixmap,<br>                       pDstPixmap,<br>                       dx,<br>
                       dy,<br>                       pGC ? pGC-&gt;alu : GXcopy,<br>                       pGC ? pGC-&gt;planemask : FB_ALLONES))<br>    {<br>    while (nbox--)<br>    {<br>        (*pKaaScr-&gt;info-&gt;Copy) (pbox-&gt;x1 + dx + src_off_x,<br>
                    pbox-&gt;y1 + dy + src_off_y,<br>                    pbox-&gt;x1 + dst_off_x, pbox-&gt;y1 + dst_off_y,<br>                    pbox-&gt;x2 - pbox-&gt;x1,<br>                    pbox-&gt;y2 - pbox-&gt;y1);<br>
        pbox++;<br>    }<br>    (*pKaaScr-&gt;info-&gt;DoneCopy) ();<br>    kaaMarkSync (pDstDrawable-&gt;pScreen);<br>    }<br>    else<br>    {<br>    kaaWaitSync (pDstDrawable-&gt;pScreen);<br>    fbCopyNtoN (pSrcDrawable, pDstDrawable, pGC, <br>
            pbox, nbox, dx, dy, reverse, upsidedown, <br>            bitplane, closure);<br>    }<br>    kaaDrawableDirty (pDstDrawable);<br>}<br><br>static RegionPtr<br>kaaCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC,<br>
        int srcx, int srcy, int width, int height, int dstx, int dsty)<br>{<br>    return fbDoCopy (pSrcDrawable, pDstDrawable, pGC, <br>             srcx, srcy, width, height, <br>             dstx, dsty, kaaCopyNtoN, 0, 0);<br>
}<br><br>static void<br>kaaPolyFillRect(DrawablePtr pDrawable, <br>        GCPtr        pGC, <br>        int        nrect,<br>        xRectangle  *prect)<br>{<br>    KdScreenPriv (pDrawable-&gt;pScreen);<br>    KaaScreenPriv (pDrawable-&gt;pScreen);<br>
    RegionPtr        pClip = fbGetCompositeClip(pGC);<br>    PixmapPtr        pPixmap;<br>    register BoxPtr pbox;<br>    BoxPtr        pextent;<br>    int            extentX1, extentX2, extentY1, extentY2;<br>    int            fullX1, fullX2, fullY1, fullY2;<br>
    int            partX1, partX2, partY1, partY2;<br>    int            xoff, yoff;<br>    int            xorg, yorg;<br>    int            n;<br>    <br>    if (!pScreenPriv-&gt;enabled ||<br>    pGC-&gt;fillStyle != FillSolid ||<br>
    !(pPixmap = kaaGetOffscreenPixmap (pDrawable, &amp;xoff, &amp;yoff)) || <br>    !(*pKaaScr-&gt;info-&gt;PrepareSolid) (pPixmap,<br>                     pGC-&gt;alu,<br>                     pGC-&gt;planemask,<br>                     pGC-&gt;fgPixel))<br>
    {<br>    KdCheckPolyFillRect (pDrawable, pGC, nrect, prect);<br>    return;<br>    }<br>    <br>    xorg = pDrawable-&gt;x;<br>    yorg = pDrawable-&gt;y;<br>    <br>    pextent = REGION_EXTENTS(pGC-&gt;pScreen, pClip);<br>
    extentX1 = pextent-&gt;x1;<br>    extentY1 = pextent-&gt;y1;<br>    extentX2 = pextent-&gt;x2;<br>    extentY2 = pextent-&gt;y2;<br>    while (nrect--)<br>    {<br>    fullX1 = prect-&gt;x + xorg;<br>    fullY1 = prect-&gt;y + yorg;<br>
    fullX2 = fullX1 + (int) prect-&gt;width;<br>    fullY2 = fullY1 + (int) prect-&gt;height;<br>    prect++;<br>    <br>    if (fullX1 &lt; extentX1)<br>        fullX1 = extentX1;<br><br>    if (fullY1 &lt; extentY1)<br>
        fullY1 = extentY1;<br><br>    if (fullX2 &gt; extentX2)<br>        fullX2 = extentX2;<br>    <br>    if (fullY2 &gt; extentY2)<br>        fullY2 = extentY2;<br><br>    if ((fullX1 &gt;= fullX2) || (fullY1 &gt;= fullY2))<br>
        continue;<br>    n = REGION_NUM_RECTS (pClip);<br>    if (n == 1)<br>    {<br>        (*pKaaScr-&gt;info-&gt;Solid) (fullX1 + xoff, fullY1 + yoff,<br>                     fullX2 + xoff, fullY2 + yoff);<br>    }<br>
    else<br>    {<br>        pbox = REGION_RECTS(pClip);<br>        /* <br>         * clip the rectangle to each box in the clip region<br>         * this is logically equivalent to calling Intersect()<br>         */<br>        while(n--)<br>
        {<br>        partX1 = pbox-&gt;x1;<br>        if (partX1 &lt; fullX1)<br>            partX1 = fullX1;<br>        partY1 = pbox-&gt;y1;<br>        if (partY1 &lt; fullY1)<br>            partY1 = fullY1;<br>        partX2 = pbox-&gt;x2;<br>
        if (partX2 &gt; fullX2)<br>            partX2 = fullX2;<br>        partY2 = pbox-&gt;y2;<br>        if (partY2 &gt; fullY2)<br>            partY2 = fullY2;<br>    <br>        pbox++;<br>        <br>        if (partX1 &lt; partX2 &amp;&amp; partY1 &lt; partY2)<br>
            (*pKaaScr-&gt;info-&gt;Solid) (partX1 + xoff, partY1 + yoff,<br>                         partX2 + xoff, partY2 + yoff);<br>        }<br>    }<br>    }<br>    (*pKaaScr-&gt;info-&gt;DoneSolid) ();<br>    kaaDrawableDirty (pDrawable);<br>
    kaaMarkSync (pDrawable-&gt;pScreen);<br>}<br>    <br>static void<br>kaaSolidBoxClipped (DrawablePtr    pDrawable,<br>            RegionPtr    pClip,<br>            FbBits    pm,<br>            FbBits    fg,<br>            int        x1,<br>
            int        y1,<br>            int        x2,<br>            int        y2)<br>{<br>    KdScreenPriv (pDrawable-&gt;pScreen);<br>    KaaScreenPriv (pDrawable-&gt;pScreen);<br>    PixmapPtr   pPixmap;        <br>
    BoxPtr    pbox;<br>    int        nbox;<br>    int        xoff, yoff;<br>    int        partX1, partX2, partY1, partY2;<br><br>    if (!pScreenPriv-&gt;enabled ||<br>    !(pPixmap = kaaGetOffscreenPixmap (pDrawable, &amp;xoff, &amp;yoff)) ||<br>
    !(*pKaaScr-&gt;info-&gt;PrepareSolid) (pPixmap, GXcopy, pm, fg))<br>    {<br>    kaaWaitSync (pDrawable-&gt;pScreen);<br>    fg = fbReplicatePixel (fg, pDrawable-&gt;bitsPerPixel);<br>    fbSolidBoxClipped (pDrawable, pClip, x1, y1, x2, y2,<br>
               fbAnd (GXcopy, fg, pm),<br>               fbXor (GXcopy, fg, pm));<br>    kaaDrawableDirty (pDrawable);<br>    return;<br>    }<br>    for (nbox = REGION_NUM_RECTS(pClip), pbox = REGION_RECTS(pClip); <br>     nbox--; <br>
     pbox++)<br>    {<br>    partX1 = pbox-&gt;x1;<br>    if (partX1 &lt; x1)<br>        partX1 = x1;<br>    <br>    partX2 = pbox-&gt;x2;<br>    if (partX2 &gt; x2)<br>        partX2 = x2;<br>    <br>    if (partX2 &lt;= partX1)<br>
        continue;<br>    <br>    partY1 = pbox-&gt;y1;<br>    if (partY1 &lt; y1)<br>        partY1 = y1;<br>    <br>    partY2 = pbox-&gt;y2;<br>    if (partY2 &gt; y2)<br>        partY2 = y2;<br>    <br>    if (partY2 &lt;= partY1)<br>
        continue;<br>    <br>    (*pKaaScr-&gt;info-&gt;Solid) (partX1 + xoff, partY1 + yoff,<br>                 partX2 + xoff, partY2 + yoff);<br>    }<br>    (*pKaaScr-&gt;info-&gt;DoneSolid) ();<br>    kaaDrawableDirty (pDrawable);<br>
    kaaMarkSync (pDrawable-&gt;pScreen);<br>}<br><br>static void<br>kaaImageGlyphBlt (DrawablePtr    pDrawable,<br>          GCPtr        pGC,<br>          int        x, <br>          int        y,<br>          unsigned int    nglyph,<br>
          CharInfoPtr    *ppciInit,<br>          pointer    pglyphBase)<br>{<br>    FbGCPrivPtr        pPriv = fbGetGCPrivate(pGC);<br>    CharInfoPtr        *ppci;<br>    CharInfoPtr        pci;<br>    unsigned char   *pglyph;        /* pointer bits in glyph */<br>
    int            gWidth, gHeight;    /* width and height of glyph */<br>    FbStride        gStride;        /* stride of glyph */<br>    Bool        opaque;<br>    int            n;<br>    int            gx, gy;<br>    void        (*glyph) (FbBits *,<br>
                  FbStride,<br>                  int,<br>                  FbStip *,<br>                  FbBits,<br>                  int,<br>                  int);<br>    FbBits        *dst;<br>    FbStride        dstStride;<br>
    int            dstBpp;<br>    int            dstXoff, dstYoff;<br>    FbBits        depthMask;<br>    <br>    depthMask = FbFullMask(pDrawable-&gt;depth);<br>    if ((pGC-&gt;planemask &amp; depthMask) != depthMask)<br>
    {<br>    KdCheckImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppciInit, pglyphBase);<br>    return;<br>    }<br>    glyph = 0;<br>    fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);<br>    switch (dstBpp) {<br>
    case 8:    glyph = fbGlyph8; break;<br>    case 16:    glyph = fbGlyph16; break;<br>    case 24:    glyph = fbGlyph24; break;<br>    case 32:    glyph = fbGlyph32; break;<br>    }<br>    <br>    x += pDrawable-&gt;x;<br>
    y += pDrawable-&gt;y;<br><br>    if (TERMINALFONT (pGC-&gt;font) &amp;&amp; !glyph)<br>    {<br>    opaque = TRUE;<br>    }<br>    else<br>    {<br>    int        xBack, widthBack;<br>    int        yBack, heightBack;<br>
    <br>    ppci = ppciInit;<br>    n = nglyph;<br>    widthBack = 0;<br>    while (n--)<br>        widthBack += (*ppci++)-&gt;metrics.characterWidth;<br>    <br>        xBack = x;<br>    if (widthBack &lt; 0)<br>    {<br>
        xBack += widthBack;<br>        widthBack = -widthBack;<br>    }<br>    yBack = y - FONTASCENT(pGC-&gt;font);<br>    heightBack = FONTASCENT(pGC-&gt;font) + FONTDESCENT(pGC-&gt;font);<br>        kaaSolidBoxClipped (pDrawable,<br>
                fbGetCompositeClip(pGC),<br>                pGC-&gt;planemask,<br>                pGC-&gt;bgPixel,<br>                xBack,<br>                yBack,<br>                xBack + widthBack,<br>                yBack + heightBack);<br>
    opaque = FALSE;<br>    }<br><br>    kaaWaitSync (pDrawable-&gt;pScreen);<br>    kaaDrawableDirty (pDrawable);<br>    <br>    ppci = ppciInit;<br>    while (nglyph--)<br>    {<br>    pci = *ppci++;<br>    pglyph = FONTGLYPHBITS(pglyphBase, pci);<br>
    gWidth = GLYPHWIDTHPIXELS(pci);<br>    gHeight = GLYPHHEIGHTPIXELS(pci);<br>    if (gWidth &amp;&amp; gHeight)<br>    {<br>        gx = x + pci-&gt;metrics.leftSideBearing;<br>        gy = y - pci-&gt;metrics.ascent; <br>
        if (glyph &amp;&amp; gWidth &lt;= sizeof (FbStip) * 8 &amp;&amp;<br>        fbGlyphIn (fbGetCompositeClip(pGC), gx, gy, gWidth, gHeight))<br>        {<br>        (*glyph) (dst + (gy + dstYoff) * dstStride,<br>              dstStride,<br>
              dstBpp,<br>              (FbStip *) pglyph,<br>              pPriv-&gt;fg,<br>              gx + dstXoff,<br>              gHeight);<br>        }<br>        else<br>        {<br>        gStride = GLYPHWIDTHBYTESPADDED(pci) / sizeof (FbStip);<br>
        fbPutXYImage (pDrawable,<br>                  fbGetCompositeClip(pGC),<br>                  pPriv-&gt;fg,<br>                  pPriv-&gt;bg,<br>                  pPriv-&gt;pm,<br>                  GXcopy,<br>                  opaque,<br>
    <br>                  gx,<br>                  gy,<br>                  gWidth, gHeight,<br>    <br>                  (FbStip *) pglyph,<br>                  gStride,<br>                  0);<br>        }<br>    }<br>
    x += pci-&gt;metrics.characterWidth;<br>    }<br>}<br><br>static const GCOps    kaaOps = {<br>    kaaFillSpans,<br>    KdCheckSetSpans,<br>    KdCheckPutImage,<br>    kaaCopyArea,<br>    KdCheckCopyPlane,<br>    KdCheckPolyPoint,<br>
    KdCheckPolylines,<br>    KdCheckPolySegment,<br>    miPolyRectangle,<br>    KdCheckPolyArc,<br>    miFillPolygon,<br>    kaaPolyFillRect,<br>    miPolyFillArc,<br>    miPolyText8,<br>    miPolyText16,<br>    miImageText8,<br>
    miImageText16,<br>    kaaImageGlyphBlt,<br>    KdCheckPolyGlyphBlt,<br>    KdCheckPushPixels,<br>#ifdef NEED_LINEHELPER<br>    ,NULL<br>#endif<br>};<br><br>static void<br>kaaValidateGC (GCPtr pGC, Mask changes, DrawablePtr pDrawable)<br>
{<br>    fbValidateGC (pGC, changes, pDrawable);<br><br>    if (kaaDrawableIsOffscreen (pDrawable))<br>    pGC-&gt;ops = (GCOps *) &amp;kaaOps;<br>    else<br>    pGC-&gt;ops = (GCOps *) &amp;kdAsyncPixmapGCOps;<br>}<br><br>
GCFuncs    kaaGCFuncs = {<br>    kaaValidateGC,<br>    miChangeGC,<br>    miCopyGC,<br>    miDestroyGC,<br>    miChangeClip,<br>    miDestroyClip,<br>    miCopyClip<br>};<br><br>static int<br>kaaCreateGC (GCPtr pGC)<br>{<br>
    if (!fbCreateGC (pGC))<br>    return FALSE;<br><br>    pGC-&gt;funcs = &amp;kaaGCFuncs;<br><br>    return TRUE;<br>}<br><br><br>static void<br>kaaCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)<br>
{<br>    RegionRec    rgnDst;<br>    int        dx, dy;<br>    PixmapPtr    pPixmap = (*pWin-&gt;drawable.pScreen-&gt;GetWindowPixmap) (pWin);<br><br>    dx = ptOldOrg.x - pWin-&gt;drawable.x;<br>    dy = ptOldOrg.y - pWin-&gt;drawable.y;<br>
    REGION_TRANSLATE(pWin-&gt;drawable.pScreen, prgnSrc, -dx, -dy);<br><br>    REGION_INIT (pWin-&gt;drawable.pScreen, &amp;rgnDst, NullBox, 0);<br>    <br>    REGION_INTERSECT(pWin-&gt;drawable.pScreen, &amp;rgnDst, &amp;pWin-&gt;borderClip, prgnSrc);<br>
#ifdef COMPOSITE<br>    if (pPixmap-&gt;screen_x || pPixmap-&gt;screen_y)<br>    REGION_TRANSLATE (pWin-&gt;drawable.pScreen, &amp;rgnDst, <br>              -pPixmap-&gt;screen_x, -pPixmap-&gt;screen_y);<br>#endif<br><br>
    fbCopyRegion (&amp;pPixmap-&gt;drawable, &amp;pPixmap-&gt;drawable,<br>          0,<br>          &amp;rgnDst, dx, dy, kaaCopyNtoN, 0, 0);<br>    <br>    REGION_UNINIT(pWin-&gt;drawable.pScreen, &amp;rgnDst);<br>}<br><br>
static void<br>kaaFillRegionSolid (DrawablePtr    pDrawable,<br>            RegionPtr    pRegion,<br>            Pixel    pixel)<br>{<br>    KdScreenPriv(pDrawable-&gt;pScreen);<br>    KaaScreenPriv(pDrawable-&gt;pScreen);<br>
    PixmapPtr pPixmap;<br>    int xoff, yoff;<br><br>    if (pScreenPriv-&gt;enabled &amp;&amp;<br>    (pPixmap = kaaGetOffscreenPixmap (pDrawable, &amp;xoff, &amp;yoff)) &amp;&amp;<br>    (*pKaaScr-&gt;info-&gt;PrepareSolid) (pPixmap, GXcopy, FB_ALLONES, pixel))<br>
    {<br>    int    nbox = REGION_NUM_RECTS (pRegion);<br>    BoxPtr    pBox = REGION_RECTS (pRegion);<br>    <br>    while (nbox--)<br>    {<br>        (*pKaaScr-&gt;info-&gt;Solid) (pBox-&gt;x1 + xoff, pBox-&gt;y1 + yoff,<br>
                     pBox-&gt;x2 + xoff, pBox-&gt;y2 + yoff);<br>        pBox++;<br>    }<br>    (*pKaaScr-&gt;info-&gt;DoneSolid) ();<br>    kaaMarkSync (pDrawable-&gt;pScreen);<br>    }<br>    else<br>    {<br>    kaaWaitSync (pDrawable-&gt;pScreen);<br>
    fbFillRegionSolid (pDrawable, pRegion, 0,<br>               fbReplicatePixel (pixel, pDrawable-&gt;bitsPerPixel));<br>    }<br>    kaaDrawableDirty (pDrawable);<br>}<br><br>#if 0<br>static void<br>kaaFillRegionTiled (DrawablePtr pDrawable,<br>
            RegionPtr    pRegion,<br>            PixmapPtr    pTile)<br>{<br>    KdScreenPriv(pDrawable-&gt;pScreen);<br>    KaaScreenPriv(pDrawable-&gt;pScreen);<br>    PixmapPtr pPixmap;<br>    int xoff, yoff;<br>    int tileWidth, tileHeight;<br>
    int nbox = REGION_NUM_RECTS (pRegion);<br>    BoxPtr pBox = REGION_RECTS (pRegion);<br>    Bool ret = FALSE;<br><br>    tileWidth = pTile-&gt;drawable.width;<br>    tileHeight = pTile-&gt;drawable.height;<br><br>    /* If we&#39;re filling with a solid color, grab it out and go to<br>
     * FillRegionSolid, saving numerous copies.<br>     */<br>    if (tileWidth == 1 &amp;&amp; tileHeight == 1)<br>    return kaaFillRegionSolid(pDrawable, pRegion,<br>                  exaGetPixmapFirstPixel (pTile), planemask,<br>
                 alu);<br>    <br>     REGION_TRANSLATE(pScreen, pRegion, xoff, yoff);<br>     <br>    <br>  if (pScreenPriv-&gt;enabled &amp;&amp;<br>    (pPixmap = kaaGetOffscreenPixmap (pDrawable, &amp;xoff, &amp;yoff)) &amp;&amp;<br>
    (*pKaaScr-&gt;info-&gt;PrepareCopy) (pTile, pPixmap, 1, 1,     GXcopy,    FB_ALLONES))<br>    {<br><br>    if ((*pKaaScr-&gt;info-&gt;PrepareCopy) (pTile, pPixmap, 1, 1, alu, planemask))<br>    {<br>    while (nbox--)<br>
    {<br>        int height = pBox-&gt;y2 - pBox-&gt;y1;<br>        int dstY = pBox-&gt;y1;<br>        int tileY;<br><br>           modulus(dstY - yoff - pDrawable-&gt;y - (WindowPtr)pDrawable-&gt;origin.y, tileHeight, tileY);<br>
<br>        while (height &gt; 0) {<br>        int width = pBox-&gt;x2 - pBox-&gt;x1;<br>        int dstX = pBox-&gt;x1;<br>        int tileX;<br>        int h = tileHeight - tileY;<br><br>        if (h &gt; height)<br>            h = height;<br>
        height -= h;<br><br>        modulus(dstX - xoff - pDrawable-&gt;x - pPatOrg-&gt;x, tileWidth,<br>            tileX);<br><br>        while (width &gt; 0) {<br>            int w = tileWidth - tileX;<br>            if (w &gt; width)<br>
            w = width;<br>            width -= w;<br><br>            (*pKaaScr-&gt;info-&gt;Copy) (pPixmap, tileX, tileY, dstX, dstY,<br>                        w, h);<br>            dstX += w;<br>            tileX = 0;<br>
        }<br>        dstY += h;<br>        tileY = 0;<br>        }<br>        pBox++;<br>    }<br>    (*pKaaScr-&gt;info-&gt;DoneCopy) (pPixmap);<br>    kaaMarkSync(pDrawable-&gt;pScreen);<br><br>    ret = TRUE;<br>    }<br>
<br>    return ret;<br>}<br>#endif<br><br>static void<br>kaaPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what)<br>{<br><br>    if (!REGION_NUM_RECTS(pRegion)) <br>    return;<br>    switch (what) {<br>    case PW_BACKGROUND:<br>
    switch (pWin-&gt;backgroundState) {<br>    case None:<br>        return;<br>    case ParentRelative:<br>        do {<br>        pWin = pWin-&gt;parent;<br>        } while (pWin-&gt;backgroundState == ParentRelative);<br>
        (*pWin-&gt;drawable.pScreen-&gt;PaintWindowBackground)(pWin, pRegion,<br>                                 what);<br>        return;<br>    case BackgroundPixel:<br>        kaaFillRegionSolid((DrawablePtr)pWin, pRegion, pWin-&gt;background.pixel);<br>
        return;<br>#if 0        <br>    case BackgroundPixmap:<br>        kaaFillRegionTiled((DrawablePtr)pWin, pRegion, pWin-&gt;background.pixmap);<br>        return;<br>#endif<br>        }<br>        break;<br>    case PW_BORDER:<br>
    if (pWin-&gt;borderIsPixel)<br>    {<br>        kaaFillRegionSolid((DrawablePtr)pWin, pRegion, pWin-&gt;border.pixel);<br>        return;<br>    }<br>#if 0<br>    else<br>    {<br>        kaaFillRegionTiled((DrawablePtr)pWin, pRegion, pWin-&gt;border.pixmap);<br>
        return;<br>    }<br>#endif<br>    break;<br>    }<br>    KdCheckPaintWindow (pWin, pRegion, what);<br>}<br><br>Bool<br>kaaDrawInit (ScreenPtr        pScreen,<br>         KaaScreenInfoPtr    pScreenInfo)<br>{<br>    KaaScreenPrivPtr pKaaScr;<br>
    KdScreenPriv(pScreen);<br>    KdScreenInfo *screen = pScreenPriv-&gt;screen;<br>#ifdef RENDER<br>    PictureScreenPtr    ps = GetPictureScreenIfSet(pScreen);<br>#endif<br>    <br>    if (kaaGeneration != serverGeneration)<br>
    {<br>    kaaScreenPrivateIndex = AllocateScreenPrivateIndex();<br>    kaaPixmapPrivateIndex = AllocatePixmapPrivateIndex();<br>    kaaGeneration = serverGeneration;<br>    }<br><br>    pKaaScr = xalloc (sizeof (KaaScreenPrivRec));<br>
<br>    if (!pKaaScr)<br>    return FALSE;<br>    <br>    pKaaScr-&gt;info = pScreenInfo;<br>    <br>    pScreen-&gt;devPrivates[kaaScreenPrivateIndex].ptr = (pointer) pKaaScr;<br>    <br>    /*<br>     * Hook up asynchronous drawing<br>
     */<br>    KdScreenInitAsync (pScreen);<br>    /*<br>     * Replace various fb screen functions<br>     */<br>    pScreen-&gt;CreateGC = kaaCreateGC;<br>    pScreen-&gt;CopyWindow = kaaCopyWindow;<br>    pScreen-&gt;PaintWindowBackground = kaaPaintWindow;<br>
    pScreen-&gt;PaintWindowBorder = kaaPaintWindow;<br>#ifdef RENDER<br>    if (ps) {<br>    ps-&gt;Composite = kaaComposite;<br>    ps-&gt;RasterizeTrapezoid = kaaRasterizeTrapezoid;<br>    }<br>#endif<br><br>    /*<br>     * Hookup offscreen pixmaps<br>
     */<br>    if ((pKaaScr-&gt;info-&gt;flags &amp; KAA_OFFSCREEN_PIXMAPS) &amp;&amp;<br>    screen-&gt;off_screen_base &lt; screen-&gt;memory_size)<br>    {<br>    if (!AllocatePixmapPrivate(pScreen, kaaPixmapPrivateIndex,<br>
                   sizeof (KaaPixmapPrivRec)))<br>        return FALSE;<br>    pScreen-&gt;CreatePixmap = kaaCreatePixmap;<br>    pScreen-&gt;DestroyPixmap = kaaDestroyPixmap;<br>    }<br>    else<br>    {<br>    if (!AllocatePixmapPrivate(pScreen, kaaPixmapPrivateIndex, 0))<br>
        return FALSE;<br>    }<br><br>    return TRUE;<br>}<br><br>void<br>kaaDrawFini (ScreenPtr pScreen)<br>{<br>    KaaScreenPriv(pScreen);<br><br>    xfree (pKaaScr);<br>}<br><br>void<br>kaaMarkSync (ScreenPtr pScreen)<br>
{<br>    KdScreenPriv(pScreen);<br>    KaaScreenPriv(pScreen);<br><br>    pScreenPriv-&gt;card-&gt;needSync = TRUE;<br>    if (pKaaScr-&gt;info-&gt;markSync != NULL) {<br>    pScreenPriv-&gt;card-&gt;lastMarker = (*pKaaScr-&gt;info-&gt;markSync) (pScreen);<br>
    }<br>}<br><br>void<br>kaaWaitSync (ScreenPtr pScreen)<br>{<br>    KdScreenPriv(pScreen);<br>    KaaScreenPriv(pScreen);<br>    KdCardInfo *card = pScreenPriv-&gt;card;<br><br>    if (card-&gt;needSync) {<br>    (*pKaaScr-&gt;info-&gt;waitMarker) (pScreen, card-&gt;lastMarker);<br>
    card-&gt;needSync = FALSE;<br>    }<br>}<br><br><br><div class="gmail_quote">On Fri, Oct 30, 2009 at 12:45 PM, Daniel Stone <span dir="ltr">&lt;<a href="mailto:daniel@fooishbar.org">daniel@fooishbar.org</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im">Hi,<br>
<br>
On Fri, Oct 30, 2009 at 11:04:57AM +0530, prudhvi raj wrote:<br>
</div><div><div></div><div class="h5">&gt; I have added the acceleration support to the Xfbdev server (in X windows<br>
&gt; version 11 release 7.4) in order to improve the performance on ARM 11 board.<br>
&gt; Among the accelerated hooks supported by KAA we have implemented<br>
&gt; polyFillRect and CopyArea.<br>
&gt;<br>
&gt; But when we run some client application on this accelerated server the calls<br>
&gt; to the accelerated copyArea (which internally calls the hardware bitBlit<br>
&gt; function) are coming very less frequently compared to the software blit<br>
&gt; calls.<br>
&gt;<br>
&gt; During my observation i have found some partially implemented functions like<br>
&gt; kaaFillRegionTiled() etc which may internally call the blit operation<br>
&gt; through (*pKaaScr-&gt;info-&gt;Copy) hook.<br>
&gt;<br>
&gt; If at all this function could help to improve the performance of blit, can<br>
&gt; you provide the fully implemented kaaFillRegionTiled().<br>
&gt;<br>
&gt; When i have run one sample client application (gtkDemo) the fbBlt() function<br>
&gt; got called around 40000 times where as the hardware accelerated blit<br>
&gt; function called through kaaCopyNtoN (which calls (*pKaaScr-&gt;info-&gt;Copy)<br>
&gt; internally) very few times (around 2500 times only) compared to fbBlt.<br>
&gt;<br>
&gt; Can you provide more clarity why are most of the Blit calls are routed<br>
&gt; through software fallbacks.<br>
<br>
</div></div><div><div></div><div class="h5">Firstly, we very strongly recommend using Xorg instead of KDrive, and<br>
also secondly, it&#39;s really very hard to debug your code without having<br>
access to it.  Are you able to post it somewhere?<br>
<br>
Cheers,<br>
Daniel<br>
</div></div></blockquote></div><br>