summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2008-09-23 15:53:29 -0700
committerKeith Whitwell <keith@tungstengraphics.com>2008-09-23 15:53:29 -0700
commit9e7c0724bbc62c86dc302a9fe76b3e4288fc4461 (patch)
tree84eb7541f09eecfe1d6c7f692b01bbfb56b61516 /src
parenta0bd3972b645fbe61c3d1e2bbaa1510e04bad8d8 (diff)
parentf85ea6837da434cdec011de431e62db20ee39df2 (diff)
Merge commit 'origin/master' into gallium-0.2
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i915/intel_tris.c35
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.c3
-rw-r--r--src/mesa/drivers/dri/intel/intel_pixel_copy.c18
-rw-r--r--src/mesa/drivers/dri/intel/intel_pixel_draw.c384
4 files changed, 142 insertions, 298 deletions
diff --git a/src/mesa/drivers/dri/i915/intel_tris.c b/src/mesa/drivers/dri/i915/intel_tris.c
index 723cc70173..06210035af 100644
--- a/src/mesa/drivers/dri/i915/intel_tris.c
+++ b/src/mesa/drivers/dri/i915/intel_tris.c
@@ -109,6 +109,7 @@ void intel_flush_prim(struct intel_context *intel)
BATCH_LOCALS;
dri_bo *aper_array[2];
dri_bo *vb_bo;
+ unsigned int offset, count;
/* Must be called after an intel_start_prim. */
assert(intel->prim.primitive != ~0);
@@ -116,11 +117,19 @@ void intel_flush_prim(struct intel_context *intel)
if (intel->prim.count == 0)
return;
- /* Keep a reference on the BO as it may get finished as we start the
- * batch emit.
+ /* Clear the current prims out of the context state so that a batch flush
+ * flush triggered by wait_flips or emit_state doesn't loop back to
+ * flush_prim again.
*/
vb_bo = intel->prim.vb_bo;
dri_bo_reference(vb_bo);
+ count = intel->prim.count;
+ intel->prim.count = 0;
+ offset = intel->prim.start_offset;
+ intel->prim.start_offset = intel->prim.current_offset;
+ if (!IS_9XX(intel->intelScreen->deviceID))
+ intel->prim.start_offset = ALIGN(intel->prim.start_offset, 128);
+ intel->prim.flush = NULL;
intel_wait_flips(intel);
@@ -145,7 +154,7 @@ void intel_flush_prim(struct intel_context *intel)
assert((intel->batch->dirty_state & (1<<1)) == 0);
#if 0
- printf("emitting %d..%d=%d vertices size %d\n", intel->prim.start_offset,
+ printf("emitting %d..%d=%d vertices size %d\n", offset,
intel->prim.current_offset, intel->prim.count,
intel->vertex_size * 4);
#endif
@@ -154,9 +163,8 @@ void intel_flush_prim(struct intel_context *intel)
BEGIN_BATCH(5, LOOP_CLIPRECTS);
OUT_BATCH(_3DSTATE_LOAD_STATE_IMMEDIATE_1 |
I1_LOAD_S(0) | I1_LOAD_S(1) | 1);
- assert((intel->prim.start_offset & !S0_VB_OFFSET_MASK) == 0);
- OUT_RELOC(vb_bo, I915_GEM_DOMAIN_VERTEX, 0,
- intel->prim.start_offset);
+ assert((offset & !S0_VB_OFFSET_MASK) == 0);
+ OUT_RELOC(vb_bo, I915_GEM_DOMAIN_VERTEX, 0, offset);
OUT_BATCH((intel->vertex_size << S1_VERTEX_WIDTH_SHIFT) |
(intel->vertex_size << S1_VERTEX_PITCH_SHIFT));
@@ -164,7 +172,7 @@ void intel_flush_prim(struct intel_context *intel)
PRIM_INDIRECT |
PRIM_INDIRECT_SEQUENTIAL |
intel->prim.primitive |
- intel->prim.count);
+ count);
OUT_BATCH(0); /* Beginning vertex index */
ADVANCE_BATCH();
} else {
@@ -174,10 +182,9 @@ void intel_flush_prim(struct intel_context *intel)
OUT_BATCH(_3DSTATE_LOAD_STATE_IMMEDIATE_1 |
I1_LOAD_S(0) | I1_LOAD_S(2) | 1);
/* S0 */
- assert((intel->prim.start_offset & !S0_VB_OFFSET_MASK_830) == 0);
+ assert((offset & !S0_VB_OFFSET_MASK_830) == 0);
OUT_RELOC(vb_bo, I915_GEM_DOMAIN_VERTEX, 0,
- intel->prim.start_offset |
- (intel->vertex_size << S0_VB_PITCH_SHIFT_830) |
+ offset | (intel->vertex_size << S0_VB_PITCH_SHIFT_830) |
S0_VB_ENABLE_830);
/* S1
* This is somewhat unfortunate -- VB width is tied up with
@@ -194,19 +201,13 @@ void intel_flush_prim(struct intel_context *intel)
PRIM_INDIRECT |
PRIM_INDIRECT_SEQUENTIAL |
intel->prim.primitive |
- intel->prim.count);
+ count);
OUT_BATCH(0); /* Beginning vertex index */
ADVANCE_BATCH();
}
intel->no_batch_wrap = GL_FALSE;
- intel->prim.flush = NULL;
- intel->prim.start_offset = intel->prim.current_offset;
- if (!IS_9XX(intel->intelScreen->deviceID))
- intel->prim.start_offset = ALIGN(intel->prim.start_offset, 128);
- intel->prim.count = 0;
-
dri_bo_unreference(vb_bo);
}
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index df4593e42f..92629016d9 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -147,7 +147,8 @@ GLboolean brwCreateContext( const __GLcontextModes *mesaVis,
brw->emit_state_always = 0;
- ctx->FragmentProgram._MaintainTexEnvProgram = 1;
+ ctx->VertexProgram._MaintainTnlProgram = GL_TRUE;
+ ctx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE;
brw_draw_init( brw );
diff --git a/src/mesa/drivers/dri/intel/intel_pixel_copy.c b/src/mesa/drivers/dri/intel/intel_pixel_copy.c
index 3fb8a3104c..1b3cb5adcb 100644
--- a/src/mesa/drivers/dri/intel/intel_pixel_copy.c
+++ b/src/mesa/drivers/dri/intel/intel_pixel_copy.c
@@ -135,10 +135,20 @@ do_texture_copypixels(GLcontext * ctx,
srcbox.x2 = srcx + width;
srcbox.y2 = srcy + height;
- dstbox.x1 = dstx;
- dstbox.y1 = dsty;
- dstbox.x2 = dstx + width * ctx->Pixel.ZoomX;
- dstbox.y2 = dsty + height * ctx->Pixel.ZoomY;
+ if (ctx->Pixel.ZoomX > 0) {
+ dstbox.x1 = dstx;
+ dstbox.x2 = dstx + width * ctx->Pixel.ZoomX;
+ } else {
+ dstbox.x1 = dstx + width * ctx->Pixel.ZoomX;
+ dstbox.x2 = dstx;
+ }
+ if (ctx->Pixel.ZoomY > 0) {
+ dstbox.y1 = dsty;
+ dstbox.y2 = dsty + height * ctx->Pixel.ZoomY;
+ } else {
+ dstbox.y1 = dsty + height * ctx->Pixel.ZoomY;
+ dstbox.y2 = dsty;
+ }
DBG("src %d,%d %d,%d\n", srcbox.x1, srcbox.y1, srcbox.x2, srcbox.y2);
DBG("dst %d,%d %d,%d (%dx%d) (%f,%f)\n", dstbox.x1, dstbox.y1, dstbox.x2, dstbox.y2,
diff --git a/src/mesa/drivers/dri/intel/intel_pixel_draw.c b/src/mesa/drivers/dri/intel/intel_pixel_draw.c
index 5e32d8a8ed..0ddc3aa30d 100644
--- a/src/mesa/drivers/dri/intel/intel_pixel_draw.c
+++ b/src/mesa/drivers/dri/intel/intel_pixel_draw.c
@@ -31,6 +31,14 @@
#include "main/mtypes.h"
#include "main/macros.h"
#include "main/bufferobj.h"
+#include "main/teximage.h"
+#include "main/texobj.h"
+#include "main/texstate.h"
+#include "main/matrix.h"
+#include "main/varray.h"
+#include "main/attrib.h"
+#include "main/enable.h"
+#include "glapi/dispatch.h"
#include "swrast/swrast.h"
#include "intel_screen.h"
@@ -44,294 +52,123 @@
#include "intel_tris.h"
-
static GLboolean
-do_texture_drawpixels(GLcontext * ctx,
- GLint x, GLint y,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *unpack,
- const GLvoid * pixels)
+intel_texture_drawpixels(GLcontext * ctx,
+ GLint x, GLint y,
+ GLsizei width, GLsizei height,
+ GLenum format,
+ GLenum type,
+ const struct gl_pixelstore_attrib *unpack,
+ const GLvoid *pixels)
{
- struct intel_context *intel = intel_context(ctx);
- struct intel_region *dst = intel_drawbuf_region(intel);
- struct intel_buffer_object *src = intel_buffer_object(unpack->BufferObj);
- GLuint rowLength = unpack->RowLength ? unpack->RowLength : width;
- GLuint src_offset;
-
- if (INTEL_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- intelFlush(&intel->ctx);
-
- if (!dst)
- return GL_FALSE;
-
- intel->vtbl.render_start(intel);
- intel->vtbl.emit_state(intel);
-
- if (src) {
- if (!_mesa_validate_pbo_access(2, unpack, width, height, 1,
- format, type, pixels)) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawPixels");
- return GL_TRUE;
- }
- }
- else {
- /* PBO only for now:
- */
- if (INTEL_DEBUG & DEBUG_PIXEL)
- _mesa_printf("%s - not PBO\n", __FUNCTION__);
- return GL_FALSE;
- }
+ GLuint texname;
+ GLfloat vertices[4][4];
+ GLfloat texcoords[4][2];
- /* There are a couple of things we can't do yet, one of which is
- * set the correct state for pixel operations when GL texturing is
- * enabled. That's a pretty rare state and probably not worth the
- * effort. A completely device-independent version of this may do
- * more.
- *
- * Similarly, we make no attempt to merge metaops processing with
- * an enabled fragment program, though it would certainly be
- * possible.
+ /* We're going to mess with texturing with no regard to existing texture
+ * state, so if there is some set up we have to bail.
*/
- if (!intel_check_meta_tex_fragment_ops(ctx)) {
- if (INTEL_DEBUG & DEBUG_PIXEL)
- _mesa_printf("%s - bad GL fragment state for metaops texture\n",
- __FUNCTION__);
+ if (ctx->Texture._EnabledUnits != 0)
return GL_FALSE;
- }
- intel->vtbl.install_meta_state(intel);
-
-
- /* Is this true? Also will need to turn depth testing on according
- * to state:
+ /* Can't do textured DrawPixels with a fragment program, unless we were
+ * to generate a new program that sampled our texture and put the results
+ * in the fragment color before the user's program started.
*/
- intel->vtbl.meta_no_stencil_write(intel);
- intel->vtbl.meta_no_depth_write(intel);
-
- /* Set the 3d engine to draw into the destination region:
- */
- intel->vtbl.meta_draw_region(intel, dst, intel->depth_region);
-
- intel->vtbl.meta_import_pixel_state(intel);
-
- src_offset = (GLuint) _mesa_image_address(2, unpack, pixels, width, height,
- format, type, 0, 0, 0);
-
-
- /* Setup the pbo up as a rectangular texture, if possible.
- *
- * TODO: This is almost always possible if the i915 fragment
- * program is adjusted to correctly swizzle the sampled colors.
- * The major exception is any 24bit texture, like RGB888, for which
- * there is no hardware support.
- */
- if (!intel->vtbl.meta_tex_rect_source(intel, src->buffer, src_offset,
- rowLength, height, format, type)) {
- intel->vtbl.leave_meta_state(intel);
- return GL_FALSE;
- }
-
- intel->vtbl.meta_texture_blend_replace(intel);
-
-
- LOCK_HARDWARE(intel);
-
- if (intel->driDrawable->numClipRects) {
- __DRIdrawablePrivate *dPriv = intel->driDrawable;
- GLint srcx, srcy;
- GLint dstx, dsty;
-
- dstx = x;
- dsty = dPriv->h - (y + height);
-
- srcx = 0; /* skiprows/pixels already done */
- srcy = 0;
-
- if (0) {
- const GLint orig_x = dstx;
- const GLint orig_y = dsty;
-
- if (!_mesa_clip_to_region(0, 0, dst->pitch, dst->height,
- &dstx, &dsty, &width, &height))
- goto out;
-
- srcx += dstx - orig_x;
- srcy += dsty - orig_y;
- }
-
-
- if (INTEL_DEBUG & DEBUG_PIXEL)
- _mesa_printf("draw %d,%d %dx%d\n", dstx, dsty, width, height);
-
- /* Must use the regular cliprect mechanism in order to get the
- * drawing origin set correctly. Otherwise scissor state is in
- * incorrect coordinate space. Does this even need to hold the
- * lock???
- */
- intel->vtbl.meta_draw_quad(intel,
- dstx, dstx + width * ctx->Pixel.ZoomX,
- dPriv->h - (y + height * ctx->Pixel.ZoomY),
- dPriv->h - (y),
- -ctx->Current.RasterPos[2] * .5,
- 0x00ff00ff,
- srcx, srcx + width, srcy + height, srcy);
- out:
- intel->vtbl.leave_meta_state(intel);
- intel_batchbuffer_emit_mi_flush(intel->batch);
- }
- UNLOCK_HARDWARE(intel);
- return GL_TRUE;
-}
-
-
-
-
-
-/* Pros:
- * - no waiting for idle before updating framebuffer.
- *
- * Cons:
- * - if upload is by memcpy, this may actually be slower than fallback path.
- * - uploads the whole image even if destination is clipped
- *
- * Need to benchmark.
- *
- * Given the questions about performance, implement for pbo's only.
- * This path is definitely a win if the pbo is already in agp. If it
- * turns out otherwise, we can add the code necessary to upload client
- * data to agp space before performing the blit. (Though it may turn
- * out to be better/simpler just to use the texture engine).
- */
-static GLboolean
-do_blit_drawpixels(GLcontext * ctx,
- GLint x, GLint y,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *unpack,
- const GLvoid * pixels)
-{
- struct intel_context *intel = intel_context(ctx);
- struct intel_region *dest = intel_drawbuf_region(intel);
- struct intel_buffer_object *src = intel_buffer_object(unpack->BufferObj);
- GLuint src_offset;
- GLuint rowLength;
-
- if (INTEL_DEBUG & DEBUG_PIXEL)
- _mesa_printf("%s\n", __FUNCTION__);
-
-
- if (!dest) {
- if (INTEL_DEBUG & DEBUG_PIXEL)
- _mesa_printf("%s - no dest\n", __FUNCTION__);
- return GL_FALSE;
- }
-
- if (src) {
- /* This validation should be done by core mesa:
- */
- if (!_mesa_validate_pbo_access(2, unpack, width, height, 1,
- format, type, pixels)) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawPixels");
- return GL_TRUE;
- }
- }
- else {
- /* PBO only for now:
- */
- if (INTEL_DEBUG & DEBUG_PIXEL)
- _mesa_printf("%s - not PBO\n", __FUNCTION__);
+ if (ctx->FragmentProgram.Enabled)
return GL_FALSE;
- }
- if (!intel_check_blit_format(dest, format, type)) {
- if (INTEL_DEBUG & DEBUG_PIXEL)
- _mesa_printf("%s - bad format for blit\n", __FUNCTION__);
+ /* Don't even want to think about it */
+ if (format == GL_COLOR_INDEX)
return GL_FALSE;
- }
- 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__);
+ /* We don't have a way to generate fragments with stencil values which *
+ * will set the resulting stencil value.
+ */
+ if (format == GL_STENCIL_INDEX)
return GL_FALSE;
- }
- if (ctx->Pixel.ZoomX != 1.0F) {
- if (INTEL_DEBUG & DEBUG_PIXEL)
- _mesa_printf("%s - bad PixelZoomX for blit\n", __FUNCTION__);
- return GL_FALSE;
- }
-
-
- if (unpack->RowLength > 0)
- rowLength = unpack->RowLength;
- else
- rowLength = width;
-
- if (ctx->Pixel.ZoomY == -1.0F) {
- if (INTEL_DEBUG & DEBUG_PIXEL)
- _mesa_printf("%s - bad PixelZoomY for blit\n", __FUNCTION__);
- return GL_FALSE; /* later */
- y -= height;
- }
- else if (ctx->Pixel.ZoomY == 1.0F) {
- rowLength = -rowLength;
- }
- else {
- if (INTEL_DEBUG & DEBUG_PIXEL)
- _mesa_printf("%s - bad PixelZoomY for blit\n", __FUNCTION__);
+ /* To do DEPTH_COMPONENT, we would need to change our setup to not draw to
+ * the color buffer, and sample the texture values into the fragment depth
+ * in a program.
+ */
+ if (format == GL_DEPTH_COMPONENT)
return GL_FALSE;
- }
-
- src_offset = (GLuint) _mesa_image_address(2, unpack, pixels, width, height,
- format, type, 0, 0, 0);
-
- intelFlush(&intel->ctx);
- LOCK_HARDWARE(intel);
-
- if (intel->driDrawable->numClipRects) {
- __DRIdrawablePrivate *dPriv = intel->driDrawable;
- int nbox = dPriv->numClipRects;
- drm_clip_rect_t *box = dPriv->pClipRects;
- drm_clip_rect_t rect;
- drm_clip_rect_t dest_rect;
- dri_bo *src_buffer = intel_bufferobj_buffer(intel, src, INTEL_READ);
- int i;
- dest_rect.x1 = dPriv->x + x;
- dest_rect.y1 = dPriv->y + dPriv->h - (y + height);
- dest_rect.x2 = dest_rect.x1 + width;
- dest_rect.y2 = dest_rect.y1 + height;
-
- for (i = 0; i < nbox; i++) {
- if (!intel_intersect_cliprects(&rect, &dest_rect, &box[i]))
- continue;
-
- intelEmitCopyBlit(intel,
- dest->cpp,
- rowLength, src_buffer, src_offset, GL_FALSE,
- dest->pitch, dest->buffer, 0, dest->tiling,
- rect.x1 - dest_rect.x1,
- rect.y2 - dest_rect.y2,
- rect.x1,
- rect.y1, rect.x2 - rect.x1, rect.y2 - rect.y1,
- ctx->Color.ColorLogicOpEnabled ?
- ctx->Color.LogicOp : GL_COPY);
- }
- }
- UNLOCK_HARDWARE(intel);
-
- if (INTEL_DEBUG & DEBUG_PIXEL)
- _mesa_printf("%s - DONE\n", __FUNCTION__);
+ _mesa_PushAttrib(GL_ENABLE_BIT | GL_TRANSFORM_BIT | GL_TEXTURE_BIT |
+ GL_CURRENT_BIT);
+ _mesa_PushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT);
+
+ /* XXX: pixel store stuff */
+ _mesa_Disable(GL_POLYGON_STIPPLE);
+
+ _mesa_ActiveTextureARB(GL_TEXTURE0_ARB);
+ _mesa_Enable(GL_TEXTURE_2D);
+ _mesa_GenTextures(1, &texname);
+ _mesa_BindTexture(GL_TEXTURE_2D, texname);
+ _mesa_TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ _mesa_TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ _mesa_TexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
+ /*
+ _mesa_TexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_REPLACE);
+ _mesa_TexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE);
+ */
+ _mesa_TexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, format,
+ type, pixels);
+
+ _mesa_MatrixMode(GL_PROJECTION);
+ _mesa_PushMatrix();
+ _mesa_LoadIdentity();
+ _mesa_Ortho(0, ctx->DrawBuffer->Width, 0, ctx->DrawBuffer->Height, 1, -1);
+
+ _mesa_MatrixMode(GL_MODELVIEW);
+ _mesa_PushMatrix();
+ _mesa_LoadIdentity();
+
+ vertices[0][0] = x;
+ vertices[0][1] = y;
+ vertices[0][2] = ctx->Current.RasterPos[2];
+ vertices[0][3] = ctx->Current.RasterPos[3];
+ vertices[1][0] = x + width * ctx->Pixel.ZoomX;
+ vertices[1][1] = y;
+ vertices[1][2] = ctx->Current.RasterPos[2];
+ vertices[1][3] = ctx->Current.RasterPos[3];
+ vertices[2][0] = x + width * ctx->Pixel.ZoomX;
+ vertices[2][1] = y + height * ctx->Pixel.ZoomY;
+ vertices[2][2] = ctx->Current.RasterPos[2];
+ vertices[2][3] = ctx->Current.RasterPos[3];
+ vertices[3][0] = x;
+ vertices[3][1] = y + height * ctx->Pixel.ZoomY;
+ vertices[3][2] = ctx->Current.RasterPos[2];
+ vertices[3][3] = ctx->Current.RasterPos[3];
+
+ texcoords[0][0] = 0.0;
+ texcoords[0][1] = 0.0;
+ texcoords[1][0] = 1.0;
+ texcoords[1][1] = 0.0;
+ texcoords[2][0] = 1.0;
+ texcoords[2][1] = 1.0;
+ texcoords[3][0] = 0.0;
+ texcoords[3][1] = 1.0;
+
+ _mesa_VertexPointer(4, GL_FLOAT, 4 * sizeof(GLfloat), &vertices);
+ _mesa_TexCoordPointer(2, GL_FLOAT, 2 * sizeof(GLfloat), &texcoords);
+ _mesa_Enable(GL_VERTEX_ARRAY);
+ _mesa_Enable(GL_TEXTURE_COORD_ARRAY);
+ CALL_DrawArrays(ctx->Exec, (GL_TRIANGLE_FAN, 0, 4));
+
+ _mesa_MatrixMode(GL_PROJECTION);
+ _mesa_PopMatrix();
+ _mesa_MatrixMode(GL_MODELVIEW);
+ _mesa_PopMatrix();
+ _mesa_PopClientAttrib();
+ _mesa_PopAttrib();
+
+ _mesa_DeleteTextures(1, &texname);
return GL_TRUE;
}
-
-
void
intelDrawPixels(GLcontext * ctx,
GLint x, GLint y,
@@ -341,15 +178,10 @@ intelDrawPixels(GLcontext * ctx,
const struct gl_pixelstore_attrib *unpack,
const GLvoid * pixels)
{
- if (do_blit_drawpixels(ctx, x, y, width, height, format, type,
- unpack, pixels))
+ if (intel_texture_drawpixels(ctx, x, y, width, height, format, type,
+ unpack, pixels))
return;
- if (do_texture_drawpixels(ctx, x, y, width, height, format, type,
- unpack, pixels))
- return;
-
-
if (INTEL_DEBUG & DEBUG_PIXEL)
_mesa_printf("%s: fallback to swrast\n", __FUNCTION__);