summaryrefslogtreecommitdiff
path: root/glamor/glamor.c
diff options
context:
space:
mode:
authorZhigang Gong <zhigang.gong@intel.com>2014-04-23 18:54:43 +0900
committerEric Anholt <eric@anholt.net>2014-04-23 10:41:19 -0700
commita4d96afdbddb7a636df8e336059d3a5624f2e6ae (patch)
tree1684cb2061ef3f4a1039d567e7510614ca53b93d /glamor/glamor.c
parent21e0e373858bd7f3458172ebd465397e33b90162 (diff)
glamor: Fallback to system memory when fail to allocate one big fbo.
Even when create a pixmap which smaller than the max_fbo_size, it may fail due to some low level driver limitation. If that is the case, we don't need to crash the xserver. We just need to fallback to system memory. See the related bug at: https://bugs.freedesktop.org/show_bug.cgi?id=71190 Signed-off-by: Zhigang Gong <zhigang.gong@intel.com> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com> Tested-by: Kai Wasserbach <kai@dev.carbon-project.org> Tested-by: Erich Seifert <eseifert@error-reports.org> Signed-off-by: Michel Dänzer <michel.daenzer@amd.com> Signed-off-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'glamor/glamor.c')
-rw-r--r--glamor/glamor.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/glamor/glamor.c b/glamor/glamor.c
index 994e92358..08f6ba174 100644
--- a/glamor/glamor.c
+++ b/glamor/glamor.c
@@ -146,7 +146,7 @@ glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
glamor_pixmap_type_t type = GLAMOR_TEXTURE_ONLY;
glamor_pixmap_private *pixmap_priv;
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
- glamor_pixmap_fbo *fbo;
+ glamor_pixmap_fbo *fbo = NULL;
int pitch;
GLenum format;
@@ -199,13 +199,12 @@ glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
pixmap_priv->base.box.x2 = w;
pixmap_priv->base.box.y2 = h;
fbo = glamor_create_fbo(glamor_priv, w, h, format, usage);
- }
- else {
- DEBUGF("Create LARGE pixmap %p width %d height %d\n", pixmap, w, h);
+ } else {
+ int tile_size = glamor_priv->max_fbo_size;
+ DEBUGF("Create LARGE pixmap %p width %d height %d, tile size %d\n", pixmap, w, h, tile_size);
pixmap_priv->type = GLAMOR_TEXTURE_LARGE;
fbo = glamor_create_fbo_array(glamor_priv, w, h, format, usage,
- glamor_priv->max_fbo_size,
- glamor_priv->max_fbo_size, pixmap_priv);
+ tile_size, tile_size, pixmap_priv);
}
if (fbo == NULL) {
@@ -658,7 +657,8 @@ glamor_fd_from_pixmap(ScreenPtr screen,
switch (pixmap_priv->type) {
case GLAMOR_TEXTURE_DRM:
case GLAMOR_TEXTURE_ONLY:
- glamor_pixmap_ensure_fbo(pixmap, GL_RGBA, 0);
+ if (!glamor_pixmap_ensure_fbo(pixmap, GL_RGBA, 0))
+ return -1;
return glamor_egl_dri3_fd_name_from_tex(screen,
pixmap,
pixmap_priv->base.fbo->tex,
@@ -682,7 +682,8 @@ glamor_name_from_pixmap(PixmapPtr pixmap, CARD16 *stride, CARD32 *size)
switch (pixmap_priv->type) {
case GLAMOR_TEXTURE_DRM:
case GLAMOR_TEXTURE_ONLY:
- glamor_pixmap_ensure_fbo(pixmap, GL_RGBA, 0);
+ if (!glamor_pixmap_ensure_fbo(pixmap, GL_RGBA, 0))
+ return -1;
return glamor_egl_dri3_fd_name_from_tex(pixmap->drawable.pScreen,
pixmap,
pixmap_priv->base.fbo->tex,