From e23bfdb3298ec43ef895121527fb4d79474d7b1b Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Thu, 19 Jul 2012 08:54:05 -0400 Subject: wayland: Use existing EGL_TEXTURE_FORMAT for querying wl_buffer texture format MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We also reuse EGL_TEXTURE_RGBA and EGL_TEXTURE_RGB, adding only the new planar YUV texture formats: EGL_TEXTURE_Y_U_V_WL, EGL_TEXTURE_Y_UV_WL and EGL_TEXTURE_Y_XUXV_WL. Signed-off-by: Kristian Høgsberg --- src/egl/drivers/dri2/egl_dri2.c | 22 +++++++++++----------- .../state_trackers/egl/common/egl_g3d_api.c | 6 +++--- 2 files changed, 14 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index fcb226443b3..8d82c19d72f 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -1071,42 +1071,42 @@ static const struct wl_drm_format_descriptor { int cpp; } planes[3]; } wl_drm_formats[] = { - { WL_DRM_FORMAT_ARGB8888, EGL_WAYLAND_BUFFER_RGBA_WL, 1, + { WL_DRM_FORMAT_ARGB8888, EGL_TEXTURE_RGBA, 1, { { 0, 0, 0, __DRI_IMAGE_FORMAT_ARGB8888, 4 }, } }, - { WL_DRM_FORMAT_XRGB8888, EGL_WAYLAND_BUFFER_RGB_WL, 1, + { WL_DRM_FORMAT_XRGB8888, EGL_TEXTURE_RGB, 1, { { 0, 0, 0, __DRI_IMAGE_FORMAT_XRGB8888, 4 }, } }, - { WL_DRM_FORMAT_YUV410, EGL_WAYLAND_BUFFER_Y_U_V_WL, 3, + { WL_DRM_FORMAT_YUV410, EGL_TEXTURE_Y_U_V_WL, 3, { { 0, 0, 0, __DRI_IMAGE_FORMAT_R8, 1 }, { 1, 2, 2, __DRI_IMAGE_FORMAT_R8, 1 }, { 2, 2, 2, __DRI_IMAGE_FORMAT_R8, 1 } } }, - { WL_DRM_FORMAT_YUV411, EGL_WAYLAND_BUFFER_Y_U_V_WL, 3, + { WL_DRM_FORMAT_YUV411, EGL_TEXTURE_Y_U_V_WL, 3, { { 0, 0, 0, __DRI_IMAGE_FORMAT_R8, 1 }, { 1, 2, 0, __DRI_IMAGE_FORMAT_R8, 1 }, { 2, 2, 0, __DRI_IMAGE_FORMAT_R8, 1 } } }, - { WL_DRM_FORMAT_YUV420, EGL_WAYLAND_BUFFER_Y_U_V_WL, 3, + { WL_DRM_FORMAT_YUV420, EGL_TEXTURE_Y_U_V_WL, 3, { { 0, 0, 0, __DRI_IMAGE_FORMAT_R8, 1 }, { 1, 1, 1, __DRI_IMAGE_FORMAT_R8, 1 }, { 2, 1, 1, __DRI_IMAGE_FORMAT_R8, 1 } } }, - { WL_DRM_FORMAT_YUV422, EGL_WAYLAND_BUFFER_Y_U_V_WL, 3, + { WL_DRM_FORMAT_YUV422, EGL_TEXTURE_Y_U_V_WL, 3, { { 0, 0, 0, __DRI_IMAGE_FORMAT_R8, 1 }, { 1, 1, 0, __DRI_IMAGE_FORMAT_R8, 1 }, { 2, 1, 0, __DRI_IMAGE_FORMAT_R8, 1 } } }, - { WL_DRM_FORMAT_YUV444, EGL_WAYLAND_BUFFER_Y_U_V_WL, 3, + { WL_DRM_FORMAT_YUV444, EGL_TEXTURE_Y_U_V_WL, 3, { { 0, 0, 0, __DRI_IMAGE_FORMAT_R8, 1 }, { 1, 0, 0, __DRI_IMAGE_FORMAT_R8, 1 }, { 2, 0, 0, __DRI_IMAGE_FORMAT_R8, 1 } } }, - { WL_DRM_FORMAT_NV12, EGL_WAYLAND_BUFFER_Y_UV_WL, 2, + { WL_DRM_FORMAT_NV12, EGL_TEXTURE_Y_UV_WL, 2, { { 0, 0, 0, __DRI_IMAGE_FORMAT_R8, 1 }, { 1, 1, 1, __DRI_IMAGE_FORMAT_GR88, 2 } } }, - { WL_DRM_FORMAT_NV16, EGL_WAYLAND_BUFFER_Y_UV_WL, 2, + { WL_DRM_FORMAT_NV16, EGL_TEXTURE_Y_UV_WL, 2, { { 0, 0, 0, __DRI_IMAGE_FORMAT_R8, 1 }, { 1, 1, 0, __DRI_IMAGE_FORMAT_GR88, 2 } } }, @@ -1118,7 +1118,7 @@ static const struct wl_drm_format_descriptor { * texture sampler interpolate the Y components correctly when * sampling from plane 0, and interpolate U and V correctly when * sampling from plane 1. */ - { WL_DRM_FORMAT_YUYV, EGL_WAYLAND_BUFFER_Y_XUXV_WL, 2, + { WL_DRM_FORMAT_YUYV, EGL_TEXTURE_Y_XUXV_WL, 2, { { 0, 0, 0, __DRI_IMAGE_FORMAT_GR88, 2 }, { 0, 1, 0, __DRI_IMAGE_FORMAT_ARGB8888, 4 } } } }; @@ -1414,7 +1414,7 @@ dri2_query_wayland_buffer_wl(_EGLDriver *drv, _EGLDisplay *disp, return EGL_FALSE; format = buffer->driver_format; - if (attribute == EGL_WAYLAND_BUFFER_COMPONENTS_WL) { + if (attribute == EGL_TEXTURE_FORMAT) { *value = format->components; return EGL_TRUE; } diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_api.c b/src/gallium/state_trackers/egl/common/egl_g3d_api.c index f2e86de3147..b3941f2467b 100644 --- a/src/gallium/state_trackers/egl/common/egl_g3d_api.c +++ b/src/gallium/state_trackers/egl/common/egl_g3d_api.c @@ -888,13 +888,13 @@ egl_g3d_query_wayland_buffer_wl(_EGLDriver *drv, _EGLDisplay *dpy, if (!wayland_buffer_is_drm(&buffer->buffer)) return EGL_FALSE; - if (attribute == EGL_WAYLAND_BUFFER_COMPONENTS_WL) { + if (attribute == EGL_TEXTURE_FORMAT) { switch (resource->format) { case PIPE_FORMAT_B8G8R8A8_UNORM: - *value = EGL_WAYLAND_BUFFER_RGBA_WL; + *value = EGL_TEXTURE_RGBA; return EGL_TRUE; case PIPE_FORMAT_B8G8R8X8_UNORM: - *value = EGL_WAYLAND_BUFFER_RGB_WL; + *value = EGL_TEXTURE_RGB; return EGL_TRUE; default: return EGL_FALSE; -- cgit v1.2.3