Skip to content

Commit

Permalink
Merge pull request #15 from eric-ch/oxt-858
Browse files Browse the repository at this point in the history
OXT-858: Surfman spurious logs
  • Loading branch information
jean-edouard authored Dec 8, 2016
2 parents d049a6f + b9d1ab2 commit a75f8f7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
16 changes: 14 additions & 2 deletions libsurfman/src/surfman.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,21 @@ extern "C"
void surfman_message(surfman_loglvl level, const char *fmt, ...) __attribute__ ((format (printf, 2, 3)));
void surfman_vmessage(surfman_loglvl level, const char *fmt, va_list ap);
# define __log(level, level_string, fmt, ...) \
surfman_message(level, "%s:%s:%s:%d: " fmt "\n", level_string, __FILE__, __PRETTY_FUNCTION__, __LINE__, ## __VA_ARGS__)
surfman_message(level, "%s: " fmt "\n", level_string, ## __VA_ARGS__)

# ifdef NDEBUG
# define SURFMAN_DEBUG_PRINT 0
# else
# define SURFMAN_DEBUG_PRINT 1
#endif

# define surfman_debug(fmt, ...) \
do { \
if (SURFMAN_DEBUG_PRINT) \
surfman_message(SURFMAN_DEBUG, "%s:%s:%d: " fmt, \
__FILE__, __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__); \
} while (0)

# define surfman_debug(fmt, ...) __log(SURFMAN_DEBUG, "Debug", fmt, ## __VA_ARGS__)
# define surfman_info(fmt, ...) __log(SURFMAN_INFO, "Info", fmt, ## __VA_ARGS__)
# define surfman_warning(fmt, ...) __log(SURFMAN_WARNING, "Warning", fmt, ## __VA_ARGS__)
# define surfman_error(fmt, ...) __log(SURFMAN_ERROR, "Error", fmt, ## __VA_ARGS__)
Expand Down
6 changes: 3 additions & 3 deletions surfman/src/ioemugfx.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ ioemugfx_display_get_info(void *priv,
int align;
uint16_t rounded_xres;

surfman_info ("DisplayID:%d", msg->DisplayID);
surfman_debug ("DisplayID:%d", msg->DisplayID);

m = display_get_monitor (msg->DisplayID);
if (!m) {
Expand All @@ -123,12 +123,12 @@ ioemugfx_display_get_info(void *priv,
*/
rounded_xres = out->max_xres & ~0x7;
if (rounded_xres != out->max_xres) {
surfman_info ("Monitor %d: Rounding down xres: %d -> %d",
surfman_debug ("Monitor %d: Rounding down xres: %d -> %d",
msg->DisplayID, out->max_xres, rounded_xres);
out->max_xres = rounded_xres;
}

surfman_info ("Monitor %d: Max resolution: %dx%d, stride alignment: %d",
surfman_debug ("Monitor %d: Max resolution: %dx%d, stride alignment: %d",
msg->DisplayID, out->max_xres, out->max_yres, out->align);

return 0;
Expand Down

0 comments on commit a75f8f7

Please sign in to comment.