From: "Noralf Trønnes" <noralf@tronnes.org>
To: David Herrmann <dh.herrmann@gmail.com>, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v5 6/7] drm: add SimpleDRM driver
Date: Sat, 3 Sep 2016 14:01:24 +0200 [thread overview]
Message-ID: <52b34b00-91af-9b4f-328a-3464a532e233@tronnes.org> (raw)
In-Reply-To: <20160902082245.7119-7-dh.herrmann@gmail.com>
Den 02.09.2016 10:22, skrev David Herrmann:
> The SimpleDRM driver binds to simple-framebuffer devices and provides a
> DRM/KMS API. It provides only a single CRTC+encoder+connector combination
> plus one initial mode.
>
> Userspace can create dumb-buffers which can be blit into the real
> framebuffer similar to UDL. No access to the real framebuffer is allowed
> (compared to earlier version of this driver) to avoid security issues.
> Furthermore, this way we can support arbitrary modes as long as we have a
> conversion-helper.
>
> Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
> ---
[...]
> diff --git a/drivers/gpu/drm/simpledrm/simpledrm_drv.c b/drivers/gpu/drm/simpledrm/simpledrm_drv.c
[...]
> +static int sdrm_fop_mmap(struct file *file, struct vm_area_struct *vma)
> +{
> + struct drm_file *dfile = file->private_data;
> + struct drm_device *dev = dfile->minor->dev;
> + struct drm_gem_object *obj = NULL;
> + struct drm_vma_offset_node *node;
> + int r;
> +
> + drm_vma_offset_lock_lookup(dev->vma_offset_manager);
> + node = drm_vma_offset_exact_lookup_locked(dev->vma_offset_manager,
> + vma->vm_pgoff,
> + vma_pages(vma));
> + if (likely(node)) {
> + obj = container_of(node, struct drm_gem_object, vma_node);
> + if (!kref_get_unless_zero(&obj->refcount))
> + obj = NULL;
> + }
> + drm_vma_offset_unlock_lookup(dev->vma_offset_manager);
> +
> + if (!obj)
> + return -EINVAL;
> +
> + if (!drm_vma_node_is_allowed(node, dfile)) {
I get:
drivers/gpu/drm/simpledrm/simpledrm_drv.c:320:2: warning: passing
argument 2 of ‘drm_vma_node_is_allowed’ from incompatible pointer type
[enabled by default]
dfile -> file
> + drm_gem_object_unreference_unlocked(obj);
> + return -EACCES;
> + }
> +
> + if (vma->vm_file)
> + fput(vma->vm_file);
> + vma->vm_file = get_file(obj->filp);
> + vma->vm_pgoff = 0;
> +
> + r = obj->filp->f_op->mmap(obj->filp, vma);
> + drm_gem_object_unreference_unlocked(obj);
> + return r;
> +}
[...]
> diff --git a/drivers/gpu/drm/simpledrm/simpledrm_kms.c b/drivers/gpu/drm/simpledrm/simpledrm_kms.c
[...]
> +static void sdrm_crtc_send_vblank_event(struct drm_crtc *crtc)
> +{
> + if (crtc->state && crtc->state->event) {
> + spin_lock_irq(&crtc->dev->event_lock);
> + drm_crtc_send_vblank_event(crtc, crtc->state->event);
> + spin_unlock_irq(&crtc->dev->event_lock);
> + crtc->state->event = NULL;
> + }
> +}
> +
> +void sdrm_display_pipe_update(struct drm_simple_display_pipe *pipe,
> + struct drm_plane_state *plane_state)
> +{
> + struct drm_framebuffer *dfb = pipe->plane.state->fb;
> + struct sdrm_fb *fb;
> +
> + sdrm_crtc_send_vblank_event(&pipe->crtc);
> +
> + if (dfb) {
> + fb = container_of(dfb, struct sdrm_fb, base);
> + pipe->plane.fb = dfb;
> + sdrm_dirty(fb, 0, 0, dfb->width, dfb->height);
> + }
> +}
> +
> +static void sdrm_display_pipe_enable(struct drm_simple_display_pipe *pipe,
> + struct drm_crtc_state *crtc_state)
> +{
> + sdrm_crtc_send_vblank_event(&pipe->crtc);
> +}
> +
> +static void sdrm_display_pipe_disable(struct drm_simple_display_pipe *pipe)
> +{
> + sdrm_crtc_send_vblank_event(&pipe->crtc);
> +}
> +
> +static const struct drm_simple_display_pipe_funcs sdrm_pipe_funcs = {
> + .update = sdrm_display_pipe_update,
> + .enable = sdrm_display_pipe_enable,
> + .disable = sdrm_display_pipe_disable,
> +};
The enable and disable callbacks can be removed.
This commit in drm-misc fixed the flip done timeout:
drm/simple-helpers: Always add planes to the state update
Noralf.
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2016-09-03 12:08 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-02 8:22 [PATCH v5 0/7] drm: add simpledrm driver David Herrmann
2016-09-02 8:22 ` [PATCH v5 1/7] x86/sysfb: add support for 64bit EFI lfb_base David Herrmann
2016-09-02 10:20 ` Tom Gundersen
2016-09-02 8:22 ` [PATCH v5 2/7] x86/sysfb: fix lfb_size calculation David Herrmann
2016-09-02 10:20 ` Tom Gundersen
2016-09-02 8:22 ` [PATCH v5 3/7] of/platform: expose of_platform_device_destroy() David Herrmann
2016-09-02 10:21 ` Tom Gundersen
2016-09-02 8:22 ` [PATCH v5 4/7] video: add generic framebuffer eviction David Herrmann
2016-09-02 10:21 ` Tom Gundersen
2016-09-03 12:06 ` Noralf Trønnes
2016-09-05 11:19 ` David Herrmann
2016-09-05 16:36 ` Noralf Trønnes
2016-09-02 8:22 ` [PATCH v5 5/7] drm: switch to sysfb_evict_conflicts() David Herrmann
2016-09-03 12:13 ` Noralf Trønnes
2016-09-02 8:22 ` [PATCH v5 6/7] drm: add SimpleDRM driver David Herrmann
2016-09-02 12:45 ` Tom Gundersen
2016-09-03 12:01 ` Noralf Trønnes [this message]
2016-09-03 12:05 ` David Herrmann
2016-09-05 16:39 ` Noralf Trønnes
2016-09-02 8:22 ` [PATCH v5 7/7] drm/simpledrm: add fbdev fallback support David Herrmann
2016-09-03 12:04 ` Noralf Trønnes
2016-09-03 17:15 ` Noralf Trønnes
2016-09-05 11:21 ` David Herrmann
2021-03-10 2:50 ` [PATCH v5 0/7] drm: add simpledrm driver nerdopolis
2021-03-10 9:10 ` Thomas Zimmermann
2021-03-10 13:52 ` nerdopolis
2021-03-12 3:49 ` nerdopolis
2021-03-12 8:03 ` Thomas Zimmermann
2021-03-12 13:25 ` nerdopolis
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=52b34b00-91af-9b4f-328a-3464a532e233@tronnes.org \
--to=noralf@tronnes.org \
--cc=dh.herrmann@gmail.com \
--cc=dri-devel@lists.freedesktop.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;
as well as URLs for NNTP newsgroup(s).