]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
drm: for minimum buffer size to be greater than 0
authorKevin Murphy <kemurphy@andrew.cmu.edu>
Tue, 8 May 2012 09:02:08 +0000 (05:02 -0400)
committerRay Strode <rstrode@redhat.com>
Fri, 11 May 2012 15:54:05 +0000 (11:54 -0400)
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.

src/plugins/renderers/drm/plugin.c

index 90d40e73c75e24a629383306a3b980eaf4d5c816..c19d6710721d13c2c14f040fb9cac0a567bee0e3 100644 (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)