mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Inki Dae <inki.dae@samsung.com>
To: "'Konrad Rzeszutek Wilk'" <konrad.wilk@oracle.com>,
	"'Rob Clark'" <robdclark@gmail.com>
Cc: sw0312.kim@samsung.com, linux-kernel@vger.kernel.org,
	dri-devel@lists.freedesktop.org, kyungmin.park@samsung.com,
	linux-arm-kernel@lists.infradead.org
Subject: RE: [RFC][PATCH v3] DRM: add DRM Driver for Samsung SoC EXYNOS4210.
Date: Wed, 31 Aug 2011 16:33:30 +0900	[thread overview]
Message-ID: <001101cc67b0$47b63410$d7229c30$%dae@samsung.com> (raw)
In-Reply-To: <20110831020652.GA16547@dumpdata.com>

Hello, Konrad Rzeszutek Wilk.

> -----Original Message-----
> From: Konrad Rzeszutek Wilk [mailto:konrad.wilk@oracle.com]
> Sent: Wednesday, August 31, 2011 11:07 AM
> To: Rob Clark
> Cc: Inki Dae; sw0312.kim@samsung.com; linux-kernel@vger.kernel.org; dri-
> devel@lists.freedesktop.org; kyungmin.park@samsung.com; linux-arm-
> kernel@lists.infradead.org
> Subject: Re: [RFC][PATCH v3] DRM: add DRM Driver for Samsung SoC
> EXYNOS4210.
> 
> > > +       entry->vaddr = dma_alloc_writecombine(dev->dev, entry->size,
> > > +                       (dma_addr_t *)&entry->paddr, GFP_KERNEL);
> > > +       if (!entry->paddr) {
> > > +               DRM_ERROR("failed to allocate buffer.\n");
> > > +               return -ENOMEM;
> > > +       }
> > > +
> > > +       DRM_DEBUG_KMS("allocated : vaddr(0x%x), paddr(0x%x),
> size(0x%x)\n",
> > > +                       (unsigned int)entry->vaddr, entry->paddr,
entry-
> >size);
> > > +
> > > +       return 0;
> > > +}
> > > +
> > [snip]
> >
> > > diff --git a/drivers/gpu/drm/samsung/samsung_drm_buf.h
> b/drivers/gpu/drm/samsung/samsung_drm_buf.h
> > > new file mode 100644
> > > index 0000000..d6a7e95
> > > --- /dev/null
> > > +++ b/drivers/gpu/drm/samsung/samsung_drm_buf.h
> > [snip]
> > > +/**
> > > + * samsung drm buffer entry structure.
> > > + *
> > > + * @paddr: physical address of allocated memory.
> > > + * @vaddr: kernel virtual address of allocated memory.
> > > + * @size: size of allocated memory.
> > > + */
> > > +struct samsung_drm_buf_entry {
> > > +       unsigned int paddr;
> 
> This could be made 'dma_addr_t' and then you can drop all of the
> casts to (dma_addr_t *).
> 

Ok, I will correct it right now. thank you.

> .. snip..
> > > +static int samsung_drm_connector_get_modes(struct drm_connector
> *connector)
> 
> Why not make the return be 'unsigned int'?
> 

Yes, I think so, but please, see drm_connector_helper_funcs structure of
drm_crtc_helper.h. get_modes callback has int type as return.

> .. snip..
> > > +/* get detection status of display device. */
> > > +static enum drm_connector_status
> > > +samsung_drm_connector_detect(struct drm_connector *connector, bool
> force)
> > > +{
> > > +       struct samsung_drm_connector *samsung_connector =
> > > +               to_samsung_connector(connector);
> > > +       struct samsung_drm_display *display =
> > > +               samsung_drm_get_manager(samsung_connector->encoder)-
> >display;
> > > +       unsigned int ret = connector_status_unknown;
> 
> Not 'enum drm_connector_status ret = connector_status_unknown' ?
> 

Oh, you are right, I will fix up it. thank you.

> > > +
> > > +       DRM_DEBUG_KMS("%s\n", __FILE__);
> > > +
> > > +       if (display && display->is_connected) {
> > > +               if (display->is_connected())
> > > +                       ret = connector_status_connected;
> > > +               else
> > > +                       ret = connector_status_disconnected;
> > > +       }
> > > +
> > > +       return ret;
> > > +}
> 
> .. snip..
> > > +static void samsung_drm_fb_destroy(struct drm_framebuffer *fb)
> > > +{
> > > +       struct samsung_drm_fb *samsung_fb = to_samsung_fb(fb);
> > > +       int ret;
> 
> Get rid of 'ret'

It seems that it doesn't need 'ret' but it needs to check 'ret' because of
drm_gem_handle_delete().

> > > +
> > > +       DRM_DEBUG_KMS("%s\n", __FILE__);
> > > +
> > > +       drm_framebuffer_cleanup(fb);
> > > +
> > > +       if (samsung_fb->is_default) {
> > > +               ret = drm_gem_handle_delete(samsung_fb->file_priv,
> > > +                               samsung_fb->gem_handle);
> >
> > why not keep the gem buffer ptr, and do something like:
> >
> >   drm_gem_object_unreference_unlocked(samsung_fb->bo)..
> >
> > this way, you get the right behavior if someone somewhere else took a
> > ref to the gem buffer object?  And it avoids needing to keep the
> > file_priv ptr in the fb (which seems a bit strange)
> >
> >
> > > +               if (ret < 0)
> > > +                       DRM_ERROR("failed to delete
drm_gem_handle.\n");
> 
> And just do the check on the function return value here. You are not using
> the 'ret' for anything.

Yes, right. it just prints out error message because drm_gem_handle_delete
function which is mainline function doesn't leave any error message. anyway
using 'ret' is not clear. so I will remove 'ret' and check
drm_gem_handle_delete function directly instead to print out error message.

> > > +       }
> > > +
> > > +       kfree(samsung_fb);
> > > +}
> > > +
> > [snip]
> 
> Hm, so I stopped here - just realized that I am missing some of the code
> and I should look at the original patch..

Thank you for your comments. it's been very useful. please give me your
comments and advices anytime then I will be pleased.



  reply	other threads:[~2011-08-31  7:33 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-26 11:47 Inki Dae
2011-08-31  1:57 ` Rob Clark
2011-08-31  2:06   ` Konrad Rzeszutek Wilk
2011-08-31  7:33     ` Inki Dae [this message]
2011-08-31  2:28   ` Joonyoung Shim
2011-08-31  6:51   ` Inki Dae
2011-08-31 16:02     ` Rob Clark
2011-09-01 13:06       ` Inki Dae
2011-09-02  1:02         ` Kyungmin Park
2011-09-02  1:08           ` Rob Clark
2011-09-02  1:18         ` Rob Clark
2011-09-02 12:00           ` Inki Dae
2011-08-31  8:38 ` Thomas Hellstrom
2011-09-01  3:57   ` Inki Dae

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='001101cc67b0$47b63410$d7229c30$%dae@samsung.com' \
    --to=inki.dae@samsung.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=konrad.wilk@oracle.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robdclark@gmail.com \
    --cc=sw0312.kim@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome