OSDN Git Service

Hook gallium i915 up to DRI2
authorAlan Hourihane <alanh@tungstengraphics.com>
Wed, 11 Jun 2008 13:52:55 +0000 (14:52 +0100)
committerAlan Hourihane <alanh@tungstengraphics.com>
Wed, 11 Jun 2008 13:52:55 +0000 (14:52 +0100)
src/gallium/winsys/dri/intel/intel_context.c
src/gallium/winsys/dri/intel/intel_lock.c
src/gallium/winsys/dri/intel/intel_screen.c
src/gallium/winsys/dri/intel/intel_screen.h
src/gallium/winsys/dri/intel/intel_swapbuffers.c
src/glx/x11/Makefile

index ecc4b0a..af44018 100644 (file)
@@ -28,6 +28,8 @@
 
 #include "i830_dri.h"
 
+#include "state_tracker/st_public.h"
+#include "state_tracker/st_context.h"
 #include "intel_screen.h"
 #include "intel_context.h"
 #include "intel_swapbuffers.h"
@@ -36,8 +38,6 @@
 
 #include "i915simple/i915_screen.h"
 
-#include "state_tracker/st_public.h"
-#include "state_tracker/st_context.h"
 #include "pipe/p_defines.h"
 #include "pipe/p_context.h"
 
