static void DDNotifyResize(struct ggi_visual *vis, int xsize, int ysize) { gii_event ev; ggi_cmddata_switchrequest *swreq; directx_priv *priv = GGIDIRECTX_PRIV(vis); DPRINT_DRAW("DDNotifyResize(%p, %dx%d) called\n", vis, xsize, ysize); if (!priv->inp) return; /* This is racy, what if window is resized and * resized back before the app gets to react * to the first resize notification? */ if (!LIBGGI_X(vis) || !LIBGGI_Y(vis)) { DPRINT_DRAW("DDNotifyResize: No old size, ignore\n"); return; } if ((LIBGGI_X(vis) == xsize) && (LIBGGI_Y(vis) == ysize)) { DPRINT_DRAW("DDNotifyResize: Same size, ignore\n"); return; } DPRINT_DRAW("DDNotifyResize: Old size %ux%u\n", LIBGGI_X(vis), LIBGGI_Y(vis)); ev.any.size= sizeof(gii_cmd_nodata_event) + sizeof(ggi_cmddata_switchrequest); ev.any.type= evCommand; ev.cmd.code= GGICMD_REQUEST_SWITCH; swreq = (ggi_cmddata_switchrequest *) ev.cmd.data; swreq->request = GGI_REQSW_MODE; swreq->mode = *LIBGGI_MODE(vis); swreq->mode.visible.x = xsize; swreq->mode.visible.y = ysize; if (swreq->mode.virt.x < xsize) swreq->mode.virt.x = xsize; if (swreq->mode.virt.y < ysize) swreq->mode.virt.y = ysize; swreq->mode.size.x = GGI_AUTO; swreq->mode.size.y = GGI_AUTO; ggControl(priv->inp->channel, GII_CMDCODE_RESIZE, &ev); }
int GGI_X_setorigin_child(struct ggi_visual *vis, int x, int y) { ggi_x_priv *priv; priv = GGIX_PRIV(vis); if (x < 0) return GGI_EARGINVAL; if (y < 0) return GGI_EARGINVAL; if (x > LIBGGI_VIRTX(vis) - LIBGGI_X(vis)) return GGI_EARGINVAL; if (y > LIBGGI_VIRTY(vis) - LIBGGI_Y(vis)) return GGI_EARGINVAL; vis->origin_x = x; vis->origin_y = y; XMoveWindow(priv->disp, priv->win, -x, - y - priv->pf_offset); GGI_X_MAYBE_SYNC(vis); return 0; }
int _ggi_palemu_Open(struct ggi_visual *vis) { int rc; ggi_palemu_priv *priv = PALEMU_PRIV(vis); DPRINT("display-palemu: Open %dx%d#%dx%d\n", LIBGGI_X(vis), LIBGGI_Y(vis), LIBGGI_VIRTX(vis), LIBGGI_VIRTY(vis)); /* set the parent mode */ rc = ggiSetMode(priv->parent, &priv->parent_mode); if (rc < 0) { DPRINT("display-palemu: Couldn't set parent mode.\n"); return rc; } DPRINT("display-palemu: parent is %d/%d\n", GT_DEPTH(priv->parent_mode.graphtype), GT_SIZE(priv->parent_mode.graphtype)); /* setup tables and choose blitter function */ switch (GT_ByPP(priv->parent_mode.graphtype)) { case 1: priv->do_blit = &blitter_1; break; case 2: priv->do_blit = &blitter_2; break; case 3: priv->do_blit = &blitter_3; break; case 4: priv->do_blit = &blitter_4; break; default: DPRINT("Unsupported pixel size '%d'.\n", GT_SIZE(priv->parent_mode.graphtype)); return GGI_ENOMATCH; } priv->palette = _ggi_malloc(256 * sizeof(ggi_color)); priv->lookup = _ggi_malloc(256 * sizeof(ggi_pixel)); priv->red_gamma = priv->green_gamma = priv->blue_gamma = 1.0; /* clear the 'dirty region' */ priv->dirty_tl.x = LIBGGI_VIRTX(vis); priv->dirty_tl.y = LIBGGI_VIRTY(vis); priv->dirty_br.x = 0; priv->dirty_br.y = 0; return 0; }
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; }