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.
This commit is contained in:
Kevin Murphy 2012-05-08 05:02:08 -04:00 committed by Ray Strode
parent e274cda1ee
commit cdbfba5364

View file

@ -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)