[PATCH 1/4] modesetting: Allocate and destroy shadow_fb in drmmode_display

Jason Ekstrand jason at jlekstrand.net
Fri Dec 19 14:25:26 PST 2014


I've also pushed a branch with my patches on top of Ken's new present
patches here:

http://cgit.freedesktop.org/~jekstrand/xserver/log/?h=wip/modeset-shadow

On Fri, Dec 19, 2014 at 2:12 PM, Jason Ekstrand <jason at jlekstrand.net>
wrote:
>
> This way all of the buffer allocation/destruction is in the same file.
>
> Signed-off-by: Jason Ekstrand <jason.ekstrand at intel.com>
> ---
>  hw/xfree86/drivers/modesetting/driver.c          | 16 +---------------
>  hw/xfree86/drivers/modesetting/drmmode_display.c | 19 ++++++++++++++++++-
>  hw/xfree86/drivers/modesetting/drmmode_display.h |  2 +-
>  3 files changed, 20 insertions(+), 17 deletions(-)
>
> diff --git a/hw/xfree86/drivers/modesetting/driver.c
> b/hw/xfree86/drivers/modesetting/driver.c
> index 5dda96b..77da2cc 100644
> --- a/hw/xfree86/drivers/modesetting/driver.c
> +++ b/hw/xfree86/drivers/modesetting/driver.c
> @@ -993,15 +993,6 @@ ScreenInit(ScreenPtr pScreen, int argc, char **argv)
>      if (!drmmode_create_initial_bos(pScrn, &ms->drmmode))
>          return FALSE;
>
> -    if (ms->drmmode.shadow_enable) {
> -        ms->drmmode.shadow_fb =
> -            calloc(1,
> -                   pScrn->displayWidth * pScrn->virtualY *
> -                   ((pScrn->bitsPerPixel + 7) >> 3));
> -        if (!ms->drmmode.shadow_fb)
> -            ms->drmmode.shadow_enable = FALSE;
> -    }
> -
>      miClearVisualTypes();
>
>      if (!miSetVisualTypes(pScrn->depth,
> @@ -1200,14 +1191,9 @@ CloseScreen(ScreenPtr pScreen)
>          ms->damage = NULL;
>      }
>
> -    if (ms->drmmode.shadow_enable) {
> -        shadowRemove(pScreen, pScreen->GetScreenPixmap(pScreen));
> -        free(ms->drmmode.shadow_fb);
> -        ms->drmmode.shadow_fb = NULL;
> -    }
>      drmmode_uevent_fini(pScrn, &ms->drmmode);
>
> -    drmmode_free_bos(pScrn, &ms->drmmode);
> +    drmmode_free_bos(pScreen, &ms->drmmode);
>
>      if (pScrn->vtSema) {
>          LeaveVT(pScrn);
> diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c
> b/hw/xfree86/drivers/modesetting/drmmode_display.c
> index 824500b..30ee79d 100644
> --- a/hw/xfree86/drivers/modesetting/drmmode_display.c
> +++ b/hw/xfree86/drivers/modesetting/drmmode_display.c
> @@ -39,6 +39,7 @@
>  #include "micmap.h"
>  #include "xf86cmap.h"
>  #include "xf86DDC.h"
> +#include "shadow.h"
>
>  #include <xf86drm.h>
>  #include "xf86Crtc.h"
> @@ -1539,6 +1540,15 @@ drmmode_create_initial_bos(ScrnInfoPtr pScrn,
> drmmode_ptr drmmode)
>          return FALSE;
>      pScrn->displayWidth = drmmode_bo_get_pitch(&drmmode->front_bo) / cpp;
>
> +    if (drmmode->shadow_enable) {
> +        drmmode->shadow_fb =
> +            calloc(1,
> +                   pScrn->displayWidth * pScrn->virtualY *
> +                   ((pScrn->bitsPerPixel + 7) >> 3));
> +        if (!drmmode->shadow_fb)
> +            drmmode->shadow_enable = FALSE;
> +    }
> +
>      width = ms->cursor_width;
>      height = ms->cursor_height;
>      bpp = 32;
> @@ -1601,8 +1611,9 @@ drmmode_map_cursor_bos(ScrnInfoPtr pScrn,
> drmmode_ptr drmmode)
>  }
>
>  void
> -drmmode_free_bos(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
> +drmmode_free_bos(ScreenPtr pScreen, drmmode_ptr drmmode)
>  {
> +    ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
>      xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
>      int i;
>
> @@ -1611,6 +1622,12 @@ drmmode_free_bos(ScrnInfoPtr pScrn, drmmode_ptr
> drmmode)
>          drmmode->fb_id = 0;
>      }
>
> +    if (drmmode->shadow_enable) {
> +        shadowRemove(pScreen, pScreen->GetScreenPixmap(pScreen));
> +        free(drmmode->shadow_fb);
> +        drmmode->shadow_fb = NULL;
> +    }
> +
>      drmmode_bo_destroy(drmmode, &drmmode->front_bo);
>
>      for (i = 0; i < xf86_config->num_crtc; i++) {
> diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.h
> b/hw/xfree86/drivers/modesetting/drmmode_display.h
> index 66d0ca2..c67809b 100644
> --- a/hw/xfree86/drivers/modesetting/drmmode_display.h
> +++ b/hw/xfree86/drivers/modesetting/drmmode_display.h
> @@ -155,7 +155,7 @@ extern void drmmode_uevent_fini(ScrnInfoPtr scrn,
> drmmode_ptr drmmode);
>  Bool drmmode_create_initial_bos(ScrnInfoPtr pScrn, drmmode_ptr drmmode);
>  void *drmmode_map_front_bo(drmmode_ptr drmmode);
>  Bool drmmode_map_cursor_bos(ScrnInfoPtr pScrn, drmmode_ptr drmmode);
> -void drmmode_free_bos(ScrnInfoPtr pScrn, drmmode_ptr drmmode);
> +void drmmode_free_bos(ScreenPtr pScreen, drmmode_ptr drmmode);
>  void drmmode_get_default_bpp(ScrnInfoPtr pScrn, drmmode_ptr drmmmode,
>                               int *depth, int *bpp);
>
> --
> 2.2.0
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.x.org/archives/xorg-devel/attachments/20141219/736bc742/attachment-0001.html>


More information about the xorg-devel mailing list