drivers/video/fbdev/mb862xx/mb862xxfb_accel.c

Source file repositories/reference/linux-study-clean/drivers/video/fbdev/mb862xx/mb862xxfb_accel.c

File Facts

System
Linux kernel
Corpus path
drivers/video/fbdev/mb862xx/mb862xxfb_accel.c
Extension
.c
Size
8147 bytes
Lines
327
Domain
Driver Families
Bucket
drivers/video
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

if (free) {
			outreg(geo, GDC_GEO_REG_INPUT_FIFO, data[total]);
			total++;
			free--;
		} else {
			free = (u32) inreg(draw, GDC_REG_FIFO_COUNT);
		}
	}
}

static void mb86290fb_copyarea(struct fb_info *info,
			       const struct fb_copyarea *area)
{
	__u32 cmd[6];

	cmd[0] = (GDC_TYPE_SETREGISTER << 24) | (1 << 16) | GDC_REG_MODE_BITMAP;
	/* Set raster operation */
	cmd[1] = (2 << 7) | (GDC_ROP_COPY << 9);
	cmd[2] = GDC_TYPE_BLTCOPYP << 24;

	if (area->sx >= area->dx && area->sy >= area->dy)
		cmd[2] |= GDC_CMD_BLTCOPY_TOP_LEFT << 16;
	else if (area->sx >= area->dx && area->sy <= area->dy)
		cmd[2] |= GDC_CMD_BLTCOPY_BOTTOM_LEFT << 16;
	else if (area->sx <= area->dx && area->sy >= area->dy)
		cmd[2] |= GDC_CMD_BLTCOPY_TOP_RIGHT << 16;
	else
		cmd[2] |= GDC_CMD_BLTCOPY_BOTTOM_RIGHT << 16;

	cmd[3] = (area->sy << 16) | area->sx;
	cmd[4] = (area->dy << 16) | area->dx;
	cmd[5] = (area->height << 16) | area->width;
	mb862xxfb_write_fifo(6, cmd, info);
}

/*
 * Fill in the cmd array /GDC FIFO commands/ to draw a 1bit image.
 * Make sure cmd has enough room!
 */
static void mb86290fb_imageblit1(u32 *cmd, u16 step, u16 dx, u16 dy,
				 u16 width, u16 height, u32 fgcolor,
				 u32 bgcolor, const struct fb_image *image,
				 struct fb_info *info)
{
	int i;
	unsigned const char *line;
	u16 bytes;

	/* set colors and raster operation regs */
	cmd[0] = (GDC_TYPE_SETREGISTER << 24) | (1 << 16) | GDC_REG_MODE_BITMAP;
	/* Set raster operation */
	cmd[1] = (2 << 7) | (GDC_ROP_COPY << 9);
	cmd[2] =
	    (GDC_TYPE_SETCOLORREGISTER << 24) | (GDC_CMD_BODY_FORE_COLOR << 16);
	cmd[3] = fgcolor;
	cmd[4] =
	    (GDC_TYPE_SETCOLORREGISTER << 24) | (GDC_CMD_BODY_BACK_COLOR << 16);
	cmd[5] = bgcolor;

	i = 0;
	line = image->data;
	bytes = (image->width + 7) >> 3;

	/* and the image */
	cmd[6] = (GDC_TYPE_DRAWBITMAPP << 24) |
	    (GDC_CMD_BITMAP << 16) | (2 + (step * height));
	cmd[7] = (dy << 16) | dx;
	cmd[8] = (height << 16) | width;

	while (i < height) {
		memcpy(&cmd[9 + i * step], line, step << 2);
#ifdef __LITTLE_ENDIAN
		{
			int k = 0;
			for (k = 0; k < step; k++)
				cmd[9 + i * step + k] =
				    cpu_to_be32(cmd[9 + i * step + k]);
		}
#endif
		line += bytes;
		i++;
	}
}

/*
 * Fill in the cmd array /GDC FIFO commands/ to draw a 8bit image.
 * Make sure cmd has enough room!
 */
static void mb86290fb_imageblit8(u32 *cmd, u16 step, u16 dx, u16 dy,
				 u16 width, u16 height, u32 fgcolor,

Annotation

Implementation Notes