mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kronos <kronos@kronoz.cjb.net>
To: Martin MOKREJ? <mmokrejs@natur.cuni.cz>
Cc: linux-kernel@vger.kernel.org
Subject: Re: radeonfb: cannot map FB
Date: Sun, 27 Jun 2004 22:33:44 +0200	[thread overview]
Message-ID: <20040627203344.GA11474@dreamland.darkstar.lan> (raw)
In-Reply-To: <Pine.OSF.4.51.0406272113190.111358@tao.natur.cuni.cz>

Il Sun, Jun 27, 2004 at 09:16:34PM +0200, Martin MOKREJ? ha scritto: 
> Hi,
>   yes, I have one GB and SMP kernel. It's interresting that I don't
> remember this bug with kernels around 2.4.23 or .24 - just a guess.

Hum, I see a big DRM merge in .23 but it's unrelated to the fb driver.
Nothing else. Maybe you added another PCI card that used part of the
available address space?

> If someone would be interrwested, and can check when did it appear for
> the first time. Otherwise, will be happy to get your patch. 

Patch follows. Compile with DEBUG 1 if something goes wrong.

> I think the printk() lines could print out more debug info. For
> example the contents of some variables which were passed to preceeding
> functions ... ;)

The old driver (ie. the one in 2.4 and the "old" one in 2.6) is not
developed anymore. The new reference point is the driver by BenH in 2.6.


--- linux-2.4/drivers/video/radeonfb.c.orig	2004-06-27 22:26:56.000000000 +0200
+++ linux-2.4/drivers/video/radeonfb.c	2004-06-27 22:29:49.000000000 +0200
@@ -176,7 +176,8 @@
 #define RTRACE		if(0) printk
 #endif
 
-
+#define MAX_MAPPED_VRAM (2048*2048*4)
+#define MIN_MAPPED_VRAM (1024*768*1)
 
 enum radeon_chips {
 	RADEON_QD,
@@ -499,7 +500,8 @@
 
 	short chipset;
 	unsigned char arch;
-	int video_ram;
+	unsigned int video_ram;
+	unsigned int mapped_vram;
 	u8 rev;
 	int pitch, bpp, depth;
 	int xres, yres, pixclock;
@@ -1823,8 +1825,20 @@
 		}
 	}
 
-	rinfo->fb_base = (unsigned long) ioremap (rinfo->fb_base_phys,
-				  		  rinfo->video_ram);
+	if (rinfo->video_ram < rinfo->mapped_vram)
+		rinfo->mapped_vram = rinfo->video_ram;
+	else
+		rinfo->mapped_vram = MAX_MAPPED_VRAM;
+	do {
+		rinfo->fb_base = (unsigned long) ioremap (rinfo->fb_base_phys,
+				  		  rinfo->mapped_vram);
+		if (rinfo->fb_base)
+			break;
+
+		RTRACE(KERN_INFO "radeonfb: cannot ioremap %dk of videoram\n", rinfo->mapped_vram);
+		rinfo->mapped_vram /= 2;
+	} while(rinfo->mapped_vram > MIN_MAPPED_VRAM);
+	
 	if (!rinfo->fb_base) {
 		printk ("radeonfb: cannot map FB\n");
 		iounmap ((void*)rinfo->mmio_base);
@@ -1835,6 +1849,7 @@
 		kfree (rinfo);
 		return -ENODEV;
 	}
+	RTRACE(KERN_INFO "radeonfb: mapped %dk videoram\n", rinfo->mapped_vram/1024);
 
 	/* currcon not yet configured, will be set by first switch */
 	rinfo->currcon = -1;
@@ -2261,7 +2276,7 @@
 	sprintf (fix->id, "ATI Radeon %s", rinfo->name);
         
         fix->smem_start = rinfo->fb_base_phys;
-        fix->smem_len = rinfo->video_ram;
+        fix->smem_len = rinfo->mapped_vram;
 
         fix->type = disp->type;
         fix->type_aux = disp->type_aux;
@@ -2429,6 +2444,9 @@
                         return -EINVAL;
         }
 
+	if (((v.xres_virtual * v.yres_virtual * nom) / den) > rinfo->mapped_vram)
+		return -EINVAL;
+
         if (radeonfb_do_maximize(rinfo, var, &v, nom, den) < 0)
                 return -EINVAL;  
                 


Luca
-- 
Home: http://kronoz.cjb.net
Carpe diem, quam minimum credula postero. (Q. Horatius Flaccus)

  reply	other threads:[~2004-06-27 20:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-26 21:59 Martin MOKREJŠ
2004-06-26 22:49 ` Kronos
2004-06-27 19:16   ` Martin MOKREJŠ
2004-06-27 20:33     ` Kronos [this message]
2004-06-27 21:51       ` Martin MOKREJŠ
2004-08-26 12:03       ` Martin MOKREJŠ
2004-08-26 17:54         ` Kronos

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=20040627203344.GA11474@dreamland.darkstar.lan \
    --to=kronos@kronoz.cjb.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mmokrejs@natur.cuni.cz \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®