[Mesa-dev] [PATCH 2/2] mesa: Add performance debug for meta code.

2013-04-19 Thread Eric Anholt
I noticed a fallback in regnum through sysprof, and wanted a nicer way to
get information about it.
---
 src/mesa/drivers/common/meta.c |   28 +---
 src/mesa/main/errors.h |   10 ++
 2 files changed, 35 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index e3ab82b..6ee0986 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -3048,16 +3048,33 @@ _mesa_meta_check_generate_mipmap_fallback(struct 
gl_context *ctx, GLenum target,
GLenum status;
 
/* check for fallbacks */
-   if (!ctx->Extensions.EXT_framebuffer_object ||
-   target == GL_TEXTURE_3D ||
+   if (!ctx->Extensions.EXT_framebuffer_object) {
+  _mesa_perf_debug(ctx, MESA_DEBUG_SEVERITY_HIGH,
+   "glGenerateMipmap() without FBOs\n");
+  return GL_TRUE;
+   }
+
+   if (target == GL_TEXTURE_3D ||
target == GL_TEXTURE_1D_ARRAY ||
target == GL_TEXTURE_2D_ARRAY) {
+  _mesa_perf_debug(ctx, MESA_DEBUG_SEVERITY_HIGH,
+   "glGenerateMipmap() to %s target\n",
+   _mesa_lookup_enum_by_nr(target));
   return GL_TRUE;
}
 
srcLevel = texObj->BaseLevel;
baseImage = _mesa_select_tex_image(ctx, texObj, target, srcLevel);
-   if (!baseImage || _mesa_is_format_compressed(baseImage->TexFormat)) {
+   if (!baseImage) {
+  _mesa_perf_debug(ctx, MESA_DEBUG_SEVERITY_HIGH,
+   "glGenerateMipmap() couldn't find base teximage\n");
+  return GL_TRUE;
+   }
+
+   if (_mesa_is_format_compressed(baseImage->TexFormat)) {
+  _mesa_perf_debug(ctx, MESA_DEBUG_SEVERITY_HIGH,
+   "glGenerateMipmap() with %s format\n",
+   _mesa_get_format_name(baseImage->TexFormat));
   return GL_TRUE;
}
 
@@ -3067,6 +3084,9 @@ _mesa_meta_check_generate_mipmap_fallback(struct 
gl_context *ctx, GLenum target,
* texture sample conversion.  So we won't be able to generate the
* right colors when rendering.  Need to use a fallback.
*/
+  _mesa_perf_debug(ctx, MESA_DEBUG_SEVERITY_HIGH,
+   "glGenerateMipmap() of sRGB texture without "
+   "sRGB decode\n");
   return GL_TRUE;
}
 
@@ -3103,6 +3123,8 @@ _mesa_meta_check_generate_mipmap_fallback(struct 
gl_context *ctx, GLenum target,
_mesa_BindFramebuffer(GL_FRAMEBUFFER_EXT, fboSave);
 
if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
+  _mesa_perf_debug(ctx, MESA_DEBUG_SEVERITY_HIGH,
+   "glGenerateMipmap() got incomplete FBO\n");
   return GL_TRUE;
}
 
diff --git a/src/mesa/main/errors.h b/src/mesa/main/errors.h
index 7d8be5a..1677971 100644
--- a/src/mesa/main/errors.h
+++ b/src/mesa/main/errors.h
@@ -73,6 +73,16 @@ _mesa_gl_debug(struct gl_context *ctx,
enum mesa_debug_severity severity,
const char *fmtString, ...) PRINTFLIKE(5, 6);
 
+#define _mesa_perf_debug(ctx, sev, ...) do {  \
+   static GLuint msg_id = 0;  \
+   if (unlikely(ctx->Const.ContextFlags & GL_CONTEXT_FLAG_DEBUG_BIT)) {   \
+  _mesa_gl_debug(ctx, &msg_id,\
+ MESA_DEBUG_TYPE_PERFORMANCE, \
+ sev, \
+ __VA_ARGS__);\
+   }  \
+} while (0)
+
 extern void
 _mesa_shader_debug(struct gl_context *ctx, GLenum type, GLuint *id,
const char *msg, int len);
-- 
1.7.10.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/2] mesa: Add performance debug for meta code.

2013-04-19 Thread Brian Paul

On 04/19/2013 12:35 PM, Eric Anholt wrote:

I noticed a fallback in regnum through sysprof, and wanted a nicer way to
get information about it.
---
  src/mesa/drivers/common/meta.c |   28 +---
  src/mesa/main/errors.h |   10 ++
  2 files changed, 35 insertions(+), 3 deletions(-)



Reviewed-by: Brian Paul 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/2] mesa: Add performance debug for meta code.

2013-04-19 Thread Kenneth Graunke

On 04/19/2013 11:35 AM, Eric Anholt wrote:

I noticed a fallback in regnum through sysprof, and wanted a nicer way to
get information about it.
---
  src/mesa/drivers/common/meta.c |   28 +---
  src/mesa/main/errors.h |   10 ++
  2 files changed, 35 insertions(+), 3 deletions(-)


Looks nice to me, but I'm guessing this only shows up through 
ARB_debug_output?  It'd be nice to get this via printf when an 
environment variable is set.


For both:
Reviewed-by: Kenneth Graunke 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/2] mesa: Add performance debug for meta code.

2013-04-21 Thread Eric Anholt
Kenneth Graunke  writes:

> On 04/19/2013 11:35 AM, Eric Anholt wrote:
>> I noticed a fallback in regnum through sysprof, and wanted a nicer way to
>> get information about it.
>> ---
>>   src/mesa/drivers/common/meta.c |   28 +---
>>   src/mesa/main/errors.h |   10 ++
>>   2 files changed, 35 insertions(+), 3 deletions(-)
>
> Looks nice to me, but I'm guessing this only shows up through 
> ARB_debug_output?  It'd be nice to get this via printf when an 
> environment variable is set.

Right, and I agree.


pgpU9nhWny5Or.pgp
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev