From db70498462344680ff884e7ed576543175833fc0 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 3 Aug 2007 18:56:12 +0100 Subject: [PATCH] Rip out more dead drawing-related code. --- .../drivers/dri/i915pipe/intel_batchbuffer.c | 2 +- .../drivers/dri/i915pipe/intel_batchbuffer.h | 1 - src/mesa/drivers/dri/i915pipe/intel_context.c | 59 ------- src/mesa/drivers/dri/i915pipe/intel_context.h | 157 +----------------- src/mesa/drivers/dri/i915pipe/intel_fbo.c | 1 + src/mesa/drivers/dri/i915pipe/intel_tex.c | 28 ++++ src/mesa/drivers/dri/i915pipe/intel_tex.h | 56 +++++++ 7 files changed, 90 insertions(+), 214 deletions(-) diff --git a/src/mesa/drivers/dri/i915pipe/intel_batchbuffer.c b/src/mesa/drivers/dri/i915pipe/intel_batchbuffer.c index 97e3882bc97..60bd8eaec29 100644 --- a/src/mesa/drivers/dri/i915pipe/intel_batchbuffer.c +++ b/src/mesa/drivers/dri/i915pipe/intel_batchbuffer.c @@ -337,6 +337,6 @@ intel_batchbuffer_data(struct intel_batchbuffer *batch, { assert((bytes & 3) == 0); intel_batchbuffer_require_space(batch, bytes, flags); - __memcpy(batch->ptr, data, bytes); + memcpy(batch->ptr, data, bytes); batch->ptr += bytes; } diff --git a/src/mesa/drivers/dri/i915pipe/intel_batchbuffer.h b/src/mesa/drivers/dri/i915pipe/intel_batchbuffer.h index 212f1301012..6d4d05e0bb1 100644 --- a/src/mesa/drivers/dri/i915pipe/intel_batchbuffer.h +++ b/src/mesa/drivers/dri/i915pipe/intel_batchbuffer.h @@ -107,7 +107,6 @@ intel_batchbuffer_require_space(struct intel_batchbuffer *batch, #define BATCH_LOCALS #define BEGIN_BATCH(n, flags) do { \ - assert(!intel->prim.flush); \ intel_batchbuffer_require_space(intel->batch, (n)*4, flags); \ } while (0) diff --git a/src/mesa/drivers/dri/i915pipe/intel_context.c b/src/mesa/drivers/dri/i915pipe/intel_context.c index f0ca5c75c7b..395ffd086b9 100644 --- a/src/mesa/drivers/dri/i915pipe/intel_context.c +++ b/src/mesa/drivers/dri/i915pipe/intel_context.c @@ -240,8 +240,6 @@ intelInvalidateState(GLcontext * ctx, GLuint new_state) _tnl_invalidate_vertex_state(ctx, new_state); st_invalidate_state( ctx, new_state ); - - intel_context(ctx)->NewGLState |= new_state; } @@ -361,33 +359,6 @@ intelCreateContext(const __GLcontextModes * mesaVis, driParseConfigFiles(&intel->optionCache, &intelScreen->optionCache, intel->driScreen->myNum, "i915"); - ctx->Const.MaxTextureMaxAnisotropy = 2.0; - - /* This doesn't yet catch all non-conformant rendering, but it's a - * start. - */ - if (getenv("INTEL_STRICT_CONFORMANCE")) { - intel->strict_conformance = 1; - } - - ctx->Const.MinLineWidth = 1.0; - ctx->Const.MinLineWidthAA = 1.0; - ctx->Const.MaxLineWidth = 3.0; - ctx->Const.MaxLineWidthAA = 3.0; - ctx->Const.LineWidthGranularity = 1.0; - - ctx->Const.MinPointSize = 1.0; - ctx->Const.MinPointSizeAA = 1.0; - ctx->Const.MaxPointSize = 255.0; - ctx->Const.MaxPointSizeAA = 3.0; - ctx->Const.PointSizeGranularity = 1.0; - - /* reinitialize the context point state. - * It depend on constants in __GLcontextRec::Const - */ - _mesa_init_point(ctx); - - ctx->Const.MaxColorAttachments = 4; /* XXX FBO: review this */ /* Initialize the software rasterizer and helper modules. */ _vbo_CreateContext(ctx); @@ -425,34 +396,14 @@ intelCreateContext(const __GLcontextModes * mesaVis, intel->driFd = sPriv->fd; intel->driHwLock = (drmLock *) & sPriv->pSAREA->lock; - intel->hw_stipple = 1; - - /* XXX FBO: this doesn't seem to be used anywhere */ - switch (mesaVis->depthBits) { - case 0: /* what to do in this case? */ - case 16: - intel->polygon_offset_scale = 1.0 / 0xffff; - break; - case 24: - intel->polygon_offset_scale = 2.0 / 0xffffff; /* req'd to pass glean */ - break; - default: - assert(0); - break; - } - - TNL_CONTEXT(ctx)->Driver.RunPipeline = _tnl_run_pipeline; - intel->RenderIndex = ~0; fthrottle_mode = driQueryOptioni(&intel->optionCache, "fthrottle_mode"); intel->iw.irq_seq = -1; intel->irqsEmitted = 0; - _math_matrix_ctr(&intel->ViewportMatrix); - /* Disable imaging extension until convolution is working in * teximage paths: */ @@ -476,18 +427,10 @@ intelCreateContext(const __GLcontextModes * mesaVis, _mesa_enable_extension(ctx, "GL_EXT_texture_compression_s3tc"); } - intel->prim.primitive = ~0; - - #if DO_DEBUG INTEL_DEBUG = driParseDebugString(getenv("INTEL_DEBUG"), debug_control); #endif - if (getenv("INTEL_NO_RAST")) { - fprintf(stderr, "disabling 3D rasterization\n"); - FALLBACK(intel, INTEL_FALLBACK_USER, 1); - } - return GL_TRUE; } @@ -510,8 +453,6 @@ intelDestroyContext(__DRIcontextPrivate * driContextPriv) _tnl_DestroyContext(&intel->ctx); _vbo_DestroyContext(&intel->ctx); - intel->Fallback = 0; /* don't call _swrast_Flush later */ - intel_batchbuffer_free(intel->batch); if (intel->last_swap_fence) { diff --git a/src/mesa/drivers/dri/i915pipe/intel_context.h b/src/mesa/drivers/dri/i915pipe/intel_context.h index cac9fd7b491..6c728dfe735 100644 --- a/src/mesa/drivers/dri/i915pipe/intel_context.h +++ b/src/mesa/drivers/dri/i915pipe/intel_context.h @@ -38,11 +38,7 @@ #include "intel_screen.h" #include "i915_drm.h" #include "i830_common.h" -#include "tnl/t_vertex.h" -#define TAG(x) intel##x -#include "tnl_dd/t_dd_vertex.h" -#undef TAG #define DV_PF_555 (1<<8) #define DV_PF_565 (2<<8) @@ -53,67 +49,11 @@ struct pipe_region; struct intel_context; struct _DriBufferObject; -typedef void (*intel_tri_func) (struct intel_context *, intelVertex *, - intelVertex *, intelVertex *); -typedef void (*intel_line_func) (struct intel_context *, intelVertex *, - intelVertex *); -typedef void (*intel_point_func) (struct intel_context *, intelVertex *); - -#define INTEL_FALLBACK_DRAW_BUFFER 0x1 -#define INTEL_FALLBACK_READ_BUFFER 0x2 -#define INTEL_FALLBACK_DEPTH_BUFFER 0x4 -#define INTEL_FALLBACK_STENCIL_BUFFER 0x8 -#define INTEL_FALLBACK_USER 0x10 -#define INTEL_FALLBACK_RENDERMODE 0x20 - -#define FALLBACK( intel, bit, mode ) _mesa_printf("intelFallback not implemented/removed\n") - #define INTEL_WRITE_PART 0x1 #define INTEL_WRITE_FULL 0x2 #define INTEL_READ 0x4 -struct intel_texture_object -{ - struct gl_texture_object base; /* The "parent" object */ - - /* The mipmap tree must include at least these levels once - * validated: - */ - GLuint firstLevel; - GLuint lastLevel; - - /* Offset for firstLevel image: - */ - GLuint textureOffset; - - /* On validation any active images held in main memory or in other - * regions will be copied to this region and the old storage freed. - */ - struct intel_mipmap_tree *mt; - - GLboolean imageOverride; - GLint depthOverride; - GLuint pitchOverride; -}; - - - -struct intel_texture_image -{ - struct gl_texture_image base; - - /* These aren't stored in gl_texture_image - */ - GLuint level; - GLuint face; - - /* If intelImage->mt != NULL, image data is stored here. - * Else if intelImage->base.Data != NULL, image is stored there. - * Else there is no image data. - */ - struct intel_mipmap_tree *mt; -}; #define INTEL_MAX_FIXUP 64 @@ -125,21 +65,12 @@ struct intel_context struct pipe_context *pipe; GLint refcount; - GLuint Fallback; - GLuint NewGLState; struct _DriFenceObject *last_swap_fence; struct _DriFenceObject *first_swap_fence; struct intel_batchbuffer *batch; - struct - { - GLuint id; - GLuint primitive; - GLubyte *start_ptr; - void (*flush) (struct intel_context *); - } prim; GLboolean locked; char *prevLockFile; @@ -148,41 +79,6 @@ struct intel_context GLuint ClearColor565; GLuint ClearColor8888; - /* Offsets of fields within the current vertex: - */ - GLuint coloroffset; - GLuint specoffset; - GLuint wpos_offset; - GLuint wpos_size; - - struct tnl_attr_map vertex_attrs[VERT_ATTRIB_MAX]; - GLuint vertex_attr_count; - - GLfloat polygon_offset_scale; /* dependent on depth_scale, bpp */ - - GLboolean hw_stipple; - GLboolean strict_conformance; - - /* AGP memory buffer manager: - */ - struct bufmgr *bm; - - - /* State for intelvb.c and inteltris.c. - */ - GLuint RenderIndex; - GLmatrix ViewportMatrix; - GLenum render_primitive; - GLenum reduced_primitive; - GLuint vertex_size; - GLubyte *verts; /* points to tnl->clipspace.vertex_buf */ - - - /* Fallback rasterization functions - */ - intel_point_func draw_point; - intel_line_func draw_line; - intel_tri_func draw_tri; /* These refer to the current drawing buffer: */ @@ -190,8 +86,6 @@ struct intel_context drm_clip_rect_t *pClipRects; drm_clip_rect_t fboRect; /**< cliprect for rendering */ - GLuint do_usleeps; - int do_irqs; GLuint irqsEmitted; drm_i915_irq_wait_t iw; @@ -219,15 +113,9 @@ void UNLOCK_HARDWARE( struct intel_context *intel ); extern char *__progname; - -#define SUBPIXEL_X 0.125 -#define SUBPIXEL_Y 0.125 - -#define INTEL_FIREVERTICES(intel) \ -do { \ - if ((intel)->prim.flush) \ - (intel)->prim.flush(intel); \ -} while (0) +/* Will become a call into state_tracker: + */ +#define INTEL_FIREVERTICES(intel) /* ================================================================ * Color packing: @@ -248,32 +136,6 @@ do { \ -/* ================================================================ - * From linux kernel i386 header files, copes with odd sizes better - * than COPY_DWORDS would: - * XXX Put this in src/mesa/main/imports.h ??? - */ -#if defined(i386) || defined(__i386__) -static INLINE void * -__memcpy(void *to, const void *from, size_t n) -{ - int d0, d1, d2; - __asm__ __volatile__("rep ; movsl\n\t" - "testb $2,%b4\n\t" - "je 1f\n\t" - "movsw\n" - "1:\ttestb $1,%b4\n\t" - "je 2f\n\t" - "movsb\n" "2:":"=&c"(d0), "=&D"(d1), "=&S"(d2) - :"0"(n / 4), "q"(n), "1"((long) to), "2"((long) from) - :"memory"); - return (to); -} -#else -#define __memcpy(a,b,c) memcpy(a,b,c) -#endif - - /* ================================================================ * Debugging: @@ -337,6 +199,7 @@ extern void intelInitDriverFunctions(struct dd_function_table *functions); #define MI_BATCH_BUFFER_END (0xA<<23) +#define FALLBACK( ctx, bit, mode ) /*====================================================================== * Inline conversion functions. @@ -348,18 +211,6 @@ intel_context(GLcontext * ctx) return (struct intel_context *) ctx; } -static INLINE struct intel_texture_object * -intel_texture_object(struct gl_texture_object *obj) -{ - return (struct intel_texture_object *) obj; -} - -static INLINE struct intel_texture_image * -intel_texture_image(struct gl_texture_image *img) -{ - return (struct intel_texture_image *) img; -} - extern struct intel_renderbuffer *intel_renderbuffer(struct gl_renderbuffer *rb); diff --git a/src/mesa/drivers/dri/i915pipe/intel_fbo.c b/src/mesa/drivers/dri/i915pipe/intel_fbo.c index 7b6906dea6a..9eee5cce457 100644 --- a/src/mesa/drivers/dri/i915pipe/intel_fbo.c +++ b/src/mesa/drivers/dri/i915pipe/intel_fbo.c @@ -41,6 +41,7 @@ #include "intel_fbo.h" #include "intel_mipmap_tree.h" #include "intel_regions.h" +#include "intel_tex.h" #include "pipe/p_context.h" diff --git a/src/mesa/drivers/dri/i915pipe/intel_tex.c b/src/mesa/drivers/dri/i915pipe/intel_tex.c index b08dee43bc1..9e494d21bad 100644 --- a/src/mesa/drivers/dri/i915pipe/intel_tex.c +++ b/src/mesa/drivers/dri/i915pipe/intel_tex.c @@ -75,6 +75,34 @@ intelFreeTextureImageData(GLcontext * ctx, struct gl_texture_image *texImage) } + + +/* ================================================================ + * From linux kernel i386 header files, copes with odd sizes better + * than COPY_DWORDS would: + * XXX Put this in src/mesa/main/imports.h ??? + */ +#if defined(i386) || defined(__i386__) +static INLINE void * +__memcpy(void *to, const void *from, size_t n) +{ + int d0, d1, d2; + __asm__ __volatile__("rep ; movsl\n\t" + "testb $2,%b4\n\t" + "je 1f\n\t" + "movsw\n" + "1:\ttestb $1,%b4\n\t" + "je 2f\n\t" + "movsb\n" "2:":"=&c"(d0), "=&D"(d1), "=&S"(d2) + :"0"(n / 4), "q"(n), "1"((long) to), "2"((long) from) + :"memory"); + return (to); +} +#else +#define __memcpy(a,b,c) memcpy(a,b,c) +#endif + + /* The system memcpy (at least on ubuntu 5.10) has problems copying * to agp (writecombined) memory from a source which isn't 64-byte * aligned - there is a 4x performance falloff. diff --git a/src/mesa/drivers/dri/i915pipe/intel_tex.h b/src/mesa/drivers/dri/i915pipe/intel_tex.h index b77d7a1d8af..4a5081eee7a 100644 --- a/src/mesa/drivers/dri/i915pipe/intel_tex.h +++ b/src/mesa/drivers/dri/i915pipe/intel_tex.h @@ -32,6 +32,48 @@ #include "intel_context.h" #include "texmem.h" +struct intel_texture_object +{ + struct gl_texture_object base; /* The "parent" object */ + + /* The mipmap tree must include at least these levels once + * validated: + */ + GLuint firstLevel; + GLuint lastLevel; + + /* Offset for firstLevel image: + */ + GLuint textureOffset; + + /* On validation any active images held in main memory or in other + * regions will be copied to this region and the old storage freed. + */ + struct intel_mipmap_tree *mt; + + GLboolean imageOverride; + GLint depthOverride; + GLuint pitchOverride; +}; + + + +struct intel_texture_image +{ + struct gl_texture_image base; + + /* These aren't stored in gl_texture_image + */ + GLuint level; + GLuint face; + + /* If intelImage->mt != NULL, image data is stored here. + * Else if intelImage->base.Data != NULL, image is stored there. + * Else there is no image data. + */ + struct intel_mipmap_tree *mt; +}; + void intelInitTextureFuncs(struct dd_function_table *functions); @@ -148,4 +190,18 @@ void intel_tex_unmap_images(struct intel_context *intel, int intel_compressed_num_bytes(GLuint mesaFormat); + +static INLINE struct intel_texture_object * +intel_texture_object(struct gl_texture_object *obj) +{ + return (struct intel_texture_object *) obj; +} + +static INLINE struct intel_texture_image * +intel_texture_image(struct gl_texture_image *img) +{ + return (struct intel_texture_image *) img; +} + + #endif -- 2.30.2