[PATCH] int10/vbe: don't use xf86Screens. (ABI) (v2)

Dave Airlie airlied at gmail.com
Tue May 15 11:52:20 PDT 2012


Pass the ScrnInfoPtr instead of the index in the int10 struct.

This saves us using it to dereference xf86Screens.

v2: address Alan's comment to fix struct alignment.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 hw/xfree86/int10/generic.c     |    2 +-
 hw/xfree86/int10/helper_exec.c |   18 ++++++++--------
 hw/xfree86/int10/helper_mem.c  |    8 +++---
 hw/xfree86/int10/xf86int10.c   |   42 ++++++++++++++++++++--------------------
 hw/xfree86/int10/xf86int10.h   |    4 +-
 hw/xfree86/vbe/vbe.c           |   17 ++++++++-------
 6 files changed, 46 insertions(+), 45 deletions(-)

diff --git a/hw/xfree86/int10/generic.c b/hw/xfree86/int10/generic.c
index 4b97520..5343e47 100644
--- a/hw/xfree86/int10/generic.c
+++ b/hw/xfree86/int10/generic.c
@@ -89,7 +89,7 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
     pInt->mem = &genericMem;
     pInt->private = (pointer) xnfcalloc(1, sizeof(genericInt10Priv));
     INTPriv(pInt)->alloc = (pointer) xnfcalloc(1, ALLOC_ENTRIES(getpagesize()));
