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

Keith Packard keithp at keithp.com
Wed Nov 6 21:42:22 PST 2013


Christopher James Halse Rogers <christopher.halse.rogers at 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 --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;

-- 
keith.packard at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 827 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20131106/1a39459b/attachment.pgp>


More information about the dri-devel mailing list