}
static _EGLImage *
-dri2_create_image_android_native_buffer(_EGLDisplay *disp,
+dri2_create_image_android_native_buffer(_EGLDisplay *disp, _EGLContext *ctx,
struct ANativeWindowBuffer *buf)
{
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
int name;
EGLint format;
+ if (ctx != NULL) {
+ /* From the EGL_ANDROID_image_native_buffer spec:
+ *
+ * * If <target> is EGL_NATIVE_BUFFER_ANDROID and <ctx> is not
+ * EGL_NO_CONTEXT, the error EGL_BAD_CONTEXT is generated.
+ */
+ _eglError(EGL_BAD_CONTEXT, "eglCreateEGLImageKHR: for "
+ "EGL_NATIVE_BUFFER_ANDROID, the context must be "
+ "EGL_NO_CONTEXT");
+ return NULL;
+ }
+
if (!buf || buf->common.magic != ANDROID_NATIVE_BUFFER_MAGIC ||
buf->common.version != sizeof(*buf)) {
_eglError(EGL_BAD_PARAMETER, "eglCreateEGLImageKHR");
{
switch (target) {
case EGL_NATIVE_BUFFER_ANDROID:
- return dri2_create_image_android_native_buffer(disp,
+ return dri2_create_image_android_native_buffer(disp, ctx,
(struct ANativeWindowBuffer *) buffer);
default:
return dri2_create_image_khr(drv, disp, ctx, target, buffer, attr_list);