<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">Hi Nicolas,<br>
      <br>
      I believe this patch doesn't fully solve the problem and could
      introduce some bugs.<br>
      <br>
      For example you change dri2_create_image_from_name pitch argument
      to stride,<br>
      whereas this function is used as is to implement
      createImageFromName from __DRIimageExtensionRec,<br>
      which takes a pitch. That said for this very function I'm not sure
      it is used correctly by the other parts of mesa,<br>
      for example in dri2_create_image_mesa_drm_buffer it seems to pass
      a stride ...<br>
      <br>
      It is a good idea to clean the pitch/stride confusions that can
      occur in the code, but you should fix<br>
      all occurences, not just some subset. I mean you'll have to change
      __DRIimageExtensionRec spec,<br>
      adapt all users and implementers.<br>
      <br>
      I guess piglit can be used to check for regressions<br>
      <br>
      Yours,<br>
      <br>
      Axel<br>
      <br>
      On 05/01/2016 16:58, Nicolas Dufresne wrote:<br>
    </div>
    <blockquote cite="mid:1452009498.25995.0.camel@collabora.com"
      type="cite">
      <pre wrap="">Le me know if this patch needs an update.

cheers,
Nicolas

Le jeudi 24 décembre 2015 à 15:15 -0500, Nicolas Dufresne a écrit :
</pre>
      <blockquote type="cite">
        <pre wrap="">In order to convert from stride to pitch, few functions were diving
by 4
the stride. This is not valid for RGB565 and this conversion was not
needed anyway in this context.

Signed-off-by: Nicolas Dufresne <a class="moz-txt-link-rfc2396E" href="mailto:nicolas.dufresne@collabora.com"><nicolas.dufresne@collabora.com></a>
---
 src/gallium/state_trackers/dri/dri2.c | 33 ++++++++++++-------------
--------
 1 file changed, 12 insertions(+), 21 deletions(-)

diff --git a/src/gallium/state_trackers/dri/dri2.c
b/src/gallium/state_trackers/dri/dri2.c
index a11a6cb..9f07a45 100644
--- a/src/gallium/state_trackers/dri/dri2.c
+++ b/src/gallium/state_trackers/dri/dri2.c
@@ -708,7 +708,7 @@ dri2_lookup_egl_image(struct dri_screen *screen,
void *handle)
 static __DRIimage *
 dri2_create_image_from_winsys(__DRIscreen *_screen,
                               int width, int height, int format,
-                              struct winsys_handle *whandle, int
pitch,
+                              struct winsys_handle *whandle, int
stride,
                               void *loaderPrivate)
 {
    struct dri_screen *screen = dri_screen(_screen);
@@ -753,7 +753,7 @@ dri2_create_image_from_winsys(__DRIscreen
*_screen,
    templ.depth0 = 1;
    templ.array_size = 1;
 
-   whandle->stride = pitch * util_format_get_blocksize(pf);
+   whandle->stride = stride;
 
    img->texture = screen->base.screen->resource_from_handle(screen-
</pre>
        <blockquote type="cite">
          <pre wrap="">base.screen,
</pre>
        </blockquote>
        <pre wrap="">          &templ, whandle);
@@ -773,7 +773,7 @@ dri2_create_image_from_winsys(__DRIscreen
*_screen,
 static __DRIimage *
 dri2_create_image_from_name(__DRIscreen *_screen,
                             int width, int height, int format,
-                            int name, int pitch, void
*loaderPrivate)
+                            int name, int stride, void
*loaderPrivate)
 {
    struct winsys_handle whandle;
 
@@ -782,13 +782,13 @@ dri2_create_image_from_name(__DRIscreen
*_screen,
    whandle.handle = name;
 
    return dri2_create_image_from_winsys(_screen, width, height,
format,
-                                        &whandle, pitch,
loaderPrivate);
+                                        &whandle, stride,
loaderPrivate);
 }
 
 static __DRIimage *
 dri2_create_image_from_fd(__DRIscreen *_screen,
                           int width, int height, int format,
-                          int fd, int pitch, void *loaderPrivate)
+                          int fd, int stride, void *loaderPrivate)
 {
    struct winsys_handle whandle;
 
@@ -800,7 +800,7 @@ dri2_create_image_from_fd(__DRIscreen *_screen,
    whandle.handle = (unsigned)fd;
 
    return dri2_create_image_from_winsys(_screen, width, height,
format,
-                                        &whandle, pitch,
loaderPrivate);
+                                        &whandle, stride,
loaderPrivate);
 }
 
 static __DRIimage *
@@ -986,7 +986,7 @@ dri2_from_names(__DRIscreen *screen, int width,
int height, int format,
                 void *loaderPrivate)
 {
    __DRIimage *img;
-   int stride, dri_components;
+   int dri_components;
 
    if (num_names != 1)
       return NULL;
@@ -997,11 +997,8 @@ dri2_from_names(__DRIscreen *screen, int width,
int height, int format,
    if (format == -1)
       return NULL;
 
-   /* Strides are in bytes not pixels. */
-   stride = strides[0] /4;
-
    img = dri2_create_image_from_name(screen, width, height, format,
-                                     names[0], stride,
loaderPrivate);
+                                     names[0], strides[0],
loaderPrivate);
    if (img == NULL)
       return NULL;
 
@@ -1101,7 +1098,7 @@ dri2_from_fds(__DRIscreen *screen, int width,
int height, int fourcc,
               void *loaderPrivate)
 {
    __DRIimage *img;
-   int format, stride, dri_components;
+   int format, dri_components;
 
    if (num_fds != 1)
       return NULL;
@@ -1112,11 +1109,8 @@ dri2_from_fds(__DRIscreen *screen, int width,
int height, int fourcc,
    if (format == -1)
       return NULL;
 
-   /* Strides are in bytes not pixels. */
-   stride = strides[0] /4;
-
    img = dri2_create_image_from_fd(screen, width, height, format,
-                                   fds[0], stride, loaderPrivate);
+                                   fds[0], strides[0],
loaderPrivate);
    if (img == NULL)
       return NULL;
 
@@ -1137,7 +1131,7 @@ dri2_from_dma_bufs(__DRIscreen *screen,
                    void *loaderPrivate)
 {
    __DRIimage *img;
-   int format, stride, dri_components;
+   int format, dri_components;
 
    if (num_fds != 1 || offsets[0] != 0) {
       *error = __DRI_IMAGE_ERROR_BAD_MATCH;
@@ -1150,11 +1144,8 @@ dri2_from_dma_bufs(__DRIscreen *screen,
       return NULL;
    }
 
-   /* Strides are in bytes not pixels. */
-   stride = strides[0] /4;
-
    img = dri2_create_image_from_fd(screen, width, height, format,
-                                   fds[0], stride, loaderPrivate);
+                                   fds[0], strides[0],
loaderPrivate);
    if (img == NULL) {
       *error = __DRI_IMAGE_ERROR_BAD_ALLOC;
       return NULL;</pre>
        <br>
        <fieldset class="mimeAttachmentHeader"></fieldset>
        <br>
        <pre wrap="">_______________________________________________
mesa-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a>
<a class="moz-txt-link-freetext" href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a>
</pre>
      </blockquote>
    </blockquote>
    <br>
  </body>
</html>