I sent two patches for this an hour ago.... On Fri, Oct 26, 2018 at 12:31 PM Eric Engestrom <eric.engest...@intel.com> wrote:
> This de-duplicates the error messages. > > Signed-off-by: Eric Engestrom <eric.engest...@intel.com> > --- > Kinda hacky, so I won't take it personally if I get a "heck no!" :P > --- > src/intel/vulkan/anv_device.c | 27 ++++++++------------------- > src/intel/vulkan/anv_private.h | 5 +++++ > src/intel/vulkan/anv_queue.c | 16 ++++------------ > src/intel/vulkan/genX_query.c | 4 +--- > 4 files changed, 18 insertions(+), 34 deletions(-) > > diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c > index 495a4ecab080bdd7de41..bb418b6969da644aba8a 100644 > --- a/src/intel/vulkan/anv_device.c > +++ b/src/intel/vulkan/anv_device.c > @@ -2049,7 +2049,7 @@ void anv_GetDeviceQueue2( > } > > void > -anv_device_set_lost(struct anv_device *device, const char *msg, ...) > +(anv_device_set_lost)(struct anv_device *device, const char *msg, ...) > { > device->_lost = true; > > @@ -2079,19 +2079,13 @@ anv_device_query_status(struct anv_device *device) > int ret = anv_gem_gpu_get_reset_stats(device, &active, &pending); > if (ret == -1) { > /* We don't know the real error. */ > - anv_device_set_lost(device, "get_reset_stats failed: %m"); > - return vk_errorf(device->instance, device, VK_ERROR_DEVICE_LOST, > - "get_reset_stats failed: %m"); > + return anv_device_set_lost(device, "get_reset_stats failed: %m"); > } > > if (active) { > - anv_device_set_lost(device, "GPU hung on one of our command > buffers"); > - return vk_errorf(device->instance, device, VK_ERROR_DEVICE_LOST, > - "GPU hung on one of our command buffers"); > + return anv_device_set_lost(device, "GPU hung on one of our command > buffers"); > } else if (pending) { > - anv_device_set_lost(device, "GPU hung with commands in-flight"); > - return vk_errorf(device->instance, device, VK_ERROR_DEVICE_LOST, > - "GPU hung with commands in-flight"); > + return anv_device_set_lost(device, "GPU hung with commands > in-flight"); > } > > return VK_SUCCESS; > @@ -2109,9 +2103,7 @@ anv_device_bo_busy(struct anv_device *device, struct > anv_bo *bo) > return VK_NOT_READY; > } else if (ret == -1) { > /* We don't know the real error. */ > - anv_device_set_lost(device, "gem wait failed: %m"); > - return vk_errorf(device->instance, device, VK_ERROR_DEVICE_LOST, > - "gem wait failed: %m"); > + return anv_device_set_lost(device, "gem wait failed: %m"); > } > > /* Query for device status after the busy call. If the BO we're > checking > @@ -2132,9 +2124,7 @@ anv_device_wait(struct anv_device *device, struct > anv_bo *bo, > return VK_TIMEOUT; > } else if (ret == -1) { > /* We don't know the real error. */ > - anv_device_set_lost(device, "gem wait failed: %m"); > - return vk_errorf(device->instance, device, VK_ERROR_DEVICE_LOST, > - "gem wait failed: %m"); > + return anv_device_set_lost(device, "gem wait failed: %m"); > } > > /* Query for device status after the wait. If the BO we're waiting on > got > @@ -3111,9 +3101,8 @@ VkResult anv_GetCalibratedTimestampsEXT( > &pTimestamps[d]); > > if (ret != 0) { > - anv_device_set_lost(device, "Failed to get a timestamp"); > - return vk_errorf(device->instance, device, > VK_ERROR_DEVICE_LOST, > - "Failed to read the TIMESTAMP register: %m"); > + return anv_device_set_lost(device, > + "Failed to read the TIMESTAMP > register: %m"); > } > uint64_t device_period = DIV_ROUND_UP(1000000000, > timestamp_frequency); > max_clock_period = MAX2(max_clock_period, device_period); > diff --git a/src/intel/vulkan/anv_private.h > b/src/intel/vulkan/anv_private.h > index a3ab971b6fd8b2355933..30e02142dba5f77641ca 100644 > --- a/src/intel/vulkan/anv_private.h > +++ b/src/intel/vulkan/anv_private.h > @@ -1077,6 +1077,11 @@ void anv_device_finish_blorp(struct anv_device > *device); > > void anv_device_set_lost(struct anv_device *device, > const char *msg, ...); > +#define anv_device_set_lost(dev, msg, ...) \ > + ({ \ > + (anv_device_set_lost)(dev, msg, ##__VA_ARGS__); \ > + vk_errorf(dev->instance, dev, VK_ERROR_DEVICE_LOST, msg, > ##__VA_ARGS__); \ > + }) > > static inline bool > anv_device_is_lost(struct anv_device *device) > diff --git a/src/intel/vulkan/anv_queue.c b/src/intel/vulkan/anv_queue.c > index 8e9f743fcb7a953a1f8f..6247ba8751e1fc3d2411 100644 > --- a/src/intel/vulkan/anv_queue.c > +++ b/src/intel/vulkan/anv_queue.c > @@ -42,9 +42,7 @@ anv_device_execbuf(struct anv_device *device, > int ret = device->no_hw ? 0 : anv_gem_execbuffer(device, execbuf); > if (ret != 0) { > /* We don't know the real error. */ > - anv_device_set_lost(device, "execbuf2 failed: %m"); > - return vk_errorf(device->instance, device, VK_ERROR_DEVICE_LOST, > - "execbuf2 failed: %m"); > + return anv_device_set_lost(device, "execbuf2 failed: %m"); > } > > struct drm_i915_gem_exec_object2 *objects = > @@ -243,9 +241,7 @@ VkResult anv_QueueSubmit( > * VK_ERROR_DEVICE_LOST to ensure that clients do not attempt to > * submit the same job again to this device. > */ > - result = vk_errorf(device->instance, device, VK_ERROR_DEVICE_LOST, > - "vkQueueSubmit() failed"); > - anv_device_set_lost(device, "vkQueueSubmit() failed"); > + result = anv_device_set_lost(device, "vkQueueSubmit() failed"); > } > > pthread_mutex_unlock(&device->mutex); > @@ -438,9 +434,7 @@ VkResult anv_GetFenceStatus( > return VK_NOT_READY; > } else { > /* We don't know the real error. */ > - anv_device_set_lost(device, "drm_syncobj_wait failed: %m"); > - return vk_errorf(device->instance, device, > VK_ERROR_DEVICE_LOST, > - "drm_syncobj_wait failed: %m"); > + return anv_device_set_lost(device, "drm_syncobj_wait failed: > %m"); > } > } else { > return VK_SUCCESS; > @@ -526,9 +520,7 @@ anv_wait_for_syncobj_fences(struct anv_device *device, > return VK_TIMEOUT; > } else { > /* We don't know the real error. */ > - anv_device_set_lost(device, "drm_syncobj_wait failed: %m"); > - return vk_errorf(device->instance, device, VK_ERROR_DEVICE_LOST, > - "drm_syncobj_wait failed: %m"); > + return anv_device_set_lost(device, "drm_syncobj_wait failed: > %m"); > } > } else { > return VK_SUCCESS; > diff --git a/src/intel/vulkan/genX_query.c b/src/intel/vulkan/genX_query.c > index 7dd9112d296228f1c7d5..ce8757f2643127a40c52 100644 > --- a/src/intel/vulkan/genX_query.c > +++ b/src/intel/vulkan/genX_query.c > @@ -181,9 +181,7 @@ wait_for_available(struct anv_device *device, > continue; > } else if (ret == -1) { > /* We don't know the real error. */ > - anv_device_set_lost(device, "gem wait failed: %m"); > - return vk_errorf(device->instance, device, VK_ERROR_DEVICE_LOST, > - "gem wait failed: %m"); > + return anv_device_set_lost(device, "gem wait failed: %m"); > } else { > assert(ret == 0); > /* The BO is no longer busy. */ > -- > Cheers, > Eric > > _______________________________________________ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev >
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev