Thread (4 messages) 4 messages, 3 authors, 2005-01-29

Re: Added 915G to intelfb of 2.6.10-kernel-sources

From: Sylvain Meyer <hidden>
Date: 2005-01-28 16:43:48

       Hi Axel,

   Thanks for your patch but could you format it as described in this document  http://www.zip.com.au/~akpm/linux/patches/stuff/tpp.txt

and resend it.

The best is to use these tools to maintain and send kernel patches
http://www.zip.com.au/~akpm/linux/patches/

Also you should subscribe and send fbdev-related mails to linux-fbdev-devel@lists.sourceforge.net

Regards
Sylvain

Buttchereit, Axel (XLsigned) a écrit:
Hi,

though I'm quite sure that the attached patch (intelfb-...) is far from complete
I think that someone/you (guessing from the comments that you are maintaining
the code) might be interested in my work.

Having no technical documentation (from Intel) I had to "develop" the patch by
looking at the xfree/xorg-code that already supports I915G and by using
trial-and-error (My ThinkCentre's internal graphics device is an I915G
and that made me start working on this subject).

During development and testing I've discovered that the way "intelfb" and maybe
other framebuffer-drivers are using "modedb" does not work, if compiled as a
module. The initial "modedb entries" are lost (overwritten?) when "fb_find_mode"
is called from the module. Linking "intelfb" into the kernel works as expected.

ByTheWay: Why isn't the framebuffer module (intelfb) automatically loaded, if
"video=intelfb:..." is specified as kernel-parameter?

I have attached an additional patch (modedb-...) that re-initialize a
minimal-modedb (my_mini_modedb), if MY_PREFERRED_MODE (1024x768-32@73)
is used in a call to "fb_find_mode", to show that loading "intelfb" as a
module works in principle.

Just for completeness I've attached a third (trivial) patch that adds support for
the external graphics adapter (radeon X600, RV380) of my ThinkCentre, by treating
it as an RV350.

Sorry for sending direct email.

--Axel





------------------------------------------------------------------------

diff -ruN linux/drivers/video/intelfb.orig/intelfbdrv.c linux/drivers/video/intelfb/intelfbdrv.c
--- linux/drivers/video/intelfb.orig/intelfbdrv.c    2005-01-26 18:51:13.162054107 +0100
+++ linux/drivers/video/intelfb/intelfbdrv.c    2005-01-27 23:37:21.273059171 +0100
@@ -1,7 +1,8 @@
/*
 * intelfb
 *
- * Linux framebuffer driver for Intel(R) 830M/845G/852GM/855GM/865G
+ * *** XLsigned-2005-01-27: Added 915G ***
+ * Linux framebuffer driver for Intel(R) 830M/845G/852GM/855GM/865G/915G
 * integrated graphics chips.
 *
 * Copyright © 2002, 2003 David Dawes [off-list ref]
@@ -153,6 +154,8 @@
    { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_845G, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, INTELFB_CLASS_MASK, INTEL_845G },
    { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_85XGM, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, INTELFB_CLASS_MASK, INTEL_85XGM },
    { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_865G, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, INTELFB_CLASS_MASK, INTEL_865G },
+    /* XLsigned-2005-01-27: Added 915G */
+    { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_915G, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, INTELFB_CLASS_MASK, INTEL_915G },
    { 0, }
};
@@ -516,13 +519,25 @@
    }

    /* Set base addresses. */
