[Intel-gfx] [PATCH 1/9] drm: Add drm_mode_debug_printmodeline_raw

Tvrtko Ursulin tvrtko.ursulin at linux.intel.com
Wed Apr 27 12:58:42 UTC 2016


On 27/04/16 13:35, Jani Nikula wrote:
> On Wed, 27 Apr 2016, Tvrtko Ursulin <tvrtko.ursulin at linux.intel.com> wrote:
>> From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
>>
>> Purpose is to enable drivers to print out just the mode
>> string with their own formatting.
>
> Some alternatives that preserve the use of a single printk(), avoiding
> garbled console output due to races (as discussed on intel-gfx in reply
> to the cover letter [1]):
>
> 1) Simply add a prefix string parameter to use in
>     drm_mode_debug_printmodeline(). Really easy and covers most
>     needs. Maybe wrap this in a macro to use the caller's function name.
>
> 2) Model drm_mode_debug_printmodeline() after drm_ut_debug_printk(),
>     adding a mode parameter. Maybe wrap this in a macro to use the
>     caller's function name.

This sounds good to me...

> 3) Add char *drm_mode_line(mode) that kmallocs a mode line string, or a
>     drm_mode_line(mode, buf, bufsize) that prints the mode string to a
>     statically allocated buffer.

...but it only solved the modeline part of the story. Unless something 
like 3), which I specifically wanted to avoid. String handling etc.. 
best to be avoided in general if possible and more so for debug code 
only. Any potential bug in those is best avoided if they do not exist. 
And some of them log external input so even more so.

Something like debug_start/debug_print/debug_end would solve all that 
but that would be bigger and core.

I'll try to do 2) and see what to do with the rest...

Regards,

Tvrtko


More information about the Intel-gfx mailing list