diff mbox

[3/8] dri/intel: Add explicit size parameter to intel_region_alloc_for_fd

Message ID 86r4asydhd.fsf@miki.keithp.com
State New, archived
Headers show

Commit Message

Keith Packard Nov. 7, 2013, 5:42 a.m. UTC
Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
writes:

> You've presumably noticed this already, but this is the wrong way round
> - you're passing height * stride as pitch, and stride as size. This
> makes for awesome rendering.

Thanks for catching this; I've flipped them around, and also fixed the
fact that these calls were passing '1' for cpp, which appears to not
actually matter most of the time, but as the correct value was sitting
there in the image structure for the taking, I added that as well.

You reviewed this on IRC, so I'll be merging it into the commit on my
branch, just putting it here for other people to look at:
diff mbox

Patch

diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c
index 38badec..3ac5aa2 100644
--- a/src/mesa/drivers/dri/i915/intel_screen.c
+++ b/src/mesa/drivers/dri/i915/intel_screen.c
@@ -608,8 +608,8 @@  intel_create_image_from_fds(__DRIscreen *screen,
       return NULL;
 
    image->region = intel_region_alloc_for_fd(intelScreen,
-                                             1, width, height, height * strides[0],
-                                             strides[0], fds[0], "image");
+                                             f->planes[0].cpp, width, height, strides[0],
+                                             height * strides[0], fds[0], "image");
    if (image->region == NULL) {
       free(image);
       return NULL;
diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c
index 7571921..dcfde97 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -663,8 +663,8 @@  intel_create_image_from_fds(__DRIscreen *screen,
       return NULL;
 
    image->region = intel_region_alloc_for_fd(intelScreen,
-                                             1, width, height, height * strides[0],
-                                             strides[0], fds[0], "image");
+                                             f->planes[0].cpp, width, height, strides[0],
+                                             height * strides[0], fds[0], "image");
    if (image->region == NULL) {
       free(image);
       return NULL;