NEWBIE Help please.
From: Mukund JB. <hidden>
Date: 2004-09-13 07:11:20
Hello all,
I am having a basic problem of understanding how does the FRAMEBUFFER
driver really goes.
I have just written a sample framebuffer driver, I am attaching the code
here to this mail.
I have the following doubts. I went through the complete mail list where
in found no answers for these questions Probably I am asking silly ones,
please help this newbie.
QUESTION 1 :
is the framebuffer driver restricted to just graphical applications?
Is there a different framebuffer driver for console(ALT+CTRL+F1)? Is
framebuffer mechaninism used on the console too?
QUESTION 2 :
When I have a framebuffer driver already on my system, I know I can I
always insert another framebuffer driver which will be given a minor
number of '1' and is integrated into the kernel on insertion. But, my
question is : what is the active framebuffer driver now?
Is the active framebuffer driver the new one or the old one?
I read from a site that setting the global variable "FRAMEBUFFER" as
"/dev/fb1" will activate my driver? please explain how it goes, if this
is true.
QUESTION 3 :
Can u please explain briefly what functionality I need to implement
regarding the follong function which exists in "fb_ops" structure.
fb_get_fix
fb_get_var
fb_set_var
fb_get_cmap
fb_set_cmap
fb_pan_display
fb_ioctl
Please provide me a link where in I can get a detailed description of
the above.
Here is the code I want to insert as a framebuffer module.
/*
* Initialization
*/
int __init xxxfb_init(void)
{
fb_info.gen.fbhw = &xxx_switch;
fb_info.gen.fbhw->detect();
strcpy(fb_info.gen.info.modename, "XXX");
fb_info.gen.info.changevar = NULL;
fb_info.gen.info.node = -1;
fb_info.gen.info.fbops = &xxxfb_ops;
fb_info.gen.info.disp = &disp;
fb_info.gen.info.switch_con = &xxxfb_switch;
fb_info.gen.info.updatevar = &xxxfb_update_var;
fb_info.gen.info.blank = &xxxfb_blank;
fb_info.gen.info.flags = FBINFO_FLAG_DEFAULT;
/* This should give a reasonable default video mode */
// fbgen_get_var(&disp.var, -1, &fb_info.gen.info);
// fbgen_do_set_var(&disp.var, 1, &fb_info.gen);
// fbgen_set_disp(-1, &fb_info.gen);
// fbgen_install_cmap(0, &fb_info.gen);
if (register_framebuffer(&fb_info.gen.info) < 0)
return -EINVAL;
printk(KERN_INFO "fb%d: %s frame buffer device\n",
GET_FB_IDX(fb_info.gen.info.node),
fb_info.gen.info.modename);
/* uncomment this if your driver cannot be unloaded */
/* MOD_INC_USE_COUNT; */
return 0;
}
/*
* Cleanup
*/
void xxxfb_cleanup(struct fb_info *info)
{
/*
* If your driver supports multiple boards, you should unregister
and
* clean up all instances.
*/
unregister_framebuffer(info);
/* ... */
}
/*
* Setup
*/
/*
------------------------------------------------------------------------
- */
/*
* Frame buffer operations
*/
/* If all you need is that - just don't define ->fb_open */
static int xxxfb_open(const struct fb_info *info, int user)
{
return 0;
}
/* If all you need is that - just don't define ->fb_release */
static int xxxfb_release(const struct fb_info *info, int user)
{
return 0;
}
/*
* In most cases the `generic' routines (fbgen_*) should be
satisfactory.
* However, you're free to fill in your own replacements.
*/
static struct fb_ops xxxfb_ops = {
owner: THIS_MODULE,
fb_open: xxxfb_open, /* only if you need it to
do something */
fb_release: xxxfb_release, /* only if you need it to
do something */
// fb_get_fix: fbgen_get_fix,
// fb_get_var: fbgen_get_var,
// fb_set_var: fbgen_set_var,
// fb_get_cmap: fbgen_get_cmap,
// fb_set_cmap: fbgen_set_cmap,
// fb_pan_display: fbgen_pan_display,
// fb_ioctl: xxxfb_ioctl, /* optional */
};
/*
------------------------------------------------------------------------
- */
/*
* Modularization
*/
#ifdef MODULE
MODULE_LICENSE("GPL");
int init_module(void)
{
return xxxfb_init();
}
void cleanup_module(void)
{
xxxfb_cleanup(void);
}
#endif /* MODULE */
regards & and thanks for the help,
Mukund jampala
-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 13. Go here: http://sf.net/ppc_contest.php