[PATCH fbdev] Fix shadow fb allocation size (v2)

Alex Deucher alexdeucher at gmail.com
Wed Jan 4 18:19:00 UTC 2017


On Wed, Jan 4, 2017 at 10:30 AM, Adam Jackson <ajax at redhat.com> wrote:
> ->bitsPerPixel is rather obviously eight times too large.
>
> v2: Use ->displayWidth - the pitch - not ->virtualX (Keith Packard)
>
> Signed-off-by: Adam Jackson <ajax at redhat.com>

Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

> ---
>  src/fbdev.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/fbdev.c b/src/fbdev.c
> index 2c658fe..4309d76 100644
> --- a/src/fbdev.c
> +++ b/src/fbdev.c
> @@ -827,8 +827,8 @@ FBDevScreenInit(SCREEN_INIT_ARGS_DECL)
>         fPtr->fbstart = fPtr->fbmem + fPtr->fboff;
>
>         if (fPtr->shadowFB) {
> -           fPtr->shadow = calloc(1, pScrn->virtualX * pScrn->virtualY *
> -                                 pScrn->bitsPerPixel);
> +           fPtr->shadow = calloc(1, pScrn->displayWidth * pScrn->virtualY *
> +                                 ((pScrn->bitsPerPixel + 7) / 8));
>
>             if (!fPtr->shadow) {
>                 xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
> --
> 2.9.3
>
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: https://lists.x.org/mailman/listinfo/xorg-devel


More information about the xorg-devel mailing list