i915_blit.c File Reference

Include dependency graph for i915_blit.c:

Go to the source code of this file.

Defines

#define FILE_DEBUG_FLAG   DEBUG_BLIT

Functions

void i915_fill_blit (struct i915_context *i915, unsigned cpp, short dst_pitch, struct pipe_buffer *dst_buffer, unsigned dst_offset, short x, short y, short w, short h, unsigned color)
void i915_copy_blit (struct i915_context *i915, unsigned do_flip, unsigned cpp, short src_pitch, struct pipe_buffer *src_buffer, unsigned src_offset, short dst_pitch, struct pipe_buffer *dst_buffer, unsigned dst_offset, short src_x, short src_y, short dst_x, short dst_y, short w, short h)


Define Documentation

#define FILE_DEBUG_FLAG   DEBUG_BLIT

Definition at line 36 of file i915_blit.c.


Function Documentation

void i915_copy_blit ( struct i915_context i915,
unsigned  do_flip,
unsigned  cpp,
short  src_pitch,
struct pipe_buffer src_buffer,
unsigned  src_offset,
short  dst_pitch,
struct pipe_buffer dst_buffer,
unsigned  dst_offset,
short  src_x,
short  src_y,
short  dst_x,
short  dst_y,
short  w,
short  h 
)

Definition at line 84 of file i915_blit.c.

References assert, BEGIN_BATCH, BR13(), FLUSH_BATCH, I915_BUFFER_ACCESS_READ, I915_BUFFER_ACCESS_WRITE, I915_DBG(), OUT_BATCH, OUT_RELOC, XY_SRC_COPY_BLT_CMD, XY_SRC_COPY_BLT_WRITE_ALPHA, and XY_SRC_COPY_BLT_WRITE_RGB.

00096 {
00097    unsigned CMD, BR13;
00098    int dst_y2 = dst_y + h;
00099    int dst_x2 = dst_x + w;
00100 
00101 
00102    I915_DBG(i915,
00103        "%s src:buf(%p)/%d+%d %d,%d dst:buf(%p)/%d+%d %d,%d sz:%dx%d\n",
00104        __FUNCTION__,
00105        src_buffer, src_pitch, src_offset, src_x, src_y,
00106        dst_buffer, dst_pitch, dst_offset, dst_x, dst_y, w, h);
00107 
00108    src_pitch *= (short) cpp;
00109    dst_pitch *= (short) cpp;
00110 
00111    switch (cpp) {
00112    case 1:
00113    case 2:
00114    case 3:
00115       BR13 = (((int) dst_pitch) & 0xffff) | 
00116          (0xCC << 16) | (1 << 24);
00117       CMD = XY_SRC_COPY_BLT_CMD;
00118       break;
00119    case 4:
00120       BR13 =
00121          (((int) dst_pitch) & 0xffff) | 
00122          (0xCC << 16) | (1 << 24) | (1 << 25);
00123       CMD =
00124          (XY_SRC_COPY_BLT_CMD | XY_SRC_COPY_BLT_WRITE_ALPHA |
00125           XY_SRC_COPY_BLT_WRITE_RGB);
00126       break;
00127    default:
00128       return;
00129    }
00130 
00131    if (dst_y2 < dst_y || 
00132        dst_x2 < dst_x) {
00133       return;
00134    }
00135 
00136    /* Hardware can handle negative pitches but loses the ability to do
00137     * proper overlapping blits in that case.  We don't really have a
00138     * need for either at this stage.
00139     */
00140    assert (dst_pitch > 0 && src_pitch > 0);
00141 
00142 
00143    if (!BEGIN_BATCH(8, 2)) {
00144       FLUSH_BATCH(NULL);
00145       assert(BEGIN_BATCH(8, 2));
00146    }
00147    OUT_BATCH(CMD);
00148    OUT_BATCH(BR13);
00149    OUT_BATCH((dst_y << 16) | dst_x);
00150    OUT_BATCH((dst_y2 << 16) | dst_x2);
00151    OUT_RELOC(dst_buffer, I915_BUFFER_ACCESS_WRITE, dst_offset);
00152    OUT_BATCH((src_y << 16) | src_x);
00153    OUT_BATCH(((int) src_pitch & 0xffff));
00154    OUT_RELOC(src_buffer, I915_BUFFER_ACCESS_READ, src_offset);
00155 }

void i915_fill_blit ( struct i915_context i915,
unsigned  cpp,
short  dst_pitch,
struct pipe_buffer dst_buffer,
unsigned  dst_offset,
short  x,
short  y,
short  w,
short  h,
unsigned  color 
)

Definition at line 39 of file i915_blit.c.

References assert, BEGIN_BATCH, BR13(), FLUSH_BATCH, I915_BUFFER_ACCESS_WRITE, OUT_BATCH, OUT_RELOC, XY_COLOR_BLT_CMD, XY_COLOR_BLT_WRITE_ALPHA, and XY_COLOR_BLT_WRITE_RGB.

00047 {
00048    unsigned BR13, CMD;
00049 
00050    switch (cpp) {
00051    case 1:
00052    case 2:
00053    case 3:
00054       BR13 = dst_pitch | (0xF0 << 16) | (1 << 24);
00055       CMD = XY_COLOR_BLT_CMD;
00056       break;
00057    case 4:
00058       BR13 = dst_pitch | (0xF0 << 16) | (1 << 24) | (1 << 25);
00059       CMD = (XY_COLOR_BLT_CMD | XY_COLOR_BLT_WRITE_ALPHA |
00060              XY_COLOR_BLT_WRITE_RGB);
00061       break;
00062    default:
00063       return;
00064    }
00065 
00066 //   DBG("%s dst:buf(%p)/%d+%d %d,%d sz:%dx%d\n",
00067 //       __FUNCTION__, dst_buffer, dst_pitch, dst_offset, x, y, w, h);
00068 
00069 
00070    if (!BEGIN_BATCH(6, 1)) {
00071       FLUSH_BATCH(NULL);
00072       assert(BEGIN_BATCH(6, 1));
00073    }
00074    OUT_BATCH(CMD);
00075    OUT_BATCH(BR13);
00076    OUT_BATCH((y << 16) | x);
00077    OUT_BATCH(((y + h) << 16) | (x + w));
00078    OUT_RELOC( dst_buffer, I915_BUFFER_ACCESS_WRITE, dst_offset);
00079    OUT_BATCH(color);
00080 }


Generated on Tue Sep 29 06:25:33 2009 for Gallium3D by  doxygen 1.5.4