summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/i915tex
diff options
context:
space:
mode:
authorNian Wu <nian@graphics.(none)>2007-02-25 09:40:28 -0800
committerNian Wu <nian@graphics.(none)>2007-02-25 09:40:28 -0800
commit675f7f627bec92315bf168a9c872ffc05f88c69c (patch)
tree19c8f9cc509dc7ce73a0709832f34bf13a2c7425 /src/mesa/drivers/dri/i915tex
parent51bfb8fc8c78bb066d24e6ecbc20f00af7210386 (diff)
parentc080123998f28d9317331aec7ddfcd1074b29daf (diff)
Merge git://proxy01.pd.intel.com:9419/git/mesa/mesa into crestline
Diffstat (limited to 'src/mesa/drivers/dri/i915tex')
-rw-r--r--src/mesa/drivers/dri/i915tex/i915_context.c3
-rw-r--r--src/mesa/drivers/dri/i915tex/i915_context.h1
-rw-r--r--src/mesa/drivers/dri/i915tex/i915_state.c11
-rw-r--r--src/mesa/drivers/dri/i915tex/i915_tex.c35
-rw-r--r--src/mesa/drivers/dri/i915tex/i915_tex_layout.c12
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_batchbuffer.c2
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_batchbuffer.h2
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_buffer_objects.c5
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_context.c40
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_context.h9
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_mipmap_tree.c9
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_regions.c5
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_regions.h2
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_tex_validate.c6
14 files changed, 82 insertions, 60 deletions
diff --git a/src/mesa/drivers/dri/i915tex/i915_context.c b/src/mesa/drivers/dri/i915tex/i915_context.c
index 4cbe29d79d..9b4d72eab3 100644
--- a/src/mesa/drivers/dri/i915tex/i915_context.c
+++ b/src/mesa/drivers/dri/i915tex/i915_context.c
@@ -36,7 +36,6 @@
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
#include "tnl/tnl.h"
-#include "array_cache/acache.h"
#include "utils.h"
#include "i915_reg.h"
@@ -67,7 +66,7 @@ i915InvalidateState(GLcontext * ctx, GLuint new_state)
{
_swrast_InvalidateState(ctx, new_state);
_swsetup_InvalidateState(ctx, new_state);
- _ac_InvalidateState(ctx, new_state);
+ _vbo_InvalidateState(ctx, new_state);
_tnl_InvalidateState(ctx, new_state);
_tnl_invalidate_vertex_state(ctx, new_state);
intel_context(ctx)->NewGLState |= new_state;
diff --git a/src/mesa/drivers/dri/i915tex/i915_context.h b/src/mesa/drivers/dri/i915tex/i915_context.h
index 5ae76fcd18..d2713e88f9 100644
--- a/src/mesa/drivers/dri/i915tex/i915_context.h
+++ b/src/mesa/drivers/dri/i915tex/i915_context.h
@@ -243,7 +243,6 @@ struct i915_context
GLuint lodbias_ss2[MAX_TEXTURE_UNITS];
- struct i915_fragment_program tex_program;
struct i915_fragment_program *current_program;
struct i915_hw_state meta, initial, state, *current;
diff --git a/src/mesa/drivers/dri/i915tex/i915_state.c b/src/mesa/drivers/dri/i915tex/i915_state.c
index 2f5a30787e..78ae4bdb5f 100644
--- a/src/mesa/drivers/dri/i915tex/i915_state.c
+++ b/src/mesa/drivers/dri/i915tex/i915_state.c
@@ -520,7 +520,6 @@ update_specular(GLcontext * ctx)
/* A hack to trigger the rebuild of the fragment program.
*/
intel_context(ctx)->NewGLState |= _NEW_TEXTURE;
- I915_CONTEXT(ctx)->tex_program.translated = 0;
}
static void
@@ -646,10 +645,12 @@ i915_update_fog(GLcontext * ctx)
i915->state.Ctx[I915_CTXREG_LIS5] &= ~S5_FOG_ENABLE;
}
- if (enabled) {
- _tnl_allow_vertex_fog(ctx, (i915->vertex_fog == I915_FOG_VERTEX));
- _tnl_allow_pixel_fog(ctx, (i915->vertex_fog != I915_FOG_VERTEX));
- }
+ /* always enbale pixel fog
+ * vertex fog use precaculted fog coord will conflict with appended
+ * fog program
+ */
+ _tnl_allow_vertex_fog( ctx, 0 );
+ _tnl_allow_pixel_fog( ctx, 1 );
}
static void
diff --git a/src/mesa/drivers/dri/i915tex/i915_tex.c b/src/mesa/drivers/dri/i915tex/i915_tex.c
index a53abe9a92..59e148ca04 100644
--- a/src/mesa/drivers/dri/i915tex/i915_tex.c
+++ b/src/mesa/drivers/dri/i915tex/i915_tex.c
@@ -52,27 +52,6 @@ i915TexEnv(GLcontext * ctx, GLenum target,
struct i915_context *i915 = I915_CONTEXT(ctx);
switch (pname) {
- case GL_TEXTURE_ENV_COLOR: /* Should be a tracked param */
- case GL_TEXTURE_ENV_MODE:
- case GL_COMBINE_RGB:
- case GL_COMBINE_ALPHA:
- case GL_SOURCE0_RGB:
- case GL_SOURCE1_RGB:
- case GL_SOURCE2_RGB:
- case GL_SOURCE0_ALPHA:
- case GL_SOURCE1_ALPHA:
- case GL_SOURCE2_ALPHA:
- case GL_OPERAND0_RGB:
- case GL_OPERAND1_RGB:
- case GL_OPERAND2_RGB:
- case GL_OPERAND0_ALPHA:
- case GL_OPERAND1_ALPHA:
- case GL_OPERAND2_ALPHA:
- case GL_RGB_SCALE:
- case GL_ALPHA_SCALE:
- i915->tex_program.translated = 0;
- break;
-
case GL_TEXTURE_LOD_BIAS:{
GLuint unit = ctx->Texture.CurrentUnit;
GLint b = (int) ((*param) * 16.0);
@@ -92,22 +71,8 @@ i915TexEnv(GLcontext * ctx, GLenum target,
}
-static void
-i915BindTexture(GLcontext * ctx, GLenum target,
- struct gl_texture_object *texobj)
-{
- /* Need this if image format changes between bound textures.
- * Could try and shortcircuit by checking for differences in
- * state between incoming and outgoing textures:
- */
- I915_CONTEXT(ctx)->tex_program.translated = 0;
-}
-
-
-
void
i915InitTextureFuncs(struct dd_function_table *functions)
{
- functions->BindTexture = i915BindTexture;
functions->TexEnv = i915TexEnv;
}
diff --git a/src/mesa/drivers/dri/i915tex/i915_tex_layout.c b/src/mesa/drivers/dri/i915tex/i915_tex_layout.c
index 333fefef85..c844f5351d 100644
--- a/src/mesa/drivers/dri/i915tex/i915_tex_layout.c
+++ b/src/mesa/drivers/dri/i915tex/i915_tex_layout.c
@@ -62,15 +62,23 @@ i915_miptree_layout(struct intel_mipmap_tree * mt)
case GL_TEXTURE_CUBE_MAP:{
const GLuint dim = mt->width0;
GLuint face;
+ GLuint lvlWidth = mt->width0, lvlHeight = mt->height0;
+
+ assert(lvlWidth == lvlHeight); /* cubemap images are square */
/* double pitch for cube layouts */
mt->pitch = ((dim * mt->cpp * 2 + 3) & ~3) / mt->cpp;
mt->total_height = dim * 4;
- for (level = mt->first_level; level <= mt->last_level; level++)
+ for (level = mt->first_level; level <= mt->last_level; level++) {
intel_miptree_set_level_info(mt, level, 6,
0, 0,
- mt->pitch, mt->total_height, 1);
+ /*OLD: mt->pitch, mt->total_height,*/
+ lvlWidth, lvlHeight,
+ 1);
+ lvlWidth /= 2;
+ lvlHeight /= 2;
+ }
for (face = 0; face < 6; face++) {
GLuint x = initial_offsets[face][0] * dim;
diff --git a/src/mesa/drivers/dri/i915tex/intel_batchbuffer.c b/src/mesa/drivers/dri/i915tex/intel_batchbuffer.c
index be2750d041..c92b83bcb3 100644
--- a/src/mesa/drivers/dri/i915tex/intel_batchbuffer.c
+++ b/src/mesa/drivers/dri/i915tex/intel_batchbuffer.c
@@ -311,7 +311,7 @@ intel_batchbuffer_emit_reloc(struct intel_batchbuffer *batch,
struct _DriBufferObject *buffer,
GLuint flags, GLuint mask, GLuint delta)
{
- assert(batch->nr_relocs <= MAX_RELOCS);
+ assert(batch->nr_relocs < MAX_RELOCS);
driBOAddListItem(&batch->list, buffer, flags, mask);
diff --git a/src/mesa/drivers/dri/i915tex/intel_batchbuffer.h b/src/mesa/drivers/dri/i915tex/intel_batchbuffer.h
index a83dbf423d..59261f7274 100644
--- a/src/mesa/drivers/dri/i915tex/intel_batchbuffer.h
+++ b/src/mesa/drivers/dri/i915tex/intel_batchbuffer.h
@@ -9,7 +9,7 @@ struct intel_context;
#define BATCH_SZ 16384
#define BATCH_RESERVED 16
-#define MAX_RELOCS 100
+#define MAX_RELOCS 400
#define INTEL_BATCH_NO_CLIPRECTS 0x1
#define INTEL_BATCH_CLIPRECTS 0x2
diff --git a/src/mesa/drivers/dri/i915tex/intel_buffer_objects.c b/src/mesa/drivers/dri/i915tex/intel_buffer_objects.c
index 31c41d8685..ba3c7f0c1f 100644
--- a/src/mesa/drivers/dri/i915tex/intel_buffer_objects.c
+++ b/src/mesa/drivers/dri/i915tex/intel_buffer_objects.c
@@ -50,7 +50,10 @@ intel_bufferobj_alloc(GLcontext * ctx, GLuint name, GLenum target)
_mesa_initialize_buffer_object(&obj->Base, name, target);
driGenBuffers(intel->intelScreen->regionPool,
- "bufferobj", 1, &obj->buffer, 64, 0, 0);
+ "bufferobj", 1, &obj->buffer, 64,
+ DRM_BO_FLAG_MEM_LOCAL |
+ DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE,
+ 0);
return &obj->Base;
}
diff --git a/src/mesa/drivers/dri/i915tex/intel_context.c b/src/mesa/drivers/dri/i915tex/intel_context.c
index c77d365360..a5ce08b170 100644
--- a/src/mesa/drivers/dri/i915tex/intel_context.c
+++ b/src/mesa/drivers/dri/i915tex/intel_context.c
@@ -37,7 +37,6 @@
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
#include "tnl/tnl.h"
-#include "array_cache/acache.h"
#include "tnl/t_pipeline.h"
#include "tnl/t_vertex.h"
@@ -241,7 +240,7 @@ intelInvalidateState(GLcontext * ctx, GLuint new_state)
{
_swrast_InvalidateState(ctx, new_state);
_swsetup_InvalidateState(ctx, new_state);
- _ac_InvalidateState(ctx, new_state);
+ _vbo_InvalidateState(ctx, new_state);
_tnl_InvalidateState(ctx, new_state);
_tnl_invalidate_vertex_state(ctx, new_state);
intel_context(ctx)->NewGLState |= new_state;
@@ -357,6 +356,10 @@ intelInitContext(struct intel_context *intel,
intel->driScreen = sPriv;
intel->sarea = saPriv;
+ intel->width = intelScreen->width;
+ intel->height = intelScreen->height;
+ intel->current_rotation = intelScreen->current_rotation;
+
if (!lockMutexInit) {
lockMutexInit = GL_TRUE;
_glthread_INIT_MUTEX(lockMutex);
@@ -390,7 +393,7 @@ intelInitContext(struct intel_context *intel,
/* Initialize the software rasterizer and helper modules. */
_swrast_CreateContext(ctx);
- _ac_CreateContext(ctx);
+ _vbo_CreateContext(ctx);
_tnl_CreateContext(ctx);
_swsetup_CreateContext(ctx);
@@ -500,7 +503,7 @@ intelDestroyContext(__DRIcontextPrivate * driContextPriv)
release_texture_heaps = (intel->ctx.Shared->RefCount == 1);
_swsetup_DestroyContext(&intel->ctx);
_tnl_DestroyContext(&intel->ctx);
- _ac_DestroyContext(&intel->ctx);
+ _vbo_DestroyContext(&intel->ctx);
_swrast_DestroyContext(&intel->ctx);
intel->Fallback = 0; /* don't call _swrast_Flush later */
@@ -635,14 +638,35 @@ intelContendedLock(struct intel_context *intel, GLuint flags)
sarea->rotation != intelScreen->current_rotation) {
intelUpdateScreenRotation(sPriv, sarea);
+ }
- /*
+ if (sarea->width != intel->width ||
+ sarea->height != intel->height ||
+ sarea->rotation != intel->current_rotation) {
+
+ void *batchMap = intel->batch->map;
+
+ /*
+ * FIXME: Really only need to do this when drawing to a
+ * common back- or front buffer.
+ */
+
+ /*
* This will drop the outstanding batchbuffer on the floor
- * FIXME: This should be done for all contexts?
*/
+ if (batchMap != NULL) {
+ driBOUnmap(intel->batch->buffer);
+ intel->batch->map = NULL;
+ }
+
intel_batchbuffer_reset(intel->batch);
+ if (batchMap == NULL) {
+ driBOUnmap(intel->batch->buffer);
+ intel->batch->map = NULL;
+ }
+
/* lose all primitives */
intel->prim.primitive = ~0;
intel->prim.start_ptr = 0;
@@ -653,6 +677,10 @@ intelContendedLock(struct intel_context *intel, GLuint flags)
/* force window update */
intel->lastStamp = 0;
+
+ intel->width = sarea->width;
+ intel->height = sarea->height;
+ intel->current_rotation = sarea->rotation;
}
diff --git a/src/mesa/drivers/dri/i915tex/intel_context.h b/src/mesa/drivers/dri/i915tex/intel_context.h
index 7654e4ecd5..96b911501f 100644
--- a/src/mesa/drivers/dri/i915tex/intel_context.h
+++ b/src/mesa/drivers/dri/i915tex/intel_context.h
@@ -286,6 +286,15 @@ struct intel_context
GLuint swap_missed_count;
GLuint swap_scheduled;
+
+ /* Rotation. Need to match that of the
+ * current screen.
+ */
+
+ int width;
+ int height;
+ int current_rotation;
+
};
/* These are functions now:
diff --git a/src/mesa/drivers/dri/i915tex/intel_mipmap_tree.c b/src/mesa/drivers/dri/i915tex/intel_mipmap_tree.c
index 2b1077aee0..93372f4dcc 100644
--- a/src/mesa/drivers/dri/i915tex/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i915tex/intel_mipmap_tree.c
@@ -309,8 +309,13 @@ intel_miptree_image_data(struct intel_context *intel,
height = dst->level[level].height;
if(dst->compressed)
height /= 4;
- intel_region_data(intel->intelScreen, dst->region, dst_offset + dst_depth_offset[i], 0, 0, src, src_row_pitch, 0, 0, /* source x,y */
- dst->level[level].width, height);
+ intel_region_data(intel->intelScreen, dst->region,
+ dst_offset + dst_depth_offset[i], /* dst_offset */
+ 0, 0, /* dstx, dsty */
+ src,
+ src_row_pitch,
+ 0, 0, /* source x, y */
+ dst->level[level].width, height); /* width, height */
src += src_image_pitch;
}
diff --git a/src/mesa/drivers/dri/i915tex/intel_regions.c b/src/mesa/drivers/dri/i915tex/intel_regions.c
index 1205b180ca..a114bdf896 100644
--- a/src/mesa/drivers/dri/i915tex/intel_regions.c
+++ b/src/mesa/drivers/dri/i915tex/intel_regions.c
@@ -217,7 +217,8 @@ _mesa_copy_rect(GLubyte * dst,
GLuint dst_y,
GLuint width,
GLuint height,
- GLubyte * src, GLuint src_pitch, GLuint src_x, GLuint src_y)
+ const GLubyte * src,
+ GLuint src_pitch, GLuint src_x, GLuint src_y)
{
GLuint i;
@@ -253,7 +254,7 @@ intel_region_data(intelScreenPrivate *intelScreen,
struct intel_region *dst,
GLuint dst_offset,
GLuint dstx, GLuint dsty,
- void *src, GLuint src_pitch,
+ const void *src, GLuint src_pitch,
GLuint srcx, GLuint srcy, GLuint width, GLuint height)
{
struct intel_context *intel = intelScreenContext(intelScreen);
diff --git a/src/mesa/drivers/dri/i915tex/intel_regions.h b/src/mesa/drivers/dri/i915tex/intel_regions.h
index 1415bace69..d938c107a4 100644
--- a/src/mesa/drivers/dri/i915tex/intel_regions.h
+++ b/src/mesa/drivers/dri/i915tex/intel_regions.h
@@ -103,7 +103,7 @@ void intel_region_data(intelScreenPrivate *intelScreen,
struct intel_region *dest,
GLuint dest_offset,
GLuint destx, GLuint desty,
- void *src, GLuint src_stride,
+ const void *src, GLuint src_stride,
GLuint srcx, GLuint srcy, GLuint width, GLuint height);
/* Copy rectangular sub-regions
diff --git a/src/mesa/drivers/dri/i915tex/intel_tex_validate.c b/src/mesa/drivers/dri/i915tex/intel_tex_validate.c
index e73c9c2f21..79d587a174 100644
--- a/src/mesa/drivers/dri/i915tex/intel_tex_validate.c
+++ b/src/mesa/drivers/dri/i915tex/intel_tex_validate.c
@@ -110,6 +110,8 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit)
GLuint nr_faces = 0;
struct intel_texture_image *firstImage;
+ GLboolean need_flush = GL_FALSE;
+
/* We know/require this is true by now:
*/
assert(intelObj->base.Complete);
@@ -201,11 +203,13 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit)
*/
if (intelObj->mt != intelImage->mt) {
copy_image_data_to_tree(intel, intelObj, intelImage);
+ need_flush = GL_TRUE;
}
}
}
- intel_batchbuffer_flush(intel->batch);
+ if (need_flush)
+ intel_batchbuffer_flush(intel->batch);
return GL_TRUE;
}