Lines Matching refs:fb

37 struct framebuffer fb;  variable
72 fb.fd = open("/dev/fb", O_RDWR); in gfx_framework_init()
73 if (fb.fd < 0) in gfx_framework_init()
77 if (ioctl(fb.fd, VIS_GETIDENTIFIER, &fb.ident) < 0 || in gfx_framework_init()
78 strcmp(fb.ident.name, "illumos_fb") != 0) { in gfx_framework_init()
79 (void) close(fb.fd); in gfx_framework_init()
80 fb.fd = -1; in gfx_framework_init()
84 if (ioctl(fb.fd, FBIOGATTR, &attr) < 0) { in gfx_framework_init()
85 (void) close(fb.fd); in gfx_framework_init()
86 fb.fd = -1; in gfx_framework_init()
91 fb.fb_height = attr.fbtype.fb_height; in gfx_framework_init()
92 fb.fb_width = attr.fbtype.fb_width; in gfx_framework_init()
93 fb.fb_depth = attr.fbtype.fb_depth; in gfx_framework_init()
94 fb.fb_size = attr.fbtype.fb_size; in gfx_framework_init()
95 fb.fb_bpp = attr.fbtype.fb_depth >> 3; in gfx_framework_init()
97 fb.fb_bpp = 2; in gfx_framework_init()
98 fb.fb_pitch = gfxfb_info->pitch; in gfx_framework_init()
99 fb.terminal_origin_x = gfxfb_info->terminal_origin_x; in gfx_framework_init()
100 fb.terminal_origin_y = gfxfb_info->terminal_origin_y; in gfx_framework_init()
101 fb.font_width = gfxfb_info->font_width; in gfx_framework_init()
102 fb.font_height = gfxfb_info->font_height; in gfx_framework_init()
104 fb.red_mask_size = gfxfb_info->red_mask_size; in gfx_framework_init()
105 fb.red_field_position = gfxfb_info->red_field_position; in gfx_framework_init()
106 fb.green_mask_size = gfxfb_info->green_mask_size; in gfx_framework_init()
107 fb.green_field_position = gfxfb_info->green_field_position; in gfx_framework_init()
108 fb.blue_mask_size = gfxfb_info->blue_mask_size; in gfx_framework_init()
109 fb.blue_field_position = gfxfb_info->blue_field_position; in gfx_framework_init()
111 fb.fb_addr = (uint8_t *)mmap(0, fb.fb_size, (PROT_READ | PROT_WRITE), in gfx_framework_init()
112 MAP_SHARED, fb.fd, 0); in gfx_framework_init()
114 if (fb.fb_addr == NULL) { in gfx_framework_init()
115 (void) close(fb.fd); in gfx_framework_init()
116 fb.fd = -1; in gfx_framework_init()
119 (void) snprintf(buf, sizeof (buf), "%d", fb.fb_height); in gfx_framework_init()
121 (void) snprintf(buf, sizeof (buf), "%d", fb.fb_width); in gfx_framework_init()
128 if (fb.fd < 0) in gfx_framework_fini()
131 (void) munmap((caddr_t)fb.fb_addr, fb.fb_size); in gfx_framework_fini()
132 (void) close(fb.fd); in gfx_framework_fini()
133 fb.fd = -1; in gfx_framework_fini()
163 if (fb.fd < 0) in gfx_fb_setpixel()
167 if (x >= fb.fb_width || y >= fb.fb_height) in gfx_fb_setpixel()
170 offset = y * fb.fb_pitch + x * fb.fb_bpp; in gfx_fb_setpixel()
171 switch (fb.fb_depth) { in gfx_fb_setpixel()
173 fb.fb_addr[offset] = c & 0xff; in gfx_fb_setpixel()
177 *(uint16_t *)(fb.fb_addr + offset) = c & 0xffff; in gfx_fb_setpixel()
180 fb.fb_addr[offset] = (c >> 16) & 0xff; in gfx_fb_setpixel()
181 fb.fb_addr[offset + 1] = (c >> 8) & 0xff; in gfx_fb_setpixel()
182 fb.fb_addr[offset + 2] = c & 0xff; in gfx_fb_setpixel()
185 *(uint32_t *)(fb.fb_addr + offset) = c; in gfx_fb_setpixel()
196 if (fb.fd < 0) in gfx_fb_drawrect()
217 if (fb.fd < 0) in gfx_term_drawrect()
220 width = fb.font_width / 4; /* line width */ in gfx_term_drawrect()
221 xshift = (fb.font_width - width) / 2; in gfx_term_drawrect()
222 yshift = (fb.font_height - width) / 2; in gfx_term_drawrect()
232 x1 = (row1 + 1) * fb.font_width + fb.terminal_origin_x; in gfx_term_drawrect()
233 y1 = col1 * fb.font_height + fb.terminal_origin_y + yshift; in gfx_term_drawrect()
234 x2 = row2 * fb.font_width + fb.terminal_origin_x; in gfx_term_drawrect()
236 y2 = col2 * fb.font_height + fb.terminal_origin_y; in gfx_term_drawrect()
237 y2 += fb.font_height - yshift - width; in gfx_term_drawrect()
243 x1 = row1 * fb.font_width + fb.terminal_origin_x + xshift; in gfx_term_drawrect()
244 y1 = col1 * fb.font_height + fb.terminal_origin_y; in gfx_term_drawrect()
245 y1 += fb.font_height; in gfx_term_drawrect()
246 y2 = col2 * fb.font_height + fb.terminal_origin_y; in gfx_term_drawrect()
248 x1 = row2 * fb.font_width + fb.terminal_origin_x; in gfx_term_drawrect()
249 x1 += fb.font_width - xshift - width; in gfx_term_drawrect()
253 x1 = row1 * fb.font_width + fb.terminal_origin_x + xshift; in gfx_term_drawrect()
254 y1 = col1 * fb.font_height + fb.terminal_origin_y; in gfx_term_drawrect()
255 y1 += fb.font_height; in gfx_term_drawrect()
257 x2 = row1 * fb.font_width + fb.terminal_origin_x; in gfx_term_drawrect()
258 x2 += fb.font_width; in gfx_term_drawrect()
259 y2 = col1 * fb.font_height + fb.terminal_origin_y + yshift; in gfx_term_drawrect()
264 x1 = row1 * fb.font_width + fb.terminal_origin_x; in gfx_term_drawrect()
265 x1 += fb.font_width; in gfx_term_drawrect()
266 y1 = col2 * fb.font_height + fb.terminal_origin_y; in gfx_term_drawrect()
267 y1 += fb.font_height - yshift; in gfx_term_drawrect()
268 x2 = row1 * fb.font_width + fb.terminal_origin_x + xshift; in gfx_term_drawrect()
269 y2 = col2 * fb.font_height + fb.terminal_origin_y; in gfx_term_drawrect()
274 x1 = row2 * fb.font_width + fb.terminal_origin_x; in gfx_term_drawrect()
275 y1 = col1 * fb.font_height + fb.terminal_origin_y + yshift; in gfx_term_drawrect()
276 x2 = row2 * fb.font_width + fb.terminal_origin_x; in gfx_term_drawrect()
277 x2 += fb.font_width - xshift - width; in gfx_term_drawrect()
278 y2 = col1 * fb.font_height + fb.terminal_origin_y; in gfx_term_drawrect()
279 y2 += fb.font_height; in gfx_term_drawrect()
284 x1 = row2 * fb.font_width + fb.terminal_origin_x; in gfx_term_drawrect()
285 y1 = col2 * fb.font_height + fb.terminal_origin_y; in gfx_term_drawrect()
286 y1 += fb.font_height - yshift; in gfx_term_drawrect()
287 x2 = row2 * fb.font_width + fb.terminal_origin_x; in gfx_term_drawrect()
288 x2 += fb.font_width - xshift - width; in gfx_term_drawrect()
289 y2 = col2 * fb.font_height + fb.terminal_origin_y; in gfx_term_drawrect()
300 if (fb.fd < 0) in gfx_fb_line()
354 if (fb.fd < 0) in gfx_fb_bezier()
430 if (fb.fd < 0) { in gfx_fb_putimage()
442 if (ux1 > fb.fb_width || uy1 > fb.fb_height) { in gfx_fb_putimage()
478 if (ux2 > fb.fb_width || uy2 > fb.fb_height) { in gfx_fb_putimage()
499 ux2 = fb.fb_width - fb.terminal_origin_x; in gfx_fb_putimage()
508 uy2 = fb.fb_height - fb.terminal_origin_y; in gfx_fb_putimage()
531 data = malloc(fwidth * fheight * fb.fb_bpp); in gfx_fb_putimage()
571 j = (y * fwidth + x) * fb.fb_bpp; in gfx_fb_putimage()
622 r >> (8 - fb.red_mask_size) in gfx_fb_putimage()
623 << fb.red_field_position | in gfx_fb_putimage()
624 g >> (8 - fb.green_mask_size) in gfx_fb_putimage()
625 << fb.green_field_position | in gfx_fb_putimage()
626 b >> (8 - fb.blue_mask_size) in gfx_fb_putimage()
627 << fb.blue_field_position; in gfx_fb_putimage()
629 switch (fb.fb_depth) { in gfx_fb_putimage()
742 if (col >= fb.fb_width || row >= fb.fb_height || in gfx_fb_cons_display()
743 col + width > fb.fb_width || row + height > fb.fb_height) in gfx_fb_cons_display()
746 size = width * fb.fb_bpp; in gfx_fb_cons_display()
747 fbp = fb.fb_addr + col * fb.fb_bpp + row * fb.fb_pitch; in gfx_fb_cons_display()
751 uint8_t *dest = fbp + i * fb.fb_pitch; in gfx_fb_cons_display()
753 bitmap_cpy(dest, src, size, fb.fb_bpp); in gfx_fb_cons_display()