<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 8 September 2014 13:07, Daniel Vetter <span dir="ltr"><<a href="mailto:daniel@ffwll.ch" target="_blank">daniel@ffwll.ch</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="">On Mon, Sep 08, 2014 at 12:12:21PM +0100, Thomas Wood wrote:<br>
> Include the generic_edid array inside igt_kms.c to avoid having to include<br>
> it separately in tests. This also means it can be included in the i-g-t kms<br>
> section of the documentation.<br>
<br>
</span>You can just include igt_edid.h from igt_kms.h and add the corresponding<br>
note in the documentation like we do for igt_fb.[hc] already. That way we<br>
have nice doc splits and the simplest possible interface for tests.<br></blockquote><div><br><div>Including igt_edid.h in igt_kms.h causes problems with multiple
definitions of generic_edid when linking, so this was a way of avoiding
that. The intention was that igt_kms.h would not be included from anywhere else, so the definition would effectively be in igt_kms.c.<br></div><br></div><div>However, moving the definition into a .c file (as suggested below) would perhaps be slightly nicer and avoid potential confusion.<br><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div><div class="h5"><br>
><br>
> Signed-off-by: Thomas Wood <<a href="mailto:thomas.wood@intel.com">thomas.wood@intel.com</a>><br>
> ---<br>
> docs/reference/intel-gpu-tools/Makefile.am | 3 ++-<br>
> docs/reference/intel-gpu-tools/intel-gpu-tools-docs.xml | 1 -<br>
> lib/igt_edid.h | 2 +-<br>
> lib/igt_kms.c | 2 ++<br>
> lib/igt_kms.h | 17 +++++++++++++++++<br>
> tests/kms_3d.c | 1 -<br>
> tests/kms_force_connector.c | 1 -<br>
> 7 files changed, 22 insertions(+), 5 deletions(-)<br>
><br>
> diff --git a/docs/reference/intel-gpu-tools/Makefile.am b/docs/reference/intel-gpu-tools/Makefile.am<br>
> index 3368e3e..05f604f 100644<br>
> --- a/docs/reference/intel-gpu-tools/Makefile.am<br>
> +++ b/docs/reference/intel-gpu-tools/Makefile.am<br>
> @@ -60,7 +60,8 @@ EXTRA_HFILES=<br>
> # e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h private_code<br>
> IGNORE_HFILES=gen6_render.h gen7_media.h gen7_render.h gen8_media.h \<br>
> gen8_render.h i830_reg.h i915_3d.h i915_pciids.h i915_reg.h \<br>
> - intel_reg.h debug.h instdone.h media_fill.h rendercopy.h<br>
> + igt_edid.h intel_reg.h debug.h instdone.h media_fill.h \<br>
> + rendercopy.h<br>
><br>
> # Images to copy into HTML directory.<br>
> # e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png<br>
> diff --git a/docs/reference/intel-gpu-tools/intel-gpu-tools-docs.xml b/docs/reference/intel-gpu-tools/intel-gpu-tools-docs.xml<br>
> index 3d9caf8..68ca8d4 100644<br>
> --- a/docs/reference/intel-gpu-tools/intel-gpu-tools-docs.xml<br>
> +++ b/docs/reference/intel-gpu-tools/intel-gpu-tools-docs.xml<br>
> @@ -25,7 +25,6 @@<br>
> <xi:include href="xml/intel_batchbuffer.xml"/><br>
> <xi:include href="xml/intel_chipset.xml"/><br>
> <xi:include href="xml/intel_io.xml"/><br>
> - <xi:include href="xml/igt_edid.xml"/><br>
><br>
> </chapter><br>
> <index id="api-index-full"><br>
> diff --git a/lib/igt_edid.h b/lib/igt_edid.h<br>
> index 27373b7..7711841 100644<br>
> --- a/lib/igt_edid.h<br>
> +++ b/lib/igt_edid.h<br>
> @@ -29,7 +29,7 @@<br>
><br>
> #define EDID_LENGTH 128<br>
><br>
> -static const unsigned char generic_edid[MAX_EDIDS][EDID_LENGTH] = {<br>
> +const unsigned char generic_edid[MAX_EDIDS][EDID_LENGTH] = {<br>
<br>
</div></div>But if you want to move something then imo this here should go into a .c<br>
file - global variable definitions in headers just aint pretty ;-)<br>
<br>
Cheers, Daniel<br>
<div><div class="h5"><br>
> {<br>
> 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00,<br>
> 0x31, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,<br>
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c<br>
> index 3a850f1..26794f2 100644<br>
> --- a/lib/igt_kms.c<br>
> +++ b/lib/igt_kms.c<br>
> @@ -43,6 +43,8 @@<br>
> #include "igt_aux.h"<br>
> #include "intel_chipset.h"<br>
><br>
> +#include "igt_edid.h"<br>
> +<br>
> /*<br>
> * There hasn't been a release of libdrm containing these #define's yet, so<br>
> * copy them here to allow compilation to succeed in the mean time.<br>
> diff --git a/lib/igt_kms.h b/lib/igt_kms.h<br>
> index 921afef..23f73b1 100644<br>
> --- a/lib/igt_kms.h<br>
> +++ b/lib/igt_kms.h<br>
> @@ -127,6 +127,12 @@ enum kmstest_force_connector_state {<br>
> FORCE_CONNECTOR_OFF<br>
> };<br>
><br>
> +/**<br>
> + * EDID_LENGTH:<br>
> + *<br>
> + * Length of an EDID block, in bytes.<br>
> + */<br>
> +#define EDID_LENGTH 128<br>
><br>
> /**<br>
> * kmstest_generic_edid:<br>
> @@ -136,6 +142,8 @@ enum kmstest_force_connector_state {<br>
> * @EDID_WSXGA: 1680x1050<br>
> * @EDID_FHD: 1920x1080<br>
> * @MAX_EDIDS: Size of #generic_edid array<br>
> + *<br>
> + * Index of items in the #generic_edid array.<br>
> */<br>
> enum kmstest_generic_edid {<br>
> EDID_XGA, /* 1024x768 */<br>
> @@ -147,6 +155,15 @@ enum kmstest_generic_edid {<br>
> MAX_EDIDS<br>
> };<br>
><br>
> +/**<br>
> + * generic_edid:<br>
> + *<br>
> + * An array of generic EDID blocks, with each item corresponding to the entries<br>
> + * in #kmstest_generic_edid.<br>
> + */<br>
> +const unsigned char generic_edid[MAX_EDIDS][EDID_LENGTH];<br>
> +<br>
> +<br>
> bool kmstest_force_connector(int fd, drmModeConnector *connector,<br>
> enum kmstest_force_connector_state state);<br>
> void kmstest_edid_add_3d(const unsigned char *edid, size_t length, unsigned char *new_edid_ptr[], size_t *new_length);<br>
> diff --git a/tests/kms_3d.c b/tests/kms_3d.c<br>
> index c11873b..9bf252c 100644<br>
> --- a/tests/kms_3d.c<br>
> +++ b/tests/kms_3d.c<br>
> @@ -25,7 +25,6 @@<br>
> #include "igt_core.h"<br>
> #include "igt_kms.h"<br>
> #include "drmtest.h"<br>
> -#include "igt_edid.h"<br>
><br>
> igt_simple_main<br>
> {<br>
> diff --git a/tests/kms_force_connector.c b/tests/kms_force_connector.c<br>
> index 7dba68a..adb73a0 100644<br>
> --- a/tests/kms_force_connector.c<br>
> +++ b/tests/kms_force_connector.c<br>
> @@ -25,7 +25,6 @@<br>
> #include "igt_core.h"<br>
> #include "igt_kms.h"<br>
> #include "drmtest.h"<br>
> -#include "igt_edid.h"<br>
><br>
> int<br>
> main (int argc, char **argv)<br>
> --<br>
> 1.9.3<br>
><br>
</div></div>> _______________________________________________<br>
> Intel-gfx mailing list<br>
> <a href="mailto:Intel-gfx@lists.freedesktop.org">Intel-gfx@lists.freedesktop.org</a><br>
> <a href="http://lists.freedesktop.org/mailman/listinfo/intel-gfx" target="_blank">http://lists.freedesktop.org/mailman/listinfo/intel-gfx</a><br>
<br>
--<br>
Daniel Vetter<br>
Software Engineer, Intel Corporation<br>
<a href="tel:%2B41%20%280%29%2079%20365%2057%2048" value="+41793655748">+41 (0) 79 365 57 48</a> - <a href="http://blog.ffwll.ch" target="_blank">http://blog.ffwll.ch</a><br>
</blockquote></div><br></div></div>