linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Eric Engestrom <eric.engestrom@imgtec.com>
Cc: "Daniel Vetter" <daniel@ffwll.ch>,
	"Eric Engestrom" <eric@engestrom.ch>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
	"David Airlie" <airlied@linux.ie>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	"Wei Yongjun" <yongjun_wei@trendmicro.com.cn>,
	"Daniel Vetter" <daniel.vetter@intel.com>,
	"Flora Cui" <Flora.Cui@amd.com>,
	"Gustavo Padovan" <gustavo.padovan@collabora.co.uk>,
	"Tom St Denis" <tom.stdenis@amd.com>,
	"Chunming Zhou" <David1.Zhou@amd.com>,
	"Thomas Hellstrom" <thellstrom@vmware.com>,
	"Laurent Pinchart" <laurent.pinchart+renesas@ideasonboard.com>,
	"Sinclair Yeh" <syeh@vmware.com>,
	"Xinliang Liu" <z.liuxinliang@hisilicon.com>,
	"Xinwei Kong" <kong.kongxinwei@hisilicon.com>,
	"VMware Graphics" <linux-graphics-maintainer@vmware.com>,
	"Vitaly Prosyak" <vitaly.prosyak@amd.com>,
	"Alexandre Demers" <alexandre.f.demers@gmail.com>,
	intel-gfx <intel-gfx@lists.freedesktop.org>,
	"Emily Deng" <Emily.Deng@amd.com>,
	"Colin Ian King" <colin.king@canonical.com>,
	"Junwei Zhang" <Jerry.Zhang@amd.com>,
	"Michel Dänzer" <michel.daenzer@amd.com>,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"Christian König" <christian.koenig@amd.com>
Subject: Re: [Intel-gfx] [PATCH v3] drm: move allocation out of drm_get_format_name()
Date: Thu, 10 Nov 2016 12:30:09 +0200	[thread overview]
Message-ID: <871syjfwzy.fsf@intel.com> (raw)
In-Reply-To: <2360827.8WFanMYCQ1@avalon>

On Thu, 10 Nov 2016, Laurent Pinchart <laurent.pinchart@ideasonboard.com> wrote:
> Hi Eric,
>
> On Wednesday 09 Nov 2016 16:59:31 Eric Engestrom wrote:
>> On Wednesday, 2016-11-09 14:13:40 +0100, Daniel Vetter wrote:
>> > On Wed, Nov 9, 2016 at 12:42 PM, Eric Engestrom wrote:
>> > >> Well, had to drop it again since it didn't compile:
>> > >>   CC [M]  drivers/gpu/drm/drm_blend.o
>> > >> 
>> > >> drivers/gpu/drm/drm_atomic.c: In function
>> > >> ‘drm_atomic_plane_print_state’:
>> > >> drivers/gpu/drm/drm_atomic.c:920:5: error: too few arguments to
>> > >> function ‘drm_get_format_name’> >> 
>> > >>      drm_get_format_name(fb->pixel_format));
>> > >>      ^~~~~~~~~~~~~~~~~~~
>> > >> 
>> > >> In file included from ./include/drm/drmP.h:71:0,
>> > >> 
>> > >>                  from drivers/gpu/drm/drm_atomic.c:29:
>> > >> ./include/drm/drm_fourcc.h:65:7: note: declared here
>> > >> 
>> > >>  char *drm_get_format_name(uint32_t format, struct drm_format_name_buf
>> > >>  *buf);> >>  
>> > >>        ^~~~~~~~~~~~~~~~~~~
>> > >> 
>> > >> Can you pls rebase onto drm-misc or linux-next or something?
>> > > 
>> > > That was based on airlied/drm-next (last fetched on Sunday I think),
>> > > I can rebase it on drm-misc if it helps, but it seems older than
>> > > drm-next. Should I just rebase on top of current head of drm-next?
>> > 
>> > It needs to be drm-misc (linux-next doesn't have it yet) due to the
>> > new atomic debug work that we just landed. I'm working on drm-tip as a
>> > drm local integration tree to ease pains like these a bit, but that
>> > doesn't really exist yet.
>> 
>> I'm confused as to how the different trees and branches merge back to
>> Torvalds' tree (I'm interested in particular in drm), and I'm not sure
>> which branch you want me to rebase on in the drm-misc tree [1],
>> especially since all of them are older than drm-next [2].
>> 
>> I'll try to rebase on drm-misc-fixes (currently at 4da5caa6a6f82cda3193)
>> as it sounds about right, but it doesn't apply at all, so it'll take
>> a little while.
>
> While at it, could you make the function return a const char * ?

I thought I mentioned that too, though I didn't insist.

> By the way, while this is an improvement over the current situation in that it 
> fixes the missing kfree() issue, I wonder whether the problem we're trying to 
> solve should be addressed at a more global level.

Maybe, but let's not block this one!

> The issue here is that printk can't format the fourcc as a string by itself. 
> There's a bunch of places in the kernel where a similar formatting problem 
> occurs. In a few occasions it has been solved by extending printk with 
> additional format specifiers (such as for MAC/IP addresses, GUIDs, various 
> kind of device names, ...). DRM fourccs are probably too DRM specific to be 
> worth a format specifier, but I wonder whether we could introduce a new 
> specifier that takes a function pointer as a formatting helper. Another 
> similarly crazy option would be a format specifier for strings that would free 
> the passed pointer after printing it.

I think there are too many non-standard format specifiers already. I
can't review the non-standard format strings without looking at
Documentation/prink-formats.txt first. The formatting hook would be a
generic alternative, but that's more than a little scary from the
security standpoint. And what if the hook has to allocate memory? Can't
do that in atomic contexts.

BR,
Jani.


>
>> Could you give me a quick explanation or point me to a doc/page that
>> explains how the various trees and branches get merged?
>> I googled a bit and found this doc [4] by Jani, but it doesn't mention
>> drm-misc for instance, so I'm not sure how up-to-date and
>> non-intel-specific it is.
>> 
>> Looking at this page, something just occurred to me: did you mean
>> drm-fixes [3], instead of one of the branches on drm-misc?
>> 
>> Cheers,
>>   Eric
>> 
>> [1] git://anongit.freedesktop.org/drm/drm-misc
>> [2] git://people.freedesktop.org/~airlied/linux drm-next
>> [2] git://people.freedesktop.org/~airlied/linux drm-fixes
>> [3] https://01.org/linuxgraphics/gfx-docs/maintainer-tools/drm-intel.html

-- 
Jani Nikula, Intel Open Source Technology Center

  reply	other threads:[~2016-11-10 10:30 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20161105012344.GA28349@engestrom.ch>
2016-11-05  1:33 ` [PATCH] drm: move allocation out of drm_get_format_name() Eric Engestrom
2016-11-05  6:56   ` Thomas Hellstrom
2016-11-05 12:11   ` Christian König
2016-11-05 16:38     ` Eric Engestrom
2016-11-05 16:49       ` Rob Clark
2016-11-06  9:47         ` Christian König
2016-11-06 13:03           ` Rob Clark
2016-11-07  0:47             ` Eric Engestrom
2016-11-07  0:48               ` [PATCH v2] " Eric Engestrom
2016-11-07  7:46                 ` Christian König
2016-11-07  8:10                 ` Jani Nikula
2016-11-07 17:12                   ` Eric Engestrom
2016-11-07 17:38                     ` Jani Nikula
2016-11-08 10:15                       ` [Intel-gfx] " Daniel Vetter
2016-11-09  0:17                         ` [PATCH v3] " Eric Engestrom
2016-11-09  1:09                           ` [Intel-gfx] " Daniel Vetter
2016-11-09  1:13                             ` Daniel Vetter
2016-11-09 11:42                               ` Eric Engestrom
2016-11-09 13:13                                 ` Daniel Vetter
2016-11-09 16:59                                   ` Eric Engestrom
2016-11-10 10:03                                     ` Laurent Pinchart
2016-11-10 10:30                                       ` Jani Nikula [this message]
2016-11-10 10:59                                         ` Laurent Pinchart
2016-11-10 11:03                                           ` Jani Nikula
2016-11-11  9:26                                     ` Daniel Vetter
2016-11-12  1:12                                       ` [PATCH v4] " Eric Engestrom
2016-11-07 14:45                 ` [PATCH v2] " Rob Clark
2016-11-07 18:12                 ` Sinclair Yeh

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=871syjfwzy.fsf@intel.com \
    --to=jani.nikula@intel.com \
    --cc=David1.Zhou@amd.com \
    --cc=Emily.Deng@amd.com \
    --cc=Flora.Cui@amd.com \
    --cc=Jerry.Zhang@amd.com \
    --cc=airlied@linux.ie \
    --cc=alexander.deucher@amd.com \
    --cc=alexandre.f.demers@gmail.com \
    --cc=christian.koenig@amd.com \
    --cc=colin.king@canonical.com \
    --cc=daniel.vetter@intel.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=eric.engestrom@imgtec.com \
    --cc=eric@engestrom.ch \
    --cc=gustavo.padovan@collabora.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=kong.kongxinwei@hisilicon.com \
    --cc=laurent.pinchart+renesas@ideasonboard.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-graphics-maintainer@vmware.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michel.daenzer@amd.com \
    --cc=syeh@vmware.com \
    --cc=thellstrom@vmware.com \
    --cc=tom.stdenis@amd.com \
    --cc=vitaly.prosyak@amd.com \
    --cc=yongjun_wei@trendmicro.com.cn \
    --cc=z.liuxinliang@hisilicon.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;
as well as URLs for NNTP newsgroup(s).