All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Antonino A. Daplas" <adaplas@gmail.com>
To: Nathan Cline <nathan.cline@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Patch to framebuffer
Date: Thu, 24 Nov 2005 16:49:15 +0800	[thread overview]
Message-ID: <43857E8B.4090004@gmail.com> (raw)
In-Reply-To: <656113ee0511232208n6948c364ke6103b3ef0a54f@mail.gmail.com>

Nathan Cline wrote:
> --- fbcon.c	2005-11-23 23:49:10.000000000 -0600
> +++ fbcon.c.mine	2005-11-23 23:12:16.000000000 -0600
> @@ -390,12 +390,15 @@
>  	int mode;
>  
>  	if (ops->currcon != -1)
> -		vc = vc_cons[ops->currcon].d;
> +		vc = ops->currcon_ptr; 

As mentioned in the other thread, you don't need ops->currcon_ptr.
vc_cons[ops->currcon].d should give you the same results.

>  
> -	if (!vc || !CON_IS_VISIBLE(vc) ||
> +	if (!vc)
> +		return;
> +
> +	if (!CON_IS_VISIBLE(vc) ||
>  	    fbcon_is_inactive(vc, info) ||
>   	    registered_fb[con2fb_map[vc->vc_num]] != info ||
> -	    vc_cons[ops->currcon].d->vc_deccm != 1)
> +	    vc->vc_deccm != 1)
>  		return;
>  	acquire_console_sem();
>  	p = &fb_display[vc->vc_num];
> @@ -753,6 +756,7 @@
>  	struct fbcon_ops *ops = info->fbcon_par;
>  
>  	ops->currcon = fg_console;
> +	ops->currcon_ptr = vc_cons[fg_console].d;

no need

>  
>  	if (info->fbops->fb_set_par && !(ops->flags & FBCON_FLAGS_INIT))
>  		info->fbops->fb_set_par(info);
> @@ -766,7 +770,7 @@
>  		fbcon_preset_disp(info, &info->var, unit);
>  
>  	if (show_logo) {
> -		struct vc_data *fg_vc = vc_cons[fg_console].d;
> +		struct vc_data *fg_vc = ops->currcon_ptr;

or *fg_vc = vc_cons[ops->currcon].d

>  		struct fb_info *fg_info =
>  			registered_fb[con2fb_map[fg_console]];
>  
> @@ -775,7 +779,7 @@
>  				   fg_vc->vc_rows);
>  	}
>  
> -	update_screen(vc_cons[fg_console].d);
> +	update_screen(ops->currcon_ptr);

similarly, update_screen(vc_cons[ops->currcon].d);

>  }
>  
>  /**
> @@ -929,6 +933,7 @@
>  
>  	memset(ops, 0, sizeof(struct fbcon_ops));
>  	ops->currcon = -1;
> +	ops->currcon_ptr = NULL;

no need.

>  	ops->graphics = 1;
>  	ops->cur_rotate = -1;
>  	info->fbcon_par = ops;
> @@ -1055,6 +1060,15 @@
>  	    return;
>  
>  	cap = info->flags;
> +	ops = info->fbcon_par;
> +
> +	if (ops->currcon == -1)
> +	{
> +		ops->currcon = vc->vc_num;
> +		ops->currcon_ptr = vc;

no need for the last line.

> +	}
> +
> +	vc->vc_display_fg = &(ops->currcon_ptr);
>  
>  	if (vc != svc || logo_shown == FBCON_LOGO_DONTSHOW ||
>  	    (info->fix.type == FB_TYPE_TEXT))
> @@ -1091,7 +1105,6 @@
>  	if (!*vc->vc_uni_pagedir_loc)
>  		con_copy_unimap(vc, svc);
>  
> -	ops = info->fbcon_par;
>  	p->con_rotate = rotate;
>  	set_blitting_type(vc, info, NULL);
>  
> @@ -1296,6 +1309,8 @@
>  	struct fbcon_ops *ops = info->fbcon_par;
>  	int rows, cols, charcnt = 256;
>  
> +	vc->vc_display_fg = &(ops->currcon_ptr);
> +	

or vc->vc_display_fg = &vc_cons[ops->currcon].d;

>  	if (var_to_display(p, var, info))
>  		return;
>  	t = &fb_display[svc->vc_num];
> @@ -2048,7 +2063,7 @@
>  	struct fbcon_ops *ops;
>  	struct display *p = &fb_display[vc->vc_num];
>  	struct fb_var_screeninfo var;
> -	int i, prev_console;
> +	int prev_console;
>  
>  	info = registered_fb[con2fb_map[vc->vc_num]];
>  	ops = info->fbcon_par;
> @@ -2073,21 +2088,10 @@
>  	prev_console = ops->currcon;
>  	if (prev_console != -1)
>  		old_info = registered_fb[con2fb_map[prev_console]];
> -	/*
> -	 * FIXME: If we have multiple fbdev's loaded, we need to
> -	 * update all info->currcon.  Perhaps, we can place this
> -	 * in a centralized structure, but this might break some
> -	 * drivers.
> -	 *
> -	 * info->currcon = vc->vc_num;
> -	 */
> -	for (i = 0; i < FB_MAX; i++) {
> -		if (registered_fb[i] != NULL && registered_fb[i]->fbcon_par) {
> -			struct fbcon_ops *o = registered_fb[i]->fbcon_par;
>  
> -			o->currcon = vc->vc_num;
> -		}
> -	}

