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.
{
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)