Lines Matching full:var
56 struct fb_var_screeninfo *var = &fbi->var; in draw_pixel() local
59 const unsigned bytespp = var->bits_per_pixel >> 3; in draw_pixel()
66 if (var->bits_per_pixel == 16) { in draw_pixel()
75 } else if (var->bits_per_pixel == 24) { in draw_pixel()
82 } else if (var->bits_per_pixel == 32) { in draw_pixel()
91 struct fb_var_screeninfo *var = &fbi->var; in fill_fb() local
92 const short w = var->xres_virtual; in fill_fb()
93 const short h = var->yres_virtual; in fill_fb()
125 if (var->bits_per_pixel == 16) { in fill_fb()
272 static bool cmp_var_to_colormode(struct fb_var_screeninfo *var, in cmp_var_to_colormode() argument
275 if (var->bits_per_pixel == 0 || in cmp_var_to_colormode()
276 var->red.length == 0 || in cmp_var_to_colormode()
277 var->blue.length == 0 || in cmp_var_to_colormode()
278 var->green.length == 0) in cmp_var_to_colormode()
281 return var->bits_per_pixel == color->bits_per_pixel && in cmp_var_to_colormode()
282 cmp_component(&var->red, &color->red) && in cmp_var_to_colormode()
283 cmp_component(&var->green, &color->green) && in cmp_var_to_colormode()
284 cmp_component(&var->blue, &color->blue) && in cmp_var_to_colormode()
285 cmp_component(&var->transp, &color->transp); in cmp_var_to_colormode()
288 static void assign_colormode_to_var(struct fb_var_screeninfo *var, in assign_colormode_to_var() argument
291 var->bits_per_pixel = color->bits_per_pixel; in assign_colormode_to_var()
292 var->nonstd = color->nonstd; in assign_colormode_to_var()
293 var->red = color->red; in assign_colormode_to_var()
294 var->green = color->green; in assign_colormode_to_var()
295 var->blue = color->blue; in assign_colormode_to_var()
296 var->transp = color->transp; in assign_colormode_to_var()
299 static int fb_mode_to_dss_mode(struct fb_var_screeninfo *var, in fb_mode_to_dss_mode() argument
306 if (var->nonstd) { in fb_mode_to_dss_mode()
309 if (var->nonstd == m->nonstd) { in fb_mode_to_dss_mode()
310 assign_colormode_to_var(var, m); in fb_mode_to_dss_mode()
322 if (cmp_var_to_colormode(var, m)) { in fb_mode_to_dss_mode()
323 assign_colormode_to_var(var, m); in fb_mode_to_dss_mode()
331 switch (var->bits_per_pixel) { in fb_mode_to_dss_mode()
363 assign_colormode_to_var(var, m); in fb_mode_to_dss_mode()
372 static int check_fb_res_bounds(struct fb_var_screeninfo *var) in check_fb_res_bounds() argument
380 if (var->xres_virtual == 0) in check_fb_res_bounds()
381 var->xres_virtual = var->xres; in check_fb_res_bounds()
383 if (var->yres_virtual == 0) in check_fb_res_bounds()
384 var->yres_virtual = var->yres; in check_fb_res_bounds()
386 if (var->xres_virtual < xres_min || var->yres_virtual < yres_min) in check_fb_res_bounds()
389 if (var->xres < xres_min) in check_fb_res_bounds()
390 var->xres = xres_min; in check_fb_res_bounds()
391 if (var->yres < yres_min) in check_fb_res_bounds()
392 var->yres = yres_min; in check_fb_res_bounds()
393 if (var->xres > xres_max) in check_fb_res_bounds()
394 var->xres = xres_max; in check_fb_res_bounds()
395 if (var->yres > yres_max) in check_fb_res_bounds()
396 var->yres = yres_max; in check_fb_res_bounds()
398 if (var->xres > var->xres_virtual) in check_fb_res_bounds()
399 var->xres = var->xres_virtual; in check_fb_res_bounds()
400 if (var->yres > var->yres_virtual) in check_fb_res_bounds()
401 var->yres = var->yres_virtual; in check_fb_res_bounds()
407 struct fb_var_screeninfo *var) in shrink_height() argument
410 var->yres_virtual = max_frame_size / in shrink_height()
411 (var->xres_virtual * var->bits_per_pixel >> 3); in shrink_height()
413 if (var->yres_virtual < OMAPFB_PLANE_YRES_MIN) in shrink_height()
414 var->yres_virtual = OMAPFB_PLANE_YRES_MIN; in shrink_height()
416 if (var->yres > var->yres_virtual) in shrink_height()
417 var->yres = var->yres_virtual; in shrink_height()
421 struct fb_var_screeninfo *var) in shrink_width() argument
424 var->xres_virtual = max_frame_size / var->yres_virtual / in shrink_width()
425 (var->bits_per_pixel >> 3); in shrink_width()
427 if (var->xres_virtual < OMAPFB_PLANE_XRES_MIN) in shrink_width()
428 var->xres_virtual = OMAPFB_PLANE_XRES_MIN; in shrink_width()
430 if (var->xres > var->xres_virtual) in shrink_width()
431 var->xres = var->xres_virtual; in shrink_width()
435 const struct fb_var_screeninfo *var) in check_vrfb_fb_size() argument
437 unsigned long min_phys_size = omap_vrfb_min_phys_size(var->xres_virtual, in check_vrfb_fb_size()
438 var->yres_virtual, var->bits_per_pixel >> 3); in check_vrfb_fb_size()
444 struct fb_var_screeninfo *var) in check_fb_size() argument
447 int bytespp = var->bits_per_pixel >> 3; in check_fb_size()
448 unsigned long line_size = var->xres_virtual * bytespp; in check_fb_size()
452 if (check_vrfb_fb_size(max_frame_size, var)) in check_fb_size()
454 max_frame_size, var->xres_virtual, bytespp) * in check_fb_size()
455 line_size, var); in check_fb_size()
457 if (check_vrfb_fb_size(max_frame_size, var)) { in check_fb_size()
467 if (line_size * var->yres_virtual > max_frame_size) in check_fb_size()
468 shrink_height(max_frame_size, var); in check_fb_size()
470 if (line_size * var->yres_virtual > max_frame_size) { in check_fb_size()
471 shrink_width(max_frame_size, var); in check_fb_size()
472 line_size = var->xres_virtual * bytespp; in check_fb_size()
475 if (line_size * var->yres_virtual > max_frame_size) { in check_fb_size()
495 struct fb_var_screeninfo *var = &fbi->var; in setup_vrfb_rotation() local
508 r = fb_mode_to_dss_mode(var, &mode); in setup_vrfb_rotation()
512 bytespp = var->bits_per_pixel >> 3; in setup_vrfb_rotation()
527 else if (vrfb->xres != var->xres_virtual || in setup_vrfb_rotation()
528 vrfb->yres != var->yres_virtual) in setup_vrfb_rotation()
544 var->xres_virtual, in setup_vrfb_rotation()
545 var->yres_virtual, in setup_vrfb_rotation()
549 r = omap_vrfb_map_angle(vrfb, var->yres_virtual, 0); in setup_vrfb_rotation()
558 switch (var->nonstd) { in setup_vrfb_rotation()
562 (OMAP_VRFB_LINE_LEN * var->bits_per_pixel) >> 2; in setup_vrfb_rotation()
566 (OMAP_VRFB_LINE_LEN * var->bits_per_pixel) >> 3; in setup_vrfb_rotation()
570 fix->smem_len = var->yres_virtual * fix->line_length; in setup_vrfb_rotation()
576 struct fb_var_screeninfo *var) in dss_mode_to_fb_mode() argument
583 assign_colormode_to_var(var, mode); in dss_mode_to_fb_mode()
593 struct fb_var_screeninfo *var = &fbi->var; in set_fb_fix() local
604 switch (var->nonstd) { in set_fb_fix()
608 (OMAP_VRFB_LINE_LEN * var->bits_per_pixel) >> 2; in set_fb_fix()
612 (OMAP_VRFB_LINE_LEN * var->bits_per_pixel) >> 3; in set_fb_fix()
616 fix->smem_len = var->yres_virtual * fix->line_length; in set_fb_fix()
619 (var->xres_virtual * var->bits_per_pixel) >> 3; in set_fb_fix()
627 if (var->nonstd) in set_fb_fix()
630 switch (var->bits_per_pixel) { in set_fb_fix()
653 /* check new var and possibly modify it to be ok */
654 int check_fb_var(struct fb_info *fbi, struct fb_var_screeninfo *var) in check_fb_var() argument
666 r = fb_mode_to_dss_mode(var, &mode); in check_fb_var()
668 DBG("cannot convert var to omap dss mode\n"); in check_fb_var()
679 if (var->rotate > 3) in check_fb_var()
682 if (check_fb_res_bounds(var)) in check_fb_var()
686 if (ofbi->region->size != 0 && check_fb_size(ofbi, var)) in check_fb_var()
689 if (var->xres + var->xoffset > var->xres_virtual) in check_fb_var()
690 var->xoffset = var->xres_virtual - var->xres; in check_fb_var()
691 if (var->yres + var->yoffset > var->yres_virtual) in check_fb_var()
692 var->yoffset = var->yres_virtual - var->yres; in check_fb_var()
695 var->xres, var->yres, in check_fb_var()
696 var->xres_virtual, var->yres_virtual); in check_fb_var()
701 var->width = DIV_ROUND_CLOSEST(w, 1000); in check_fb_var()
702 var->height = DIV_ROUND_CLOSEST(h, 1000); in check_fb_var()
704 var->height = -1; in check_fb_var()
705 var->width = -1; in check_fb_var()
708 var->grayscale = 0; in check_fb_var()
715 var->pixclock = timings.pixelclock != 0 ? in check_fb_var()
718 var->left_margin = timings.hbp; in check_fb_var()
719 var->right_margin = timings.hfp; in check_fb_var()
720 var->upper_margin = timings.vbp; in check_fb_var()
721 var->lower_margin = timings.vfp; in check_fb_var()
722 var->hsync_len = timings.hsw; in check_fb_var()
723 var->vsync_len = timings.vsw; in check_fb_var()
724 var->sync |= timings.hsync_level == OMAPDSS_SIG_ACTIVE_HIGH ? in check_fb_var()
726 var->sync |= timings.vsync_level == OMAPDSS_SIG_ACTIVE_HIGH ? in check_fb_var()
728 var->vmode = timings.interlace ? in check_fb_var()
731 var->pixclock = 0; in check_fb_var()
732 var->left_margin = 0; in check_fb_var()
733 var->right_margin = 0; in check_fb_var()
734 var->upper_margin = 0; in check_fb_var()
735 var->lower_margin = 0; in check_fb_var()
736 var->hsync_len = 0; in check_fb_var()
737 var->vsync_len = 0; in check_fb_var()
738 var->sync = 0; in check_fb_var()
739 var->vmode = FB_VMODE_NONINTERLACED; in check_fb_var()
760 static unsigned calc_rotation_offset_dma(const struct fb_var_screeninfo *var, in calc_rotation_offset_dma() argument
765 offset = var->yoffset * fix->line_length + in calc_rotation_offset_dma()
766 var->xoffset * (var->bits_per_pixel >> 3); in calc_rotation_offset_dma()
771 static unsigned calc_rotation_offset_vrfb(const struct fb_var_screeninfo *var, in calc_rotation_offset_vrfb() argument
777 offset = (var->yres_virtual - var->yres) * in calc_rotation_offset_vrfb()
780 offset = (var->yres_virtual - var->yres) * in calc_rotation_offset_vrfb()
781 (var->bits_per_pixel >> 3); in calc_rotation_offset_vrfb()
786 offset += var->yoffset * fix->line_length + in calc_rotation_offset_vrfb()
787 var->xoffset * (var->bits_per_pixel >> 3); in calc_rotation_offset_vrfb()
789 offset -= var->yoffset * fix->line_length + in calc_rotation_offset_vrfb()
790 var->xoffset * (var->bits_per_pixel >> 3); in calc_rotation_offset_vrfb()
792 offset -= var->xoffset * fix->line_length + in calc_rotation_offset_vrfb()
793 var->yoffset * (var->bits_per_pixel >> 3); in calc_rotation_offset_vrfb()
795 offset += var->xoffset * fix->line_length + in calc_rotation_offset_vrfb()
796 var->yoffset * (var->bits_per_pixel >> 3); in calc_rotation_offset_vrfb()
802 const struct fb_var_screeninfo *var, in omapfb_calc_addr() argument
815 offset = calc_rotation_offset_vrfb(var, fix, rotation); in omapfb_calc_addr()
817 offset = calc_rotation_offset_dma(var, fix, rotation); in omapfb_calc_addr()
823 var->xoffset, var->yoffset, offset); in omapfb_calc_addr()
836 struct fb_var_screeninfo *var = &fbi->var; in omapfb_setup_overlay() local
844 int rotation = var->rotate; in omapfb_setup_overlay()
861 xres = var->yres; in omapfb_setup_overlay()
862 yres = var->xres; in omapfb_setup_overlay()
864 xres = var->xres; in omapfb_setup_overlay()
865 yres = var->yres; in omapfb_setup_overlay()
869 omapfb_calc_addr(ofbi, var, fix, rotation, &data_start_p); in omapfb_setup_overlay()
871 r = fb_mode_to_dss_mode(var, &mode); in omapfb_setup_overlay()
877 switch (var->nonstd) { in omapfb_setup_overlay()
882 / (var->bits_per_pixel >> 2); in omapfb_setup_overlay()
887 screen_width = fix->line_length / (var->bits_per_pixel >> 3); in omapfb_setup_overlay()
925 /* apply var to the overlay */
930 struct fb_var_screeninfo *var = &fbi->var; in omapfb_apply_changes() local
957 int rotation = (var->rotate + ofbi->rotation[i]) % 4; in omapfb_apply_changes()
960 outw = var->yres; in omapfb_apply_changes()
961 outh = var->xres; in omapfb_apply_changes()
963 outw = var->xres; in omapfb_apply_changes()
964 outh = var->yres; in omapfb_apply_changes()
996 /* checks var and eventually tweaks it to something supported,
998 static int omapfb_check_var(struct fb_var_screeninfo *var, struct fb_info *fbi) in omapfb_check_var() argument
1007 r = check_fb_var(fbi, var); in omapfb_check_var()
1014 /* set the video mode according to info->var */
1038 static int omapfb_pan_display(struct fb_var_screeninfo *var, in omapfb_pan_display() argument
1047 if (var->xoffset == fbi->var.xoffset && in omapfb_pan_display()
1048 var->yoffset == fbi->var.yoffset) in omapfb_pan_display()
1051 new_var = fbi->var; in omapfb_pan_display()
1052 new_var.xoffset = var->xoffset; in omapfb_pan_display()
1053 new_var.yoffset = var->yoffset; in omapfb_pan_display()
1055 fbi->var = new_var; in omapfb_pan_display()
1138 struct fb_var_screeninfo *var = &fbi->var; in _setcolreg() local
1167 pal = ((red >> (16 - var->red.length)) << in _setcolreg()
1168 var->red.offset) | in _setcolreg()
1169 ((green >> (16 - var->green.length)) << in _setcolreg()
1170 var->green.offset) | in _setcolreg()
1171 (blue >> (16 - var->blue.length)); in _setcolreg()
1333 memset(&fbi->var, 0, sizeof(fbi->var)); in clear_fb_info()
1572 .width = fbi->var.xres_virtual, in omapfb_clear_fb()
1573 .height = fbi->var.yres_virtual, in omapfb_clear_fb()
1635 memcpy(&new_var, &fbi->var, sizeof(new_var)); in omapfb_realloc_fbmem()
1639 memcpy(&fbi->var, &new_var, sizeof(fbi->var)); in omapfb_realloc_fbmem()
1727 /* initialize fb_info, var, fix to something sane based on the display */
1730 struct fb_var_screeninfo *var = &fbi->var; in omapfb_fb_init() local
1743 var->nonstd = 0; in omapfb_fb_init()
1744 var->bits_per_pixel = 0; in omapfb_fb_init()
1746 var->rotate = def_rotate; in omapfb_fb_init()
1750 int rotation = (var->rotate + ofbi->rotation[0]) % 4; in omapfb_fb_init()
1756 var->xres = h; in omapfb_fb_init()
1757 var->yres = w; in omapfb_fb_init()
1759 var->xres = w; in omapfb_fb_init()
1760 var->yres = h; in omapfb_fb_init()
1763 var->xres_virtual = var->xres; in omapfb_fb_init()
1764 var->yres_virtual = var->yres; in omapfb_fb_init()
1766 if (!var->bits_per_pixel) { in omapfb_fb_init()
1769 var->bits_per_pixel = 16; in omapfb_fb_init()
1772 var->bits_per_pixel = 32; in omapfb_fb_init()
1782 var->xres = 320; in omapfb_fb_init()
1783 var->yres = 240; in omapfb_fb_init()
1784 var->xres_virtual = var->xres; in omapfb_fb_init()
1785 var->yres_virtual = var->yres; in omapfb_fb_init()
1786 if (!var->bits_per_pixel) in omapfb_fb_init()
1787 var->bits_per_pixel = 16; in omapfb_fb_init()
1790 r = check_fb_var(fbi, var); in omapfb_fb_init()
2002 struct fb_var_screeninfo *var; in omapfb_mode_to_timings() local
2019 * that we need fb_info and var, so we create dummy ones */ in omapfb_mode_to_timings()
2023 var = NULL; in omapfb_mode_to_timings()
2032 var = kzalloc(sizeof(*var), GFP_KERNEL); in omapfb_mode_to_timings()
2033 if (var == NULL) { in omapfb_mode_to_timings()
2046 r = fb_find_mode(var, fbi, mode_str, NULL, 0, NULL, 24); in omapfb_mode_to_timings()
2060 timings->pixelclock = PICOS2KHZ(var->pixclock) * 1000; in omapfb_mode_to_timings()
2061 timings->hbp = var->left_margin; in omapfb_mode_to_timings()
2062 timings->hfp = var->right_margin; in omapfb_mode_to_timings()
2063 timings->vbp = var->upper_margin; in omapfb_mode_to_timings()
2064 timings->vfp = var->lower_margin; in omapfb_mode_to_timings()
2065 timings->hsw = var->hsync_len; in omapfb_mode_to_timings()
2066 timings->vsw = var->vsync_len; in omapfb_mode_to_timings()
2067 timings->x_res = var->xres; in omapfb_mode_to_timings()
2068 timings->y_res = var->yres; in omapfb_mode_to_timings()
2069 timings->hsync_level = var->sync & FB_SYNC_HOR_HIGH_ACT ? in omapfb_mode_to_timings()
2072 timings->vsync_level = var->sync & FB_SYNC_VERT_HIGH_ACT ? in omapfb_mode_to_timings()
2075 timings->interlace = var->vmode & FB_VMODE_INTERLACED; in omapfb_mode_to_timings()
2077 switch (var->bits_per_pixel) { in omapfb_mode_to_timings()
2092 kfree(var); in omapfb_mode_to_timings()