Ejemplo n.º 1
0
Bool
rdpRRScreenSetSize(ScreenPtr pScreen, CARD16 width, CARD16 height,
                   CARD32 mmWidth, CARD32 mmHeight)
{
    WindowPtr root;
    PixmapPtr screenPixmap;
    BoxRec box;
    rdpPtr dev;

    LLOGLN(0, ("rdpRRScreenSetSize: width %d height %d mmWidth %d mmHeight %d",
           width, height, (int)mmWidth, (int)mmHeight));
    dev = rdpGetDevFromScreen(pScreen);
    root = rdpGetRootWindowPtr(pScreen);
    if ((width < 1) || (height < 1))
    {
        LLOGLN(10, ("  error width %d height %d", width, height));
        return FALSE;
    }
    dev->width = width;
    dev->height = height;
    dev->paddedWidthInBytes = PixmapBytePad(dev->width, dev->depth);
    dev->sizeInBytes = dev->paddedWidthInBytes * dev->height;
    pScreen->width = width;
    pScreen->height = height;
    pScreen->mmWidth = mmWidth;
    pScreen->mmHeight = mmHeight;
    screenPixmap = pScreen->GetScreenPixmap(pScreen);
    g_free(dev->pfbMemory_alloc);
    dev->pfbMemory_alloc = (char *) g_malloc(dev->sizeInBytes + 16, 1);
    dev->pfbMemory = (char *) RDPALIGN(dev->pfbMemory_alloc, 16);
    if (screenPixmap != 0)
    {
        pScreen->ModifyPixmapHeader(screenPixmap, width, height,
                                    -1, -1,
                                    dev->paddedWidthInBytes,
                                    dev->pfbMemory);
    }
    box.x1 = 0;
    box.y1 = 0;
    box.x2 = width;
    box.y2 = height;
    rdpRegionInit(&root->winSize, &box, 1);
    rdpRegionInit(&root->borderSize, &box, 1);
    rdpRegionReset(&root->borderClip, &box);
    rdpRegionBreak(&root->clipList);
    root->drawable.width = width;
    root->drawable.height = height;
    ResizeChildrenWinSize(root, 0, 0, 0, 0);
    RRGetInfo(pScreen, 1);
    LLOGLN(0, ("  screen resized to %dx%d", pScreen->width, pScreen->height));
    RRScreenSizeNotify(pScreen);
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1, 13, 0, 0, 0)
    xf86EnableDisableFBAccess(pScreen->myNum, FALSE);
    xf86EnableDisableFBAccess(pScreen->myNum, TRUE);
#else
    xf86EnableDisableFBAccess(xf86Screens[pScreen->myNum], FALSE);
    xf86EnableDisableFBAccess(xf86Screens[pScreen->myNum], TRUE);
#endif
    return TRUE;
}
Ejemplo n.º 2
0
static void
RootlessPaintWindowBackground(WindowPtr pWin, RegionPtr pRegion, int what)
{
    int oldBackgroundState = 0;
    PixUnion oldBackground;
    ScreenPtr pScreen = pWin->drawable.pScreen;

    SCREEN_UNWRAP(pScreen, PaintWindowBackground);
    RL_DEBUG_MSG("paintwindowbackground start (win 0x%x) ", pWin);
    if (IsFramedWindow(pWin)) {
        if (IsRoot(pWin)) {
            // set root background to magic transparent color
            oldBackgroundState = pWin->backgroundState;
            oldBackground = pWin->background;
            pWin->backgroundState = BackgroundPixel;
            pWin->background.pixel = 0x00fffffe;
        }
    }

    pScreen->PaintWindowBackground(pWin, pRegion, what);

    if (IsFramedWindow(pWin)) {
        RootlessDamageRegion(pWin, pRegion);
        if (IsRoot(pWin)) {
            pWin->backgroundState = oldBackgroundState;
            pWin->background = oldBackground;
        }
    }
    SCREEN_WRAP(pScreen, PaintWindowBackground);
    RL_DEBUG_MSG("paintwindowbackground end\n");
}
Ejemplo n.º 3
0
/** Create a graphics context on the back-end server associated /a pGC's
 *  screen. */
Bool
dmxCreateGC(GCPtr pGC)
{
    ScreenPtr pScreen = pGC->pScreen;
    DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
    dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
    Bool ret;

    DMX_UNWRAP(CreateGC, dmxScreen, pScreen);
    if ((ret = pScreen->CreateGC(pGC))) {
        /* Save the old funcs */
        pGCPriv->funcs = pGC->funcs;
        pGCPriv->ops = NULL;

        pGC->funcs = &dmxGCFuncs;

        if (dmxScreen->beDisplay) {
            dmxBECreateGC(pScreen, pGC);
        }
        else {
            pGCPriv->gc = NULL;
        }

        /* Check for "magic special case"
         * 1. see CreateGC in dix/gc.c for more info
         * 2. see dmxChangeGC for more info
         */
        pGCPriv->msc = (!pGC->tileIsPixel && !pGC->tile.pixmap);
    }
    DMX_WRAP(CreateGC, dmxCreateGC, dmxScreen, pScreen);

    return ret;
}
static DRI2Buffer2Ptr
vivante_dri2_CreateBuffer(DrawablePtr drawable, unsigned int attachment,
	unsigned int format)
{
	struct vivante_dri2_buffer *buf;
	struct vivante_pixmap *vpix;
	ScreenPtr pScreen = drawable->pScreen;
	PixmapPtr pixmap = NULL;
	uint32_t name;

fprintf(stderr, "%s: %p %u %u\n", __func__, drawable, attachment, format);
	if (attachment == DRI2BufferFrontLeft) {
		pixmap = vivante_dri2_get_front_pixmap(drawable);
		if (!pixmap) {
			drawable = &pixmap->drawable;
			pixmap = NULL;
		}
	}

	if (pixmap == NULL) {
		int width = drawable->width;
		int height = drawable->height;
		int depth = format ? format : drawable->depth;

		pixmap = pScreen->CreatePixmap(pScreen, width, height, depth, 0);
		if (!pixmap)
			goto err;
	}

	vpix = vivante_get_pixmap_priv(pixmap);
	if (!vpix)
		goto err;

	buf = calloc(1, sizeof *buf);
	if (!buf)
		goto err;

	if (!vpix->bo || drm_armada_bo_flink(vpix->bo, &name)) {
		free(buf);
		goto err;
	}

	buf->dri2.attachment = attachment;
	buf->dri2.name = name;
	buf->dri2.pitch = pixmap->devKind;
	buf->dri2.cpp = pixmap->drawable.bitsPerPixel / 8;
	buf->dri2.flags = 0;
	buf->dri2.format = format;
	buf->dri2.driverPrivate = buf;
	buf->pixmap = pixmap;
	buf->ref = 1;

	return &buf->dri2;

 err:
	if (pixmap)
		pScreen->DestroyPixmap(pixmap);

	return NULL;
}
Ejemplo n.º 5
0
Bool
rdpRRScreenSetSize(ScreenPtr pScreen, CARD16 width, CARD16 height,
                   CARD32 mmWidth, CARD32 mmHeight)
{
    PixmapPtr screenPixmap;
    BoxRec box;

    ErrorF("rdpRRScreenSetSize: width %d height %d mmWidth %d mmHeight %d\n",
           width, height, (int)mmWidth, (int)mmHeight);

    if ((width < 1) || (height < 1))
    {
        ErrorF("  error width %d height %d\n", width, height);
        return FALSE;
    }

    g_rdpScreen.width = width;
    g_rdpScreen.height = height;
    g_rdpScreen.paddedWidthInBytes =
        PixmapBytePad(g_rdpScreen.width, g_rdpScreen.depth);
    g_rdpScreen.sizeInBytes =
        g_rdpScreen.paddedWidthInBytes * g_rdpScreen.height;
    pScreen->width = width;
    pScreen->height = height;
    pScreen->mmWidth = mmWidth;
    pScreen->mmHeight = mmHeight;

    screenPixmap = pScreen->GetScreenPixmap(pScreen);

    if (screenPixmap != 0)
    {
        ErrorF("  resizing screenPixmap [%p] to %dx%d, currently at %dx%d\n",
               (void *)screenPixmap, width, height,
               screenPixmap->drawable.width, screenPixmap->drawable.height);
        pScreen->ModifyPixmapHeader(screenPixmap, width, height,
                                    g_rdpScreen.depth, g_rdpScreen.bitsPerPixel,
                                    g_rdpScreen.paddedWidthInBytes,
                                    g_rdpScreen.pfbMemory);
        ErrorF("  pixmap resized to %dx%d\n",
               screenPixmap->drawable.width, screenPixmap->drawable.height);
    }

    DEBUG_OUT(("  root window %p\n", (void *)pScreen->root));
    box.x1 = 0;
    box.y1 = 0;
    box.x2 = width;
    box.y2 = height;
    RegionInit(&pScreen->root->winSize, &box, 1);
    RegionInit(&pScreen->root->borderSize, &box, 1);
    RegionReset(&pScreen->root->borderClip, &box);
    RegionBreak(&pScreen->root->clipList);
    pScreen->root->drawable.width = width;
    pScreen->root->drawable.height = height;
    ResizeChildrenWinSize(pScreen->root, 0, 0, 0, 0);
    RRGetInfo(pScreen, 1);
    rdpInvalidateArea(g_pScreen, 0, 0, g_rdpScreen.width, g_rdpScreen.height);
    ErrorF("  screen resized to %dx%d\n",
           pScreen->width, pScreen->height);
    return TRUE;
}
Ejemplo n.º 6
0
static Bool
glamor_egl_close_screen(ScreenPtr screen)
{
    ScrnInfoPtr scrn;
    struct glamor_egl_screen_private *glamor_egl;
    PixmapPtr screen_pixmap;
    EGLImageKHR back_image;

    scrn = xf86ScreenToScrn(screen);
    glamor_egl = glamor_egl_get_screen_private(scrn);
    screen_pixmap = screen->GetScreenPixmap(screen);

    eglDestroyImageKHR(glamor_egl->display,glamor_egl->front_image);
    dixSetPrivate(&screen_pixmap->devPrivates, glamor_egl_pixmap_private_key,
                  NULL);
    glamor_egl->front_image = NULL;
    if (glamor_egl->back_pixmap && *glamor_egl->back_pixmap) {
        back_image = dixLookupPrivate(&(*glamor_egl->back_pixmap)->devPrivates,
                                      glamor_egl_pixmap_private_key);
        if (back_image != NULL && back_image != EGL_NO_IMAGE_KHR) {
            eglDestroyImageKHR(glamor_egl->display, back_image);
            dixSetPrivate(&(*glamor_egl->back_pixmap)->devPrivates,
                          glamor_egl_pixmap_private_key, NULL);
        }
    }

    screen->CloseScreen = glamor_egl->saved_close_screen;

    return screen->CloseScreen(screen);
}
Ejemplo n.º 7
0
void 
glWinCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
{
    ScreenPtr pScreen = pWindow->drawable.pScreen;
    glWinScreenRec *screenPriv = &glWinScreens[pScreen->myNum];
    __GLXdrawablePrivate *glxPriv;
    
    /* Check if the window is attached and discard any drawing request */
    glxPriv = __glXFindDrawablePrivate(pWindow->drawable.id);
    if (glxPriv) {
        __GLXcontext *gx;

        /* GL contexts bound to this window for drawing */
        for (gx = glxPriv->drawGlxc; gx != NULL; gx = gx->next) {
/*            
            GLWIN_DEBUG_MSG("glWinCopyWindow - calling glDrawBuffer\n");
            glDrawBuffer(GL_FRONT);
 */
            return;
        }

        /* GL contexts bound to this window for reading */
        for (gx = glxPriv->readGlxc; gx != NULL; gx = gx->next) {
            return;
        }
    }

    GLWIN_DEBUG_MSG("glWinCopyWindow - passing to hw layer\n");

    pScreen->CopyWindow = screenPriv->CopyWindow;
    pScreen->CopyWindow(pWindow, ptOldOrg, prgnSrc);
    pScreen->CopyWindow = glWinCopyWindow;
}
Ejemplo n.º 8
0
static void
ExaSrcValidate(DrawablePtr pDrawable,
	       int x,
	       int y,
	       int width,
	       int height)
{
    ScreenPtr pScreen = pDrawable->pScreen;
    ExaScreenPriv(pScreen);
    PixmapPtr pPix = exaGetDrawablePixmap (pDrawable);
    BoxRec box;
    RegionRec reg;
    RegionPtr dst;
    int xoff, yoff;

    exaGetDrawableDeltas(pDrawable, pPix, &xoff, &yoff);

    box.x1 = x + xoff;
    box.y1 = y + yoff;
    box.x2 = box.x1 + width;
    box.y2 = box.y1 + height;

    dst = (pExaScr->srcPix == pPix) ? &pExaScr->srcReg :
	&pExaScr->maskReg;

    REGION_INIT(pScreen, &reg, &box, 1);
    REGION_UNION(pScreen, dst, dst, &reg);
    REGION_UNINIT(pScreen, &reg);

    if (pExaScr->SavedSourceValidate) {
        swap(pExaScr, pScreen, SourceValidate);
        pScreen->SourceValidate(pDrawable, x, y, width, height);
        swap(pExaScr, pScreen, SourceValidate);
    }
}
Ejemplo n.º 9
0
Bool
rdpRealizeWindow(WindowPtr pWindow)
{
    ScreenPtr pScreen;
    rdpWindowRec *priv;
    Bool rv;

    LLOGLN(10, ("rdpRealizeWindow:"));
    priv = GETWINPRIV(pWindow);
    pScreen = pWindow->drawable.pScreen;
    pScreen->RealizeWindow = g_rdpScreen.RealizeWindow;
    rv = pScreen->RealizeWindow(pWindow);
    pScreen->RealizeWindow = rdpRealizeWindow;

    if (g_use_rail)
    {
        if ((pWindow != g_invalidate_window) && (pWindow->parent != 0))
        {
            if (XR_IS_ROOT(pWindow->parent))
            {
                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, (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;
                rdpup_create_window(pWindow, priv);
            }
        }
    }

    return rv;
}
Ejemplo n.º 10
0
Bool
rdpUnrealizeWindow(WindowPtr pWindow)
{
    ScreenPtr pScreen;
    rdpWindowRec *priv;
    Bool rv;

    LLOGLN(10, ("rdpUnrealizeWindow:"));
    priv = GETWINPRIV(pWindow);
    pScreen = pWindow->drawable.pScreen;
    pScreen->UnrealizeWindow = g_rdpScreen.UnrealizeWindow;
    rv = pScreen->UnrealizeWindow(pWindow);
    pScreen->UnrealizeWindow = rdpUnrealizeWindow;

    if (g_use_rail)
    {
        if (priv->status == 1)
        {
            LLOGLN(10, ("rdpUnrealizeWindow:"));
            priv->status = 0;
            rdpup_delete_window(pWindow, priv);
        }
    }

    return rv;
}
Ejemplo n.º 11
0
Bool
rdpPositionWindow(WindowPtr pWindow, int x, int y)
{
    ScreenPtr pScreen;
    rdpWindowRec *priv;
    Bool rv;

    LLOGLN(10, ("rdpPositionWindow:"));
    priv = GETWINPRIV(pWindow);
    pScreen = pWindow->drawable.pScreen;
    pScreen->PositionWindow = g_rdpScreen.PositionWindow;
    rv = pScreen->PositionWindow(pWindow, x, y);
    pScreen->PositionWindow = rdpPositionWindow;

    if (g_use_rail)
    {
        if (priv->status == 1)
        {
            LLOGLN(10, ("rdpPositionWindow:"));
            LLOGLN(10, ("  x %d y %d", x, y));
        }
    }

    return rv;
}
Ejemplo n.º 12
0
Bool
rdpDestroyPixmap(PixmapPtr pPixmap)
{
    Bool rv;
    ScreenPtr pScreen;
    rdpPixmapRec *priv;

    LLOGLN(10, ("rdpDestroyPixmap:"));
    priv = GETPIXPRIV(pPixmap);
    LLOGLN(10, ("status %d refcnt %d", priv->status, pPixmap->refcnt));

    if (pPixmap->refcnt < 2)
    {
        if (XRDP_IS_OS(priv))
        {
            rdpup_remove_os_bitmap(priv->rdpindex);
            rdpup_delete_os_surface(priv->rdpindex);
            draw_item_remove_all(priv);
        }
    }

    pScreen = pPixmap->drawable.pScreen;
    pScreen->DestroyPixmap = g_rdpScreen.DestroyPixmap;
    rv = pScreen->DestroyPixmap(pPixmap);
    pScreen->DestroyPixmap = rdpDestroyPixmap;
    return rv;
}
Ejemplo n.º 13
0
vfbCloseScreen(ScreenPtr pScreen)
#endif
{
#if XORG < 113
    vfbScreenInfoPtr pvfb = &vfbScreens[index];
#else
    vfbScreenInfoPtr pvfb = &vfbScreens[pScreen->myNum];
#endif
    int i;
 
    pScreen->CloseScreen = pvfb->closeScreen;

    /*
     * XXX probably lots of stuff to clean.  For now,
     * clear installed colormaps so that server reset works correctly.
     */
#if XORG < 113
    for (i = 0; i < MAXSCREENS; i++)
	InstalledMaps[i] = NULL;

    return pScreen->CloseScreen(index, pScreen);
#else
    for (i = 0; i < screenInfo.numScreens; i++)
	SetInstalledColormap(screenInfo.screens[i], NULL);

    /*
     * fb overwrites miCloseScreen, so do this here
     */
    if (pScreen->devPrivate)
        (*pScreen->DestroyPixmap) ((PixmapPtr) pScreen->devPrivate);
    pScreen->devPrivate = NULL;

    return pScreen->CloseScreen(pScreen);
#endif
}
static Bool
radeon_glamor_set_shared_pixmap_backing(PixmapPtr pixmap, void *handle)
{
	ScreenPtr screen = pixmap->drawable.pScreen;
	ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
	struct radeon_surface surface;
	struct radeon_pixmap *priv;

	if (!radeon_set_shared_pixmap_backing(pixmap, handle, &surface))
		return FALSE;

	priv = radeon_get_pixmap_private(pixmap);
	priv->surface = surface;

	if (!radeon_glamor_create_textured_pixmap(pixmap, priv)) {
		xf86DrvMsg(scrn->scrnIndex, X_ERROR,
			   "Failed to get PRIME drawable for glamor pixmap.\n");
		return FALSE;
	}

	screen->ModifyPixmapHeader(pixmap,
				   pixmap->drawable.width,
				   pixmap->drawable.height,
				   0, 0, 0, NULL);

	return TRUE;
}
Ejemplo n.º 15
0
PixmapPtr
rdpCreatePixmap(ScreenPtr pScreen, int width, int height, int depth,
                unsigned usage_hint)
{
  PixmapPtr rv;
  rdpPixmapRec* priv;
  int org_width;

  org_width = width;
  /* width must be a multiple of 4 in rdp */
  width = (width + 3) & ~3;
  LLOGLN(10, ("rdpCreatePixmap: width %d org_width %d", width, org_width));
  pScreen->CreatePixmap = g_rdpScreen.CreatePixmap;
  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;
}
Ejemplo n.º 16
0
/**
 * Destroy Buffer
 */
static void
MSMDRI2DestroyBuffer(DrawablePtr pDraw, DRI2BufferPtr buffer)
{
	MSMDRI2BufferPtr buf = MSMBUF(buffer);
	ScreenPtr pScreen = buf->pPixmap->drawable.pScreen;
	ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);

	if (--buf->refcnt)
		return;

	DEBUG_MSG("pDraw=%p, buffer=%p, attachment=%d",
			pDraw, buffer, buffer->attachment);

	/* if drawable has already gone away, 3rd buf is cleaned
	 * up in MSMDRI2DrawableGone()
	 */
	if ((buffer->attachment == DRI2BufferBackLeft) && pDraw) {
		MSMDRI2DrawablePtr pPriv = MSMDRI2GetDrawable(pDraw);
		if (pPriv->pThirdBuffer) {
			MSMDRI2DestroyBuffer(pDraw, pPriv->pThirdBuffer);
			pPriv->pThirdBuffer = NULL;
		}
	}

	pScreen->DestroyPixmap(buf->pPixmap);

	free(buf);
}
Ejemplo n.º 17
0
/*
 * RootlessValidateTree
 *  ValidateTree is modified in two ways:
 *   - top-level windows don't clip each other
 *   - windows aren't clipped against root.
 *  These only matter when validating from the root.
 */
static int
RootlessValidateTree(WindowPtr pParent, WindowPtr pChild, VTKind kind)
{
    int result;
    RegionRec saveRoot;
    ScreenPtr pScreen = pParent->drawable.pScreen;

    SCREEN_UNWRAP(pScreen, ValidateTree);
    RL_DEBUG_MSG("VALIDATETREE start ");

    // Use our custom version to validate from root
    if (IsRoot(pParent)) {
        RL_DEBUG_MSG("custom ");
        result = RootlessMiValidateTree(pParent, pChild, kind);
    } else {
        HUGE_ROOT(pParent);
        result = pScreen->ValidateTree(pParent, pChild, kind);
        NORMAL_ROOT(pParent);
    }

    SCREEN_WRAP(pScreen, ValidateTree);
    RL_DEBUG_MSG("VALIDATETREE end\n");

    return result;
}
Ejemplo n.º 18
0
static void
crtc_shadow_destroy(xf86CrtcPtr crtc, PixmapPtr rotate_pixmap, void *data)
{
    ScreenPtr pScreen = rotate_pixmap->drawable.pScreen;

    pScreen->DestroyPixmap(rotate_pixmap);
}
Ejemplo n.º 19
0
void
ExaCheckCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
{
    DrawablePtr pDrawable = &pWin->drawable;
    ScreenPtr pScreen = pDrawable->pScreen;

    EXA_PRE_FALLBACK(pScreen);
    EXA_FALLBACK(("from %p\n", pWin));

    /* Only need the source bits, the destination region will be overwritten */
    if (pExaScr->prepare_access_reg) {
        PixmapPtr pPixmap = pScreen->GetWindowPixmap(pWin);
        int xoff, yoff;

        exaGetDrawableDeltas(&pWin->drawable, pPixmap, &xoff, &yoff);
        RegionTranslate(prgnSrc, xoff, yoff);
        pExaScr->prepare_access_reg(pPixmap, EXA_PREPARE_SRC, prgnSrc);
        RegionTranslate(prgnSrc, -xoff, -yoff);
    }
    else
        exaPrepareAccess(pDrawable, EXA_PREPARE_SRC);

    swap(pExaScr, pScreen, CopyWindow);
    pScreen->CopyWindow(pWin, ptOldOrg, prgnSrc);
    swap(pExaScr, pScreen, CopyWindow);
    exaFinishAccess(pDrawable, EXA_PREPARE_SRC);
    EXA_POST_FALLBACK(pScreen);
}
Ejemplo n.º 20
0
Bool
exaDestroyPixmap_classic(PixmapPtr pPixmap)
{
    ScreenPtr pScreen = pPixmap->drawable.pScreen;

    ExaScreenPriv(pScreen);
    Bool ret;

    if (pPixmap->refcnt == 1) {
        ExaPixmapPriv(pPixmap);

        exaDestroyPixmap(pPixmap);

        if (pExaPixmap->area) {
            DBG_PIXMAP(("-- 0x%p (0x%x) (%dx%d)\n",
                        (void *) pPixmap->drawable.id,
                        ExaGetPixmapPriv(pPixmap)->area->offset,
                        pPixmap->drawable.width, pPixmap->drawable.height));
            /* Free the offscreen area */
            exaOffscreenFree(pPixmap->drawable.pScreen, pExaPixmap->area);
            pPixmap->devPrivate.ptr = pExaPixmap->sys_ptr;
            pPixmap->devKind = pExaPixmap->sys_pitch;
        }
        RegionUninit(&pExaPixmap->validSys);
        RegionUninit(&pExaPixmap->validFB);
    }

    swap(pExaScr, pScreen, DestroyPixmap);
    ret = pScreen->DestroyPixmap(pPixmap);
    swap(pExaScr, pScreen, DestroyPixmap);

    return ret;
}
Ejemplo n.º 21
0
/* Fake backing store via automatic redirection */
static Bool
compChangeWindowAttributes(WindowPtr pWin, unsigned long mask)
{
    ScreenPtr pScreen = pWin->drawable.pScreen;
    CompScreenPtr cs = GetCompScreen (pScreen);
    Bool ret;

    pScreen->ChangeWindowAttributes = cs->ChangeWindowAttributes;
    ret = pScreen->ChangeWindowAttributes(pWin, mask);

    if (ret && (mask & CWBackingStore) &&
	    pScreen->backingStoreSupport != NotUseful) {
	if (pWin->backingStore != NotUseful) {
	    compRedirectWindow(serverClient, pWin, CompositeRedirectAutomatic);
	    pWin->backStorage = (pointer) (intptr_t) 1;
	} else {
	    compUnredirectWindow(serverClient, pWin,
				 CompositeRedirectAutomatic);
	    pWin->backStorage = NULL;
	}
    }

    pScreen->ChangeWindowAttributes = compChangeWindowAttributes;

    return ret;
}
Ejemplo n.º 22
0
static Bool
XAPixmapIsOffscreen(PixmapPtr pPixmap)
{
	ScreenPtr pScreen = pPixmap->drawable.pScreen;
	struct xa_surface *surf = msm_get_pixmap_surf(pPixmap);

	if ((pScreen->GetScreenPixmap(pScreen) == pPixmap)) {
		return TRUE;
	}

	if (!surf) {
		/* because we are pretending to handle unaccel (1bpp, etc)
		 * pixmaps too..
		 * this is pretty lame, revisit using EXA_MIXED_PIXMAPS
		 */
		struct msm_pixmap_priv *priv =
			exaGetPixmapDriverPrivate(pPixmap);

		if (priv && priv->ptr) {
			return TRUE;
		}
	}

	if (surf)
		return TRUE;

	return FALSE;
}
static inline Bool
canexchange(DrawablePtr pDraw, struct armsoc_bo *src_bo, struct armsoc_bo *dst_bo)
{
	Bool ret = FALSE;
	ScreenPtr pScreen = pDraw->pScreen;
	PixmapPtr pRootPixmap, pWindowPixmap;
	int src_fb_id, dst_fb_id;

	pRootPixmap = pScreen->GetWindowPixmap(pScreen->root);
	pWindowPixmap = pDraw->type == DRAWABLE_PIXMAP ? (PixmapPtr)pDraw : pScreen->GetWindowPixmap((WindowPtr)pDraw);

	src_fb_id = armsoc_bo_get_fb(src_bo);
	dst_fb_id = armsoc_bo_get_fb(dst_bo);

	if (pRootPixmap != pWindowPixmap &&
	    armsoc_bo_width(src_bo) == armsoc_bo_width(dst_bo) &&
	    armsoc_bo_height(src_bo) == armsoc_bo_height(dst_bo) &&
	    armsoc_bo_bpp(src_bo) == armsoc_bo_bpp(dst_bo) &&
	    armsoc_bo_width(src_bo) == pDraw->width &&
	    armsoc_bo_height(src_bo) == pDraw->height &&
	    armsoc_bo_bpp(src_bo) == pDraw->bitsPerPixel &&
	    src_fb_id == 0 && dst_fb_id == 0) {
		ret = TRUE;
	}

	return ret;
}
Ejemplo n.º 24
0
static PixmapPtr
createpix(DrawablePtr pDraw)
{
	ScreenPtr pScreen = pDraw->pScreen;
	return pScreen->CreatePixmap(pScreen,
			pDraw->width, pDraw->height, pDraw->depth,
			CREATE_PIXMAP_USAGE_DRI2);
}
static PixmapPtr
createpix(DrawablePtr pDraw)
{
	ScreenPtr pScreen = pDraw->pScreen;
	int flags = canflip(pDraw) ? ARMSOC_CREATE_PIXMAP_SCANOUT : 0;
	return pScreen->CreatePixmap(pScreen,
			pDraw->width, pDraw->height, pDraw->depth, flags);
}
Ejemplo n.º 26
0
static void
xf86_dga_sync(ScrnInfoPtr scrn)
{
    ScreenPtr	pScreen = scrn->pScreen;
    WindowPtr	pRoot = WindowTable [pScreen->myNum];
    char	buffer[4];

    pScreen->GetImage (&pRoot->drawable, 0, 0, 1, 1, ZPixmap, ~0L, buffer);
}
Ejemplo n.º 27
0
static void
VGAarbiterWakeupHandler(int i, pointer blockData, unsigned long result, pointer pReadmask)
{
    ScreenPtr pScreen = screenInfo.screens[i];
    SCREEN_PROLOG(WakeupHandler);
    VGAGet(pScreen);
    pScreen->WakeupHandler(i, blockData, result, pReadmask);
    VGAPut();
    SCREEN_EPILOG(WakeupHandler, VGAarbiterWakeupHandler);
}
/**
 * Set the devices' cursor position to the given x/y position.
 *
 * This function is called during the pointer update path in
 * GetPointerEvents and friends (and the same in the xwin DDX).
 *
 * The coordinates provided are always absolute. The parameter mode whether
 * it was relative or absolute movement that landed us at those coordinates.
 *
 * @param pDev The device to move
 * @param mode Movement mode (Absolute or Relative)
 * @param[in,out] x The x coordiante in screen coordinates (in regards to total
 * desktop size)
 * @param[in,out] y The y coordiante in screen coordinates (in regards to total
 * desktop size)
 */
