Module Name: src Committed By: macallan Date: Tue Sep 10 08:49:33 UTC 2024
Modified Files: src/sys/arch/hppa/dev: gftfb.c Log Message: as suspected the Visualize EG's rectangle fill function works exactly the same as HCRX's, so apply the same trick to draw less than 32 pixel wide rectangles and get rid of the workaround To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/arch/hppa/dev/gftfb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/hppa/dev/gftfb.c diff -u src/sys/arch/hppa/dev/gftfb.c:1.19 src/sys/arch/hppa/dev/gftfb.c:1.20 --- src/sys/arch/hppa/dev/gftfb.c:1.19 Wed Aug 28 06:20:30 2024 +++ src/sys/arch/hppa/dev/gftfb.c Tue Sep 10 08:49:33 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: gftfb.c,v 1.19 2024/08/28 06:20:30 macallan Exp $ */ +/* $NetBSD: gftfb.c,v 1.20 2024/09/10 08:49:33 macallan Exp $ */ /* $OpenBSD: sti_pci.c,v 1.7 2009/02/06 22:51:04 miod Exp $ */ @@ -85,7 +85,6 @@ struct gftfb_softc { #define HW_FB 0 #define HW_FILL 1 #define HW_BLIT 2 - uint32_t sc_rect_colour, sc_rect_height; /* cursor stuff */ int sc_cursor_x, sc_cursor_y; int sc_hot_x, sc_hot_y, sc_enabled; @@ -223,8 +222,6 @@ gftfb_attach(device_t parent, device_t s sc->sc_width = sc->sc_scr.scr_cfg.scr_width; sc->sc_height = sc->sc_scr.scr_cfg.scr_height; - sc->sc_rect_colour = 0xf0000000; - sc->sc_rect_height = 0; aprint_normal_dev(sc->sc_dev, "%s at %dx%d\n", sc->sc_scr.name, sc->sc_width, sc->sc_height); @@ -654,8 +651,6 @@ gftfb_setup(struct gftfb_softc *sc) sc->sc_enabled = 0; sc->sc_video_on = 1; - sc->sc_rect_colour = 0xf0000000; - sc->sc_rect_height = 0; /* set Bt458 read mask register to all planes */ gftfb_wait(sc); @@ -869,7 +864,6 @@ gftfb_mmap(void *v, void *vs, off_t offs struct sti_rom *rom = sc->sc_base.sc_rom; paddr_t pa = -1; - if (sc->sc_mode == WSDISPLAYIO_MODE_EMUL) return -1; @@ -1038,28 +1032,32 @@ gftfb_wait_fifo(struct gftfb_softc *sc, } static void -gftfb_real_rectfill(struct gftfb_softc *sc, int x, int y, int wi, int he, +gftfb_rectfill(struct gftfb_softc *sc, int x, int y, int wi, int he, uint32_t bg) { struct sti_rom *rom = sc->sc_base.sc_rom; bus_space_tag_t memt = rom->memt; bus_space_handle_t memh = rom->regh[2]; + uint32_t mask = 0xffffffff; if (sc->sc_hwmode != HW_FILL) { - gftfb_wait_fifo(sc, 4); - /* transfer data */ - bus_space_write_stream_4(memt, memh, NGLE_REG_8, 0xffffffff); + gftfb_wait_fifo(sc, 3); /* plane mask */ bus_space_write_stream_4(memt, memh, NGLE_REG_13, 0xff); /* bitmap op */ bus_space_write_stream_4(memt, memh, NGLE_REG_14, - IBOvals(RopSrc, 0, BitmapExtent08, 0, DataDynamic, MaskOtc, 0, 0)); + IBOvals(RopSrc, 0, BitmapExtent08, 0, DataDynamic, MaskOtc, 1, 0)); /* dst bitmap access */ bus_space_write_stream_4(memt, memh, NGLE_REG_11, BA(IndexedDcd, Otc32, OtsIndirect, AddrLong, 0, BINapp0I, 0)); sc->sc_hwmode = HW_FILL; } - gftfb_wait_fifo(sc, 3); + gftfb_wait_fifo(sc, 4); + + if (wi < 32) + mask = 0xffffffff << (32 - wi); + /* transfer data */ + bus_space_write_stream_4(memt, memh, NGLE_REG_8, mask); bus_space_write_stream_4(memt, memh, NGLE_REG_35, bg); /* dst XY */ bus_space_write_stream_4(memt, memh, NGLE_REG_6, (x << 16) | y); @@ -1069,31 +1067,6 @@ gftfb_real_rectfill(struct gftfb_softc * } static void -gftfb_rectfill(struct gftfb_softc *sc, int x, int y, int wi, int he, - uint32_t bg) -{ - /* - * For some reason my 4MB VisEG always draws rectangles at least 32 - * pixels wide - no idea why, the bitblt command doesn't have this - * problem. - * So, as a workaround, we draw a 50xFontHeight rectangle to the right - * of the visible fb, keep track of the colour so we don't need to - * redraw every time, and bitblt the portion we need - */ - if (wi < 50) { - if ((bg != sc->sc_rect_colour) || - (he > sc->sc_rect_height)) { - gftfb_real_rectfill(sc, sc->sc_width + 10, 0, 50, - he, bg); - sc->sc_rect_colour = bg; - sc->sc_rect_height = he; - } - gftfb_bitblt(sc, sc->sc_width + 10, 0, x, y, wi, he, RopSrc); - } else - gftfb_real_rectfill(sc, x, y, wi, he, bg); -} - -static void gftfb_bitblt(void *cookie, int xs, int ys, int xd, int yd, int wi, int he, int rop) {