Ejemplo n.º 1
0
static void
dri2WaitGL(__GLXDRIdrawable * pdraw)
{
    __GLXDRIdrawablePrivate *priv = (__GLXDRIdrawablePrivate *) pdraw;
    XRectangle xrect;
    XserverRegion region;

    if (!priv->have_fake_front)
        return;

    xrect.x = 0;
    xrect.y = 0;
    xrect.width = priv->width;
    xrect.height = priv->height;

#ifdef __DRI2_FLUSH
    if (pdraw->psc->f)
        (*pdraw->psc->f->flush) (pdraw->driDrawable);
#endif

    region = XFixesCreateRegion(pdraw->psc->dpy, &xrect, 1);
    DRI2CopyRegion(pdraw->psc->dpy, pdraw->xDrawable, region,
                   DRI2BufferFrontLeft, DRI2BufferFakeFrontLeft);
    XFixesDestroyRegion(pdraw->psc->dpy, region);
}
Ejemplo n.º 2
0
static void
dri2CopySubBuffer(__GLXDRIdrawable *pdraw, int x, int y, int width, int height)
{
    __GLXDRIdrawablePrivate *priv = (__GLXDRIdrawablePrivate *) pdraw;
    XRectangle xrect;
    XserverRegion region;

    /* Check we have the right attachments */
    if (!priv->have_back)
        return;

    xrect.x = x;
    xrect.y = priv->height - y - height;
    xrect.width = width;
    xrect.height = height;

#ifdef __DRI2_FLUSH
    if (pdraw->psc->f)
        (*pdraw->psc->f->flush) (pdraw->driDrawable);
#endif

    region = XFixesCreateRegion(pdraw->psc->dpy, &xrect, 1);
    /* should get a fence ID back from here at some point */
    DRI2CopyRegion(pdraw->psc->dpy, pdraw->xDrawable, region,
                   DRI2BufferFrontLeft, DRI2BufferBackLeft);
    XFixesDestroyRegion(pdraw->psc->dpy, region);

    /* Refresh the fake front (if present) after we just damaged the real
     * front.
     */
    dri2WaitX(pdraw);
}
Ejemplo n.º 3
0
static void dri2_copy_swap(Display *dpy, Drawable d,
			   int width, int height, int has_front)
{
	XRectangle rect;
	XserverRegion region;

	rect.x = 0;
	rect.y = 0;
	rect.width = width;
	rect.height = height;

	region = XFixesCreateRegion(dpy, &rect, 1);
	DRI2CopyRegion(dpy, d, region, DRI2BufferFrontLeft, DRI2BufferBackLeft);
	if (has_front)
		DRI2CopyRegion(dpy, d, region, DRI2BufferFakeFrontLeft, DRI2BufferFrontLeft);
	XFixesDestroyRegion(dpy, region);
}
Ejemplo n.º 4
0
/**
 * Copy between buffers of the DRI2 drawable.
 */
void
x11_drawable_copy_buffers(struct x11_screen *xscr, Drawable drawable,
                          int x, int y, int width, int height,
                          int src_buf, int dst_buf)
{
   XRectangle rect;
   XserverRegion region;

   rect.x = x;
   rect.y = y;
   rect.width = width;
   rect.height = height;

   region = XFixesCreateRegion(xscr->dpy, &rect, 1);
   DRI2CopyRegion(xscr->dpy, drawable, region, dst_buf, src_buf);
   XFixesDestroyRegion(xscr->dpy, region);
}
Ejemplo n.º 5
0
static int
ProcDRI2CopyRegion(ClientPtr client)
{
    REQUEST(xDRI2CopyRegionReq);
    xDRI2CopyRegionReply rep;
    DrawablePtr pDrawable;
    int status;
    RegionPtr pRegion;

    REQUEST_SIZE_MATCH(xDRI2CopyRegionReq);

    if (!validDrawable(client, stuff->drawable, DixWriteAccess,
                       &pDrawable, &status))
        return status;

    VERIFY_REGION(pRegion, stuff->region, client, DixReadAccess);

    status = DRI2CopyRegion(pDrawable, pRegion, stuff->dest, stuff->src);
    if (status != Success)
        return status;

    /* CopyRegion needs to be a round trip to make sure the X server
     * queues the swap buffer rendering commands before the DRI client
     * continues rendering.  The reply has a bitmask to signal the
     * presense of optional return values as well, but we're not using
     * that yet.
     */

    rep = (xDRI2CopyRegionReply) {
        .type = X_Reply,
        .sequenceNumber = client->sequence,
        .length = 0
    };

    WriteToClient(client, sizeof(xDRI2CopyRegionReply), &rep);

    return Success;
}

static void
load_swap_reply(xDRI2SwapBuffersReply * rep, CARD64 sbc)
{
    rep->swap_hi = sbc >> 32;
    rep->swap_lo = sbc & 0xffffffff;
}
Ejemplo n.º 6
0
/**
 * Copy between buffers of the DRI2 drawable.
 */
void
x11_drawable_copy_buffers_region(struct x11_screen *xscr, Drawable drawable,
                                 int num_rects, const int *rects,
                                 int src_buf, int dst_buf)
{
   XserverRegion region;
   XRectangle *rectangles = CALLOC(num_rects, sizeof(XRectangle));

   for (int i = 0; i < num_rects; i++) {
      rectangles[i].x = rects[i * 4 + 0];
      rectangles[i].y = rects[i * 4 + 1];
      rectangles[i].width = rects[i * 4 + 2];
      rectangles[i].height = rects[i * 4 + 3];
   }

   region = XFixesCreateRegion(xscr->dpy, rectangles, num_rects);
   DRI2CopyRegion(xscr->dpy, drawable, region, dst_buf, src_buf);
   XFixesDestroyRegion(xscr->dpy, region);
   FREE(rectangles);
}
int ephyrDRI2CopyRegion(XID drawable,
		   EphyrDRI2WindowPair *pair,
		   RegionPtr pRegion,
		   unsigned int dest,
		   unsigned int src)
{
    Display *dpy = hostx_get_display ();
    XRectangle xrect;
    XserverRegion region;

    xrect.x = pRegion->extents.x1;
    xrect.y = pRegion->extents.y1;
    xrect.width  = pRegion->extents.x2 - pRegion->extents.x1;
    xrect.height = pRegion->extents.y2 - pRegion->extents.y1;

    region = XFixesCreateRegion(dpy, &xrect, 1);
    DRI2CopyRegion(dpy, pair->remote, region, dest, src);
    XFixesDestroyRegion(dpy, region);

    return Success;
}