Commit 9db4fd1a authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧
Browse files

DmaBufTexture: The modifier is a global dmabuf attribute

We don't get one per plane, but one per allocation.
parent 51bfadab
Pipeline #184472 passed with stage
in 12 minutes and 7 seconds
......@@ -282,10 +282,10 @@ EGLImageKHR EglGbmBackend::importDmaBufAsImage(const DmaBufAttributes &dmabuf)
<< EGL_DMA_BUF_PLANE0_FD_EXT << dmabuf.fd[0]
<< EGL_DMA_BUF_PLANE0_OFFSET_EXT << dmabuf.offset[0]
<< EGL_DMA_BUF_PLANE0_PITCH_EXT << dmabuf.pitch[0];
if (dmabuf.modifier[0] != DRM_FORMAT_MOD_INVALID) {
if (dmabuf.modifier != DRM_FORMAT_MOD_INVALID) {
attribs
<< EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT << EGLint(dmabuf.modifier[0] & 0xffffffff)
<< EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT << EGLint(dmabuf.modifier[0] >> 32);
<< EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT << EGLint(dmabuf.modifier & 0xffffffff)
<< EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT << EGLint(dmabuf.modifier >> 32);
}
if (dmabuf.planeCount > 1) {
......@@ -293,10 +293,10 @@ EGLImageKHR EglGbmBackend::importDmaBufAsImage(const DmaBufAttributes &dmabuf)
<< EGL_DMA_BUF_PLANE1_FD_EXT << dmabuf.fd[1]
<< EGL_DMA_BUF_PLANE1_OFFSET_EXT << dmabuf.offset[1]
<< EGL_DMA_BUF_PLANE1_PITCH_EXT << dmabuf.pitch[1];
if (dmabuf.modifier[1] != DRM_FORMAT_MOD_INVALID) {
if (dmabuf.modifier != DRM_FORMAT_MOD_INVALID) {
attribs
<< EGL_DMA_BUF_PLANE1_MODIFIER_LO_EXT << EGLint(dmabuf.modifier[1] & 0xffffffff)
<< EGL_DMA_BUF_PLANE1_MODIFIER_HI_EXT << EGLint(dmabuf.modifier[1] >> 32);
<< EGL_DMA_BUF_PLANE1_MODIFIER_LO_EXT << EGLint(dmabuf.modifier & 0xffffffff)
<< EGL_DMA_BUF_PLANE1_MODIFIER_HI_EXT << EGLint(dmabuf.modifier >> 32);
}
}
......@@ -305,10 +305,10 @@ EGLImageKHR EglGbmBackend::importDmaBufAsImage(const DmaBufAttributes &dmabuf)
<< EGL_DMA_BUF_PLANE2_FD_EXT << dmabuf.fd[2]
<< EGL_DMA_BUF_PLANE2_OFFSET_EXT << dmabuf.offset[2]
<< EGL_DMA_BUF_PLANE2_PITCH_EXT << dmabuf.pitch[2];
if (dmabuf.modifier[2] != DRM_FORMAT_MOD_INVALID) {
if (dmabuf.modifier != DRM_FORMAT_MOD_INVALID) {
attribs
<< EGL_DMA_BUF_PLANE2_MODIFIER_LO_EXT << EGLint(dmabuf.modifier[2] & 0xffffffff)
<< EGL_DMA_BUF_PLANE2_MODIFIER_HI_EXT << EGLint(dmabuf.modifier[2] >> 32);
<< EGL_DMA_BUF_PLANE2_MODIFIER_LO_EXT << EGLint(dmabuf.modifier & 0xffffffff)
<< EGL_DMA_BUF_PLANE2_MODIFIER_HI_EXT << EGLint(dmabuf.modifier >> 32);
}
}
......@@ -317,10 +317,10 @@ EGLImageKHR EglGbmBackend::importDmaBufAsImage(const DmaBufAttributes &dmabuf)
<< EGL_DMA_BUF_PLANE3_FD_EXT << dmabuf.fd[3]
<< EGL_DMA_BUF_PLANE3_OFFSET_EXT << dmabuf.offset[3]
<< EGL_DMA_BUF_PLANE3_PITCH_EXT << dmabuf.pitch[3];
if (dmabuf.modifier[3] != DRM_FORMAT_MOD_INVALID) {
if (dmabuf.modifier != DRM_FORMAT_MOD_INVALID) {
attribs
<< EGL_DMA_BUF_PLANE3_MODIFIER_LO_EXT << EGLint(dmabuf.modifier[3] & 0xffffffff)
<< EGL_DMA_BUF_PLANE3_MODIFIER_HI_EXT << EGLint(dmabuf.modifier[3] >> 32);
<< EGL_DMA_BUF_PLANE3_MODIFIER_LO_EXT << EGLint(dmabuf.modifier & 0xffffffff)
<< EGL_DMA_BUF_PLANE3_MODIFIER_HI_EXT << EGLint(dmabuf.modifier >> 32);
}
}
......
......@@ -21,13 +21,13 @@ inline DmaBufAttributes dmaBufAttributesForBo(gbm_bo *bo)
attributes.width = gbm_bo_get_width(bo);
attributes.height = gbm_bo_get_height(bo);
attributes.format = gbm_bo_get_format(bo);
attributes.modifier = gbm_bo_get_modifier(bo);
#if HAVE_GBM_BO_GET_FD_FOR_PLANE
for (int i = 0; i < attributes.planeCount; ++i) {
attributes.fd[i] = gbm_bo_get_fd_for_plane(bo, i);
attributes.offset[i] = gbm_bo_get_offset(bo, i);
attributes.pitch[i] = gbm_bo_get_stride_for_plane(bo, i);
attributes.modifier[i] = gbm_bo_get_modifier(bo);
}
#else
if (attributes.planeCount > 1) {
......@@ -37,7 +37,6 @@ inline DmaBufAttributes dmaBufAttributesForBo(gbm_bo *bo)
attributes.fd[0] = gbm_bo_get_fd(bo);
attributes.offset[0] = gbm_bo_get_offset(bo, 0);
attributes.pitch[0] = gbm_bo_get_stride_for_plane(bo, 0);
attributes.modifier[0] = gbm_bo_get_modifier(bo);
#endif
return attributes;
......
......@@ -21,11 +21,11 @@ struct DmaBufAttributes
int width;
int height;
int format;
uint64_t modifier;
int fd[4];
int offset[4];
int pitch[4];
uint64_t modifier[4];
};
class KWIN_EXPORT DmaBufTexture
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment