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 3eed0fe..efb57a3 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 ec5cace..abf0253 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 00ce21f..5b51f08 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 8284e0e..97ef731 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 1d61617..809af2e 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;
 }