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_blit.c9
-rw-r--r--src/mesa/drivers/dri/intel/intel_context.c1
-rw-r--r--src/mesa/drivers/dri/intel/intel_context.h2
-rw-r--r--src/mesa/drivers/dri/intel/intel_pixel.c109
-rw-r--r--src/mesa/drivers/dri/intel/intel_pixel.h3
-rw-r--r--src/mesa/drivers/dri/intel/intel_pixel_bitmap.c2
-rw-r--r--src/mesa/drivers/dri/intel/intel_pixel_copy.c37
-rw-r--r--src/mesa/drivers/dri/intel/intel_pixel_draw.c2
8 files changed, 117 insertions, 48 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_blit.c b/src/mesa/drivers/dri/intel/intel_blit.c
index f1f21e7dfe..80d11a01b7 100644
--- a/src/mesa/drivers/dri/intel/intel_blit.c
+++ b/src/mesa/drivers/dri/intel/intel_blit.c
@@ -586,9 +586,6 @@ intelEmitImmediateColorExpandBlit(struct intel_context *intel,
dst_pitch *= cpp;
- if (dst_tiled)
- dst_pitch /= 4;
-
DBG("%s dst:buf(%p)/%d+%d %d,%d sz:%dx%d, %d bytes %d dwords\n",
__FUNCTION__,
dst_buffer, dst_pitch, dst_offset, x, y, w, h, src_size, dwords);
@@ -602,8 +599,12 @@ intelEmitImmediateColorExpandBlit(struct intel_context *intel,
opcode = XY_SETUP_BLT_CMD;
if (cpp == 4)
opcode |= XY_BLT_WRITE_ALPHA | XY_BLT_WRITE_RGB;
- if (dst_tiled)
+#ifndef I915
+ if (dst_tiled) {
opcode |= XY_DST_TILED;
+ dst_pitch /= 4;
+ }
+#endif
br13 = dst_pitch | (translate_raster_op(logic_op) << 16) | (1 << 29);
if (cpp == 2)
diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c
index 16ddbeea9e..6d7d6811ac 100644
--- a/src/mesa/drivers/dri/intel/intel_context.c
+++ b/src/mesa/drivers/dri/intel/intel_context.c
@@ -534,6 +534,7 @@ intelInitDriverFunctions(struct dd_function_table *functions)
intelInitTextureFuncs(functions);
intelInitStateFuncs(functions);
intelInitBufferFuncs(functions);
+ intelInitPixelFuncs(functions);
}
diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h
index c314b6e218..f1116d2747 100644
--- a/src/mesa/drivers/dri/intel/intel_context.h
+++ b/src/mesa/drivers/dri/intel/intel_context.h
@@ -331,7 +331,7 @@ do { \
* 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)
+static INLINE void * __memcpy(void * to, const void * from, size_t n)
{
int d0, d1, d2;
__asm__ __volatile__(
diff --git a/src/mesa/drivers/dri/intel/intel_pixel.c b/src/mesa/drivers/dri/intel/intel_pixel.c
index 9018e3daef..6417866b20 100644
--- a/src/mesa/drivers/dri/intel/intel_pixel.c
+++ b/src/mesa/drivers/dri/intel/intel_pixel.c
@@ -33,32 +33,97 @@
#include "intel_pixel.h"
#include "intel_regions.h"
+#define FILE_DEBUG_FLAG DEBUG_PIXEL
+
+static GLenum
+effective_func(GLenum func, GLboolean src_alpha_is_one)
+{
+ if (src_alpha_is_one) {
+ if (func == GL_SRC_ALPHA)
+ return GL_ONE;
+ if (func == GL_ONE_MINUS_SRC_ALPHA)
+ return GL_ZERO;
+ }
+
+ return func;
+}
/**
* Check if any fragment operations are in effect which might effect
* glDraw/CopyPixels.
*/
GLboolean
-intel_check_blit_fragment_ops(GLcontext * ctx)
+intel_check_blit_fragment_ops(GLcontext * ctx, GLboolean src_alpha_is_one)
{
if (ctx->NewState)
_mesa_update_state(ctx);
- /* XXX Note: Scissor could be done with the blitter:
- */
- return !(ctx->_ImageTransferState ||
- ctx->Color.AlphaEnabled ||
- ctx->Depth.Test ||
- ctx->Fog.Enabled ||
- ctx->Scissor.Enabled ||
- ctx->Stencil.Enabled ||
- !ctx->Color.ColorMask[0] ||
- !ctx->Color.ColorMask[1] ||
- !ctx->Color.ColorMask[2] ||
- !ctx->Color.ColorMask[3] ||
- ctx->Texture._EnabledUnits ||
- ctx->FragmentProgram._Enabled ||
- ctx->Color.BlendEnabled);
+ if (ctx->FragmentProgram._Enabled) {
+ DBG("fallback due to fragment program\n");
+ return GL_FALSE;
+ }
+
+ if (ctx->Color.BlendEnabled &&
+ (effective_func(ctx->Color.BlendSrcRGB, src_alpha_is_one) != GL_ONE ||
+ effective_func(ctx->Color.BlendDstRGB, src_alpha_is_one) != GL_ZERO ||
+ ctx->Color.BlendEquationRGB != GL_FUNC_ADD ||
+ effective_func(ctx->Color.BlendSrcA, src_alpha_is_one) != GL_ONE ||
+ effective_func(ctx->Color.BlendDstA, src_alpha_is_one) != GL_ZERO ||
+ ctx->Color.BlendEquationA != GL_FUNC_ADD)) {
+ DBG("fallback due to blend\n");
+ return GL_FALSE;
+ }
+
+ if (ctx->Texture._EnabledUnits) {
+ DBG("fallback due to texturing\n");
+ return GL_FALSE;
+ }
+
+ if (!(ctx->Color.ColorMask[0] &&
+ ctx->Color.ColorMask[1] &&
+ ctx->Color.ColorMask[2] &&
+ ctx->Color.ColorMask[3])) {
+ DBG("fallback due to color masking\n");
+ return GL_FALSE;
+ }
+
+ if (ctx->Color.AlphaEnabled) {
+ DBG("fallback due to alpha\n");
+ return GL_FALSE;
+ }
+
+ if (ctx->Depth.Test) {
+ DBG("fallback due to depth test\n");
+ return GL_FALSE;
+ }
+
+ if (ctx->Fog.Enabled) {
+ DBG("fallback due to fog\n");
+ return GL_FALSE;
+ }
+
+ if (ctx->_ImageTransferState) {
+ DBG("fallback due to image transfer\n");
+ return GL_FALSE;
+ }
+
+ if (ctx->Stencil.Enabled) {
+ DBG("fallback due to image stencil\n");
+ return GL_FALSE;
+ }
+
+ if (ctx->Scissor.Enabled) {
+ /* XXX Note: Scissor could be done with the blitter */
+ DBG("fallback due to image scissor\n");
+ return GL_FALSE;
+ }
+
+ if (ctx->RenderMode != GL_RENDER) {
+ DBG("fallback due to render mode\n");
+ return GL_FALSE;
+ }
+
+ return GL_TRUE;
}
@@ -113,8 +178,12 @@ void
intelInitPixelFuncs(struct dd_function_table *functions)
{
functions->Accum = _swrast_Accum;
- functions->Bitmap = _swrast_Bitmap;
- functions->CopyPixels = intelCopyPixels;
- functions->ReadPixels = intelReadPixels;
- functions->DrawPixels = intelDrawPixels;
+ if (!getenv("INTEL_NO_BLIT")) {
+ functions->Bitmap = intelBitmap;
+ functions->CopyPixels = intelCopyPixels;
+#ifdef I915
+ functions->ReadPixels = intelReadPixels;
+ functions->DrawPixels = intelDrawPixels;
+#endif
+ }
}
diff --git a/src/mesa/drivers/dri/intel/intel_pixel.h b/src/mesa/drivers/dri/intel/intel_pixel.h
index ea2319a01f..9c899b954c 100644
--- a/src/mesa/drivers/dri/intel/intel_pixel.h
+++ b/src/mesa/drivers/dri/intel/intel_pixel.h
@@ -32,7 +32,8 @@
void intelInitPixelFuncs(struct dd_function_table *functions);
-GLboolean intel_check_blit_fragment_ops(GLcontext * ctx);
+GLboolean intel_check_blit_fragment_ops(GLcontext * ctx,
+ GLboolean src_alpha_is_one);
GLboolean intel_check_meta_tex_fragment_ops(GLcontext * ctx);
diff --git a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c
index 4cb68655f2..81238acfe4 100644
--- a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c
+++ b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c
@@ -194,7 +194,7 @@ do_blit_bitmap( GLcontext *ctx,
/* Does zoom apply to bitmaps?
*/
- if (!intel_check_blit_fragment_ops(ctx) ||
+ if (!intel_check_blit_fragment_ops(ctx, tmpColor[3] == 1.0F) ||
ctx->Pixel.ZoomX != 1.0F ||
ctx->Pixel.ZoomY != 1.0F)
return GL_FALSE;
diff --git a/src/mesa/drivers/dri/intel/intel_pixel_copy.c b/src/mesa/drivers/dri/intel/intel_pixel_copy.c
index c453097e55..45f72bac52 100644
--- a/src/mesa/drivers/dri/intel/intel_pixel_copy.c
+++ b/src/mesa/drivers/dri/intel/intel_pixel_copy.c
@@ -40,7 +40,6 @@
#include "intel_buffers.h"
#include "intel_blit.h"
#include "intel_regions.h"
-#include "intel_tris.h"
#include "intel_pixel.h"
#define FILE_DEBUG_FLAG DEBUG_PIXEL
@@ -99,6 +98,7 @@ intel_check_copypixel_blit_fragment_ops(GLcontext * ctx)
ctx->Color.BlendEnabled);
}
+#ifdef I915
/* Doesn't work for overlapping regions. Could do a double copy or
* just fallback.
*/
@@ -236,9 +236,7 @@ do_texture_copypixels(GLcontext * ctx,
DBG("%s: success\n", __FUNCTION__);
return GL_TRUE;
}
-
-
-
+#endif /* I915 */
/**
@@ -272,8 +270,8 @@ do_blit_copypixels(GLcontext * ctx,
if (intel->driDrawable->numClipRects) {
__DRIdrawablePrivate *dPriv = intel->driDrawable;
+ __DRIdrawablePrivate *dReadPriv = intel->driReadDrawable;
drm_clip_rect_t *box = dPriv->pClipRects;
- drm_clip_rect_t dest_rect;
GLint nbox = dPriv->numClipRects;
GLint delta_x = 0;
GLint delta_y = 0;
@@ -303,8 +301,8 @@ do_blit_copypixels(GLcontext * ctx,
srcy = dPriv->h - srcy - height;
dstx += dPriv->x;
dsty += dPriv->y;
- srcx += dPriv->x;
- srcy += dPriv->y;
+ srcx += dReadPriv->x;
+ srcy += dReadPriv->y;
/* Clip against the source region. This is the only source
* clipping we do. Dst is clipped with cliprects below.
@@ -321,11 +319,6 @@ do_blit_copypixels(GLcontext * ctx,
dsty = srcy - delta_y;
}
- dest_rect.x1 = dstx;
- dest_rect.y1 = dsty;
- dest_rect.x2 = dstx + width;
- dest_rect.y2 = dsty + height;
-
/* Could do slightly more clipping: Eg, take the intersection of
* the existing set of cliprects and those cliprects translated
* by delta_x, delta_y:
@@ -334,19 +327,21 @@ do_blit_copypixels(GLcontext * ctx,
* introduce garbage when copying from obscured window regions.
*/
for (i = 0; i < nbox; i++) {
- drm_clip_rect_t rect;
+ GLint clip_x = dstx;
+ GLint clip_y = dsty;
+ GLint clip_w = width;
+ GLint clip_h = height;
- if (!intel_intersect_cliprects(&rect, &dest_rect, &box[i]))
+ if (!_mesa_clip_to_region(box[i].x1, box[i].y1, box[i].x2, box[i].y2,
+ &clip_x, &clip_y, &clip_w, &clip_h))
continue;
-
- intelEmitCopyBlit(intel, dst->cpp,
+ intelEmitCopyBlit(intel, dst->cpp,
src->pitch, src->buffer, 0, src->tiled,
dst->pitch, dst->buffer, 0, dst->tiled,
- rect.x1 + delta_x,
- rect.y1 + delta_y, /* srcx, srcy */
- rect.x1, rect.y1, /* dstx, dsty */
- rect.x2 - rect.x1, rect.y2 - rect.y1,
+ clip_x + delta_x, clip_y + delta_y, /* srcx, srcy */
+ clip_x, clip_y, /* dstx, dsty */
+ clip_w, clip_h,
ctx->Color.ColorLogicOpEnabled ?
ctx->Color.LogicOp : GL_COPY);
}
@@ -373,8 +368,10 @@ intelCopyPixels(GLcontext * ctx,
if (do_blit_copypixels(ctx, srcx, srcy, width, height, destx, desty, type))
return;
+#ifdef I915
if (do_texture_copypixels(ctx, srcx, srcy, width, height, destx, desty, type))
return;
+#endif
DBG("fallback to _swrast_CopyPixels\n");
diff --git a/src/mesa/drivers/dri/intel/intel_pixel_draw.c b/src/mesa/drivers/dri/intel/intel_pixel_draw.c
index 28cd4f0ba6..569e992b5e 100644
--- a/src/mesa/drivers/dri/intel/intel_pixel_draw.c
+++ b/src/mesa/drivers/dri/intel/intel_pixel_draw.c
@@ -253,7 +253,7 @@ do_blit_drawpixels(GLcontext * ctx,
return GL_FALSE;
}
- if (!intel_check_blit_fragment_ops(ctx)) {
+ if (!intel_check_blit_fragment_ops(ctx, GL_FALSE)) {
if (INTEL_DEBUG & DEBUG_PIXEL)
_mesa_printf("%s - bad GL fragment state for blitter\n",
__FUNCTION__);