diff options
Diffstat (limited to 'src/mesa/drivers/dri/i915')
-rw-r--r-- | src/mesa/drivers/dri/i915/Makefile | 1 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i915/i830_context.h | 4 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i915/i915_metaops.c | 1 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i915/intel_context.c | 46 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i915/intel_context.h | 20 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i915/intel_rotate.c | 237 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i915/intel_rotate.h | 39 |
7 files changed, 5 insertions, 343 deletions
diff --git a/src/mesa/drivers/dri/i915/Makefile b/src/mesa/drivers/dri/i915/Makefile index ae96ddda0ab..bff09ee8424 100644 --- a/src/mesa/drivers/dri/i915/Makefile +++ b/src/mesa/drivers/dri/i915/Makefile @@ -46,7 +46,6 @@ DRIVER_SOURCES = \ intel_context.c \ intel_decode.c \ intel_ioctl.c \ - intel_rotate.c \ intel_screen.c \ intel_span.c \ intel_state.c \ diff --git a/src/mesa/drivers/dri/i915/i830_context.h b/src/mesa/drivers/dri/i915/i830_context.h index 9397fa45b52..a298c1407de 100644 --- a/src/mesa/drivers/dri/i915/i830_context.h +++ b/src/mesa/drivers/dri/i915/i830_context.h @@ -196,10 +196,6 @@ extern void i830InitState(struct i830_context *i830); */ extern void i830InitMetaFuncs(struct i830_context *i830); -extern void -i830RotateWindow(struct intel_context *intel, __DRIdrawablePrivate * dPriv, - GLuint srcBuf); - /*====================================================================== * Inline conversion functions. These are better-typed than the * macros used previously: diff --git a/src/mesa/drivers/dri/i915/i915_metaops.c b/src/mesa/drivers/dri/i915/i915_metaops.c index a739bd65811..73aa63451e0 100644 --- a/src/mesa/drivers/dri/i915/i915_metaops.c +++ b/src/mesa/drivers/dri/i915/i915_metaops.c @@ -35,7 +35,6 @@ #include "intel_batchbuffer.h" #include "intel_ioctl.h" #include "intel_regions.h" -#include "intel_rotate.h" #include "i915_context.h" #include "i915_reg.h" diff --git a/src/mesa/drivers/dri/i915/intel_context.c b/src/mesa/drivers/dri/i915/intel_context.c index b85b0c2939c..2b93f60ab4d 100644 --- a/src/mesa/drivers/dri/i915/intel_context.c +++ b/src/mesa/drivers/dri/i915/intel_context.c @@ -278,37 +278,6 @@ intelFlush(GLcontext * ctx) */ } - -/** - * Check if we need to rotate/warp the front color buffer to the - * rotated screen. We generally need to do this when we get a glFlush - * or glFinish after drawing to the front color buffer. - */ -static void -intelCheckFrontRotate(GLcontext * ctx) -{ - struct intel_context *intel = intel_context(ctx); - if (intel->ctx.DrawBuffer->_ColorDrawBufferMask[0] == - BUFFER_BIT_FRONT_LEFT) { - intelScreenPrivate *screen = intel->intelScreen; - if (screen->current_rotation != 0) { - __DRIdrawablePrivate *dPriv = intel->driDrawable; - intelRotateWindow(intel, dPriv, BUFFER_BIT_FRONT_LEFT); - } - } -} - - -/** - * Called via glFlush. - */ -static void -intelglFlush(GLcontext * ctx) -{ - intelFlush(ctx); - intelCheckFrontRotate(ctx); -} - void intelFinish(GLcontext * ctx) { @@ -319,7 +288,6 @@ intelFinish(GLcontext * ctx) dri_fence_unreference(intel->batch->last_fence); intel->batch->last_fence = NULL; } - intelCheckFrontRotate(ctx); } @@ -328,7 +296,7 @@ intelInitDriverFunctions(struct dd_function_table *functions) { _mesa_init_driver_functions(functions); - functions->Flush = intelglFlush; + functions->Flush = intelFlush; functions->Finish = intelFinish; functions->GetString = intelGetString; functions->UpdateState = intelInvalidateState; @@ -371,7 +339,6 @@ intelInitContext(struct intel_context *intel, intel->width = intelScreen->width; intel->height = intelScreen->height; - intel->current_rotation = intelScreen->current_rotation; if (!lockMutexInit) { lockMutexInit = GL_TRUE; @@ -676,16 +643,8 @@ intelContendedLock(struct intel_context *intel, GLuint flags) intel_decode_context_reset(); } - if (sarea->width != intelScreen->width || - sarea->height != intelScreen->height || - sarea->rotation != intelScreen->current_rotation) { - - intelUpdateScreenRotation(sPriv, sarea); - } - if (sarea->width != intel->width || - sarea->height != intel->height || - sarea->rotation != intel->current_rotation) { + sarea->height != intel->height) { int numClipRects = intel->numClipRects; /* @@ -713,7 +672,6 @@ intelContendedLock(struct intel_context *intel, GLuint flags) intel->width = sarea->width; intel->height = sarea->height; - intel->current_rotation = sarea->rotation; } /* Drawable changed? diff --git a/src/mesa/drivers/dri/i915/intel_context.h b/src/mesa/drivers/dri/i915/intel_context.h index ce9a362944b..7272f8f352b 100644 --- a/src/mesa/drivers/dri/i915/intel_context.h +++ b/src/mesa/drivers/dri/i915/intel_context.h @@ -174,8 +174,6 @@ struct intel_context GLuint pitch, GLuint height, GLenum format, GLenum type); - void (*rotate_window) (struct intel_context * intel, - __DRIdrawablePrivate * dPriv, GLuint srcBuf); void (*assert_not_dirty) (struct intel_context *intel); @@ -229,14 +227,6 @@ struct intel_context GLuint vertex_size; GLubyte *verts; /* points to tnl->clipspace.vertex_buf */ -#if 0 - struct intel_region *front_region; /* XXX FBO: obsolete */ - struct intel_region *rotated_region; /* XXX FBO: obsolete */ - struct intel_region *back_region; /* XXX FBO: obsolete */ - struct intel_region *draw_region; /* XXX FBO: rename to color_region */ - struct intel_region *depth_region; /**< currently bound depth/Z region */ -#endif - /* Fallback rasterization functions */ intel_point_func draw_point; @@ -272,13 +262,9 @@ struct intel_context */ driOptionCache optionCache; - /* Rotation. Need to match that of the - * current screen. - */ - - int width; - int height; - int current_rotation; + /* Last seen width/height of the screen */ + int width; + int height; }; /* These are functions now: diff --git a/src/mesa/drivers/dri/i915/intel_rotate.c b/src/mesa/drivers/dri/i915/intel_rotate.c deleted file mode 100644 index 12d98c4ad2f..00000000000 --- a/src/mesa/drivers/dri/i915/intel_rotate.c +++ /dev/null @@ -1,237 +0,0 @@ - -/** - * Routines for simple 2D->2D transformations for rotated, flipped screens. - * - * XXX This code is not intel-specific. Move it into a common/utility - * someday. - */ - -#include "intel_rotate.h" - -#define MIN2(A, B) ( ((A) < (B)) ? (A) : (B) ) - -#define ABS(A) ( ((A) < 0) ? -(A) : (A) ) - - -void -matrix23Set(struct matrix23 *m, - int m00, int m01, int m02, int m10, int m11, int m12) -{ - m->m00 = m00; - m->m01 = m01; - m->m02 = m02; - m->m10 = m10; - m->m11 = m11; - m->m12 = m12; -} - - -/* - * Transform (x,y) coordinate by the given matrix. - */ -void -matrix23TransformCoordf(const struct matrix23 *m, float *x, float *y) -{ - const float x0 = *x; - const float y0 = *y; - - *x = m->m00 * x0 + m->m01 * y0 + m->m02; - *y = m->m10 * x0 + m->m11 * y0 + m->m12; -} - - -void -matrix23TransformCoordi(const struct matrix23 *m, int *x, int *y) -{ - const int x0 = *x; - const int y0 = *y; - - *x = m->m00 * x0 + m->m01 * y0 + m->m02; - *y = m->m10 * x0 + m->m11 * y0 + m->m12; -} - - -/* - * Transform a width and height by the given matrix. - * XXX this could be optimized quite a bit. - */ -void -matrix23TransformDistance(const struct matrix23 *m, int *xDist, int *yDist) -{ - int x0 = 0, y0 = 0; - int x1 = *xDist, y1 = 0; - int x2 = 0, y2 = *yDist; - matrix23TransformCoordi(m, &x0, &y0); - matrix23TransformCoordi(m, &x1, &y1); - matrix23TransformCoordi(m, &x2, &y2); - - *xDist = (x1 - x0) + (x2 - x0); - *yDist = (y1 - y0) + (y2 - y0); - - if (*xDist < 0) - *xDist = -*xDist; - if (*yDist < 0) - *yDist = -*yDist; -} - - -/** - * Transform the rect defined by (x, y, w, h) by m. - */ -void -matrix23TransformRect(const struct matrix23 *m, int *x, int *y, int *w, - int *h) -{ - int x0 = *x, y0 = *y; - int x1 = *x + *w, y1 = *y; - int x2 = *x + *w, y2 = *y + *h; - int x3 = *x, y3 = *y + *h; - matrix23TransformCoordi(m, &x0, &y0); - matrix23TransformCoordi(m, &x1, &y1); - matrix23TransformCoordi(m, &x2, &y2); - matrix23TransformCoordi(m, &x3, &y3); - *w = ABS(x1 - x0) + ABS(x2 - x1); - /**w = ABS(*w);*/ - *h = ABS(y1 - y0) + ABS(y2 - y1); - /**h = ABS(*h);*/ - *x = MIN2(x0, x1); - *x = MIN2(*x, x2); - *y = MIN2(y0, y1); - *y = MIN2(*y, y2); -} - - -/* - * Make rotation matrix for width X height screen. - */ -void -matrix23Rotate(struct matrix23 *m, int width, int height, int angle) -{ - switch (angle) { - case 0: - matrix23Set(m, 1, 0, 0, 0, 1, 0); - break; - case 90: - matrix23Set(m, 0, 1, 0, -1, 0, width); - break; - case 180: - matrix23Set(m, -1, 0, width, 0, -1, height); - break; - case 270: - matrix23Set(m, 0, -1, height, 1, 0, 0); - break; - default: - /*abort() */ ; - } -} - - -/* - * Make flip/reflection matrix for width X height screen. - */ -void -matrix23Flip(struct matrix23 *m, int width, int height, int xflip, int yflip) -{ - if (xflip) { - m->m00 = -1; - m->m01 = 0; - m->m02 = width - 1; - } - else { - m->m00 = 1; - m->m01 = 0; - m->m02 = 0; - } - if (yflip) { - m->m10 = 0; - m->m11 = -1; - m->m12 = height - 1; - } - else { - m->m10 = 0; - m->m11 = 1; - m->m12 = 0; - } -} - - -/* - * result = a * b - */ -void -matrix23Multiply(struct matrix23 *result, - const struct matrix23 *a, const struct matrix23 *b) -{ - result->m00 = a->m00 * b->m00 + a->m01 * b->m10; - result->m01 = a->m00 * b->m01 + a->m01 * b->m11; - result->m02 = a->m00 * b->m02 + a->m01 * b->m12 + a->m02; - - result->m10 = a->m10 * b->m00 + a->m11 * b->m10; - result->m11 = a->m10 * b->m01 + a->m11 * b->m11; - result->m12 = a->m10 * b->m02 + a->m11 * b->m12 + a->m12; -} - - -#if 000 - -#include <stdio.h> - -int -main(int argc, char *argv[]) -{ - int width = 500, height = 400; - int rot; - int fx = 0, fy = 0; /* flip x and/or y ? */ - int coords[4][2]; - - /* four corner coords to test with */ - coords[0][0] = 0; - coords[0][1] = 0; - coords[1][0] = width - 1; - coords[1][1] = 0; - coords[2][0] = width - 1; - coords[2][1] = height - 1; - coords[3][0] = 0; - coords[3][1] = height - 1; - - - for (rot = 0; rot < 360; rot += 90) { - struct matrix23 rotate, flip, m; - int i; - - printf("Rot %d, xFlip %d, yFlip %d:\n", rot, fx, fy); - - /* make transformation matrix 'm' */ - matrix23Rotate(&rotate, width, height, rot); - matrix23Flip(&flip, width, height, fx, fy); - matrix23Multiply(&m, &rotate, &flip); - - /* xform four coords */ - for (i = 0; i < 4; i++) { - int x = coords[i][0]; - int y = coords[i][1]; - matrix23TransformCoordi(&m, &x, &y); - printf(" %d, %d -> %d %d\n", coords[i][0], coords[i][1], x, y); - } - - /* xform width, height */ - { - int x = width; - int y = height; - matrix23TransformDistance(&m, &x, &y); - printf(" %d x %d -> %d x %d\n", width, height, x, y); - } - - /* xform rect */ - { - int x = 50, y = 10, w = 200, h = 100; - matrix23TransformRect(&m, &x, &y, &w, &h); - printf(" %d,%d %d x %d -> %d, %d %d x %d\n", 50, 10, 200, 100, - x, y, w, h); - } - - } - - return 0; -} -#endif diff --git a/src/mesa/drivers/dri/i915/intel_rotate.h b/src/mesa/drivers/dri/i915/intel_rotate.h deleted file mode 100644 index 9c8802ca477..00000000000 --- a/src/mesa/drivers/dri/i915/intel_rotate.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef INTEL_ROTATE_H -#define INTEL_ROTATE_H 1 - -struct matrix23 -{ - int m00, m01, m02; - int m10, m11, m12; -}; - - - -extern void -matrix23Set(struct matrix23 *m, - int m00, int m01, int m02, int m10, int m11, int m12); - -extern void matrix23TransformCoordi(const struct matrix23 *m, int *x, int *y); - -extern void -matrix23TransformCoordf(const struct matrix23 *m, float *x, float *y); - -extern void -matrix23TransformDistance(const struct matrix23 *m, int *xDist, int *yDist); - -extern void -matrix23TransformRect(const struct matrix23 *m, - int *x, int *y, int *w, int *h); - -extern void -matrix23Rotate(struct matrix23 *m, int width, int height, int angle); - -extern void -matrix23Flip(struct matrix23 *m, int width, int height, int xflip, int yflip); - -extern void -matrix23Multiply(struct matrix23 *result, - const struct matrix23 *a, const struct matrix23 *b); - - -#endif /* INTEL_ROTATE_H */ |