Use vmw_printf() just for extra debugging info (off by default).
Use vmw_error() for real errors/failures/etc that we definitely
want to report.
Reviewed-by: José Fonseca <jfonseca@vmware.com>
#ifndef VMW_CONTEXT_H_
#define VMW_CONTEXT_H_
+#include <stdio.h>
#include "pipe/p_compiler.h"
struct svga_winsys_screen;
struct pipe_context;
struct pipe_screen;
+
+/** Set to 1 to get extra debug info/output */
#define VMW_DEBUG 0
#if VMW_DEBUG
#endif
+/**
+ * Called when an error/failure is encountered.
+ * We want these messages reported for all build types.
+ */
+#define vmw_error(...) fprintf(stderr, "VMware: " __VA_ARGS__)
+
+
struct svga_winsys_context *
vmw_svga_winsys_context_create(struct svga_winsys_screen *sws);
#include "util/u_inlines.h"
#include "util/u_memory.h"
#include "util/u_format.h"
-#include "vmw_screen.h"
+#include "vmw_context.h"
+#include "vmw_screen.h"
#include "vmw_surface.h"
#include "svga_drm_public.h"
if (cur->major == required->major && cur->minor >= required->minor)
return TRUE;
- fprintf(stderr, "%s version failure.\n", component);
- fprintf(stderr, "%s version is %d.%d.%d and this driver can only work\n"
- "with versions %d.%d.x through %d.x.x.\n",
- component,
- cur->major,
- cur->minor,
- cur->patch_level, required->major, required->minor, compat->major);
+ vmw_error("%s version failure.\n", component);
+ vmw_error("%s version is %d.%d.%d and this driver can only work\n"
+ "with versions %d.%d.x through %d.x.x.\n",
+ component,
+ cur->major, cur->minor, cur->patch_level,
+ required->major, required->minor, compat->major);
return FALSE;
}
&arg, sizeof(arg));
if (ret) {
- fprintf(stderr, "Failed referencing shared surface. SID %d.\n"
- "Error %d (%s).\n",
- whandle->handle, ret, strerror(-ret));
+ vmw_error("Failed referencing shared surface. SID %d.\n"
+ "Error %d (%s).\n",
+ whandle->handle, ret, strerror(-ret));
return NULL;
}
if (rep->mip_levels[0] != 1) {
- fprintf(stderr, "Incorrect number of mipmap levels on shared surface."
- " SID %d, levels %d\n",
- whandle->handle, rep->mip_levels[0]);
+ vmw_error("Incorrect number of mipmap levels on shared surface."
+ " SID %d, levels %d\n",
+ whandle->handle, rep->mip_levels[0]);
goto out_mip;
}
for (i=1; i < DRM_VMW_MAX_SURFACE_FACES; ++i) {
if (rep->mip_levels[i] != 0) {
- fprintf(stderr, "Incorrect number of faces levels on shared surface."
- " SID %d, face %d present.\n",
- whandle->handle, i);
+ vmw_error("Incorrect number of faces levels on shared surface."
+ " SID %d, face %d present.\n",
+ whandle->handle, i);
goto out_mip;
}
}
ret = drmCommandWrite(vws->ioctl.drm_fd, DRM_VMW_EXECBUF, &arg, sizeof(arg));
} while(ret == -ERESTART);
if (ret) {
- debug_printf("%s error %s.\n", __FUNCTION__, strerror(-ret));
+ vmw_error("%s error %s.\n", __FUNCTION__, strerror(-ret));
}
if (rep.error) {
} while (ret == -ERESTART);
if (ret) {
- debug_printf("IOCTL failed %d: %s\n", ret, strerror(-ret));
+ vmw_error("IOCTL failed %d: %s\n", ret, strerror(-ret));
goto out_err1;
}
map = os_mmap(NULL, region->size, PROT_READ | PROT_WRITE, MAP_SHARED,
region->drm_fd, region->map_handle);
if (map == MAP_FAILED) {
- debug_printf("%s: Map failed.\n", __FUNCTION__);
+ vmw_error("%s: Map failed.\n", __FUNCTION__);
return NULL;
}
ret = drmCommandWrite(vws->ioctl.drm_fd, DRM_VMW_FENCE_UNREF,
&arg, sizeof(arg));
if (ret != 0)
- debug_printf("%s Failed\n", __FUNCTION__);
+ vmw_error("%s Failed\n", __FUNCTION__);
}
static INLINE uint32_t
&arg, sizeof(arg));
if (ret != 0)
- debug_printf("%s Failed\n", __FUNCTION__);
+ vmw_error("%s Failed\n", __FUNCTION__);
return 0;
}
ret = drmCommandWriteRead(vws->ioctl.drm_fd, DRM_VMW_GET_PARAM,
&gp_arg, sizeof(gp_arg));
if (ret || gp_arg.value == 0) {
- debug_printf("No 3D enabled (%i, %s).\n", ret, strerror(-ret));
+ vmw_error("No 3D enabled (%i, %s).\n", ret, strerror(-ret));
goto out_no_3d;
}
ret = drmCommandWriteRead(vws->ioctl.drm_fd, DRM_VMW_GET_PARAM,
&gp_arg, sizeof(gp_arg));
if (ret) {
- debug_printf("Failed to get fifo hw version"
- " (%i, %s).\n", ret, strerror(-ret));
+ vmw_error("Failed to get fifo hw version (%i, %s).\n",
+ ret, strerror(-ret));
goto out_no_3d;
}
vws->ioctl.hwversion = gp_arg.value;