summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/intel
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/drivers/dri/intel')
-rw-r--r--src/mesa/drivers/dri/intel/intel_batchbuffer.c41
-rw-r--r--src/mesa/drivers/dri/intel/intel_batchbuffer.h5
-rw-r--r--src/mesa/drivers/dri/intel/intel_blit.c2
-rw-r--r--src/mesa/drivers/dri/intel/intel_blit.h2
-rw-r--r--src/mesa/drivers/dri/intel/intel_buffer_objects.c1
-rw-r--r--src/mesa/drivers/dri/intel/intel_buffers.c3
-rw-r--r--src/mesa/drivers/dri/intel/intel_context.c298
-rw-r--r--src/mesa/drivers/dri/intel/intel_context.h4
-rw-r--r--src/mesa/drivers/dri/intel/intel_ioctl.c185
-rw-r--r--src/mesa/drivers/dri/intel/intel_ioctl.h46
-rw-r--r--src/mesa/drivers/dri/intel/intel_pixel_bitmap.c1
-rw-r--r--src/mesa/drivers/dri/intel/intel_pixel_copy.c1
-rw-r--r--src/mesa/drivers/dri/intel/intel_pixel_draw.c1
-rw-r--r--src/mesa/drivers/dri/intel/intel_regions.c8
-rw-r--r--src/mesa/drivers/dri/intel/intel_regions.h6
-rw-r--r--src/mesa/drivers/dri/intel/intel_screen.c192
-rw-r--r--src/mesa/drivers/dri/intel/intel_screen.h7
-rw-r--r--src/mesa/drivers/dri/intel/intel_span.c1
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex_format.c2
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex_image.c3
20 files changed, 289 insertions, 520 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_batchbuffer.c b/src/mesa/drivers/dri/intel/intel_batchbuffer.c
index 5afaad070c..7dbc646370 100644
--- a/src/mesa/drivers/dri/intel/intel_batchbuffer.c
+++ b/src/mesa/drivers/dri/intel/intel_batchbuffer.c
@@ -25,8 +25,8 @@
*
**************************************************************************/
+#include "intel_context.h"
#include "intel_batchbuffer.h"
-#include "intel_ioctl.h"
#include "intel_decode.h"
#include "intel_reg.h"
#include "intel_bufmgr.h"
@@ -148,28 +148,15 @@ do_flush_locked(struct intel_batchbuffer *batch,
*/
if (!(intel->numClipRects == 0 &&
- batch->cliprect_mode == LOOP_CLIPRECTS)) {
- if (intel->ttm == GL_TRUE) {
- struct drm_i915_gem_execbuffer *execbuf;
-
- execbuf = dri_process_relocs(batch->buf);
- ret = intel_exec_ioctl(batch->intel,
- used,
- batch->cliprect_mode != LOOP_CLIPRECTS,
- allow_unlock,
- execbuf);
- } else {
- dri_process_relocs(batch->buf);
- ret = intel_batch_ioctl(batch->intel,
- batch->buf->offset,
- used,
- batch->cliprect_mode != LOOP_CLIPRECTS,
- allow_unlock);
- }
+ batch->cliprect_mode == LOOP_CLIPRECTS) || intel->no_hw) {
+ dri_bo_exec(batch->buf, used,
+ intel->pClipRects,
+ batch->cliprect_mode != LOOP_CLIPRECTS ?
+ 0 : intel->numClipRects,
+ (((GLuint) intel->drawX) & 0xffff) |
+ (((GLuint) intel->drawY) << 16));
}
- dri_post_submit(batch->buf);
-
if (intel->numClipRects == 0 &&
batch->cliprect_mode == LOOP_CLIPRECTS) {
if (allow_unlock) {
@@ -261,13 +248,9 @@ _intel_batchbuffer_flush(struct intel_batchbuffer *batch, const char *file,
UNLOCK_HARDWARE(intel);
if (INTEL_DEBUG & DEBUG_SYNC) {
- int irq;
-
fprintf(stderr, "waiting for idle\n");
- LOCK_HARDWARE(intel);
- irq = intelEmitIrqLocked(intel);
- UNLOCK_HARDWARE(intel);
- intelWaitIrq(intel, irq);
+ dri_bo_map(batch->buf, GL_TRUE);
+ dri_bo_unmap(batch->buf);
}
/* Reset the buffer:
@@ -289,8 +272,8 @@ intel_batchbuffer_emit_reloc(struct intel_batchbuffer *batch,
if (batch->ptr - batch->map > batch->buf->size)
_mesa_printf ("bad relocation ptr %p map %p offset %d size %d\n",
batch->ptr, batch->map, batch->ptr - batch->map, batch->buf->size);
- ret = intel_bo_emit_reloc(batch->buf, read_domains, write_domain,
- delta, batch->ptr - batch->map, buffer);
+ ret = dri_bo_emit_reloc(batch->buf, read_domains, write_domain,
+ delta, batch->ptr - batch->map, buffer);
/*
* Using the old buffer offset, write in what the right data would be, in case
diff --git a/src/mesa/drivers/dri/intel/intel_batchbuffer.h b/src/mesa/drivers/dri/intel/intel_batchbuffer.h
index 52d6ecc223..cf7d4a0633 100644
--- a/src/mesa/drivers/dri/intel/intel_batchbuffer.h
+++ b/src/mesa/drivers/dri/intel/intel_batchbuffer.h
@@ -3,11 +3,10 @@
#include "mtypes.h"
-#include "dri_bufmgr.h"
+#include "intel_context.h"
+#include "intel_bufmgr.h"
#include "intel_reg.h"
-struct intel_context;
-
#define BATCH_SZ 16384
#define BATCH_RESERVED 16
diff --git a/src/mesa/drivers/dri/intel/intel_blit.c b/src/mesa/drivers/dri/intel/intel_blit.c
index 7129a4ba91..653f485dd0 100644
--- a/src/mesa/drivers/dri/intel/intel_blit.c
+++ b/src/mesa/drivers/dri/intel/intel_blit.c
@@ -33,13 +33,13 @@
#include "context.h"
#include "enums.h"
-#include "intel_batchbuffer.h"
#include "intel_blit.h"
#include "intel_buffers.h"
#include "intel_context.h"
#include "intel_fbo.h"
#include "intel_reg.h"
#include "intel_regions.h"
+#include "intel_batchbuffer.h"
#define FILE_DEBUG_FLAG DEBUG_BLIT
diff --git a/src/mesa/drivers/dri/intel/intel_blit.h b/src/mesa/drivers/dri/intel/intel_blit.h
index 0881cc4fdc..52065b13ed 100644
--- a/src/mesa/drivers/dri/intel/intel_blit.h
+++ b/src/mesa/drivers/dri/intel/intel_blit.h
@@ -29,8 +29,6 @@
#define INTEL_BLIT_H
#include "intel_context.h"
-#include "intel_ioctl.h"
-#include "dri_bufmgr.h"
extern void intelCopyBuffer(const __DRIdrawablePrivate * dpriv,
const drm_clip_rect_t * rect);
diff --git a/src/mesa/drivers/dri/intel/intel_buffer_objects.c b/src/mesa/drivers/dri/intel/intel_buffer_objects.c
index 1923a21516..88484a07af 100644
--- a/src/mesa/drivers/dri/intel/intel_buffer_objects.c
+++ b/src/mesa/drivers/dri/intel/intel_buffer_objects.c
@@ -34,7 +34,6 @@
#include "intel_buffer_objects.h"
#include "intel_batchbuffer.h"
#include "intel_regions.h"
-#include "dri_bufmgr.h"
static GLboolean intel_bufferobj_unmap(GLcontext * ctx,
GLenum target,
diff --git a/src/mesa/drivers/dri/intel/intel_buffers.c b/src/mesa/drivers/dri/intel/intel_buffers.c
index 77352e6a53..3fe67462d5 100644
--- a/src/mesa/drivers/dri/intel/intel_buffers.c
+++ b/src/mesa/drivers/dri/intel/intel_buffers.c
@@ -618,6 +618,9 @@ intel_wait_flips(struct intel_context *intel)
BUFFER_FRONT_LEFT ? BUFFER_FRONT_LEFT :
BUFFER_BACK_LEFT);
+ if (intel->intelScreen->driScrnPriv->dri2.enabled)
+ return;
+
if (intel_fb->Base.Name == 0 && intel_rb &&
intel_rb->pf_pending == intel_fb->pf_seq) {
GLint pf_planes = intel_fb->pf_planes;
diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c
index 50c1964d87..4d1a742698 100644
--- a/src/mesa/drivers/dri/intel/intel_context.c
+++ b/src/mesa/drivers/dri/intel/intel_context.c
@@ -51,7 +51,6 @@
#include "intel_chipset.h"
#include "intel_buffers.h"
#include "intel_tex.h"
-#include "intel_ioctl.h"
#include "intel_batchbuffer.h"
#include "intel_blit.h"
#include "intel_pixel.h"
@@ -195,6 +194,142 @@ intelGetString(GLcontext * ctx, GLenum name)
}
}
+void
+intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable)
+{
+ struct intel_framebuffer *intel_fb = drawable->driverPrivate;
+ struct intel_renderbuffer *rb;
+ struct intel_region *region, *depth_region;
+ struct intel_context *intel = context->driverPrivate;
+ __DRIbuffer *buffers;
+ __DRIscreen *screen;
+ int i, count;
+ unsigned int attachments[10];
+ uint32_t name;
+ const char *region_name;
+
+ if (INTEL_DEBUG & DEBUG_DRI)
+ fprintf(stderr, "enter %s, drawable %p\n", __func__, drawable);
+
+ screen = intel->intelScreen->driScrnPriv;
+
+ i = 0;
+ if (intel_fb->color_rb[0])
+ attachments[i++] = __DRI_BUFFER_FRONT_LEFT;
+ if (intel_fb->color_rb[1])
+ attachments[i++] = __DRI_BUFFER_BACK_LEFT;
+ if (intel_get_renderbuffer(&intel_fb->Base, BUFFER_DEPTH))
+ attachments[i++] = __DRI_BUFFER_DEPTH;
+ if (intel_get_renderbuffer(&intel_fb->Base, BUFFER_STENCIL))
+ attachments[i++] = __DRI_BUFFER_STENCIL;
+
+ buffers = (*screen->dri2.loader->getBuffers)(drawable,
+ &drawable->w,
+ &drawable->h,
+ attachments, i,
+ &count,
+ drawable->loaderPrivate);
+
+ drawable->x = 0;
+ drawable->y = 0;
+ drawable->backX = 0;
+ drawable->backY = 0;
+ drawable->numClipRects = 1;
+ drawable->pClipRects[0].x1 = 0;
+ drawable->pClipRects[0].y1 = 0;
+ drawable->pClipRects[0].x2 = drawable->w;
+ drawable->pClipRects[0].y2 = drawable->h;
+ drawable->numBackClipRects = 1;
+ drawable->pBackClipRects[0].x1 = 0;
+ drawable->pBackClipRects[0].y1 = 0;
+ drawable->pBackClipRects[0].x2 = drawable->w;
+ drawable->pBackClipRects[0].y2 = drawable->h;
+
+ depth_region = NULL;
+ for (i = 0; i < count; i++) {
+ switch (buffers[i].attachment) {
+ case __DRI_BUFFER_FRONT_LEFT:
+ rb = intel_fb->color_rb[0];
+ region_name = "dri2 front buffer";
+ break;
+
+ case __DRI_BUFFER_BACK_LEFT:
+ rb = intel_fb->color_rb[1];
+ region_name = "dri2 back buffer";
+ break;
+
+ case __DRI_BUFFER_DEPTH:
+ rb = intel_get_renderbuffer(&intel_fb->Base, BUFFER_DEPTH);
+ region_name = "dri2 depth buffer";
+ break;
+
+ case __DRI_BUFFER_STENCIL:
+ rb = intel_get_renderbuffer(&intel_fb->Base, BUFFER_STENCIL);
+ region_name = "dri2 stencil buffer";
+ break;
+
+ case __DRI_BUFFER_ACCUM:
+ default:
+ fprintf(stderr,
+ "unhandled buffer attach event, attacment type %d\n",
+ buffers[i].attachment);
+ return;
+ }
+
+ if (rb->region) {
+ dri_bo_flink(rb->region->buffer, &name);
+ if (name == buffers[i].name)
+ continue;
+ }
+
+ if (INTEL_DEBUG & DEBUG_DRI)
+ fprintf(stderr,
+ "attaching buffer %d, at %d, cpp %d, pitch %d\n",
+ buffers[i].name, buffers[i].attachment,
+ buffers[i].cpp, buffers[i].pitch);
+
+ if (buffers[i].attachment == __DRI_BUFFER_STENCIL && depth_region) {
+ if (INTEL_DEBUG & DEBUG_DRI)
+ fprintf(stderr, "(reusing depth buffer as stencil)\n");
+ intel_region_reference(&region, depth_region);
+ }
+ else
+ region = intel_region_alloc_for_handle(intel, buffers[i].cpp,
+ buffers[i].pitch / buffers[i].cpp,
+ drawable->h,
+ buffers[i].name,
+ region_name);
+
+ if (buffers[i].attachment == __DRI_BUFFER_DEPTH)
+ depth_region = region;
+
+ intel_renderbuffer_set_region(rb, region);
+ intel_region_release(&region);
+ }
+
+ driUpdateFramebufferSize(&intel->ctx, drawable);
+}
+
+static void
+intel_viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h)
+{
+ struct intel_context *intel = intel_context(ctx);
+ __DRIcontext *driContext = intel->driContext;
+
+ if (!driContext->driScreenPriv->dri2.enabled)
+ return;
+
+ intel_update_renderbuffers(driContext, driContext->driDrawablePriv);
+ if (driContext->driDrawablePriv != driContext->driReadablePriv)
+ intel_update_renderbuffers(driContext, driContext->driReadablePriv);
+
+ ctx->Driver.Viewport = NULL;
+ intel->driDrawable = driContext->driDrawablePriv;
+ intelWindowMoved(intel);
+ intel_draw_buffer(ctx, intel->ctx.DrawBuffer);
+ ctx->Driver.Viewport = intel_viewport;
+}
+
/**
* Extension strings exported by the intel driver.
*
@@ -273,10 +408,12 @@ static const struct dri_extension brw_extensions[] = {
{ NULL, NULL }
};
+#ifdef I915_MMIO_READ
static const struct dri_extension arb_oc_extensions[] = {
{"GL_ARB_occlusion_query", GL_ARB_occlusion_query_functions},
{NULL, NULL}
};
+#endif
static const struct dri_extension ttm_extensions[] = {
{"GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions},
@@ -301,10 +438,12 @@ void intelInitExtensions(GLcontext *ctx, GLboolean enable_imaging)
if (intel == NULL || intel->ttm)
driInitExtensions(ctx, ttm_extensions, GL_FALSE);
+#ifdef I915_MMIO_READ
if (intel == NULL ||
(IS_965(intel->intelScreen->deviceID) &&
intel->intelScreen->drmMinor >= 8))
driInitExtensions(ctx, arb_oc_extensions, GL_FALSE);
+#endif
if (intel == NULL || IS_965(intel->intelScreen->deviceID))
driInitExtensions(ctx, brw_extensions, GL_FALSE);
@@ -402,6 +541,7 @@ intelFinish(GLcontext * ctx)
}
}
+#ifdef I915_MMIO_READ
static void
intelBeginQuery(GLcontext *ctx, GLenum target, struct gl_query_object *q)
{
@@ -432,105 +572,7 @@ intelEndQuery(GLcontext *ctx, GLenum target, struct gl_query_object *q)
q->Ready = GL_TRUE;
intel->stats_wm--;
}
-
-/** Driver-specific fence emit implementation for the fake memory manager. */
-static unsigned int
-intel_fence_emit(void *private)
-{
- struct intel_context *intel = (struct intel_context *)private;
- unsigned int fence;
-
- /* XXX: Need to emit a flush, if we haven't already (at least with the
- * current batchbuffer implementation, we have).
- */
-
- fence = intelEmitIrqLocked(intel);
-
- return fence;
-}
-
-/** Driver-specific fence wait implementation for the fake memory manager. */
-static int
-intel_fence_wait(void *private, unsigned int cookie)
-{
- struct intel_context *intel = (struct intel_context *)private;
-
- intelWaitIrq(intel, cookie);
-
- return 0;
-}
-
-static GLboolean
-intel_init_bufmgr(struct intel_context *intel)
-{
- intelScreenPrivate *intelScreen = intel->intelScreen;
- GLboolean gem_disable = getenv("INTEL_NO_GEM") != NULL;
- int gem_kernel = 0;
- GLboolean gem_supported;
- struct drm_i915_getparam gp;
-
- gp.param = I915_PARAM_HAS_GEM;
- gp.value = &gem_kernel;
-
- (void) drmCommandWriteRead(intel->driFd, DRM_I915_GETPARAM, &gp, sizeof(gp));
-
- /* If we've got a new enough DDX that's initializing GEM and giving us
- * object handles for the shared buffers, use that.
- */
- intel->ttm = GL_FALSE;
- if (intel->intelScreen->driScrnPriv->dri2.enabled)
- gem_supported = GL_TRUE;
- else if (intel->intelScreen->driScrnPriv->ddx_version.minor >= 9 &&
- gem_kernel &&
- intel->intelScreen->front.bo_handle != -1)
- gem_supported = GL_TRUE;
- else
- gem_supported = GL_FALSE;
-
- if (!gem_disable && gem_supported) {
- int bo_reuse_mode;
- intel->bufmgr = intel_bufmgr_gem_init(intel->driFd,
- BATCH_SZ);
- if (intel->bufmgr != NULL)
- intel->ttm = GL_TRUE;
-
- bo_reuse_mode = driQueryOptioni(&intel->optionCache, "bo_reuse");
- switch (bo_reuse_mode) {
- case DRI_CONF_BO_REUSE_DISABLED:
- break;
- case DRI_CONF_BO_REUSE_ALL:
- intel_bufmgr_gem_enable_reuse(intel->bufmgr);
- break;
- }
- }
- /* Otherwise, use the classic buffer manager. */
- if (intel->bufmgr == NULL) {
- if (gem_disable) {
- fprintf(stderr, "GEM disabled. Using classic.\n");
- } else {
- fprintf(stderr, "Failed to initialize GEM. "
- "Falling back to classic.\n");
- }
-
- if (intelScreen->tex.size == 0) {
- fprintf(stderr, "[%s:%u] Error initializing buffer manager.\n",
- __func__, __LINE__);
- return GL_FALSE;
- }
-
- intel->bufmgr = intel_bufmgr_fake_init(intelScreen->tex.offset,
- intelScreen->tex.map,
- intelScreen->tex.size,
- intel_fence_emit,
- intel_fence_wait,
- intel);
- }
-
- /* XXX bufmgr should be per-screen, not per-context */
- intelScreen->ttm = intel->ttm;
-
- return GL_TRUE;
-}
+#endif
void
intelInitDriverFunctions(struct dd_function_table *functions)
@@ -541,14 +583,17 @@ intelInitDriverFunctions(struct dd_function_table *functions)
functions->Finish = intelFinish;
functions->GetString = intelGetString;
functions->UpdateState = intelInvalidateState;
+ functions->Viewport = intel_viewport;
functions->CopyColorTable = _swrast_CopyColorTable;
functions->CopyColorSubTable = _swrast_CopyColorSubTable;
functions->CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D;
functions->CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D;
+#ifdef I915_MMIO_READ
functions->BeginQuery = intelBeginQuery;
functions->EndQuery = intelEndQuery;
+#endif
intelInitTextureFuncs(functions);
intelInitStateFuncs(functions);
@@ -568,8 +613,6 @@ intelInitContext(struct intel_context *intel,
GLcontext *shareCtx = (GLcontext *) sharedContextPrivate;
__DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
intelScreenPrivate *intelScreen = (intelScreenPrivate *) sPriv->private;
- volatile struct drm_i915_sarea *saPriv = (struct drm_i915_sarea *)
- (((GLubyte *) sPriv->pSAREA) + intelScreen->sarea_priv_offset);
int fthrottle_mode;
if (!_mesa_initialize_context(&intel->ctx, mesaVis, shareCtx,
@@ -581,7 +624,8 @@ intelInitContext(struct intel_context *intel,
driContextPriv->driverPrivate = intel;
intel->intelScreen = intelScreen;
intel->driScreen = sPriv;
- intel->sarea = saPriv;
+ intel->sarea = intelScreen->sarea;
+ intel->driContext = driContextPriv;
/* Dri stuff */
intel->hHWContext = driContextPriv->hHWContext;
@@ -599,8 +643,20 @@ intelInitContext(struct intel_context *intel,
else
intel->maxBatchSize = BATCH_SZ;
- if (!intel_init_bufmgr(intel))
- return GL_FALSE;
+ intel->bufmgr = intelScreen->bufmgr;
+ intel->ttm = intelScreen->ttm;
+ if (intel->ttm) {
+ int bo_reuse_mode;
+
+ bo_reuse_mode = driQueryOptioni(&intel->optionCache, "bo_reuse");
+ switch (bo_reuse_mode) {
+ case DRI_CONF_BO_REUSE_DISABLED:
+ break;
+ case DRI_CONF_BO_REUSE_ALL:
+ intel_bufmgr_gem_enable_reuse(intel->bufmgr);
+ break;
+ }
+ }
ctx->Const.MaxTextureMaxAnisotropy = 2.0;
@@ -783,11 +839,14 @@ intelMakeCurrent(__DRIcontextPrivate * driContextPriv,
struct intel_framebuffer *intel_fb =
(struct intel_framebuffer *) driDrawPriv->driverPrivate;
GLframebuffer *readFb = (GLframebuffer *) driReadPriv->driverPrivate;
-
-
- /* XXX FBO temporary fix-ups! */
- /* if the renderbuffers don't have regions, init them from the context */
- if (!driContextPriv->driScreenPriv->dri2.enabled) {
+
+ if (driContextPriv->driScreenPriv->dri2.enabled) {
+ intel_update_renderbuffers(driContextPriv, driDrawPriv);
+ if (driDrawPriv != driReadPriv)
+ intel_update_renderbuffers(driContextPriv, driReadPriv);
+ } else {
+ /* XXX FBO temporary fix-ups! */
+ /* if the renderbuffers don't have regions, init them from the context */
struct intel_renderbuffer *irbDepth
= intel_get_renderbuffer(&intel_fb->Base, BUFFER_DEPTH);
struct intel_renderbuffer *irbStencil
@@ -989,18 +1048,12 @@ void LOCK_HARDWARE( struct intel_context *intel )
intel_fb->vbl_waited = vbl.reply.sequence;
}
- DRM_CAS(intel->driHwLock, intel->hHWContext,
- (DRM_LOCK_HELD|intel->hHWContext), __ret);
+ if (!sPriv->dri2.enabled) {
+ DRM_CAS(intel->driHwLock, intel->hHWContext,
+ (DRM_LOCK_HELD|intel->hHWContext), __ret);
- if (sPriv->dri2.enabled) {
if (__ret)
- drmGetLock(intel->driFd, intel->hHWContext, 0);
- if (__driParseEvents(dPriv->driContextPriv, dPriv)) {
- intelWindowMoved(intel);
- intel_draw_buffer(&intel->ctx, intel->ctx.DrawBuffer);
- }
- } else if (__ret) {
- intelContendedLock( intel, 0 );
+ intelContendedLock( intel, 0 );
}
@@ -1013,10 +1066,13 @@ void LOCK_HARDWARE( struct intel_context *intel )
*/
void UNLOCK_HARDWARE( struct intel_context *intel )
{
+ __DRIscreen *sPriv = intel->driScreen;
+
intel->vtbl.note_unlock( intel );
intel->locked = 0;
- DRM_UNLOCK(intel->driFd, intel->driHwLock, intel->hHWContext);
+ if (!sPriv->dri2.enabled)
+ DRM_UNLOCK(intel->driFd, intel->driHwLock, intel->hHWContext);
_glthread_UNLOCK_MUTEX(lockMutex);
diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h
index f9a373cf74..8bd75753ea 100644
--- a/src/mesa/drivers/dri/intel/intel_context.h
+++ b/src/mesa/drivers/dri/intel/intel_context.h
@@ -34,7 +34,6 @@
#include "drm.h"
#include "mm.h"
#include "texmem.h"
-#include "dri_bufmgr.h"
#include "intel_bufmgr.h"
#include "intel_screen.h"
@@ -257,6 +256,7 @@ struct intel_context
drmLock *driHwLock;
int driFd;
+ __DRIcontextPrivate *driContext;
__DRIdrawablePrivate *driDrawable;
__DRIdrawablePrivate *driReadDrawable;
__DRIscreenPrivate *driScreen;
@@ -492,6 +492,8 @@ extern int intel_translate_stencil_op(GLenum op);
extern int intel_translate_blend_factor(GLenum factor);
extern int intel_translate_logic_op(GLenum opcode);
+void intel_update_renderbuffers(__DRIcontext *context,
+ __DRIdrawable *drawable);
/*======================================================================
* Inline conversion functions.
diff --git a/src/mesa/drivers/dri/intel/intel_ioctl.c b/src/mesa/drivers/dri/intel/intel_ioctl.c
deleted file mode 100644
index 58c81766cd..0000000000
--- a/src/mesa/drivers/dri/intel/intel_ioctl.c
+++ /dev/null
@@ -1,185 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-
-#include <stdio.h>
-#include <unistd.h>
-#include <errno.h>
-#include <sched.h>
-#include <sys/types.h>
-#include <sys/ioctl.h>
-
-#include "mtypes.h"
-#include "context.h"
-#include "swrast/swrast.h"
-
-#include "intel_context.h"
-#include "intel_ioctl.h"
-#include "intel_batchbuffer.h"
-#include "intel_blit.h"
-#include "intel_regions.h"
-#include "drm.h"
-#include "i915_drm.h"
-
-#include "intel_bufmgr.h"
-
-#define FILE_DEBUG_FLAG DEBUG_IOCTL
-
-int
-intelEmitIrqLocked(struct intel_context *intel)
-{
- struct drm_i915_irq_emit ie;
- int ret, seq = 1;
-
- if (intel->no_hw)
- return 1;
-
- /*
- assert(((*(int *)intel->driHwLock) & ~DRM_LOCK_CONT) ==
- (DRM_LOCK_HELD|intel->hHWContext));
- */
-
- ie.irq_seq = &seq;
-
- ret = drmCommandWriteRead(intel->driFd, DRM_I915_IRQ_EMIT, &ie, sizeof(ie));
- if (ret) {
- fprintf(stderr, "%s: drm_i915_irq_emit: %d\n", __FUNCTION__, ret);
- exit(1);
- }
-
- DBG("%s --> %d\n", __FUNCTION__, seq);
-
- return seq;
-}
-
-void
-intelWaitIrq(struct intel_context *intel, int seq)
-{
- struct drm_i915_irq_wait iw;
- int ret, lastdispatch;
- volatile struct drm_i915_sarea *sarea = intel->sarea;
-
- if (intel->no_hw)
- return;
-
- DBG("%s %d\n", __FUNCTION__, seq);
-
- iw.irq_seq = seq;
-
- do {
- lastdispatch = sarea->last_dispatch;
- ret = drmCommandWrite(intel->driFd, DRM_I915_IRQ_WAIT, &iw, sizeof(iw));
- } while (ret == -EAGAIN ||
- ret == -EINTR ||
- (ret == -EBUSY && lastdispatch != sarea->last_dispatch) ||
- (ret == 0 && seq > sarea->last_dispatch) ||
- (ret == 0 && sarea->last_dispatch - seq >= (1 << 24)));
-
- if (ret) {
- fprintf(stderr, "%s: drm_i915_irq_wait: %d\n", __FUNCTION__, ret);
- exit(1);
- }
-}
-
-
-int
-intel_batch_ioctl(struct intel_context *intel,
- GLuint start_offset,
- GLuint used,
- GLboolean ignore_cliprects, GLboolean allow_unlock)
-{
- struct drm_i915_batchbuffer batch;
-
- if (intel->no_hw)
- return 0;
-
- assert(intel->locked);
- assert(used);
-
- DBG("%s used %d offset %x..%x ignore_cliprects %d\n",
- __FUNCTION__,
- used, start_offset, start_offset + used, ignore_cliprects);
-
- /* Throw away non-effective packets. Won't work once we have
- * hardware contexts which would preserve statechanges beyond a
- * single buffer.
- */
- batch.start = start_offset;
- batch.used = used;
- batch.cliprects = intel->pClipRects;
- batch.num_cliprects = ignore_cliprects ? 0 : intel->numClipRects;
- batch.DR1 = 0;
- batch.DR4 = ((((GLuint) intel->drawX) & 0xffff) |
- (((GLuint) intel->drawY) << 16));
-
- DBG("%s: 0x%x..0x%x DR4: %x cliprects: %d\n",
- __FUNCTION__,
- batch.start,
- batch.start + batch.used * 4, batch.DR4, batch.num_cliprects);
-
- if (drmCommandWrite(intel->driFd, DRM_I915_BATCHBUFFER, &batch,
- sizeof(batch))) {
- fprintf(stderr, "DRM_I915_BATCHBUFFER: %d\n", -errno);
- return -errno;
- }
-
- return 0;
-}
-
-int
-intel_exec_ioctl(struct intel_context *intel,
- GLuint used,
- GLboolean ignore_cliprects, GLboolean allow_unlock,
- struct drm_i915_gem_execbuffer *execbuf)
-{
- int ret;
-
- assert(intel->locked);
- assert(used);
-
- if (intel->no_hw)
- return 0;
-
- execbuf->batch_start_offset = 0;
- execbuf->batch_len = used;
- execbuf->cliprects_ptr = (uintptr_t)intel->pClipRects;
- execbuf->num_cliprects = ignore_cliprects ? 0 : intel->numClipRects;
- execbuf->DR1 = 0;
- execbuf->DR4 = ((((GLuint) intel->drawX) & 0xffff) |
- (((GLuint) intel->drawY) << 16));
-
- do {
- ret = ioctl(intel->driFd, DRM_IOCTL_I915_GEM_EXECBUFFER, execbuf);
- } while (ret == -EAGAIN);
-
- if (ret != 0) {
- fprintf(stderr, "DRM_I915_GEM_EXECBUFFER: %d\n", -errno);
- return -errno;
- }
-
- return 0;
-}
diff --git a/src/mesa/drivers/dri/intel/intel_ioctl.h b/src/mesa/drivers/dri/intel/intel_ioctl.h
deleted file mode 100644
index 526e38358c..0000000000
--- a/src/mesa/drivers/dri/intel/intel_ioctl.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-#ifndef INTEL_IOCTL_H
-#define INTEL_IOCTL_H
-
-#include "intel_context.h"
-
-void intelWaitIrq( struct intel_context *intel, int seq );
-int intelEmitIrqLocked( struct intel_context *intel );
-
-int intel_batch_ioctl(struct intel_context *intel,
- GLuint start_offset,
- GLuint used,
- GLboolean ignore_cliprects,
- GLboolean allow_unlock);
-int intel_exec_ioctl(struct intel_context *intel,
- GLuint used,
- GLboolean ignore_cliprects, GLboolean allow_unlock,
- struct drm_i915_gem_execbuffer *execbuf);
-
-#endif
diff --git a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c
index 7e0d20e681..daa6d4be17 100644
--- a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c
+++ b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c
@@ -36,7 +36,6 @@
#include "intel_screen.h"
#include "intel_context.h"
-#include "intel_ioctl.h"
#include "intel_batchbuffer.h"
#include "intel_blit.h"
#include "intel_regions.h"
diff --git a/src/mesa/drivers/dri/intel/intel_pixel_copy.c b/src/mesa/drivers/dri/intel/intel_pixel_copy.c
index 3093ccf7c6..1c72d6179d 100644
--- a/src/mesa/drivers/dri/intel/intel_pixel_copy.c
+++ b/src/mesa/drivers/dri/intel/intel_pixel_copy.c
@@ -35,7 +35,6 @@
#include "intel_screen.h"
#include "intel_context.h"
-#include "intel_ioctl.h"
#include "intel_batchbuffer.h"
#include "intel_buffers.h"
#include "intel_blit.h"
diff --git a/src/mesa/drivers/dri/intel/intel_pixel_draw.c b/src/mesa/drivers/dri/intel/intel_pixel_draw.c
index 5675084da5..47460da9aa 100644
--- a/src/mesa/drivers/dri/intel/intel_pixel_draw.c
+++ b/src/mesa/drivers/dri/intel/intel_pixel_draw.c
@@ -35,7 +35,6 @@
#include "intel_screen.h"
#include "intel_context.h"
-#include "intel_ioctl.h"
#include "intel_batchbuffer.h"
#include "intel_blit.h"
#include "intel_buffers.h"
diff --git a/src/mesa/drivers/dri/intel/intel_regions.c b/src/mesa/drivers/dri/intel/intel_regions.c
index ddfdce3835..1cfc8ddd64 100644
--- a/src/mesa/drivers/dri/intel/intel_regions.c
+++ b/src/mesa/drivers/dri/intel/intel_regions.c
@@ -46,7 +46,6 @@
#include "intel_regions.h"
#include "intel_blit.h"
#include "intel_buffer_objects.h"
-#include "dri_bufmgr.h"
#include "intel_bufmgr.h"
#include "intel_batchbuffer.h"
#include "intel_chipset.h"
@@ -145,12 +144,12 @@ intel_region_alloc(struct intel_context *intel,
struct intel_region *
intel_region_alloc_for_handle(struct intel_context *intel,
GLuint cpp, GLuint pitch, GLuint height,
- GLuint handle)
+ GLuint handle, const char *name)
{
struct intel_region *region;
dri_bo *buffer;
- buffer = intel_bo_gem_create_from_name(intel->bufmgr, "dri2 region", handle);
+ buffer = intel_bo_gem_create_from_name(intel->bufmgr, name, handle);
region = intel_region_alloc_internal(intel, cpp, pitch, height, buffer);
if (region == NULL)
@@ -164,6 +163,9 @@ intel_region_alloc_for_handle(struct intel_context *intel,
void
intel_region_reference(struct intel_region **dst, struct intel_region *src)
{
+ if (src)
+ DBG("%s %d\n", __FUNCTION__, src->refcount);
+
assert(*dst == NULL);
if (src) {
src->refcount++;
diff --git a/src/mesa/drivers/dri/intel/intel_regions.h b/src/mesa/drivers/dri/intel/intel_regions.h
index e5f19fbb45..a561de485e 100644
--- a/src/mesa/drivers/dri/intel/intel_regions.h
+++ b/src/mesa/drivers/dri/intel/intel_regions.h
@@ -34,8 +34,10 @@
* the basic structure for rectangular collections of pixels stored in a dri_bo.
*/
+#include <xf86drm.h>
+
#include "mtypes.h"
-#include "dri_bufmgr.h"
+#include "intel_bufmgr.h"
struct intel_context;
struct intel_buffer_object;
@@ -76,7 +78,7 @@ struct intel_region *intel_region_alloc(struct intel_context *intel,
struct intel_region *
intel_region_alloc_for_handle(struct intel_context *intel,
GLuint cpp, GLuint pitch, GLuint height,
- unsigned int handle);
+ unsigned int handle, const char *name);
void intel_region_reference(struct intel_region **dst,
struct intel_region *src);
diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c
index 9ed89906d5..1de1ac49ea 100644
--- a/src/mesa/drivers/dri/intel/intel_screen.c
+++ b/src/mesa/drivers/dri/intel/intel_screen.c
@@ -41,7 +41,6 @@
#include "intel_buffers.h"
#include "intel_tex.h"
#include "intel_span.h"
-#include "intel_ioctl.h"
#include "intel_fbo.h"
#include "intel_chipset.h"
@@ -211,102 +210,6 @@ intelUpdateScreenFromSAREA(intelScreenPrivate * intelScreen,
intelPrintSAREA(sarea);
}
-
-/**
- * DRI2 entrypoint
- */
-static void
-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;
- int cpp, pitch;
-
- cpp = intel->ctx.Visual.rgbBits / 8;
- pitch = ((cpp * dPriv->w + 63) & ~63) / cpp;
-
- 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. */
-}
-
-/**
- * DRI2 entrypoint
- */
-static void
-intelHandleBufferAttach(__DRIdrawablePrivate *dPriv,
- __DRIcontextPrivate *pcp,
- __DRIBufferAttachEvent *ba)
-{
- struct intel_framebuffer *intel_fb = dPriv->driverPrivate;
- struct intel_renderbuffer *rb;
- struct intel_region *region;
- struct intel_context *intel = pcp->driverPrivate;
-
- switch (ba->buffer.attachment) {
- case DRI_DRAWABLE_BUFFER_FRONT_LEFT:
- rb = intel_fb->color_rb[0];
- break;
-
- 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;
-
- case DRI_DRAWABLE_BUFFER_ACCUM:
- default:
- fprintf(stderr, "unhandled buffer attach event, attacment 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
-
- region = intel_region_alloc_for_handle(intel, ba->buffer.cpp,
- ba->buffer.pitch / ba->buffer.cpp,
- dPriv->h,
- ba->buffer.handle);
-
- intel_renderbuffer_set_region(rb, region);
-}
-
static const __DRItexOffsetExtension intelTexOffsetExtension = {
{ __DRI_TEX_OFFSET },
intelSetTexOffset,
@@ -370,9 +273,9 @@ static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv)
intelScreen->driScrnPriv = sPriv;
sPriv->private = (void *) intelScreen;
- intelScreen->sarea_priv_offset = gDRIPriv->sarea_priv_offset;
sarea = (struct drm_i915_sarea *)
- (((GLubyte *) sPriv->pSAREA) + intelScreen->sarea_priv_offset);
+ (((GLubyte *) sPriv->pSAREA) + gDRIPriv->sarea_priv_offset);
+ intelScreen->sarea = sarea;
intelScreen->deviceID = gDRIPriv->deviceID;
@@ -385,8 +288,6 @@ static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv)
return GL_FALSE;
}
- intelScreen->sarea_priv_offset = gDRIPriv->sarea_priv_offset;
-
if (0)
intelPrintDRIInfo(intelScreen, sPriv, gDRIPriv);
@@ -647,6 +548,69 @@ intelFillInModes(__DRIscreenPrivate *psp,
return configs;
}
+static GLboolean
+intel_init_bufmgr(intelScreenPrivate *intelScreen)
+{
+ GLboolean gem_disable = getenv("INTEL_NO_GEM") != NULL;
+ int gem_kernel = 0;
+ GLboolean gem_supported;
+ struct drm_i915_getparam gp;
+ __DRIscreenPrivate *spriv = intelScreen->driScrnPriv;
+
+ intelScreen->no_hw = getenv("INTEL_NO_HW") != NULL;
+
+ gp.param = I915_PARAM_HAS_GEM;
+ gp.value = &gem_kernel;
+
+ (void) drmCommandWriteRead(spriv->fd, DRM_I915_GETPARAM, &gp, sizeof(gp));
+
+ /* If we've got a new enough DDX that's initializing GEM and giving us
+ * object handles for the shared buffers, use that.
+ */
+ intelScreen->ttm = GL_FALSE;
+ if (intelScreen->driScrnPriv->dri2.enabled)
+ gem_supported = GL_TRUE;
+ else if (intelScreen->driScrnPriv->ddx_version.minor >= 9 &&
+ gem_kernel &&
+ intelScreen->front.bo_handle != -1)
+ gem_supported = GL_TRUE;
+ else
+ gem_supported = GL_FALSE;
+
+ if (!gem_disable && gem_supported) {
+ intelScreen->bufmgr = intel_bufmgr_gem_init(spriv->fd, BATCH_SZ);
+ if (intelScreen->bufmgr != NULL)
+ intelScreen->ttm = GL_TRUE;
+ }
+ /* Otherwise, use the classic buffer manager. */
+ if (intelScreen->bufmgr == NULL) {
+ if (gem_disable) {
+ fprintf(stderr, "GEM disabled. Using classic.\n");
+ } else {
+ fprintf(stderr, "Failed to initialize GEM. "
+ "Falling back to classic.\n");
+ }
+
+ if (intelScreen->tex.size == 0) {
+ fprintf(stderr, "[%s:%u] Error initializing buffer manager.\n",
+ __func__, __LINE__);
+ return GL_FALSE;
+ }
+
+ intelScreen->bufmgr =
+ intel_bufmgr_fake_init(spriv->fd,
+ intelScreen->tex.offset,
+ intelScreen->tex.map,
+ intelScreen->tex.size,
+ (unsigned int * volatile)
+ &intelScreen->sarea->last_dispatch);
+ }
+
+ /* XXX bufmgr should be per-screen, not per-context */
+ intelScreen->ttm = intelScreen->ttm;
+
+ return GL_TRUE;
+}
/**
* This is the driver specific part of the createNewScreen entry point.
@@ -658,6 +622,7 @@ intelFillInModes(__DRIscreenPrivate *psp,
*/
static const __DRIconfig **intelInitScreen(__DRIscreenPrivate *psp)
{
+ intelScreenPrivate *intelScreen;
#ifdef I915
static const __DRIversion ddx_expected = { 1, 5, 0 };
#else
@@ -691,6 +656,10 @@ static const __DRIconfig **intelInitScreen(__DRIscreenPrivate *psp)
psp->extensions = intelScreenExtensions;
+ intelScreen = psp->private;
+ if (!intel_init_bufmgr(intelScreen))
+ return GL_FALSE;
+
return (const __DRIconfig **)
intelFillInModes(psp, dri_priv->cpp * 8,
(dri_priv->cpp == 2) ? 16 : 24,
@@ -750,26 +719,15 @@ __DRIconfig **intelInitScreen2(__DRIscreenPrivate *psp)
intelScreen->drmMinor = psp->drm_version.minor;
- /* Determine chipset ID? */
+ /* Determine chipset ID */
if (!intel_get_param(psp, I915_PARAM_CHIPSET_ID,
&intelScreen->deviceID))
return GL_FALSE;
- /* Determine if IRQs are active? */
- if (!intel_get_param(psp, I915_PARAM_IRQ_ACTIVE,
- &intelScreen->irq_active))
- return GL_FALSE;
-
- /* Determine if batchbuffers are allowed */
- if (!intel_get_param(psp, I915_PARAM_ALLOW_BATCHBUFFER,
- &intelScreen->allow_batchbuffer))
- return GL_FALSE;
-
- if (!intelScreen->allow_batchbuffer) {
- fprintf(stderr, "batch buffer not allowed\n");
- return GL_FALSE;
- }
+ if (!intel_init_bufmgr(intelScreen))
+ return GL_FALSE;
+ intelScreen->irq_active = 1;
psp->extensions = intelScreenExtensions;
return driConcatConfigs(intelFillInModes(psp, 16, 16, 0, 1),
@@ -792,6 +750,4 @@ const struct __DriverAPIRec driDriverAPI = {
.CopySubBuffer = intelCopySubBuffer,
.InitScreen2 = intelInitScreen2,
- .HandleDrawableConfig = intelHandleDrawableConfig,
- .HandleBufferAttach = intelHandleBufferAttach,
};
diff --git a/src/mesa/drivers/dri/intel/intel_screen.h b/src/mesa/drivers/dri/intel/intel_screen.h
index 9a73b13951..daf2ab4c58 100644
--- a/src/mesa/drivers/dri/intel/intel_screen.h
+++ b/src/mesa/drivers/dri/intel/intel_screen.h
@@ -30,6 +30,7 @@
#include <sys/time.h>
#include "dri_util.h"
+#include "intel_bufmgr.h"
#include "i915_drm.h"
#include "xmlconfig.h"
@@ -67,14 +68,18 @@ typedef struct
int logTextureGranularity;
__DRIscreenPrivate *driScrnPriv;
- unsigned int sarea_priv_offset;
+
+ volatile struct drm_i915_sarea *sarea;
int drmMinor;
int irq_active;
int allow_batchbuffer;
+ GLboolean no_hw;
+
int ttm;
+ dri_bufmgr *bufmgr;
/**
* Configuration cache with default values for all contexts
diff --git a/src/mesa/drivers/dri/intel/intel_span.c b/src/mesa/drivers/dri/intel/intel_span.c
index edede3a74b..0ea8576a02 100644
--- a/src/mesa/drivers/dri/intel/intel_span.c
+++ b/src/mesa/drivers/dri/intel/intel_span.c
@@ -34,7 +34,6 @@
#include "intel_screen.h"
#include "intel_span.h"
#include "intel_regions.h"
-#include "intel_ioctl.h"
#include "intel_tex.h"
#include "swrast/swrast.h"
diff --git a/src/mesa/drivers/dri/intel/intel_tex_format.c b/src/mesa/drivers/dri/intel/intel_tex_format.c
index 349a29bd71..8ae80e1601 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_format.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_format.c
@@ -138,7 +138,7 @@ intelChooseTextureFormat(GLcontext * ctx, GLint internalFormat,
case GL_DEPTH_STENCIL_EXT:
case GL_DEPTH24_STENCIL8_EXT:
- return &_mesa_texformat_z24_s8;
+ return &_mesa_texformat_s8_z24;
#ifndef I915
case GL_SRGB_EXT:
diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c
index c11687a2cf..d1f540b0f1 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_image.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_image.c
@@ -21,7 +21,6 @@
#include "intel_buffer_objects.h"
#include "intel_batchbuffer.h"
#include "intel_tex.h"
-#include "intel_ioctl.h"
#include "intel_blit.h"
#include "intel_fbo.h"
@@ -731,7 +730,7 @@ intelSetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawable *dPriv)
if (!intelObj)
return;
- __driParseEvents(pDRICtx, dPriv);
+ intel_update_renderbuffers(pDRICtx, dPriv);
rb = intel_fb->color_rb[0];
type = GL_BGRA;