This hunk is the actual culprit why fbcon is behaving like it is :-)

> +	ops->currcon = vc->vc_num;
> +	ops->currcon_ptr = vc;
> +	
>  	memset(&var, 0, sizeof(struct fb_var_screeninfo));
>  	display_to_var(&var, p);
>  	var.activate = FB_ACTIVATE_NOW;
> @@ -2103,13 +2107,6 @@
>  	fb_set_var(info, &var);
>  	ops->var = info->var;
>  
> -	if (old_info != NULL && old_info != info) {
> -		if (info->fbops->fb_set_par)
> -			info->fbops->fb_set_par(info);

Don't remove the above hunk.  It's possible to have multiple fb_info's
(ie vga16fb, vesafb, xxxfb) driving the same hardware.  This gives
the driver a chance to initialize the hardware when it's their turn
to take over.
 
> -		fbcon_del_cursor_timer(old_info);
> -		fbcon_add_cursor_timer(info);
> -	}
> -

The above is safe to remove.

>  	set_blitting_type(vc, info, p);
>  	ops->cursor_reset = 1;
>  
> @@ -2691,7 +2688,7 @@
>  
>  	if (!ops || ops->currcon < 0)
>  		return;
> -	vc = vc_cons[ops->currcon].d;
> +	vc = ops->currcon_ptr;

Again, equivalent.

>  
>  	/* Clear cursor, restore saved data */
>  	fbcon_cursor(vc, CM_ERASE);
> @@ -2704,7 +2701,7 @@
>  
>  	if (!ops || ops->currcon < 0)
>  		return;
> -	vc = vc_cons[ops->currcon].d;
> +	vc = ops->currcon_ptr; 

equivalent

>  
>  	update_screen(vc);
>  }
> @@ -2718,7 +2715,7 @@
>  
>  	if (!ops || ops->currcon < 0)
>  		return;
> -	vc = vc_cons[ops->currcon].d;
> +	vc = ops->currcon_ptr; 

equivalent

>  	if (vc->vc_mode != KD_TEXT ||
>  	    registered_fb[con2fb_map[ops->currcon]] != info)
>  		return;
> @@ -2841,7 +2838,7 @@
>  	if (!ops || ops->currcon < 0)
>  		return;
>  
> -	vc = vc_cons[ops->currcon].d;
> +	vc = ops->currcon_ptr; 

equivalent

>  	if (vc->vc_mode != KD_TEXT ||
>  			registered_fb[con2fb_map[ops->currcon]] != info)
>  		return;
> 
> 
> ------------------------------------------------------------------------
> 
> --- fbcon.h	2005-11-23 23:49:10.000000000 -0600
> +++ fbcon.h.mine	2005-11-23 23:46:07.000000000 -0600
> @@ -73,6 +73,7 @@
>  	struct fb_cursor cursor_state;
>  	struct display *p;
>          int    currcon;	                /* Current VC. */
> +	struct vc_data *currcon_ptr;

No need for currcon_ptr.

Tony

  parent reply	other threads:[~2005-11-24  8:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-24  6:08 Patch to framebuffer Nathan Cline
2005-11-24  7:43 ` Antonino A. Daplas
2005-11-24  8:49 ` Antonino A. Daplas [this message]
2005-11-24  9:08 ` Matt Keenan
2005-11-24  9:46 ` Pekka Enberg
  -- strict thread matches above, loose matches on Subject: below --
2005-11-24 17:21 Knut Petersen
2005-11-24 17:21 ` Knut Petersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=43857E8B.4090004@gmail.com \
    --to=adaplas@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nathan.cline@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.