-    dinfo->aperture.physical = pci_resource_start(pdev, 0);
-    dinfo->aperture.size     = pci_resource_len(pdev, 0);
-    dinfo->mmio_base_phys    = pci_resource_start(pdev, 1);
-
-    DBG_MSG("fb aperture: 0x%lx/0x%lx, MMIO region: 0x%lx/0x%lx\n",
-        pci_resource_start(pdev, 0), pci_resource_len(pdev, 0),
-        pci_resource_start(pdev, 1), pci_resource_len(pdev, 1));
+    /* XLsigned-2005-01-27: Added 915G */
+    if (ent->device == PCI_DEVICE_ID_INTEL_915G) {
+        DBG_MSG("XLsigned-Debug: IS_915G\n");
+        dinfo->aperture.physical = pci_resource_start(pdev, 2);
+        dinfo->aperture.size     = pci_resource_len(pdev, 2);
+        dinfo->mmio_base_phys    = pci_resource_start(pdev, 0);
+       +        DBG_MSG("fb aperture: 0x%lx/0x%lx, MMIO region: 0x%lx/0x%lx\n",
+            pci_resource_start(pdev, 2), pci_resource_len(pdev, 2),
+            pci_resource_start(pdev, 0), pci_resource_len(pdev, 0));
+    } else {
+        dinfo->aperture.physical = pci_resource_start(pdev, 0);
+        dinfo->aperture.size     = pci_resource_len(pdev, 0);
+        dinfo->mmio_base_phys    = pci_resource_start(pdev, 1);
+
+        DBG_MSG("fb aperture: 0x%lx/0x%lx, MMIO region: 0x%lx/0x%lx\n",
+            pci_resource_start(pdev, 0), pci_resource_len(pdev, 0),
+            pci_resource_start(pdev, 1), pci_resource_len(pdev, 1));
+    }

    /* Reserve the fb and MMIO regions */
    if (!request_mem_region(dinfo->aperture.physical, dinfo->aperture.size,
@@ -756,6 +771,8 @@
        printk(").  Disabling mode switching.\n");
    }

+    DBG_MSG("XLsigned-Debug: Value of bailearly: %d\n",bailearly);
+       if (bailearly == 1)
        bailout(dinfo);
@@ -785,7 +802,7 @@
        bailout(dinfo);


-    if (intelfb_set_fbinfo(dinfo)) {
+     if (intelfb_set_fbinfo(dinfo)) {
        cleanup(dinfo);
        return -ENODEV;
    }
@@ -983,17 +1000,20 @@

    var = &dinfo->info->var;
    if (FIXED_MODE(dinfo)) {
+        DBG_MSG("XLsigned-Debug: Setting FIXED_MODE\n");
            memcpy(var, &dinfo->initial_var,
               sizeof(struct fb_var_screeninfo));
        msrc = 5;
    } else {
        if (mode) {
+            DBG_MSG("XLsignedi-Debug: finding given mode: %s\n",mode);
            msrc = fb_find_mode(var, dinfo->info, mode,
                        NULL, 0, NULL, 0);
            if (msrc)
                msrc |= 8;
        }
        if (!msrc) {
+            DBG_MSG("XLsigned-Debug: finding PREFERRED_MODE: %s\n",PREFERRED_MODE);
            msrc = fb_find_mode(var, dinfo->info, PREFERRED_MODE,
                        NULL, 0, NULL, 0);
        }
diff -ruN linux/drivers/video/intelfb.orig/intelfbdrv.h linux/drivers/video/intelfb/intelfbdrv.h
--- linux/drivers/video/intelfb.orig/intelfbdrv.h    2005-01-26 18:51:13.162054107 +0100
+++ linux/drivers/video/intelfb/intelfbdrv.h    2005-01-27 13:23:55.811192427 +0100
@@ -5,7 +5,8 @@
 
******************************************************************************
 * intelfb
 *
- * Linux framebuffer driver for Intel(R) 830M/845G/852GM/855GM/865G
+ * *** XLsigned-2005-01-27: Added 915G ***
+ * Linux framebuffer driver for Intel(R) 830M/845G/852GM/855GM/865G/915G
 * integrated graphics chips.
 *
 * Copyright © 2004 Sylvain Meyer
diff -ruN linux/drivers/video/intelfb.orig/intelfb.h linux/drivers/video/intelfb/intelfb.h
--- linux/drivers/video/intelfb.orig/intelfb.h    2005-01-26 18:51:13.162054107 +0100
+++ linux/drivers/video/intelfb/intelfb.h    2005-01-28 03:59:58.630904165 +0100
@@ -10,7 +10,8 @@
/*** Version/name ***/
#define INTELFB_VERSION            "0.9.2"
#define INTELFB_MODULE_NAME        "intelfb"
-#define SUPPORTED_CHIPSETS        "830M/845G/852GM/855GM/865G"
+/* XLsigned-2005-01-27: Added 915G */
+#define SUPPORTED_CHIPSETS        "830M/845G/852GM/855GM/865G/915G"


/*** Debug/feature defines ***/
@@ -35,10 +36,14 @@
#define ALLOCATE_FOR_PANNING        1
#endif

+/* XLsigned-2005-01-27: Make this a match of the (one-and-)only entry of "my_mini_modedb" */
+#define PREFERRED_MODE            "1024x768-32@73"
+
#ifndef PREFERRED_MODE
#define PREFERRED_MODE            "1024x768-16@60"
#endif

+
/*** hw-related values ***/

/* PCI ids for supported devices */
@@ -46,6 +51,8 @@
#define PCI_DEVICE_ID_INTEL_845G    0x2562
#define PCI_DEVICE_ID_INTEL_85XGM    0x3582
#define PCI_DEVICE_ID_INTEL_865G    0x2572
+/* XLsigned-2005-01-27: Added 915G */
+#define PCI_DEVICE_ID_INTEL_915G    0x2582

/* Size of MMIO region */
#define INTEL_REG_SIZE            0x80000
@@ -117,7 +124,9 @@
    INTEL_852GME,
    INTEL_855GM,
    INTEL_855GME,
-    INTEL_865G
+    /* XLsigned-2005-01-27: Added 915G */
+    INTEL_865G,
+    INTEL_915G
};

struct intelfb_hwstate {
diff -ruN linux/drivers/video/intelfb.orig/intelfbhw.c linux/drivers/video/intelfb/intelfbhw.c
--- linux/drivers/video/intelfb.orig/intelfbhw.c    2005-01-26 18:51:13.162054107 +0100
+++ linux/drivers/video/intelfb/intelfbhw.c    2005-01-27 20:27:12.672227462 +0100
@@ -98,6 +98,12 @@
        *chipset = INTEL_865G;
        *mobile = 0;
        return 0;
+    /* XLsigned-2005-01-27: Added 915G */
+    case PCI_DEVICE_ID_INTEL_915G:
+        *name = "Intel(R) 915G";
+        *chipset = INTEL_915G;
+        *mobile = 0;
+        return 0;
    default:
        return 1;
    }
@@ -169,6 +175,13 @@
        case INTEL_855_GMCH_GMS_STOLEN_32M:
            *stolen_size = MB(32) - KB(132);
            return 0;
+        /* XLsigned-2005-01-27: Added 915G */
+        case INTEL_915G_GMCH_GMS_STOLEN_48M:
+            *stolen_size = MB(48) - KB(132);
+            return 0;
+        case INTEL_915G_GMCH_GMS_STOLEN_64M:
+            *stolen_size = MB(64) - KB(132);
+            return 0;
        case INTEL_855_GMCH_GMS_DISABLED:
            ERR_MSG("video memory is disabled\n");
            return 0;
@@ -390,7 +403,7 @@
#if VERBOSE > 0
    DBG_MSG("intelfbhw_read_hw_state\n");
#endif
-
+       if (!hw || !dinfo)
        return -1;

diff -ruN linux/drivers/video/intelfb.orig/intelfbhw.h linux/drivers/video/intelfb/intelfbhw.h
--- linux/drivers/video/intelfb.orig/intelfbhw.h    2005-01-26 18:51:13.163053957 +0100
+++ linux/drivers/video/intelfb/intelfbhw.h    2005-01-27 14:37:30.365140440 +0100
@@ -46,6 +46,11 @@
#define INTEL_855_GMCH_GMS_STOLEN_16M    (0x4 << 4)
#define INTEL_855_GMCH_GMS_STOLEN_32M    (0x5 << 4)

+/* XLsigned-2005-01-27: Added 915G */
+#define INTEL_915G_GMCH_GMS_STOLEN_48M    (0x6 << 4)
+#define INTEL_915G_GMCH_GMS_STOLEN_64M    (0x7 << 4)
+
+
/* HW registers */

/* Fence registers */


------------------------------------------------------------------------

diff -ru linux/drivers/video/aty.orig/ati_ids.h linux/drivers/video/aty/ati_ids.h
--- linux/drivers/video/aty.orig/ati_ids.h    2005-01-26 05:50:20.235665432 +0100
+++ linux/drivers/video/aty/ati_ids.h    2005-01-26 04:11:46.279111468 +0100
@@ -4,6 +4,9 @@
 * radeonfb
 */

+/* XLsigned-2004-11-16i: added RV380 (X600) */
+#define PCI_CHIP_RV380_3E50        0x3E50
+
#define PCI_CHIP_RS100_4136        0x4136
#define PCI_CHIP_RS200_4137        0x4137
#define PCI_CHIP_R300_AD        0x4144
diff -ru linux/drivers/video/aty.orig/radeon_base.c linux/drivers/video/aty/radeon_base.c
--- linux/drivers/video/aty.orig/radeon_base.c    2005-01-26 05:48:50.965236600 +0100
+++ linux/drivers/video/aty/radeon_base.c    2005-01-26 06:21:33.388589496 +0100
@@ -107,6 +107,13 @@
    { PCI_VENDOR_ID_ATI, id, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (flags) | (CHIP_FAMILY_##family) }
static struct pci_device_id radeonfb_pci_table[] = {
+
+        /* XLsigned-2004-11-16: added RV380 (X600)
+         * XLsigned-2005-01-26: added CHIP_IS_MOBILITY flag to force reading
+         * of PLL config from VBIOS (BIOS mapped to RAM) and not from BIOS-ROM
+         */
+    CHIP_DEF(PCI_CHIP_RV380_3E50,    RV350,    CHIP_HAS_CRTC2 | CHIP_IS_MOBILITY),
+       /* Mobility M6 */
    CHIP_DEF(PCI_CHIP_RADEON_LY,     RV100,    CHIP_HAS_CRTC2 | CHIP_IS_MOBILITY),
    CHIP_DEF(PCI_CHIP_RADEON_LZ,    RV100,    CHIP_HAS_CRTC2 | CHIP_IS_MOBILITY),


------------------------------------------------------------------------
--- linux/drivers/video/modedb.c.orig    2005-01-28 04:19:28.710375507 +0100
+++ linux/drivers/video/modedb.c    2005-01-28 04:20:33.595040284 +0100
@@ -18,6 +18,9 @@
#undef DEBUG

+/* XLsigned-2005-01-27: Added #define DEBUG 1 */
+#define DEBUG 1
+
#define name_matches(v, s, l) \
    ((v).name && !strncmp((s), (v).name, (l)) && strlen((v).name) == (l))
#define res_matches(v, x, y) \
@@ -39,6 +42,19 @@
#define DEFAULT_MODEDB_INDEX    0

+/* XLsigned-2005-01-27: Added my_mini_modedb */
+#define MY_PREFERRED_MODE "1024x768-32@73"
+#define IS_MY_PREFERRED_MODE(m) \
+    ((m) && \
+     !strncmp((m),MY_PREFERRED_MODE,strlen(MY_PREFERRED_MODE)) && \
+     (strlen((m)) == strlen(MY_PREFERRED_MODE)))
+static struct fb_videomode my_mini_modedb[] = {
+    {
+    MY_PREFERRED_MODE, 70, 1024, 768, 13333, 180, 24, 29, 3, 136, 6,
+    0, FB_VMODE_NONINTERLACED, 0
+    }
+};
+
static const __init struct fb_videomode modedb[] = {
    {
    /* 640x400 @ 70 Hz, 31.5 kHz hsync */
@@ -480,7 +496,42 @@
    if (!db) {
    db = modedb;
    dbsize = sizeof(modedb)/sizeof(*modedb);
+    /* XLsigned: 2005-01-27: Added my_mini_modedb
+     * ANY static "modedb" is obviously destroyed when this function
+     * is called from a loadable (framebuffer-)module (like intelfb)
+     */
+    if (mode_option) {
+      DPRINTK("XLsigned-Debug: mode_option = %s\n", mode_option);
+      DPRINTK("XLsigned-Debug: MY_PREFERRED_MODE = %s\n", MY_PREFERRED_MODE);
+    }
+    else {
+      DPRINTK("XLsigned-Debug: No mode_option specified\n");
+    }
+    if (IS_MY_PREFERRED_MODE(mode_option)) {
+        my_mini_modedb[0].name = MY_PREFERRED_MODE;
+        my_mini_modedb[0].refresh = 70;
+        my_mini_modedb[0].xres = 1024;
+        my_mini_modedb[0].yres = 768;
+        my_mini_modedb[0].pixclock = 13333;
+        my_mini_modedb[0].left_margin = 180;
+        my_mini_modedb[0].right_margin = 24;
+        my_mini_modedb[0].upper_margin = 29;
+        my_mini_modedb[0].lower_margin = 3;
+        my_mini_modedb[0].hsync_len = 136;
+        my_mini_modedb[0].vsync_len = 6;
+        my_mini_modedb[0].sync = 0;
+        my_mini_modedb[0].vmode = FB_VMODE_NONINTERLACED;
+        my_mini_modedb[0].flag = 0;
+
+        db = my_mini_modedb;
+        dbsize = sizeof(my_mini_modedb)/sizeof(*my_mini_modedb);
+        DPRINTK("XLsigned-Debug: using my_mini_modedb: dbsize = %i\n", dbsize);
+    }
+    else {
+        DPRINTK("XLsigned-Debug: using builtin modedb: dbsize = %i\n", dbsize);
+    }
    }
+       if (!default_mode)
    default_mode = &modedb[DEFAULT_MODEDB_INDEX];
    if (!default_bpp)






-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help