void
miPointerSetPosition(DeviceIntPtr pDev, int mode, int *x, int *y)
{
    miPointerScreenPtr	pScreenPriv;
    ScreenPtr		pScreen;
    ScreenPtr		newScreen;

    miPointerPtr        pPointer; 

    if (!pDev || !pDev->coreEvents)
        return;

    pPointer = MIPOINTER(pDev);
    pScreen = pPointer->pScreen;
    if (!pScreen)
	return;	    /* called before ready */

    if (*x < 0 || *x >= pScreen->width || *y < 0 || *y >= pScreen->height)
    {
	pScreenPriv = GetScreenPrivate (pScreen);
	if (!pPointer->confined)
	{
	    newScreen = pScreen;
	    (*pScreenPriv->screenFuncs->CursorOffScreen) (&newScreen, x, y);
	    if (newScreen != pScreen)
	    {
		pScreen = newScreen;
		(*pScreenPriv->screenFuncs->NewEventScreen) (pDev, pScreen,
							     FALSE);
		pScreenPriv = GetScreenPrivate (pScreen);
	    	/* Smash the confine to the new screen */
                pPointer->limits.x2 = pScreen->width;
                pPointer->limits.y2 = pScreen->height;
	    }
	}
    }
    /* Constrain the sprite to the current limits. */
    if (*x < pPointer->limits.x1)
	*x = pPointer->limits.x1;
    if (*x >= pPointer->limits.x2)
	*x = pPointer->limits.x2 - 1;
    if (*y < pPointer->limits.y1)
	*y = pPointer->limits.y1;
    if (*y >= pPointer->limits.y2)
	*y = pPointer->limits.y2 - 1;

    if (pScreen->ConstrainCursorHarder)
       pScreen->ConstrainCursorHarder(pDev, pScreen, mode, x, y);

    if (pPointer->x == *x && pPointer->y == *y && 
            pPointer->pScreen == pScreen) 
        return;

    miPointerMoveNoEvent(pDev, pScreen, *x, *y);
}
Ejemplo n.º 29
0
static int
y_flip(PixmapPtr pixmap, int y)
{
	ScreenPtr screen = pixmap->drawable.pScreen;
	PixmapPtr screen_pixmap = screen->GetScreenPixmap(screen);

	if (pixmap == screen_pixmap)
		return (pixmap->drawable.height - 1) - y;
	else
		return y;
}
Ejemplo n.º 30
0
static void
VGAarbiterBlockHandler(int i,
                       pointer blockData, pointer pTimeout, pointer pReadmask)
{
    ScreenPtr pScreen = screenInfo.screens[i];
    SCREEN_PROLOG(BlockHandler);
    VGAGet(pScreen);
    pScreen->BlockHandler(i, blockData, pTimeout, pReadmask);
    VGAPut();
    SCREEN_EPILOG(BlockHandler, VGAarbiterBlockHandler);
}