summaryrefslogtreecommitdiffstats
path: root/src/gallium/winsys
diff options
context:
space:
mode:
authorAlan Hourihane <[email protected]>2008-06-11 14:52:55 +0100
committerAlan Hourihane <[email protected]>2008-06-11 14:52:55 +0100
commit1bcb817167773d6a148dd4b2cd63777d0f072c08 (patch)
treefea9712a6aff0f880943da6207d11163a6592e7b /src/gallium/winsys
parent4dd1917e4be3ae48b436ed333bd2fcd37603d1ed (diff)
Hook gallium i915 up to DRI2
Diffstat (limited to 'src/gallium/winsys')
-rw-r--r--src/gallium/winsys/dri/intel/intel_context.c9
-rw-r--r--src/gallium/winsys/dri/intel/intel_lock.c7
-rw-r--r--src/gallium/winsys/dri/intel/intel_screen.c98
-rw-r--r--src/gallium/winsys/dri/intel/intel_screen.h4
-rw-r--r--src/gallium/winsys/dri/intel/intel_swapbuffers.c3
5 files changed, 26 insertions, 95 deletions
diff --git a/src/gallium/winsys/dri/intel/intel_context.c b/src/gallium/winsys/dri/intel/intel_context.c
index ecc4b0aa53e..af440180536 100644
--- a/src/gallium/winsys/dri/intel/intel_context.c
+++ b/src/gallium/winsys/dri/intel/intel_context.c
@@ -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;
}
diff --git a/src/gallium/winsys/dri/intel/intel_lock.c b/src/gallium/winsys/dri/intel/intel_lock.c
index 406284c98fb..469090c0e17 100644
--- a/src/gallium/winsys/dri/intel/intel_lock.c
+++ b/src/gallium/winsys/dri/intel/intel_lock.c
@@ -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);
}
diff --git a/src/gallium/winsys/dri/intel/intel_screen.c b/src/gallium/winsys/dri/intel/intel_screen.c
index 23889c80b8c..a36c9407d4b 100644
--- a/src/gallium/winsys/dri/intel/intel_screen.c
+++ b/src/gallium/winsys/dri/intel/intel_screen.c
@@ -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 = {
diff --git a/src/gallium/winsys/dri/intel/intel_screen.h b/src/gallium/winsys/dri/intel/intel_screen.h
index 80369179031..d1389a31fb5 100644
--- a/src/gallium/winsys/dri/intel/intel_screen.h
+++ b/src/gallium/winsys/dri/intel/intel_screen.h
@@ -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
diff --git a/src/gallium/winsys/dri/intel/intel_swapbuffers.c b/src/gallium/winsys/dri/intel/intel_swapbuffers.c
index 7f3babd98ef..8b17154cf9b 100644
--- a/src/gallium/winsys/dri/intel/intel_swapbuffers.c
+++ b/src/gallium/winsys/dri/intel/intel_swapbuffers.c
@@ -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);