summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhigang Gong <zhigang.gong@linux.intel.com>2011-12-16 15:11:16 +0800
committerZhigang Gong <zhigang.gong@linux.intel.com>2011-12-16 20:23:09 +0800
commite2c8bac972cf46982bf64bd786ecc001009081f0 (patch)
tree88202a2eb042bb9073d14cb96e5fce49abe1e6d5
parent19c184b7e4f8de747ed6fb1f6f910238193cf2a1 (diff)
uxa/glamor: Fallback to new glamor pixmap if failed to create textured pixmap.
If we failed to create textured pixmap from BO's handle, we turn to create a new glamor pixmap by call glamor_create_pixmap rather than fallback to in-memory pixmap. Have to introduce a new wrapper function intel_glamor_create_pixmap. Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
-rw-r--r--src/intel_glamor.c7
-rw-r--r--src/intel_glamor.h5
-rw-r--r--src/intel_uxa.c41
3 files changed, 40 insertions, 13 deletions
diff --git a/src/intel_glamor.c b/src/intel_glamor.c
index 0cf8ed75..8daa4b19 100644
--- a/src/intel_glamor.c
+++ b/src/intel_glamor.c
@@ -78,6 +78,13 @@ intel_glamor_pre_init(ScrnInfoPtr scrn)
return TRUE;
}
+PixmapPtr
+intel_glamor_create_pixmap(ScreenPtr screen, int w, int h,
+ int depth, unsigned int usage)
+{
+ return glamor_create_pixmap(screen, w, h, depth, usage);
+}
+
Bool
intel_glamor_create_textured_pixmap(PixmapPtr pixmap)
{
diff --git a/src/intel_glamor.h b/src/intel_glamor.h
index 1ba17c03..13745882 100644
--- a/src/intel_glamor.h
+++ b/src/intel_glamor.h
@@ -43,6 +43,8 @@ void intel_glamor_flush(intel_screen_private * intel);
Bool intel_glamor_create_textured_pixmap(PixmapPtr pixmap);
void intel_glamor_destroy_pixmap(PixmapPtr pixmap);
+PixmapPtr intel_glamor_create_pixmap(ScreenPtr screen, int w, int h,
+ int depth, unsigned int usage);
#else
@@ -58,6 +60,9 @@ static inline void intel_glamor_flush(intel_screen_private * intel) { }
static inline Bool intel_glamor_create_textured_pixmap(PixmapPtr pixmap) { return TRUE; }
static inline void intel_glamor_destroy_pixmap(PixmapPtr pixmap) { }
+static inline PixmapPtr intel_glamor_create_pixmap(ScreenPtr screen, int w, int h,
+ int depth, unsigned int usage) { return NULL; }
+
#endif
#endif /* INTEL_GLAMOR_H */
diff --git a/src/intel_uxa.c b/src/intel_uxa.c
index 292642ef..9d745540 100644
--- a/src/intel_uxa.c
+++ b/src/intel_uxa.c
@@ -1024,7 +1024,7 @@ intel_uxa_create_pixmap(ScreenPtr screen, int w, int h, int depth,
ScrnInfoPtr scrn = xf86Screens[screen->myNum];
intel_screen_private *intel = intel_get_screen_private(scrn);
struct intel_pixmap *priv;
- PixmapPtr pixmap;
+ PixmapPtr pixmap, new_pixmap = NULL;
if (w > 32767 || h > 32767)
return NullPixmap;
@@ -1111,8 +1111,7 @@ intel_uxa_create_pixmap(ScreenPtr screen, int w, int h, int depth,
screen->ModifyPixmapHeader(pixmap, w, h, 0, 0, stride, NULL);
if (!intel_glamor_create_textured_pixmap(pixmap))
- goto fallback_bo;
-
+ goto fallback_glamor;
return pixmap;
}
}
@@ -1146,26 +1145,42 @@ intel_uxa_create_pixmap(ScreenPtr screen, int w, int h, int depth,
screen->ModifyPixmapHeader(pixmap, w, h, 0, 0, stride, NULL);
- /* Create textured pixmap failed means glamor fail to create
- * a texture from the BO for some reasons, and then glamor
- * create a new texture attached to the pixmap, and all the
- * consequent rendering operations on this pixmap will never
- * fallback to UXA path, so we don't need to hold the useless
- * BO if it is the case.
- */
if (!intel_glamor_create_textured_pixmap(pixmap))
- goto fallback_bo;
+ goto fallback_glamor;
}
return pixmap;
-fallback_bo:
+fallback_glamor:
+ if (usage & INTEL_CREATE_PIXMAP_DRI2) {
+ /* XXX need further work to handle the DRI2 failure case.
+ * Glamor don't know how to handle a BO only pixmap. Put
+ * a warning indicator here.
+ */
+ xf86DrvMsg(scrn->scrnIndex, X_WARNING,
+ "Failed to create textured DRI2 pixmap.");
+ return pixmap;
+ }
+ /* Create textured pixmap failed means glamor failed to
+ * create a texture from current BO for some reasons. We turn
+ * to create a new glamor pixmap and clean up current one.
+ * One thing need to be noted, this new pixmap doesn't
+ * has a priv and bo attached to it. It's glamor's responsbility
+ * to take care of it. Glamor will mark this new pixmap as a
+ * texture only pixmap and will never fallback to DDX layer
+ * afterwards.
+ */
+ new_pixmap = intel_glamor_create_pixmap(screen, w, h,
+ depth, usage);
dri_bo_unreference(priv->bo);
fallback_priv:
free(priv);
fallback_pixmap:
fbDestroyPixmap(pixmap);
- return fbCreatePixmap(screen, w, h, depth, usage);
+ if (new_pixmap)
+ return new_pixmap;
+ else
+ return fbCreatePixmap(screen, w, h, depth, usage);
}
static Bool intel_uxa_destroy_pixmap(PixmapPtr pixmap)