gbm/dri: Fix sign-extension in modifier query
authorDaniel Stone <daniels@collabora.com>
Tue, 2 May 2017 18:44:38 +0000 (19:44 +0100)
committerDaniel Stone <daniels@collabora.com>
Tue, 2 May 2017 18:55:13 +0000 (19:55 +0100)
When we were assembling the unsigned 64-bit query return from its
two signed 32-bit component parts, the lower half was getting
sign-extended into the top half. Be more explicit about what we want to
do.

Fixes gbm_bo_get_modifier() returning ((1 << 64) - 1) rather than
((1 << 56) - 1), i.e. DRM_FORMAT_MOD_INVALID.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
src/gbm/backends/dri/gbm_dri.c

index 71590d71103696efcaaa23ecdc051ae2bad5cc79..8cca35e0e06cbbda54066a0e8d5d5aad54e8491f 100644 (file)
@@ -772,7 +772,7 @@ gbm_dri_bo_get_modifier(struct gbm_bo *_bo)
                                &mod))
       return DRM_FORMAT_MOD_INVALID;
 
-   ret |= mod;
+   ret |= (uint64_t)(mod & 0xffffffff);
 
    return ret;
 }