From: Kevin Murphy Date: Tue, 8 May 2012 09:02:08 +0000 (-0400) Subject: drm: for minimum buffer size to be greater than 0 X-Git-Tag: 0.8.5~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cdbfba5364d5bbb6fa16f84aff90b2ebb3a17315;p=thirdparty%2Fplymouth.git drm: for minimum buffer size to be greater than 0 The drm driver tells us the minimum dimensions it supports for buffer objects. We use this minimum for creating a small temporary 32-bit buffer to test if 32-bit buffers are supported. Unfortunately, some drivers neglect to fill in min_width/min_height and then we try to allocate a buffer with 0 sized dimensions. This commit checks for min_width/min_height being 0, and then bumps them to 1. Minor changes to initial patch by Ray Strode. --- diff --git a/src/plugins/renderers/drm/plugin.c b/src/plugins/renderers/drm/plugin.c index 90d40e73..c19d6710 100644 --- a/src/plugins/renderers/drm/plugin.c +++ b/src/plugins/renderers/drm/plugin.c @@ -885,10 +885,24 @@ has_32bpp_support (ply_renderer_backend_t *backend) { uint32_t buffer_id; unsigned long row_stride; + uint32_t min_width; + uint32_t min_height; + + min_width = backend->resources->min_width; + min_height = backend->resources->min_height; + + /* Some drivers set min_width/min_height to 0, + * but 0x0 sized buffers don't work. + */ + if (min_width == 0) + min_width = 1; + + if (min_height == 0) + min_height = 1; buffer_id = backend->driver_interface->create_buffer (backend->driver, - backend->resources->min_width, - backend->resources->min_height, + min_width, + min_height, &row_stride); if (buffer_id == 0)