@@ -160,8 +160,9 @@ static const struct dri_extension ttm_extensions[] = {
  * Initializes potential list of extensions if ctx == NULL, or actually enables
  * extensions for a context.
  */
-void intelInitExtensions(GLcontext *ctx, GLboolean enable_imaging)
+void intelInitExtensions(struct st_context *st, GLboolean enable_imaging)
 {
+   GLcontext *ctx = st ? st->ctx : NULL;
    /* Disable imaging extension until convolution is working in teximage paths.
     */
    enable_imaging = GL_FALSE;
@@ -326,7 +327,7 @@ intelCreateContext(const __GLcontextModes * visual,
 
    intel->st = st_create_context(pipe, visual, st_share);
 
-   intelInitExtensions( intel->st->ctx, GL_TRUE );
+   intelInitExtensions( intel->st, GL_TRUE );
 
    return GL_TRUE;
 }
index 406284c..469090c 100644 (file)
@@ -50,6 +50,9 @@ intelContendedLock(struct intel_context *intel, uint flags)
 
    DBG(LOCK, "%s - got contended lock\n", __progname);
 
+   if (sPriv->dri2.enabled)
+      return;
+
    /* If the window moved, may need to set a new cliprect now.
     *
     * NOTE: This releases and regains the hw lock, so all state
@@ -58,8 +61,8 @@ intelContendedLock(struct intel_context *intel, uint flags)
    if (dPriv)
       DRI_VALIDATE_DRAWABLE_INFO(sPriv, dPriv);
 
-   if (sarea->width != intelScreen->front.width ||
-       sarea->height != intelScreen->front.height) {
+   if (sarea && (sarea->width != intelScreen->front.width ||
+                        sarea->height != intelScreen->front.height)) {
 
       intelUpdateScreenRotation(sPriv, sarea);
    }
index 23889c8..a36c940 100644 (file)
@@ -110,116 +110,40 @@ intelHandleDrawableConfig(__DRIdrawablePrivate *dPriv,
                          __DRIcontextPrivate *pcp,
                          __DRIDrawableConfigEvent *event)
 {
-   struct intel_framebuffer *intel_fb = dPriv->driverPrivate;
-   struct intel_region *region = NULL;
-   struct intel_renderbuffer *rb, *depth_rb, *stencil_rb;
-   struct intel_context *intel = pcp->driverPrivate;
-   struct intel_screen *intelScreen = intel_screen(dPriv->driScreenPriv);
-   int cpp, pitch;
-
-#if 0
-   cpp = intelScreen->front.cpp;
-   pitch = ((cpp * dPriv->w + 63) & ~63) / cpp;
-
-   back_surf = st_get_framebuffer_surface(intel_fb->stfb,
-                                          ST_SURFACE_BACK_LEFT);
-   rb = intel_fb->color_rb[1];
-   if (rb) {
-      region = intel_region_alloc(intel, cpp, pitch, dPriv->h);
-      intel_renderbuffer_set_region(rb, region);
-   }
-
-   rb = intel_fb->color_rb[2];
-   if (rb) {
-      region = intel_region_alloc(intel, cpp, pitch, dPriv->h);
-      intel_renderbuffer_set_region(rb, region);
-   }
-
-   depth_rb = intel_get_renderbuffer(&intel_fb->Base, BUFFER_DEPTH);
-   stencil_rb = intel_get_renderbuffer(&intel_fb->Base, BUFFER_STENCIL);
-   if (depth_rb || stencil_rb)
-      region = intel_region_alloc(intel, cpp, pitch, dPriv->h);
-   if (depth_rb)
-      intel_renderbuffer_set_region(depth_rb, region);
-   if (stencil_rb)
-      intel_renderbuffer_set_region(stencil_rb, region);
-
-   /* FIXME: Tell the X server about the regions we just allocated and
-    * attached. */
-#endif
-
+   (void) dPriv;
+   (void) pcp;
+   (void) event;
 }
 
-#define BUFFER_FLAG_TILED 0x0100
-
 static void
 intelHandleBufferAttach(__DRIdrawablePrivate *dPriv,
                        __DRIcontextPrivate *pcp,
                        __DRIBufferAttachEvent *ba)
 {
    struct intel_screen *intelScreen = intel_screen(dPriv->driScreenPriv);
-   struct intel_framebuffer *intel_fb = dPriv->driverPrivate;
-   struct intel_renderbuffer *rb;
-   struct intel_region *region;
-   struct intel_context *intel = pcp->driverPrivate;
-   struct pipe_surface *surf;
-   GLuint tiled;
 
    switch (ba->buffer.attachment) {
    case DRI_DRAWABLE_BUFFER_FRONT_LEFT:
-   #if 0
-   intelScreen->front.width = ba->width;
-   intelScreen->front.height = ba->height;
-   intelScreen->front.offset = sarea->front_offset;
-   #endif
-   intelScreen->front.pitch = ba->buffer.pitch * ba->buffer.cpp;
-   #if 0
-   intelScreen->front.size = sarea->front_size;
-   #endif
+      intelScreen->front.width = dPriv->w;
+      intelScreen->front.height = dPriv->h;
+      intelScreen->front.cpp = ba->buffer.cpp;
+      intelScreen->front.pitch = ba->buffer.pitch;
       driGenBuffers(intelScreen->base.staticPool, "front", 1, &intelScreen->front.buffer, 0, 0, 0);
       driBOSetReferenced(intelScreen->front.buffer, ba->buffer.handle);
-       
       break;
 
-#if 0
    case DRI_DRAWABLE_BUFFER_BACK_LEFT:
-      rb = intel_fb->color_rb[0];
-      break;
-
    case DRI_DRAWABLE_BUFFER_DEPTH:
-     rb = intel_get_renderbuffer(&intel_fb->Base, BUFFER_DEPTH);
-     break;
-
    case DRI_DRAWABLE_BUFFER_STENCIL:
-     rb = intel_get_renderbuffer(&intel_fb->Base, BUFFER_STENCIL);
-     break;
-#endif
-
    case DRI_DRAWABLE_BUFFER_ACCUM:
+      /* anything ?? */
+      break;
+
    default:
-      fprintf(stderr, "unhandled buffer attach event, attacment type %d\n",
+      fprintf(stderr, "unhandled buffer attach event, attachment type %d\n",
              ba->buffer.attachment);
       return;
    }
-
-#if 0
-   /* FIXME: Add this so we can filter out when the X server sends us
-    * attachment events for the buffers we just allocated.  Need to
-    * get the BO handle for a render buffer. */
-   if (intel_renderbuffer_get_region_handle(rb) == ba->buffer.handle)
-      return;
-#endif
-
-#if 0
-   tiled = (ba->buffer.flags & BUFFER_FLAG_TILED) > 0;
-
-   region = intel_region_alloc_for_handle(intel, ba->buffer.cpp,
-                                         ba->buffer.pitch / ba->buffer.cpp,
-                                         dPriv->h, tiled,
-                                         ba->buffer.handle);
-
-   intel_renderbuffer_set_region(rb, region);
-#endif
 }
 
 static const __DRItexOffsetExtension intelTexOffsetExtension = {
index 8036917..d1389a3 100644 (file)
@@ -32,7 +32,7 @@
 #include "i830_common.h"
 #include "xmlconfig.h"
 #include "intel_drm/ws_dri_bufpool.h"
-
+#include "state_tracker/st_context.h"
 #include "pipe/p_compiler.h"
 
 #include "intel_drm/intel_be_device.h"
@@ -116,5 +116,7 @@ intelCreateContext(const __GLcontextModes * visual,
                    __DRIcontextPrivate * driContextPriv,
                    void *sharedContextPrivate);
 
+extern void
+intelInitExtensions(struct st_context *st, GLboolean enable_imaging);
 
 #endif
index 7f3babd..8b17154 100644 (file)
@@ -78,7 +78,8 @@ intelDisplaySurface(__DRIdrawablePrivate *dPriv,
     * current context (which is what intelScreenContext should return) might
     * not get a contended lock and thus cliprects not updated (tests/manywin)
     */
-   if (intel_context(dPriv->driContextPriv) != intel)
+   if (!intel->driScreen->dri2.enabled &&
+        intel_context(dPriv->driContextPriv) != intel)
       DRI_VALIDATE_DRAWABLE_INFO(intel->driScreen, dPriv);
 
 
index 1304311..bb4d3cc 100644 (file)
@@ -50,6 +50,7 @@ INCLUDES = -I. \
        -I$(TOP)/include \
        -I$(TOP)/include/GL/internal \
        -I$(TOP)/src/mesa \
+       -I$(TOP)/src/mesa/glapi \
        -I$(TOP)/src/mesa/main \
        $(LIBDRM_CFLAGS) \
        $(DRI2PROTO_CFLAGS) \