[Intel-gfx] [PATCH] Add tools/intel_infoframes
From: Paulo Zanoni paulo.r.zan...@intel.com This is a command-line tool that allows us to display and modify the InfoFrames we send. Signed-off-by: Paulo Zanoni paulo.r.zan...@intel.com --- Hi Before we add Kernel interfaces to deal with the infoframes, I decided to write this tool. It allows us to quickly test everything without requiring a patched Kernel, so is very convenient for people who want to change their InfoFrames quickly. The coolest feature behind this tool is the ability to change between overscan and underscan, so now you can connect your computer to your TV and, maybe, be able to see your whole desktop (even the corners!). I tested this with 3 TVs, but only one of them respected the overscan/underscan settings. I still need to investigate more the reasons why the settings were ignored on two TVs (I didn't look at the EDID stuff). So, to change between overscan and underscan: $ sudo ./intel_infoframes You'll see the main menu. Type 1 and then press enter to see what's happening on your machine. You'll see which transcoder is associated to which HDMI port. If any of the transcoders is enabled, you'll also see the InfoFrames they're sending. Note that to really understand each InfoFrame field you'll have to look at the HDMI or CEA-861 specifications. Then, select option 2 to change an InfoFrame. You'll need to select a transcoder: scroll up and read the output of the previous command. Then, select the AVI infoframe (option 1). On the next menu, select option 1 again. The option that deals with overscan/uderscan is S. Value 0 is default, value 1 is overscan and value 2 is underscan. Write S 2 and then press enter. Then, write done and press enter. If your TV repects the underscan settings of the AVI infoframes, you'll now have underscan. Next features: - Support for Iron Lake (I only tested with Sandy Bridge) - Other InfoFrames (I only added support for AVI and SPD) - Code that tries to check which InfoFrames your TV is supposed to respect. Feedback/testing would be appreciated. Cheers, Paulo man/Makefile.am |1 + man/intel_infoframes.man | 20 + tools/.gitignore |1 + tools/Makefile.am|1 + tools/intel_infoframes.c | 993 ++ 5 files changed, 1016 insertions(+), 0 deletions(-) create mode 100644 man/intel_infoframes.man create mode 100644 tools/intel_infoframes.c diff --git a/man/Makefile.am b/man/Makefile.am index 2b54195..7c14a81 100644 --- a/man/Makefile.am +++ b/man/Makefile.am @@ -6,6 +6,7 @@ appman_PRE =\ intel_error_decode.man \ intel_gpu_top.man \ intel_gtt.man \ + intel_infoframes.man\ intel_lid.man \ intel_reg_dumper.man\ intel_reg_read.man \ diff --git a/man/intel_infoframes.man b/man/intel_infoframes.man new file mode 100644 index 000..1caf91b --- /dev/null +++ b/man/intel_infoframes.man @@ -0,0 +1,20 @@ +.\ shorthand for double quote that works everywhere. +.ds q \N'34' +.TH intel_infoframes __appmansuffix__ __xorgversion__ +.SH NAME +intel_infoframes \- View and change HDMI InfoFrames +.SH SYNOPSIS +.B intel_infoframes +.SH DESCRIPTION +.B intel_infoframes +is a tool to view and change the HDMI InfoFrames sent by the GPU. Its main +purpose is to be used as a debugging tool. In some cases (e.g., when +changing modes) the Kernel will undo the changes made by this tool. + +Descriptions of the InfoFrame fields can be found on the HDMI and CEA-861 +specifications. +.SH LIMITATIONS +Not all HDMI monitors respect the InfoFrames sent to them. Only Sandy Bridge +or newer hardware is supported yet. +.SH SEE ALSO +HDMI specification, CEA-861 specification. diff --git a/tools/.gitignore b/tools/.gitignore index 0bbdde1..ce70e30 100644 --- a/tools/.gitignore +++ b/tools/.gitignore @@ -10,6 +10,7 @@ intel_gpu_dump intel_gpu_time intel_gpu_top intel_gtt +intel_infoframes intel_lid intel_reg_checker intel_reg_dumper diff --git a/tools/Makefile.am b/tools/Makefile.am index 4969a11..1287220 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -8,6 +8,7 @@ bin_PROGRAMS = \ intel_gpu_top \ intel_gpu_time \ intel_gtt \ + intel_infoframes \ intel_stepping \ intel_reg_checker \ intel_reg_dumper \ diff --git a/tools/intel_infoframes.c b/tools/intel_infoframes.c new file mode 100644 index 000..d4bfd67 --- /dev/null +++ b/tools/intel_infoframes.c @@ -0,0 +1,993 @@ +/* + * Copyright © 2012 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,
[Intel-gfx] [PATCH] drm/i915/sdvo: always set positive sync polarity
From: Paulo Zanoni paulo.r.zan...@intel.com This is a revert of 81a14b46846fea0741902e8d8dfcc6c6c78154c8. We already set the mode polarity using the SDVO commands with struct intel_sdvo_dtd. We have at least 3 bugs that get fixed with this patch. The documentation, despite not clear, can also be interpreted in a way that suggests this patch is needed. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=15766 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=42174 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=4 Cc: sta...@kernel.org Reviewed-by: Eric Anholt e...@anholt.net Reviewed-by: Jesse Barnes jbar...@virtuousgeek.org Signed-off-by: Paulo Zanoni paulo.r.zan...@intel.com --- drivers/gpu/drm/i915/intel_sdvo.c |8 +++- 1 files changed, 3 insertions(+), 5 deletions(-) The Reviewed-by tags were provided on IRC. diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c index f7b9268..e334ec3 100644 --- a/drivers/gpu/drm/i915/intel_sdvo.c +++ b/drivers/gpu/drm/i915/intel_sdvo.c @@ -1066,15 +1066,13 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder, /* Set the SDVO control regs. */ if (INTEL_INFO(dev)-gen = 4) { - sdvox = 0; + /* The real mode polarity is set by the SDVO commands, using +* struct intel_sdvo_dtd. */ + sdvox = SDVO_VSYNC_ACTIVE_HIGH | SDVO_HSYNC_ACTIVE_HIGH; if (intel_sdvo-is_hdmi) sdvox |= intel_sdvo-color_range; if (INTEL_INFO(dev)-gen 5) sdvox |= SDVO_BORDER_ENABLE; - if (adjusted_mode-flags DRM_MODE_FLAG_PVSYNC) - sdvox |= SDVO_VSYNC_ACTIVE_HIGH; - if (adjusted_mode-flags DRM_MODE_FLAG_PHSYNC) - sdvox |= SDVO_HSYNC_ACTIVE_HIGH; } else { sdvox = I915_READ(intel_sdvo-sdvo_reg); switch (intel_sdvo-sdvo_reg) { -- 1.7.7.3 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [RFC] drm: implement DRM_IOCTL_MODE_SETROTATION
From: Paulo Zanoni paulo.r.zan...@intel.com This ioctl is used to signal the drivers that the screen is rotated, not to make the drivers rotate the screen. - add a driver-specific rotation_set function - implement Intel's rotation_set by setting the right values to the PIPECONF registers. The idea is that when user-space does rotation, it can call this ioctl to inform the Kernel that we have a rotation. This feature is needed by the KVMr feature of VPro. Signed-off-by: Paulo Zanoni paulo.r.zan...@intel.com --- Hi We need this feature for the KVMr feature of VPro. I'm not sure how useful this will be for the non-Intel drivers, so maybe the current approach is not the best. I'm open to suggestions. I also have a patch to libdrm that just implements a wrapper for the ioctl (drmModeCrtcSetRotation) and a patch for xf86-video-intel that callss the libdrm function whenever needed. I already have the libdrm and xf86-video-intel patches (they're simple) but I'll wait until I get some comments on this one before I send the others. drivers/gpu/drm/drm_crtc.c | 28 drivers/gpu/drm/drm_drv.c|3 ++- drivers/gpu/drm/i915/i915_reg.h |5 + drivers/gpu/drm/i915/intel_display.c | 34 ++ include/drm/drm.h|2 ++ include/drm/drm_crtc.h |8 +++- include/drm/drm_mode.h | 15 +++ 7 files changed, 93 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index f259a25..4a33ea1 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -3125,6 +3125,34 @@ out: return ret; } +int drm_crtc_rotation_set_ioctl(struct drm_device *dev, void *data, + struct drm_file *file_priv) +{ + struct drm_mode_crtc_rotation *rotation = data; + struct drm_mode_object *obj; + struct drm_crtc *crtc; + int ret = 0; + + DRM_DEBUG_KMS(changing rotation to %d\n, rotation-rotation); + + if (!drm_core_check_feature(dev, DRIVER_MODESET)) + return -EINVAL; + + mutex_lock(dev-mode_config.mutex); + obj = drm_mode_object_find(dev, rotation-crtc_id, DRM_MODE_OBJECT_CRTC); + if (!obj) { + ret = -EINVAL; + goto out; + } + crtc = obj_to_crtc(obj); + + if (crtc-funcs-rotation_set) + crtc-funcs-rotation_set(crtc, rotation-rotation); +out: + mutex_unlock(dev-mode_config.mutex); + return ret; +} + int drm_mode_page_flip_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv) { diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index bc5febe..ba0dac1 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c @@ -159,7 +159,8 @@ static struct drm_ioctl_desc drm_ioctls[] = { DRM_IOCTL_DEF(DRM_IOCTL_MODE_DIRTYFB, drm_mode_dirtyfb_ioctl, DRM_MASTER|DRM_CONTROL_ALLOW|DRM_UNLOCKED), DRM_IOCTL_DEF(DRM_IOCTL_MODE_CREATE_DUMB, drm_mode_create_dumb_ioctl, DRM_MASTER|DRM_CONTROL_ALLOW|DRM_UNLOCKED), DRM_IOCTL_DEF(DRM_IOCTL_MODE_MAP_DUMB, drm_mode_mmap_dumb_ioctl, DRM_MASTER|DRM_CONTROL_ALLOW|DRM_UNLOCKED), - DRM_IOCTL_DEF(DRM_IOCTL_MODE_DESTROY_DUMB, drm_mode_destroy_dumb_ioctl, DRM_MASTER|DRM_CONTROL_ALLOW|DRM_UNLOCKED) + DRM_IOCTL_DEF(DRM_IOCTL_MODE_DESTROY_DUMB, drm_mode_destroy_dumb_ioctl, DRM_MASTER|DRM_CONTROL_ALLOW|DRM_UNLOCKED), + DRM_IOCTL_DEF(DRM_IOCTL_MODE_SETROTATION, drm_crtc_rotation_set_ioctl, DRM_MASTER|DRM_UNLOCKED) }; #define DRM_CORE_IOCTL_COUNT ARRAY_SIZE( drm_ioctls ) diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index 194d987..3d9d46e 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h @@ -2323,6 +2323,11 @@ #define PIPECONF_INTERLACE_FIELD_0_ONLY (7 21) #define PIPECONF_INTERLACE_MASK (7 21) #define PIPECONF_CXSR_DOWNCLOCK (116) +#define PIPECONF_ROTATION_MASK (3 14) +#define PIPECONF_ROTATION_0 (0 14) +#define PIPECONF_ROTATION_90 (1 14) +#define PIPECONF_ROTATION_180(2 14) +#define PIPECONF_ROTATION_270(3 14) #define PIPECONF_BPP_MASK(0x00e0) #define PIPECONF_BPP_8 (05) #define PIPECONF_BPP_10 (15) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 55a5b4c..08780f5 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -6317,6 +6317,39 @@ static void intel_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, intel_crtc_load_lut(crtc); } +static void intel_crtc_rotation_set(struct drm_crtc *crtc, + enum drm_crtc_rotation rotation) +{ + struct drm_device *dev = crtc-dev; +
[Intel-gfx] [PATCH] drm/i915/sdvo: always set positive sync polarity
From: Paulo Zanoni paulo.r.zan...@intel.com This is a revert of 81a14b46846fea0741902e8d8dfcc6c6c78154c8. We already set the mode polarity using the SDVO commands with struct intel_sdvo_dtd. We have at least 3 bugs that get fixed with this patch. The documentation, despite not clear, can also be interpreted in a way that suggests this patch is needed. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=15766 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=42174 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=4 Cc: sta...@kernel.org Cc: a...@redhat.com Signed-off-by: Paulo Zanoni paulo.r.zan...@intel.com --- drivers/gpu/drm/i915/intel_sdvo.c |8 +++- 1 files changed, 3 insertions(+), 5 deletions(-) This exact patch was still not tested, but equivalent ones were. I'm going to ask the bug reporters to test this specific patch too. diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c index f7b9268..e334ec3 100644 --- a/drivers/gpu/drm/i915/intel_sdvo.c +++ b/drivers/gpu/drm/i915/intel_sdvo.c @@ -1066,15 +1066,13 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder, /* Set the SDVO control regs. */ if (INTEL_INFO(dev)-gen = 4) { - sdvox = 0; + /* The real mode polarity is set by the SDVO commands, using +* struct intel_sdvo_dtd. */ + sdvox = SDVO_VSYNC_ACTIVE_HIGH | SDVO_HSYNC_ACTIVE_HIGH; if (intel_sdvo-is_hdmi) sdvox |= intel_sdvo-color_range; if (INTEL_INFO(dev)-gen 5) sdvox |= SDVO_BORDER_ENABLE; - if (adjusted_mode-flags DRM_MODE_FLAG_PVSYNC) - sdvox |= SDVO_VSYNC_ACTIVE_HIGH; - if (adjusted_mode-flags DRM_MODE_FLAG_PHSYNC) - sdvox |= SDVO_HSYNC_ACTIVE_HIGH; } else { sdvox = I915_READ(intel_sdvo-sdvo_reg); switch (intel_sdvo-sdvo_reg) { -- 1.7.7.3 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [RFC] drm/i915: always set positive sync in the sdvo register
From: Paulo Zanoni paulo.r.zan...@intel.com We use struct intel_sdvo_dtd for that too. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=15766 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=42174 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=4 Signed-off-by: Paulo Zanoni paulo.r.zan...@intel.com --- drivers/gpu/drm/i915/intel_sdvo.c |7 +++ 1 files changed, 3 insertions(+), 4 deletions(-) Hi We have at least 3 reports of wrong sdvo modes that get fixed when we set the sdvo register to PVSync + PHSync. According to the reporters, modes that contain NVSync or NHSync don't work without this patch. If you look at the sdvo commnads (from intel_sdvo_regs.h) you'll see that we also inform the sdvo device about the positive/negative syncs when we call SDVO_CMD_SET_*_TIMINGS (using the dtd_flags field of struct intel_sdvo_dtd). I couldn't find in our documentation any evidence that this patch is actually right for every sdvo device, but if anyone knows about this or know anyone I could ask about this, please tell me. If you have an sdvo device and want to help, please test: - use xrandr --verbose to check which modes contain -VSync or -HSync or both - without this patch, check if modes with -VSync or -HSync or both work (they should not be working) - apply this patch, and check if all the modes work (they should) - if you have newer hardware, be sure to have this patch too before testing anything: http://lists.freedesktop.org/archives/intel-gfx/2011-October/012726.html I didn't ask our reporters to test this specific patch, but they're all using equivalent changes. Paulo diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c index 3003fb2..4a6ba9c 100644 --- a/drivers/gpu/drm/i915/intel_sdvo.c +++ b/drivers/gpu/drm/i915/intel_sdvo.c @@ -1070,10 +1070,6 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder, sdvox |= intel_sdvo-color_range; if (INTEL_INFO(dev)-gen 5) sdvox |= SDVO_BORDER_ENABLE; - if (adjusted_mode-flags DRM_MODE_FLAG_PVSYNC) - sdvox |= SDVO_VSYNC_ACTIVE_HIGH; - if (adjusted_mode-flags DRM_MODE_FLAG_PHSYNC) - sdvox |= SDVO_HSYNC_ACTIVE_HIGH; } else { sdvox = I915_READ(intel_sdvo-sdvo_reg); switch (intel_sdvo-sdvo_reg) { @@ -1091,6 +1087,9 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder, if (intel_sdvo-has_hdmi_audio) sdvox |= SDVO_AUDIO_ENABLE; + /* We already set the {P,N}{V,H}Sync using struct intel_sdvo_dtd */ + sdvox |= SDVO_VSYNC_ACTIVE_HIGH | SDVO_HSYNC_ACTIVE_HIGH; + if (INTEL_INFO(dev)-gen = 4) { /* done in crtc_mode_set as the dpll_md reg must be written early */ } else if (IS_I945G(dev) || IS_I945GM(dev) || IS_G33(dev)) { -- 1.7.7.3 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [PATCH 1/3] drm/i915: set the right SDVO transcoder for CPT
From: Paulo Zanoni paulo.r.zan...@intel.com v2: add a CPT-specific macro, make code cleaner v3: fix commit message Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=41272 Cc: sta...@kernel.org Signed-off-by: Paulo Zanoni paulo.r.zan...@intel.com --- drivers/gpu/drm/i915/i915_reg.h |8 drivers/gpu/drm/i915/intel_sdvo.c |8 ++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index 138eae1..e02b64c 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h @@ -3275,10 +3275,10 @@ /* or SDVOB */ #define HDMIB 0xe1140 #define PORT_ENABLE(1 31) -#define TRANSCODER_A (0) -#define TRANSCODER_B (1 30) -#define TRANSCODER(pipe) ((pipe) 30) -#define TRANSCODER_MASK (1 30) +#define TRANSCODER(pipe) ((pipe) 30) +#define TRANSCODER_CPT(pipe) ((pipe) 29) +#define TRANSCODER_MASK(1 30) +#define TRANSCODER_MASK_CPT(3 29) #define COLOR_FORMAT_8bpc (0) #define COLOR_FORMAT_12bpc (3 26) #define SDVOB_HOTPLUG_ENABLE (1 23) diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c index aa94110..85fc976 100644 --- a/drivers/gpu/drm/i915/intel_sdvo.c +++ b/drivers/gpu/drm/i915/intel_sdvo.c @@ -1080,8 +1080,12 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder, } sdvox |= (9 19) | SDVO_BORDER_ENABLE; } - if (intel_crtc-pipe == 1) - sdvox |= SDVO_PIPE_B_SELECT; + + if (INTEL_PCH_TYPE(dev) = PCH_CPT) + sdvox |= TRANSCODER_CPT(intel_crtc-pipe); + else + sdvox |= TRANSCODER(intel_crtc-pipe); + if (intel_sdvo-has_hdmi_audio) sdvox |= SDVO_AUDIO_ENABLE; -- 1.7.6.3 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [PATCH 2/3] drm/i915: Rename HDMI register field definitions
From: Paulo Zanoni paulo.r.zan...@intel.com Also making the differences between HDMI{B,C,D} and SDVO registers for non-PCH, IBX and CPT more explicit. Signed-off-by: Paulo Zanoni paulo.r.zan...@intel.com --- drivers/gpu/drm/i915/i915_reg.h | 49 -- drivers/gpu/drm/i915/intel_display.c | 16 ++- drivers/gpu/drm/i915/intel_hdmi.c|6 ++-- drivers/gpu/drm/i915/intel_sdvo.c|5 ++- 4 files changed, 44 insertions(+), 32 deletions(-) As discussed on IRC diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index e02b64c..8fdee99 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h @@ -3272,27 +3272,36 @@ #define ADPA_CRT_HOTPLUG_VOLREF_475MV (117) #define ADPA_CRT_HOTPLUG_FORCE_TRIGGER (116) -/* or SDVOB */ +/* + * - Fields named HDMI are present for HDMI{B,C,D} + * - Fields named PCH_SDVO are present only for HDMIB (aka PCH_SDVOB or + * SDVO_HDMI_CTL on newer chips). Some of them, not all, are compatible with + * the old SDVO registers (SDVOB, SDVOC) + * - Fields valid only for IBX have the _IBX suffix + * - Fields valid only for CPT (and newer?) have the _CPT suffix + */ #define HDMIB 0xe1140 -#define PORT_ENABLE(1 31) -#define TRANSCODER(pipe) ((pipe) 30) -#define TRANSCODER_CPT(pipe) ((pipe) 29) -#define TRANSCODER_MASK(1 30) -#define TRANSCODER_MASK_CPT(3 29) -#define COLOR_FORMAT_8bpc (0) -#define COLOR_FORMAT_12bpc (3 26) -#define SDVOB_HOTPLUG_ENABLE (1 23) -#define SDVO_ENCODING (0) -#define TMDS_ENCODING (2 10) -#define NULL_PACKET_VSYNC_ENABLE (1 9) -/* CPT */ -#define HDMI_MODE_SELECT (1 9) -#define DVI_MODE_SELECT (0) -#define SDVOB_BORDER_ENABLE(1 7) -#define AUDIO_ENABLE (1 6) -#define VSYNC_ACTIVE_HIGH (1 4) -#define HSYNC_ACTIVE_HIGH (1 3) -#define PORT_DETECTED (1 2) +#define HDMI_PORT_ENABLE(1 31) +#define HDMI_TRANSCODER_IBX(pipe) ((pipe) 30) +#define HDMI_TRANSCODER_CPT(pipe) ((pipe) 29) +#define HDMI_TRANSCODER_MASK_IBX(1 30) +#define HDMI_TRANSCODER_MASK_CPT(3 29) +#define HDMI_COLOR_FORMAT_8bpc (0 26) +#define HDMI_COLOR_FORMAT_12bpc (3 26) +#define HDMI_COLOR_MASK (7 26) +#define PCH_SDVO_STALL_SELECT_IBX SDVO_STALL_SELECT +#define PCH_SDVO_STALL_SELECT_CPT (1 25) +#define PCH_SDVO_HOTPLUG_INT_ENABLE (1 23) +#define PCH_SDVO_ENCODING_SDVO SDVO_ENCODING_SDVO +#define PCH_SDVO_ENCODING_TMDS SDVO_ENCODING_HDMI +#define PCH_SDVO_ENCODING_MASK (3 10) +#define HDMI_MODE_DVI (0 9) +#define HDMI_MODE_HDMI SDVO_NULL_PACKETS_DURING_VSYNC +#define PCH_SDVO_BORDER_ENABLE SDVO_BORDER_ENABLE +#define HDMI_AUDIO_ENABLE SDVO_AUDIO_ENABLE +#define HDMI_VSYNC_ACTIVE_HIGH SDVO_VSYNC_ACTIVE_HIGH +#define HDMI_HSYNC_ACTIVE_HIGH SDVO_HSYNC_ACTIVE_HIGH +#define HDMI_PORT_DETECTED SDVO_DETECTED /* PCH SDVOB multiplex with HDMIB */ #define PCH_SDVOB HDMIB diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index f0e5f9f..d18db3b 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -1002,14 +1002,16 @@ static bool dp_pipe_enabled(struct drm_i915_private *dev_priv, static bool hdmi_pipe_enabled(struct drm_i915_private *dev_priv, enum pipe pipe, u32 val) { - if ((val PORT_ENABLE) == 0) + if ((val HDMI_PORT_ENABLE) == 0) return false; if (HAS_PCH_CPT(dev_priv-dev)) { - if ((val PORT_TRANS_SEL_MASK) != PORT_TRANS_SEL_CPT(pipe)) + if ((val HDMI_TRANSCODER_MASK_CPT) != + HDMI_TRANSCODER_CPT(pipe)) return false; } else { - if ((val TRANSCODER_MASK) != TRANSCODER(pipe)) + if ((val HDMI_TRANSCODER_MASK_IBX) != + HDMI_TRANSCODER_IBX(pipe)) return false; } return true; @@ -1421,7 +1423,7 @@ static void disable_pch_hdmi(struct drm_i915_private *dev_priv, if (hdmi_pipe_enabled(dev_priv, val, pipe)) { DRM_DEBUG_KMS(Disabling pch HDMI %x on pipe %d\n, reg, pipe); - I915_WRITE(reg, val ~PORT_ENABLE); + I915_WRITE(reg, val ~HDMI_PORT_ENABLE); } } @@ -7292,7 +7294,7 @@ static void intel_setup_outputs(struct drm_device *dev) if (HAS_PCH_SPLIT(dev)) { int found; - if (I915_READ(HDMIB) PORT_DETECTED) { + if (I915_READ(HDMIB) HDMI_PORT_DETECTED) { /* PCH SDVOB multiplex with HDMIB */ found = intel_sdvo_init(dev, PCH_SDVOB); if (!found) @@ -7301,10 +7303,10 @@ static void
[Intel-gfx] [PATCH] drm/i915: set the right SDVO transcoder for CPT
From: Paulo Zanoni paulo.r.zan...@intel.com Fixes fd.o #41272 Signed-off-by: Paulo Zanoni paulo.r.zan...@intel.com --- drivers/gpu/drm/i915/intel_sdvo.c | 10 +- 1 files changed, 9 insertions(+), 1 deletions(-) It would be nice to have this in Kernel 3.1 too diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c index aa94110..c66c0b4 100644 --- a/drivers/gpu/drm/i915/intel_sdvo.c +++ b/drivers/gpu/drm/i915/intel_sdvo.c @@ -1080,8 +1080,16 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder, } sdvox |= (9 19) | SDVO_BORDER_ENABLE; } - if (intel_crtc-pipe == 1) + + if (intel_sdvo-sdvo_reg == PCH_SDVOB) { + if (HAS_PCH_IBX(dev)) + sdvox |= TRANSCODER(intel_crtc-pipe); + else + sdvox |= PORT_TRANS_SEL_CPT(intel_crtc-pipe); + } else if (intel_crtc-pipe == 1) { sdvox |= SDVO_PIPE_B_SELECT; + } + if (intel_sdvo-has_hdmi_audio) sdvox |= SDVO_AUDIO_ENABLE; -- 1.7.6.3 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [PATCH] drm/i915: add missing break
From: Paulo Zanoni paulo.r.zan...@intel.com It seems to be missing from this commit: drm/i915: split out PCH refclk update code Signed-off-by: Paulo Zanoni paulo.r.zan...@intel.com --- drivers/gpu/drm/i915/intel_display.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index c829875..2921bac 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -5120,6 +5120,7 @@ static void ironlake_update_pch_refclk(struct drm_device *dev) switch (encoder-type) { case INTEL_OUTPUT_LVDS: has_lvds = true; + break; case INTEL_OUTPUT_EDP: has_edp_encoder = encoder; break; -- 1.7.4.1 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [PATCH 1/2] Fix always false conditionals
From: Paulo Zanoni paulo.r.zan...@intel.com Enums are unsigned by default in gcc and we can't rely on any specific signedess for the other compilers. i965_render.c: In function ‘i965_prepare_composite’: i965_render.c:2018:2: warning: comparison of unsigned expression 0 is always false i965_render.c:2025:2: warning: comparison of unsigned expression 0 is always false i965_render.c:2050:3: warning: comparison of unsigned expression 0 is always false i965_render.c:2057:3: warning: comparison of unsigned expression 0 is always false Signed-off-by: Paulo Zanoni paulo.r.zan...@intel.com --- src/i965_render.c | 18 ++ 1 files changed, 10 insertions(+), 8 deletions(-) I could also have defined FILTER_ERROR as -1, then gcc would have automagically converted the enum to signed, but I'm not sure what other compilers would do in this case. diff --git a/src/i965_render.c b/src/i965_render.c index 7e1da5b..2bd25b5 100644 --- a/src/i965_render.c +++ b/src/i965_render.c @@ -606,7 +606,8 @@ static const uint32_t ps_kernel_masknoca_projective_static_gen7[][4] = { typedef enum { SAMPLER_STATE_FILTER_NEAREST, SAMPLER_STATE_FILTER_BILINEAR, - FILTER_COUNT + FILTER_COUNT, + FILTER_ERROR } sampler_state_filter_t; typedef enum { @@ -614,7 +615,8 @@ typedef enum { SAMPLER_STATE_EXTEND_REPEAT, SAMPLER_STATE_EXTEND_PAD, SAMPLER_STATE_EXTEND_REFLECT, - EXTEND_COUNT + EXTEND_COUNT, + EXTEND_ERROR } sampler_state_extend_t; typedef enum { @@ -1248,7 +1250,7 @@ static sampler_state_filter_t sampler_state_filter_from_picture(int filter) case PictFilterBilinear: return SAMPLER_STATE_FILTER_BILINEAR; default: - return -1; + return FILTER_ERROR; } } @@ -1264,7 +1266,7 @@ static sampler_state_extend_t sampler_state_extend_from_picture(int repeat_type) case RepeatReflect: return SAMPLER_STATE_EXTEND_REFLECT; default: - return -1; + return EXTEND_ERROR; } } @@ -2015,14 +2017,14 @@ i965_prepare_composite(int op, PicturePtr source_picture, composite_op-src_filter = sampler_state_filter_from_picture(source_picture-filter); - if (composite_op-src_filter 0) { + if (composite_op-src_filter == FILTER_ERROR) { intel_debug_fallback(scrn, Bad src filter 0x%x\n, source_picture-filter); return FALSE; } composite_op-src_extend = sampler_state_extend_from_picture(source_picture-repeatType); - if (composite_op-src_extend 0) { + if (composite_op-src_extend == EXTEND_ERROR) { intel_debug_fallback(scrn, Bad src repeat 0x%x\n, source_picture-repeatType); return FALSE; @@ -2047,14 +2049,14 @@ i965_prepare_composite(int op, PicturePtr source_picture, composite_op-mask_filter = sampler_state_filter_from_picture(mask_picture-filter); - if (composite_op-mask_filter 0) { + if (composite_op-mask_filter == FILTER_ERROR) { intel_debug_fallback(scrn, Bad mask filter 0x%x\n, mask_picture-filter); return FALSE; } composite_op-mask_extend = sampler_state_extend_from_picture(mask_picture-repeatType); - if (composite_op-mask_extend 0) { + if (composite_op-mask_extend == EXTEND_ERROR) { intel_debug_fallback(scrn, Bad mask repeat 0x%x\n, mask_picture-repeatType); return FALSE; -- 1.7.4.1 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [PATCH 2/2] Remove useless assertion
From: Paulo Zanoni paulo.r.zan...@intel.com Removes 17 instances of: warning: comparison of unsigned expression = 0 is always true Signed-off-by: Paulo Zanoni paulo.r.zan...@intel.com --- src/xvmc/intel_batchbuffer.h |1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/src/xvmc/intel_batchbuffer.h b/src/xvmc/intel_batchbuffer.h index 888abeb..7fae6f7 100644 --- a/src/xvmc/intel_batchbuffer.h +++ b/src/xvmc/intel_batchbuffer.h @@ -44,7 +44,6 @@ extern int VERBOSE; do { \ xvmc_driver-batch.space -= (batch_ptr - xvmc_driver-batch.ptr);\ xvmc_driver-batch.ptr = batch_ptr; \ -assert(xvmc_driver-batch.space = 0); \ } while(0) extern void intelFlushBatch(Bool); -- 1.7.4.1 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [gpu-tools 1/7] testdisplay: fix compiler warnings
From: Paulo Zanoni paulo.r.zan...@intel.com testdisplay.c:117:1: warning: comparison between signed and unsigned integer expressions testdisplay.c:125:1: warning: comparison between signed and unsigned integer expressions testdisplay.c:145:1: warning: comparison between signed and unsigned integer expressions testdisplay.c:1060:16: warning: comparison between signed and unsigned integer expressions Signed-off-by: Paulo Zanoni paulo.r.zan...@intel.com --- tests/testdisplay.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/testdisplay.c b/tests/testdisplay.c index 1d85acd..94c6e74 100644 --- a/tests/testdisplay.c +++ b/tests/testdisplay.c @@ -98,7 +98,7 @@ struct type_name { #define type_name_fn(res) \ static char * res##_str(int type) {\ - int i; \ + unsigned int i; \ for (i = 0; i ARRAY_SIZE(res##_names); i++) { \ if (res##_names[i].type == type)\ return res##_names[i].name; \ @@ -1010,7 +1010,7 @@ int main(int argc, char **argv) int c; int encoders = 0, connectors = 0, crtcs = 0, framebuffers = 0; char *modules[] = { i915 }; - int i; + unsigned int i; struct udev *u; int ret = 0; GIOChannel *udevchannel, *stdinchannel; -- 1.7.4.1 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [gpu-tools 2/7] Add missing files to .gitignore
From: Paulo Zanoni paulo.r.zan...@intel.com Signed-off-by: Paulo Zanoni paulo.r.zan...@intel.com --- .gitignore | 11 +++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/.gitignore b/.gitignore index 70736e2..592a1b8 100644 --- a/.gitignore +++ b/.gitignore @@ -34,6 +34,8 @@ tests/getclient tests/getstats tests/getversion tests/gem_basic +tests/gem_double_irq_loop +tests/gem_dummy_reloc_loop tests/gem_exec_blt tests/gem_exec_nop tests/gem_fence_thrash @@ -43,11 +45,17 @@ tests/gem_gtt_speed tests/gem_largeobject tests/gem_mmap tests/gem_mmap_gtt +tests/gem_pipe_control_store_loop tests/gem_pread_after_blit tests/gem_pwrite tests/gem_readwrite tests/gem_ringfill +tests/gem_ring_sync_loop tests/gem_linear_blits +tests/gem_storedw_batches_loop +tests/gem_storedw_loop_blt +tests/gem_storedw_loop_bsd +tests/gem_storedw_loop_render tests/gem_vmap_blits tests/gem_tiled_blits tests/gem_tiled_fence_blits @@ -64,6 +72,9 @@ tests/gen3_render_tiledx_blits tests/gen3_render_tiledy_blits tests/gen3_render_mixed_blits tests/gen3_mixed_blits +tests/testdisplay +tools/forcewaked +tools/intel_backlight tools/intel_disable_clock_gating tools/intel_dump_decode tools/intel_error_decode -- 1.7.4.1 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [gpu-tools 3/7] testdisplay: test all modes if no option is provided
From: Paulo Zanoni paulo.r.zan...@intel.com Previously, when called without any arguments, the application required user input to finish. However, testdisplay is ran by make check, and it is not a good idea to run a program that requires user input in make check. So we change the default behavior to something that doesn't require user input. You can still access the previous behavior using the -m argument. Signed-off-by: Paulo Zanoni paulo.r.zan...@intel.com --- tests/testdisplay.c | 13 + 1 files changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/testdisplay.c b/tests/testdisplay.c index 94c6e74..cae04e9 100644 --- a/tests/testdisplay.c +++ b/tests/testdisplay.c @@ -946,7 +946,7 @@ static void update_display(void) extern char *optarg; extern int optind, opterr, optopt; -static char optstr[] = hiaf:s:d:pt; +static char optstr[] = hiaf:s:d:pmt; static void usage(char *name) { @@ -956,11 +956,12 @@ static void usage(char *name) fprintf(stderr, \t-s\tduration\tsleep between each mode test\n); fprintf(stderr, \t-d\tdepth\tbit depth of scanout buffer\n); fprintf(stderr, \t-p\ttest overlay plane\n); + fprintf(stderr, \t-m\ttest the preferred mode\n); fprintf(stderr, \t-t\tuse a tiled framebuffer\n); fprintf(stderr, \t-f\tclock MHz,hdisp,hsync-start,hsync-end,htotal,\n); fprintf(stderr, \t\tvdisp,vsync-start,vsync-end,vtotal\n); fprintf(stderr, \t\ttest force mode\n); - fprintf(stderr, \tDefault is to test the preferred mode.\n); + fprintf(stderr, \tDefault is to test all modes.\n); exit(0); } @@ -1043,6 +1044,9 @@ int main(int argc, char **argv) case 'p': test_plane = 1; break; + case 'm': + test_preferred_mode = 1; + break; case 't': enable_tiling = 1; break; @@ -1054,8 +1058,9 @@ int main(int argc, char **argv) break; } } - if (!test_all_modes !force_mode !dump_info) - test_preferred_mode = 1; + if (!test_all_modes !force_mode !dump_info + !test_preferred_mode) + test_all_modes = 1; for (i = 0; i ARRAY_SIZE(modules); i++) { fd = drmOpen(modules[i], NULL); -- 1.7.4.1 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [gpu-tools 4/7] testdisplay: don't enter the main loop if dump_info or test_all_modes
From: Paulo Zanoni paulo.r.zan...@intel.com If calls inside update_display fail, the function returns and we don't quit the program if dump_info or test_all_modes. So we enter the main loop and keep waiting for user input, even on cases where we are not supposed to require user input. To fix this, we move the check to outside the update_display function. As a side effect, we also do cleanup instead of just exit(0) and we return 1 in case update_display failed. Signed-off-by: Paulo Zanoni paulo.r.zan...@intel.com --- tests/testdisplay.c | 18 -- 1 files changed, 12 insertions(+), 6 deletions(-) diff --git a/tests/testdisplay.c b/tests/testdisplay.c index cae04e9..69dbf42 100644 --- a/tests/testdisplay.c +++ b/tests/testdisplay.c @@ -909,7 +909,7 @@ set_mode(struct connector *c) * Each connector has a corresponding encoder, except in the SDVO case * where an encoder may have multiple connectors. */ -static void update_display(void) +static int update_display(void) { struct connector *connectors; int c; @@ -918,13 +918,13 @@ static void update_display(void) if (!resources) { fprintf(stderr, drmModeGetResources failed: %s\n, strerror(errno)); - return; + return 0; } connectors = calloc(resources-count_connectors, sizeof(struct connector)); if (!connectors) - return; + return 0; if (dump_info) { dump_connectors(); @@ -940,8 +940,7 @@ static void update_display(void) } } drmModeFreeResources(resources); - if (dump_info || test_all_modes) - exit(0); + return 1; } extern char *optarg; @@ -1138,7 +1137,14 @@ int main(int argc, char **argv) goto out_stdio_off; } - update_display(); + if (!update_display()) { + ret = 1; + goto out_stdio_off; + } + + if (dump_info || test_all_modes) + goto out_stdio_off; + g_main_loop_run(mainloop); out_stdio_off: -- 1.7.4.1 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [gpu-tools 5/7] testdisplay: remove wrong return statement
From: Paulo Zanoni paulo.r.zan...@intel.com It seems that the kernel patches required by the TEST_PLANES feature are still not upstream, so I didn't test this patch. Signed-off-by: Paulo Zanoni paulo.r.zan...@intel.com --- tests/testdisplay.c |1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/tests/testdisplay.c b/tests/testdisplay.c index 69dbf42..d650537 100644 --- a/tests/testdisplay.c +++ b/tests/testdisplay.c @@ -677,7 +677,6 @@ connector_find_plane(struct connector *c) drmModeFreePlane(ovr); } - return 4; return id; } -- 1.7.4.1 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [gpu-tools 6/7] drm_open_any: explain why we are abort()ing
From: Paulo Zanoni paulo.r.zan...@intel.com Signed-off-by: Paulo Zanoni paulo.r.zan...@intel.com --- lib/drmtest.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/lib/drmtest.c b/lib/drmtest.c index 95df93f..7e2c3fe 100644 --- a/lib/drmtest.c +++ b/lib/drmtest.c @@ -64,6 +64,7 @@ int drm_open_any(void) close(fd); } + fprintf(stderr, failed to open any drm device\n); abort(); } -- 1.7.4.1 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [gpu-tools 7/7] getstats: remove useless assertion
From: Paulo Zanoni paulo.r.zan...@intel.com getstats.c:48:2: warning: comparison of unsigned expression = 0 is always true Signed-off-by: Paulo Zanoni paulo.r.zan...@intel.com --- tests/getstats.c |2 -- 1 files changed, 0 insertions(+), 2 deletions(-) This patch can be applied to both intel-gpu-tools and mesa/drm. Whoever apply this to intel-gpu-tools, please apply to mesa/drm too. diff --git a/tests/getstats.c b/tests/getstats.c index 8d40d0b..8a7d299 100644 --- a/tests/getstats.c +++ b/tests/getstats.c @@ -45,8 +45,6 @@ int main(int argc, char **argv) ret = ioctl(fd, DRM_IOCTL_GET_STATS, stats); assert(ret == 0); - assert(stats.count = 0); - close(fd); return 0; } -- 1.7.4.1 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [gpu-tools 6/7 v2] drm_open_any: explain why we are abort()ing
From: Paulo Zanoni paulo.r.zan...@intel.com Signed-off-by: Paulo Zanoni paulo.r.zan...@intel.com --- lib/drmtest.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/lib/drmtest.c b/lib/drmtest.c index 95df93f..5d5d180 100644 --- a/lib/drmtest.c +++ b/lib/drmtest.c @@ -64,6 +64,7 @@ int drm_open_any(void) close(fd); } + fprintf(stderr, failed to open any drm device (retry as root?)\n); abort(); } -- 1.7.4.1 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx