i915: Moved screen creation to intel_be_device
authorJakob Bornecrantz <jakob@tungstengraphics.com>
Tue, 24 Jun 2008 11:09:43 +0000 (13:09 +0200)
committerJakob Bornecrantz <jakob@tungstengraphics.com>
Tue, 24 Jun 2008 12:33:18 +0000 (14:33 +0200)
src/gallium/winsys/common/intel_drm/intel_be_device.c
src/gallium/winsys/common/intel_drm/intel_be_device.h
src/gallium/winsys/dri/intel/Makefile
src/gallium/winsys/dri/intel/intel_context.c
src/gallium/winsys/dri/intel/intel_screen.c

index 3eed0fe410718008da7b6612a2c232cac21106ec..efb57a394e41c36ccfe1c2d4956d2abeb6a62fcd 100644 (file)
@@ -16,6 +16,8 @@
 #include "pipe/p_util.h"
 #include "pipe/p_inlines.h"
 
+#include "i915simple/i915_screen.h"
+
 /* Turn a pipe winsys into an intel/pipe winsys:
  */
 static INLINE struct intel_be_device *
@@ -192,7 +194,7 @@ intel_be_fence_finish( struct pipe_winsys *sws,
  */
 
 boolean
-intel_be_init_device(struct intel_be_device *dev, int fd)
+intel_be_init_device(struct intel_be_device *dev, int fd, unsigned id)
 {
        dev->fd = fd;
        dev->max_batch_size = 16 * 4096;
@@ -252,6 +254,11 @@ intel_be_init_device(struct intel_be_device *dev, int fd)
                                         1, 40, dev->max_batch_size * 16, 0,
                                         dev->fMan);
 
+       /* Fill in this struct with callbacks that i915simple will need to
+        * communicate with the window system, buffer manager, etc.
+        */
+       dev->screen = i915_create_screen(&dev->base, id);
+
        return true;
 }
 
index ec5cace71c8d384bfd41b85c957b012f49f75fde..abf0253917181602f8d7b633337e9a8a2121f315 100644 (file)
@@ -12,6 +12,11 @@ struct intel_be_device
 {
        struct pipe_winsys base;
 
+       /**
+        * Hw level screen
+        */
+       struct pipe_screen *screen;
+
        int fd; /**< Drm file discriptor */
 
        size_t max_batch_size;
@@ -28,7 +33,7 @@ struct intel_be_device
 };
 
 boolean
-intel_be_init_device(struct intel_be_device *device, int fd);
+intel_be_init_device(struct intel_be_device *device, int fd, unsigned id);
 
 void
 intel_be_destroy_device(struct intel_be_device *dev);
index 00ce21f6903c058933990b5d3d1a09de311db9dc..5b51f0815d5c7026f664a9fb84aac0bb5e48d808 100644 (file)
@@ -6,8 +6,9 @@ LIBNAME = i915_dri.so
 
 PIPE_DRIVERS = \
        $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \
-       $(TOP)/src/gallium/drivers/i915simple/libi915simple.a \
-       $(TOP)/src/gallium/winsys/common/intel_drm/libinteldrm.a
+       $(TOP)/src/gallium/winsys/common/intel_drm/libinteldrm.a \
+       $(TOP)/src/gallium/drivers/i915simple/libi915simple.a
+
 
 DRIVER_SOURCES = \
        intel_winsys_softpipe.c \
index 8284e0edbb977feb3e88e2cfa7bfff5e5912ebba..97ef731aaadcbdf37a0c577c933d3b4fd3d7a464 100644 (file)
@@ -134,25 +134,6 @@ static const struct dri_debug_control debug_control[] = {
 
 
 
-/**
- * Create i915 hardware rendering context.
- */
-static struct pipe_context *
-intel_create_i915simple(struct intel_context *intel,
-                       struct pipe_winsys *winsys)
-{
-   struct pipe_screen *screen;
-       
-   /* Fill in this struct with callbacks that i915simple will need to
-    * communicate with the window system, buffer manager, etc.
-    */
-   screen = i915_create_screen(winsys, intel->intelScreen->deviceID);
-
-   /* Create the i915simple context:
-    */
-   return i915_create_context(screen, winsys, &intel->base.base );
-}
-
 static void
 intel_lock_hardware(struct intel_be_context *context)
 {
@@ -250,7 +231,9 @@ intelCreateContext(const __GLcontextModes * visual,
       case PCI_CHIP_Q35_G:
       case PCI_CHIP_I915_G:
       case PCI_CHIP_I915_GM:
-        pipe = intel_create_i915simple( intel, &intelScreen->base.base );
+        pipe = i915_create_context(intelScreen->base.screen,
+                                   &intelScreen->base.base,
+                                   &intel->base.base);
         break;
       default:
         fprintf(stderr, "Unknown PCIID %x in %s, using software driver\n",
index 1d61617ab5836fb20665275763295fb52469f886..809af2e553093621b4d1a9e8a5c682376f3c56db 100644 (file)
@@ -198,10 +198,12 @@ intel_flush_frontbuffer( struct pipe_winsys *winsys,
                          struct pipe_surface *surf,
                          void *context_private)
 {
-   struct intel_context *intel = (struct intel_context *) context_private;
-   __DRIdrawablePrivate *dPriv = intel->driDrawable;
+   //struct intel_context *intel = (struct intel_context *) context_private;
+   //__DRIdrawablePrivate *dPriv = intel->driDrawable;
 
-   intelDisplaySurface(dPriv, surf, NULL);
+   assert((int)"Doesn't work currently" & 0);
+
+   //intelDisplaySurface(dPriv, surf, NULL);
 }
 
 static boolean
@@ -254,9 +256,9 @@ intelInitDriver(__DRIscreenPrivate * sPriv)
       (*glx_enable_extension) (psc, "GLX_SGI_make_current_read");
    }
 
-   intel_be_init_device(&intelScreen->base, sPriv->fd);
    intelScreen->base.base.flush_frontbuffer = intel_flush_frontbuffer;
    intelScreen->base.base.get_name = intel_get_name;
+   intel_be_init_device(&intelScreen->base, sPriv->fd, intelScreen->deviceID);
 
    return GL_TRUE;
 }