summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2007-08-10 10:01:15 +0100
committerKeith Whitwell <keith@tungstengraphics.com>2007-08-10 10:15:31 +0100
commitc12b71ef93ed71a78473568025d2b4d8d8fd2003 (patch)
tree4f1584cbdc29f8166f8ee04d285f6e878a7e5984
parentcb2d95ba68affe665619cc0ec7b74fd0aaae7fc2 (diff)
Pass pci_id to i915_create()
-rw-r--r--src/mesa/pipe/i915simple/i915_context.c42
-rw-r--r--src/mesa/pipe/i915simple/i915_context.h5
-rw-r--r--src/mesa/pipe/i915simple/i915_winsys.h3
3 files changed, 43 insertions, 7 deletions
diff --git a/src/mesa/pipe/i915simple/i915_context.c b/src/mesa/pipe/i915simple/i915_context.c
index eb7f3804d3..a15d3505d7 100644
--- a/src/mesa/pipe/i915simple/i915_context.c
+++ b/src/mesa/pipe/i915simple/i915_context.c
@@ -33,6 +33,14 @@
#include "pipe/draw/draw_context.h"
#include "pipe/p_defines.h"
+#define PCI_CHIP_I915_G 0x2582
+#define PCI_CHIP_I915_GM 0x2592
+#define PCI_CHIP_I945_G 0x2772
+#define PCI_CHIP_I945_GM 0x27A2
+#define PCI_CHIP_I945_GME 0x27AE
+#define PCI_CHIP_G33_G 0x29C2
+#define PCI_CHIP_Q35_G 0x29B2
+#define PCI_CHIP_Q33_G 0x29D2
/**
@@ -143,14 +151,40 @@ i915_draw_vertices(struct pipe_context *pipe,
-struct pipe_context *i915_create( struct i915_winsys *winsys )
+struct pipe_context *i915_create( struct i915_winsys *winsys,
+ unsigned pci_id )
{
- struct i915_context *i915 = CALLOC_STRUCT(i915_context);
+ struct i915_context *i915;
+ unsigned is_i945 = 0;
- i915->pipe.destroy = i915_destroy;
+ /* TODO: Push this down into the pipe driver:
+ */
+ switch (pci_id) {
+ case PCI_CHIP_I915_G:
+ case PCI_CHIP_I915_GM:
+ break;
+
+ case PCI_CHIP_I945_G:
+ case PCI_CHIP_I945_GM:
+ case PCI_CHIP_I945_GME:
+ case PCI_CHIP_G33_G:
+ case PCI_CHIP_Q33_G:
+ case PCI_CHIP_Q35_G:
+ is_i945 = 1;
+ break;
- i915->pipe.supported_formats = i915_supported_formats;
+ default:
+ winsys->printf(winsys, "%s: unknown pci id 0x%x, cannot create context\n",
+ __FUNCTION__, pci_id);
+ return NULL;
+ }
+
+ i915 = CALLOC_STRUCT(i915_context);
+ if (i915 == NULL)
+ return NULL;
+ i915->pipe.destroy = i915_destroy;
+ i915->pipe.supported_formats = i915_supported_formats;
i915->pipe.draw_vb = i915_draw_vb;
i915->pipe.draw_vertices = i915_draw_vertices;
i915->pipe.clear = i915_clear;
diff --git a/src/mesa/pipe/i915simple/i915_context.h b/src/mesa/pipe/i915simple/i915_context.h
index 550d9c012f..e8db2b7c36 100644
--- a/src/mesa/pipe/i915simple/i915_context.h
+++ b/src/mesa/pipe/i915simple/i915_context.h
@@ -122,8 +122,9 @@ struct i915_context
GLuint debug;
-
- struct pipe_scissor_state cliprect;
+ struct {
+ unsigned is_i945:1;
+ } flags;
};
/* A flag for each state_tracker state object:
diff --git a/src/mesa/pipe/i915simple/i915_winsys.h b/src/mesa/pipe/i915simple/i915_winsys.h
index 887308f5dd..9802148aa1 100644
--- a/src/mesa/pipe/i915simple/i915_winsys.h
+++ b/src/mesa/pipe/i915simple/i915_winsys.h
@@ -123,7 +123,8 @@ struct i915_winsys {
#define I915_BUFFER_ACCESS_READ 0x2
-struct pipe_context *i915_create( struct i915_winsys * );
+struct pipe_context *i915_create( struct i915_winsys *,
+ unsigned pci_id );
#endif