Mesa (gallium-drm-driver-descriptor): i965g: Moved pci_id to winsys struct

Jakob Bornecrantz wallbraker at kemper.freedesktop.org
Tue Jun 22 18:44:56 PDT 2010


Module: Mesa
Branch: gallium-drm-driver-descriptor
Commit: 2b15e37348ca234c5a3352db55babb7bd293b708
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=2b15e37348ca234c5a3352db55babb7bd293b708

Author: Jakob Bornecrantz <jakob at vmware.com>
Date:   Wed Jun 23 02:28:47 2010 +0200

i965g: Moved pci_id to winsys struct

---

 src/gallium/drivers/i965/brw_screen.c         |    8 ++++----
 src/gallium/drivers/i965/brw_winsys.h         |    3 ++-
 src/gallium/winsys/i965/drm/i965_drm_api.c    |    6 ++----
 src/gallium/winsys/i965/drm/i965_drm_buffer.c |    4 ++--
 src/gallium/winsys/i965/drm/i965_drm_winsys.h |    2 --
 src/gallium/winsys/i965/xlib/xlib_i965.c      |    3 ++-
 6 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/src/gallium/drivers/i965/brw_screen.c b/src/gallium/drivers/i965/brw_screen.c
index 50a446d..eb75427 100644
--- a/src/gallium/drivers/i965/brw_screen.c
+++ b/src/gallium/drivers/i965/brw_screen.c
@@ -350,7 +350,7 @@ brw_destroy_screen(struct pipe_screen *screen)
  * Create a new brw_screen object
  */
 struct pipe_screen *
-brw_create_screen(struct brw_winsys_screen *sws, uint pci_id)
+brw_create_screen(struct brw_winsys_screen *sws)
 {
    struct brw_screen *bscreen;
    struct brw_chipset chipset;
@@ -365,9 +365,9 @@ brw_create_screen(struct brw_winsys_screen *sws, uint pci_id)
 
    memset(&chipset, 0, sizeof chipset);
 
-   chipset.pci_id = pci_id;
+   chipset.pci_id = sws->pci_id;
 
-   switch (pci_id) {
+   switch (chipset.pci_id) {
    case PCI_CHIP_I965_G:
    case PCI_CHIP_I965_Q:
    case PCI_CHIP_I965_G_1:
@@ -393,7 +393,7 @@ brw_create_screen(struct brw_winsys_screen *sws, uint pci_id)
 
    default:
       debug_printf("%s: unknown pci id 0x%x, cannot create screen\n", 
-                   __FUNCTION__, pci_id);
+                   __FUNCTION__, chipset.pci_id);
       return NULL;
    }
 
diff --git a/src/gallium/drivers/i965/brw_winsys.h b/src/gallium/drivers/i965/brw_winsys.h
index f30c7f1..adb0006 100644
--- a/src/gallium/drivers/i965/brw_winsys.h
+++ b/src/gallium/drivers/i965/brw_winsys.h
@@ -147,6 +147,7 @@ static INLINE void make_reloc(struct brw_winsys_reloc *reloc,
 
 struct brw_winsys_screen {
 
+   unsigned pci_id;
 
    /**
     * Buffer functions.
@@ -264,7 +265,7 @@ bo_reference(struct brw_winsys_buffer **ptr, struct brw_winsys_buffer *buf)
 /**
  * Create brw pipe_screen.
  */
-struct pipe_screen *brw_create_screen(struct brw_winsys_screen *iws, unsigned pci_id);
+struct pipe_screen *brw_create_screen(struct brw_winsys_screen *iws);
 
 
 
diff --git a/src/gallium/winsys/i965/drm/i965_drm_api.c b/src/gallium/winsys/i965/drm/i965_drm_api.c
index 87ee807..124dc26 100644
--- a/src/gallium/winsys/i965/drm/i965_drm_api.c
+++ b/src/gallium/winsys/i965/drm/i965_drm_api.c
@@ -56,7 +56,6 @@ static struct pipe_screen *
 i965_libdrm_create_screen(struct drm_api *api, int drmFD)
 {
    struct i965_libdrm_winsys *idws;
-   unsigned int deviceID;
 
    debug_printf("%s\n", __FUNCTION__);
 
@@ -64,12 +63,11 @@ i965_libdrm_create_screen(struct drm_api *api, int drmFD)
    if (!idws)
       return NULL;
 
-   i965_libdrm_get_device_id(&deviceID);
+   i965_libdrm_get_device_id(&idws->base.pci_id);
 
    i965_libdrm_winsys_init_buffer_functions(idws);
 
    idws->fd = drmFD;
-   idws->id = deviceID;
 
    idws->base.destroy = i965_libdrm_winsys_destroy;
 
@@ -78,7 +76,7 @@ i965_libdrm_create_screen(struct drm_api *api, int drmFD)
 
    idws->send_cmd = !debug_get_bool_option("BRW_NO_HW", FALSE);
 
-   return brw_create_screen(&idws->base, deviceID);
+   return brw_create_screen(&idws->base);
 }
 
 struct drm_api i965_libdrm_api =
diff --git a/src/gallium/winsys/i965/drm/i965_drm_buffer.c b/src/gallium/winsys/i965/drm/i965_drm_buffer.c
index fb5e50c..9e9d59d 100644
--- a/src/gallium/winsys/i965/drm/i965_drm_buffer.c
+++ b/src/gallium/winsys/i965/drm/i965_drm_buffer.c
@@ -322,7 +322,7 @@ i965_libdrm_bo_subdata(struct brw_winsys_buffer *buffer,
 		   nr_reloc);
 
    if (BRW_DUMP)
-      brw_dump_data( idws->id,
+      brw_dump_data( idws->base.pci_id,
 		     data_type,
 		     buf->bo->offset + offset, 
 		     data, size );
@@ -460,7 +460,7 @@ i965_libdrm_bo_flush_range(struct brw_winsys_buffer *buffer,
 		   offset, length);
 
    if (BRW_DUMP)
-      brw_dump_data( idws->id,
+      brw_dump_data( idws->base.pci_id,
 		     buf->data_type,
 		     buf->bo->offset + offset, 
 		     (char*)buf->bo->virtual + offset, 
diff --git a/src/gallium/winsys/i965/drm/i965_drm_winsys.h b/src/gallium/winsys/i965/drm/i965_drm_winsys.h
index c6a7d4a..3856e1c 100644
--- a/src/gallium/winsys/i965/drm/i965_drm_winsys.h
+++ b/src/gallium/winsys/i965/drm/i965_drm_winsys.h
@@ -22,8 +22,6 @@ struct i965_libdrm_winsys
    boolean send_cmd;
 
    int fd; /**< Drm file discriptor */
-
-   unsigned id;
 };
 
 static INLINE struct i965_libdrm_winsys *
diff --git a/src/gallium/winsys/i965/xlib/xlib_i965.c b/src/gallium/winsys/i965/xlib/xlib_i965.c
index 063e9f6..baadd6e 100644
--- a/src/gallium/winsys/i965/xlib/xlib_i965.c
+++ b/src/gallium/winsys/i965/xlib/xlib_i965.c
@@ -395,6 +395,7 @@ xlib_create_brw_winsys_screen( void )
       return NULL;
 
    ws->used = 0;
+   ws->base.pci_id = PCI_CHIP_GM45_GM;
 
    ws->base.destroy              = xlib_brw_winsys_destroy;
    ws->base.bo_alloc             = xlib_brw_bo_alloc;
@@ -452,7 +453,7 @@ xlib_create_i965_screen( void )
    if (winsys == NULL)
       return NULL;
 
-   screen = brw_create_screen(winsys, PCI_CHIP_GM45_GM);
+   screen = brw_create_screen(winsys);
    if (screen == NULL)
       goto fail;
 



More information about the mesa-commit mailing list