@@ -3937,6 +3937,8 @@ static inline void intel_display_crc_init(struct drm_i915_private *dev_priv) {}
__printf(2, 3)
void i915_error_printf(struct drm_i915_error_state_buf *e, const char *f, ...);
+void i915_error_binary_write(struct drm_i915_error_state_buf *e,
+ const void *data, size_t len);
int i915_error_state_to_str(struct drm_i915_error_state_buf *estr,
const struct i915_gpu_state *gpu);
int i915_error_state_buf_init(struct drm_i915_error_state_buf *eb,
@@ -149,17 +149,13 @@ static void i915_error_vprintf(struct drm_i915_error_state_buf *e,
__i915_error_advance(e, len);
}
-static void i915_error_puts(struct drm_i915_error_state_buf *e,
- const char *str)
+void i915_error_binary_write(struct drm_i915_error_state_buf *e,
+ const void *data, size_t len)
{
- unsigned len;
-
if (!__i915_error_ok(e))
return;
- len = strlen(str);
-
- /* Seek the first printf which is hits start position */
+ /* Seek the first printf which hits start position */
if (e->pos < e->start) {
if (!__i915_error_seek(e, len))
return;
@@ -167,11 +163,18 @@ static void i915_error_puts(struct drm_i915_error_state_buf *e,
if (len >= e->size - e->bytes)
len = e->size - e->bytes - 1;
- memcpy(e->buf + e->bytes, str, len);
+ memcpy(e->buf + e->bytes, data, len);
__i915_error_advance(e, len);
}
+static void i915_error_puts(struct drm_i915_error_state_buf *e, const char *str)
+{
+ size_t len = strlen(str);
+
+ i915_error_binary_write(e, str, len);
+}
+
#define err_printf(e, ...) i915_error_printf(e, __VA_ARGS__)
#define err_puts(e, s) i915_error_puts(e, s)
i915_error_puts becomes an specialization of the more general case. Also, make it publicly accesible (since I will be using it inside AubCrash). Signed-off-by: Oscar Mateo <oscar.mateo@intel.com> Cc: Chris Wilson <chris@chris-wsilon.co.uk> --- drivers/gpu/drm/i915/i915_drv.h | 2 ++ drivers/gpu/drm/i915/i915_gpu_error.c | 19 +++++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-)