void OpcodeState::unfullscreen( void ) { XDestroyWindow( display, window ); /* adjust width and height of displayed image */ if ( sar > 1 ) { width = lrint( (double)dispwidth * sar ); height = dispheight; } else { width = dispwidth; height = lrint( (double)dispheight / sar ); } window_setup(); if ( !glXMakeCurrent( display, window, context ) ) { fprintf( stderr, "Could not reactivate OpenGL.\n" ); throw DisplayError(); } OpenGLDisplay::GLcheck( "glXMakeCurrent" ); reset_viewport(); XMapRaised( display, window ); paint(); }
/** * @brief Fill an area with a bitmap. * @note Optional - The high level driver can emulate using software. * * @param[in] x, y The start filled area * @param[in] cx, cy The width and height to be filled * @param[in] srcx, srcy The bitmap position to start the fill from * @param[in] srccx The width of a line in the bitmap. * @param[in] buffer The pixels to use to fill the area. * * @notapi */ void GDISP_LLD(blitareaex)(coord_t x, coord_t y, coord_t cx, coord_t cy, coord_t srcx, coord_t srcy, coord_t srccx, const pixel_t *buffer) { coord_t endx, endy; unsigned lg; #if GDISP_NEED_VALIDATION || GDISP_NEED_CLIP if (x < GDISP.clipx0) { cx -= GDISP.clipx0 - x; srcx += GDISP.clipx0 - x; x = GDISP.clipx0; } if (y < GDISP.clipy0) { cy -= GDISP.clipy0 - y; srcy += GDISP.clipy0 - y; y = GDISP.clipy0; } if (srcx+cx > srccx) cx = srccx - srcx; if (cx <= 0 || cy <= 0 || x >= GDISP.clipx1 || y >= GDISP.clipy1) return; if (x+cx > GDISP.clipx1) cx = GDISP.clipx1 - x; if (y+cy > GDISP.clipy1) cy = GDISP.clipy1 - y; #endif acquire_bus(); set_viewport(x, y, cx, cy); stream_start(); endx = srcx + cx; endy = y + cy; lg = srccx - cx; buffer += srcx + srcy * srccx; for(; y < endy; y++, buffer += lg) for(x=srcx; x < endx; x++) write_data(*buffer++); stream_stop(); reset_viewport(); release_bus(); }
/** * @brief Fill an area with a color. * @note Optional - The high level driver can emulate using software. * * @param[in] x, y The start filled area * @param[in] cx, cy The width and height to be filled * @param[in] color The color of the fill * * @notapi */ void GDISP_LLD(fillarea)(coord_t x, coord_t y, coord_t cx, coord_t cy, color_t color) { unsigned i, area; #if GDISP_NEED_VALIDATION || GDISP_NEED_CLIP if (x < GDISP.clipx0) { cx -= GDISP.clipx0 - x; x = GDISP.clipx0; } if (y < GDISP.clipy0) { cy -= GDISP.clipy0 - y; y = GDISP.clipy0; } if (cx <= 0 || cy <= 0 || x >= GDISP.clipx1 || y >= GDISP.clipy1) return; if (x+cx > GDISP.clipx1) cx = GDISP.clipx1 - x; if (y+cy > GDISP.clipy1) cy = GDISP.clipy1 - y; #endif area = cx*cy; acquire_bus(); set_viewport(x, y, cx, cy); stream_start(); for(i = 0; i < area; i++) write_data(color); stream_stop(); reset_viewport(); release_bus(); }
/** * @brief Scroll vertically a section of the screen. * @note Optional. * @note If x,y + cx,cy is off the screen, the result is undefined. * @note If lines is >= cy, it is equivelent to a area fill with bgcolor. * * @param[in] x, y The start of the area to be scrolled * @param[in] cx, cy The size of the area to be scrolled * @param[in] lines The number of lines to scroll (Can be positive or negative) * @param[in] bgcolor The color to fill the newly exposed area. * * @notapi */ void GDISP_LLD(verticalscroll)(coord_t x, coord_t y, coord_t cx, coord_t cy, int lines, color_t bgcolor) { /* This is marked as "TODO: Test this" in the original GLCD driver. * For now we just leave the GDISP_HARDWARE_SCROLL off. */ static color_t buf[((GDISP_SCREEN_HEIGHT > GDISP_SCREEN_WIDTH ) ? GDISP_SCREEN_HEIGHT : GDISP_SCREEN_WIDTH)]; coord_t row0, row1; unsigned i, gap, abslines; #if GDISP_NEED_VALIDATION || GDISP_NEED_CLIP if (x < GDISP.clipx0) { cx -= GDISP.clipx0 - x; x = GDISP.clipx0; } if (y < GDISP.clipy0) { cy -= GDISP.clipy0 - y; y = GDISP.clipy0; } if (!lines || cx <= 0 || cy <= 0 || x >= GDISP.clipx1 || y >= GDISP.clipy1) return; if (x+cx > GDISP.clipx1) cx = GDISP.clipx1 - x; if (y+cy > GDISP.clipy1) cy = GDISP.clipy1 - y; #endif abslines = lines < 0 ? -lines : lines; acquire_bus(); if (abslines >= cy) { abslines = cy; gap = 0; } else { gap = cy - abslines; for(i = 0; i < gap; i++) { if(lines > 0) { row0 = y + i + lines; row1 = y + i; } else { row0 = (y - i - 1) + lines; row1 = (y - i - 1); } /* read row0 into the buffer and then write at row1*/ set_viewport(x, row0, cx, 1); lld_lcdReadStreamStart(); lld_lcdReadStream(buf, cx); lld_lcdReadStreamStop(); set_viewport(x, row1, cx, 1); stream_start(); write_data(buf, cx); stream_stop(); } } /* fill the remaining gap */ set_viewport(x, lines > 0 ? (y+gap) : y, cx, abslines); stream_start(); gap = cx*abslines; for(i = 0; i < gap; i++) write_data(bgcolor); stream_stop(); reset_viewport(); release_bus(); }
/** * @brief Clear the display. * @note Optional - The high level driver can emulate using software. * * @param[in] color The color of the pixel * * @notapi */ void lld_gdisp_clear(color_t color) { unsigned i; acquire_bus(); reset_viewport(); set_cursor(0, 0); stream_start(); for(i = 0; i < GDISP_SCREEN_WIDTH * GDISP_SCREEN_HEIGHT; i++) write_data(color); stream_stop(); release_bus(); }
void OpcodeState::dofullscreen( void ) { /* move on top */ XEvent xev; Atom wm_state = XInternAtom( display, "_NET_WM_STATE", False); Atom fullscreen = XInternAtom( display, "_NET_WM_STATE_FULLSCREEN", False); memset(&xev, 0, sizeof(xev)); xev.type = ClientMessage; xev.xclient.window = window; xev.xclient.message_type = wm_state; xev.xclient.format = 32; xev.xclient.data.l[0] = 1; xev.xclient.data.l[1] = fullscreen; xev.xclient.data.l[2] = 0; XSendEvent( display, DefaultRootWindow( display ), False, SubstructureNotifyMask, &xev); /* hide cursor */ Cursor thecursor; Pixmap thepixmap; char no_data[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; XColor bg; thepixmap = XCreateBitmapFromData( display, window, no_data, 8, 8 ); thecursor = XCreatePixmapCursor( display, thepixmap, thepixmap, &bg, &bg, 0, 0 ); XDefineCursor( display, window, thecursor ); XFreeCursor( display, thecursor ); XFreePixmap( display, thepixmap ); /* adjust width and height of displayed image */ width = DisplayWidth( display, DefaultScreen( display ) ); height = lrint( (double)dispheight * (double)width / ((double)dispwidth * sar) ); if ( (signed)height > DisplayHeight( display, DefaultScreen( display ) ) ) { height = DisplayHeight( display, DefaultScreen( display ) ); width = lrint( (double)dispwidth * (double) sar * (double)height / (double)dispheight ); } reset_viewport(); OpenGLDisplay::GLcheck( "fullscreen" ); paint(); }
bool_t GDISP_LLD(init)(void) { /* initialize the hardware */ init_board(); /* Hardware reset */ setpin_reset(TRUE); delayms(20); setpin_reset(TRUE); delayms(20); /* Get the bus for the following initialisation commands */ acquire_bus(); write_reg(0x11,0x2004); write_reg(0x13,0xCC00); write_reg(0x15,0x2600); write_reg(0x14,0x252A); write_reg(0x12,0x0033); write_reg(0x13,0xCC04); delayms(1); write_reg(0x13,0xCC06); delayms(1); write_reg(0x13,0xCC4F); delayms(1); write_reg(0x13,0x674F); write_reg(0x11,0x2003); delayms(1); // Gamma Setting write_reg(0x30,0x2609); write_reg(0x31,0x242C); write_reg(0x32,0x1F23); write_reg(0x33,0x2425); write_reg(0x34,0x2226); write_reg(0x35,0x2523); write_reg(0x36,0x1C1A); write_reg(0x37,0x131D); write_reg(0x38,0x0B11); write_reg(0x39,0x1210); write_reg(0x3A,0x1315); write_reg(0x3B,0x3619); write_reg(0x3C,0x0D00); write_reg(0x3D,0x000D); write_reg(0x16,0x0007); write_reg(0x02,0x0013); write_reg(0x03,0x0003); write_reg(0x01,0x0127); delayms(1); write_reg(0x08,0x0303); write_reg(0x0A,0x000B); write_reg(0x0B,0x0003); write_reg(0x0C,0x0000); write_reg(0x41,0x0000); write_reg(0x50,0x0000); write_reg(0x60,0x0005); write_reg(0x70,0x000B); write_reg(0x71,0x0000); write_reg(0x78,0x0000); write_reg(0x7A,0x0000); write_reg(0x79,0x0007); write_reg(0x07,0x0051); delayms(1); write_reg(0x07,0x0053); write_reg(0x79,0x0000); reset_viewport(); set_backlight(GDISP_INITIAL_BACKLIGHT); /* Now initialise the GDISP structure */ GDISP.Width = GDISP_SCREEN_WIDTH; GDISP.Height = GDISP_SCREEN_HEIGHT; GDISP.Orientation = GDISP_ROTATE_0; GDISP.Powermode = powerOn; GDISP.Backlight = 100; GDISP.Contrast = 50; #if GDISP_NEED_VALIDATION || GDISP_NEED_CLIP GDISP.clipx0 = 0; GDISP.clipy0 = 0; GDISP.clipx1 = GDISP.Width; GDISP.clipy1 = GDISP.Height; #endif return TRUE; }
static void fd4_clear(struct fd_context *ctx, unsigned buffers, const union pipe_color_union *color, double depth, unsigned stencil) { struct fd4_context *fd4_ctx = fd4_context(ctx); struct fd_ringbuffer *ring = ctx->ring; struct pipe_framebuffer_state *pfb = &ctx->framebuffer; unsigned dirty = ctx->dirty; unsigned ce, i; struct fd4_emit emit = { .vtx = &fd4_ctx->solid_vbuf_state, .prog = &ctx->solid_prog, .key = { .half_precision = true, }, }; uint32_t colr = 0; if ((buffers & PIPE_CLEAR_COLOR) && pfb->nr_cbufs) colr = pack_rgba(pfb->cbufs[0]->format, color->f); dirty &= FD_DIRTY_FRAMEBUFFER | FD_DIRTY_SCISSOR; dirty |= FD_DIRTY_PROG; emit.dirty = dirty; OUT_PKT0(ring, REG_A4XX_PC_PRIM_VTX_CNTL, 1); OUT_RING(ring, A4XX_PC_PRIM_VTX_CNTL_PROVOKING_VTX_LAST); /* emit generic state now: */ fd4_emit_state(ctx, ring, &emit); reset_viewport(ring, pfb); if (buffers & PIPE_CLEAR_DEPTH) { OUT_PKT0(ring, REG_A4XX_RB_DEPTH_CONTROL, 1); OUT_RING(ring, A4XX_RB_DEPTH_CONTROL_Z_WRITE_ENABLE | A4XX_RB_DEPTH_CONTROL_Z_ENABLE | A4XX_RB_DEPTH_CONTROL_ZFUNC(FUNC_ALWAYS)); fd_wfi(ctx, ring); OUT_PKT0(ring, REG_A4XX_GRAS_CL_VPORT_ZOFFSET_0, 2); OUT_RING(ring, A4XX_GRAS_CL_VPORT_ZOFFSET_0(0.0)); OUT_RING(ring, A4XX_GRAS_CL_VPORT_ZSCALE_0(depth)); ctx->dirty |= FD_DIRTY_VIEWPORT; } else { OUT_PKT0(ring, REG_A4XX_RB_DEPTH_CONTROL, 1); OUT_RING(ring, A4XX_RB_DEPTH_CONTROL_ZFUNC(FUNC_NEVER)); } if (buffers & PIPE_CLEAR_STENCIL) { OUT_PKT0(ring, REG_A4XX_RB_STENCILREFMASK, 2); OUT_RING(ring, A4XX_RB_STENCILREFMASK_STENCILREF(stencil) | A4XX_RB_STENCILREFMASK_STENCILMASK(stencil) | A4XX_RB_STENCILREFMASK_STENCILWRITEMASK(0xff)); OUT_RING(ring, A4XX_RB_STENCILREFMASK_STENCILREF(0) | A4XX_RB_STENCILREFMASK_STENCILMASK(0) | 0xff000000 | // XXX ??? A4XX_RB_STENCILREFMASK_STENCILWRITEMASK(0xff)); OUT_PKT0(ring, REG_A4XX_RB_STENCIL_CONTROL, 2); OUT_RING(ring, A4XX_RB_STENCIL_CONTROL_STENCIL_ENABLE | A4XX_RB_STENCIL_CONTROL_FUNC(FUNC_ALWAYS) | A4XX_RB_STENCIL_CONTROL_FAIL(STENCIL_KEEP) | A4XX_RB_STENCIL_CONTROL_ZPASS(STENCIL_REPLACE) | A4XX_RB_STENCIL_CONTROL_ZFAIL(STENCIL_KEEP) | A4XX_RB_STENCIL_CONTROL_FUNC_BF(FUNC_NEVER) | A4XX_RB_STENCIL_CONTROL_FAIL_BF(STENCIL_KEEP) | A4XX_RB_STENCIL_CONTROL_ZPASS_BF(STENCIL_KEEP) | A4XX_RB_STENCIL_CONTROL_ZFAIL_BF(STENCIL_KEEP)); OUT_RING(ring, 0x00000000); /* RB_STENCIL_CONTROL2 */ } else { OUT_PKT0(ring, REG_A4XX_RB_STENCILREFMASK, 2); OUT_RING(ring, A4XX_RB_STENCILREFMASK_STENCILREF(0) | A4XX_RB_STENCILREFMASK_STENCILMASK(0) | A4XX_RB_STENCILREFMASK_STENCILWRITEMASK(0)); OUT_RING(ring, A4XX_RB_STENCILREFMASK_BF_STENCILREF(0) | A4XX_RB_STENCILREFMASK_BF_STENCILMASK(0) | A4XX_RB_STENCILREFMASK_BF_STENCILWRITEMASK(0)); OUT_PKT0(ring, REG_A4XX_RB_STENCIL_CONTROL, 2); OUT_RING(ring, A4XX_RB_STENCIL_CONTROL_FUNC(FUNC_NEVER) | A4XX_RB_STENCIL_CONTROL_FAIL(STENCIL_KEEP) | A4XX_RB_STENCIL_CONTROL_ZPASS(STENCIL_KEEP) | A4XX_RB_STENCIL_CONTROL_ZFAIL(STENCIL_KEEP) | A4XX_RB_STENCIL_CONTROL_FUNC_BF(FUNC_NEVER) | A4XX_RB_STENCIL_CONTROL_FAIL_BF(STENCIL_KEEP) | A4XX_RB_STENCIL_CONTROL_ZPASS_BF(STENCIL_KEEP) | A4XX_RB_STENCIL_CONTROL_ZFAIL_BF(STENCIL_KEEP)); OUT_RING(ring, 0x00000000); /* RB_STENCIL_CONTROL2 */ } if (buffers & PIPE_CLEAR_COLOR) { OUT_PKT0(ring, REG_A4XX_RB_ALPHA_CONTROL, 1); OUT_RING(ring, A4XX_RB_ALPHA_CONTROL_ALPHA_TEST_FUNC(FUNC_NEVER)); ce = 0xf; } else { ce = 0x0; } for (i = 0; i < 8; i++) { OUT_PKT0(ring, REG_A4XX_RB_MRT_CONTROL(i), 1); OUT_RING(ring, A4XX_RB_MRT_CONTROL_FASTCLEAR | A4XX_RB_MRT_CONTROL_B11 | A4XX_RB_MRT_CONTROL_COMPONENT_ENABLE(ce)); OUT_PKT0(ring, REG_A4XX_RB_MRT_BLEND_CONTROL(i), 1); OUT_RING(ring, A4XX_RB_MRT_BLEND_CONTROL_RGB_SRC_FACTOR(FACTOR_ONE) | A4XX_RB_MRT_BLEND_CONTROL_RGB_BLEND_OPCODE(BLEND_DST_PLUS_SRC) | A4XX_RB_MRT_BLEND_CONTROL_RGB_DEST_FACTOR(FACTOR_ZERO) | A4XX_RB_MRT_BLEND_CONTROL_ALPHA_SRC_FACTOR(FACTOR_ONE) | A4XX_RB_MRT_BLEND_CONTROL_ALPHA_BLEND_OPCODE(BLEND_DST_PLUS_SRC) | A4XX_RB_MRT_BLEND_CONTROL_ALPHA_DEST_FACTOR(FACTOR_ZERO)); } fd4_emit_vertex_bufs(ring, &emit); OUT_PKT0(ring, REG_A4XX_GRAS_ALPHA_CONTROL, 1); OUT_RING(ring, 0x0); /* XXX GRAS_ALPHA_CONTROL */ OUT_PKT0(ring, REG_A4XX_GRAS_CLEAR_CNTL, 1); OUT_RING(ring, 0x00000000); OUT_PKT0(ring, REG_A4XX_RB_CLEAR_COLOR_DW0, 4); OUT_RING(ring, colr); /* RB_CLEAR_COLOR_DW0 */ OUT_RING(ring, colr); /* RB_CLEAR_COLOR_DW1 */ OUT_RING(ring, colr); /* RB_CLEAR_COLOR_DW2 */ OUT_RING(ring, colr); /* RB_CLEAR_COLOR_DW3 */ /* until fastclear works: */ fd4_emit_constant(ring, SB_FRAG_SHADER, 0, 0, 4, color->ui, NULL); OUT_PKT0(ring, REG_A4XX_VFD_INDEX_OFFSET, 2); OUT_RING(ring, 0); /* VFD_INDEX_OFFSET */ OUT_RING(ring, 0); /* ??? UNKNOWN_2209 */ OUT_PKT0(ring, REG_A4XX_PC_RESTART_INDEX, 1); OUT_RING(ring, 0xffffffff); /* PC_RESTART_INDEX */ OUT_PKT3(ring, CP_UNKNOWN_1A, 1); OUT_RING(ring, 0x00000001); fd4_draw(ctx, ring, DI_PT_RECTLIST, USE_VISIBILITY, DI_SRC_SEL_AUTO_INDEX, 2, INDEX_SIZE_IGN, 0, 0, NULL); OUT_PKT3(ring, CP_UNKNOWN_1A, 1); OUT_RING(ring, 0x00000000); OUT_PKT0(ring, REG_A4XX_GRAS_CLEAR_CNTL, 1); OUT_RING(ring, A4XX_GRAS_CLEAR_CNTL_NOT_FASTCLEAR); OUT_PKT0(ring, REG_A4XX_GRAS_SC_CONTROL, 1); OUT_RING(ring, A4XX_GRAS_SC_CONTROL_RENDER_MODE(RB_RENDERING_PASS) | A4XX_GRAS_SC_CONTROL_MSAA_DISABLE | A4XX_GRAS_SC_CONTROL_MSAA_SAMPLES(MSAA_ONE) | A4XX_GRAS_SC_CONTROL_RASTER_MODE(0)); }