Lines Matching refs:ctx

135 releaseContext(TinyDRIContext * ctx)
137 switch (ctx->state) {
139 uniDRIDestroyContext(ctx->display, ctx->screen, ctx->id);
141 drmClose(ctx->drmFD);
143 XFree(ctx->driPriv);
145 XFree(ctx->driverName);
147 XFree(ctx->curBusID);
148 uniDRICloseConnection(ctx->display, ctx->screen);
150 XCloseDisplay(ctx->display);
169 benchmarkBuffer(TinyDRIContext * ctx, unsigned long size,
181 BM_CKFATAL(drmBOCreate(ctx->drmFD, size, 0, NULL,
189 BM_CKFATAL(drmBOMap(ctx->drmFD, &buf,
210 BM_CKFATAL(drmBOUnmap(ctx->drmFD, &buf));
219 BM_CKFATAL(drmBOSetStatus(ctx->drmFD, &buf,
227 BM_CKFATAL(drmBOMap(ctx->drmFD, &buf,
247 BM_CKFATAL(drmBOUnmap(ctx->drmFD, &buf));
250 BM_CKFATAL(drmBOSetStatus(ctx->drmFD, &buf,
260 ret = drmBOSetStatus(ctx->drmFD, &buf,
271 BM_CKFATAL(drmBOUnreference(ctx->drmFD, &buf));
277 BM_CKFATAL(drmBOMap(ctx->drmFD, &buf,
298 BM_CKFATAL(drmBOUnmap(ctx->drmFD, &buf));
299 BM_CKFATAL(drmBOUnreference(ctx->drmFD, &buf));
305 testAGP(TinyDRIContext * ctx)
311 ret = benchmarkBuffer(ctx, size, ticks);
352 TinyDRIContext ctx;
355 ctx.screen = 0;
356 ctx.state = haveNothing;
357 ctx.display = XOpenDisplay(displayName);
358 if (!ctx.display) {
360 return releaseContext(&ctx);
362 ctx.state = haveDisplay;
365 uniDRIQueryDirectRenderingCapable(ctx.display, ctx.screen,
369 return releaseContext(&ctx);
372 if (!uniDRIOpenConnection(ctx.display, ctx.screen, &ctx.sAreaOffset,
373 &ctx.curBusID)) {
375 return releaseContext(&ctx);
377 ctx.state = haveConnection;
379 if (!uniDRIGetClientDriverName(ctx.display, ctx.screen,
380 &ctx.ddxDriverMajor, &ctx.ddxDriverMinor,
381 &ctx.ddxDriverPatch, &ctx.driverName)) {
383 return releaseContext(&ctx);
385 ctx.state = haveDriverName;
387 if (!uniDRIGetDeviceInfo(ctx.display, ctx.screen,
388 &ctx.fbHandle, &ctx.fbOrigin, &ctx.fbSize,
389 &ctx.fbStride, &ctx.driPrivSize, &ctx.driPriv)) {
391 return releaseContext(&ctx);
393 ctx.state = haveDriverName;
395 if ((ctx.drmFD = drmOpen(NULL, ctx.curBusID)) < 0) {
397 return releaseContext(&ctx);
399 ctx.state = haveDRM;
401 drmGetMagic(ctx.drmFD, &magic);
402 if (!uniDRIAuthConnection(ctx.display, ctx.screen, magic)) {
404 return releaseContext(&ctx);
407 ret = XMatchVisualInfo(ctx.display, ctx.screen, 24, TrueColor,
408 &ctx.visualInfo);
410 ret = XMatchVisualInfo(ctx.display, ctx.screen, 16, TrueColor,
411 &ctx.visualInfo);
414 return releaseContext(&ctx);
418 if (!uniDRICreateContext(ctx.display, ctx.screen, ctx.visualInfo.visual,
419 &ctx.id, &ctx.hwContext)) {
421 return releaseContext(&ctx);
423 ctx.state = haveContext;
425 testAGP(&ctx);
427 releaseContext(&ctx);