* [RFC] Move i915 ascii85 functions to linux/ascii85.h
@ 2018-01-26 20:59 Jordan Crouse
2018-01-26 20:59 ` [PATCH] include: Move ascii85 functions from i915 " Jordan Crouse
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Jordan Crouse @ 2018-01-26 20:59 UTC (permalink / raw)
To: intel-gfx; +Cc: freedreno, dri-devel, linux-arm-msm
I've been working on a crash dump utility for the drm/msm GPU driver
to get the useful GPU information out after a hang. Taking inspiration
from the i915 driver I thought it was very smart to use ascii85 format
to encode the binary buffers and other bits. This patch moves the two
very simple functions to encode binaries as ascii85 from the i915
driver to a linux header to be enjoyed by all.
I debated if it was better to move them to drm/ or go all the way and
obviously I picked all the way, but if the owners and maintainers feel
like this is something we want to keep closer to home then by all means
lets do what feels best.
Suggestions and flames welcome. Coming immediately after will be the drm/msm
stack that uses this in anger.
Jordan Crouse (1):
include: Move ascii85 functions from i915 to linux/ascii85.h
drivers/gpu/drm/i915/i915_gpu_error.c | 24 +---------------
include/linux/ascii85.h | 52 +++++++++++++++++++++++++++++++++++
2 files changed, 53 insertions(+), 23 deletions(-)
create mode 100644 include/linux/ascii85.h
--
1.9.1
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH] include: Move ascii85 functions from i915 to linux/ascii85.h 2018-01-26 20:59 [RFC] Move i915 ascii85 functions to linux/ascii85.h Jordan Crouse @ 2018-01-26 20:59 ` Jordan Crouse 2018-01-26 21:13 ` Chris Wilson 2018-01-26 21:19 ` Chris Wilson 2018-01-26 21:22 ` ✓ Fi.CI.BAT: success for " Patchwork 2018-01-26 22:10 ` ✗ Fi.CI.IGT: failure " Patchwork 2 siblings, 2 replies; 6+ messages in thread From: Jordan Crouse @ 2018-01-26 20:59 UTC (permalink / raw) To: intel-gfx; +Cc: linux-arm-msm, freedreno, dri-devel The i915 DRM driver very cleverly used ascii85 encoding for their GPU state file. Move the encode functions to a general header file to support other drivers that might be interested in the same functionality. Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org> --- drivers/gpu/drm/i915/i915_gpu_error.c | 24 +--------------- include/linux/ascii85.h | 52 +++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 23 deletions(-) create mode 100644 include/linux/ascii85.h diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c index 48418fb..2588f37 100644 --- a/drivers/gpu/drm/i915/i915_gpu_error.c +++ b/drivers/gpu/drm/i915/i915_gpu_error.c @@ -31,6 +31,7 @@ #include <linux/stop_machine.h> #include <linux/zlib.h> #include <drm/drm_print.h> +#include <linux/ascii85.h> #include "i915_drv.h" @@ -501,29 +502,6 @@ void i915_error_printf(struct drm_i915_error_state_buf *e, const char *f, ...) va_end(args); } -static int -ascii85_encode_len(int len) -{ - return DIV_ROUND_UP(len, 4); -} - -static bool -ascii85_encode(u32 in, char *out) -{ - int i; - - if (in == 0) - return false; - - out[5] = '\0'; - for (i = 5; i--; ) { - out[i] = '!' + in % 85; - in /= 85; - } - - return true; -} - static void print_error_obj(struct drm_i915_error_state_buf *m, struct intel_engine_cs *engine, const char *name, diff --git a/include/linux/ascii85.h b/include/linux/ascii85.h new file mode 100644 index 0000000..7ee39f9 --- /dev/null +++ b/include/linux/ascii85.h @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2008 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#ifndef _ASCII85_H_ +#define _ASCII85_H_ + +#include <linux/kernel.h> + +static inline int +ascii85_encode_len(int len) +{ + return DIV_ROUND_UP(len, 4); +} + +static inline bool +ascii85_encode(u32 in, char *out) +{ + int i; + + if (in == 0) + return false; + + out[5] = '\0'; + for (i = 5; i--; ) { + out[i] = '!' + in % 85; + in /= 85; + } + + return true; +} + +#endif -- 1.9.1 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] include: Move ascii85 functions from i915 to linux/ascii85.h 2018-01-26 20:59 ` [PATCH] include: Move ascii85 functions from i915 " Jordan Crouse @ 2018-01-26 21:13 ` Chris Wilson 2018-01-26 21:19 ` Chris Wilson 1 sibling, 0 replies; 6+ messages in thread From: Chris Wilson @ 2018-01-26 21:13 UTC (permalink / raw) To: Jordan Crouse, intel-gfx; +Cc: linux-arm-msm, freedreno, dri-devel Quoting Jordan Crouse (2018-01-26 20:59:22) > The i915 DRM driver very cleverly used ascii85 encoding for their > GPU state file. Move the encode functions to a general header file to > support other drivers that might be interested in the same > functionality. > > Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org> > --- > drivers/gpu/drm/i915/i915_gpu_error.c | 24 +--------------- > include/linux/ascii85.h | 52 +++++++++++++++++++++++++++++++++++ > 2 files changed, 53 insertions(+), 23 deletions(-) > create mode 100644 include/linux/ascii85.h > > diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c > index 48418fb..2588f37 100644 > --- a/drivers/gpu/drm/i915/i915_gpu_error.c > +++ b/drivers/gpu/drm/i915/i915_gpu_error.c > @@ -31,6 +31,7 @@ > #include <linux/stop_machine.h> > #include <linux/zlib.h> > #include <drm/drm_print.h> > +#include <linux/ascii85.h> > > #include "i915_drv.h" > > @@ -501,29 +502,6 @@ void i915_error_printf(struct drm_i915_error_state_buf *e, const char *f, ...) > va_end(args); > } > > -static int > -ascii85_encode_len(int len) > -{ > - return DIV_ROUND_UP(len, 4); > -} > - > -static bool > -ascii85_encode(u32 in, char *out) > -{ > - int i; > - > - if (in == 0) > - return false; > - > - out[5] = '\0'; > - for (i = 5; i--; ) { > - out[i] = '!' + in % 85; > - in /= 85; > - } > - > - return true; > -} > - > static void print_error_obj(struct drm_i915_error_state_buf *m, > struct intel_engine_cs *engine, > const char *name, > diff --git a/include/linux/ascii85.h b/include/linux/ascii85.h > new file mode 100644 > index 0000000..7ee39f9 > --- /dev/null > +++ b/include/linux/ascii85.h > @@ -0,0 +1,52 @@ > +/* > + * Copyright (c) 2008 Intel Corporation > + * > + * Permission is hereby granted, free of charge, to any person obtaining a > + * copy of this software and associated documentation files (the "Software"), > + * to deal in the Software without restriction, including without limitation > + * the rights to use, copy, modify, merge, publish, distribute, sublicense, > + * and/or sell copies of the Software, and to permit persons to whom the > + * Software is furnished to do so, subject to the following conditions: > + * > + * The above copyright notice and this permission notice (including the next > + * paragraph) shall be included in all copies or substantial portions of the > + * Software. > + * > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, > + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL > + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER > + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING > + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS > + * IN THE SOFTWARE. > + */ > + > +#ifndef _ASCII85_H_ > +#define _ASCII85_H_ > + > +#include <linux/kernel.h> > + > +static inline int > +ascii85_encode_len(int len) > +{ > + return DIV_ROUND_UP(len, 4); > +} Use longs for generic stuff. > + > +static inline bool > +ascii85_encode(u32 in, char *out) > +{ > + int i; > + > + if (in == 0) > + return false; > + > + out[5] = '\0'; > + for (i = 5; i--; ) { > + out[i] = '!' + in % 85; > + in /= 85; > + } > + > + return true; > +} I think you'll want to capture the special case 0 == 'z' in the common routines. { char buf[ASCII85_BUFSZ]; int i, len; len = ascii85_encode_len(PAGE_SIZE); for (i = 0; i < len; i++) err_puts(m, ascii85_encode(obj->pages[page][i], buf)); } Looks reasonable for the caller, so #define ASCII85_BUFSZ 6 static inline const char * ascii85_encode(u32 in, char *out) { int i; /* check whether out[0] = 'z'; out[1] = '\0'; generates better code */ if (in == 0) return "z"; out[5] = '\0'; for (i = 5; i--; ) { out[i] = '!' + in % 85; in /= 85; } return out; } -Chris _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] include: Move ascii85 functions from i915 to linux/ascii85.h 2018-01-26 20:59 ` [PATCH] include: Move ascii85 functions from i915 " Jordan Crouse 2018-01-26 21:13 ` Chris Wilson @ 2018-01-26 21:19 ` Chris Wilson 1 sibling, 0 replies; 6+ messages in thread From: Chris Wilson @ 2018-01-26 21:19 UTC (permalink / raw) To: Jordan Crouse, intel-gfx; +Cc: linux-arm-msm, freedreno, dri-devel Quoting Jordan Crouse (2018-01-26 20:59:22) > The i915 DRM driver very cleverly used ascii85 encoding for their All gfx drivers must eventually become PostScript. > GPU state file. Move the encode functions to a general header file to > support other drivers that might be interested in the same > functionality. > > Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org> > --- > diff --git a/include/linux/ascii85.h b/include/linux/ascii85.h > new file mode 100644 > index 0000000..7ee39f9 > --- /dev/null > +++ b/include/linux/ascii85.h > @@ -0,0 +1,52 @@ > +/* > + * Copyright (c) 2008 Intel Corporation Just cut this down to /* * SPDX-License-Identifier: GPL-2.0 * * Copyright (c) 2008 Intel Corporation * Copyright (c) 2018 My Name Here */ Fortunately ideas themselves are not copyrightable, otherwise Adobe has a strong claim to ownership. -Chris _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply [flat|nested] 6+ messages in thread
* ✓ Fi.CI.BAT: success for include: Move ascii85 functions from i915 to linux/ascii85.h 2018-01-26 20:59 [RFC] Move i915 ascii85 functions to linux/ascii85.h Jordan Crouse 2018-01-26 20:59 ` [PATCH] include: Move ascii85 functions from i915 " Jordan Crouse @ 2018-01-26 21:22 ` Patchwork 2018-01-26 22:10 ` ✗ Fi.CI.IGT: failure " Patchwork 2 siblings, 0 replies; 6+ messages in thread From: Patchwork @ 2018-01-26 21:22 UTC (permalink / raw) To: Jordan Crouse; +Cc: intel-gfx == Series Details == Series: include: Move ascii85 functions from i915 to linux/ascii85.h URL : https://patchwork.freedesktop.org/series/37211/ State : success == Summary == Series 37211v1 include: Move ascii85 functions from i915 to linux/ascii85.h https://patchwork.freedesktop.org/api/1.0/series/37211/revisions/1/mbox/ Test debugfs_test: Subgroup read_all_entries: dmesg-fail -> DMESG-WARN (fi-elk-e7500) fdo#103989 pass -> INCOMPLETE (fi-snb-2520m) fdo#103713 fdo#103989 https://bugs.freedesktop.org/show_bug.cgi?id=103989 fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713 fi-bdw-5557u total:288 pass:267 dwarn:0 dfail:0 fail:0 skip:21 time:425s fi-bdw-gvtdvm total:288 pass:264 dwarn:0 dfail:0 fail:0 skip:24 time:432s fi-blb-e6850 total:288 pass:223 dwarn:1 dfail:0 fail:0 skip:64 time:374s fi-bsw-n3050 total:288 pass:242 dwarn:0 dfail:0 fail:0 skip:46 time:488s fi-bwr-2160 total:288 pass:183 dwarn:0 dfail:0 fail:0 skip:105 time:282s fi-bxt-dsi total:288 pass:258 dwarn:0 dfail:0 fail:0 skip:30 time:483s fi-bxt-j4205 total:288 pass:259 dwarn:0 dfail:0 fail:0 skip:29 time:486s fi-byt-j1900 total:288 pass:253 dwarn:0 dfail:0 fail:0 skip:35 time:472s fi-byt-n2820 total:288 pass:249 dwarn:0 dfail:0 fail:0 skip:39 time:463s fi-cfl-s2 total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:577s fi-cnl-y2 total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:533s fi-elk-e7500 total:224 pass:168 dwarn:10 dfail:0 fail:0 skip:45 fi-gdg-551 total:288 pass:179 dwarn:0 dfail:0 fail:1 skip:108 time:278s fi-glk-1 total:288 pass:260 dwarn:0 dfail:0 fail:0 skip:28 time:516s fi-hsw-4770 total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:395s fi-hsw-4770r total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:402s fi-ilk-650 total:288 pass:228 dwarn:0 dfail:0 fail:0 skip:60 time:417s fi-ivb-3520m total:288 pass:259 dwarn:0 dfail:0 fail:0 skip:29 time:461s fi-ivb-3770 total:288 pass:255 dwarn:0 dfail:0 fail:0 skip:33 time:417s fi-kbl-7500u total:288 pass:263 dwarn:1 dfail:0 fail:0 skip:24 time:461s fi-kbl-7560u total:288 pass:269 dwarn:0 dfail:0 fail:0 skip:19 time:499s fi-kbl-7567u total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:457s fi-kbl-r total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:507s fi-pnv-d510 total:288 pass:222 dwarn:1 dfail:0 fail:0 skip:65 time:585s fi-skl-6260u total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:432s fi-skl-6600u total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:515s fi-skl-6700hq total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:527s fi-skl-6700k2 total:288 pass:264 dwarn:0 dfail:0 fail:0 skip:24 time:485s fi-skl-6770hq total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:485s fi-skl-guc total:288 pass:260 dwarn:0 dfail:0 fail:0 skip:28 time:421s fi-skl-gvtdvm total:288 pass:265 dwarn:0 dfail:0 fail:0 skip:23 time:429s fi-snb-2520m total:3 pass:2 dwarn:0 dfail:0 fail:0 skip:0 fi-snb-2600 total:288 pass:248 dwarn:0 dfail:0 fail:0 skip:40 time:408s Blacklisted hosts: fi-glk-dsi total:288 pass:258 dwarn:0 dfail:0 fail:0 skip:30 time:479s 59275f1cec1d31adab39ddb6ab948519ac8ddffb drm-tip: 2018y-01m-26d-13h-05m-14s UTC integration manifest f8cd6a723439 include: Move ascii85 functions from i915 to linux/ascii85.h == Logs == For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7795/issues.html _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply [flat|nested] 6+ messages in thread
* ✗ Fi.CI.IGT: failure for include: Move ascii85 functions from i915 to linux/ascii85.h 2018-01-26 20:59 [RFC] Move i915 ascii85 functions to linux/ascii85.h Jordan Crouse 2018-01-26 20:59 ` [PATCH] include: Move ascii85 functions from i915 " Jordan Crouse 2018-01-26 21:22 ` ✓ Fi.CI.BAT: success for " Patchwork @ 2018-01-26 22:10 ` Patchwork 2 siblings, 0 replies; 6+ messages in thread From: Patchwork @ 2018-01-26 22:10 UTC (permalink / raw) To: Jordan Crouse; +Cc: intel-gfx == Series Details == Series: include: Move ascii85 functions from i915 to linux/ascii85.h URL : https://patchwork.freedesktop.org/series/37211/ State : failure == Summary == Warning: bzip CI_DRM_3686/shard-glkb6/results14.json.bz2 wasn't in correct JSON format Test perf: Subgroup oa-exponents: pass -> FAIL (shard-apl) fdo#102254 Subgroup enable-disable: fail -> PASS (shard-apl) fdo#103715 Test kms_flip: Subgroup 2x-plain-flip-fb-recreate-interruptible: pass -> FAIL (shard-hsw) Test kms_frontbuffer_tracking: Subgroup fbc-1p-offscren-pri-shrfb-draw-blt: fail -> PASS (shard-snb) fdo#101623 Test kms_mmap_write_crc: skip -> PASS (shard-apl) fdo#102254 https://bugs.freedesktop.org/show_bug.cgi?id=102254 fdo#103715 https://bugs.freedesktop.org/show_bug.cgi?id=103715 fdo#101623 https://bugs.freedesktop.org/show_bug.cgi?id=101623 shard-apl total:2838 pass:1751 dwarn:1 dfail:0 fail:21 skip:1064 time:12674s shard-hsw total:2838 pass:1735 dwarn:1 dfail:0 fail:11 skip:1090 time:12105s shard-snb total:2838 pass:1330 dwarn:1 dfail:0 fail:10 skip:1497 time:6663s Blacklisted hosts: shard-kbl total:2807 pass:1841 dwarn:1 dfail:0 fail:21 skip:942 time:9314s == Logs == For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7795/shards.html _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-01-26 22:10 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2018-01-26 20:59 [RFC] Move i915 ascii85 functions to linux/ascii85.h Jordan Crouse 2018-01-26 20:59 ` [PATCH] include: Move ascii85 functions from i915 " Jordan Crouse 2018-01-26 21:13 ` Chris Wilson 2018-01-26 21:19 ` Chris Wilson 2018-01-26 21:22 ` ✓ Fi.CI.BAT: success for " Patchwork 2018-01-26 22:10 ` ✗ Fi.CI.IGT: failure " Patchwork
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox