linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/13] Address issues with PDF output at media uAPI docs
@ 2020-12-10 10:55 Mauro Carvalho Chehab
  2020-12-10 10:55 ` [PATCH 01/13] docs: conf.py: fix sphinx version detection for margin set Mauro Carvalho Chehab
                   ` (12 more replies)
  0 siblings, 13 replies; 23+ messages in thread
From: Mauro Carvalho Chehab @ 2020-12-10 10:55 UTC (permalink / raw)
  To: Linux Media Mailing List
  Cc: linuxarm, mauro.chehab, Mauro Carvalho Chehab, linux-doc,
	linux-kernel, Jonathan Corbet

Keeping LaTeX/PDF output working is hard, as Sphinx require lots of
manual adjusts, as it has several troubles:

- It can't compute properly table cell sizes when literals are used;
- It doesn't break long literal words with hiphens when needed;
- It easily write things out of tables and out of pages;
- It doesn't have any tag that would allow changing the font size;
- It doesn't re-scale tables.

So, from time to time, a manual (hard) work is needed in order to
check what broke, fixing them.

This series address most of such issues that happen at the uAPI
media documents.

Jon,

Patch 1 actually fixes a bug at conf.py.  The remaining patches
depend on it. My plan is to have this series merged for 5.11.

IMO, the best would be to have this patch applied via my tree,
but I'm OK if you prefer to merge this one via yours.

Regards,
Mauro

