Re: framebuffer_{alloc,release}

3 messages, 2 authors, 2003-09-23 · open the first message on its own page

Re: framebuffer_{alloc,release}

From: Kronos <hidden>
Date: 2003-09-18 16:03:06

Hum, I don't see original email...

James Simmons wrote:
The patch looks nice except for one thing. framebuffer_alloc is incorrect 
in assuming there is one struct xxx_par per strut fb_info. Struct xxx_par
represents the physically hardware in a way independent of the 
framebuffer. The reason for this was to handle cards with more than one 
physical framebuffer. For example take a dual headed radeon card. You 
would have a design like this.
	   |-----------------	
____________	   |	 | /dev/fb0 |
| radeon_par | ----|	 ------------
|____________|	   |
	   |
	   |-----------------
	   	 | /dev/fb1 |
	   	 ------------

the reason for this design is simple. If fb0 video resolution changes it 
affects par. Now par's state affect fb1. We need to see if changes to 
either fb0 or fb1 affects the other display as well.
framebuffer_alloc doesn't assume anything. It allocates fb_info->par iff
it's  told to. For  dual  head you  can allocate  par  yourself (and  do
whatever you want with it) or do something like this (matrox fb is doing
something similar):

if (seconday) {
        fb_info = framebuffer_alloc(0, NULL);
        fb_info->par = primary->par;
} else
        fb_info = framebuffer_alloc(sizeof(struct foo_par), NULL);

release_fb_info  won't  touch  fb_info->par  unless it  was  created  by
framebuffer_alloc. If  secondary driver  can work  even when  primary is
unloaded  then you  can  use  class_device_get (or  a  wrapper) to  keep
primary fb data around:

if (secondary) {
        if (!primary_fb_info)
                secondary_fb_info = framebuffer_alloc(sizeof(struct foo_par), NULL);
        else {
                if (!class_device_get(&primary_fb_info->class_dev))
                        /* primary is going away */
                else {
                        secondary_fb_info = framebuffer_alloc(0, NULL);
                        secondary_fb_info->par = primary_fb_info->par;
                }
        }
}


I've created a bk tree here:

bk://mesa3d.bkbits.net/fbdev-2.5

It's cloned from your tree and you can do a bk pull. You'll get the
following changesets:

[off-list ref] (03/09/17 1.1285)
   Update sparc framebuffer drivers to the new API.

[off-list ref] (03/09/17 1.1281.1.1)
   Add new API framebuffer_alloc and framebuffer_release.

   Framebuffer info structure (ie. struct fb_info) must be obtained from
   framebuffer_alloc. When it is no longer needed (after unregister_framebuffer
   and clean up) it can be released using framebuffer_release.

   If the framebuffer is not registered yet (eg. on error path) then fb_info must
   be released via kfree.


David S. Miller has ack'ed sparc changes.

Luca
-- 
Reply-To: kronos@kronoz.cjb.net
Home: http://kronoz.cjb.net
Runtime error 6D at f000:a12f : user incompetente


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

Re: framebuffer_{alloc,release}

From: James Simmons <hidden>
Date: 2003-09-22 21:24:09

framebuffer_alloc doesn't assume anything. It allocates fb_info->par iff
it's  told to. For  dual  head you  can allocate  par  yourself (and  do
whatever you want with it) or do something like this (matrox fb is doing
something similar):

if (seconday) {
        fb_info = framebuffer_alloc(0, NULL);
        fb_info->par = primary->par;
} else
        fb_info = framebuffer_alloc(sizeof(struct foo_par), NULL);

release_fb_info  won't  touch  fb_info->par  unless it  was  created  by
framebuffer_alloc. If  secondary driver  can work  even when  primary is
unloaded  then you  can  use  class_device_get (or  a  wrapper) to  keep
primary fb data around:

if (secondary) {
        if (!primary_fb_info)
                secondary_fb_info = framebuffer_alloc(sizeof(struct foo_par), NULL);
        else {
                if (!class_device_get(&primary_fb_info->class_dev))
                        /* primary is going away */
                else {
                        secondary_fb_info = framebuffer_alloc(0, NULL);
                        secondary_fb_info->par = primary_fb_info->par;
                }
        }
}
This is acceptable. I applied your changes.




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

Re: framebuffer_{alloc,release}

From: Kronos <hidden>
Date: 2003-09-23 15:51:34

Il Mon, Sep 22, 2003 at 10:24:04PM +0100, James Simmons ha scritto: 
This is acceptable. I applied your changes.
Good. I've just finished matroxfb, you can do a bk pull from:

bk://mesa3d.bkbits.net/fbdev-2.5

This will update the following files:

 drivers/video/Kconfig                   |   20 
 drivers/video/matrox/g450_pll.c         |  166 +++---
 drivers/video/matrox/g450_pll.h         |    6 
 drivers/video/matrox/i2c-matroxfb.c     |   18 
 drivers/video/matrox/matroxfb_DAC1064.c |  586 ++++++++++++------------
 drivers/video/matrox/matroxfb_DAC1064.h |    4 
 drivers/video/matrox/matroxfb_Ti3026.c  |  256 +++++-----
 drivers/video/matrox/matroxfb_accel.c   |  130 ++---
 drivers/video/matrox/matroxfb_accel.h   |    2 
 drivers/video/matrox/matroxfb_base.c    |  778 +++++++++++++++-----------------
 drivers/video/matrox/matroxfb_base.h    |   76 ---
 drivers/video/matrox/matroxfb_crtc2.c   |  259 +++++-----
 drivers/video/matrox/matroxfb_crtc2.h   |    2 
 drivers/video/matrox/matroxfb_g450.c    |  162 +++---
 drivers/video/matrox/matroxfb_g450.h    |    8 
 drivers/video/matrox/matroxfb_maven.c   |   38 -
 drivers/video/matrox/matroxfb_misc.c    |  264 +++++-----
 drivers/video/matrox/matroxfb_misc.h    |   10 
 18 files changed, 1355 insertions(+), 1430 deletions(-)

through these ChangeSets:

[off-list ref] (03/09/23 1.1290)
   Port driver to the new framebuffer_{alloc,release} API.

[off-list ref] (03/09/21 1.1289)
   Remove FB_MATROX_MULTIHEAD and helper macros.
   Now minfo is always dynamically allocated.


Luca
-- 
Reply-To: kronos@kronoz.cjb.net
Home: http://kronoz.cjb.net
"La mia teoria scientifica preferita e` quella secondo la quale gli 
 anelli di Saturno sarebbero interamente composti dai bagagli andati 
 persi nei viaggi aerei." -- Mark Russel


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help