public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rohit Vaswani <rvaswani@codeaurora.org>
To: Rohit Vaswani <rvaswani@codeaurora.org>
Cc: David Brown <davidb@codeaurora.org>,
	Bryan Huntsman <bryanh@codeaurora.org>,
	Daniel Walker <dwalker@fifo99.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org
Subject: [Please Ignore] Re: [PATCH] Changes to resolve the multiple client issue: by Michael Street
Date: Wed, 20 Mar 2013 17:56:51 -0700	[thread overview]
Message-ID: <514A5AD3.3010605@codeaurora.org> (raw)
In-Reply-To: <1363826498-7254-1-git-send-email-rvaswani@codeaurora.org>

Please Ignore.

On 3/20/2013 5:41 PM, Rohit Vaswani wrote:
> Signed-off-by: Rohit Vaswani <rvaswani@codeaurora.org>
> ---
>   src/msm-dri2.c |   21 +++++++++++++++++++--
>   src/msm-drm.c  |   39 ++++++++++++++++++++++++++++++---------
>   src/msm-drm.h  |    1 +
>   3 files changed, 50 insertions(+), 11 deletions(-)
>
> diff --git a/src/msm-dri2.c b/src/msm-dri2.c
> index e5bdf8a..7eadc48 100644
> --- a/src/msm-dri2.c
> +++ b/src/msm-dri2.c
> @@ -131,9 +131,10 @@ DoFlipMDP4(ScreenPtr pScreen, PixmapPtr pPixmap,
>   {
>       struct mdp_overlay overlay;
>       struct msmfb_overlay_data play;
> +    struct drm_kgsl_gem_get_ion_fd ionfdioctl;
>       ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
>       MSMPtr pMsm = MSMPTR(pScrn);
> -    int ret;
> +    int ret = 0;
>       struct msm_pixmap_priv *pixpriv;
>   
>   
> @@ -190,9 +191,21 @@ DoFlipMDP4(ScreenPtr pScreen, PixmapPtr pPixmap,
>       }
>   
>       pixpriv = exaGetPixmapDriverPrivate(pPixmap);
> +    ionfdioctl.ion_fd = 0;
> +    if(pixpriv->bo->ion_fd == 0) {
> +	    ionfdioctl.handle = pixpriv->bo->handle;
> +	    ret = ioctl(pixpriv->bo->fd, DRM_IOCTL_KGSL_GEM_GET_ION_FD, &ionfdioctl);
> +	    if (ret < 0) {
> +	        ErrorF("DRM: DRM_IOCTL_KGSL_GEM_GET_ION_FD failed: %m\n");
> +	        return ret;
> +	    }
> +        play.data.memory_id =  ionfdioctl.ion_fd;
> +    }
> +    else {
> +        play.data.memory_id = pixpriv->bo->ion_fd;
> +    }
>       play.id = fbOverlay;
>       play.data.offset = pixpriv->bo->offsets[pixpriv->bo->active];
> -    play.data.memory_id = pixpriv->bo->ion_fd;
>       play.data.priv = 0;
>       play.data.flags = 0;
>   
> @@ -206,6 +219,10 @@ DoFlipMDP4(ScreenPtr pScreen, PixmapPtr pPixmap,
>       if (ret < 0)
>           ErrorF("FBIOPAN_DISPLAY failed line %d error %d\n",__LINE__,errno);
>   
> +    if(ionfdioctl.ion_fd != 0) {
> +	    close(ionfdioctl.ion_fd);
> +    }
> +
>       return ret == 0 ? TRUE : FALSE;
>   }
>   #endif
> diff --git a/src/msm-drm.c b/src/msm-drm.c
> index 1e13d4a..3603cbd 100644
> --- a/src/msm-drm.c
> +++ b/src/msm-drm.c
> @@ -218,6 +218,7 @@ msm_drm_bo_create(MSMPtr pMsm, int fd, int size, int type)
>       bo->fd = fd;
>       bo->active = 0;
>       bo->count = 1;
> +    bo->allocated = 0;
>   
>       /* All memory defaults to KMEM */
>       bo->memtype = DRM_KGSL_GEM_TYPE_KMEM;
> @@ -260,20 +261,21 @@ int
>   msm_drm_bo_alloc(struct msm_drm_bo *bo)
>   {
>       struct drm_kgsl_gem_alloc alloc;
> -    struct drm_kgsl_gem_get_ion_fd ionfdioctl;
> +    //struct drm_kgsl_gem_get_ion_fd ionfdioctl;
>       int ret;
>   
>       if (bo == NULL)
>   	return -1;
>   
>       /* If the offset is set, then assume it has been allocated */
> -    if (bo->ion_fd != 0)
> +    if (bo->allocated != 0)
>   	return 0;
>   
>       memset(&alloc, 0, sizeof(alloc));
>       alloc.handle = bo->handle;
>   
>       ret = ioctl(bo->fd, DRM_IOCTL_KGSL_GEM_ALLOC, &alloc);
> +    bo->allocated = 1;
>   
>       if (ret) {
>   	/* if the ioctl isn't supported, then use the legacy PREP ioctl */
> @@ -299,13 +301,13 @@ msm_drm_bo_alloc(struct msm_drm_bo *bo)
>   	return ret;
>       }
>   
> -    ionfdioctl.handle = bo->handle;
> -    ret = ioctl(bo->fd, DRM_IOCTL_KGSL_GEM_GET_ION_FD, &ionfdioctl);
> -    if (ret < 0) {
> -        ErrorF("DRM: DRM_IOCTL_KGSL_GEM_GET_ION_FD failed: %m\n");
> -        return ret;
> -    }
> -    bo->ion_fd = ionfdioctl.ion_fd;
> +//    ionfdioctl.handle = bo->handle;
> +//    ret = ioctl(bo->fd, DRM_IOCTL_KGSL_GEM_GET_ION_FD, &ionfdioctl);
> +//    if (ret < 0) {
> +//        ErrorF("DRM: DRM_IOCTL_KGSL_GEM_GET_ION_FD failed: %m\n");
> +//        return ret;
> +//    }
> +//    bo->ion_fd = ionfdioctl.ion_fd;
>   
>       bo->offset = alloc.offset;
>       return 0;
> @@ -356,6 +358,7 @@ msm_drm_bo_map(struct msm_drm_bo *bo)
>   {
>       int ret, i;
>       unsigned int mapsize;
> +    struct drm_kgsl_gem_get_ion_fd ionfdioctl;
>   
>       if (bo == NULL)
>   	return -1;
> @@ -401,8 +404,22 @@ msm_drm_bo_map(struct msm_drm_bo *bo)
>   
>       if (ret == 0)
>       {
> +        ionfdioctl.handle = bo->handle;
> +	if(bo->ion_fd == 0)
> +	{
> +        	ret = ioctl(bo->fd, DRM_IOCTL_KGSL_GEM_GET_ION_FD, &ionfdioctl);
> +        	if (ret < 0) {
> +            	ErrorF("DRM: DRM_IOCTL_KGSL_GEM_GET_ION_FD failed: %m\n");
> +            	return ret;
> +        	}
> +        	bo->ion_fd = ionfdioctl.ion_fd;
> +	}
> +	else ErrorF("DRM: ion_fd %d already allocated\n", bo->ion_fd);
> +
>           bo->hostptr = mmap(0, mapsize, PROT_READ | PROT_WRITE, MAP_SHARED,
>                              bo->ion_fd, 0);
> +	close(bo->ion_fd);
> +	bo->ion_fd = 0;
>       }
>       else
>       {
> @@ -434,6 +451,8 @@ msm_drm_bo_unmap(struct msm_drm_bo *bo)
>   	munmap((void *) bo->hostptr, bo->size);
>   
>       bo->hostptr = 0;
> +    close(bo->ion_fd);
> +    bo->ion_fd = 0;
>   #endif
>   }
>   
> @@ -452,6 +471,8 @@ msm_drm_bo_free(MSMPtr pMsm, struct msm_drm_bo *bo)
>   	}
>   	else
>   		_msm_drm_bo_free(bo);
> +
> +	bo->allocated = 0;
>   }
>   
>   /* Set the next buffer in the list as active */
> diff --git a/src/msm-drm.h b/src/msm-drm.h
> index 55d071d..1eaf8e4 100644
> --- a/src/msm-drm.h
> +++ b/src/msm-drm.h
> @@ -53,6 +53,7 @@ struct msm_drm_bo {
>       int ref;
>       int active;
>       unsigned long long offset;
> +    int allocated;
>   };
>   
>   int msm_drm_init(int fd);


Thanks,
Rohit Vaswani

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation


      reply	other threads:[~2013-03-21  0:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-21  0:41 [PATCH] Changes to resolve the multiple client issue: by Michael Street Rohit Vaswani
2013-03-21  0:56 ` Rohit Vaswani [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=514A5AD3.3010605@codeaurora.org \
    --to=rvaswani@codeaurora.org \
    --cc=bryanh@codeaurora.org \
    --cc=davidb@codeaurora.org \
    --cc=dwalker@fifo99.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox