summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Mueller <MarkKMueller@gmail.com>2013-10-21 14:32:48 -0700
committerMark Mueller <MarkKMueller@gmail.com>2013-10-28 11:06:48 -0700
commit1b27273bcf92535d5fffb7717b38fffb9bb01422 (patch)
tree293a76c46d01cad4266594efaa59ab158d1aa11e
parent5d3e6e97887ebe7e2dad576ecdcc1ea40157efb2 (diff)
Minor changes. Improve texture loading metric. Resolving issues with a
system hang with piglit which appears unrelated to this work
-rw-r--r--src/mesa/drivers/common/meta.c21
-rw-r--r--src/mesa/drivers/dri/i965/brw_blorp_blit.cpp58
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.h2
-rw-r--r--src/mesa/drivers/dri/i965/intel_mipmap_tree.c2
-rw-r--r--src/mesa/drivers/dri/i965/intel_tex_image.c2
-rw-r--r--src/mesa/drivers/dri/i965/intel_tex_subimage.c17
-rw-r--r--src/mesa/main/debug.c2
-rw-r--r--src/mesa/main/teximage.c27
8 files changed, 125 insertions, 6 deletions
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index 798efa6807..b2f1615da5 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -3551,8 +3551,24 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target,
const GLint slice = 0;
GLuint samplerSave;
+ static unsigned totalCount = 0;
+
+ static double oldGenTime = 0.0;
+ static double glslGenTime = 0.0;
+
+ if (0 == totalCount % 16) {
+ _mesa_debug(ctx, "%s Gen Mipmap time for old path: %g. gen for GLSL: %g mipmapCout: %d \n", __FUNCTION__, oldGenTime, glslGenTime, totalCount);
+ }
+ struct timespec timestruct;
+ clock_gettime(CLOCK_MONOTONIC, &timestruct);
+ const double time0 = timestruct.tv_sec + timestruct.tv_nsec / 1000000000.0;
+
if (_mesa_meta_check_generate_mipmap_fallback(ctx, target, texObj)) {
_mesa_generate_mipmap(ctx, target, texObj);
+ clock_gettime(CLOCK_MONOTONIC, &timestruct);
+ const double time1 = timestruct.tv_sec + timestruct.tv_nsec / 1000000000.0;
+
+ oldGenTime += time1 - time0;
return;
}
@@ -3751,6 +3767,11 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target,
_mesa_TexParameteri(target, GL_GENERATE_MIPMAP, genMipmapSave);
_mesa_BindFramebuffer(GL_FRAMEBUFFER_EXT, fboSave);
+
+ clock_gettime(CLOCK_MONOTONIC, &timestruct);
+ const double time1 = timestruct.tv_sec + timestruct.tv_nsec / 1000000000.0;
+
+ glslGenTime += time1 - time0;
}
diff --git a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
index cd5e6f36e7..f3de44ce85 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
+++ b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
@@ -347,6 +347,64 @@ brw_blorp_GPUcopytexsubimage(struct brw_context *brw,
return false;
}
+ if (dst_image->Width == 0 || dst_image->Height == 0 || dst_image->Depth == 0) {
+ return false;
+ }
+
+ if (MESA_FORMAT_RGB_DXT1 <= dst_image->TexFormat &&
+ MESA_FORMAT_RGBA_DXT5 >= dst_image->TexFormat) {
+ DBG("%s: Compressed textures not supported.\n", __FUNCTION__);
+ return false;
+ }
+
+ /* compute slice info (and do some sanity checks) */
+ switch (dst_image->TexObject->Target) {
+ case GL_TEXTURE_2D:
+ case GL_TEXTURE_RECTANGLE:
+ case GL_TEXTURE_CUBE_MAP:
+ /* one image slice, nothing special needs to be done */
+ break;
+ case GL_TEXTURE_1D:
+ break;
+ case GL_TEXTURE_1D_ARRAY:
+// assert(depth == 1);
+// assert(zoffset == 0);
+// numSlices = height;
+// sliceOffset = yoffset;
+// height = 1;
+// yoffset = 0;
+// srcImageStride = _mesa_image_row_stride(packing, width, format, type);
+ return false;
+ break;
+ case GL_TEXTURE_2D_ARRAY:
+// numSlices = depth;
+// sliceOffset = zoffset;
+// depth = 1;
+// zoffset = 0;
+// srcImageStride = _mesa_image_image_stride(packing, width, height,
+// format, type);
+ return false;
+ break;
+ case GL_TEXTURE_3D:
+ /* we'll store 3D images as a series of slices */
+// numSlices = depth;
+// sliceOffset = zoffset;
+// srcImageStride = _mesa_image_image_stride(packing, width, height,
+// format, type);
+ return false;
+ break;
+ case GL_TEXTURE_CUBE_MAP_ARRAY:
+// numSlices = depth;
+// sliceOffset = zoffset;
+// srcImageStride = _mesa_image_image_stride(packing, width, height,
+// format, type);
+ return false;
+ break;
+ default:
+ _mesa_debug(&brw->ctx, "Unexpected target 0x%x in store_texsubimage()", dst_image->TexObject->Target);
+ return false;
+ }
+
/* get pointer to src pixels (may be in a pbo which we'll map here) */
const GLvoid *src =
_mesa_validate_pbo_teximage(&brw->ctx, dims, width, height, 1,
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index 6817afbb3b..b3de09c058 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -1408,8 +1408,6 @@ void brwInitVtbl( struct brw_context *brw );
/* brw_clear.c */
extern void intelInitClearFuncs(struct dd_function_table *functions);
-int CopyClientBuffer(struct brw_context *brw, drm_intel_bo *intelBO,
- unsigned offset, size_t len, const void *from);
/*======================================================================
* brw_context.c
diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index b24366b791..4f20bcdc54 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -728,7 +728,7 @@ intel_miptree_create_for_dri2_buffer(struct brw_context *brw,
return multisample_mt;
}
-int
+static int
CopyClientBuffer(struct brw_context *brw, drm_intel_bo *intelBO,
unsigned offset, size_t len, const void *from)
{
diff --git a/src/mesa/drivers/dri/i965/intel_tex_image.c b/src/mesa/drivers/dri/i965/intel_tex_image.c
index e293d329a2..28d1bec94f 100644
--- a/src/mesa/drivers/dri/i965/intel_tex_image.c
+++ b/src/mesa/drivers/dri/i965/intel_tex_image.c
@@ -195,11 +195,11 @@ intelTexImage(struct gl_context * ctx,
pixels, unpack, 0, 0, 0,
0, 0, texImage->Width, texImage->Height)) {
+ gpuCount++;
if (!(totalCount % 16)) {
_mesa_debug(ctx, "%s used blorp load. ratio = %g \n", __FUNCTION__, (double)gpuCount / (double)totalCount);
}
- gpuCount++;
return;
}
diff --git a/src/mesa/drivers/dri/i965/intel_tex_subimage.c b/src/mesa/drivers/dri/i965/intel_tex_subimage.c
index c086f95057..cccd504a06 100644
--- a/src/mesa/drivers/dri/i965/intel_tex_subimage.c
+++ b/src/mesa/drivers/dri/i965/intel_tex_subimage.c
@@ -647,8 +647,23 @@ intelTexSubImage(struct gl_context * ctx,
_mesa_lookup_enum_by_nr(texImage->TexObject->Target),
texImage->Level, texImage->Width, texImage->Height, texImage->Depth);
+ static double time0 = 0.0;
+
+ if (0 == totalCount) {
+ struct timespec timestruct;
+ clock_gettime(CLOCK_MONOTONIC, &timestruct);
+ time0 = timestruct.tv_sec + timestruct.tv_nsec / 1000000000.0;
+ }
+
+ if (300 == totalCount) {
+ struct timespec timestruct;
+ clock_gettime(CLOCK_MONOTONIC, &timestruct);
+ double time1 = timestruct.tv_sec + timestruct.tv_nsec / 1000000000.0;
+ _mesa_debug(ctx, "%s sub Load time for 300 textures: %g \n", __FUNCTION__, time1 - time0);
+ }
+
/* Try BLORP first. It can handle almost everything. */
- if (brw_blorp_GPUcopytexsubimage(brw_context(ctx), dims, texImage, format, type,
+ if (0 && brw_blorp_GPUcopytexsubimage(brw_context(ctx), dims, texImage, format, type,
pixels, packing, 0, 0, 0, xoffset, yoffset,
texImage->Width, texImage->Height)) {
diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c
index 9434c1ea2d..3a25926870 100644
--- a/src/mesa/main/debug.c
+++ b/src/mesa/main/debug.c
@@ -223,7 +223,7 @@ static void
write_ppm(const char *filename, const GLubyte *buffer, int width, int height,
int comps, int rcomp, int gcomp, int bcomp, GLboolean invert)
{
- FILE *f = fopen( filename, "w" );
+ FILE *f = fopen( filename, "a" );
if (f) {
int x, y;
const GLubyte *ptr = buffer;
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 793c5d3828..20997ead16 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -3130,6 +3130,10 @@ teximage(struct gl_context *ctx, GLboolean compressed, GLuint dims,
width, height, depth,
border, internalFormat, texFormat);
+ struct timespec timestruct;
+ clock_gettime(CLOCK_MONOTONIC, &timestruct);
+ const double time0 = timestruct.tv_sec + timestruct.tv_nsec / 1000000000.0;
+
/* Give the texture to the driver. <pixels> may be null. */
if (width > 0 && height > 0 && depth > 0) {
if (compressed) {
@@ -3142,7 +3146,30 @@ teximage(struct gl_context *ctx, GLboolean compressed, GLuint dims,
}
}
+ static unsigned totalCount = 0;
+ static unsigned mipmapCount = 0;
+ static double texImageTime = 0.0;
+ static double mipmapTime = 0.0;
+
+ clock_gettime(CLOCK_MONOTONIC, &timestruct);
+ const double time1 = timestruct.tv_sec + timestruct.tv_nsec / 1000000000.0;
+ texImageTime += time1 - time0;
+
+ totalCount++;
+
check_gen_mipmap(ctx, target, texObj, level);
+ if (texObj->GenerateMipmap &&
+ level == texObj->BaseLevel &&
+ level < texObj->MaxLevel) {
+ mipmapCount++;
+ }
+
+ clock_gettime(CLOCK_MONOTONIC, &timestruct);
+ mipmapTime += (timestruct.tv_sec + timestruct.tv_nsec / 1000000000.0) - time1;
+
+ if (300 == totalCount) {
+ _mesa_debug(ctx, "%s Mipmap time for 300 textures: %g. TexImageTime: %g. mipmapCout: %d \n", __FUNCTION__, mipmapTime, texImageTime, mipmapCount);
+ }
_mesa_update_fbo_texture(ctx, texObj, face, level);