summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/i915tex/intel_context.c
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2007-09-21 17:05:34 -0700
committerEric Anholt <eric@anholt.net>2007-09-21 17:13:20 -0700
commit39c709c0f6a9b2c910265390b31ce233a991ab68 (patch)
treea4484723b11f36f822e3bfeeeaa3652da2753859 /src/mesa/drivers/dri/i915tex/intel_context.c
parent6016de689fb9f29fe148b5ff0daf0b34a8510e23 (diff)
parentd0350dadaa52064f67e4e9001145af14478b2849 (diff)
Merge branch 'i915-unification'
This branch replaces the DRM pool interface used by i915tex with a "dri_bufmgr" interface in dri/common which may be set up to use either TTM or traditional static memory management according to what is available. The i915tex TTM code now requires an updated DDX which provides proper buffer objects for the static front/back/depth, instead of using fake buffers. The driver is now built as i915_dri.so, and should replace the old i915 driver shortly.
Diffstat (limited to 'src/mesa/drivers/dri/i915tex/intel_context.c')
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_context.c46
1 files changed, 28 insertions, 18 deletions
diff --git a/src/mesa/drivers/dri/i915tex/intel_context.c b/src/mesa/drivers/dri/i915tex/intel_context.c
index 40ea756412..16fbe38e64 100644
--- a/src/mesa/drivers/dri/i915tex/intel_context.c
+++ b/src/mesa/drivers/dri/i915tex/intel_context.c
@@ -59,6 +59,7 @@
#include "intel_regions.h"
#include "intel_buffer_objects.h"
#include "intel_fbo.h"
+#include "intel_decode.h"
#include "drirenderbuffer.h"
#include "vblank.h"
@@ -176,7 +177,6 @@ const struct dri_extension card_extensions[] = {
{"GL_ARB_texture_mirrored_repeat", NULL},
{"GL_ARB_texture_rectangle", NULL},
{"GL_ARB_vertex_buffer_object", GL_ARB_vertex_buffer_object_functions},
- {"GL_ARB_pixel_buffer_object", NULL},
{"GL_ARB_vertex_program", GL_ARB_vertex_program_functions},
{"GL_ARB_window_pos", GL_ARB_window_pos_functions},
{"GL_EXT_blend_color", GL_EXT_blend_color_functions},
@@ -187,7 +187,6 @@ const struct dri_extension card_extensions[] = {
{"GL_EXT_blend_subtract", NULL},
{"GL_EXT_cull_vertex", GL_EXT_cull_vertex_functions},
{"GL_EXT_fog_coord", GL_EXT_fog_coord_functions},
- {"GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions},
{"GL_EXT_multi_draw_arrays", GL_EXT_multi_draw_arrays_functions},
#if 1 /* XXX FBO temporary? */
{"GL_EXT_packed_depth_stencil", NULL},
@@ -210,6 +209,12 @@ const struct dri_extension card_extensions[] = {
{NULL, NULL}
};
+const struct dri_extension ttm_extensions[] = {
+ {"GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions},
+ {"GL_ARB_pixel_buffer_object", NULL},
+ {NULL, NULL}
+};
+
extern const struct tnl_pipeline_stage _intel_render_stage;
static const struct tnl_pipeline_stage *intel_pipeline[] = {
@@ -314,9 +319,8 @@ intelFinish(GLcontext * ctx)
struct intel_context *intel = intel_context(ctx);
intelFlush(ctx);
if (intel->batch->last_fence) {
- driFenceFinish(intel->batch->last_fence,
- 0, GL_FALSE);
- driFenceUnReference(intel->batch->last_fence);
+ dri_fence_wait(intel->batch->last_fence);
+ dri_fence_unreference(intel->batch->last_fence);
intel->batch->last_fence = NULL;
}
intelCheckFrontRotate(ctx);
@@ -358,15 +362,7 @@ intelInitContext(struct intel_context *intel,
drmI830Sarea *saPriv = (drmI830Sarea *)
(((GLubyte *) sPriv->pSAREA) + intelScreen->sarea_priv_offset);
int fthrottle_mode;
- GLboolean havePools;
- DRM_LIGHT_LOCK(sPriv->fd, &sPriv->pSAREA->lock, driContextPriv->hHWContext);
- havePools = intelCreatePools(intelScreen);
- DRM_UNLOCK(sPriv->fd, &sPriv->pSAREA->lock, driContextPriv->hHWContext);
-
- if (!havePools)
- return GL_FALSE;
-
if (!_mesa_initialize_context(&intel->ctx,
mesaVis, shareCtx,
functions, (void *) intel))
@@ -460,7 +456,6 @@ intelInitContext(struct intel_context *intel,
intel->RenderIndex = ~0;
fthrottle_mode = driQueryOptioni(&intel->optionCache, "fthrottle_mode");
- intel->iw.irq_seq = -1;
intel->irqsEmitted = 0;
intel->do_irqs = (intel->intelScreen->irq_active &&
@@ -477,6 +472,9 @@ intelInitContext(struct intel_context *intel,
/* GL_TRUE, */
GL_FALSE);
+ if (intelScreen->ttm)
+ driInitExtensions(ctx, ttm_extensions, GL_FALSE);
+
intel->batch = intel_batchbuffer_alloc(intel);
intel->last_swap_fence = NULL;
@@ -533,13 +531,13 @@ intelDestroyContext(__DRIcontextPrivate * driContextPriv)
intel_batchbuffer_free(intel->batch);
if (intel->last_swap_fence) {
- driFenceFinish(intel->last_swap_fence, DRM_FENCE_TYPE_EXE, GL_TRUE);
- driFenceUnReference(intel->last_swap_fence);
+ dri_fence_wait(intel->last_swap_fence);
+ dri_fence_unreference(intel->last_swap_fence);
intel->last_swap_fence = NULL;
}
if (intel->first_swap_fence) {
- driFenceFinish(intel->first_swap_fence, DRM_FENCE_TYPE_EXE, GL_TRUE);
- driFenceUnReference(intel->first_swap_fence);
+ dri_fence_wait(intel->first_swap_fence);
+ dri_fence_unreference(intel->first_swap_fence);
intel->first_swap_fence = NULL;
}
@@ -671,6 +669,18 @@ intelContendedLock(struct intel_context *intel, GLuint flags)
if (dPriv)
DRI_VALIDATE_DRAWABLE_INFO(sPriv, dPriv);
+ /* If the last consumer of the texture memory wasn't us, notify the fake
+ * bufmgr and record the new owner. We should have the memory shared
+ * between contexts of a single fake bufmgr, but this will at least make
+ * things correct for now.
+ */
+ if (!intel->intelScreen->ttm && sarea->texAge != intel->hHWContext) {
+ sarea->texAge = intel->hHWContext;
+ dri_bufmgr_fake_contended_lock_take(intel->intelScreen->bufmgr);
+ if (INTEL_DEBUG & DEBUG_BATCH)
+ intel_decode_context_reset();
+ }
+
if (sarea->width != intelScreen->width ||
sarea->height != intelScreen->height ||
sarea->rotation != intelScreen->current_rotation) {