drm-buffer: Remove useless soft-asserts

If triggered, many would result in crashes later anyway, so lets change
those to asserts. Some are simply useless, so remove those.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/584
This commit is contained in:
Jonas Ådahl 2019-05-20 21:28:04 +02:00 committed by Georges Basile Stavracas Neto
parent 6eeba2434a
commit ed56edc7ba

View File

@ -80,12 +80,10 @@ meta_drm_buffer_acquire_swapped_buffer (MetaDrmBuffer *buffer,
int i; int i;
int kms_fd; int kms_fd;
g_return_val_if_fail (META_IS_DRM_BUFFER (buffer), FALSE); g_assert (buffer->type == META_DRM_BUFFER_TYPE_GBM);
g_return_val_if_fail (buffer->type == META_DRM_BUFFER_TYPE_GBM, FALSE); g_assert (!buffer->gbm.bo);
g_return_val_if_fail (buffer->gbm.bo == NULL, FALSE); g_assert (buffer->gbm.surface);
g_return_val_if_fail (buffer->gbm.surface != NULL, FALSE); g_assert (buffer->gbm.gpu_kms);
g_return_val_if_fail (buffer->gbm.gpu_kms != NULL, FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
kms_fd = meta_gpu_kms_get_fd (buffer->gbm.gpu_kms); kms_fd = meta_gpu_kms_get_fd (buffer->gbm.gpu_kms);
@ -238,9 +236,6 @@ meta_drm_buffer_new_from_gbm (MetaGpuKms *gpu_kms,
{ {
MetaDrmBuffer *buffer; MetaDrmBuffer *buffer;
g_return_val_if_fail (META_IS_GPU_KMS (gpu_kms), NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
buffer = g_object_new (META_TYPE_DRM_BUFFER, NULL); buffer = g_object_new (META_TYPE_DRM_BUFFER, NULL);
buffer->type = META_DRM_BUFFER_TYPE_GBM; buffer->type = META_DRM_BUFFER_TYPE_GBM;
buffer->gbm.gpu_kms = gpu_kms; buffer->gbm.gpu_kms = gpu_kms;
@ -272,15 +267,12 @@ meta_drm_buffer_new_from_dumb (uint32_t dumb_fb_id)
uint32_t uint32_t
meta_drm_buffer_get_fb_id (const MetaDrmBuffer *buffer) meta_drm_buffer_get_fb_id (const MetaDrmBuffer *buffer)
{ {
g_return_val_if_fail (buffer != NULL, INVALID_FB_ID);
return buffer->fb_id; return buffer->fb_id;
} }
struct gbm_bo * struct gbm_bo *
meta_drm_buffer_get_bo (const MetaDrmBuffer *buffer) meta_drm_buffer_get_bo (const MetaDrmBuffer *buffer)
{ {
g_return_val_if_fail (buffer, NULL);
g_return_val_if_fail (buffer->type == META_DRM_BUFFER_TYPE_GBM, NULL); g_return_val_if_fail (buffer->type == META_DRM_BUFFER_TYPE_GBM, NULL);
return buffer->gbm.bo; return buffer->gbm.bo;