-    pInt->scrnIndex = pScrn->scrnIndex;
+    pInt->pScrn = pScrn;
     base = INTPriv(pInt)->base = xnfalloc(SYS_BIOS);
 
     /* FIXME: Shouldn't this be a failure case?  Leaving dev as NULL seems like
diff --git a/hw/xfree86/int10/helper_exec.c b/hw/xfree86/int10/helper_exec.c
index 1e90877..1c58cf7 100644
--- a/hw/xfree86/int10/helper_exec.c
+++ b/hw/xfree86/int10/helper_exec.c
@@ -125,7 +125,7 @@ run_bios_int(int num, xf86Int10InfoPtr pInt)
     if (MEM_RW(pInt, (num << 2) + 2) == (SYS_BIOS >> 4)) {      /* SYS_BIOS_SEG ? */
 
         if (num == 21 && X86_AH == 0x4e) {
-            xf86DrvMsg(pInt->scrnIndex, X_NOTICE,
+            xf86DrvMsg(pInt->pScrn->scrnIndex, X_NOTICE,
                        "Failing Find-Matching-File on non-PC"
                        " (int 21, func 4e)\n");
             X86_AX = 2;
@@ -133,7 +133,7 @@ run_bios_int(int num, xf86Int10InfoPtr pInt)
             return 1;
         }
         else {
-            xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
+            xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2,
                            "Ignoring int 0x%02x call\n", num);
             if (xf86GetVerbosity() > 3) {
                 dump_registers(pInt);
@@ -169,7 +169,7 @@ dump_code(xf86Int10InfoPtr pInt)
     int i;
     CARD32 lina = SEG_ADR((CARD32), X86_CS, IP);
 
-    xf86DrvMsgVerb(pInt->scrnIndex, X_INFO, 3, "code at 0x%8.8" PRIx32 ":\n",
+    xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_INFO, 3, "code at 0x%8.8" PRIx32 ":\n",
                    lina);
     for (i = 0; i < 0x10; i++)
         xf86ErrorFVerb(3, " %2.2x", MEM_RB(pInt, lina + i));
@@ -182,19 +182,19 @@ dump_code(xf86Int10InfoPtr pInt)
 void
 dump_registers(xf86Int10InfoPtr pInt)
 {
-    xf86DrvMsgVerb(pInt->scrnIndex, X_INFO, 3,
+    xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_INFO, 3,
                    "EAX=0x%8.8lx, EBX=0x%8.8lx, ECX=0x%8.8lx, EDX=0x%8.8lx\n",
                    (unsigned long) X86_EAX, (unsigned long) X86_EBX,
                    (unsigned long) X86_ECX, (unsigned long) X86_EDX);
-    xf86DrvMsgVerb(pInt->scrnIndex, X_INFO, 3,
+    xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_INFO, 3,
                    "ESP=0x%8.8lx, EBP=0x%8.8lx, ESI=0x%8.8lx, EDI=0x%8.8lx\n",
                    (unsigned long) X86_ESP, (unsigned long) X86_EBP,
                    (unsigned long) X86_ESI, (unsigned long) X86_EDI);
-    xf86DrvMsgVerb(pInt->scrnIndex, X_INFO, 3,
+    xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_INFO, 3,
                    "CS=0x%4.4x, SS=0x%4.4x,"
                    " DS=0x%4.4x, ES=0x%4.4x, FS=0x%4.4x, GS=0x%4.4x\n",
                    X86_CS, X86_SS, X86_DS, X86_ES, X86_FS, X86_GS);
-    xf86DrvMsgVerb(pInt->scrnIndex, X_INFO, 3,
+    xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_INFO, 3,
                    "EIP=0x%8.8lx, EFLAGS=0x%8.8lx\n",
                    (unsigned long) X86_EIP, (unsigned long) X86_EFLAGS);
 }
@@ -337,7 +337,7 @@ x_inb(CARD16 port)
     }
     else if (port < 0x0100) {   /* Don't interfere with mainboard */
         val = 0;
-        xf86DrvMsgVerb(Int10Current->scrnIndex, X_NOT_IMPLEMENTED, 2,
+        xf86DrvMsgVerb(Int10Current->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2,
                        "inb 0x%4.4x\n", port);
         if (xf86GetVerbosity() > 3) {
             dump_registers(Int10Current);
@@ -395,7 +395,7 @@ x_outb(CARD16 port, CARD8 val)
 #ifdef __NOT_YET__
     }
     else if (port < 0x0100) {   /* Don't interfere with mainboard */
-        xf86DrvMsgVerb(Int10Current->scrnIndex, X_NOT_IMPLEMENTED, 2,
+        xf86DrvMsgVerb(Int10Current->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2,
                        "outb 0x%4.4x,0x%2.2x\n", port, val);
         if (xf86GetVerbosity() > 3) {
             dump_registers(Int10Current);
diff --git a/hw/xfree86/int10/helper_mem.c b/hw/xfree86/int10/helper_mem.c
index 96c598a..160c5ae 100644
--- a/hw/xfree86/int10/helper_mem.c
+++ b/hw/xfree86/int10/helper_mem.c
@@ -281,7 +281,7 @@ xf86int10GetBiosLocationType(const xf86Int10InfoPtr pInt)
 
 #define CHECK_V_SEGMENT_RANGE(x)   \
     if (((x) << 4) < V_BIOS) { \
-	xf86DrvMsg(pInt->scrnIndex, X_ERROR, \
+	xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, \
 		   "V_BIOS address 0x%lx out of range\n", \
 		   (unsigned long)(x) << 4); \
 	return FALSE; \
@@ -306,17 +306,17 @@ xf86int10GetBiosSegment(xf86Int10InfoPtr pInt, void *base)
 
         CHECK_V_SEGMENT_RANGE(cs);
         vbiosMem = (unsigned char *) base + (cs << 4);
-        if (int10_check_bios(pInt->scrnIndex, cs, vbiosMem)) {
+        if (int10_check_bios(pInt->pScrn->scrnIndex, cs, vbiosMem)) {
             break;
         }
     }
 
     if (segments[i] == ~0) {
-        xf86DrvMsg(pInt->scrnIndex, X_ERROR, "No V_BIOS found\n");
+        xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, "No V_BIOS found\n");
         return FALSE;
     }
 
-    xf86DrvMsg(pInt->scrnIndex, X_INFO, "Primary V_BIOS segment is: 0x%lx\n",
+    xf86DrvMsg(pInt->pScrn->scrnIndex, X_INFO, "Primary V_BIOS segment is: 0x%lx\n",
                (unsigned long) cs);
 
     pInt->BIOSseg = cs;
diff --git a/hw/xfree86/int10/xf86int10.c b/hw/xfree86/int10/xf86int10.c
index df347d4..5ead44f 100644
--- a/hw/xfree86/int10/xf86int10.c
+++ b/hw/xfree86/int10/xf86int10.c
@@ -57,7 +57,7 @@ int_handler(xf86Int10InfoPtr pInt)
         ret = run_bios_int(num, pInt);
 
     if (!ret) {
-        xf86DrvMsg(pInt->scrnIndex, X_ERROR, "Halting on int 0x%2.2x!\n", num);
+        xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, "Halting on int 0x%2.2x!\n", num);
         dump_registers(pInt);
         stack_trace(pInt);
     }
@@ -257,7 +257,7 @@ int42_handler(xf86Int10InfoPtr pInt)
         /*         DL = character column                      */
         /* Not Implemented                                    */
     {                           /* Localise */
-        xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
+        xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2,
                        "int 0x%2.2x(AH=0x04) -- Get Light Pen Position\n",
                        pInt->num);
         if (xf86GetVerbosity() > 3) {
@@ -314,10 +314,10 @@ int42_handler(xf86Int10InfoPtr pInt)
         /* Leave:  Nothing                                    */
         /* Not Implemented                                    */
     {                           /* Localise */
-        xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
+        xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2,
                        "int 0x%2.2x(AH=0x06) -- Initialise or Scroll Window Up\n",
                        pInt->num);
-        xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
+        xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 3,
                        " AL=0x%2.2x, BH=0x%2.2x,"
                        " CH=0x%2.2x, CL=0x%2.2x, DH=0x%2.2x, DL=0x%2.2x\n",
                        X86_AL, X86_BH, X86_CH, X86_CL, X86_DH, X86_DL);
@@ -339,10 +339,10 @@ int42_handler(xf86Int10InfoPtr pInt)
         /* Leave:  Nothing                                    */
         /* Not Implemented                                    */
     {                           /* Localise */
-        xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
+        xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2,
                        "int 0x%2.2x(AH=0x07) -- Initialise or Scroll Window Down\n",
                        pInt->num);
-        xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
+        xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 3,
                        " AL=0x%2.2x, BH=0x%2.2x,"
                        " CH=0x%2.2x, CL=0x%2.2x, DH=0x%2.2x, DL=0x%2.2x\n",
                        X86_AL, X86_BH, X86_CH, X86_CL, X86_DH, X86_DL);
@@ -360,10 +360,10 @@ int42_handler(xf86Int10InfoPtr pInt)
         /*         AL = character                             */
         /* Not Implemented                                    */
     {                           /* Localise */
-        xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
+        xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2,
                        "int 0x%2.2x(AH=0x08) -- Read Character and Attribute at"
                        " Cursor\n", pInt->num);
-        xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
+        xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 3,
                        "BH=0x%2.2x\n", X86_BH);
         if (xf86GetVerbosity() > 3) {
             dump_registers(pInt);
@@ -382,10 +382,10 @@ int42_handler(xf86Int10InfoPtr pInt)
         /* Leave:  Nothing                                    */
         /* Not Implemented                                    */
     {                           /* Localise */
-        xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
+        xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2,
                        "int 0x%2.2x(AH=0x09) -- Write Character and Attribute at"
                        " Cursor\n", pInt->num);
-        xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
+        xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 3,
                        "AL=0x%2.2x, BH=0x%2.2x, BL=0x%2.2x, CX=0x%4.4x\n",
                        X86_AL, X86_BH, X86_BL, X86_CX);
         if (xf86GetVerbosity() > 3) {
@@ -404,10 +404,10 @@ int42_handler(xf86Int10InfoPtr pInt)
         /* Leave:  Nothing                                    */
         /* Not Implemented                                    */
     {                           /* Localise */
-        xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
+        xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2,
                        "int 0x%2.2x(AH=0x0A) -- Write Character at Cursor\n",
                        pInt->num);
-        xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
+        xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 3,
                        "AL=0x%2.2x, BH=0x%2.2x, BL=0x%2.2x, CX=0x%4.4x\n",
                        X86_AL, X86_BH, X86_BL, X86_CX);
         if (xf86GetVerbosity() > 3) {
@@ -450,10 +450,10 @@ int42_handler(xf86Int10InfoPtr pInt)
         /* Leave:  Nothing                                    */
         /* Not Implemented                                    */
     {                           /* Localise */
-        xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
+        xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2,
                        "int 0x%2.2x(AH=0x0C) -- Write Graphics Pixel\n",
                        pInt->num);
-        xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
+        xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 3,
                        "AL=0x%2.2x, BH=0x%2.2x, CX=0x%4.4x, DX=0x%4.4x\n",
                        X86_AL, X86_BH, X86_CX, X86_DX);
         if (xf86GetVerbosity() > 3) {
@@ -471,10 +471,10 @@ int42_handler(xf86Int10InfoPtr pInt)
         /* Leave:  AL = pixel value                           */
         /* Not Implemented                                    */
     {                           /* Localise */
-        xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
+        xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2,
                        "int 0x%2.2x(AH=0x0D) -- Read Graphics Pixel\n",
                        pInt->num);
-        xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
+        xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 3,
                        "BH=0x%2.2x, CX=0x%4.4x, DX=0x%4.4x\n", X86_BH, X86_CX,
                        X86_DX);
         if (xf86GetVerbosity() > 3) {
@@ -498,10 +498,10 @@ int42_handler(xf86Int10InfoPtr pInt)
         /*           which might or might not have been       */
         /*           installed yet.                           */
     {                           /* Localise */
-        xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
+        xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2,
                        "int 0x%2.2x(AH=0x0E) -- Write Character in Teletype Mode\n",
                        pInt->num);
-        xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
+        xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 3,
                        "AL=0x%2.2x, BH=0x%2.2x, BL=0x%2.2x\n",
                        X86_AL, X86_BH, X86_BL);
         if (xf86GetVerbosity() > 3) {
@@ -564,10 +564,10 @@ int42_handler(xf86Int10InfoPtr pInt)
         /*           which might or might not have been       */
         /*           installed yet.                           */
     {                           /* Localise */
-        xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
+        xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2,
                        "int 0x%2.2x(AH=0x13) -- Write String in Teletype Mode\n",
                        pInt->num);
-        xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
+        xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 3,
                        "AL=0x%2.2x, BL=0x%2.2x, CX=0x%4.4x,"
                        " DH=0x%2.2x, DL=0x%2.2x, ES:BP=0x%4.4x:0x%4.4x\n",
                        X86_AL, X86_BL, X86_CX, X86_DH, X86_DL, X86_ES, X86_BP);
@@ -840,7 +840,7 @@ int1A_handler(xf86Int10InfoPtr pInt)
 #endif
         return 1;
     default:
-        xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
+        xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2,
                        "int 0x1a subfunction\n");
         dump_registers(pInt);
         if (xf86GetVerbosity() > 3)
diff --git a/hw/xfree86/int10/xf86int10.h b/hw/xfree86/int10/xf86int10.h
index 36b659f..6d564fc 100644
--- a/hw/xfree86/int10/xf86int10.h
+++ b/hw/xfree86/int10/xf86int10.h
@@ -21,10 +21,10 @@
 /* int10 info structure */
 typedef struct {
     int entityIndex;
-    int scrnIndex;
-    pointer cpuRegs;
     CARD16 BIOSseg;
     CARD16 inb40time;
+    ScrnInfoPtr pScrn;
+    pointer cpuRegs;
     char *BIOSScratch;
     int Flags;
     pointer private;
diff --git a/hw/xfree86/vbe/vbe.c b/hw/xfree86/vbe/vbe.c
index bbb60e3..d3c9d36 100644
--- a/hw/xfree86/vbe/vbe.c
+++ b/hw/xfree86/vbe/vbe.c
@@ -179,7 +179,7 @@ static Bool
 vbeProbeDDC(vbeInfoPtr pVbe)
 {
     const char *ddc_level;
-    int screen = pVbe->pInt10->scrnIndex;
+    int screen = pVbe->pInt10->pScrn->scrnIndex;
 
     if (pVbe->ddc == DDC_NONE)
         return FALSE;
@@ -262,7 +262,8 @@ vbeReadEDID(vbeInfoPtr pVbe)
     unsigned char *tmp = NULL;
     Bool novbe = FALSE;
     Bool noddc = FALSE;
-    int screen = pVbe->pInt10->scrnIndex;
+    ScrnInfoPtr pScrn = pVbe->pInt10->pScrn;
+    int screen = pScrn->scrnIndex;
     OptionInfoPtr options;
 
     if (!page)
@@ -270,7 +271,7 @@ vbeReadEDID(vbeInfoPtr pVbe)
 
     options = xnfalloc(sizeof(VBEOptions));
     (void) memcpy(options, VBEOptions, sizeof(VBEOptions));
-    xf86ProcessOptions(screen, xf86Screens[screen]->options, options);
+    xf86ProcessOptions(screen, pScrn->options, options);
     xf86GetOptValBool(options, VBEOPT_NOVBE, &novbe);
     xf86GetOptValBool(options, VBEOPT_NODDC, &noddc);
     free(options);
@@ -330,7 +331,7 @@ vbeDoEDID(vbeInfoPtr pVbe, pointer pDDCModule)
 
     if (!(pModule = pDDCModule)) {
         pModule =
-            xf86LoadSubModule(xf86Screens[pVbe->pInt10->scrnIndex], "ddc");
+            xf86LoadSubModule(pVbe->pInt10->pScrn, "ddc");
         if (!pModule)
             return NULL;
     }
@@ -340,7 +341,7 @@ vbeDoEDID(vbeInfoPtr pVbe, pointer pDDCModule)
     if (!DDC_data)
         return NULL;
 
-    pMonitor = xf86InterpretEDID(pVbe->pInt10->scrnIndex, DDC_data);
+    pMonitor = xf86InterpretEDID(pVbe->pInt10->pScrn->scrnIndex, DDC_data);
 
     if (!pDDCModule)
         xf86UnloadSubModule(pModule);
@@ -598,7 +599,7 @@ VBESaveRestore(vbeInfoPtr pVbe, vbeSaveRestoreFunction function,
      */
 
     if ((pVbe->version & 0xff00) > 0x100) {
-        int screen = pVbe->pInt10->scrnIndex;
+        int screen = pVbe->pInt10->pScrn->scrnIndex;
 
         if (function == MODE_QUERY || (function == MODE_SAVE && !*memory)) {
             /* Query amount of memory to save state */
@@ -904,7 +905,7 @@ VBEBuildVbeModeList(vbeInfoPtr pVbe, VbeInfoBlock * vbe)
         m->n = id;
         m->next = ModeList;
 
-        xf86DrvMsgVerb(pVbe->pInt10->scrnIndex, X_PROBED, 3,
+        xf86DrvMsgVerb(pVbe->pInt10->pScrn->scrnIndex, X_PROBED, 3,
                        "BIOS reported VESA mode 0x%x: x:%i y:%i bpp:%i\n",
                        m->n, m->width, m->height, m->bpp);
 
@@ -1069,7 +1070,7 @@ VBEReadPanelID(vbeInfoPtr pVbe)
     int RealOff = pVbe->real_mode_base;
     pointer page = pVbe->memory;
     void *tmp = NULL;
-    int screen = pVbe->pInt10->scrnIndex;
+    int screen = pVbe->pInt10->pScrn->scrnIndex;
 
     pVbe->pInt10->ax = 0x4F11;
     pVbe->pInt10->bx = 0x01;
-- 
1.7.6



More information about the xorg-devel mailing list