const struct wl_drm_components_descriptor *f;
__DRIimage *dri_image;
_EGLImageAttribs attrs;
- EGLint err;
int32_t plane;
buffer = wayland_drm_buffer_get(dri2_dpy->wl_server_drm,
if (!buffer)
return NULL;
- err = _eglParseImageAttribList(&attrs, disp, attr_list);
- plane = attrs.PlaneWL;
- if (err != EGL_SUCCESS) {
- _eglError(EGL_BAD_PARAMETER, "dri2_create_image_wayland_wl_buffer");
+ if (!_eglParseImageAttribList(&attrs, disp, attr_list))
return NULL;
- }
+ plane = attrs.PlaneWL;
f = buffer->driver_format;
if (plane < 0 || plane >= f->nplanes) {
_eglError(EGL_BAD_PARAMETER,
return EGL_NO_IMAGE_KHR;
}
- if (_eglParseImageAttribList(&attrs, disp, attr_list) != EGL_SUCCESS)
+ if (!_eglParseImageAttribList(&attrs, disp, attr_list))
return EGL_NO_IMAGE_KHR;
switch (target) {
name = (EGLint) (uintptr_t) buffer;
- err = _eglParseImageAttribList(&attrs, disp, attr_list);
- if (err != EGL_SUCCESS)
+ if (!_eglParseImageAttribList(&attrs, disp, attr_list))
return NULL;
if (attrs.Width <= 0 || attrs.Height <= 0 ||
{
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
_EGLImage *res;
- EGLint err;
_EGLImageAttribs attrs;
__DRIimage *dri_image;
unsigned num_fds;
return NULL;
}
- err = _eglParseImageAttribList(&attrs, disp, attr_list);
- if (err != EGL_SUCCESS) {
- _eglError(err, "bad attribute");
+ if (!_eglParseImageAttribList(&attrs, disp, attr_list))
return NULL;
- }
if (!dri2_check_dma_buf_attribs(&attrs))
return NULL;
_EGLImageAttribs attrs;
unsigned int dri_use, valid_mask;
int format;
- EGLint err = EGL_SUCCESS;
(void) drv;
return EGL_NO_IMAGE_KHR;
}
- err = _eglParseImageAttribList(&attrs, disp, attr_list);
- if (err != EGL_SUCCESS) {
- _eglError(EGL_BAD_PARAMETER, __func__);
+ if (!_eglParseImageAttribList(&attrs, disp, attr_list))
return EGL_NO_IMAGE_KHR;
- }
if (attrs.Width <= 0 || attrs.Height <= 0) {
_eglError(EGL_BAD_PARAMETER, __func__);
#include <assert.h>
#include <string.h>
+#include "eglcurrent.h"
#include "eglimage.h"
#include "egllog.h"
/**
- * Parse the list of image attributes and return the proper error code.
+ * Parse the list of image attributes.
+ *
+ * Returns EGL_TRUE on success and EGL_FALSE otherwise.
+ * Function calls _eglError to set the correct error code.
*/
-EGLint
+EGLBoolean
_eglParseImageAttribList(_EGLImageAttribs *attrs, _EGLDisplay *dpy,
const EGLint *attrib_list)
{
memset(attrs, 0, sizeof(*attrs));
if (!attrib_list)
- return err;
+ return EGL_TRUE;
for (i = 0; attrib_list[i] != EGL_NONE; i++) {
EGLint attr = attrib_list[i++];
break;
default:
- /* unknown attrs are ignored */
- break;
+ return _eglError(EGL_BAD_ATTRIBUTE, __func__);
}
- if (err != EGL_SUCCESS) {
- _eglLog(_EGL_DEBUG, "bad image attribute 0x%04x", attr);
- break;
- }
+ if (err != EGL_SUCCESS)
+ return _eglError(err, __func__);
}
- return err;
+ return EGL_TRUE;
}