From: Zhigang Gong <zhigang.g...@linux.intel.com>

Two fixes in this commit, first we only need to check the
front left buffer, for other attachment we don't need to
check them. The second is, we should fixup the pixmap's
drawable not the original drawable.

Signed-off-by: Zhigang Gong <zhigang.g...@linux.intel.com>
---
 src/intel_dri.c |   22 ++++++++++++++++------
 1 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/src/intel_dri.c b/src/intel_dri.c
index 2a0102d..f6f0c86 100644
--- a/src/intel_dri.c
+++ b/src/intel_dri.c
@@ -280,14 +280,18 @@ I830DRI2CreateBuffers(DrawablePtr drawable, unsigned int 
*attachments,
                pixmap = NULL;
                if (attachments[i] == DRI2BufferFrontLeft) {
                        pixmap = get_front_buffer(drawable);
+
+                       if (pixmap && intel_get_pixmap_private(pixmap) == NULL) 
{
+                               is_glamor_pixmap = TRUE;
+                               drawable = &pixmap->drawable;
+                               pixmap = NULL;
+                       }
                } else if (attachments[i] == DRI2BufferStencil && pDepthPixmap) 
{
                        pixmap = pDepthPixmap;
                        pixmap->refcnt++;
                }
 
-               is_glamor_pixmap = pixmap && (intel_get_pixmap_private(pixmap) 
== NULL);
-
-               if (pixmap == NULL || is_glamor_pixmap) {
+               if (pixmap == NULL) {
                        unsigned int hint = INTEL_CREATE_PIXMAP_DRI2;
 
                        if (intel->tiling & INTEL_TILING_3D) {
@@ -398,11 +402,17 @@ I830DRI2CreateBuffer(DrawablePtr drawable, unsigned int 
attachment,
        }
 
        pixmap = NULL;
-       if (attachment == DRI2BufferFrontLeft)
+       if (attachment == DRI2BufferFrontLeft) {
                pixmap = get_front_buffer(drawable);
 
-       is_glamor_pixmap = pixmap && (intel_get_pixmap_private(pixmap) == NULL);
-       if (pixmap == NULL || is_glamor_pixmap) {
+               if (pixmap && intel_get_pixmap_private(pixmap) == NULL) {
+                       is_glamor_pixmap = TRUE;
+                       drawable = &pixmap->drawable;
+                       pixmap = NULL;
+               }
+       }
+
+       if (pixmap == NULL) {
                unsigned int hint = INTEL_CREATE_PIXMAP_DRI2;
                int pixmap_width = drawable->width;
                int pixmap_height = drawable->height;
-- 
1.7.4.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to