static void gl_ggiUpdateState(GLcontext *ctx, GLuint new_state) { ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx; GGIMESADPRINT_CORE("gl_ggiUpdateState() called\n"); /* Propogate statechange information to swrast and swrast_setup * modules. The GGI driver has no internal GL-dependent state. */ _swrast_InvalidateState(ctx, new_state); _swsetup_InvalidateState(ctx, new_state); _tnl_InvalidateState(ctx, new_state); /* XXX: Better use an assertion that bails out here on failure */ if (!LIBGGI_MESAEXT(ggi_ctx->ggi_visual)->update_state) { GGIMESADPRINT_CORE("update_state == NULL!\n"); GGIMESADPRINT_CORE("Please check your config files!\n"); ggiPanic(""); } LIBGGI_MESAEXT(ggi_ctx->ggi_visual)->update_state(ggi_ctx); }
static int GGIopen(ggi_visual *vis, struct ggi_dlhandle *dlh, const char *args, void *argptr, uint32_t *dlret) { ggi_accel_t *accel; Gx00_context_t *ctx; /* NB: The accel engine is resource 2 (1 is the ILOAD aperture, ** 0 the framebuffer) */ if (!(accel = KGI_PRIV(vis)->map_accel(vis, 2, 0, GX00_BUFFER_SIZE_ORDER, GX00_BUFFER_NUM, 0))) return GGI_ENODEVICE; if (!(ctx = (Gx00_context_t*)malloc(sizeof(*ctx)))) return GGI_ENOMEM; /* setup the accel_priv data structures */ KGI_ACCEL_PRIV(vis) = ctx; memset(ctx, 0, sizeof(*ctx)); ctx->accel = accel; ctx->hwgc_mask = 0; /* TODO: Should use -1 instead? */ /* setup the DMA buffers */ GX00_INIT(vis); /* Initializes the pitch */ GX00_WRITE_REG(vis, LIBGGI_VIRTX(vis), PITCH); /* Initializes the MACCESS fields */ { uint32_t maccess = MACCESS_ZWIDTH_ZW16; /* NB: no fogging */ switch (GT_ByPP(LIBGGI_GT(vis))) { case 1: maccess |= MACCESS_PWIDTH_PW8; break; case 2: maccess |= MACCESS_PWIDTH_PW16; if (LIBGGI_GT(vis) == GT_15BIT) maccess |= MACCESS_DIT555; /* else: GT_16BIT */ break; case 4: maccess |= MACCESS_PWIDTH_PW32; break; case 3: maccess |= MACCESS_PWIDTH_PW24; break; default: ggiPanic("Unknown depth size!"); break; } /* TODO: check? -- ortalo: maccess |= MACCESS_NODITHER; */ GX00_WRITE_REG(vis, maccess, MACCESS); } /* Initializes the destination origin */ GX00_WRITE_REG(vis, 0x0, DSTORG); /* Initializes the old-style destination origin */ GX00_WRITE_REG(vis, 0x0, YDSTORG); /* Initializes the plane mask */ GX00_WRITE_REG(vis, 0xFFFFFFFF, PLNWT); #if 0 /* Maybe not needed? TODO: Check in libggi if clipping is initialized */ /* Initializes the clipping to max */ GX00_WRITE_REG(vis, 0 | (((LIBGGI_X(vis) - 1) << CXBNDRY_CXRIGHT_SHIFT) & CXBNDRY_CXRIGHT_MASK), CXBNDRY); GX00_WRITE_REG(vis, 0, YTOP); GX00_WRITE_REG(vis, (LIBGGI_Y(vis) - 1) * LIBGGI_VIRTX(vis), YBOT); #endif vis->opdisplay->idleaccel = GGI_kgi_Gx00_idleaccel; vis->opdisplay->flush = GGI_kgi_Gx00_flush; vis->opgc->gcchanged = GGI_kgi_Gx00_gcchanged; vis->opdraw->drawhline_nc = GGI_kgi_Gx00_drawhline_nc; vis->opdraw->drawhline = GGI_kgi_Gx00_drawhline; vis->opdraw->drawvline_nc = GGI_kgi_Gx00_drawvline_nc; vis->opdraw->drawvline = GGI_kgi_Gx00_drawvline; vis->opdraw->drawbox = GGI_kgi_Gx00_drawbox; vis->opdraw->fillscreen = GGI_kgi_Gx00_fillscreen; vis->opdraw->drawline = GGI_kgi_Gx00_drawline; vis->opdraw->copybox = GGI_kgi_Gx00_copybox; /* bugs on the G400 */ vis->opdraw->getcharsize = GGI_kgi_Gx00_getcharsize; vis->opdraw->putc = GGI_kgi_Gx00_putc; /* The generic puts uses putc, so... vis->opdraw->puts = GGI_kgi_Gx00_puts; */ vis->needidleaccel = 1; vis->accelactive = 0; *dlret = GGI_DL_OPDRAW | GGI_DL_OPGC; return 0; }