Mauro Carvalho Chehab (13):
  docs: conf.py: fix sphinx version detection for margin set
  media: colorspaces-details.rst: drop tabularcolumns
  media: control.rst: use a table for V4L2_CID_POWER_LINE
  media: docs: sliced-vbi: fix V4L2_SLICED_WSS_625 docs
  media: ext-ctrls-codec-stateless.rst: change a FWHT flag description
  media: ext-ctrls-codec.rst: add a missing profile description
  media: ext-ctrls-codec.rst: simplify a few tables
  media: ext-ctrls-jpeg.rst: cleanup V4L2_CID_JPEG_COMPRESSION_QUALITY
    text
  media: docs: pixfmt: use section titles for bayer formats
  media: buffer.rst: fix a PDF output issue
  media: ext-ctrls-codec-stateless.rst: fix an H-264 table format
  media: pixfmt-yuv-planar.rst: fix PDF OUTPUT
  media: docs: uAPI: fix table output in LaTeX/PDF format

 Documentation/conf.py                         |   3 +-
 .../media/cec/cec-ioc-adap-g-caps.rst         |   4 +-
 .../media/cec/cec-ioc-adap-g-conn-info.rst    |   6 +-
 .../media/cec/cec-ioc-adap-g-log-addrs.rst    |  12 +-
 .../media/cec/cec-ioc-dqevent.rst             |  10 +-
 .../media/cec/cec-ioc-g-mode.rst              |   4 +-
 .../media/cec/cec-ioc-receive.rst             |   8 +-
 .../userspace-api/media/dvb/fe-type-t.rst     |   2 +-
 .../media/mediactl/media-ioc-device-info.rst  |   2 +-
 .../mediactl/media-ioc-enum-entities.rst      |   2 +-
 .../media/mediactl/media-ioc-enum-links.rst   |   6 +-
 .../media/mediactl/media-ioc-g-topology.rst   |  12 +-
 .../media/mediactl/media-types.rst            |   4 +-
 .../userspace-api/media/rc/rc-tables.rst      |   2 +-
 .../userspace-api/media/v4l/buffer.rst        |  22 +-
 .../media/v4l/colorspaces-details.rst         |  31 --
 .../userspace-api/media/v4l/control.rst       |  13 +-
 .../userspace-api/media/v4l/dev-meta.rst      |   2 +-
 .../userspace-api/media/v4l/dev-raw-vbi.rst   |   4 +-
 .../userspace-api/media/v4l/dev-rds.rst       |   4 +-
 .../userspace-api/media/v4l/dev-sdr.rst       |   2 +-
 .../media/v4l/dev-sliced-vbi.rst              |  50 +--
 .../userspace-api/media/v4l/dev-subdev.rst    |   6 +-
 .../userspace-api/media/v4l/diff-v4l.rst      |  10 +-
 .../media/v4l/ext-ctrls-camera.rst            |  14 +-
 .../media/v4l/ext-ctrls-codec-stateless.rst   | 181 +++++++++--
 .../media/v4l/ext-ctrls-codec.rst             | 288 ++++++++++++------
 .../userspace-api/media/v4l/ext-ctrls-dv.rst  |   2 +-
 .../media/v4l/ext-ctrls-flash.rst             |   7 +-
 .../media/v4l/ext-ctrls-jpeg.rst              |  13 +-
 .../userspace-api/media/v4l/field-order.rst   |   2 +-
 .../media/v4l/pixfmt-compressed.rst           |  12 +-
 .../media/v4l/pixfmt-packed-yuv.rst           |  26 +-
 .../media/v4l/pixfmt-reserved.rst             |  10 +-
 .../userspace-api/media/v4l/pixfmt-rgb.rst    |   9 +-
 .../media/v4l/pixfmt-srggb10-ipu3.rst         |  12 +-
 .../media/v4l/pixfmt-srggb10p.rst             |   2 +-
 .../media/v4l/pixfmt-srggb12p.rst             |   2 +-
 .../media/v4l/pixfmt-srggb14.rst              |   2 +
 .../media/v4l/pixfmt-srggb14p.rst             |   6 +-
 .../media/v4l/pixfmt-srggb16.rst              |   2 +
 .../userspace-api/media/v4l/pixfmt-srggb8.rst |   3 +-
 .../media/v4l/pixfmt-v4l2-mplane.rst          |   4 +-
 .../userspace-api/media/v4l/pixfmt-v4l2.rst   |   4 +-
 .../media/v4l/pixfmt-yuv-luma.rst             |  10 +
 .../media/v4l/pixfmt-yuv-planar.rst           |  34 ++-
 .../media/v4l/subdev-formats.rst              |  26 +-
 .../media/v4l/v4l2-selection-flags.rst        |  14 +-
 .../media/v4l/v4l2-selection-targets.rst      |  12 +-
 .../media/v4l/vidioc-create-bufs.rst          |   2 +-
 .../media/v4l/vidioc-cropcap.rst              |   4 +-
 .../media/v4l/vidioc-dbg-g-chip-info.rst      |   6 +-
 .../media/v4l/vidioc-dbg-g-register.rst       |   4 +-
 .../media/v4l/vidioc-decoder-cmd.rst          |   8 +-
 .../media/v4l/vidioc-dqevent.rst              |  21 +-
 .../media/v4l/vidioc-dv-timings-cap.rst       |   6 +-
 .../media/v4l/vidioc-encoder-cmd.rst          |   6 +-
 .../media/v4l/vidioc-enum-dv-timings.rst      |   2 +-
 .../media/v4l/vidioc-enum-fmt.rst             |  10 +-
 .../media/v4l/vidioc-enum-frameintervals.rst  |   7 +-
 .../media/v4l/vidioc-enum-framesizes.rst      |   8 +-
 .../media/v4l/vidioc-enum-freq-bands.rst      |   4 +-
 .../media/v4l/vidioc-enuminput.rst            |   8 +-
 .../media/v4l/vidioc-enumoutput.rst           |   6 +-
 .../media/v4l/vidioc-enumstd.rst              |   6 +-
 .../userspace-api/media/v4l/vidioc-expbuf.rst |   2 +-
 .../media/v4l/vidioc-g-audio.rst              |   6 +-
 .../media/v4l/vidioc-g-audioout.rst           |   2 +-
 .../userspace-api/media/v4l/vidioc-g-crop.rst |   2 +-
 .../userspace-api/media/v4l/vidioc-g-ctrl.rst |   2 +-
 .../media/v4l/vidioc-g-dv-timings.rst         |  20 +-
 .../userspace-api/media/v4l/vidioc-g-edid.rst |   2 +-
 .../media/v4l/vidioc-g-enc-index.rst          |   6 +-
 .../media/v4l/vidioc-g-ext-ctrls.rst          |  20 +-
 .../userspace-api/media/v4l/vidioc-g-fbuf.rst |   6 +-
 .../userspace-api/media/v4l/vidioc-g-fmt.rst  |   2 +-
 .../media/v4l/vidioc-g-frequency.rst          |   2 +-
 .../media/v4l/vidioc-g-jpegcomp.rst           |   4 +-
 .../media/v4l/vidioc-g-modulator.rst          |   9 +-
 .../userspace-api/media/v4l/vidioc-g-parm.rst |  11 +-
 .../media/v4l/vidioc-g-priority.rst           |   2 +-
 .../media/v4l/vidioc-g-selection.rst          |   2 +-
 .../media/v4l/vidioc-g-sliced-vbi-cap.rst     |  29 +-
 .../media/v4l/vidioc-g-tuner.rst              |  12 +-
 .../media/v4l/vidioc-querycap.rst             |   8 +-
 .../media/v4l/vidioc-queryctrl.rst            |  21 +-
 .../media/v4l/vidioc-reqbufs.rst              |  14 +-
 .../media/v4l/vidioc-s-hw-freq-seek.rst       |   2 +-
 .../v4l/vidioc-subdev-enum-frame-interval.rst |   2 +-
 .../v4l/vidioc-subdev-enum-frame-size.rst     |   2 +-
 .../v4l/vidioc-subdev-enum-mbus-code.rst      |  14 +-
 .../media/v4l/vidioc-subdev-g-crop.rst        |   2 +-
 .../media/v4l/vidioc-subdev-g-fmt.rst         |   4 +-
 .../v4l/vidioc-subdev-g-frame-interval.rst    |   2 +-
 .../media/v4l/vidioc-subdev-g-selection.rst   |   2 +-
 .../media/v4l/vidioc-subdev-querycap.rst      |   4 +-
 .../media/v4l/vidioc-subscribe-event.rst      |   4 +-
 97 files changed, 802 insertions(+), 446 deletions(-)

