linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rob Clark <robdclark@gmail.com>
To: Daniel Vetter <daniel@ffwll.ch>
Cc: linux-arm-msm <linux-arm-msm@vger.kernel.org>,
	Linux Fbdev development list <linux-fbdev@vger.kernel.org>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Subject: Re: [PATCH 3/3] drm/msm: hijack firmware fb's memory
Date: Tue, 11 Jul 2017 14:31:42 +0000	[thread overview]
Message-ID: <CAF6AEGsh-5SAEtSjWz9kPZRpZA7yaVOS3PiKAutMLJEdTS7ogg@mail.gmail.com> (raw)
In-Reply-To: <CAKMK7uGLEaiZcTgd=2JzO22=+uMqF7iGzeJTy5Jdf2Qsf4Ecaw@mail.gmail.com>

On Tue, Jul 11, 2017 at 10:03 AM, Daniel Vetter <daniel@ffwll.ch> wrote:
> On Tue, Jul 11, 2017 at 3:38 PM, Rob Clark <robdclark@gmail.com> wrote:
>> +static unsigned long hijack_firmware_fb(struct drm_device *dev)
>> +{
>> +       struct msm_drm_private *priv = dev->dev_private;
>> +       unsigned long size;
>> +       int i;
>> +
>> +       /* if we have simplefb/efifb, find it's aperture and hijack
>> +        * that before we kick out the firmware fb's.
>> +        *
>> +        * TODO we probably should hold registration_lock
>> +        */
>> +       for (i = 0; i < FB_MAX; i++) {
>> +               struct fb_info *fb = get_fb_info(i);
>> +
>> +               if (IS_ERR_OR_NULL(fb))
>> +                       continue;
>> +
>> +               if (!fb->apertures->count)
>> +                       continue;
>> +
>> +               /* if we find efifb or simplefb, we are about to
>> +                * kick them out, so hijack their memory:
>> +                */
>> +               if ((strcmp(fb->fix.id, "EFI VGA") = 0) ||
>> +                               (strcmp(fb->fix.id, "simple") = 0)) {
>> +
>> +                       priv->vram.paddr = fb->apertures->ranges[0].base;
>> +                       size = fb->apertures->ranges[0].size;
>> +               }
>> +
>> +               put_fb_info(fb);
>> +
>> +               if (size)
>> +                       return size;
>> +       }
>> +
>> +       return 0;
>> +}
>
> I think this should be a helper function in at least drm_fb_helper.c,
> which would then fill in both base&size in a passed-in struct. But
> yeah this seems a lot better than the old one.

Yeah, I guess we could do that.. but probably not in drm_fb_helper.c
since that is compile-time optional.  Better suggestions about where
it should live?  If you have fbdev but not DRM_FBDEV_EMULATION you
still want to do this, I think.  Otherwise we can't completely take
over the display setup by firmware (ie. no way to create
plane->state->fb).

BR,
-R


> In the future we could then also extend this with kicking out other
> firmware fb things.
> -Daniel
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> +41 (0) 79 365 57 48 - http://blog.ffwll.ch

  reply	other threads:[~2017-07-11 14:31 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-11 13:38 [PATCH 0/3] drm/msm: hijack firmware fb's memory Rob Clark
2017-07-11 13:38 ` [PATCH 1/3] drm/msm: kick out firmware framebuffer Rob Clark
2017-07-11 13:38 ` [PATCH 2/3] fbdev: fbmem: export get/put_fb_info() Rob Clark
2017-07-12  9:54   ` Bartlomiej Zolnierkiewicz
2017-07-11 13:38 ` [PATCH 3/3] drm/msm: hijack firmware fb's memory Rob Clark
2017-07-11 14:03   ` Daniel Vetter
2017-07-11 14:31     ` Rob Clark [this message]
2017-07-11 14:42       ` Daniel Vetter
2017-07-11 19:53         ` Rob Clark
2017-07-11 20:37           ` Daniel Vetter
2017-07-11 14:17   ` Chris Wilson
2017-07-11 14:34     ` Rob Clark

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=CAF6AEGsh-5SAEtSjWz9kPZRpZA7yaVOS3PiKAutMLJEdTS7ogg@mail.gmail.com \
    --to=robdclark@gmail.com \
    --cc=b.zolnierkie@samsung.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-fbdev@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;
as well as URLs for NNTP newsgroup(s).