From 754726b0936587c172374567921a856f8fb6cf07 Mon Sep 17 00:00:00 2001 From: Taekyun Kim Date: Mon, 2 Nov 2015 13:04:19 +0900 Subject: [PATCH] drm: Don't print error msg when direct scanout failed Change-Id: I597b7c188f696937e9c28884398cc855e06a88d1 --- src/lib/drm/drm-buffer.c | 31 +++++++++++++++++-------------- src/lib/drm/drm-output.c | 6 ++++-- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/src/lib/drm/drm-buffer.c b/src/lib/drm/drm-buffer.c index 47f37c2..1f27068 100644 --- a/src/lib/drm/drm-buffer.c +++ b/src/lib/drm/drm-buffer.c @@ -143,26 +143,20 @@ handle_client_buffer_destroy(pepper_event_listener_t *listener, pepper_object_t drm_buffer_t * drm_buffer_create_pepper(pepper_drm_t *drm, pepper_buffer_t *pb) { - struct gbm_bo *bo; - drm_buffer_t *buffer; + struct gbm_bo *bo = NULL; + drm_buffer_t *buffer = NULL; struct wl_resource *resource = pepper_buffer_get_resource(pb); - buffer = calloc(1, sizeof(drm_buffer_t)); - PEPPER_CHECK(buffer, return NULL, "calloc() failed.\n"); - bo = gbm_bo_import(drm->gbm_device, GBM_BO_IMPORT_WL_BUFFER, resource, GBM_BO_USE_SCANOUT); if (!bo) - { - free(buffer); - return NULL; - } + goto error; + + buffer = calloc(1, sizeof(drm_buffer_t)); + if (!buffer) + goto error; if (!init_buffer_gbm(buffer, drm, bo, GBM_FORMAT_XRGB8888 /* FIXME */)) - { - gbm_bo_destroy(bo); - free(buffer); - return NULL; - } + goto error; buffer->type = DRM_BUFFER_TYPE_CLIENT; buffer->client_buffer = pb; @@ -173,6 +167,15 @@ drm_buffer_create_pepper(pepper_drm_t *drm, pepper_buffer_t *pb) handle_client_buffer_destroy, buffer); return buffer; + +error: + if (bo) + gbm_bo_destroy(bo); + + if (buffer) + free(buffer); + + return NULL; } void diff --git a/src/lib/drm/drm-output.c b/src/lib/drm/drm-output.c index 2448cfd..050d6b8 100644 --- a/src/lib/drm/drm-output.c +++ b/src/lib/drm/drm-output.c @@ -148,7 +148,8 @@ assign_fb_plane(drm_output_t *output, pepper_view_t *view) return NULL; output->back = drm_buffer_create_pepper(output->drm, buffer); - PEPPER_CHECK(output->back, return NULL, "failed to create drm_buffer\n"); + if (!output->back) + return NULL; return output->fb_plane; } @@ -187,7 +188,8 @@ assign_overlay_plane(drm_output_t *output, pepper_view_t *view) if (!plane->back && (plane->plane->possible_crtcs & (1 << output->crtc_index))) { plane->back = drm_buffer_create_pepper(output->drm, buffer); - PEPPER_CHECK(plane->back, return NULL, "failed to create drm_buffer\n"); + if (!plane->back) + return NULL; /* set position */ pepper_view_get_position(view, &x, &y); -- 2.7.4