X11rdp: create off screen pixmap if not created on use

This commit is contained in:
Jay Sorg 2012-12-23 14:03:05 -08:00
parent 6ed3d10096
commit 842fbc43e0
23 changed files with 86 additions and 47 deletions

View File

@ -256,7 +256,6 @@ struct _rdpPixmapRec
{
int status;
int rdpindex;
int allocBytes;
int con_number;
int is_dirty;
int pad0;
@ -338,7 +337,7 @@ draw_item_remove(rdpPixmapRec* priv, struct rdp_draw_item* di);
int
draw_item_remove_all(rdpPixmapRec* priv);
int
draw_item_pack(rdpPixmapRec* priv);
draw_item_pack(PixmapPtr pix, rdpPixmapRec* priv);
int
draw_item_add_img_region(rdpPixmapRec* priv, RegionPtr reg, int opcode,
int type);
@ -359,7 +358,8 @@ rdpCreatePixmap(ScreenPtr pScreen, int width, int height, int depth,
unsigned usage_hint);
Bool
rdpDestroyPixmap(PixmapPtr pPixmap);
int
xrdp_is_os(PixmapPtr pix, rdpPixmapPtr priv);
Bool
rdpCreateWindow(WindowPtr pWindow);
Bool
@ -420,7 +420,6 @@ rdpGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
INT16 xSrc, INT16 ySrc, int nlists, GlyphListPtr lists,
GlyphPtr* glyphs);
/* rdpinput.c */
int
rdpKeybdProc(DeviceIntPtr pDevice, int onoff);

View File