-- 
2.29.2



^ permalink raw reply	[flat|nested] 23+ messages in thread
* Re: [PATCH RFC v2] docs: experimental: build PDF with rst2pdf
@ 2020-12-28 17:19 Nícolas F. R. A. Prado
  0 siblings, 0 replies; 23+ messages in thread
From: Nícolas F. R. A. Prado @ 2020-12-28 17:19 UTC (permalink / raw)
  To: corbet
  Cc: linux-doc, linux-kbuild, linux-kernel, linux-media, masahiroy,
	mchehab+huawei, mchehab, michal.lkml

On Fri, Dec 11, 2020 at 05:03:50PM -0700, Jonathan Corbet wrote:
> The right solution is probably something like this:
> 
> 	try:
> 	    import rst2pdf
> 	    extensions.append('rst2pdf.pdfbuilder')
> 	except ModuleNotFoundError:
> 	    pass # no rst2pdf for you

I tested it, but it still fails, and the error message is even more cryptic:

	Sphinx error:
	Builder name pdf not registered or available through entry point
	make[1]: *** [Documentation/Makefile:120: rst2pdf] Error 2
	make: *** [Makefile:1663: rst2pdf] Error 2

It seems to me that the missing dependency should be treated in the Makefile
target rather than in Sphinx. Looking through the Makefile, I took inspiration
from the latex version and did the following:

	HAVE_RST2PDF := $(shell if python -c "import rst2pdf" >/dev/null 2>&1; then echo 1; else echo 0; fi)

	 
	ifeq ($(HAVE_RST2PDF),0)

	rst2pdf:
	       $(warning The 'rst2pdf' python module was not found. Make sure you have it installed to produce PDF output.)
	       @echo "  SKIP    Sphinx $@ target."

	else # HAVE_RST2PDF

	rst2pdf:
	       @$(srctree)/scripts/sphinx-pre-install --version-check
	       @+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,pdf,$(var),pdf,$(var)))

	endif # HAVE_RST2PDF

With this, the following message is shown in case it isn't installed:

	Documentation/Makefile:122: The 'rst2pdf' python module was not found. Make sure you have it installed to produce PDF output.
	  SKIP    Sphinx rst2pdf target.

