Fixed a stride problem for textured_drm pixmap.

As a textured_drm pixmap has a drm bo attached to it, and
it's the DDX layer to set it stride value. In some case,
the stride value is not equal to PixmapBytePad(w, depth)
which is used within glamor.

Then if it is the case, we have two choice, one is to set
the GL_PACK_ROW_LENGTH/GL_UNPACK_ROW_LENGTH when we need
to download or upload the pixmap. The other option is to
change the pixmap's devKind to match the one glamor is using
when downloading the pixmap, and restore it to the drm stride
after uploading the pixmap.

We choose the 2nd option, as GLES doesn't support the first
method.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
This commit is contained in:
Zhigang Gong 2012-04-15 17:09:06 +08:00 committed by Eric Anholt
parent 70b71718e7
commit ff3d2c7963
3 changed files with 14 additions and 3 deletions

View File

@ -344,6 +344,9 @@ glamor_finish_access(DrawablePtr drawable, glamor_access_t access_mode)
free(pixmap->devPrivate.ptr);
}
if (pixmap_priv->type == GLAMOR_TEXTURE_DRM)
pixmap->devKind = pixmap_priv->drm_stride;
if (pixmap_priv->gl_fbo == GLAMOR_FBO_DOWNLOADED)
pixmap_priv->gl_fbo = GLAMOR_FBO_NORMAL;

View File

@ -688,6 +688,7 @@ glamor_upload_pixmap_to_texture(PixmapPtr pixmap)
glamor_pixmap_private *pixmap_priv;
void *data;
int pbo;
int ret;
pixmap_priv = glamor_get_pixmap_private(pixmap);
@ -706,11 +707,11 @@ glamor_upload_pixmap_to_texture(PixmapPtr pixmap)
pixmap->drawable.height,
pixmap->devKind,
data, pbo))
return GLAMOR_UPLOAD_DONE;
ret = GLAMOR_UPLOAD_DONE;
else
return GLAMOR_UPLOAD_FAILED;
ret = GLAMOR_UPLOAD_FAILED;
return GLAMOR_UPLOAD_DONE;
return ret;
}
void
@ -1023,6 +1024,12 @@ glamor_download_pixmap_to_cpu(PixmapPtr pixmap, glamor_access_t access)
pbo = pixmap_priv->fbo->pbo;
}
if (pixmap_priv->type == GLAMOR_TEXTURE_DRM) {
stride = PixmapBytePad(pixmap->drawable.width, pixmap->drawable.depth);
pixmap_priv->drm_stride = pixmap->devKind;
pixmap->devKind = stride;
}
dst = glamor_download_sub_pixmap_to_cpu(pixmap, 0, 0,
pixmap->drawable.width,
pixmap->drawable.height,

View File

@ -327,6 +327,7 @@ typedef struct glamor_pixmap_private {
PictFormatShort pict_format;
glamor_pending_op pending_op;
PixmapPtr container;
int drm_stride;
glamor_screen_private *glamor_priv;
} glamor_pixmap_private;