@ -403,7 +403,7 @@ rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
pDstPixmap = (PixmapPtr)pDst;
pDstPriv = GETPIXPRIV(pDstPixmap);
if (XRDP_IS_OS(pDstPriv))
if (xrdp_is_os(pDstPixmap, pDstPriv))
{
can_do_screen_blt = pGC->alu == GXcopy;
@ -423,7 +423,7 @@ rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
pSrcPixmap = (PixmapPtr)pSrc;
pSrcPriv = GETPIXPRIV(pSrcPixmap);
if (XRDP_IS_OS(pSrcPriv))
if (xrdp_is_os(pSrcPixmap, pSrcPriv))
{
if (pDst->type == DRAWABLE_WINDOW)
{
@ -442,7 +442,7 @@ rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
pDstPixmap = (PixmapPtr)pDst;
pDstPriv = GETPIXPRIV(pDstPixmap);
if (XRDP_IS_OS(pDstPriv))
if (xrdp_is_os(pDstPixmap, pDstPriv))
{
if (g_can_do_pix_to_pix)
{
@ -472,7 +472,7 @@ rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
pDstPixmap = (PixmapPtr)pDst;
pDstPriv = GETPIXPRIV(pDstPixmap);
if (XRDP_IS_OS(pDstPriv))
if (xrdp_is_os(pDstPixmap, pDstPriv))
{
post_process = 1;

View File

@ -105,7 +105,7 @@ rdpCopyPlane(DrawablePtr pSrc, DrawablePtr pDst,
pDstPixmap = (PixmapPtr)pDst;
pDstPriv = GETPIXPRIV(pDstPixmap);
if (XRDP_IS_OS(pDstPriv))
if (xrdp_is_os(pDstPixmap, pDstPriv))
{
post_process = 1;

View File

@ -144,7 +144,7 @@ rdpFillPolygon(DrawablePtr pDrawable, GCPtr pGC,
pDstPixmap = (PixmapPtr)pDrawable;
pDstPriv = GETPIXPRIV(pDstPixmap);
if (XRDP_IS_OS(pDstPriv))
if (xrdp_is_os(pDstPixmap, pDstPriv))
{
post_process = 1;

View File

@ -80,7 +80,7 @@ rdpFillSpans(DrawablePtr pDrawable, GCPtr pGC, int nInit,
pDstPixmap = (PixmapPtr)pDrawable;
pDstPriv = GETPIXPRIV(pDstPixmap);
if (XRDP_IS_OS(pDstPriv))
if (xrdp_is_os(pDstPixmap, pDstPriv))
{
rdpup_switch_os_surface(pDstPriv->rdpindex);
rdpup_get_pixmap_image_rect(pDstPixmap, &id);

View File

@ -102,7 +102,7 @@ rdpImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
pDstPixmap = (PixmapPtr)pDrawable;
pDstPriv = GETPIXPRIV(pDstPixmap);
if (XRDP_IS_OS(pDstPriv))
if (xrdp_is_os(pDstPixmap, pDstPriv))
{
post_process = 1;

View File

@ -100,7 +100,7 @@ rdpImageText16(DrawablePtr pDrawable, GCPtr pGC,
pDstPixmap = (PixmapPtr)pDrawable;
pDstPriv = GETPIXPRIV(pDstPixmap);
if (XRDP_IS_OS(pDstPriv))
if (xrdp_is_os(pDstPixmap, pDstPriv))
{
post_process = 1;

View File

@ -100,7 +100,7 @@ rdpImageText8(DrawablePtr pDrawable, GCPtr pGC,
pDstPixmap = (PixmapPtr)pDrawable;
pDstPriv = GETPIXPRIV(pDstPixmap);
if (XRDP_IS_OS(pDstPriv))
if (xrdp_is_os(pDstPixmap, pDstPriv))
{
post_process = 1;

View File

@ -119,7 +119,7 @@ rdpPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc *parcs)
pDstPixmap = (PixmapPtr)pDrawable;
pDstPriv = GETPIXPRIV(pDstPixmap);
if (XRDP_IS_OS(pDstPriv))
if (xrdp_is_os(pDstPixmap, pDstPriv))
{
post_process = 1;

View File

@ -119,7 +119,7 @@ rdpPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc *parcs)
pDstPixmap = (PixmapPtr)pDrawable;
pDstPriv = GETPIXPRIV(pDstPixmap);
if (XRDP_IS_OS(pDstPriv))
if (xrdp_is_os(pDstPixmap, pDstPriv))
{
post_process = 1;

View File

@ -99,7 +99,7 @@ rdpPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill,
pDstPixmap = (PixmapPtr)pDrawable;
pDstPriv = GETPIXPRIV(pDstPixmap);
if (XRDP_IS_OS(pDstPriv))
if (xrdp_is_os(pDstPixmap, pDstPriv))
{
post_process = 1;

View File

@ -102,7 +102,7 @@ rdpPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
pDstPixmap = (PixmapPtr)pDrawable;
pDstPriv = GETPIXPRIV(pDstPixmap);
if (XRDP_IS_OS(pDstPriv))
if (xrdp_is_os(pDstPixmap, pDstPriv))
{
post_process = 1;

View File

@ -150,7 +150,7 @@ rdpPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode,
pDstPixmap = (PixmapPtr)pDrawable;
pDstPriv = GETPIXPRIV(pDstPixmap);
if (XRDP_IS_OS(pDstPriv))
if (xrdp_is_os(pDstPixmap, pDstPriv))
{
post_process = 1;

View File

@ -112,7 +112,7 @@ rdpPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nrects,
pDstPixmap = (PixmapPtr)pDrawable;
pDstPriv = GETPIXPRIV(pDstPixmap);
if (XRDP_IS_OS(pDstPriv))
if (xrdp_is_os(pDstPixmap, pDstPriv))
{
post_process = 1;

View File

@ -109,7 +109,7 @@ rdpPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment *pSegs)
pDstPixmap = (PixmapPtr)pDrawable;
pDstPriv = GETPIXPRIV(pDstPixmap);
if (XRDP_IS_OS(pDstPriv))
if (xrdp_is_os(pDstPixmap, pDstPriv))
{
post_process = 1;

View File

@ -103,7 +103,7 @@ rdpPolyText16(DrawablePtr pDrawable, GCPtr pGC,
pDstPixmap = (PixmapPtr)pDrawable;
pDstPriv = GETPIXPRIV(pDstPixmap);
if (XRDP_IS_OS(pDstPriv))
if (xrdp_is_os(pDstPixmap, pDstPriv))
{
post_process = 1;

View File

@ -103,7 +103,7 @@ rdpPolyText8(DrawablePtr pDrawable, GCPtr pGC,
pDstPixmap = (PixmapPtr)pDrawable;
pDstPriv = GETPIXPRIV(pDstPixmap);
if (XRDP_IS_OS(pDstPriv))
if (xrdp_is_os(pDstPixmap, pDstPriv))
{
post_process = 1;

View File

@ -160,7 +160,7 @@ rdpPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode,
pDstPixmap = (PixmapPtr)pDrawable;
pDstPriv = GETPIXPRIV(pDstPixmap);
if (XRDP_IS_OS(pDstPriv))
if (xrdp_is_os(pDstPixmap, pDstPriv))
{
post_process = 1;

View File

@ -96,7 +96,7 @@ rdpPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst,
pDstPixmap = (PixmapPtr)pDst;
pDstPriv = GETPIXPRIV(pDstPixmap);
if (XRDP_IS_OS(pDstPriv))
if (xrdp_is_os(pDstPixmap, pDstPriv))
{
post_process = 1;

View File

@ -98,7 +98,7 @@ rdpPutImage(DrawablePtr pDst, GCPtr pGC, int depth, int x, int y,
pDstPixmap = (PixmapPtr)pDst;
pDstPriv = GETPIXPRIV(pDstPixmap);
if (XRDP_IS_OS(pDstPriv))
if (xrdp_is_os(pDstPixmap, pDstPriv))
{
post_process = 1;

View File

@ -89,7 +89,7 @@ rdpSetSpans(DrawablePtr pDrawable, GCPtr pGC, char *psrc,
pDstPixmap = (PixmapPtr)pDrawable;
pDstPriv = GETPIXPRIV(pDstPixmap);
if (XRDP_IS_OS(pDstPriv))
if (xrdp_is_os(pDstPixmap, pDstPriv))
{
post_process = 1;

View File

@ -482,7 +482,7 @@ draw_item_remove_all(rdpPixmapRec *priv)
/******************************************************************************/
int
draw_item_pack(rdpPixmapRec *priv)
draw_item_pack(PixmapPtr pix, rdpPixmapRec *priv)
{
struct rdp_draw_item *di;
struct rdp_draw_item *di_prev;
@ -685,20 +685,6 @@ rdpCreatePixmap(ScreenPtr pScreen, int width, int height, int depth,
rv = pScreen->CreatePixmap(pScreen, width, height, depth, usage_hint);
priv = GETPIXPRIV(rv);
priv->rdpindex = -1;
if ((rv->drawable.depth >= g_rdpScreen.depth) &&
(org_width > 1) && (height > 1))
{
priv->allocBytes = width * height * g_Bpp;
priv->rdpindex = rdpup_add_os_bitmap(rv, priv);
if (priv->rdpindex >= 0)
{
priv->status = 1;
rdpup_create_os_surface(priv->rdpindex, width, height);
}
}
pScreen->ModifyPixmapHeader(rv, org_width, 0, 0, 0, 0, 0);
pScreen->CreatePixmap = rdpCreatePixmap;
return rv;
@ -735,6 +721,59 @@ rdpDestroyPixmap(PixmapPtr pPixmap)
return rv;
}
/*****************************************************************************/
int
xrdp_is_os(PixmapPtr pix, rdpPixmapPtr priv)
{
RegionRec reg1;
BoxRec box;
int width;
int height;
struct image_data id;
if (priv->status == 0)
{
width = pix->drawable.width;
height = pix->drawable.height;
if ((pix->drawable.depth >= g_rdpScreen.depth) &&
(width > 1) && (height > 1))
{
width = (width + 3) & ~3;
priv->rdpindex = rdpup_add_os_bitmap(pix, priv);
if (priv->rdpindex >= 0)
{
priv->status = 1;
rdpup_create_os_surface(priv->rdpindex, width, height);
box.x1 = 0;
box.y1 = 0;
box.x2 = width;
box.y2 = height;
if (g_do_dirty_os)
{
draw_item_remove_all(priv);
RegionInit(&reg1, &box, 0);
draw_item_add_img_region(priv, &reg1, GXcopy, RDI_IMGLL);
RegionUninit(&reg1);
priv->is_dirty = 1;
}
else
{
rdpup_get_pixmap_image_rect(pix, &id);
rdpup_switch_os_surface(priv->rdpindex);
rdpup_begin_update();
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1,
box.y2 - box.y1);
rdpup_end_update();
rdpup_switch_os_surface(-1);
}
return 1;
}
}
return 0;
}
return 1;
}
/******************************************************************************/
Bool
rdpCreateWindow(WindowPtr pWindow)
@ -831,8 +870,8 @@ rdpRealizeWindow(WindowPtr pWindow)
LLOGLN(10, ("rdpRealizeWindow:"));
LLOGLN(10, (" pWindow %p id 0x%x pWindow->parent %p id 0x%x x %d "
"y %d width %d height %d",
pWindow, pWindow->drawable.id,
pWindow->parent, pWindow->parent->drawable.id,
pWindow, (int)(pWindow->drawable.id),
pWindow->parent, (int)(pWindow->parent->drawable.id),
pWindow->drawable.x, pWindow->drawable.y,
pWindow->drawable.width, pWindow->drawable.height));
priv->status = 1;
@ -1223,7 +1262,7 @@ rdpComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst,
pDstPixmap = (PixmapPtr)p;
pDstPriv = GETPIXPRIV(pDstPixmap);
if (XRDP_IS_OS(pDstPriv))
if (xrdp_is_os(pDstPixmap, pDstPriv))
{
post_process = 1;

View File

@ -137,6 +137,7 @@ rdpup_disconnect(void)
g_sck_closed = 1;
g_pixmap_byte_total = 0;
g_pixmap_num_used = 0;
g_rdpindex = -1;
if (g_max_os_bitmaps > 0)
{
@ -1833,7 +1834,7 @@ rdpup_check_dirty(PixmapPtr pDirtyPixmap, rdpPixmapRec *pDirtyPriv)
rdpup_switch_os_surface(pDirtyPriv->rdpindex);
rdpup_get_pixmap_image_rect(pDirtyPixmap, &id);
rdpup_begin_update();
draw_item_pack(pDirtyPriv);
draw_item_pack(pDirtyPixmap, pDirtyPriv);
di = pDirtyPriv->draw_item_head;
while (di != 0)
@ -1958,7 +1959,7 @@ rdpup_check_dirty_screen(rdpPixmapRec *pDirtyPriv)
LLOGLN(10, ("-----------------got dirty"));
rdpup_get_screen_image_rect(&id);
rdpup_begin_update();
draw_item_pack(pDirtyPriv);
draw_item_pack(0, pDirtyPriv);
di = pDirtyPriv->draw_item_head;
while (di != 0)