All of lore.kernel.org
 help / color / mirror / Atom feed
From: Inki Dae <inki.dae@samsung.com>
To: Hyungwon Hwang <human.hwang@samsung.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 1/2] exynos: Don't use DRM_EXYNOS_GEM_{MAP_OFFSET/MMAP} ioctls
Date: Wed, 19 Nov 2014 11:02:48 +0900	[thread overview]
Message-ID: <546BFA48.4080507@samsung.com> (raw)
In-Reply-To: <1414718891-3129-1-git-send-email-human.hwang@samsung.com>

On 2014년 10월 31일 10:28, Hyungwon Hwang wrote:
> The ioctl DRM_EXYNOS_GEM_MAP_OFFSET and DRM_EXYNOS_GEM_MMAP are removed from
> the linux kernel. This patch modifies libdrm and libkms to use drm generic
> ioctls instead of the removed ioctls.


Signed-off-by: Inki Dae <inki.dae@samsung.com>

> 
> Signed-off-by: Hyungwon Hwang <human.hwang@samsung.com>
> ---
>  exynos/exynos_drm.c | 24 +++++++++++++-----------
>  libkms/exynos.c     |  7 ++++---
>  2 files changed, 17 insertions(+), 14 deletions(-)
> 
> diff --git a/exynos/exynos_drm.c b/exynos/exynos_drm.c
> index 4c7dd13..4cb6a6d 100644
> --- a/exynos/exynos_drm.c
> +++ b/exynos/exynos_drm.c
> @@ -283,20 +283,22 @@ drm_public void *exynos_bo_map(struct exynos_bo *bo)
>  {
>  	if (!bo->vaddr) {
>  		struct exynos_device *dev = bo->dev;
> -		struct drm_exynos_gem_mmap req = {
> -			.handle = bo->handle,
> -			.size	= bo->size,
> -		};
> +		struct drm_mode_map_dumb arg;
> +		void *map = NULL;
>  		int ret;
>  
> -		ret = drmIoctl(dev->fd, DRM_IOCTL_EXYNOS_GEM_MMAP, &req);
> -		if (ret) {
> -			fprintf(stderr, "failed to mmap[%s].\n",
> -				strerror(errno));
> -			return NULL;
> -		}
> +		memset(&arg, 0, sizeof(arg));
> +		arg.handle = bo->handle;
> +
> +		ret = drmIoctl(dev->fd, DRM_IOCTL_MODE_MAP_DUMB, &arg);
> +		if (ret)
> +			return ret;
>  
> -		bo->vaddr = (void *)(uintptr_t)req.mapped;
> +		map = drm_mmap(0, bo->size, PROT_READ | PROT_WRITE, MAP_SHARED,
> +				dev->fd, arg.offset);
> +
> +		if (map == MAP_FAILED)
> +			return NULL;
>  	}
>  
>  	return bo->vaddr;
> diff --git a/libkms/exynos.c b/libkms/exynos.c
> index 92e329c..1123482 100644
> --- a/libkms/exynos.c
> +++ b/libkms/exynos.c
> @@ -25,6 +25,7 @@
>  #include <sys/ioctl.h>
>  #include "xf86drm.h"
>  
> +#include "libdrm.h"
>  #include "exynos_drm.h"
>  
>  struct exynos_bo
> @@ -124,7 +125,7 @@ static int
>  exynos_bo_map(struct kms_bo *_bo, void **out)
>  {
>  	struct exynos_bo *bo = (struct exynos_bo *)_bo;
> -	struct drm_exynos_gem_map_off arg;
> +	struct drm_mode_map_dumb arg;
>  	void *map = NULL;
>  	int ret;
>  
> @@ -137,11 +138,11 @@ exynos_bo_map(struct kms_bo *_bo, void **out)
>  	memset(&arg, 0, sizeof(arg));
>  	arg.handle = bo->base.handle;
>  
> -	ret = drmCommandWriteRead(bo->base.kms->fd, DRM_EXYNOS_GEM_MAP_OFFSET, &arg, sizeof(arg));
> +	ret = drmIoctl(bo->base.kms->fd, DRM_IOCTL_MODE_MAP_DUMB, &arg);
>  	if (ret)
>  		return ret;
>  
> -	map = mmap(0, bo->base.size, PROT_READ | PROT_WRITE, MAP_SHARED, bo->base.kms->fd, arg.offset);
> +	map = drm_mmap(0, bo->base.size, PROT_READ | PROT_WRITE, MAP_SHARED, bo->base.kms->fd, arg.offset);
>  	if (map == MAP_FAILED)
>  		return -errno;
>  
> 

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2014-11-19  2:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-31  1:28 [PATCH 1/2] exynos: Don't use DRM_EXYNOS_GEM_{MAP_OFFSET/MMAP} ioctls Hyungwon Hwang
2014-10-31  1:28 ` [PATCH 2/2] exynos: remove " Hyungwon Hwang
2014-11-19  2:03   ` Inki Dae
2014-11-19  2:02 ` Inki Dae [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-01-16 22:57 libdrm/exynos: fix usage of removed ioctls Tobias Jakobi
2015-01-16 22:57 ` [PATCH 1/2] exynos: Don't use DRM_EXYNOS_GEM_{MAP_OFFSET/MMAP} ioctls Tobias Jakobi
2015-01-26  1:42   ` Hyungwon Hwang
2015-01-26 19:05     ` Emil Velikov
2015-01-27  1:05       ` Hyungwon Hwang
2015-01-27  2:56         ` Emil Velikov

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=546BFA48.4080507@samsung.com \
    --to=inki.dae@samsung.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=human.hwang@samsung.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.