[client] egl: select the correct fourcc type for dma mode

This commit is contained in:
Geoffrey McRae 2020-10-30 11:55:47 +11:00
parent 6799d518a5
commit 267fa6e389

View file

@ -66,6 +66,7 @@ struct EGL_Texture
GLenum intFormat; GLenum intFormat;
GLenum format; GLenum format;
GLenum dataType; GLenum dataType;
unsigned int fourcc;
size_t pboBufferSize; size_t pboBufferSize;
struct TexState state; struct TexState state;
@ -198,6 +199,7 @@ bool egl_texture_setup(EGL_Texture * texture, enum EGL_PixelFormat pixFmt, size_
texture->offsets[0] = 0; texture->offsets[0] = 0;
texture->intFormat = GL_BGRA; texture->intFormat = GL_BGRA;
texture->dataType = GL_UNSIGNED_BYTE; texture->dataType = GL_UNSIGNED_BYTE;
texture->fourcc = DRM_FORMAT_ARGB8888;
texture->pboBufferSize = height * stride; texture->pboBufferSize = height * stride;
break; break;
@ -211,6 +213,7 @@ bool egl_texture_setup(EGL_Texture * texture, enum EGL_PixelFormat pixFmt, size_
texture->offsets[0] = 0; texture->offsets[0] = 0;
texture->intFormat = GL_BGRA; texture->intFormat = GL_BGRA;
texture->dataType = GL_UNSIGNED_BYTE; texture->dataType = GL_UNSIGNED_BYTE;
texture->fourcc = DRM_FORMAT_ABGR8888;
texture->pboBufferSize = height * stride; texture->pboBufferSize = height * stride;
break; break;
@ -224,6 +227,7 @@ bool egl_texture_setup(EGL_Texture * texture, enum EGL_PixelFormat pixFmt, size_
texture->offsets[0] = 0; texture->offsets[0] = 0;
texture->intFormat = GL_RGB10_A2; texture->intFormat = GL_RGB10_A2;
texture->dataType = GL_UNSIGNED_INT_2_10_10_10_REV; texture->dataType = GL_UNSIGNED_INT_2_10_10_10_REV;
texture->fourcc = DRM_FORMAT_BGRA1010102;
texture->pboBufferSize = height * stride; texture->pboBufferSize = height * stride;
break; break;
@ -237,6 +241,7 @@ bool egl_texture_setup(EGL_Texture * texture, enum EGL_PixelFormat pixFmt, size_
texture->offsets[0] = 0; texture->offsets[0] = 0;
texture->intFormat = GL_RGBA16F; texture->intFormat = GL_RGBA16F;
texture->dataType = GL_HALF_FLOAT; texture->dataType = GL_HALF_FLOAT;
texture->fourcc = DRM_FORMAT_ABGR16161616F;
texture->pboBufferSize = height * stride; texture->pboBufferSize = height * stride;
break; break;
@ -257,6 +262,7 @@ bool egl_texture_setup(EGL_Texture * texture, enum EGL_PixelFormat pixFmt, size_
texture->offsets[1] = stride * height; texture->offsets[1] = stride * height;
texture->offsets[2] = texture->offsets[1] + (texture->offsets[1] / 4); texture->offsets[2] = texture->offsets[1] + (texture->offsets[1] / 4);
texture->dataType = GL_UNSIGNED_BYTE; texture->dataType = GL_UNSIGNED_BYTE;
texture->fourcc = DRM_FORMAT_YUV420_8BIT;
texture->pboBufferSize = texture->offsets[2] + (texture->offsets[1] / 4); texture->pboBufferSize = texture->offsets[2] + (texture->offsets[1] / 4);
break; break;
@ -421,7 +427,7 @@ bool egl_texture_update_from_dma(EGL_Texture * texture, const FrameBuffer * fram
{ {
EGL_WIDTH , texture->width, EGL_WIDTH , texture->width,
EGL_HEIGHT , texture->height, EGL_HEIGHT , texture->height,
EGL_LINUX_DRM_FOURCC_EXT , DRM_FORMAT_ARGB8888, EGL_LINUX_DRM_FOURCC_EXT , texture->fourcc,
EGL_DMA_BUF_PLANE0_FD_EXT , dmaFd, EGL_DMA_BUF_PLANE0_FD_EXT , dmaFd,
EGL_DMA_BUF_PLANE0_OFFSET_EXT, 0, EGL_DMA_BUF_PLANE0_OFFSET_EXT, 0,
EGL_DMA_BUF_PLANE0_PITCH_EXT , texture->stride, EGL_DMA_BUF_PLANE0_PITCH_EXT , texture->stride,