Can't create KHR image if the depth is uncompatible.
Currently, KHR image only support one color format ARGB32. For all other format, we have to fail to create corresponding image and texture here. Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
This commit is contained in:
parent
b5630663cf
commit
d135e879a6
|
@ -108,7 +108,7 @@ glamor_egl_get_screen_private(ScrnInfoPtr scrn)
|
||||||
|
|
||||||
static EGLImageKHR
|
static EGLImageKHR
|
||||||
_glamor_egl_create_image(struct glamor_egl_screen_private *glamor_egl,
|
_glamor_egl_create_image(struct glamor_egl_screen_private *glamor_egl,
|
||||||
int width, int height, int stride, int name)
|
int width, int height, int stride, int name, int depth)
|
||||||
{
|
{
|
||||||
EGLImageKHR image;
|
EGLImageKHR image;
|
||||||
EGLint attribs[] = {
|
EGLint attribs[] = {
|
||||||
|
@ -126,7 +126,9 @@ _glamor_egl_create_image(struct glamor_egl_screen_private *glamor_egl,
|
||||||
|
|
||||||
attribs[1] = width;
|
attribs[1] = width;
|
||||||
attribs[3] = height;
|
attribs[3] = height;
|
||||||
attribs[5] = stride / 4;
|
attribs[5] = stride;
|
||||||
|
if (depth != 32)
|
||||||
|
return EGL_NO_IMAGE_KHR;
|
||||||
image = glamor_egl->egl_create_image_khr(glamor_egl->display,
|
image = glamor_egl->egl_create_image_khr(glamor_egl->display,
|
||||||
glamor_egl->context,
|
glamor_egl->context,
|
||||||
EGL_DRM_BUFFER_MESA,
|
EGL_DRM_BUFFER_MESA,
|
||||||
|
@ -165,6 +167,7 @@ glamor_create_texture_from_image(struct glamor_egl_screen_private
|
||||||
|
|
||||||
(glamor_egl->egl_image_target_texture2d_oes) (GL_TEXTURE_2D,
|
(glamor_egl->egl_image_target_texture2d_oes) (GL_TEXTURE_2D,
|
||||||
image);
|
image);
|
||||||
|
glamor_egl->dispatch->glBindTexture(GL_TEXTURE_2D, 0);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,8 +196,8 @@ glamor_egl_create_textured_screen(ScreenPtr screen, int handle, int stride)
|
||||||
image = _glamor_egl_create_image(glamor_egl,
|
image = _glamor_egl_create_image(glamor_egl,
|
||||||
scrn->virtualX,
|
scrn->virtualX,
|
||||||
scrn->virtualY,
|
scrn->virtualY,
|
||||||
stride,
|
stride / 4,
|
||||||
glamor_egl->front_buffer_handle);
|
glamor_egl->front_buffer_handle, 32);
|
||||||
if (image == EGL_NO_IMAGE_KHR)
|
if (image == EGL_NO_IMAGE_KHR)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
@ -208,8 +211,6 @@ glamor_egl_create_textured_screen(ScreenPtr screen, int handle, int stride)
|
||||||
/*
|
/*
|
||||||
* This function will be called from the dri buffer allocation.
|
* This function will be called from the dri buffer allocation.
|
||||||
* It is somehow very familiar with the create textured screen.
|
* It is somehow very familiar with the create textured screen.
|
||||||
* XXX the egl image here is not stored at any data structure.
|
|
||||||
* Does this cause a leak problem?
|
|
||||||
*/
|
*/
|
||||||
Bool
|
Bool
|
||||||
glamor_egl_create_textured_pixmap(PixmapPtr pixmap, int handle, int stride)
|
glamor_egl_create_textured_pixmap(PixmapPtr pixmap, int handle, int stride)
|
||||||
|
@ -221,19 +222,20 @@ glamor_egl_create_textured_pixmap(PixmapPtr pixmap, int handle, int stride)
|
||||||
EGLImageKHR image;
|
EGLImageKHR image;
|
||||||
GLuint texture;
|
GLuint texture;
|
||||||
int name;
|
int name;
|
||||||
|
|
||||||
if (!glamor_get_flink_name(glamor_egl->fd, handle, &name)) {
|
if (!glamor_get_flink_name(glamor_egl->fd, handle, &name)) {
|
||||||
xf86DrvMsg(scrn->scrnIndex, X_ERROR,
|
xf86DrvMsg(scrn->scrnIndex, X_ERROR,
|
||||||
"Couldn't flink pixmap handle\n");
|
"Couldn't flink pixmap handle\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
image = _glamor_egl_create_image(glamor_egl,
|
image = _glamor_egl_create_image(glamor_egl,
|
||||||
pixmap->drawable.width,
|
pixmap->drawable.width,
|
||||||
pixmap->drawable.height, stride,
|
pixmap->drawable.height,
|
||||||
name);
|
((stride * 8 + 7) / pixmap->drawable.bitsPerPixel),
|
||||||
|
name,
|
||||||
|
pixmap->drawable.depth);
|
||||||
if (image == EGL_NO_IMAGE_KHR) {
|
if (image == EGL_NO_IMAGE_KHR) {
|
||||||
ErrorF("Failed to create khr image for bo handle %d.\n", handle);
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user