egl/dri2: Avoid sign extension when building modifier

Since the EGL attributes are signed integers, a straight OR would
also perform sign extension,

Fixes: 6f10e7c37a ("egl/dri2: Create EGLImages with dmabuf modifiers")
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
This commit is contained in:
Daniel Stone
2017-06-05 14:30:02 +01:00
parent 142536a0e3
commit 11e549ae3f
+2 -3
View File
@@ -2278,9 +2278,8 @@ dri2_create_image_dma_buf(_EGLDisplay *disp, _EGLContext *ctx,
* will be present in attrs.DMABufPlaneModifiersLo[0] and
* attrs.DMABufPlaneModifiersHi[0] */
if (attrs.DMABufPlaneModifiersLo[0].IsPresent) {
modifier =
((uint64_t) attrs.DMABufPlaneModifiersHi[0].Value << 32) |
attrs.DMABufPlaneModifiersLo[0].Value;
modifier = (uint64_t) attrs.DMABufPlaneModifiersHi[0].Value << 32;
modifier |= (uint64_t) (attrs.DMABufPlaneModifiersLo[0].Value & 0xffffffff);
has_modifier = true;
} else {
modifier = DRM_FORMAT_MOD_INVALID;