[PATCH weston 5/7] weston-egl-ext.h: add GL_EXT_unpack_subimage definitions

Emil Velikov emil.l.velikov at gmail.com
Mon Jul 4 14:27:17 UTC 2016


From: Emil Velikov <emil.velikov at collabora.com>

... and use it in gl-renderer.

Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
---
 libweston/gl-renderer.c    | 9 ---------
 libweston/weston-egl-ext.h | 7 +++++++
 2 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/libweston/gl-renderer.c b/libweston/gl-renderer.c
index 64ef628..1546453 100644
--- a/libweston/gl-renderer.c
+++ b/libweston/gl-renderer.c
@@ -869,11 +869,9 @@ draw_output_border_texture(struct gl_output_state *go,
 	}
 
 	if (go->border_status & (1 << side)) {
-#ifdef GL_EXT_unpack_subimage
 		glPixelStorei(GL_UNPACK_ROW_LENGTH_EXT, 0);
 		glPixelStorei(GL_UNPACK_SKIP_PIXELS_EXT, 0);
 		glPixelStorei(GL_UNPACK_SKIP_ROWS_EXT, 0);
-#endif
 		glTexImage2D(GL_TEXTURE_2D, 0, GL_BGRA_EXT,
 			     img->tex_width, img->height, 0,
 			     GL_BGRA_EXT, GL_UNSIGNED_BYTE, img->data);
@@ -1226,12 +1224,9 @@ gl_renderer_flush_damage(struct weston_surface *surface)
 	struct weston_buffer *buffer = gs->buffer_ref.buffer;
 	struct weston_view *view;
 	bool texture_used;
-
-#ifdef GL_EXT_unpack_subimage
 	pixman_box32_t *rectangles;
 	void *data;
 	int i, n;
-#endif
 
 	pixman_region32_union(&gs->texture_damage,
 			      &gs->texture_damage, &surface->damage);
@@ -1271,7 +1266,6 @@ gl_renderer_flush_damage(struct weston_surface *surface)
 		goto done;
 	}
 
-#ifdef GL_EXT_unpack_subimage
 	glPixelStorei(GL_UNPACK_ROW_LENGTH_EXT, gs->pitch);
 	data = wl_shm_buffer_get_data(buffer->shm_buffer);
 
@@ -1300,7 +1294,6 @@ gl_renderer_flush_damage(struct weston_surface *surface)
 				gs->gl_format, gs->gl_pixel_type, data);
 	}
 	wl_shm_buffer_end_access(buffer->shm_buffer);
-#endif
 
 done:
 	pixman_region32_fini(&gs->texture_damage);
@@ -3152,10 +3145,8 @@ gl_renderer_setup(struct weston_compositor *ec, EGLSurface egl_surface)
 	else
 		ec->read_format = PIXMAN_a8b8g8r8;
 
-#ifdef GL_EXT_unpack_subimage
 	if (check_extension(extensions, "GL_EXT_unpack_subimage"))
 		gr->has_unpack_subimage = 1;
-#endif
 
 	if (check_extension(extensions, "GL_OES_EGL_image_external"))
 		gr->has_egl_image_external = 1;
diff --git a/libweston/weston-egl-ext.h b/libweston/weston-egl-ext.h
index d79356b..c0dbe32 100644
--- a/libweston/weston-egl-ext.h
+++ b/libweston/weston-egl-ext.h
@@ -80,6 +80,13 @@ typedef struct wl_buffer * (EGLAPIENTRYP PFNEGLCREATEWAYLANDBUFFERFROMIMAGEWL) (
 #define EGL_WAYLAND_Y_INVERTED_WL		0x31DB /* eglQueryWaylandBufferWL attribute */
 #endif
 
+#ifndef GL_EXT_unpack_subimage
+#define GL_EXT_unpack_subimage 1
+#define GL_UNPACK_ROW_LENGTH_EXT          0x0CF2
+#define GL_UNPACK_SKIP_ROWS_EXT           0x0CF3
+#define GL_UNPACK_SKIP_PIXELS_EXT         0x0CF4
+#endif /* GL_EXT_unpack_subimage */
+
 /* Mesas gl2ext.h and probably Khronos upstream defined
  * GL_EXT_unpack_subimage with non _EXT suffixed GL_UNPACK_* tokens.
  * In case we're using that mess, manually define the _EXT versions
-- 
2.8.2



More information about the wayland-devel mailing list