diff mbox

[1/4] drm/exynos: explicit store base gem object in dma_buf->priv

Message ID 1375936775-20133-1-git-send-email-inki.dae@samsung.com (mailing list archive)
State New, archived
Headers show

Commit Message

Inki Dae Aug. 8, 2013, 4:39 a.m. UTC
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 drivers/gpu/drm/exynos/exynos_drm_dmabuf.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

Comments

Inki Dae Aug. 8, 2013, 4:56 a.m. UTC | #1
Hi, Daniel. You can repost your patch set including the below my patch. And
my patch numbering is wrong. Sorry about that.

[PATCH 1/4] -> [PATCH 4/4]


Thanks,
Inki Dae

> -----Original Message-----
> From: Inki Dae [mailto:inki.dae@samsung.com]
> Sent: Thursday, August 08, 2013 1:40 PM
> To: daniel@ffwll.ch
> Cc: dri-devel@lists.freedesktop.org; intel-gfx@lists.freedesktop.org; Inki
> Dae; Kyungmin Park
> Subject: [PATCH 1/4] drm/exynos: explicit store base gem object in
> dma_buf->priv
> 
> Signed-off-by: Inki Dae <inki.dae@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
>  drivers/gpu/drm/exynos/exynos_drm_dmabuf.c |   12 ++++++++----
>  1 files changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c
> b/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c
> index 3cd56e1..fd76449 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c
> @@ -22,6 +22,11 @@ struct exynos_drm_dmabuf_attachment {
>  	bool is_mapped;
>  };
> 
> +static struct exynos_drm_gem_obj *dma_buf_to_obj(struct dma_buf *buf)
> +{
> +	return to_exynos_gem_obj(buf->priv);
> +}
> +
>  static int exynos_gem_attach_dma_buf(struct dma_buf *dmabuf,
>  					struct device *dev,
>  					struct dma_buf_attachment *attach)
> @@ -63,7 +68,7 @@ static struct sg_table *
>  					enum dma_data_direction dir)
>  {
>  	struct exynos_drm_dmabuf_attachment *exynos_attach = attach->priv;
> -	struct exynos_drm_gem_obj *gem_obj = attach->dmabuf->priv;
> +	struct exynos_drm_gem_obj *gem_obj = dma_buf_to_obj(attach->dmabuf);
>  	struct drm_device *dev = gem_obj->base.dev;
>  	struct exynos_drm_gem_buf *buf;
>  	struct scatterlist *rd, *wr;
> @@ -180,7 +185,7 @@ struct dma_buf *exynos_dmabuf_prime_export(struct
> drm_device *drm_dev,
>  {
>  	struct exynos_drm_gem_obj *exynos_gem_obj = to_exynos_gem_obj(obj);
> 
> -	return dma_buf_export(exynos_gem_obj, &exynos_dmabuf_ops,
> +	return dma_buf_export(obj, &exynos_dmabuf_ops,
>  				exynos_gem_obj->base.size, flags);
>  }
> 
> @@ -198,8 +203,7 @@ struct drm_gem_object
> *exynos_dmabuf_prime_import(struct drm_device *drm_dev,
>  	if (dma_buf->ops == &exynos_dmabuf_ops) {
>  		struct drm_gem_object *obj;
> 
> -		exynos_gem_obj = dma_buf->priv;
> -		obj = &exynos_gem_obj->base;
> +		obj = dma_buf->priv;
> 
>  		/* is it from our device? */
>  		if (obj->dev == drm_dev) {
> --
> 1.7.5.4
Daniel Vetter Aug. 8, 2013, 6:58 a.m. UTC | #2
Hi Inki,

On Thu, Aug 08, 2013 at 01:56:28PM +0900, Inki Dae wrote:
> Hi, Daniel. You can repost your patch set including the below my patch. And
> my patch numbering is wrong. Sorry about that.

Thanks for the patch, I'll submit it toghether with the other ones soon.
-Daniel

> 
> [PATCH 1/4] -> [PATCH 4/4]
> 
> 
> Thanks,
> Inki Dae
> 
> > -----Original Message-----
> > From: Inki Dae [mailto:inki.dae@samsung.com]
> > Sent: Thursday, August 08, 2013 1:40 PM
> > To: daniel@ffwll.ch
> > Cc: dri-devel@lists.freedesktop.org; intel-gfx@lists.freedesktop.org; Inki
> > Dae; Kyungmin Park
> > Subject: [PATCH 1/4] drm/exynos: explicit store base gem object in
> > dma_buf->priv
> > 
> > Signed-off-by: Inki Dae <inki.dae@samsung.com>
> > Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> > ---
> >  drivers/gpu/drm/exynos/exynos_drm_dmabuf.c |   12 ++++++++----
> >  1 files changed, 8 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c
> > b/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c
> > index 3cd56e1..fd76449 100644
> > --- a/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c
> > +++ b/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c
> > @@ -22,6 +22,11 @@ struct exynos_drm_dmabuf_attachment {
> >  	bool is_mapped;
> >  };
> > 
> > +static struct exynos_drm_gem_obj *dma_buf_to_obj(struct dma_buf *buf)
> > +{
> > +	return to_exynos_gem_obj(buf->priv);
> > +}
> > +
> >  static int exynos_gem_attach_dma_buf(struct dma_buf *dmabuf,
> >  					struct device *dev,
> >  					struct dma_buf_attachment *attach)
> > @@ -63,7 +68,7 @@ static struct sg_table *
> >  					enum dma_data_direction dir)
> >  {
> >  	struct exynos_drm_dmabuf_attachment *exynos_attach = attach->priv;
> > -	struct exynos_drm_gem_obj *gem_obj = attach->dmabuf->priv;
> > +	struct exynos_drm_gem_obj *gem_obj = dma_buf_to_obj(attach->dmabuf);
> >  	struct drm_device *dev = gem_obj->base.dev;
> >  	struct exynos_drm_gem_buf *buf;
> >  	struct scatterlist *rd, *wr;
> > @@ -180,7 +185,7 @@ struct dma_buf *exynos_dmabuf_prime_export(struct
> > drm_device *drm_dev,
> >  {
> >  	struct exynos_drm_gem_obj *exynos_gem_obj = to_exynos_gem_obj(obj);
> > 
> > -	return dma_buf_export(exynos_gem_obj, &exynos_dmabuf_ops,
> > +	return dma_buf_export(obj, &exynos_dmabuf_ops,
> >  				exynos_gem_obj->base.size, flags);
> >  }
> > 
> > @@ -198,8 +203,7 @@ struct drm_gem_object
> > *exynos_dmabuf_prime_import(struct drm_device *drm_dev,
> >  	if (dma_buf->ops == &exynos_dmabuf_ops) {
> >  		struct drm_gem_object *obj;
> > 
> > -		exynos_gem_obj = dma_buf->priv;
> > -		obj = &exynos_gem_obj->base;
> > +		obj = dma_buf->priv;
> > 
> >  		/* is it from our device? */
> >  		if (obj->dev == drm_dev) {
> > --
> > 1.7.5.4
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c b/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c
index 3cd56e1..fd76449 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c
@@ -22,6 +22,11 @@  struct exynos_drm_dmabuf_attachment {
 	bool is_mapped;
 };
 
+static struct exynos_drm_gem_obj *dma_buf_to_obj(struct dma_buf *buf)
+{
+	return to_exynos_gem_obj(buf->priv);
+}
+
 static int exynos_gem_attach_dma_buf(struct dma_buf *dmabuf,
 					struct device *dev,
 					struct dma_buf_attachment *attach)
@@ -63,7 +68,7 @@  static struct sg_table *
 					enum dma_data_direction dir)
 {
 	struct exynos_drm_dmabuf_attachment *exynos_attach = attach->priv;
-	struct exynos_drm_gem_obj *gem_obj = attach->dmabuf->priv;
+	struct exynos_drm_gem_obj *gem_obj = dma_buf_to_obj(attach->dmabuf);
 	struct drm_device *dev = gem_obj->base.dev;
 	struct exynos_drm_gem_buf *buf;
 	struct scatterlist *rd, *wr;
@@ -180,7 +185,7 @@  struct dma_buf *exynos_dmabuf_prime_export(struct drm_device *drm_dev,
 {
 	struct exynos_drm_gem_obj *exynos_gem_obj = to_exynos_gem_obj(obj);
 
-	return dma_buf_export(exynos_gem_obj, &exynos_dmabuf_ops,
+	return dma_buf_export(obj, &exynos_dmabuf_ops,
 				exynos_gem_obj->base.size, flags);
 }
 
@@ -198,8 +203,7 @@  struct drm_gem_object *exynos_dmabuf_prime_import(struct drm_device *drm_dev,
 	if (dma_buf->ops == &exynos_dmabuf_ops) {
 		struct drm_gem_object *obj;
 
-		exynos_gem_obj = dma_buf->priv;
-		obj = &exynos_gem_obj->base;
+		obj = dma_buf->priv;
 
 		/* is it from our device? */
 		if (obj->dev == drm_dev) {