[PATCH] radeon: fallback to software when we get picture bigger than pixmap
Alex Deucher
alexdeucher at gmail.com
Wed Nov 14 10:07:46 PST 2012
On Wed, Nov 14, 2012 at 1:09 PM, <j.glisse at gmail.com> wrote:
> From: Jerome Glisse <jglisse at redhat.com>
>
> This is some kind off degenerate case that we might get from time to
> time, just fallback to software when facing it.
>
> Signed-off-by: Jerome Glisse <jglisse at redhat.com>
> ---
> src/evergreen_exa.c | 4 ++++
> src/r600_exa.c | 4 ++++
> src/radeon_exa_render.c | 13 +++++++++++++
> 3 files changed, 21 insertions(+)
>
> diff --git a/src/evergreen_exa.c b/src/evergreen_exa.c
> index 883fa5c..405acf0 100644
> --- a/src/evergreen_exa.c
> +++ b/src/evergreen_exa.c
> @@ -837,6 +837,10 @@ static Bool EVERGREENTextureSetup(PicturePtr pPict, PixmapPtr pPix,
> CLEAR (tex_res);
> CLEAR (tex_samp);
>
> + if (pPict->pDrawable->width > pPix->drawable.width || pPict->pDrawable->height > pPix->drawable.height) {
> + /* just let software fallback handle this degenerate case */
> + return FALSE;
> + }
I think we should test if pPict->pDrawable exists before dereferencing
it otherwise I think we may segfault in the solid picture case.
Alex
> for (i = 0; i < sizeof(EVERGREENTexFormats) / sizeof(EVERGREENTexFormats[0]); i++) {
> if (EVERGREENTexFormats[i].fmt == pPict->format)
> break;
> diff --git a/src/r600_exa.c b/src/r600_exa.c
> index 21df084..e051b19 100644
> --- a/src/r600_exa.c
> +++ b/src/r600_exa.c
> @@ -854,6 +854,10 @@ static Bool R600TextureSetup(PicturePtr pPict, PixmapPtr pPix,
> CLEAR (tex_res);
> CLEAR (tex_samp);
>
> + if (pPict->pDrawable->width > pPix->drawable.width || pPict->pDrawable->height > pPix->drawable.height) {
> + /* just let software fallback handle this degenerate case */
> + return FALSE;
> + }
> for (i = 0; i < sizeof(R600TexFormats) / sizeof(R600TexFormats[0]); i++) {
> if (R600TexFormats[i].fmt == pPict->format)
> break;
> diff --git a/src/radeon_exa_render.c b/src/radeon_exa_render.c
> index c673f2c..8486676 100644
> --- a/src/radeon_exa_render.c
> +++ b/src/radeon_exa_render.c
> @@ -359,6 +359,11 @@ static Bool R100TextureSetup(PicturePtr pPict, PixmapPtr pPix,
> int i, w, h;
> struct radeon_exa_pixmap_priv *driver_priv;
>
> + if (pPict->pDrawable->width > pPix->drawable.width || pPict->pDrawable->height > pPix->drawable.height) {
> + /* just let software fallback handle this degenerate case */
> + return FALSE;
> + }
> +
> if (pPict->pDrawable) {
> w = pPict->pDrawable->width;
> h = pPict->pDrawable->height;
> @@ -756,6 +761,10 @@ static Bool R200TextureSetup(PicturePtr pPict, PixmapPtr pPix,
> int i, w, h;
> struct radeon_exa_pixmap_priv *driver_priv;
>
> + if (pPict->pDrawable->width > pPix->drawable.width || pPict->pDrawable->height > pPix->drawable.height) {
> + /* just let software fallback handle this degenerate case */
> + return FALSE;
> + }
> if (pPict->pDrawable) {
> w = pPict->pDrawable->width;
> h = pPict->pDrawable->height;
> @@ -1140,6 +1149,10 @@ static Bool R300TextureSetup(PicturePtr pPict, PixmapPtr pPix,
>
> TRACE;
>
> + if (pPict->pDrawable->width > pPix->drawable.width || pPict->pDrawable->height > pPix->drawable.height) {
> + /* just let software fallback handle this degenerate case */
> + return FALSE;
> + }
> if (pPict->pDrawable) {
> w = pPict->pDrawable->width;
> h = pPict->pDrawable->height;
> --
> 1.8.0
>
> _______________________________________________
> xorg-driver-ati mailing list
> xorg-driver-ati at lists.x.org
> http://lists.x.org/mailman/listinfo/xorg-driver-ati
More information about the xorg-driver-ati
mailing list