But with that check on the Makefile in place, on the Sphinx side, we can indeed
just do Jon's snippet to only add the extension if it is installed. Another
option would be to split the 'try' into 'try' and 'else', where the 'else' only
executes if the 'try' is succesful. The benefit is that this makes it clearer
that only the import is being "tried":

	# Enable experimental rst2pdf, if available
	try:
	    import rst2pdf
	except ModuleNotFoundError:
	    pass
	else:
	    extensions.append("rst2pdf.pdfbuilder")

Something interesting I noticed is that when building with Sphinx 3, and if
rst2pdf is installed, even when building other targets, like htmldocs, (since
the rst2pdf extension is added based on rst2pdf being installed and not if it is
being used) the following is printed:

	WARNING: the rst2pdf.pdfbuilder extension is not safe for parallel writing
	WARNING: doing serial write

Looking into rst2pdf's pdfbuilder.py, indeed 'parallel_write_safe' is False, so
we should probably make sure rst2pdf isn't negatively impacting build time for
other formats before merging this patch.

Thanks,
Nícolas


^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2020-12-28 17:20 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-10 10:55 [PATCH 00/13] Address issues with PDF output at media uAPI docs Mauro Carvalho Chehab
2020-12-10 10:55 ` [PATCH 01/13] docs: conf.py: fix sphinx version detection for margin set Mauro Carvalho Chehab
2020-12-10 14:48   ` Jonathan Corbet
2020-12-10 16:01     ` [PATCH RFC] docs: experimental: build PDF with rst2pdf Mauro Carvalho Chehab
2020-12-10 16:29       ` Mauro Carvalho Chehab
2020-12-11  8:33         ` [PATCH RFC v2] " Mauro Carvalho Chehab
2020-12-11 20:48           ` Jonathan Corbet
2020-12-11 23:54             ` Mauro Carvalho Chehab
2020-12-12  0:03               ` Jonathan Corbet
2020-12-10 16:03     ` [PATCH 01/13] docs: conf.py: fix sphinx version detection for margin set Mauro Carvalho Chehab
2020-12-10 10:55 ` [PATCH 02/13] media: colorspaces-details.rst: drop tabularcolumns Mauro Carvalho Chehab
2020-12-10 10:55 ` [PATCH 03/13] media: control.rst: use a table for V4L2_CID_POWER_LINE Mauro Carvalho Chehab
2020-12-10 10:55 ` [PATCH 04/13] media: docs: sliced-vbi: fix V4L2_SLICED_WSS_625 docs Mauro Carvalho Chehab
2020-12-10 10:55 ` [PATCH 05/13] media: ext-ctrls-codec-stateless.rst: change a FWHT flag description Mauro Carvalho Chehab
2020-12-10 10:55 ` [PATCH 06/13] media: ext-ctrls-codec.rst: add a missing profile description Mauro Carvalho Chehab
2020-12-10 10:55 ` [PATCH 07/13] media: ext-ctrls-codec.rst: simplify a few tables Mauro Carvalho Chehab
2020-12-10 10:55 ` [PATCH 08/13] media: ext-ctrls-jpeg.rst: cleanup V4L2_CID_JPEG_COMPRESSION_QUALITY text Mauro Carvalho Chehab
2020-12-10 10:55 ` [PATCH 09/13] media: docs: pixfmt: use section titles for bayer formats Mauro Carvalho Chehab
2020-12-10 10:55 ` [PATCH 10/13] media: buffer.rst: fix a PDF output issue Mauro Carvalho Chehab
2020-12-10 10:55 ` [PATCH 11/13] media: ext-ctrls-codec-stateless.rst: fix an H-264 table format Mauro Carvalho Chehab
2020-12-10 10:55 ` [PATCH 12/13] media: pixfmt-yuv-planar.rst: fix PDF OUTPUT Mauro Carvalho Chehab
2020-12-10 10:55 ` [PATCH 13/13] media: docs: uAPI: fix table output in LaTeX/PDF format Mauro Carvalho Chehab
2020-12-28 17:19 [PATCH RFC v2] docs: experimental: build PDF with rst2pdf Nícolas F. R. A. Prado

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).