Add HDMI helpers
Subsystems (3)
cover Add HDMI helpers
This small series is very much work in progress, but I still wanted to get feedback in this early stage to gather requirements from the folks working on the display drivers that these helpers target.
Patch 1 in the series adds a generic helper to pack a structure that describes an HDMI AVI infoframe into the binary format as specified in the HDMI specification. The resulting binary buffer should be easily programmable into the HDMI controller.
Patch 2 provides a helper to fill an HDMI AVI infoframe with data from a struct drm_display_mode.
This is all pretty rough right now, but I think some feedback would be good at this point, to see if the design is at all sensible. I should also mention that I haven't actually tested this on real hardware yet. Furthermore I have plans to add something similar for the other types of infoframes specified by HDMI once the direction becomes clearer.
Thierry
Thierry Reding (2):
video: Add generic HDMI helpers
drm: Add HDMI helpers
drivers/gpu/drm/Kconfig | 7 +++ drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/drm_hdmi.c | 107 ++++++++++++++++++++++++++++++++++++++++ drivers/video/Kconfig | 3 ++ drivers/video/Makefile | 1 + drivers/video/hdmi.c | 84 ++++++++++++++++++++++++++++++++ include/drm/drm_hdmi.h | 18 +++++++ include/linux/hdmi.h | 119 +++++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 340 insertions(+) create mode 100644 drivers/gpu/drm/drm_hdmi.c create mode 100644 drivers/video/hdmi.c create mode 100644 include/drm/drm_hdmi.h create mode 100644 include/linux/hdmi.h
Signature · 1 line
1.8.0
RFC 1/2 video: Add generic HDMI helpers
Add generic helpers to pack HDMI infoframes into a binary buffers.
--- drivers/video/Kconfig | 3 ++ drivers/video/Makefile | 1 + drivers/video/hdmi.c | 84 ++++++++++++++++++++++++++++++++++ include/linux/hdmi.h | 119 +++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 207 insertions(+) create mode 100644 drivers/video/hdmi.c create mode 100644 include/linux/hdmi.h
drivers/video/Kconfig +3 -0
@@ -52,6 +52,9 @@ config OF_VIDEOMODE help helper to get videomodes from the devicetree +config HDMI + bool + menuconfig FB tristate "Support for frame buffer devices" ---help---
drivers/video/Makefile +1 -0
@@ -5,6 +5,7 @@ # Each configuration option enables a list of files. obj-$(CONFIG_VGASTATE) += vgastate.o +obj-$(CONFIG_HDMI) += hdmi.o obj-y += fb_notify.o obj-$(CONFIG_FB) += fb.o fb-y := fbmem.o fbmon.o fbcmap.o fbsysfs.o \
drivers/video/hdmi.c new file +84 -0
84 lines not on this page · raw message
include/linux/hdmi.h new file +119 -0
119 lines not on this page · raw message
Signature · 1 line
1.8.0
RFC 2/2 drm: Add HDMI helpers
In reply to Thierry RedingAdd a generic helper to fill in an HDMI AVI infoframe with data extracted from a DRM display mode.
--- drivers/gpu/drm/Kconfig | 7 +++ drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/drm_hdmi.c | 107 +++++++++++++++++++++++++++++++++++++++++++++ include/drm/drm_hdmi.h | 18 ++++++++ 4 files changed, 133 insertions(+) create mode 100644 drivers/gpu/drm/drm_hdmi.c create mode 100644 include/drm/drm_hdmi.h
drivers/gpu/drm/Kconfig +7 -0
@@ -69,6 +69,13 @@ config DRM_KMS_CMA_HELPER help Choose this if you need the KMS CMA helper functions +config DRM_HDMI + bool + depends on DRM + select HDMI + help + Choose this if you need the HDMI helper functions + config DRM_TDFX tristate "3dfx Banshee/Voodoo3+" depends on DRM && PCI
drivers/gpu/drm/Makefile +1 -0
@@ -16,6 +16,7 @@ drm-y := drm_auth.o drm_buffer.o drm_bufs.o drm_cache.o \ drm-$(CONFIG_COMPAT) += drm_ioc32.o drm-$(CONFIG_DRM_GEM_CMA_HELPER) += drm_gem_cma_helper.o +drm-$(CONFIG_DRM_HDMI) += drm_hdmi.o drm-usb-y := drm_usb.o
drivers/gpu/drm/drm_hdmi.c new file +107 -0
107 lines not on this page · raw message
include/drm/drm_hdmi.h new file +18 -0
@@ -0,0 +1,18 @@ +/* +* Copyright (C) 2012 Avionic Design GmbH +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#ifndef _DRM_HDMI_H_ +#define _DRM_HDMI_H_ + +struct hdmi_avi_infoframe ; +struct drm_display_mode ; + +int drm_hdmi_avi_infoframe_from_display_mode (struct hdmi_avi_infoframe *frame, +struct drm_display_mode *mode); + +#endif
Signature · 1 line
1.8.0
Hi Thierry,
Quoted 9 lines · Thierry Reding
This small series is very much work in progress, but I still wanted to get feedback in this early stage to gather requirements from the folks working on the display drivers that these helpers target.
Patch 1 in the series adds a generic helper to pack a structure that describes an HDMI AVI infoframe into the binary format as specified in the HDMI specification. The resulting binary buffer should be easily programmable into the HDMI controller.
Quoted 8 lines
Patch 2 provides a helper to fill an HDMI AVI infoframe with data from a struct
drm_display_mode.This is all pretty rough right now, but I think some feedback would be good at this point, to see if the design is at all sensible. I should also mention that I haven't actually tested this on real hardware yet. Furthermore I have plans to add something similar for the other types of infoframes specified by HDMI once the direction becomes clearer.
In general I like the idea of storing the informations in a C struct and only packing it into the binary form when needed.
I would rather like to see a complete implementation of all the interesting HDMI packets, including the necessary calculations/tables for audio timing recovery etc before it gets committed upstream.
Not sure about the separate configuration option. I'm not so much into the config/build system of linux (I know that it is rather complicated), but in general I would like to see that activated automatically as soon as any driver starts using it (or at least the driver depending on that option to be active).
Also two notes about the code in itself:
1. hdmi_avi_infoframe_pack: gets the size of the target buffer, but unfortunately doesn't checks it.
2. Separate the CRC calculation, we probably need that more than once.
Thanks for looking into that, keep up with the work.
Cheers,
Christian.
Quoted 20 lines · Christian König
Hi Thierry,
Quoted 9 lines · Thierry Reding
This small series is very much work in progress, but I still wanted to get feedback in this early stage to gather requirements from the folks working on the display drivers that these helpers target.
Patch 1 in the series adds a generic helper to pack a structure that describes an HDMI AVI infoframe into the binary format as specified in the HDMI specification. The resulting binary buffer should be easily programmable into the HDMI controller.
Quoted 8 lines
Patch 2 provides a helper to fill an HDMI AVI infoframe with data from a struct
drm_display_mode.This is all pretty rough right now, but I think some feedback would be good at this point, to see if the design is at all sensible. I should also mention that I haven't actually tested this on real hardware yet. Furthermore I have plans to add something similar for the other types of infoframes specified by HDMI once the direction becomes clearer.
Quoted 7 lines
In general I like the idea of storing the informations in a C struct and only packing it into the binary form when needed.
I would rather like to see a complete implementation of all the interesting HDMI packets, including the necessary calculations/tables for audio timing recovery etc before it gets committed upstream.
I'm afraid I'm not very familiar with those packets. Also I haven't seen any actual users of audio timing recovery packets so far, so I'm not sure that adding support for them would be very useful.
What I have added so far is support for audio and vendor-specific infoframes, since those have actual users. I also noticed that i915 implements SPD infoframes as well, so I can extract that code into the generic helpers as well.
Quoted 5 lines
Not sure about the separate configuration option. I'm not so much into the config/build system of linux (I know that it is rather complicated), but in general I would like to see that activated automatically as soon as any driver starts using it (or at least the driver depending on that option to be active).
The configuration option isn't supposed to be user visible. Drivers that make use of this are supposed to select HDMI or DRM_HDMI to cause the generic code to be pulled in.
Quoted 3 lines
Also two notes about the code in itself:
1.hdmi_avi_infoframe_pack: gets the size of the target buffer, but unfortunately doesn't checks it.
That should already be fixed in the latest code in my local working branch.
Quoted 1 line
2. Separate the CRC calculation, we probably need that more than once.
I've also pulled that out into a separate function. I haven't made it a public function yet, but I don't think that'll be necessary either since it is used internally by the various infoframe packing functions.
Thierry
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 24 lines · Thierry Reding
Quoted 23 lines · Christian König
Hi Thierry,
Quoted 9 lines · Thierry Reding
This small series is very much work in progress, but I still wanted to get feedback in this early stage to gather requirements from the folks working on the display drivers that these helpers target.
Patch 1 in the series adds a generic helper to pack a structure that describes an HDMI AVI infoframe into the binary format as specified in the HDMI specification. The resulting binary buffer should be easily programmable into the HDMI controller.
Quoted 8 lines
Patch 2 provides a helper to fill an HDMI AVI infoframe with data from a struct
drm_display_mode.This is all pretty rough right now, but I think some feedback would be good at this point, to see if the design is at all sensible. I should also mention that I haven't actually tested this on real hardware yet. Furthermore I have plans to add something similar for the other types of infoframes specified by HDMI once the direction becomes clearer.
In general I like the idea of storing the informations in a C struct and only packing it into the binary form when needed.
Quoted 7 lines
Quoted 4 lines
I would rather like to see a complete implementation of all the interesting HDMI packets, including the necessary calculations/tables for audio timing recovery etc before it gets committed upstream.
I'm afraid I'm not very familiar with those packets. Also I haven't seen any actual users of audio timing recovery packets so far, so I'm not sure that adding support for them would be very useful.
Take a look at: drivers/gpu/drm/radeon/r600_hdmi.c There we have r600_hdmi_predefined_acr, r600_hdmi_calc_cts and r600_hdmi_acr doing the audio clock recovery calculation/table manually. Those values are only used as fallback, since the hardware can do the calculation on their own.
I'm not sure if anybody else is doing this calculation in any driver code, but it definitely isn't driver specific and part of the HDMI specification, so I would say that it belongs into the general purpose file as well.
Quoted 17 lines
What I have added so far is support for audio and vendor-specific infoframes, since those have actual users. I also noticed that i915 implements SPD infoframes as well, so I can extract that code into the generic helpers as well.
Quoted 5 lines
Not sure about the separate configuration option. I'm not so much into the config/build system of linux (I know that it is rather complicated), but in general I would like to see that activated automatically as soon as any driver starts using it (or at least the driver depending on that option to be active).
The configuration option isn't supposed to be user visible. Drivers that make use of this are supposed to select HDMI or
DRM_HDMIto cause the generic code to be pulled in.Quoted 3 lines
Also two notes about the code in itself:
1.hdmi_avi_infoframe_pack: gets the size of the target buffer, but unfortunately doesn't checks it.
Quoted 8 lines
That should already be fixed in the latest code in my local working branch.
Quoted 1 line
2. Separate the CRC calculation, we probably need that more than once.
I've also pulled that out into a separate function. I haven't made it a public function yet, but I don't think that'll be necessary either since it is used internally by the various infoframe packing functions.
Sounds good, let me know when you need a review of the code.
Christian.
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
2012/11/23 Christian König <[email protected]>:
Quoted 30 lines
Hi Thierry,
Quoted 10 lines · Thierry Reding
This small series is very much work in progress, but I still wanted to get feedback in this early stage to gather requirements from the folks working on the display drivers that these helpers target.
Patch 1 in the series adds a generic helper to pack a structure that describes an HDMI AVI infoframe into the binary format as specified in the HDMI specification. The resulting binary buffer should be easily programmable into the HDMI controller.
Quoted 8 lines
Patch 2 provides a helper to fill an HDMI AVI infoframe with data from a struct
drm_display_mode.This is all pretty rough right now, but I think some feedback would be good at this point, to see if the design is at all sensible. I should also mention that I haven't actually tested this on real hardware yet. Furthermore I have plans to add something similar for the other types of infoframes specified by HDMI once the direction becomes clearer.
In general I like the idea of storing the informations in a C struct and only packing it into the binary form when needed.
I would rather like to see a complete implementation of all the interesting HDMI packets, including the necessary calculations/tables for audio timing recovery etc before it gets committed upstream.
Quoted 5 lines
Not sure about the separate configuration option. I'm not so much into the config/build system of linux (I know that it is rather complicated), but in general I would like to see that activated automatically as soon as any driver starts using it (or at least the driver depending on that option to be active).
It's rather trivial ;) You just use "select FOO_BAR".
Signature · 5 lines
Rafał _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel