video: Get the default mode from the right database
PATCH 1/1 video: Get the default mode from the right database
fb_find_mode() is behaving in an non-intuitive way. When I specify my own video mode database, and no default mode, I would have expected it to assume the first mode in my database as the default mode. Instead, it uses the built in database:
Quoted 6 lines
if (!db) {
db = modedb;
dbsize = ARRAY_SIZE(modedb);
}
if (!default_mode)
default_mode = &modedb[DEFAULT_MODEDB_INDEX];Personally, I think this is incorrect - if an alternate database is specified, it should be always using that. Patch is attached.
Regards,
Jordan
Signature · 4 lines
Jordan Crouse Senior Linux Engineer Advanced Micro Devices, Inc. <www.amd.com/embeddedprocessors>
[PATCH] video: Get the default mode from the right database
From: Jordan Crouse <[email protected]>
If no default mode is specified, it should be grabbed from the supplied database, not the default one.
---
drivers/video/modedb.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/video/modedb.c +1 -1
@@ -506,7 +506,7 @@ int fb_find_mode(struct fb_var_screeninf dbsize =ARRAY_SIZE (modedb); }if (!default_mode) - default_mode = &modedb[DEFAULT_MODEDB_INDEX ]; + default_mode = &db[DEFAULT_MODEDB_INDEX ];if (!default_bpp) default_bpp =8 ;
Quoted 18 lines · Jordan Crouse
fb_find_mode()is behaving in an non-intuitive way. When I specify my own video mode database, and no default mode, I would have expected it to assume the first mode in my database as the default mode. Instead, it uses the built in database:Quoted 6 lines
if (!db) { db = modedb; dbsize = ARRAY_SIZE(modedb); } if (!default_mode) default_mode = &modedb[DEFAULT_MODEDB_INDEX];Personally, I think this is incorrect - if an alternate database is specified, it should be always using that. Patch is attached.
drivers/video/modedb.c int fb_find_mode(struct fb_var_screeninf · line 511
Quoted 7 lines
drivers/video/modedb.c +1
-1@@ -506,7 +506,7 @@ int fb_find_mode(struct fb_var_screeninf dbsize =ARRAY_SIZE (modedb); }if (!default_mode) - default_mode = &modedb[DEFAULT_MODEDB_INDEX ]; + default_mode = &db[DEFAULT_MODEDB_INDEX ];if (!default_bpp) default_bpp =8 ;
Although currently DEFAULT_MODEDB_INDEX is defined to be 0, perhaps we need a more rigorous check now it may apply to the custom video mode database? Probably you always want the first mode of your custom video mode database to be the default?
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
Quoted 10 lines · Geert Uytterhoeven
Review
Quoted 5 lines
if (!default_mode)
(quoted diff) +1
-1- default_mode = &modedb[DEFAULT_MODEDB_INDEX]; + default_mode = &db[DEFAULT_MODEDB_INDEX]; if (!default_bpp) default_bpp = 8;Although currently
DEFAULT_MODEDB_INDEXis defined to be 0, perhaps we need a more rigorous check now it may apply to the custom video mode database? Probably you always want the first mode of your custom video mode database to be the default?
Indeed. I'm not sure how many people out there actually change DEFAULT_MODEDB_INDEX to be non zero, but can't think of a reason why the default shouldn't just always use the first index in the database.
At least, thats the way I thought fb_find_mode() worked before I looked into the internals. Still, there might be some people attached to DEFAULT_MODEDB_INDEX, so I've attached a new patch that should make everybody happy.
Jordan
Signature · 4 lines
Jordan Crouse Senior Linux Engineer Advanced Micro Devices, Inc. <www.amd.com/embeddedprocessors>
[PATCH] video: Get the default mode from the right database
From: Jordan Crouse <[email protected]>
If no default mode is specified, it should be grabbed from the supplied database, not the default one.
---
drivers/video/modedb.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
drivers/video/modedb.c +4 -1
@@ -505,8 +505,11 @@ int fb_find_mode(struct fb_var_screeninf db = modedb; dbsize =ARRAY_SIZE (modedb); } -if (!default_mode) +if (!default_mode && db != modedb) + default_mode = &db[0 ]; +else default_mode = &modedb[DEFAULT_MODEDB_INDEX ]; +if (!default_bpp) default_bpp =8 ;
_______________________________________________
Devel mailing list
[email protected]
http://mailman.laptop.org/mailman/listinfo/devel