aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/svgalib.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video/svgalib.c')
-rw-r--r--drivers/video/svgalib.c47
1 files changed, 31 insertions, 16 deletions
diff --git a/drivers/video/svgalib.c b/drivers/video/svgalib.c
index 25df928d37d8..9c7106701572 100644
--- a/drivers/video/svgalib.c
+++ b/drivers/video/svgalib.c
@@ -598,9 +598,11 @@ void svga_set_timings(const struct svga_timing_regs *tm, struct fb_var_screeninf
598/* ------------------------------------------------------------------------- */ 598/* ------------------------------------------------------------------------- */
599 599
600 600
601int svga_match_format(const struct svga_fb_format *frm, struct fb_var_screeninfo *var, struct fb_fix_screeninfo *fix) 601static inline int match_format(const struct svga_fb_format *frm,
602 struct fb_var_screeninfo *var)
602{ 603{
603 int i = 0; 604 int i = 0;
605 int stored = -EINVAL;
604 606
605 while (frm->bits_per_pixel != SVGA_FORMAT_END_VAL) 607 while (frm->bits_per_pixel != SVGA_FORMAT_END_VAL)
606 { 608 {
@@ -609,25 +611,38 @@ int svga_match_format(const struct svga_fb_format *frm, struct fb_var_screeninfo
609 (var->green.length <= frm->green.length) && 611 (var->green.length <= frm->green.length) &&
610 (var->blue.length <= frm->blue.length) && 612 (var->blue.length <= frm->blue.length) &&
611 (var->transp.length <= frm->transp.length) && 613 (var->transp.length <= frm->transp.length) &&
612 (var->nonstd == frm->nonstd)) { 614 (var->nonstd == frm->nonstd))
613 var->bits_per_pixel = frm->bits_per_pixel;
614 var->red = frm->red;
615 var->green = frm->green;
616 var->blue = frm->blue;
617 var->transp = frm->transp;
618 var->nonstd = frm->nonstd;
619 if (fix != NULL) {
620 fix->type = frm->type;
621 fix->type_aux = frm->type_aux;
622 fix->visual = frm->visual;
623 fix->xpanstep = frm->xpanstep;
624 }
625 return i; 615 return i;
626 } 616 if (var->bits_per_pixel == frm->bits_per_pixel)
617 stored = i;
627 i++; 618 i++;
628 frm++; 619 frm++;
629 } 620 }
630 return -EINVAL; 621 return stored;
622}
623
624int svga_match_format(const struct svga_fb_format *frm,
625 struct fb_var_screeninfo *var,
626 struct fb_fix_screeninfo *fix)
627{
628 int i = match_format(frm, var);
629
630 if (i >= 0) {
631 var->bits_per_pixel = frm[i].bits_per_pixel;
632 var->red = frm[i].red;
633 var->green = frm[i].green;
634 var->blue = frm[i].blue;
635 var->transp = frm[i].transp;
636 var->nonstd = frm[i].nonstd;
637 if (fix != NULL) {
638 fix->type = frm[i].type;
639 fix->type_aux = frm[i].type_aux;
640 fix->visual = frm[i].visual;
641 fix->xpanstep = frm[i].xpanstep;
642 }
643 }
644
645 return i;
631} 646}
632 647
633 648