Mesa (master): wayland: Support EGL_WIDTH and EGL_HEIGHT queries for wl_buffer
Kristian Høgsberg
krh at kemper.freedesktop.org
Thu Jul 19 18:18:36 UTC 2012
Module: Mesa
Branch: master
Commit: d7522ed13052a3d30bc4faedce04685263f57933
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d7522ed13052a3d30bc4faedce04685263f57933
Author: Kristian Høgsberg <krh at bitplanet.net>
Date: Thu Jul 19 09:02:25 2012 -0400
wayland: Support EGL_WIDTH and EGL_HEIGHT queries for wl_buffer
We're going to make the public wl_buffer struct as small as possible.
Signed-off-by: Kristian Høgsberg <krh at bitplanet.net>
---
docs/WL_bind_wayland_display.spec | 6 +++++-
src/egl/drivers/dri2/egl_dri2.c | 9 ++++++++-
.../state_trackers/egl/common/egl_g3d_api.c | 13 ++++++++++---
3 files changed, 23 insertions(+), 5 deletions(-)
diff --git a/docs/WL_bind_wayland_display.spec b/docs/WL_bind_wayland_display.spec
index eca6acd..02bd6ea 100644
--- a/docs/WL_bind_wayland_display.spec
+++ b/docs/WL_bind_wayland_display.spec
@@ -154,6 +154,9 @@ Additions to the EGL 1.4 Specification:
from a wl_buffer in any way (such as glTexImage2D, binding the
EGLImage as a renderbuffer etc) will result in undefined behavior.
+ Further, eglQueryWaylandBufferWL accepts attributes EGL_WIDTH and
+ EGL_HEIGHT to query the width and height of the wl_buffer.
+
Issues
Revision History
@@ -168,4 +171,5 @@ Revision History
formats. (Kristian Høgsberg)
Version 4, July 19, 2012
Use EGL_TEXTURE_FORMAT, EGL_TEXTURE_RGB, and EGL_TEXTURE_RGBA,
- and just define the new YUV texture formats. (Kristian Høgsberg)
+ and just define the new YUV texture formats. Add support for
+ EGL_WIDTH and EGL_HEIGHT in the query attributes (Kristian Høgsberg)
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 8d82c19..f86ed0b 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -1414,9 +1414,16 @@ dri2_query_wayland_buffer_wl(_EGLDriver *drv, _EGLDisplay *disp,
return EGL_FALSE;
format = buffer->driver_format;
- if (attribute == EGL_TEXTURE_FORMAT) {
+ switch (attribute) {
+ case EGL_TEXTURE_FORMAT:
*value = format->components;
return EGL_TRUE;
+ case EGL_WIDTH:
+ *value = buffer->buffer.width;
+ break;
+ case EGL_HEIGHT:
+ *value = buffer->buffer.height;
+ break;
}
return EGL_FALSE;
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 b3941f2..a73859c 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d_api.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d_api.c
@@ -888,7 +888,8 @@ egl_g3d_query_wayland_buffer_wl(_EGLDriver *drv, _EGLDisplay *dpy,
if (!wayland_buffer_is_drm(&buffer->buffer))
return EGL_FALSE;
- if (attribute == EGL_TEXTURE_FORMAT) {
+ switch (attribute) {
+ case EGL_TEXTURE_FORMAT:
switch (resource->format) {
case PIPE_FORMAT_B8G8R8A8_UNORM:
*value = EGL_TEXTURE_RGBA;
@@ -899,9 +900,15 @@ egl_g3d_query_wayland_buffer_wl(_EGLDriver *drv, _EGLDisplay *dpy,
default:
return EGL_FALSE;
}
+ case EGL_WIDTH:
+ *value = buffer->buffer.width;
+ return EGL_TRUE;
+ case EGL_HEIGHT:
+ *value = buffer->buffer.height;
+ return EGL_TRUE;
+ default:
+ return EGL_FALSE;
}
-
- return EGL_FALSE;
}
#endif /* EGL_WL_bind_wayland_display */
More information about the mesa-commit
mailing list