Re: [PATCH v8 5/6] drm/i915: enable scrambling

2017-03-08 Thread Ander Conselvan De Oliveira
On Wed, 2017-03-08 at 19:07 +0530, Shashank Sharma wrote:
>  Geminilake platform sports a native HDMI 2.0 controller, and is
>  capable of driving pixel-clocks upto 594Mhz. HDMI 2.0 spec
>  mendates scrambling for these higher clocks, for reduced RF footprint.
> 
>  This patch checks if the monitor supports scrambling, and if required,
>  enables it during the modeset.
> 
>  V2: Addressed review comments from Ville:
>  - Do not track scrambling status in DRM layer, track somewhere in
>driver like in intel_crtc_state.
>  - Don't talk to monitor at such a low layer, set monitor scrambling
>in intel_enable_ddi() before enabling the port.
> 
>  V3: Addressed review comments from Jani
>  - In comments, function names, use "sink" instead of "monitor",
>so that the implementation could be close to the language of
>HDMI spec.
> 
> V4: Addressed review comment from Maarten
>  - scrambling -> hdmi_scrambling
>  - high_tmds_clock_ratio -> hdmi_high_tmds_clock_ratio
> 
> V5: Addressed review comments from Ville and Ander
>  - Do not modifiy the crtc_state after compute_config. Move all
>scrambling and tmds_clock_ratio calcutations to compute_config.
>  - While setting scrambling for source/sink, do not check the
>conditions again, just go by the crtc_state flags. This will
>simplyfy the condition checks.
> 
> V6: Addressed review comments from Ville
>  - Do not add IS_GLK check in disable/enable function, instead add it
>in compute_config, while setting state flags.
>  - Remove unnecessary paranthesis.
>  - Simplyfy handle_sink_scrambling function as suggested.
>  - Add readout code for scrambling status in get_ddi_config and add a
>check for the same in pipe_config_compare.
> 
> V7: Addressed review comments from Ander/Ville
>  - No separate function for source scrambling, make it inline
>  - Align the last line of the macro TRANS_DDI_HDMI_SCRAMBLING_MASK
>  - Do not add platform check while setting source scrambling
>  - Use pipe_config instead of crtc->config to set sink scrambling
>  - To readout scrambling status, Compare with SCRAMBLING_MASK
>not any of its bits
>  - Remove platform check in intel_pipe_config_compare while checking
>scrambling status
> 
> V8: Fixed mege conflict, Addressed review comments from Ander
>  - Remove the desciption/comment about scrambling fom the caller, move
>it to the function
>  - Move the IS_GLK check into scrambling function
>  - Fix alignment
> 
> Signed-off-by: Shashank Sharma 
> ---
>  drivers/gpu/drm/i915/i915_reg.h  |  7 
>  drivers/gpu/drm/i915/intel_ddi.c | 19 +++
>  drivers/gpu/drm/i915/intel_display.c |  3 ++
>  drivers/gpu/drm/i915/intel_drv.h | 10 ++
>  drivers/gpu/drm/i915/intel_hdmi.c| 62 
> 
>  5 files changed, 101 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
> index cc843f9..2d50fdc 100644
> --- a/drivers/gpu/drm/i915/i915_reg.h
> +++ b/drivers/gpu/drm/i915/i915_reg.h
> @@ -7830,7 +7830,14 @@ enum {
>  #define  TRANS_DDI_EDP_INPUT_B_ONOFF (5<<12)
>  #define  TRANS_DDI_EDP_INPUT_C_ONOFF (6<<12)
>  #define  TRANS_DDI_DP_VC_PAYLOAD_ALLOC   (1<<8)
> +#define  TRANS_DDI_HDMI_SCRAMBLER_CTS_ENABLE (1<<7)
> +#define  TRANS_DDI_HDMI_SCRAMBLER_RESET_FREQ (1<<6)
>  #define  TRANS_DDI_BFI_ENABLE(1<<4)
> +#define  TRANS_DDI_HIGH_TMDS_CHAR_RATE   (1<<4)
> +#define  TRANS_DDI_HDMI_SCRAMBLING   (1<<0)
> +#define  TRANS_DDI_HDMI_SCRAMBLING_MASK (TRANS_DDI_HDMI_SCRAMBLER_CTS_ENABLE 
> \
> + | TRANS_DDI_HDMI_SCRAMBLER_RESET_FREQ \
> + | TRANS_DDI_HDMI_SCRAMBLING)
>  
>  /* DisplayPort Transport Control */
>  #define _DP_TP_CTL_A 0x64040
> diff --git a/drivers/gpu/drm/i915/intel_ddi.c 
> b/drivers/gpu/drm/i915/intel_ddi.c
> index 0467676..b3e4c4a 100644
> --- a/drivers/gpu/drm/i915/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/intel_ddi.c
> @@ -1309,6 +1309,11 @@ void intel_ddi_enable_transcoder_func(const struct 
> intel_crtc_state *crtc_state)
>   temp |= TRANS_DDI_MODE_SELECT_HDMI;
>   else
>   temp |= TRANS_DDI_MODE_SELECT_DVI;
> +
> + if (crtc_state->hdmi_scrambling)
> + temp |= TRANS_DDI_HDMI_SCRAMBLING_MASK;
> + if (crtc_state->hdmi_high_tmds_clock_ratio)
> + temp |= TRANS_DDI_HIGH_TMDS_CHAR_RATE;
>   } else if (type == INTEL_OUTPUT_ANALOG) {
>   temp |= TRANS_DDI_MODE_SELECT_FDI;
>   temp |= (crtc_state->fdi_lanes - 1) << 1;
> @@ -1882,6 +1887,9 @@ static void intel_enable_ddi(struct intel_encoder 
> *intel_encoder,
>   struct intel_digital_port *intel_dig_port =
>   enc_to_dig_port(encoder);
>  
> + intel_hdmi_handle_sink_scrambling(intel_encoder,
> + 

Re: linux-4.11-rc1/drivers/gpu/drm/exynos/exynos5433_drm_decon.c:681: suspicious mask ?

2017-03-08 Thread Inki Dae
Hello David,

Thanks for report.

2017년 03월 06일 19:05에 David Binderman 이(가) 쓴 글:
> Hello there,
> 
> linux-4.11-rc1/drivers/gpu/drm/exynos/exynos5433_drm_decon.c:681]: (warning) 
> Result of operator '|' is always true if one operand is non-zero. Did you 
> intend to use '&'?
> 

Right. this is known issue and below patch fixes this,
http://www.spinics.net/lists/dri-devel/msg132589.html

This patch will go to -fixes.

> Source code is
> 
> if (ctx->out_type | I80_HW_TRG) {
> 
> Also in the same file:
> 
> [drivers/gpu/drm/exynos/exynos5433_drm_decon.c:131]: (style) Same expression 
> on both sides of '|'.
> 
> Source code is
> 
>writel(TRIGCON_TE_AUTO_MASK | TRIGCON_SWTRIGEN
>| TRIGCON_TE_AUTO_MASK | TRIGCON_SWTRIGEN,

In this case, only problem is two flags are set in duplicate. This should be 
cleaned up. Thanks. :)

> 
> Regards
> 
> David Binderman
> 
> 
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2 03/12] drm/exynos/decon5433: fix vblank event handling

2017-03-08 Thread Andrzej Hajda
On 09.03.2017 04:54, Michel Dänzer wrote:
> On 08/03/17 11:58 PM, Andrzej Hajda wrote:
>> Current implementation of event handling assumes that vblank interrupt is
>> always called at the right time. It is not true, it can be delayed due to
>> various reasons. As a result different races can happen. The patch fixes
>> the issue by using hardware frame counter present in DECON to serialize
>> vblank and commit completion events.
>>
>> Signed-off-by: Andrzej Hajda 
>> ---
>> v2:
>>   - added internal decon_get_frame_count function,
>>   - updated frame counter on flush,
>>   - misc style fixes (thank Inki)
> [...]
>
>> @@ -579,6 +636,23 @@ static const struct component_ops decon_component_ops = 
>> {
>>  .unbind = decon_unbind,
>>  };
>>  
>> +static void decon_handle_vblank(struct decon_context *ctx)
>> +{
>> +u32 frm;
>> +
>> +spin_lock(>vblank_lock);
>> +
>> +frm = decon_get_frame_count(ctx, true);
>> +
>> +if (frm != ctx->frame_id) {
>> +if (frm > ctx->frame_id)
>> +drm_crtc_handle_vblank(>crtc->base);
> This comparison isn't safe WRT the counter value returned by
> decon_get_frame_count wrapping around.

And knowing that max framerate is 60fps it will happen after:

0x / 60fps / 60sec / 60min / 24h / 365days = 2.3 years

So after 2.3 years of uninterrupted work of panel/TV we will lose one or
two vblanks :) Highly improbable and even then low damage.

> If it goes all the way up to
> 0x before wrapping around to zero, it can be handled e.g. by
>
>   if ((s32)(frm - ctx->frame_id) > 0)
>
> otherwise it gets a bit more complicated.
>
>
But the fix looks simple so I think it is worth to fix it. Thanks.

Regards

Andrzej




___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 100104] Gallium-9 hitting LLVM assert when trying to start EVE-Online

2017-03-08 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=100104

--- Comment #3 from Michel Dänzer  ---
Here is fine.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 100104] Gallium-9 hitting LLVM assert when trying to start EVE-Online

2017-03-08 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=100104

--- Comment #2 from Mathieu Belanger  ---
Work fine with LLVM4-rc3 ang mesa git so I assume the but is in LLVM.

Where do I post LLVM bisect if I do it as I did not yet get a response for
manually subscribe to the bugzilla?

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 99718] RX480 - MCLK stuck at 300

2017-03-08 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=99718

Mathieu Belanger  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |WONTFIX

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 15/24] drm/radeon: Merge pre/postclose hooks

2017-03-08 Thread Alex Deucher
On Wed, Mar 8, 2017 at 9:25 AM, Christian König
 wrote:
> Reviewed-by: Christian König  for this one and
> #19.

Applied both.

Thanks!

Alex

>
> Christian.
>
>
> Am 08.03.2017 um 15:12 schrieb Daniel Vetter:
>>
>> Again no apparent explanation for the split except hysterical raisins.
>> Merging them also makes it a bit more obviuos what's going on wrt the
>> runtime pm refdancing.
>>
>> Cc: Alex Deucher 
>> Cc: Christian König 
>> Cc: amd-...@lists.freedesktop.org
>> Signed-off-by: Daniel Vetter 
>> ---
>>   drivers/gpu/drm/radeon/radeon_drv.c |  3 ---
>>   drivers/gpu/drm/radeon/radeon_kms.c | 42
>> +
>>   2 files changed, 14 insertions(+), 31 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/radeon/radeon_drv.c
>> b/drivers/gpu/drm/radeon/radeon_drv.c
>> index 956c425e639e..312436a8d9e5 100644
>> --- a/drivers/gpu/drm/radeon/radeon_drv.c
>> +++ b/drivers/gpu/drm/radeon/radeon_drv.c
>> @@ -108,8 +108,6 @@ void radeon_driver_lastclose_kms(struct drm_device
>> *dev);
>>   int radeon_driver_open_kms(struct drm_device *dev, struct drm_file
>> *file_priv);
>>   void radeon_driver_postclose_kms(struct drm_device *dev,
>>  struct drm_file *file_priv);
>> -void radeon_driver_preclose_kms(struct drm_device *dev,
>> -   struct drm_file *file_priv);
>>   int radeon_suspend_kms(struct drm_device *dev, bool suspend,
>>bool fbcon, bool freeze);
>>   int radeon_resume_kms(struct drm_device *dev, bool resume, bool fbcon);
>> @@ -538,7 +536,6 @@ static struct drm_driver kms_driver = {
>> DRIVER_PRIME | DRIVER_RENDER,
>> .load = radeon_driver_load_kms,
>> .open = radeon_driver_open_kms,
>> -   .preclose = radeon_driver_preclose_kms,
>> .postclose = radeon_driver_postclose_kms,
>> .lastclose = radeon_driver_lastclose_kms,
>> .set_busid = drm_pci_set_busid,
>> diff --git a/drivers/gpu/drm/radeon/radeon_kms.c
>> b/drivers/gpu/drm/radeon/radeon_kms.c
>> index 56f35c06742c..a32a62e03a44 100644
>> --- a/drivers/gpu/drm/radeon/radeon_kms.c
>> +++ b/drivers/gpu/drm/radeon/radeon_kms.c
>> @@ -691,13 +691,26 @@ int radeon_driver_open_kms(struct drm_device *dev,
>> struct drm_file *file_priv)
>>* @dev: drm dev pointer
>>* @file_priv: drm file
>>*
>> - * On device post close, tear down vm on cayman+ (all asics).
>> + * On device close, tear down hyperz and cmask filps on r1xx-r5xx
>> + * (all asics).  And tear down vm on cayman+ (all asics).
>>*/
>>   void radeon_driver_postclose_kms(struct drm_device *dev,
>>  struct drm_file *file_priv)
>>   {
>> struct radeon_device *rdev = dev->dev_private;
>>   + pm_runtime_get_sync(dev->dev);
>> +
>> +   mutex_lock(>gem.mutex);
>> +   if (rdev->hyperz_filp == file_priv)
>> +   rdev->hyperz_filp = NULL;
>> +   if (rdev->cmask_filp == file_priv)
>> +   rdev->cmask_filp = NULL;
>> +   mutex_unlock(>gem.mutex);
>> +
>> +   radeon_uvd_free_handles(rdev, file_priv);
>> +   radeon_vce_free_handles(rdev, file_priv);
>> +
>> /* new gpu have virtual address space support */
>> if (rdev->family >= CHIP_CAYMAN && file_priv->driver_priv) {
>> struct radeon_fpriv *fpriv = file_priv->driver_priv;
>> @@ -721,33 +734,6 @@ void radeon_driver_postclose_kms(struct drm_device
>> *dev,
>> pm_runtime_put_autosuspend(dev->dev);
>>   }
>>   -/**
>> - * radeon_driver_preclose_kms - drm callback for pre close
>> - *
>> - * @dev: drm dev pointer
>> - * @file_priv: drm file
>> - *
>> - * On device pre close, tear down hyperz and cmask filps on r1xx-r5xx
>> - * (all asics).
>> - */
>> -void radeon_driver_preclose_kms(struct drm_device *dev,
>> -   struct drm_file *file_priv)
>> -{
>> -   struct radeon_device *rdev = dev->dev_private;
>> -
>> -   pm_runtime_get_sync(dev->dev);
>> -
>> -   mutex_lock(>gem.mutex);
>> -   if (rdev->hyperz_filp == file_priv)
>> -   rdev->hyperz_filp = NULL;
>> -   if (rdev->cmask_filp == file_priv)
>> -   rdev->cmask_filp = NULL;
>> -   mutex_unlock(>gem.mutex);
>> -
>> -   radeon_uvd_free_handles(rdev, file_priv);
>> -   radeon_vce_free_handles(rdev, file_priv);
>> -}
>> -
>>   /*
>>* VBlank related functions.
>>*/
>
>
>
> ___
> amd-gfx mailing list
> amd-...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2 03/12] drm/exynos/decon5433: fix vblank event handling

2017-03-08 Thread Michel Dänzer
On 08/03/17 11:58 PM, Andrzej Hajda wrote:
> Current implementation of event handling assumes that vblank interrupt is
> always called at the right time. It is not true, it can be delayed due to
> various reasons. As a result different races can happen. The patch fixes
> the issue by using hardware frame counter present in DECON to serialize
> vblank and commit completion events.
> 
> Signed-off-by: Andrzej Hajda 
> ---
> v2:
>   - added internal decon_get_frame_count function,
>   - updated frame counter on flush,
>   - misc style fixes (thank Inki)

[...]

> @@ -579,6 +636,23 @@ static const struct component_ops decon_component_ops = {
>   .unbind = decon_unbind,
>  };
>  
> +static void decon_handle_vblank(struct decon_context *ctx)
> +{
> + u32 frm;
> +
> + spin_lock(>vblank_lock);
> +
> + frm = decon_get_frame_count(ctx, true);
> +
> + if (frm != ctx->frame_id) {
> + if (frm > ctx->frame_id)
> + drm_crtc_handle_vblank(>crtc->base);

This comparison isn't safe WRT the counter value returned by
decon_get_frame_count wrapping around. If it goes all the way up to
0x before wrapping around to zero, it can be handled e.g. by

if ((s32)(frm - ctx->frame_id) > 0)

otherwise it gets a bit more complicated.


-- 
Earthling Michel Dänzer   |   http://www.amd.com
Libre software enthusiast | Mesa and X developer
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 3/4] phy: rockchip-typec: support DP phy switch

2017-03-08 Thread Chris Zhong

Hi Heiko and Brain

On 03/09/2017 09:02 AM, Heiko Stübner wrote:

Am Mittwoch, 8. März 2017, 16:39:23 CET schrieb Brian Norris:

On Fri, Feb 10, 2017 at 03:44:13PM +0800, Chris Zhong wrote:

There are 2 Type-c PHYs in RK3399, but only one DP controller. Hence
only one PHY can connect to DP controller at one time, the other should
be disconnected. The GRF_SOC_CON26 register has a switch bit to do it,
set this bit means enable PHY 1, clear this bit means enable PHY 0.

Signed-off-by: Chris Zhong 
---

  drivers/phy/phy-rockchip-typec.c | 9 +
  1 file changed, 9 insertions(+)

diff --git a/drivers/phy/phy-rockchip-typec.c
b/drivers/phy/phy-rockchip-typec.c index 7cfb0f8..1604aaa 100644
--- a/drivers/phy/phy-rockchip-typec.c
+++ b/drivers/phy/phy-rockchip-typec.c
@@ -267,6 +267,7 @@ struct rockchip_usb3phy_port_cfg {

struct usb3phy_reg usb3tousb2_en;
struct usb3phy_reg external_psm;
struct usb3phy_reg pipe_status;

+   struct usb3phy_reg uphy_dp_sel;

  };
  
  struct rockchip_typec_phy {


@@ -736,6 +737,7 @@ static const struct phy_ops rockchip_usb3_phy_ops = {

  static int rockchip_dp_phy_power_on(struct phy *phy)
  {
  
  	struct rockchip_typec_phy *tcphy = phy_get_drvdata(phy);


+   struct rockchip_usb3phy_port_cfg *cfg = >port_cfgs;

int new_mode, ret = 0;
u32 val;

@@ -766,6 +768,8 @@ static int rockchip_dp_phy_power_on(struct phy *phy)

tcphy_phy_init(tcphy, new_mode);

}

+   property_enable(tcphy, >uphy_dp_sel, 1);
+

ret = readx_poll_timeout(readl, tcphy->base + DP_MODE_CTL,

Idea for future work: this should just be readl_poll_timeout() here, and
throughout the driver.
Yes, the readl_poll_timeout is better, if next version series is needed, 
I am going to

add it in a separate patch behind this patch.

 val, val & DP_MODE_A2, 1000,
 PHY_MODE_SET_TIMEOUT);

@@ -869,6 +873,11 @@ static int tcphy_parse_dt(struct rockchip_typec_phy
*tcphy,>
if (ret)

return ret;

+   ret = tcphy_get_param(dev, >uphy_dp_sel,
+ "rockchip,uphy-dp-sel");
+   if (ret)
+   return ret;

What about existing device trees? You're essentially adding this
new property and requiring it at the same time.

Or are we considering no RK3399 DP stable at the moment? I guess we
haven't actually merged any device trees that support this yet, no?

An interesting situation we're in here. On the one hand, you're right this
breaks "backwards compatiblity".

But on the other hand, the type-c phy is currently very much unused. The only
current board rk3399-evb.dts does not enable them (so they're disabled
everywhere) and we have neither dwc3 nor dp nodes in any rk3399 devicetrees so
far. Also Rob was ok with the binding change :-) .

So from my pov, I'd say it _should_ be ok, as nothing is using the phys at all
yet and thus there is nothing that could get broken.


Heiko
Thanks Heiko. On the other hand, these is no any display node at rk3399 
dtsi,

so I can not add the DP node, do you or Mark.Yao have plan to complete it?




Brian


+

tcphy->grf_regs = syscon_regmap_lookup_by_phandle(dev->of_node,

  "rockchip,grf");

if (IS_ERR(tcphy->grf_regs)) {







--
Chris Zhong


___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] intel: fix a conversion format mismatch

2017-03-08 Thread Chih-Wei Huang
To avoid the warning:

external/libdrm/intel/intel_bufmgr.c:362:20: warning: more '%' conversions than 
data arguments [-Wformat]
fprintf(stderr, "%s: Mappable aperture size hardcoded to 64MiB\n");
 ~^

Change-Id: I6c1b0a9e3004aacde0d64662de1144cadff30132
---
 intel/intel_bufmgr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/intel/intel_bufmgr.c b/intel/intel_bufmgr.c
index 42f5f62..5bad93f 100644
--- a/intel/intel_bufmgr.c
+++ b/intel/intel_bufmgr.c
@@ -359,7 +359,7 @@ static size_t
 drm_intel_probe_agp_aperture_size(int fd)
 {
/* Nothing seems to rely on this value on Android anyway... */
-   fprintf(stderr, "%s: Mappable aperture size hardcoded to 64MiB\n");
+   fprintf(stderr, "%s: Mappable aperture size hardcoded to 64MiB\n", 
__func__);
return 64 * 1024 * 1024;
 }
 #endif
-- 
1.9.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 100067] [OpenCL] const int in argument list crashes build

2017-03-08 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=100067

--- Comment #1 from Mig  ---
The same problem occurs when running the mat-mul example taken from

https://cgit.freedesktop.org/~tstellar/opencl-example

[mig@antergos-mig opencl-example]$ ./mat-mul
There are 1 platforms.
There are 1 GPU devices.
clCreateProgramWithSource() suceeded.
Speicherzugriffsfehler (Speicherabzug geschrieben)

When int is replaced with unsigned int the the program runs fine:

[mig@antergos-mig opencl-example]$ ./mat-mul 
There are 1 platforms.
There are 1 GPU devices.
clCreateProgramWithSource() suceeded.
clBuildProgram() suceeded.
clCreateKernel() suceeded.
clSetKernelArg() succeeded.
clSetKernelArg() succeeded.
clSetKernelArg() succeeded.
clSetKernelArg() succeeded.
clSetKernelArg() succeeded.
clSetKernelArg() succeeded.
clSetKernelArg() succeeded.
50 94 178 
60 120 220

Maybe it is related to the fact that the platform reports as 64bit adressspace:
(clinfo reports incorrectly the "Global memory size" beeing 7GB whereas it
shpuld report 2GB)

[mig@antergos-mig ~]$ clinfo
Number of platforms   1
  Platform Name   Clover
  Platform Vendor Mesa
  Platform VersionOpenCL 1.1 Mesa 17.0.1
  Platform ProfileFULL_PROFILE
  Platform Extensions cl_khr_icd
  Platform Extensions function suffix MESA

  Platform Name   Clover
Number of devices 1
  Device Name AMD TONGA (DRM 3.8.0 /
4.9.11-1-ARCH, LLVM 3.9.1)
  Device Vendor   AMD
  Device Vendor ID0x1002
  Device Version  OpenCL 1.1 Mesa 17.0.1
  Driver Version  17.0.1
  Device OpenCL C Version OpenCL C 1.1 
  Device Type GPU
  Device Profile  FULL_PROFILE
  Max compute units   28
  Max clock frequency 990MHz
  Max work item dimensions3
  Max work item sizes 256x256x256
  Max work group size 256
  Preferred work group size multiple  64
  Preferred / native vector sizes 
char16 / 16  
short8 / 8   
int  4 / 4   
long 2 / 2   
half 0 / 0(n/a)
float4 / 4   
double   2 / 2   
(cl_khr_fp64)
  Half-precision Floating-point support   (n/a)
  Single-precision Floating-point support (core)
Denormals No
Infinity and NANs Yes
Round to nearest  Yes
Round to zero No
Round to infinity No
IEEE754-2008 fused multiply-add   No
Support is emulated in software   No
Correctly-rounded divide and sqrt operations  No
  Double-precision Floating-point support (cl_khr_fp64)
Denormals Yes
Infinity and NANs Yes
Round to nearest  Yes
Round to zero Yes
Round to infinity Yes
IEEE754-2008 fused multiply-add   Yes
Support is emulated in software   No
Correctly-rounded divide and sqrt operations  No
  Address bits64, Little-Endian
  Global memory size  7606060644 (7.084GiB)
  Error Correction supportNo
  Max memory allocation   1901515161 (1.771GiB)
  Unified memory for Host and Device  Yes
  Minimum alignment for any data type 128 bytes
  Alignment of base address   1024 bits (128 bytes)
  Global Memory cache typeNone
  Image support   No
  Local memory type   Local
  Local memory size   32768 (32KiB)
  Max constant buffer size1901515161 (1.771GiB)
  Max number of constant args 16
  Max size of kernel argument 1024
  Queue properties
Out-of-order execution

Re: [PATCH 3/4] phy: rockchip-typec: support DP phy switch

2017-03-08 Thread Heiko Stübner
Am Mittwoch, 8. März 2017, 16:39:23 CET schrieb Brian Norris:
> On Fri, Feb 10, 2017 at 03:44:13PM +0800, Chris Zhong wrote:
> > There are 2 Type-c PHYs in RK3399, but only one DP controller. Hence
> > only one PHY can connect to DP controller at one time, the other should
> > be disconnected. The GRF_SOC_CON26 register has a switch bit to do it,
> > set this bit means enable PHY 1, clear this bit means enable PHY 0.
> > 
> > Signed-off-by: Chris Zhong 
> > ---
> > 
> >  drivers/phy/phy-rockchip-typec.c | 9 +
> >  1 file changed, 9 insertions(+)
> > 
> > diff --git a/drivers/phy/phy-rockchip-typec.c
> > b/drivers/phy/phy-rockchip-typec.c index 7cfb0f8..1604aaa 100644
> > --- a/drivers/phy/phy-rockchip-typec.c
> > +++ b/drivers/phy/phy-rockchip-typec.c
> > @@ -267,6 +267,7 @@ struct rockchip_usb3phy_port_cfg {
> > 
> > struct usb3phy_reg usb3tousb2_en;
> > struct usb3phy_reg external_psm;
> > struct usb3phy_reg pipe_status;
> > 
> > +   struct usb3phy_reg uphy_dp_sel;
> > 
> >  };
> >  
> >  struct rockchip_typec_phy {
> > 
> > @@ -736,6 +737,7 @@ static const struct phy_ops rockchip_usb3_phy_ops = {
> > 
> >  static int rockchip_dp_phy_power_on(struct phy *phy)
> >  {
> >  
> > struct rockchip_typec_phy *tcphy = phy_get_drvdata(phy);
> > 
> > +   struct rockchip_usb3phy_port_cfg *cfg = >port_cfgs;
> > 
> > int new_mode, ret = 0;
> > u32 val;
> > 
> > @@ -766,6 +768,8 @@ static int rockchip_dp_phy_power_on(struct phy *phy)
> > 
> > tcphy_phy_init(tcphy, new_mode);
> > 
> > }
> > 
> > +   property_enable(tcphy, >uphy_dp_sel, 1);
> > +
> > 
> > ret = readx_poll_timeout(readl, tcphy->base + DP_MODE_CTL,
> 
> Idea for future work: this should just be readl_poll_timeout() here, and
> throughout the driver.
> 
> >  val, val & DP_MODE_A2, 1000,
> >  PHY_MODE_SET_TIMEOUT);
> > 
> > @@ -869,6 +873,11 @@ static int tcphy_parse_dt(struct rockchip_typec_phy
> > *tcphy,> 
> > if (ret)
> > 
> > return ret;
> > 
> > +   ret = tcphy_get_param(dev, >uphy_dp_sel,
> > + "rockchip,uphy-dp-sel");
> > +   if (ret)
> > +   return ret;
> 
> What about existing device trees? You're essentially adding this
> new property and requiring it at the same time.
> 
> Or are we considering no RK3399 DP stable at the moment? I guess we
> haven't actually merged any device trees that support this yet, no?

An interesting situation we're in here. On the one hand, you're right this 
breaks "backwards compatiblity".

But on the other hand, the type-c phy is currently very much unused. The only 
current board rk3399-evb.dts does not enable them (so they're disabled 
everywhere) and we have neither dwc3 nor dp nodes in any rk3399 devicetrees so 
far. Also Rob was ok with the binding change :-) .

So from my pov, I'd say it _should_ be ok, as nothing is using the phys at all 
yet and thus there is nothing that could get broken.


Heiko

> 
> Brian
> 
> > +
> > 
> > tcphy->grf_regs = syscon_regmap_lookup_by_phandle(dev->of_node,
> > 
> >   "rockchip,grf");
> > 
> > if (IS_ERR(tcphy->grf_regs)) {


___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [linux-sunxi] [PATCH 14/15] ARM: sun5i: a10s: Add the HDMI controller node

2017-03-08 Thread Chen-Yu Tsai
Hi,

On Tue, Mar 7, 2017 at 4:56 PM, Maxime Ripard
 wrote:
> The A10s has an HDMI controller connected to the second TCON channel. Add
> it to our DT.
>
> Signed-off-by: Maxime Ripard 
> ---
>  arch/arm/boot/dts/sun5i-a10s.dtsi | 34 -
>  arch/arm/boot/dts/sun5i.dtsi  |  1 +-
>  2 files changed, 35 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/boot/dts/sun5i-a10s.dtsi 
> b/arch/arm/boot/dts/sun5i-a10s.dtsi
> index 074485782a4a..3482c9d2b120 100644
> --- a/arch/arm/boot/dts/sun5i-a10s.dtsi
> +++ b/arch/arm/boot/dts/sun5i-a10s.dtsi
> @@ -72,7 +72,33 @@
> };
> };
>
> +   display-engine {
> +   compatible = "allwinner,sun5i-a10s-display-engine",
> +"allwinner,sun5i-a13-display-engine";
> +   allwinner,pipelines = <>;
> +   };
> +
> soc@01c0 {
> +   hdmi0: hdmi@01c16000 {

Nit: is the 0 suffix needed? I don't see any indication that there is
a second controller.

> +   compatible = "allwinner,sun5i-a10s-hdmi";
> +   reg = <0x01c16000 0x1000>;
> +   clocks = < CLK_AHB_HDMI>, < CLK_HDMI>,
> +< CLK_PLL_VIDEO0_2X>,
> +< CLK_PLL_VIDEO1_2X>;
> +   clock-names = "ahb", "mod", "pll-0", "pll-1";
> +   status = "disabled";
> +
> +   port {
> +   #address-cells = <1>;
> +   #size-cells = <0>;
> +
> +   hdmi0_in_tcon0: endpoint@0 {
> +   reg = <0>;
> +   remote-endpoint = <_out_hdmi0>;
> +   };
> +   };
> +   };
> +
> pwm: pwm@01c20e00 {
> compatible = "allwinner,sun5i-a10s-pwm";
> reg = <0x01c20e00 0xc>;
> @@ -129,3 +155,11 @@
>
>  _a {
>  };
> +
> +_out {
> +   tcon0_out_hdmi0: endpoint@2 {
> +   reg = <2>;
> +   remote-endpoint = <_in_tcon0>;
> +   allwinner,tcon-channel = <1>;
> +   };
> +};
> diff --git a/arch/arm/boot/dts/sun5i.dtsi b/arch/arm/boot/dts/sun5i.dtsi
> index f3b6e19244f9..3d009b2aa42a 100644
> --- a/arch/arm/boot/dts/sun5i.dtsi
> +++ b/arch/arm/boot/dts/sun5i.dtsi
> @@ -273,6 +273,7 @@
> tcon0_out_tve0: endpoint@1 {
> reg = <1>;
> remote-endpoint = 
> <_in_tcon0>;
> +   allwinner,tcon-channel = <1>;

This looks like a separate patch, probably following the binding change?

Regards
ChenYu

> };
> };
> };
> --
> git-series 0.8.11
>
> --
> You received this message because you are subscribed to the Google Groups 
> "linux-sunxi" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to linux-sunxi+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [kbuild-all] 0day 'make htmldocs' testing (was: Re: [PATCH] drm/dp: Add missing description to parameter)

2017-03-08 Thread Philip Li
On Wed, Mar 08, 2017 at 10:41:37AM +0200, Jani Nikula wrote:
> On Wed, 08 Mar 2017, Jani Nikula  wrote:
> > On Wed, 08 Mar 2017, Sean Paul  wrote:
> >> On Tue, Mar 07, 2017 at 09:35:11PM +0100, Tomeu Vizoso wrote:
> >>> Gabriel Krisman reported these warnings when building the documentation:
> >>> 
> >>>  ./drivers/gpu/drm/drm_dp_helper.c:1165: warning: No description found
> >>> for parameter 'crtc'
> >>> ./drivers/gpu/drm/drm_dp_helper.c:1166: warning: No description found
> >>> for parameter 'crtc'
> >>> 
> >>
> >> I've now added htmldocs build to my pre-merge build testing so I'll 
> >> hopefully
> >> catch this earlier (no promises).
> >
> > Dear 0day folks, what's the status of 'make htmldocs' build testing on
> > patches posted to dri-devel and intel-gfx mailing lists? I see
> > occasional mails reporting issues in documentation, but sometimes there
> > are no reports.
> >
> > And while I'm reaching out, have we ensured testing of the new repos and
> > branches we have? There's the drm-misc and drm-tip repos. drm-tip is an
> > integration tree, and other repos and branches feed to it. If you don't
> > have anything such, we should probably discuss whether it's best to test
> > the individual trees, or the integration tree, or both.
> 
> Okay, I see that you've sent reports about drm-tip, but there's nothing
> on the drm-misc branches after it moved from drm-intel.git to a repo of
> its own. Is drm-tip enough, or should we expand on drm-misc?
hi Jani, currently we had covered several drm repos (list a few of them below).
Can you share me the url of drm-misc, probably it is not covered yet.

git://anongit.freedesktop.org/drm/drm-tip
git://anongit.freedesktop.org/drm-intel
git://people.freedesktop.org/~jani/drm

> 
> BR,
> Jani.
> 
> >
> >
> > BR,
> > Jani.
> 
> -- 
> Jani Nikula, Intel Open Source Technology Center
> ___
> kbuild-all mailing list
> kbuild-...@lists.01.org
> https://lists.01.org/mailman/listinfo/kbuild-all
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 15/15] ARM: sun5i: a10s-olinuxino: Enable HDMI

2017-03-08 Thread Chen-Yu Tsai
On Tue, Mar 7, 2017 at 4:56 PM, Maxime Ripard
 wrote:
> The A10s Olinuxino has an HDMI connector. Make sure we can use it.
>
> Signed-off-by: Maxime Ripard 

Acked-by: Chen-Yu Tsai 
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 6/15] dt-bindings: display: sun4i: Add HDMI display bindings

2017-03-08 Thread Chen-Yu Tsai
On Tue, Mar 7, 2017 at 4:56 PM, Maxime Ripard
 wrote:
> One of the possible output of the display pipeline, on the SoCs that have
> it, is the HDMI controller.
>
> Add a binding for it.
>
> Signed-off-by: Maxime Ripard 

Acked-by: Chen-Yu Tsai 

TODO: A31 will also need a DDC clock.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v5 1/5] arm64: dts: exynos: Add the burst and esc clock frequency properties to DSI node

2017-03-08 Thread Krzysztof Kozlowski
On Wed, Mar 08, 2017 at 01:54:08PM +0900, Hoegeun Kwon wrote:
> Add the burst and esc clock frequency properties to the parent (DSI node).
> Currently the clock is parsed from the port node, while it should be
> taken from the dsi node.
> 
> Signed-off-by: Hoegeun Kwon 
> Reviewed-by: Andrzej Hajda 
> Reviewed-by: Andi Shyti 
> ---
>  arch/arm64/boot/dts/exynos/exynos5433-tm2-common.dtsi | 2 ++
>  1 file changed, 2 insertions(+)
> 

Thanks, applied.

I'll prepare tags with these.

Best regards,
Krzysztof

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH RESEND] drm: dw_hdmi: Don't rely on the status of the bridge for updating HPD

2017-03-08 Thread Romain Perier
Currently, the irq handler that monitores changes for HPD anx RX_SENSE
relies on the status of the bridge for updating the status of the HPD.
The update is done only when the bridge is enabled.

However, on Rockchip platforms we have found use cases where it could be
a problem. When HDMI is being used, turning off/on the screen or
unplugging/re-plugging the cable, the following simplified code path
will happen:

- dw_hdmi_irq() will be triggered by an HPD event, as the bridge is on
hdmi->disabled is false, then the handler will update the rxsense flag
accordingly.
- dw_hdmi_update_power() will be invoked with the mode
DRM_FORCE_UNSPECIFIED and rxsense == 1, so dw_hdmi_poweroff() will be
called and the PHY will be desactivated (its pixel clocks and TMDS)

[...]

- dw_hdmi_bridge_disable() will be invoked, the bridge will be marked as
disabled.

- dw_hdmi_irq() will be triggered by an HPD event, as the bridge is
currently disabled the HPD status won't be updated, so hdmi->rxsense
won't be changed. Even if the data part of the PHY is disabled, this
information coming from the HDMI Transmitter is correct and should be
saved.

[...]

- dw_hdmi_bridge_enable() will be invoked, the bridge will be marked as
enabled.
- dw_hdmi_update_power() will be called. As hdmi->force will be equal to
DRM_FORCE_UNSPECIFIED the function will rely on hdmi->rxsense. This
field has not been updated by the irq handler, so it will be false and
DRM_FORCE_ON won't be put to hdmi->force.

Consequently, most of the time dw_hdmi_poweron() won't be called in this
use case, TMDS won't be re-enabled the PHY won't be re-initialized,
resulting in a "Signal not found".

This commit fixes the issue by removing the check for "!hdmi->disabled".
As already explained, even if the PHY is partially disabled, information
coming from HDMI Transmitter about HPD should be saved for a later use.

Signed-off-by: Romain Perier 
---

Note: Due to an email configuration issue, some of my patches were not
received on infradead.org or vger.kernel.org. It is now fixed, so I
resend this patch for this reason.

 drivers/gpu/drm/bridge/dw-hdmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/bridge/dw-hdmi.c b/drivers/gpu/drm/bridge/dw-hdmi.c
index 235ce7d..b621fc7 100644
--- a/drivers/gpu/drm/bridge/dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/dw-hdmi.c
@@ -1790,7 +1790,7 @@ static irqreturn_t dw_hdmi_irq(int irq, void *dev_id)
if (intr_stat &
(HDMI_IH_PHY_STAT0_RX_SENSE | HDMI_IH_PHY_STAT0_HPD)) {
mutex_lock(>mutex);
-   if (!hdmi->disabled && !hdmi->force) {
+   if (!hdmi->force) {
/*
 * If the RX sense status indicates we're disconnected,
 * clear the software rxsense status.
-- 
2.9.3

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH V3 0/4] megachips-stdpxxxx-ge-b850v3-fw

2017-03-08 Thread Peter Senna Tschudin
On Mon, Mar 06, 2017 at 03:27:16PM +0530, Archit Taneja wrote:
Hi Archit,

> Hi,
> 
> On 3/3/2017 9:27 PM, Peter Senna Tschudin wrote:
> > The video processing pipeline on the second output on the GE B850v3:
> > 
> >   Host -> LVDS|--(STDP4028)--|DP -> DP|--(STDP2690)--|DP++ -> Video output
> > 
> > Each bridge has a dedicated flash containing firmware for supporting the
> > custom design. The result is that in this design neither the STDP4028
> > nor the STDP2690 behave as the stock bridges would. The compatible
> > strings include the suffix "-ge-b850v3-fw" to make it clear that the
> > driver is for the bridges with the firmware which is specific for the GE
> > B850v3.
> > 
> > The driver is powerless to control the video processing pipeline, as the
> > two bridges behaves as a single one. The driver is only needed for
> > telling the host about EDID / HPD, and for giving the host powers to ack
> > interrupts.
> 
> queued Patches 1,2 and 3 to drm-misc-next. Made stdp2690_get_edid static
> in Patch #3 to fix a sparse warning.

What about 4/4, aka the dt change? Do I need an ack from Rob Herring?

Thanks a lot!

[...]
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v11 3/3] arm64: dts: exynos: Add support for S6E3HA2 panel device on TM2 board

2017-03-08 Thread Krzysztof Kozlowski
On Wed, Mar 08, 2017 at 10:42:37AM +0900, Hoegeun Kwon wrote:
> From: Hyungwon Hwang 
> 
> This patch add the panel device tree node for S6E3HA2 display
> controller to TM2 dts.
> 
> Signed-off-by: Hyungwon Hwang 
> Signed-off-by: Andrzej Hajda 
> Signed-off-by: Chanwoo Choi 
> Signed-off-by: Hoegeun Kwon 
> Tested-by: Chanwoo Choi 
> Reviewed-by: Javier Martinez Canillas 
> ---
>  arch/arm64/boot/dts/exynos/exynos5433-tm2.dts | 12 
>  1 file changed, 12 insertions(+)
> 

Thanks, applied.

Best regards,
Krzysztof

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH V3 0/4] megachips-stdpxxxx-ge-b850v3-fw

2017-03-08 Thread Lucas Stach
Am Mittwoch, den 08.03.2017, 10:42 +0100 schrieb Peter Senna Tschudin:
> On Mon, Mar 06, 2017 at 03:27:16PM +0530, Archit Taneja wrote:
> Hi Archit,
> 
> > Hi,
> > 
> > On 3/3/2017 9:27 PM, Peter Senna Tschudin wrote:
> > > The video processing pipeline on the second output on the GE B850v3:
> > > 
> > >   Host -> LVDS|--(STDP4028)--|DP -> DP|--(STDP2690)--|DP++ -> Video output
> > > 
> > > Each bridge has a dedicated flash containing firmware for supporting the
> > > custom design. The result is that in this design neither the STDP4028
> > > nor the STDP2690 behave as the stock bridges would. The compatible
> > > strings include the suffix "-ge-b850v3-fw" to make it clear that the
> > > driver is for the bridges with the firmware which is specific for the GE
> > > B850v3.
> > > 
> > > The driver is powerless to control the video processing pipeline, as the
> > > two bridges behaves as a single one. The driver is only needed for
> > > telling the host about EDID / HPD, and for giving the host powers to ack
> > > interrupts.
> > 
> > queued Patches 1,2 and 3 to drm-misc-next. Made stdp2690_get_edid static
> > in Patch #3 to fix a sparse warning.
> 
> What about 4/4, aka the dt change? Do I need an ack from Rob Herring?
> 
> Thanks a lot!

This one needs to go through Shawn Guo. Now that the driver and binding
are in it is probably best to ask him directly to pick it up.

Regards,
Lucas

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 10/15] drm/sun4i: tcon: Switch mux on only for composite

2017-03-08 Thread Chen-Yu Tsai
On Tue, Mar 7, 2017 at 4:56 PM, Maxime Ripard
 wrote:
> Even though that mux is undocumented, it seems like it needs to be set to 1
> when using composite, and 0 when using HDMI.
>
> Signed-off-by: Maxime Ripard 
> ---
>  drivers/gpu/drm/sun4i/sun4i_tcon.c | 7 ++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c 
> b/drivers/gpu/drm/sun4i/sun4i_tcon.c
> index d2335f109601..93249c5ab1e4 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
> @@ -268,11 +268,16 @@ void sun4i_tcon1_mode_set(struct sun4i_tcon *tcon, 
> struct drm_encoder *encoder,
>SUN4I_TCON_GCTL_IOMAP_MASK,
>SUN4I_TCON_GCTL_IOMAP_TCON1);
>
> +   if (encoder->encoder_type == DRM_MODE_ENCODER_TVDAC)
> +   val = 1;
> +   else
> +   val = 0;
> +
> /*
>  * FIXME: Undocumented bits
>  */
> if (tcon->quirks->has_unknown_mux)
> -   regmap_write(tcon->regs, SUN4I_TCON_MUX_CTRL_REG, 1);
> +   regmap_write(tcon->regs, SUN4I_TCON_MUX_CTRL_REG, val);

We might want to do this the other way around, i.e. exporting

int sun4i_tcon_mux_set(struct drm_device *drm, int encoder_type,
   int pipeline)

and have downstream encoders call it. For the A31, the mux is not exclusively
used for channel 1; there is a mux setting for MIPI DSI as well, but AFAIK
DSI is connected to channel 0.

Additionally, the mux registers are only valid in the first TCON, meaning
it must available be active in 2 pipeline chips. It's also why we'd pass
"struct drm_device *" instead of "struct sun4i_tcon *".


Regards
ChenYu

>  }
>  EXPORT_SYMBOL(sun4i_tcon1_mode_set);
>
> --
> git-series 0.8.11
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: iommu/rockchip: Fix bugs and enable on ARM64

2017-03-08 Thread Caesar Wang

Shunqian,
something is depending on these patches, can you resend these patches to 
solve the

compile errors?

-Caesar
在 2016年07月16日 00:16, Joerg Roedel 写道:

On Fri, Jul 15, 2016 at 05:32:02PM +0200, Matthias Brugger wrote:

The drm rockchip patches are dependent on iommu/rockchip patches, can
you also apply these patches together? So that can avoid compile problem.


While at it. I don't see patch 8 (iommu/Kconfig) in linux-next.
I suppose you forgot to pick that one.

I picked it up first, but it causes compile errors, so I removed it for
now.


Joerg


___
Linux-rockchip mailing list
linux-rockc...@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip



___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 7/15] dt-bindings: display: sun4i: Add allwinner, tcon-channel property

2017-03-08 Thread Chen-Yu Tsai
On Tue, Mar 7, 2017 at 4:56 PM, Maxime Ripard
 wrote:
> The Allwinner Timings Controller has two, mutually exclusive, channels.
> When the binding has been introduced, it was assumed that there would be
> only a single user per channel in the system.
>
> While this is likely for the channel 0 which only connects to LCD displays,
> it turns out that the channel 1 can be connected to multiple controllers in
> the SoC (HDMI and TV encoders for example). And while the simultaneous use
> of HDMI and TV outputs cannot be achieved, switching from one to the other
> at runtime definitely sounds plausible.
>
> Add an extra property, allwinner,tcon-channel, to specify for a given
> endpoint which TCON channel it is connected to, while falling back to the
> previous mechanism if that property is missing.
>
> Signed-off-by: Maxime Ripard 

Acked-by: Chen-Yu Tsai 
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 2/3] drm/etnaviv: move fence allocation out of etnaviv_gpu_submit()

2017-03-08 Thread Russell King - ARM Linux
On Wed, Mar 08, 2017 at 11:42:17AM -0300, Gustavo Padovan wrote:
> Hi Philipp,
> 
> 2017-03-08 Philipp Zabel :
> 
> > The next patch will need the dma_fence to create the sync_file in
> > etnaviv_ioctl_gem_submit, in case an out_fence_fd is requested.
> > 
> > Signed-off-by: Philipp Zabel 
> > ---
> >  drivers/gpu/drm/etnaviv/etnaviv_gem.h|  3 ++-
> >  drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c |  8 +++-
> >  drivers/gpu/drm/etnaviv/etnaviv_gpu.c| 21 ++---
> >  drivers/gpu/drm/etnaviv/etnaviv_gpu.h|  1 +
> >  4 files changed, 16 insertions(+), 17 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem.h 
> > b/drivers/gpu/drm/etnaviv/etnaviv_gem.h
> > index 120410d67eb5b..c4a091e874269 100644
> > --- a/drivers/gpu/drm/etnaviv/etnaviv_gem.h
> > +++ b/drivers/gpu/drm/etnaviv/etnaviv_gem.h
> > @@ -20,6 +20,7 @@
> >  #include 
> >  #include "etnaviv_drv.h"
> >  
> > +struct dma_fence;
> 
> Why not #include  ?

Adding needless includes when a struct prototype will do eventually
creates headaches with circular dependencies and the like.  Low
probability in this case, but the principle is a good one to adhere
to.

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v5 2/5] arm: dts: Add the burst and esc clock frequency properties to DSI node

2017-03-08 Thread Krzysztof Kozlowski
On Wed, Mar 08, 2017 at 01:54:09PM +0900, Hoegeun Kwon wrote:
> Add the burst and esc clock frequency properties to the parent (DSI node).
> Currently the clock is parsed from the port node, while it should be
> taken from the dsi node.
> 
> Signed-off-by: Hoegeun Kwon 
> Reviewed-by: Andrzej Hajda 
> Reviewed-by: Andi Shyti 
> ---
>  arch/arm/boot/dts/exynos3250-rinato.dts | 2 ++
>  arch/arm/boot/dts/exynos4210-trats.dts  | 2 ++
>  arch/arm/boot/dts/exynos4412-trats2.dts | 2 ++
>  3 files changed, 6 insertions(+)
> 

Thanks, applied.

Best regards,
Krzysztof

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: linux-next: build failure after merge of the rcu tree

2017-03-08 Thread Paul E. McKenney
On Wed, Mar 08, 2017 at 11:13:38AM +0100, Daniel Vetter wrote:
> On Wed, Mar 08, 2017 at 12:16:45PM +1100, Stephen Rothwell wrote:
> > Hi Paul,
> > 
> > After merging the rcu tree, today's linux-next build (x86_64 allmodconfig)
> > failed like this:
> > 
> > In file included from include/linux/resource_ext.h:19:0,
> >  from include/linux/pci.h:32,
> >  from include/drm/drmP.h:50,
> >  from drivers/gpu/drm/i915/i915_gem.c:28:
> > drivers/gpu/drm/i915/selftests/mock_gem_device.c: In function 
> > 'mock_gem_device':
> > drivers/gpu/drm/i915/selftests/mock_gem_device.c:177:9: error: 
> > 'SLAB_DESTROY_BY_RCU' undeclared (first use in this function)
> >  SLAB_DESTROY_BY_RCU);
> >  ^
> > include/linux/slab.h:149:4: note: in definition of macro 'KMEM_CACHE'
> >(__flags), NULL)
> > ^
> > drivers/gpu/drm/i915/selftests/mock_gem_device.c:177:9: note: each 
> > undeclared identifier is reported only once for each function it appears in
> >  SLAB_DESTROY_BY_RCU);
> >  ^
> > include/linux/slab.h:149:4: note: in definition of macro 'KMEM_CACHE'
> >(__flags), NULL)
> > ^
> > /
> > 
> > Caused by commit
> > 
> >   24b7cb25b8d1 ("mm: Rename SLAB_DESTROY_BY_RCU to SLAB_TYPESAFE_BY_RCU")
> 
> Awesome rename. Count us in among the people who first thought this
> provides more guarantees than it does.

Glad you like it!  ;-)

> > interacting with commit
> > 
> >   0daf0113cff6 ("drm/i915: Mock infrastructure for request emission")
> > 
> > from the drm-intel tree.
> > 
> > I added the following merge fix patch:
> > 
> > From: Stephen Rothwell 
> > Date: Wed, 8 Mar 2017 12:09:49 +1100
> > Subject: [PATCH] drm/i915: merge fix for "mm: Rename SLAB_DESTROY_BY_RCU to
> >  SLAB_TYPESAFE_BY_RCU"
> > 
> > Signed-off-by: Stephen Rothwell 
> 
> Should we handle this with a topic branch? It's trivial to resolve, but I
> fear the note that this conflict exists might get lost somewhere between
> now and when the drm pull lands in Linus' inbox in 2 months ...
> 
> Otoh he's probably going to compile test drm extra carefully and will
> notice :-)

If it gets too ugly, I can always allow both SLAB_TYPESAFE_BY_RCU
and SLAB_DESTROY_BY_RCU as synonyms in 4.12, and then remove
SLAB_DESTROY_BY_RCU in 4.13.

Thanx, Paul

> -Daniel
> 
> > ---
> >  drivers/gpu/drm/i915/selftests/mock_gem_device.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/selftests/mock_gem_device.c 
> > b/drivers/gpu/drm/i915/selftests/mock_gem_device.c
> > index 6a8258eacdcb..9f24c5da3f8d 100644
> > --- a/drivers/gpu/drm/i915/selftests/mock_gem_device.c
> > +++ b/drivers/gpu/drm/i915/selftests/mock_gem_device.c
> > @@ -174,7 +174,7 @@ struct drm_i915_private *mock_gem_device(void)
> > i915->requests = KMEM_CACHE(mock_request,
> > SLAB_HWCACHE_ALIGN |
> > SLAB_RECLAIM_ACCOUNT |
> > -   SLAB_DESTROY_BY_RCU);
> > +   SLAB_TYPESAFE_BY_RCU);
> > if (!i915->requests)
> > goto err_vmas;
> >  
> > -- 
> > 2.11.0
> > 
> > -- 
> > Cheers,
> > Stephen Rothwell
> 
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
> 

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH V3 4/4] dts/imx6q-b850v3: Use megachips-stdpxxxx-ge-b850v3-fw bridges (LVDS-DP++)

2017-03-08 Thread Peter Senna Tschudin
On Fri, Mar 03, 2017 at 04:57:10PM +0100, Peter Senna Tschudin wrote:

Hi Shawn Guo,

Now that the driver and binding are in, can you pick this up?

Thank you!

> Configures the megachips-stdp-ge-b850v3-fw bridges on the GE
> B850v3 dts file.
> 
> Cc: Laurent Pinchart 
> Cc: Martyn Welch 
> Cc: Martin Donnelly 
> Cc: Javier Martinez Canillas 
> Cc: Enric Balletbo i Serra 
> Cc: Philipp Zabel 
> Cc: Rob Herring 
> Cc: Fabio Estevam 
> Signed-off-by: Peter Senna Tschudin 
> ---
> Unchanged since V1.
> 
>  arch/arm/boot/dts/imx6q-b850v3.dts | 68 
> ++
>  1 file changed, 68 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/imx6q-b850v3.dts 
> b/arch/arm/boot/dts/imx6q-b850v3.dts
> index b237429..3ec54da 100644
> --- a/arch/arm/boot/dts/imx6q-b850v3.dts
> +++ b/arch/arm/boot/dts/imx6q-b850v3.dts
> @@ -72,6 +72,13 @@
>   fsl,data-mapping = "spwg";
>   fsl,data-width = <24>;
>   status = "okay";
> +
> + port@4 {
> + reg = <4>;
> + lvds0_out: endpoint {
> + remote-endpoint = <_in>;
> + };
> + };
>   };
>  };
>  
> @@ -146,3 +153,64 @@
>   {
>   status = "disabled";
>  };
> +
> +_i2c2 {
> + status = "okay";
> + clock-frequency = <10>;
> +
> + stdp4028@73 {
> + compatible = "megachips,stdp4028-ge-b850v3-fw";
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + reg = <0x73>;
> +
> + interrupt-parent = <>;
> + interrupts = <0 IRQ_TYPE_LEVEL_HIGH>;
> +
> + ports {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + port@0 {
> + reg = <0>;
> + stdp4028_in: endpoint {
> + remote-endpoint = <_out>;
> + };
> + };
> + port@1 {
> + reg = <1>;
> + stdp4028_out: endpoint {
> + remote-endpoint = <_in>;
> + };
> + };
> + };
> + };
> +
> + stdp2690@72 {
> + compatible = "megachips,stdp2690-ge-b850v3-fw";
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + reg = <0x72>;
> +
> + ports {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + port@0 {
> + reg = <0>;
> + stdp2690_in: endpoint {
> + remote-endpoint = <_out>;
> + };
> + };
> +
> + port@1 {
> + reg = <1>;
> + stdp2690_out: endpoint {
> + /* Connector for external display */
> + };
> + };
> + };
> + };
> +};
> -- 
> 2.9.3
> 
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v5 2/5] arm: dts: Add the burst and esc clock frequency properties to DSI node

2017-03-08 Thread Krzysztof Kozlowski
On Wed, Mar 08, 2017 at 01:54:09PM +0900, Hoegeun Kwon wrote:
> Add the burst and esc clock frequency properties to the parent (DSI node).
> Currently the clock is parsed from the port node, while it should be
> taken from the dsi node.
> 
> Signed-off-by: Hoegeun Kwon 
> Reviewed-by: Andrzej Hajda 
> Reviewed-by: Andi Shyti 
> ---
>  arch/arm/boot/dts/exynos3250-rinato.dts | 2 ++
>  arch/arm/boot/dts/exynos4210-trats.dts  | 2 ++
>  arch/arm/boot/dts/exynos4412-trats2.dts | 2 ++
>  3 files changed, 6 insertions(+)
>

If anyone needs this, then:


The following changes since commit c1ae3cfa0e89fa1a7ecc4c99031f5e9ae99d9201:

  Linux 4.11-rc1 (2017-03-05 12:59:56 -0800)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux.git 
tags/samsung-dt-clock-dsi-property-4.12

for you to fetch changes up to 4c74ea4e20b582bf90a2cf509d88aa7c2dbffb12:

  ARM: dts: exynos: Add the burst and esc clock frequency properties to DSI 
node (2017-03-08 09:09:05 +0200)


Add the burst and esc clock frequency properties to DSI node in Exynos ARM
DeviceTree, before the OF graph could be parsed.


Hoegeun Kwon (1):
  ARM: dts: exynos: Add the burst and esc clock frequency properties to DSI 
node

Jaehoon Chung (1):
  ARM: dts: exynos: Add phy-pcie node for pcie to Exynos5440

Krzysztof Kozlowski (1):
  ARM: dts: exynos: Do not ignore real-world fuse values for thermal zone 0 
on Exynos5420

 arch/arm/boot/dts/exynos3250-rinato.dts   |  2 ++
 arch/arm/boot/dts/exynos4210-trats.dts|  2 ++
 arch/arm/boot/dts/exynos4412-trats2.dts   |  2 ++
 arch/arm/boot/dts/exynos5420-tmu-sensor-conf.dtsi | 25 +++
 arch/arm/boot/dts/exynos5420.dtsi | 10 
 arch/arm/boot/dts/exynos5440.dtsi | 30 +++
 6 files changed, 56 insertions(+), 15 deletions(-)
 create mode 100644 arch/arm/boot/dts/exynos5420-tmu-sensor-conf.dtsi

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v5 1/5] arm64: dts: exynos: Add the burst and esc clock frequency properties to DSI node

2017-03-08 Thread Krzysztof Kozlowski
On Wed, Mar 08, 2017 at 01:54:08PM +0900, Hoegeun Kwon wrote:
> Add the burst and esc clock frequency properties to the parent (DSI node).
> Currently the clock is parsed from the port node, while it should be
> taken from the dsi node.
> 
> Signed-off-by: Hoegeun Kwon 
> Reviewed-by: Andrzej Hajda 
> Reviewed-by: Andi Shyti 
> ---
>  arch/arm64/boot/dts/exynos/exynos5433-tm2-common.dtsi | 2 ++
>  1 file changed, 2 insertions(+)

If anyone needs this, then:


The following changes since commit c1ae3cfa0e89fa1a7ecc4c99031f5e9ae99d9201:

  Linux 4.11-rc1 (2017-03-05 12:59:56 -0800)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux.git 
tags/samsung-dt64-clock-dsi-property-4.12

for you to fetch changes up to e3c07546747cdec07ff15c984bc6cebc9c9f788c:

  arm64: dts: exynos: Add the burst and esc clock frequency properties to DSI 
node (2017-03-08 08:55:39 +0200)


Add the burst and esc clock frequency properties to DSI node in Exynos ARM64
DeviceTree, before the OF graph could be parsed.


Andi Shyti (2):
  arm64: dts: exynos: Enable ir-spi in the TM2 and TM2E boards
  arm64: dts: exynos: Add stmfts touchscreen node for TM2 and TM2E

Hoegeun Kwon (1):
  arm64: dts: exynos: Add the burst and esc clock frequency properties to 
DSI node

Hyungwon Hwang (1):
  arm64: dts: exynos: Add support for S6E3HA2 panel device on TM2 board

 .../boot/dts/exynos/exynos5433-tm2-common.dtsi | 43 +-
 arch/arm64/boot/dts/exynos/exynos5433-tm2.dts  | 17 +
 arch/arm64/boot/dts/exynos/exynos5433-tm2e.dts |  7 
 3 files changed, 65 insertions(+), 2 deletions(-)
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 8/15] drm/sun4i: tcon: Add channel debug

2017-03-08 Thread Chen-Yu Tsai
On Tue, Mar 7, 2017 at 4:56 PM, Maxime Ripard
 wrote:
> While all functions have debug logs, the channel enable and disable are not
> logged. Make sure this is the case.
>
> Signed-off-by: Maxime Ripard 

Acked-by: Chen-Yu Tsai 
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] drm/rockchip: Refactor the component match logic.

2017-03-08 Thread Jeffy Chen
Currently we are adding all components from the dts, if one of their
drivers been disabled, we would not be able to bring up others.

Refactor component match logic, follow exynos drm.

Signed-off-by: Jeffy Chen 

---

 drivers/gpu/drm/rockchip/Kconfig|  10 +-
 drivers/gpu/drm/rockchip/Makefile   |  16 +--
 drivers/gpu/drm/rockchip/analogix_dp-rockchip.c |   9 +-
 drivers/gpu/drm/rockchip/cdn-dp-core.c  |   8 +-
 drivers/gpu/drm/rockchip/dw-mipi-dsi.c  |   8 +-
 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c |  10 +-
 drivers/gpu/drm/rockchip/inno_hdmi.c|  10 +-
 drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 156 
 drivers/gpu/drm/rockchip/rockchip_drm_drv.h |   6 +
 drivers/gpu/drm/rockchip/rockchip_vop_reg.c |   8 +-
 10 files changed, 133 insertions(+), 108 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/Kconfig b/drivers/gpu/drm/rockchip/Kconfig
index 0e4eb84..50c41c0 100644
--- a/drivers/gpu/drm/rockchip/Kconfig
+++ b/drivers/gpu/drm/rockchip/Kconfig
@@ -13,7 +13,7 @@ config DRM_ROCKCHIP
  IP found on the SoC.
 
 config ROCKCHIP_ANALOGIX_DP
-   tristate "Rockchip specific extensions for Analogix DP driver"
+   bool "Rockchip specific extensions for Analogix DP driver"
depends on DRM_ROCKCHIP
select DRM_ANALOGIX_DP
help
@@ -22,7 +22,7 @@ config ROCKCHIP_ANALOGIX_DP
  on RK3288 based SoC, you should selet this option.
 
 config ROCKCHIP_CDN_DP
-tristate "Rockchip cdn DP"
+bool "Rockchip cdn DP"
 depends on DRM_ROCKCHIP
depends on EXTCON
select SND_SOC_HDMI_CODEC if SND_SOC
@@ -33,7 +33,7 @@ config ROCKCHIP_CDN_DP
  option.
 
 config ROCKCHIP_DW_HDMI
-tristate "Rockchip specific extensions for Synopsys DW HDMI"
+bool "Rockchip specific extensions for Synopsys DW HDMI"
 depends on DRM_ROCKCHIP
 select DRM_DW_HDMI
 help
@@ -43,7 +43,7 @@ config ROCKCHIP_DW_HDMI
  option.
 
 config ROCKCHIP_DW_MIPI_DSI
-   tristate "Rockchip specific extensions for Synopsys DW MIPI DSI"
+   bool "Rockchip specific extensions for Synopsys DW MIPI DSI"
depends on DRM_ROCKCHIP
select DRM_MIPI_DSI
help
@@ -53,7 +53,7 @@ config ROCKCHIP_DW_MIPI_DSI
 option.
 
 config ROCKCHIP_INNO_HDMI
-   tristate "Rockchip specific extensions for Innosilicon HDMI"
+   bool "Rockchip specific extensions for Innosilicon HDMI"
depends on DRM_ROCKCHIP
help
  This selects support for Rockchip SoC specific extensions
diff --git a/drivers/gpu/drm/rockchip/Makefile 
b/drivers/gpu/drm/rockchip/Makefile
index c931e2a..fa8dc9d 100644
--- a/drivers/gpu/drm/rockchip/Makefile
+++ b/drivers/gpu/drm/rockchip/Makefile
@@ -3,14 +3,14 @@
 # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
 
 rockchipdrm-y := rockchip_drm_drv.o rockchip_drm_fb.o \
-   rockchip_drm_gem.o rockchip_drm_psr.o rockchip_drm_vop.o
+   rockchip_drm_gem.o rockchip_drm_psr.o \
+   rockchip_drm_vop.o rockchip_vop_reg.o
 rockchipdrm-$(CONFIG_DRM_FBDEV_EMULATION) += rockchip_drm_fbdev.o
 
-obj-$(CONFIG_ROCKCHIP_ANALOGIX_DP) += analogix_dp-rockchip.o
-obj-$(CONFIG_ROCKCHIP_CDN_DP) += cdn-dp.o
-cdn-dp-objs := cdn-dp-core.o cdn-dp-reg.o
-obj-$(CONFIG_ROCKCHIP_DW_HDMI) += dw_hdmi-rockchip.o
-obj-$(CONFIG_ROCKCHIP_DW_MIPI_DSI) += dw-mipi-dsi.o
-obj-$(CONFIG_ROCKCHIP_INNO_HDMI) += inno_hdmi.o
+rockchipdrm-$(CONFIG_ROCKCHIP_ANALOGIX_DP) += analogix_dp-rockchip.o
+rockchipdrm-$(CONFIG_ROCKCHIP_CDN_DP) += cdn-dp-core.o cdn-dp-reg.o
+rockchipdrm-$(CONFIG_ROCKCHIP_DW_HDMI) += dw_hdmi-rockchip.o
+rockchipdrm-$(CONFIG_ROCKCHIP_DW_MIPI_DSI) += dw-mipi-dsi.o
+rockchipdrm-$(CONFIG_ROCKCHIP_INNO_HDMI) += inno_hdmi.o
 
-obj-$(CONFIG_DRM_ROCKCHIP) += rockchipdrm.o rockchip_vop_reg.o
+obj-$(CONFIG_DRM_ROCKCHIP) += rockchipdrm.o
diff --git a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c 
b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
index 8548e82..91ebe5c 100644
--- a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
+++ b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
@@ -507,7 +507,7 @@ static const struct of_device_id rockchip_dp_dt_ids[] = {
 };
 MODULE_DEVICE_TABLE(of, rockchip_dp_dt_ids);
 
-static struct platform_driver rockchip_dp_driver = {
+struct platform_driver rockchip_dp_driver = {
.probe = rockchip_dp_probe,
.remove = rockchip_dp_remove,
.driver = {
@@ -516,10 +516,3 @@ static struct platform_driver rockchip_dp_driver = {
   .of_match_table = of_match_ptr(rockchip_dp_dt_ids),
},
 };
-
-module_platform_driver(rockchip_dp_driver);
-
-MODULE_AUTHOR("Yakir Yang ");
-MODULE_AUTHOR("Jeff chen ");
-MODULE_DESCRIPTION("Rockchip Specific Analogix-DP Driver Extension");
-MODULE_LICENSE("GPL v2");
diff --git 

Re: [PATCH 11/15] drm/sun4i: tcon: Fix tcon channel 1 backporch calculation

2017-03-08 Thread Chen-Yu Tsai
On Tue, Mar 7, 2017 at 4:56 PM, Maxime Ripard
 wrote:
> It seems like what's called a backporch in the datasheet is actually the
> backporch plus the sync period. Fix that in our driver.
>
> Signed-off-by: Maxime Ripard 
> ---
>  drivers/gpu/drm/sun4i/sun4i_tcon.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c 
> b/drivers/gpu/drm/sun4i/sun4i_tcon.c
> index 93249c5ab1e4..e44217fb4f6f 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
> @@ -240,15 +240,14 @@ void sun4i_tcon1_mode_set(struct sun4i_tcon *tcon, 
> struct drm_encoder *encoder,
>  SUN4I_TCON1_BASIC2_Y(mode->crtc_vdisplay));
>
> /* Set horizontal display timings */
> -   bp = mode->crtc_htotal - mode->crtc_hsync_end;
> +   bp = mode->crtc_htotal - mode->crtc_hsync_start;
> DRM_DEBUG_DRIVER("Setting horizontal total %d, backporch %d\n",
>  mode->htotal, bp);
> regmap_write(tcon->regs, SUN4I_TCON1_BASIC3_REG,
>  SUN4I_TCON1_BASIC3_H_TOTAL(mode->crtc_htotal) |
>  SUN4I_TCON1_BASIC3_H_BACKPORCH(bp));
>
> -   /* Set vertical display timings */

Why remove the comment?

Otherwise,

Acked-by: Chen-Yu Tsai 

> -   bp = mode->crtc_vtotal - mode->crtc_vsync_end;
> +   bp = mode->crtc_vtotal - mode->crtc_vsync_start;
> DRM_DEBUG_DRIVER("Setting vertical total %d, backporch %d\n",
>  mode->vtotal, bp);
> regmap_write(tcon->regs, SUN4I_TCON1_BASIC4_REG,
> --
> git-series 0.8.11
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 4/5] drm/radeon: Don't register Thunderbolt eGPU with vga_switcheroo

2017-03-08 Thread Alex Deucher
On Wed, Mar 8, 2017 at 12:01 AM, Lukas Wunner  wrote:
> On Tue, Mar 07, 2017 at 03:30:30PM -0500, Alex Deucher wrote:
>> On Fri, Feb 24, 2017 at 2:19 PM, Lukas Wunner  wrote:
>> > An external Thunderbolt GPU can neither drive the laptop's panel nor be
>> > powered off by the platform, so there's no point in registering it with
>> > vga_switcheroo.  In fact, when the external GPU is runtime suspended,
>> > vga_switcheroo will cut power to the internal discrete GPU, resulting in
>> > a lockup.
>>
>> I'm not necessarily opposed to this, but I'd prefer something more
>> generic.  E.g., what happens if someone uses another dGPU in a docking
>> station or some other sort of PCIe bridge?
>
> Such a dGPU is only relevant to vga_switcheroo if it can either drive
> the panel or be powered off by the platform.  Does such a product exist?
>
> I've never heard of one, and think that's because such a product doesn't
> make sense:  A docking staton is not power-constrained, it's stationary
> and connected to a wall outlet, so there's no need to power the dGPU off
> when it's not in use.
>
> And at a docking station you're usually connected to a larger monitor,
> so having the dGPU drive the laptop's smaller panel isn't necessary either.
> In the rare cases where there's no larger monitor, you just use the dGPU
> for render offloading, just as you would for contemporary ATPX laptops.
>
> OTOH, dGPUs in Thunderbolt enclosures *do* exist and connecting them
> to an ATPX machine causes failure, as explained in the commit message.

Whether you introduce additional dGPUs via thunderbolt or some
proprietary interface or a pci bridge in a docking station the result
is still the same.  You end up with the potential scenario you
described in this commit message that there may be confusion as to
which GPU is controlled via ACPI power controls.

I talked to the windows team.  They special case thunderbolt as well,
so the patch is probably fine.  For pcie ports in a docking station, I
suspect there may not actually be any docking stations supported by PX
laptops where this could be an issue.  For non-thunderbolt detachable
graphics there is a new ATIF function to query the bus number of the
supported device.  I'll send a patch out for that in a bit.

Thinking about this more, long term we should probably only register
with vga_switcheroo if we support display muxing which is a legacy
feature these days.  Most systems are mux-less so we just need to
handle dgpu power control via runtime pm.

Alex

>
>
>> I think on AMD platforms
>> at least we should be able to determine what devices are the
>> switcheroo devices based on information in the ATIF and ATPX ACPI
>> methods.  In that case, we can be explicit in which devices we
>> register with vga_switcheroo.
>
> Is there public documentation on these methods somewhere?
>
> Thanks,
>
> Lukas
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 100089] Space Run rendering prolems

2017-03-08 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=100089

--- Comment #2 from Kenneth Graunke  ---
Also, can you supply an apitrace?

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 100089] Space Run rendering prolems

2017-03-08 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=100089

--- Comment #1 from Kenneth Graunke  ---
What graphics card(s) are you seeing this issue on?

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 18/24] drm/etnaviv: switch to postclose

2017-03-08 Thread Daniel Vetter
On Wed, Mar 08, 2017 at 05:09:45PM +0100, Lucas Stach wrote:
> Am Mittwoch, den 08.03.2017, 15:12 +0100 schrieb Daniel Vetter:
> > I didn't spot anything that would require ordering here (well not
> > anywhere else either), and I'm trying to unify at least modern
> > drivers
> > on one close hook.
> > 
> > Cc: Lucas Stach 
> > Cc: Russell King 
> > Cc: Christian Gmeiner 
> > Cc: etna...@lists.freedesktop.org
> > Signed-off-by: Daniel Vetter 
> 
> Acked-by: Lucas Stach 
> 
> for merging through drm-misc

t-b would be great, this entire area is rather wonky and full of decades
of cargo-culting. I'm not sure I missed something important, so really
want each patch to see some testing before we merge it, if possible.
-Daniel

> 
> > ---
> >  drivers/gpu/drm/etnaviv/etnaviv_drv.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> > b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> > index 587e45043542..289a9f8c6671 100644
> > --- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> > +++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> > @@ -111,7 +111,7 @@ static int etnaviv_open(struct drm_device *dev,
> > struct drm_file *file)
> >     return 0;
> >  }
> >  
> > -static void etnaviv_preclose(struct drm_device *dev, struct drm_file
> > *file)
> > +static void etnaviv_postclose(struct drm_device *dev, struct
> > drm_file *file)
> >  {
> >     struct etnaviv_drm_private *priv = dev->dev_private;
> >     struct etnaviv_file_private *ctx = file->driver_priv;
> > @@ -488,7 +488,7 @@ static struct drm_driver etnaviv_drm_driver = {
> >     DRIVER_PRIME |
> >     DRIVER_RENDER,
> >     .open   = etnaviv_open,
> > -   .preclose   = etnaviv_preclose,
> > +   .postclose   = etnaviv_postclose,
> >     .gem_free_object_unlocked = etnaviv_gem_free_object,
> >     .gem_vm_ops = _ops,
> >     .prime_handle_to_fd = drm_gem_prime_handle_to_fd,

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v8 5/6] drm/i915: enable scrambling

2017-03-08 Thread Sharma, Shashank

Regards

Shashank


On 3/8/2017 7:56 PM, Ville Syrjälä wrote:

On Wed, Mar 08, 2017 at 07:50:45PM +0200, Sharma, Shashank wrote:

Regards

Shashank


On 3/8/2017 7:44 PM, Ville Syrjälä wrote:

On Wed, Mar 08, 2017 at 07:26:45PM +0200, Sharma, Shashank wrote:

Regards

Shashank


On 3/8/2017 7:17 PM, Ville Syrjälä wrote:

On Wed, Mar 08, 2017 at 07:07:48PM +0530, Shashank Sharma wrote:

Geminilake platform sports a native HDMI 2.0 controller, and is
capable of driving pixel-clocks upto 594Mhz. HDMI 2.0 spec
mendates scrambling for these higher clocks, for reduced RF footprint.

This patch checks if the monitor supports scrambling, and if required,
enables it during the modeset.

V2: Addressed review comments from Ville:
- Do not track scrambling status in DRM layer, track somewhere in
  driver like in intel_crtc_state.
- Don't talk to monitor at such a low layer, set monitor scrambling
  in intel_enable_ddi() before enabling the port.

V3: Addressed review comments from Jani
- In comments, function names, use "sink" instead of "monitor",
  so that the implementation could be close to the language of
  HDMI spec.

V4: Addressed review comment from Maarten
- scrambling -> hdmi_scrambling
- high_tmds_clock_ratio -> hdmi_high_tmds_clock_ratio

V5: Addressed review comments from Ville and Ander
- Do not modifiy the crtc_state after compute_config. Move all
  scrambling and tmds_clock_ratio calcutations to compute_config.
- While setting scrambling for source/sink, do not check the
  conditions again, just go by the crtc_state flags. This will
  simplyfy the condition checks.

V6: Addressed review comments from Ville
- Do not add IS_GLK check in disable/enable function, instead add it
  in compute_config, while setting state flags.
- Remove unnecessary paranthesis.
- Simplyfy handle_sink_scrambling function as suggested.
- Add readout code for scrambling status in get_ddi_config and add a
  check for the same in pipe_config_compare.

V7: Addressed review comments from Ander/Ville
- No separate function for source scrambling, make it inline
- Align the last line of the macro TRANS_DDI_HDMI_SCRAMBLING_MASK
- Do not add platform check while setting source scrambling
- Use pipe_config instead of crtc->config to set sink scrambling
- To readout scrambling status, Compare with SCRAMBLING_MASK
  not any of its bits
- Remove platform check in intel_pipe_config_compare while checking
  scrambling status

V8: Fixed mege conflict, Addressed review comments from Ander
- Remove the desciption/comment about scrambling fom the caller, move
  it to the function
- Move the IS_GLK check into scrambling function
- Fix alignment

Signed-off-by: Shashank Sharma 
---
drivers/gpu/drm/i915/i915_reg.h  |  7 
drivers/gpu/drm/i915/intel_ddi.c | 19 +++
drivers/gpu/drm/i915/intel_display.c |  3 ++
drivers/gpu/drm/i915/intel_drv.h | 10 ++
drivers/gpu/drm/i915/intel_hdmi.c| 62 

5 files changed, 101 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index cc843f9..2d50fdc 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -7830,7 +7830,14 @@ enum {
#define  TRANS_DDI_EDP_INPUT_B_ONOFF(5<<12)
#define  TRANS_DDI_EDP_INPUT_C_ONOFF(6<<12)
#define  TRANS_DDI_DP_VC_PAYLOAD_ALLOC  (1<<8)
+#define  TRANS_DDI_HDMI_SCRAMBLER_CTS_ENABLE (1<<7)
+#define  TRANS_DDI_HDMI_SCRAMBLER_RESET_FREQ (1<<6)
#define  TRANS_DDI_BFI_ENABLE   (1<<4)
+#define  TRANS_DDI_HIGH_TMDS_CHAR_RATE (1<<4)
+#define  TRANS_DDI_HDMI_SCRAMBLING (1<<0)
+#define  TRANS_DDI_HDMI_SCRAMBLING_MASK (TRANS_DDI_HDMI_SCRAMBLER_CTS_ENABLE \
+   | TRANS_DDI_HDMI_SCRAMBLER_RESET_FREQ \
+   | TRANS_DDI_HDMI_SCRAMBLING)

/* DisplayPort Transport Control */

#define _DP_TP_CTL_A0x64040
diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index 0467676..b3e4c4a 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -1309,6 +1309,11 @@ void intel_ddi_enable_transcoder_func(const struct 
intel_crtc_state *crtc_state)
temp |= TRANS_DDI_MODE_SELECT_HDMI;
else
temp |= TRANS_DDI_MODE_SELECT_DVI;
+
+   if (crtc_state->hdmi_scrambling)
+   temp |= TRANS_DDI_HDMI_SCRAMBLING_MASK;
+   if (crtc_state->hdmi_high_tmds_clock_ratio)
+   temp |= TRANS_DDI_HIGH_TMDS_CHAR_RATE;
} else if (type == INTEL_OUTPUT_ANALOG) {
temp |= TRANS_DDI_MODE_SELECT_FDI;
temp |= (crtc_state->fdi_lanes - 1) 

Re: [PATCH v8 5/6] drm/i915: enable scrambling

2017-03-08 Thread Ville Syrjälä
On Wed, Mar 08, 2017 at 07:50:45PM +0200, Sharma, Shashank wrote:
> Regards
> 
> Shashank
> 
> 
> On 3/8/2017 7:44 PM, Ville Syrjälä wrote:
> > On Wed, Mar 08, 2017 at 07:26:45PM +0200, Sharma, Shashank wrote:
> >> Regards
> >>
> >> Shashank
> >>
> >>
> >> On 3/8/2017 7:17 PM, Ville Syrjälä wrote:
> >>> On Wed, Mar 08, 2017 at 07:07:48PM +0530, Shashank Sharma wrote:
> Geminilake platform sports a native HDMI 2.0 controller, and is
> capable of driving pixel-clocks upto 594Mhz. HDMI 2.0 spec
> mendates scrambling for these higher clocks, for reduced RF footprint.
> 
> This patch checks if the monitor supports scrambling, and if required,
> enables it during the modeset.
> 
> V2: Addressed review comments from Ville:
> - Do not track scrambling status in DRM layer, track somewhere in
>   driver like in intel_crtc_state.
> - Don't talk to monitor at such a low layer, set monitor scrambling
>   in intel_enable_ddi() before enabling the port.
> 
> V3: Addressed review comments from Jani
> - In comments, function names, use "sink" instead of "monitor",
>   so that the implementation could be close to the language of
>   HDMI spec.
> 
>  V4: Addressed review comment from Maarten
> - scrambling -> hdmi_scrambling
> - high_tmds_clock_ratio -> hdmi_high_tmds_clock_ratio
> 
>  V5: Addressed review comments from Ville and Ander
> - Do not modifiy the crtc_state after compute_config. Move all
>   scrambling and tmds_clock_ratio calcutations to compute_config.
> - While setting scrambling for source/sink, do not check the
>   conditions again, just go by the crtc_state flags. This will
>   simplyfy the condition checks.
> 
>  V6: Addressed review comments from Ville
> - Do not add IS_GLK check in disable/enable function, instead add it
>   in compute_config, while setting state flags.
> - Remove unnecessary paranthesis.
> - Simplyfy handle_sink_scrambling function as suggested.
> - Add readout code for scrambling status in get_ddi_config and add a
>   check for the same in pipe_config_compare.
> 
>  V7: Addressed review comments from Ander/Ville
> - No separate function for source scrambling, make it inline
> - Align the last line of the macro TRANS_DDI_HDMI_SCRAMBLING_MASK
> - Do not add platform check while setting source scrambling
> - Use pipe_config instead of crtc->config to set sink scrambling
> - To readout scrambling status, Compare with SCRAMBLING_MASK
>   not any of its bits
> - Remove platform check in intel_pipe_config_compare while checking
>   scrambling status
> 
>  V8: Fixed mege conflict, Addressed review comments from Ander
> - Remove the desciption/comment about scrambling fom the caller, move
>   it to the function
> - Move the IS_GLK check into scrambling function
> - Fix alignment
> 
>  Signed-off-by: Shashank Sharma 
>  ---
> drivers/gpu/drm/i915/i915_reg.h  |  7 
> drivers/gpu/drm/i915/intel_ddi.c | 19 +++
> drivers/gpu/drm/i915/intel_display.c |  3 ++
> drivers/gpu/drm/i915/intel_drv.h | 10 ++
> drivers/gpu/drm/i915/intel_hdmi.c| 62 
>  
> 5 files changed, 101 insertions(+)
> 
>  diff --git a/drivers/gpu/drm/i915/i915_reg.h 
>  b/drivers/gpu/drm/i915/i915_reg.h
>  index cc843f9..2d50fdc 100644
>  --- a/drivers/gpu/drm/i915/i915_reg.h
>  +++ b/drivers/gpu/drm/i915/i915_reg.h
>  @@ -7830,7 +7830,14 @@ enum {
> #define  TRANS_DDI_EDP_INPUT_B_ONOFF  (5<<12)
> #define  TRANS_DDI_EDP_INPUT_C_ONOFF  (6<<12)
> #define  TRANS_DDI_DP_VC_PAYLOAD_ALLOC(1<<8)
>  +#define  TRANS_DDI_HDMI_SCRAMBLER_CTS_ENABLE (1<<7)
>  +#define  TRANS_DDI_HDMI_SCRAMBLER_RESET_FREQ (1<<6)
> #define  TRANS_DDI_BFI_ENABLE (1<<4)
>  +#define  TRANS_DDI_HIGH_TMDS_CHAR_RATE  (1<<4)
>  +#define  TRANS_DDI_HDMI_SCRAMBLING  (1<<0)
>  +#define  TRANS_DDI_HDMI_SCRAMBLING_MASK 
>  (TRANS_DDI_HDMI_SCRAMBLER_CTS_ENABLE \
>  +| 
>  TRANS_DDI_HDMI_SCRAMBLER_RESET_FREQ \
>  +| TRANS_DDI_HDMI_SCRAMBLING)
> 
> /* DisplayPort Transport Control */
> #define _DP_TP_CTL_A  0x64040
>  diff --git a/drivers/gpu/drm/i915/intel_ddi.c 
>  b/drivers/gpu/drm/i915/intel_ddi.c
>  index 0467676..b3e4c4a 100644
>  --- a/drivers/gpu/drm/i915/intel_ddi.c
>  +++ b/drivers/gpu/drm/i915/intel_ddi.c
>  @@ -1309,6 +1309,11 @@ void intel_ddi_enable_transcoder_func(const 
>  struct 

Re: [PATCH v8 5/6] drm/i915: enable scrambling

2017-03-08 Thread Sharma, Shashank

Regards

Shashank


On 3/8/2017 7:44 PM, Ville Syrjälä wrote:

On Wed, Mar 08, 2017 at 07:26:45PM +0200, Sharma, Shashank wrote:

Regards

Shashank


On 3/8/2017 7:17 PM, Ville Syrjälä wrote:

On Wed, Mar 08, 2017 at 07:07:48PM +0530, Shashank Sharma wrote:

   Geminilake platform sports a native HDMI 2.0 controller, and is
   capable of driving pixel-clocks upto 594Mhz. HDMI 2.0 spec
   mendates scrambling for these higher clocks, for reduced RF footprint.

   This patch checks if the monitor supports scrambling, and if required,
   enables it during the modeset.

   V2: Addressed review comments from Ville:
   - Do not track scrambling status in DRM layer, track somewhere in
 driver like in intel_crtc_state.
   - Don't talk to monitor at such a low layer, set monitor scrambling
 in intel_enable_ddi() before enabling the port.

   V3: Addressed review comments from Jani
   - In comments, function names, use "sink" instead of "monitor",
 so that the implementation could be close to the language of
 HDMI spec.

V4: Addressed review comment from Maarten
   - scrambling -> hdmi_scrambling
   - high_tmds_clock_ratio -> hdmi_high_tmds_clock_ratio

V5: Addressed review comments from Ville and Ander
   - Do not modifiy the crtc_state after compute_config. Move all
 scrambling and tmds_clock_ratio calcutations to compute_config.
   - While setting scrambling for source/sink, do not check the
 conditions again, just go by the crtc_state flags. This will
 simplyfy the condition checks.

V6: Addressed review comments from Ville
   - Do not add IS_GLK check in disable/enable function, instead add it
 in compute_config, while setting state flags.
   - Remove unnecessary paranthesis.
   - Simplyfy handle_sink_scrambling function as suggested.
   - Add readout code for scrambling status in get_ddi_config and add a
 check for the same in pipe_config_compare.

V7: Addressed review comments from Ander/Ville
   - No separate function for source scrambling, make it inline
   - Align the last line of the macro TRANS_DDI_HDMI_SCRAMBLING_MASK
   - Do not add platform check while setting source scrambling
   - Use pipe_config instead of crtc->config to set sink scrambling
   - To readout scrambling status, Compare with SCRAMBLING_MASK
 not any of its bits
   - Remove platform check in intel_pipe_config_compare while checking
 scrambling status

V8: Fixed mege conflict, Addressed review comments from Ander
   - Remove the desciption/comment about scrambling fom the caller, move
 it to the function
   - Move the IS_GLK check into scrambling function
   - Fix alignment

Signed-off-by: Shashank Sharma 
---
   drivers/gpu/drm/i915/i915_reg.h  |  7 
   drivers/gpu/drm/i915/intel_ddi.c | 19 +++
   drivers/gpu/drm/i915/intel_display.c |  3 ++
   drivers/gpu/drm/i915/intel_drv.h | 10 ++
   drivers/gpu/drm/i915/intel_hdmi.c| 62 

   5 files changed, 101 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index cc843f9..2d50fdc 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -7830,7 +7830,14 @@ enum {
   #define  TRANS_DDI_EDP_INPUT_B_ONOFF (5<<12)
   #define  TRANS_DDI_EDP_INPUT_C_ONOFF (6<<12)
   #define  TRANS_DDI_DP_VC_PAYLOAD_ALLOC   (1<<8)
+#define  TRANS_DDI_HDMI_SCRAMBLER_CTS_ENABLE (1<<7)
+#define  TRANS_DDI_HDMI_SCRAMBLER_RESET_FREQ (1<<6)
   #define  TRANS_DDI_BFI_ENABLE(1<<4)
+#define  TRANS_DDI_HIGH_TMDS_CHAR_RATE (1<<4)
+#define  TRANS_DDI_HDMI_SCRAMBLING (1<<0)
+#define  TRANS_DDI_HDMI_SCRAMBLING_MASK (TRANS_DDI_HDMI_SCRAMBLER_CTS_ENABLE \
+   | TRANS_DDI_HDMI_SCRAMBLER_RESET_FREQ \
+   | TRANS_DDI_HDMI_SCRAMBLING)
   
   /* DisplayPort Transport Control */

   #define _DP_TP_CTL_A 0x64040
diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index 0467676..b3e4c4a 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -1309,6 +1309,11 @@ void intel_ddi_enable_transcoder_func(const struct 
intel_crtc_state *crtc_state)
temp |= TRANS_DDI_MODE_SELECT_HDMI;
else
temp |= TRANS_DDI_MODE_SELECT_DVI;
+
+   if (crtc_state->hdmi_scrambling)
+   temp |= TRANS_DDI_HDMI_SCRAMBLING_MASK;
+   if (crtc_state->hdmi_high_tmds_clock_ratio)
+   temp |= TRANS_DDI_HIGH_TMDS_CHAR_RATE;
} else if (type == INTEL_OUTPUT_ANALOG) {
temp |= TRANS_DDI_MODE_SELECT_FDI;
temp |= (crtc_state->fdi_lanes - 1) << 1;
@@ -1882,6 +1887,9 @@ static void intel_enable_ddi(struct intel_encoder 
*intel_encoder,
struct intel_digital_port *intel_dig_port =

Re: [PATCH v8 5/6] drm/i915: enable scrambling

2017-03-08 Thread Ville Syrjälä
On Wed, Mar 08, 2017 at 07:26:45PM +0200, Sharma, Shashank wrote:
> Regards
> 
> Shashank
> 
> 
> On 3/8/2017 7:17 PM, Ville Syrjälä wrote:
> > On Wed, Mar 08, 2017 at 07:07:48PM +0530, Shashank Sharma wrote:
> >>   Geminilake platform sports a native HDMI 2.0 controller, and is
> >>   capable of driving pixel-clocks upto 594Mhz. HDMI 2.0 spec
> >>   mendates scrambling for these higher clocks, for reduced RF footprint.
> >>
> >>   This patch checks if the monitor supports scrambling, and if required,
> >>   enables it during the modeset.
> >>
> >>   V2: Addressed review comments from Ville:
> >>   - Do not track scrambling status in DRM layer, track somewhere in
> >> driver like in intel_crtc_state.
> >>   - Don't talk to monitor at such a low layer, set monitor scrambling
> >> in intel_enable_ddi() before enabling the port.
> >>
> >>   V3: Addressed review comments from Jani
> >>   - In comments, function names, use "sink" instead of "monitor",
> >> so that the implementation could be close to the language of
> >> HDMI spec.
> >>
> >> V4: Addressed review comment from Maarten
> >>   - scrambling -> hdmi_scrambling
> >>   - high_tmds_clock_ratio -> hdmi_high_tmds_clock_ratio
> >>
> >> V5: Addressed review comments from Ville and Ander
> >>   - Do not modifiy the crtc_state after compute_config. Move all
> >> scrambling and tmds_clock_ratio calcutations to compute_config.
> >>   - While setting scrambling for source/sink, do not check the
> >> conditions again, just go by the crtc_state flags. This will
> >> simplyfy the condition checks.
> >>
> >> V6: Addressed review comments from Ville
> >>   - Do not add IS_GLK check in disable/enable function, instead add it
> >> in compute_config, while setting state flags.
> >>   - Remove unnecessary paranthesis.
> >>   - Simplyfy handle_sink_scrambling function as suggested.
> >>   - Add readout code for scrambling status in get_ddi_config and add a
> >> check for the same in pipe_config_compare.
> >>
> >> V7: Addressed review comments from Ander/Ville
> >>   - No separate function for source scrambling, make it inline
> >>   - Align the last line of the macro TRANS_DDI_HDMI_SCRAMBLING_MASK
> >>   - Do not add platform check while setting source scrambling
> >>   - Use pipe_config instead of crtc->config to set sink scrambling
> >>   - To readout scrambling status, Compare with SCRAMBLING_MASK
> >> not any of its bits
> >>   - Remove platform check in intel_pipe_config_compare while checking
> >> scrambling status
> >>
> >> V8: Fixed mege conflict, Addressed review comments from Ander
> >>   - Remove the desciption/comment about scrambling fom the caller, move
> >> it to the function
> >>   - Move the IS_GLK check into scrambling function
> >>   - Fix alignment
> >>
> >> Signed-off-by: Shashank Sharma 
> >> ---
> >>   drivers/gpu/drm/i915/i915_reg.h  |  7 
> >>   drivers/gpu/drm/i915/intel_ddi.c | 19 +++
> >>   drivers/gpu/drm/i915/intel_display.c |  3 ++
> >>   drivers/gpu/drm/i915/intel_drv.h | 10 ++
> >>   drivers/gpu/drm/i915/intel_hdmi.c| 62 
> >> 
> >>   5 files changed, 101 insertions(+)
> >>
> >> diff --git a/drivers/gpu/drm/i915/i915_reg.h 
> >> b/drivers/gpu/drm/i915/i915_reg.h
> >> index cc843f9..2d50fdc 100644
> >> --- a/drivers/gpu/drm/i915/i915_reg.h
> >> +++ b/drivers/gpu/drm/i915/i915_reg.h
> >> @@ -7830,7 +7830,14 @@ enum {
> >>   #define  TRANS_DDI_EDP_INPUT_B_ONOFF (5<<12)
> >>   #define  TRANS_DDI_EDP_INPUT_C_ONOFF (6<<12)
> >>   #define  TRANS_DDI_DP_VC_PAYLOAD_ALLOC   (1<<8)
> >> +#define  TRANS_DDI_HDMI_SCRAMBLER_CTS_ENABLE (1<<7)
> >> +#define  TRANS_DDI_HDMI_SCRAMBLER_RESET_FREQ (1<<6)
> >>   #define  TRANS_DDI_BFI_ENABLE(1<<4)
> >> +#define  TRANS_DDI_HIGH_TMDS_CHAR_RATE(1<<4)
> >> +#define  TRANS_DDI_HDMI_SCRAMBLING(1<<0)
> >> +#define  TRANS_DDI_HDMI_SCRAMBLING_MASK 
> >> (TRANS_DDI_HDMI_SCRAMBLER_CTS_ENABLE \
> >> +  | TRANS_DDI_HDMI_SCRAMBLER_RESET_FREQ \
> >> +  | TRANS_DDI_HDMI_SCRAMBLING)
> >>   
> >>   /* DisplayPort Transport Control */
> >>   #define _DP_TP_CTL_A 0x64040
> >> diff --git a/drivers/gpu/drm/i915/intel_ddi.c 
> >> b/drivers/gpu/drm/i915/intel_ddi.c
> >> index 0467676..b3e4c4a 100644
> >> --- a/drivers/gpu/drm/i915/intel_ddi.c
> >> +++ b/drivers/gpu/drm/i915/intel_ddi.c
> >> @@ -1309,6 +1309,11 @@ void intel_ddi_enable_transcoder_func(const struct 
> >> intel_crtc_state *crtc_state)
> >>temp |= TRANS_DDI_MODE_SELECT_HDMI;
> >>else
> >>temp |= TRANS_DDI_MODE_SELECT_DVI;
> >> +
> >> +  if (crtc_state->hdmi_scrambling)
> >> +  temp |= TRANS_DDI_HDMI_SCRAMBLING_MASK;
> >> +  if (crtc_state->hdmi_high_tmds_clock_ratio)
> >> +  temp |= TRANS_DDI_HIGH_TMDS_CHAR_RATE;
> >> 

Re: [PATCH v8 5/6] drm/i915: enable scrambling

2017-03-08 Thread Sharma, Shashank

Regards

Shashank


On 3/8/2017 7:17 PM, Ville Syrjälä wrote:

On Wed, Mar 08, 2017 at 07:07:48PM +0530, Shashank Sharma wrote:

  Geminilake platform sports a native HDMI 2.0 controller, and is
  capable of driving pixel-clocks upto 594Mhz. HDMI 2.0 spec
  mendates scrambling for these higher clocks, for reduced RF footprint.

  This patch checks if the monitor supports scrambling, and if required,
  enables it during the modeset.

  V2: Addressed review comments from Ville:
  - Do not track scrambling status in DRM layer, track somewhere in
driver like in intel_crtc_state.
  - Don't talk to monitor at such a low layer, set monitor scrambling
in intel_enable_ddi() before enabling the port.

  V3: Addressed review comments from Jani
  - In comments, function names, use "sink" instead of "monitor",
so that the implementation could be close to the language of
HDMI spec.

V4: Addressed review comment from Maarten
  - scrambling -> hdmi_scrambling
  - high_tmds_clock_ratio -> hdmi_high_tmds_clock_ratio

V5: Addressed review comments from Ville and Ander
  - Do not modifiy the crtc_state after compute_config. Move all
scrambling and tmds_clock_ratio calcutations to compute_config.
  - While setting scrambling for source/sink, do not check the
conditions again, just go by the crtc_state flags. This will
simplyfy the condition checks.

V6: Addressed review comments from Ville
  - Do not add IS_GLK check in disable/enable function, instead add it
in compute_config, while setting state flags.
  - Remove unnecessary paranthesis.
  - Simplyfy handle_sink_scrambling function as suggested.
  - Add readout code for scrambling status in get_ddi_config and add a
check for the same in pipe_config_compare.

V7: Addressed review comments from Ander/Ville
  - No separate function for source scrambling, make it inline
  - Align the last line of the macro TRANS_DDI_HDMI_SCRAMBLING_MASK
  - Do not add platform check while setting source scrambling
  - Use pipe_config instead of crtc->config to set sink scrambling
  - To readout scrambling status, Compare with SCRAMBLING_MASK
not any of its bits
  - Remove platform check in intel_pipe_config_compare while checking
scrambling status

V8: Fixed mege conflict, Addressed review comments from Ander
  - Remove the desciption/comment about scrambling fom the caller, move
it to the function
  - Move the IS_GLK check into scrambling function
  - Fix alignment

Signed-off-by: Shashank Sharma 
---
  drivers/gpu/drm/i915/i915_reg.h  |  7 
  drivers/gpu/drm/i915/intel_ddi.c | 19 +++
  drivers/gpu/drm/i915/intel_display.c |  3 ++
  drivers/gpu/drm/i915/intel_drv.h | 10 ++
  drivers/gpu/drm/i915/intel_hdmi.c| 62 
  5 files changed, 101 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index cc843f9..2d50fdc 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -7830,7 +7830,14 @@ enum {
  #define  TRANS_DDI_EDP_INPUT_B_ONOFF  (5<<12)
  #define  TRANS_DDI_EDP_INPUT_C_ONOFF  (6<<12)
  #define  TRANS_DDI_DP_VC_PAYLOAD_ALLOC(1<<8)
+#define  TRANS_DDI_HDMI_SCRAMBLER_CTS_ENABLE (1<<7)
+#define  TRANS_DDI_HDMI_SCRAMBLER_RESET_FREQ (1<<6)
  #define  TRANS_DDI_BFI_ENABLE (1<<4)
+#define  TRANS_DDI_HIGH_TMDS_CHAR_RATE (1<<4)
+#define  TRANS_DDI_HDMI_SCRAMBLING (1<<0)
+#define  TRANS_DDI_HDMI_SCRAMBLING_MASK (TRANS_DDI_HDMI_SCRAMBLER_CTS_ENABLE \
+   | TRANS_DDI_HDMI_SCRAMBLER_RESET_FREQ \
+   | TRANS_DDI_HDMI_SCRAMBLING)
  
  /* DisplayPort Transport Control */

  #define _DP_TP_CTL_A  0x64040
diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index 0467676..b3e4c4a 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -1309,6 +1309,11 @@ void intel_ddi_enable_transcoder_func(const struct 
intel_crtc_state *crtc_state)
temp |= TRANS_DDI_MODE_SELECT_HDMI;
else
temp |= TRANS_DDI_MODE_SELECT_DVI;
+
+   if (crtc_state->hdmi_scrambling)
+   temp |= TRANS_DDI_HDMI_SCRAMBLING_MASK;
+   if (crtc_state->hdmi_high_tmds_clock_ratio)
+   temp |= TRANS_DDI_HIGH_TMDS_CHAR_RATE;
} else if (type == INTEL_OUTPUT_ANALOG) {
temp |= TRANS_DDI_MODE_SELECT_FDI;
temp |= (crtc_state->fdi_lanes - 1) << 1;
@@ -1882,6 +1887,9 @@ static void intel_enable_ddi(struct intel_encoder 
*intel_encoder,
struct intel_digital_port *intel_dig_port =
enc_to_dig_port(encoder);
  
+		intel_hdmi_handle_sink_scrambling(intel_encoder,

+   conn_state->connector, pipe_config, true);
+
/* In HDMI/DVI mode, the port width, and 

Re: [PATCH v8 5/6] drm/i915: enable scrambling

2017-03-08 Thread Ville Syrjälä
On Wed, Mar 08, 2017 at 07:07:48PM +0530, Shashank Sharma wrote:
>  Geminilake platform sports a native HDMI 2.0 controller, and is
>  capable of driving pixel-clocks upto 594Mhz. HDMI 2.0 spec
>  mendates scrambling for these higher clocks, for reduced RF footprint.
> 
>  This patch checks if the monitor supports scrambling, and if required,
>  enables it during the modeset.
> 
>  V2: Addressed review comments from Ville:
>  - Do not track scrambling status in DRM layer, track somewhere in
>driver like in intel_crtc_state.
>  - Don't talk to monitor at such a low layer, set monitor scrambling
>in intel_enable_ddi() before enabling the port.
> 
>  V3: Addressed review comments from Jani
>  - In comments, function names, use "sink" instead of "monitor",
>so that the implementation could be close to the language of
>HDMI spec.
> 
> V4: Addressed review comment from Maarten
>  - scrambling -> hdmi_scrambling
>  - high_tmds_clock_ratio -> hdmi_high_tmds_clock_ratio
> 
> V5: Addressed review comments from Ville and Ander
>  - Do not modifiy the crtc_state after compute_config. Move all
>scrambling and tmds_clock_ratio calcutations to compute_config.
>  - While setting scrambling for source/sink, do not check the
>conditions again, just go by the crtc_state flags. This will
>simplyfy the condition checks.
> 
> V6: Addressed review comments from Ville
>  - Do not add IS_GLK check in disable/enable function, instead add it
>in compute_config, while setting state flags.
>  - Remove unnecessary paranthesis.
>  - Simplyfy handle_sink_scrambling function as suggested.
>  - Add readout code for scrambling status in get_ddi_config and add a
>check for the same in pipe_config_compare.
> 
> V7: Addressed review comments from Ander/Ville
>  - No separate function for source scrambling, make it inline
>  - Align the last line of the macro TRANS_DDI_HDMI_SCRAMBLING_MASK
>  - Do not add platform check while setting source scrambling
>  - Use pipe_config instead of crtc->config to set sink scrambling
>  - To readout scrambling status, Compare with SCRAMBLING_MASK
>not any of its bits
>  - Remove platform check in intel_pipe_config_compare while checking
>scrambling status
> 
> V8: Fixed mege conflict, Addressed review comments from Ander
>  - Remove the desciption/comment about scrambling fom the caller, move
>it to the function
>  - Move the IS_GLK check into scrambling function
>  - Fix alignment
> 
> Signed-off-by: Shashank Sharma 
> ---
>  drivers/gpu/drm/i915/i915_reg.h  |  7 
>  drivers/gpu/drm/i915/intel_ddi.c | 19 +++
>  drivers/gpu/drm/i915/intel_display.c |  3 ++
>  drivers/gpu/drm/i915/intel_drv.h | 10 ++
>  drivers/gpu/drm/i915/intel_hdmi.c| 62 
> 
>  5 files changed, 101 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
> index cc843f9..2d50fdc 100644
> --- a/drivers/gpu/drm/i915/i915_reg.h
> +++ b/drivers/gpu/drm/i915/i915_reg.h
> @@ -7830,7 +7830,14 @@ enum {
>  #define  TRANS_DDI_EDP_INPUT_B_ONOFF (5<<12)
>  #define  TRANS_DDI_EDP_INPUT_C_ONOFF (6<<12)
>  #define  TRANS_DDI_DP_VC_PAYLOAD_ALLOC   (1<<8)
> +#define  TRANS_DDI_HDMI_SCRAMBLER_CTS_ENABLE (1<<7)
> +#define  TRANS_DDI_HDMI_SCRAMBLER_RESET_FREQ (1<<6)
>  #define  TRANS_DDI_BFI_ENABLE(1<<4)
> +#define  TRANS_DDI_HIGH_TMDS_CHAR_RATE   (1<<4)
> +#define  TRANS_DDI_HDMI_SCRAMBLING   (1<<0)
> +#define  TRANS_DDI_HDMI_SCRAMBLING_MASK (TRANS_DDI_HDMI_SCRAMBLER_CTS_ENABLE 
> \
> + | TRANS_DDI_HDMI_SCRAMBLER_RESET_FREQ \
> + | TRANS_DDI_HDMI_SCRAMBLING)
>  
>  /* DisplayPort Transport Control */
>  #define _DP_TP_CTL_A 0x64040
> diff --git a/drivers/gpu/drm/i915/intel_ddi.c 
> b/drivers/gpu/drm/i915/intel_ddi.c
> index 0467676..b3e4c4a 100644
> --- a/drivers/gpu/drm/i915/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/intel_ddi.c
> @@ -1309,6 +1309,11 @@ void intel_ddi_enable_transcoder_func(const struct 
> intel_crtc_state *crtc_state)
>   temp |= TRANS_DDI_MODE_SELECT_HDMI;
>   else
>   temp |= TRANS_DDI_MODE_SELECT_DVI;
> +
> + if (crtc_state->hdmi_scrambling)
> + temp |= TRANS_DDI_HDMI_SCRAMBLING_MASK;
> + if (crtc_state->hdmi_high_tmds_clock_ratio)
> + temp |= TRANS_DDI_HIGH_TMDS_CHAR_RATE;
>   } else if (type == INTEL_OUTPUT_ANALOG) {
>   temp |= TRANS_DDI_MODE_SELECT_FDI;
>   temp |= (crtc_state->fdi_lanes - 1) << 1;
> @@ -1882,6 +1887,9 @@ static void intel_enable_ddi(struct intel_encoder 
> *intel_encoder,
>   struct intel_digital_port *intel_dig_port =
>   enc_to_dig_port(encoder);
>  
> + intel_hdmi_handle_sink_scrambling(intel_encoder,
> + 

[PATCH v2] drm: hdlcd: Fix the calculation of the scanout start address

2017-03-08 Thread Liviu Dudau
The calculation of the framebuffer's start address was wrongly using
the CRTC's x and y position rather than the one of the source
framebuffer. To fix that we need to update the plane_check code to
call drm_plane_helper_check_state() to clip the src and dst coordinates.
While there so some minor cleanup of redundant freeing of
devm_alloc-ated memory.

Signed-off-by: Liviu Dudau 
---

v1 was discussed here: 
https://lists.freedesktop.org/archives/dri-devel/2017-February/133379.html

 drivers/gpu/drm/arm/hdlcd_crtc.c | 47 ++--
 1 file changed, 31 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/arm/hdlcd_crtc.c b/drivers/gpu/drm/arm/hdlcd_crtc.c
index 20ebfb4fbdfa..c65116348281 100644
--- a/drivers/gpu/drm/arm/hdlcd_crtc.c
+++ b/drivers/gpu/drm/arm/hdlcd_crtc.c
@@ -10,6 +10,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -206,16 +207,33 @@ static const struct drm_crtc_helper_funcs 
hdlcd_crtc_helper_funcs = {
 static int hdlcd_plane_atomic_check(struct drm_plane *plane,
struct drm_plane_state *state)
 {
-   u32 src_w, src_h;
+   struct drm_rect clip = { 0 };
+   struct drm_crtc_state *crtc_state;
+   u32 src_h = state->src_h >> 16;
 
-   src_w = state->src_w >> 16;
-   src_h = state->src_h >> 16;
+   /* only the HDLCD_REG_FB_LINE_COUNT register has a limit */
+   if (src_h >= HDLCD_MAX_YRES) {
+   DRM_DEBUG_KMS("Invalid source width: %d\n", src_h);
+   return -EINVAL;
+   }
+
+   if (!state->fb || !state->crtc)
+   return 0;
 
-   /* we can't do any scaling of the plane source */
-   if ((src_w != state->crtc_w) || (src_h != state->crtc_h))
+   crtc_state = drm_atomic_get_existing_crtc_state(state->state,
+   state->crtc);
+   if (!crtc_state) {
+   DRM_DEBUG_KMS("Invalid crtc state\n");
return -EINVAL;
+   }
 
-   return 0;
+   clip.x2 = crtc_state->adjusted_mode.hdisplay;
+   clip.y2 = crtc_state->adjusted_mode.vdisplay;
+
+   return drm_plane_helper_check_state(state, ,
+   DRM_PLANE_HELPER_NO_SCALING,
+   DRM_PLANE_HELPER_NO_SCALING,
+   false, true);
 }
 
 static void hdlcd_plane_atomic_update(struct drm_plane *plane,
@@ -224,21 +242,20 @@ static void hdlcd_plane_atomic_update(struct drm_plane 
*plane,
struct drm_framebuffer *fb = plane->state->fb;
struct hdlcd_drm_private *hdlcd;
struct drm_gem_cma_object *gem;
-   u32 src_w, src_h, dest_w, dest_h;
+   u32 src_x, src_y, dest_h;
dma_addr_t scanout_start;
 
if (!fb)
return;
 
-   src_w = plane->state->src_w >> 16;
-   src_h = plane->state->src_h >> 16;
-   dest_w = plane->state->crtc_w;
-   dest_h = plane->state->crtc_h;
+   src_x = plane->state->src.x1 >> 16;
+   src_y = plane->state->src.y1 >> 16;
+   dest_h = drm_rect_height(>state->dst);
gem = drm_fb_cma_get_gem_obj(fb, 0);
+
scanout_start = gem->paddr + fb->offsets[0] +
-   plane->state->crtc_y * fb->pitches[0] +
-   plane->state->crtc_x *
-   fb->format->cpp[0];
+   src_y * fb->pitches[0] +
+   src_x * fb->format->cpp[0];
 
hdlcd = plane->dev->dev_private;
hdlcd_write(hdlcd, HDLCD_REG_FB_LINE_LENGTH, fb->pitches[0]);
@@ -285,7 +302,6 @@ static struct drm_plane *hdlcd_plane_init(struct drm_device 
*drm)
   formats, ARRAY_SIZE(formats),
   DRM_PLANE_TYPE_PRIMARY, NULL);
if (ret) {
-   devm_kfree(drm->dev, plane);
return ERR_PTR(ret);
}
 
@@ -309,7 +325,6 @@ int hdlcd_setup_crtc(struct drm_device *drm)
_crtc_funcs, NULL);
if (ret) {
hdlcd_plane_destroy(primary);
-   devm_kfree(drm->dev, primary);
return ret;
}
 
-- 
2.12.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 18/24] drm/etnaviv: switch to postclose

2017-03-08 Thread Lucas Stach
Am Mittwoch, den 08.03.2017, 15:12 +0100 schrieb Daniel Vetter:
> I didn't spot anything that would require ordering here (well not
> anywhere else either), and I'm trying to unify at least modern
> drivers
> on one close hook.
> 
> Cc: Lucas Stach 
> Cc: Russell King 
> Cc: Christian Gmeiner 
> Cc: etna...@lists.freedesktop.org
> Signed-off-by: Daniel Vetter 

Acked-by: Lucas Stach 

for merging through drm-misc

> ---
>  drivers/gpu/drm/etnaviv/etnaviv_drv.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> index 587e45043542..289a9f8c6671 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> @@ -111,7 +111,7 @@ static int etnaviv_open(struct drm_device *dev,
> struct drm_file *file)
>   return 0;
>  }
>  
> -static void etnaviv_preclose(struct drm_device *dev, struct drm_file
> *file)
> +static void etnaviv_postclose(struct drm_device *dev, struct
> drm_file *file)
>  {
>   struct etnaviv_drm_private *priv = dev->dev_private;
>   struct etnaviv_file_private *ctx = file->driver_priv;
> @@ -488,7 +488,7 @@ static struct drm_driver etnaviv_drm_driver = {
>   DRIVER_PRIME |
>   DRIVER_RENDER,
>   .open   = etnaviv_open,
> - .preclose   = etnaviv_preclose,
> + .postclose   = etnaviv_postclose,
>   .gem_free_object_unlocked = etnaviv_gem_free_object,
>   .gem_vm_ops = _ops,
>   .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 12/24] drm/i915: Merge pre/postclose hooks

2017-03-08 Thread Daniel Vetter
On Wed, Mar 08, 2017 at 03:07:48PM +, Chris Wilson wrote:
> On Wed, Mar 08, 2017 at 03:12:45PM +0100, Daniel Vetter wrote:
> > There's really not a reason afaics that we can't just clean up
> > everything at the end, in the terminal postclose hook: Since this is
> > closing a file descriptor we know no one else can have a reference or
> > a thread doing something with that drm_file except the close code.
> > Ordering shouldn't matter, as long as we don't kfree before we clean
> > stuff up.
> 
> My gut feeling was that preclose is the one we want to keep, as that is
> closer to the onion unwind - during open, we do the core drm ops first
> (e.g. drm_gem_open) before the backend, so during close we should do the
> driver before the core.
> 
> Maybe completely wrong ofc.

I wasn't sure whether drivers might have some random pointers to fpriv
that they might chase when we tear down gem objects and stuff like that.
And if you look at what's before postclose, we still have onion
unwrapping: All the things before it (fb cleanup, gem cleanup, master
dropping) is stuff that userspace adds to the file _after_ it's fully
opened.

Well it's not entirely clear, because gem destroys the idr before
postclose, which might or might not trip up someone.

But afaik all the other destructive cleanup is done after postclose.

So maybe that's the split we want in drm_close?

- First release all runtime resources acquired after ->open. Not
  destructive cleanup, fpriv should keep working like right after ->open
  has returned. These functions would all have _release in their names.
- call the driver's ->postclose.
- All the destructive cleanup. Those functions would all have _destroy in
  their names.

Since there's not really a real issue right now I'd prefer if we postpone
this cleanup though, and first get all the driver patches merged. Just in
case I missed something ...

I kinda want to do an s/postclose/close/ using cocci anyway, so this isn't
the last series on this topic.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3 1/3] drm: Add mode_config .get_format_info() hook

2017-03-08 Thread ville . syrjala
From: Ville Syrjälä 

Allow drivers to return a custom drm_format_info structure for special
fb layouts. We'll use this for the compression control surface in i915.

v2: Fix drm_get_format_info() kernel doc (Laurent)
Don't pass 'dev' to the new hook (Laurent)
v3: s/compresssion/compression/ (Ben)

Cc: Laurent Pinchart 
Cc: Ben Widawsky 
Cc: Jason Ekstrand 
Signed-off-by: Ville Syrjälä 
Reviewed-by: Ben Widawsky 
---
 drivers/gpu/drm/drm_fb_cma_helper.c  |  2 +-
 drivers/gpu/drm/drm_fourcc.c | 25 +
 drivers/gpu/drm/drm_framebuffer.c|  9 +++--
 drivers/gpu/drm/drm_modeset_helper.c |  2 +-
 include/drm/drm_fourcc.h |  6 ++
 include/drm/drm_mode_config.h| 14 ++
 6 files changed, 54 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c 
b/drivers/gpu/drm/drm_fb_cma_helper.c
index 74cd393a6407..50abd1faf38f 100644
--- a/drivers/gpu/drm/drm_fb_cma_helper.c
+++ b/drivers/gpu/drm/drm_fb_cma_helper.c
@@ -177,7 +177,7 @@ struct drm_framebuffer *drm_fb_cma_create_with_funcs(struct 
drm_device *dev,
int ret;
int i;
 
-   info = drm_format_info(mode_cmd->pixel_format);
+   info = drm_get_format_info(dev, mode_cmd);
if (!info)
return ERR_PTR(-EINVAL);
 
diff --git a/drivers/gpu/drm/drm_fourcc.c b/drivers/gpu/drm/drm_fourcc.c
index 90d2cc8da8eb..f9b6445e846a 100644
--- a/drivers/gpu/drm/drm_fourcc.c
+++ b/drivers/gpu/drm/drm_fourcc.c
@@ -199,6 +199,31 @@ const struct drm_format_info *drm_format_info(u32 format)
 EXPORT_SYMBOL(drm_format_info);
 
 /**
+ * drm_get_format_info - query information for a given framebuffer 
configuration
+ * @dev: DRM device
+ * @mode_cmd: metadata from the userspace fb creation request
+ *
+ * Returns:
+ * The instance of struct drm_format_info that describes the pixel format, or
+ * NULL if the format is unsupported.
+ */
+const struct drm_format_info *
+drm_get_format_info(struct drm_device *dev,
+   const struct drm_mode_fb_cmd2 *mode_cmd)
+{
+   const struct drm_format_info *info = NULL;
+
+   if (dev->mode_config.funcs->get_format_info)
+   info = dev->mode_config.funcs->get_format_info(mode_cmd);
+
+   if (!info)
+   info = drm_format_info(mode_cmd->pixel_format);
+
+   return info;
+}
+EXPORT_SYMBOL(drm_get_format_info);
+
+/**
  * drm_format_num_planes - get the number of planes for format
  * @format: pixel format (DRM_FORMAT_*)
  *
diff --git a/drivers/gpu/drm/drm_framebuffer.c 
b/drivers/gpu/drm/drm_framebuffer.c
index e4909aef75d7..249c8cb22404 100644
--- a/drivers/gpu/drm/drm_framebuffer.c
+++ b/drivers/gpu/drm/drm_framebuffer.c
@@ -126,11 +126,13 @@ int drm_mode_addfb(struct drm_device *dev,
return 0;
 }
 
-static int framebuffer_check(const struct drm_mode_fb_cmd2 *r)
+static int framebuffer_check(struct drm_device *dev,
+const struct drm_mode_fb_cmd2 *r)
 {
const struct drm_format_info *info;
int i;
 
+   /* check if the format is supported at all */
info = __drm_format_info(r->pixel_format & ~DRM_FORMAT_BIG_ENDIAN);
if (!info) {
struct drm_format_name_buf format_name;
@@ -140,6 +142,9 @@ static int framebuffer_check(const struct drm_mode_fb_cmd2 
*r)
return -EINVAL;
}
 
+   /* now let the driver pick its own format info */
+   info = drm_get_format_info(dev, r);
+
if (r->width == 0 || r->width % info->hsub) {
DRM_DEBUG_KMS("bad framebuffer width %u\n", r->width);
return -EINVAL;
@@ -263,7 +268,7 @@ drm_internal_framebuffer_create(struct drm_device *dev,
return ERR_PTR(-EINVAL);
}
 
-   ret = framebuffer_check(r);
+   ret = framebuffer_check(dev, r);
if (ret)
return ERR_PTR(ret);
 
diff --git a/drivers/gpu/drm/drm_modeset_helper.c 
b/drivers/gpu/drm/drm_modeset_helper.c
index cc44a9a4b004..2b33825f2f93 100644
--- a/drivers/gpu/drm/drm_modeset_helper.c
+++ b/drivers/gpu/drm/drm_modeset_helper.c
@@ -78,7 +78,7 @@ void drm_helper_mode_fill_fb_struct(struct drm_device *dev,
int i;
 
fb->dev = dev;
-   fb->format = drm_format_info(mode_cmd->pixel_format);
+   fb->format = drm_get_format_info(dev, mode_cmd);
fb->width = mode_cmd->width;
fb->height = mode_cmd->height;
for (i = 0; i < 4; i++) {
diff --git a/include/drm/drm_fourcc.h b/include/drm/drm_fourcc.h
index fcc08da850c8..6942e84b6edd 100644
--- a/include/drm/drm_fourcc.h
+++ b/include/drm/drm_fourcc.h
@@ -25,6 +25,9 @@
 #include 
 #include 
 
+struct drm_device;
+struct drm_mode_fb_cmd2;
+
 /**
  * struct drm_format_info - information about a DRM format
  * @format: 4CC format identifier (DRM_FORMAT_*)
@@ 

[PATCH v4 2/3] drm/i915: Implement .get_format_info() hook for CCS

2017-03-08 Thread ville . syrjala
From: Ville Syrjälä 

SKL+ display engine can scan out certain kinds of compressed surfaces
produced by the render engine. This involved telling the display engine
the location of the color control surfae (CCS) which describes which
parts of the main surface are compressed and which are not. The location
of CCS is provided by userspace as just another plane with its own offset.

By providing our own format information for the CCS formats, we should
be able to make framebuffer_check() do the right thing for the CCS
surface as well.

Note that we'll return the same format info for both Y and Yf tiled
format as that's what happens with the non-CCS Y vs. Yf as well. If
desired, we could potentially return a unique pointer for each
pixel_format+tiling+ccs combination, in which case we immediately be
able to tell if any of that stuff changed by just comparing the
pointers. But that does sound a bit wasteful space wise.

v2: Drop the 'dev' argument from the hook
v3: Include the description of the CCS surface layout
v4: Pretend CCS tiles are regular 128 byte wide Y tiles (Jason)

Cc: Daniel Vetter 
Cc: Ben Widawsky 
Cc: Jason Ekstrand 
Reviewed-by: Ben Widawsky  (v3)
Signed-off-by: Ville Syrjälä 
---
 drivers/gpu/drm/i915/intel_display.c | 43 
 include/uapi/drm/drm_fourcc.h| 20 +
 2 files changed, 63 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_display.c 
b/drivers/gpu/drm/i915/intel_display.c
index fef6c766d0be..f410bc4b8b3d 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2420,6 +2420,48 @@ static unsigned int intel_fb_modifier_to_tiling(uint64_t 
fb_modifier)
}
 }
 
+/*
+ * 1 byte of CCS actually corresponds to 16x8 pixels on the main
+ * surface, and the memory layout for the CCS tile us 64x64 bytes.
+ * But since we're pretending the CCS tile is 128 bytes wide we
+ * adjust hsub/vsub here accordingly to 8x16 so that the
+ * bytes<->x/y conversions come out correct.
+ */
+static const struct drm_format_info ccs_formats[] = {
+   { .format = DRM_FORMAT_XRGB, .depth = 24, .num_planes = 2, .cpp = { 
4, 1, }, .hsub = 8, .vsub = 16, },
+   { .format = DRM_FORMAT_XBGR, .depth = 24, .num_planes = 2, .cpp = { 
4, 1, }, .hsub = 8, .vsub = 16, },
+   { .format = DRM_FORMAT_ARGB, .depth = 32, .num_planes = 2, .cpp = { 
4, 1, }, .hsub = 8, .vsub = 16, },
+   { .format = DRM_FORMAT_ABGR, .depth = 32, .num_planes = 2, .cpp = { 
4, 1, }, .hsub = 8, .vsub = 16, },
+};
+
+static const struct drm_format_info *
+lookup_format_info(const struct drm_format_info formats[],
+  int num_formats, u32 format)
+{
+   int i;
+
+   for (i = 0; i < num_formats; i++) {
+   if (formats[i].format == format)
+   return [i];
+   }
+
+   return NULL;
+}
+
+static const struct drm_format_info *
+intel_get_format_info(const struct drm_mode_fb_cmd2 *cmd)
+{
+   switch (cmd->modifier[0]) {
+   case I915_FORMAT_MOD_Y_TILED_CCS:
+   case I915_FORMAT_MOD_Yf_TILED_CCS:
+   return lookup_format_info(ccs_formats,
+ ARRAY_SIZE(ccs_formats),
+ cmd->pixel_format);
+   default:
+   return NULL;
+   }
+}
+
 static int
 intel_fill_fb_info(struct drm_i915_private *dev_priv,
   struct drm_framebuffer *fb)
@@ -14482,6 +14524,7 @@ static void intel_atomic_state_free(struct 
drm_atomic_state *state)
 
 static const struct drm_mode_config_funcs intel_mode_funcs = {
.fb_create = intel_user_framebuffer_create,
+   .get_format_info = intel_get_format_info,
.output_poll_changed = intel_fbdev_output_poll_changed,
.atomic_check = intel_atomic_check,
.atomic_commit = intel_atomic_commit,
diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h
index ef20abb8119b..bc202a5adbeb 100644
--- a/include/uapi/drm/drm_fourcc.h
+++ b/include/uapi/drm/drm_fourcc.h
@@ -238,6 +238,26 @@ extern "C" {
 #define I915_FORMAT_MOD_Yf_TILED fourcc_mod_code(INTEL, 3)
 
 /*
+ * Intel color control surface (CCS) for render compression
+ *
+ * The framebuffer format must be one of the 8:8:8:8 RGB formats.
+ * The main surface will be plane index 0 and must be Y/Yf-tiled,
+ * the CCS will be plane index 1.
+ *
+ * Each CCS tile matches a 1024x512 pixel area of the main surface.
+ * To match certain aspects of the 3D hardware the CCS is
+ * considered to be made up of normal 128Bx32 Y tiles, Thus
+ * the CCS pitch must be specified in multiples of 128 bytes.
+ *
+ * In reality the CCS tile appears to be a 64Bx64 Y tile, composed
+ * of QWORD (8 bytes) chunks instead of OWORD (16 bytes) chunks.
+ * But that fact is not relevant unless the memory is accessed

[PATCH v2 0/3] drm/i915: SKL+ render decompression support

2017-03-08 Thread ville . syrjala
From: Ville Syrjälä 

Here's the remainder of CCS scanout support. All the i915 prep stuff
has now landed, and we're left with just these three patches.

What's changed since the last time?
* CCS tile is now considered to be 128Bx32 since Jason wants it that way
* A bit of polish here and there

I quickly hacked my software only CCS test to handle the new 128B
concept and it seems to work. The code looks a bit funny because
I now have to compute the stuff based on 128B tiles for addfb,
but I still need to compute it based on 64B tiles to make the
software rendering of CCS work. But it's just a test application
so whatever.

Entire series can be had here:
git://github.com/vsyrjala/linux.git fb_format_dedup_5_ccs_128

Cc: Jason Ekstrand 
Cc: Ben Widawsky 

Ville Syrjälä (3):
  drm: Add mode_config .get_format_info() hook
  drm/i915: Implement .get_format_info() hook for CCS
  drm/i915: Add render decompression support

 drivers/gpu/drm/drm_fb_cma_helper.c  |   2 +-
 drivers/gpu/drm/drm_fourcc.c |  25 
 drivers/gpu/drm/drm_framebuffer.c|   9 +-
 drivers/gpu/drm/drm_modeset_helper.c |   2 +-
 drivers/gpu/drm/i915/i915_reg.h  |  23 +++
 drivers/gpu/drm/i915/intel_display.c | 278 ---
 drivers/gpu/drm/i915/intel_pm.c  |  29 +++-
 drivers/gpu/drm/i915/intel_sprite.c  |   5 +
 include/drm/drm_fourcc.h |   6 +
 include/drm/drm_mode_config.h|  14 ++
 include/uapi/drm/drm_fourcc.h|  20 +++
 11 files changed, 390 insertions(+), 23 deletions(-)

-- 
2.10.2

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3 3/3] drm/i915: Add render decompression support

2017-03-08 Thread ville . syrjala
From: Ville Syrjälä 

SKL+ display engine can scan out certain kinds of compressed surfaces
produced by the render engine. This involved telling the display engine
the location of the color control surfae (CCS) which describes
which parts of the main surface are compressed and which are not. The
location of CCS is provided by userspace as just another plane with its
own offset.

Add the required stuff to validate the user provided AUX plane metadata
and convert the user provided linear offset into something the hardware
can consume.

Due to hardware limitations we require that the main surface and
the AUX surface (CCS) be part of the same bo. The hardware also
makes life hard by not allowing you to provide separate x/y offsets
for the main and AUX surfaces (excpet with NV12), so finding suitable
offsets for both requires a bit of work. Assuming we still want keep
playing tricks with the offsets. I've just gone with a dumb "search
backward for suitable offsets" approach, which is far from optimal,
but it works.

Also not all planes will be capable of scanning out compressed surfaces,
and eg. 90/270 degree rotation is not supported in combination with
decompression either.

This patch may contain work from at least the following people:
* Vandana Kannan 
* Daniel Vetter 
* Ben Widawsky 

v2: Deal with display workarounds 0390, 0531, 1125 (Paulo)
v3: Pretend CCS tiles are regular 128 byte wide Y tiles (Jason)
Put the AUX register defines to the correct place
Fix up the slightly bogus rotation check

Cc: Paulo Zanoni 
Cc: Daniel Vetter 
Cc: Ben Widawsky 
Cc: Jason Ekstrand 
Signed-off-by: Ville Syrjälä 
Reviewed-by: Ben Widawsky  (v1)
---
 drivers/gpu/drm/i915/i915_reg.h  |  23 
 drivers/gpu/drm/i915/intel_display.c | 235 ---
 drivers/gpu/drm/i915/intel_pm.c  |  29 -
 drivers/gpu/drm/i915/intel_sprite.c  |   5 +
 4 files changed, 273 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index cc843f96576f..c1ef483bd381 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -5905,6 +5905,10 @@ enum {
 #define _PLANE_KEYMSK_2_A  0x70298
 #define _PLANE_KEYMAX_1_A  0x701a0
 #define _PLANE_KEYMAX_2_A  0x702a0
+#define _PLANE_AUX_DIST_1_A0x701c0
+#define _PLANE_AUX_DIST_2_A0x702c0
+#define _PLANE_AUX_OFFSET_1_A  0x701c4
+#define _PLANE_AUX_OFFSET_2_A  0x702c4
 #define _PLANE_COLOR_CTL_1_A   0x701CC /* GLK+ */
 #define _PLANE_COLOR_CTL_2_A   0x702CC /* GLK+ */
 #define _PLANE_COLOR_CTL_3_A   0x703CC /* GLK+ */
@@ -6011,6 +6015,24 @@ enum {
 #define PLANE_NV12_BUF_CFG(pipe, plane)\
_MMIO_PLANE(plane, _PLANE_NV12_BUF_CFG_1(pipe), 
_PLANE_NV12_BUF_CFG_2(pipe))
 
+#define _PLANE_AUX_DIST_1_B0x711c0
+#define _PLANE_AUX_DIST_2_B0x712c0
+#define _PLANE_AUX_DIST_1(pipe) \
+   _PIPE(pipe, _PLANE_AUX_DIST_1_A, _PLANE_AUX_DIST_1_B)
+#define _PLANE_AUX_DIST_2(pipe) \
+   _PIPE(pipe, _PLANE_AUX_DIST_2_A, _PLANE_AUX_DIST_2_B)
+#define PLANE_AUX_DIST(pipe, plane) \
+   _MMIO_PLANE(plane, _PLANE_AUX_DIST_1(pipe), _PLANE_AUX_DIST_2(pipe))
+
+#define _PLANE_AUX_OFFSET_1_B  0x711c4
+#define _PLANE_AUX_OFFSET_2_B  0x712c4
+#define _PLANE_AUX_OFFSET_1(pipe)   \
+   _PIPE(pipe, _PLANE_AUX_OFFSET_1_A, _PLANE_AUX_OFFSET_1_B)
+#define _PLANE_AUX_OFFSET_2(pipe)   \
+   _PIPE(pipe, _PLANE_AUX_OFFSET_2_A, _PLANE_AUX_OFFSET_2_B)
+#define PLANE_AUX_OFFSET(pipe, plane)   \
+   _MMIO_PLANE(plane, _PLANE_AUX_OFFSET_1(pipe), _PLANE_AUX_OFFSET_2(pipe))
+
 #define _PLANE_COLOR_CTL_1_B   0x711CC
 #define _PLANE_COLOR_CTL_2_B   0x712CC
 #define _PLANE_COLOR_CTL_3_B   0x713CC
@@ -6494,6 +6516,7 @@ enum {
 # define CHICKEN3_DGMG_DONE_FIX_DISABLE(1 << 2)
 
 #define CHICKEN_PAR1_1 _MMIO(0x42080)
+#define  SKL_RC_HASH_OUTSIDE   (1 << 15)
 #define  DPA_MASK_VBLANK_SRD   (1 << 15)
 #define  FORCE_ARB_IDLE_PLANES (1 << 14)
 #define  SKL_EDP_PSR_FIX_RDWRAP(1 << 3)
diff --git a/drivers/gpu/drm/i915/intel_display.c 
b/drivers/gpu/drm/i915/intel_display.c
index f410bc4b8b3d..79d6cd38a4ed 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2004,11 +2004,19 @@ intel_tile_width_bytes(const struct drm_framebuffer 
*fb, int plane)
return 128;
else
return 512;
+   case I915_FORMAT_MOD_Y_TILED_CCS:
+ 

Re: [Intel-gfx] [PATCH 01/24] drm/doc: Add todo about connector_list_iter

2017-03-08 Thread Sean Paul
On Wed, Mar 08, 2017 at 03:12:34PM +0100, Daniel Vetter wrote:
> At least radeon, amdgpu and nouveau should be converted. We have
> patches for i915 already.
> 
> Signed-off-by: Daniel Vetter 
> ---
>  Documentation/gpu/todo.rst | 13 +
>  1 file changed, 13 insertions(+)
> 
> diff --git a/Documentation/gpu/todo.rst b/Documentation/gpu/todo.rst
> index ce0f1a588e7f..63c7088cace3 100644
> --- a/Documentation/gpu/todo.rst
> +++ b/Documentation/gpu/todo.rst
> @@ -153,6 +153,19 @@ following drivers still use ``struct_mutex``: ``msm``, 
> ``omapdrm`` and
>  
>  Contact: Daniel Vetter
>  
> +Switch to drm_connector_list_iter for any connector_list walking
> +
> +
> +Connectors can be hotplugged, and we now have a special list of helpers to 
> walk
> +the connector_list in a race-free fashion, without incuring deadlocks on 
> mutexes

s/incuring/incurring/

With that,

Reviewed-by: Sean Paul 

> +and other fun stuff.
> +
> +Unfortunately most drivers are not converted yet. At least all those 
> supporting
> +DP MST hotplug should be converted, since for those drivers the difference
> +matters. See drm_for_each_connector_iter() vs. drm_for_each_connector().
> +
> +Contact: Daniel Vetter
> +
>  Core refactorings
>  =
>  
> -- 
> 2.11.0
> 
> ___
> Intel-gfx mailing list
> intel-...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 3/3] drm/qxl: Remove qxl_debugfs_remove_files()

2017-03-08 Thread Daniel Vetter
On Wed, Mar 08, 2017 at 12:33:01PM +0100, Gerd Hoffmann wrote:
> On Mi, 2017-03-08 at 10:52 +0100, Daniel Vetter wrote:
> > On Wed, Mar 08, 2017 at 08:45:13AM +0100, Gerd Hoffmann wrote:
> > > On Di, 2017-03-07 at 21:49 +0100, Noralf Trønnes wrote:
> > > > drm_debugfs_cleanup() now removes all minor->debugfs_list entries
> > > > automatically, so it's not necessary to call
> > > > drm_debugfs_remove_files().
> > > > 
> > > > Cc: airl...@linux.ie
> > > > Cc: kra...@redhat.com
> > > > Signed-off-by: Noralf Trønnes 
> > > 
> > > Reviewed-by: Gerd Hoffmann 
> > 
> > I assume you'll push to drm-misc yourself since its qxl?
> 
> Can surely do that.
> 
> Question though:  This seems to be a cross-driver cleanup series.  At
> least only 3/3 landed in my inbox, did't look @ dri-devel for the other
> patches.  What is the usual policy on those?
> 
> From the past I had the impression that in such a case the whole series
> gets applied by one of the drm-misc maintainers instead of each
> individual driver maintainer cherry-picking the patches from the
> series ...

Well mostly because many driver maintainers aren't dutiful with picking up
patches, or lose them again, or just take forever. But for this series
here there's no such excuse, and there's also no technical reason to order
patches a certain way (at least your qxl one is free standing and depends
upon nothing else and blocks nothing else).

One of my goals with drm-misc is that I can reduce my efforts spending on
catchging other maintainer's fallout, so I'd very much encourage everyone
to just push stuff. Especially if you're the maintainer, and you slap an
r-b onto a patch with no indication whether you merge it yourself or
except someone else to merge it it's confusing and just improves the odds
of the patch hitting one of our holes ...
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 12/24] drm/i915: Merge pre/postclose hooks

2017-03-08 Thread Chris Wilson
On Wed, Mar 08, 2017 at 03:12:45PM +0100, Daniel Vetter wrote:
> There's really not a reason afaics that we can't just clean up
> everything at the end, in the terminal postclose hook: Since this is
> closing a file descriptor we know no one else can have a reference or
> a thread doing something with that drm_file except the close code.
> Ordering shouldn't matter, as long as we don't kfree before we clean
> stuff up.

My gut feeling was that preclose is the one we want to keep, as that is
closer to the onion unwind - during open, we do the core drm ops first
(e.g. drm_gem_open) before the backend, so during close we should do the
driver before the core.

Maybe completely wrong ofc.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 09/24] drm: Extract drm_file.h

2017-03-08 Thread Gustavo Padovan
2017-03-08 Daniel Vetter :

> I'm torn on whether drm_minor really should be here or somewhere else.
> Maybe with more clarity after untangling drmP.h more this is easier to
> decide, for now I've put a FIXME comment right next to it. Right now
> we need struct drm_minor for the inline drm_file type helpers, and so
> it does kinda make sense to have them here.
> 
> Next patch will kerneldoc-ify the entire pile.
> 
> Signed-off-by: Daniel Vetter 
> ---
>  drivers/gpu/drm/drm_file.c |   5 +-
>  include/drm/drmP.h | 127 +
>  include/drm/drm_file.h | 172 
> +
>  include/drm/drm_prime.h|   1 +
>  4 files changed, 178 insertions(+), 127 deletions(-)
>  create mode 100644 include/drm/drm_file.h

Reviewed-by: Gustavo Padovan 

Gustavo

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [Intel-gfx] [PATCH 07/24] drm: rename drm_fops.c to drm_file.c

2017-03-08 Thread Gustavo Padovan
2017-03-08 Daniel Vetter :

> It's not just file ops, but drm_file stuff in general. This is prep
> work to extracting a drm_file.h header in the next patch.
> 
> Signed-off-by: Daniel Vetter 
> ---
>  Documentation/gpu/drm-internals.rst| 4 ++--
>  drivers/gpu/drm/Makefile   | 2 +-
>  drivers/gpu/drm/{drm_fops.c => drm_file.c} | 3 ---
>  drivers/gpu/drm/drm_internal.h | 2 +-
>  include/drm/drmP.h | 2 +-
>  5 files changed, 5 insertions(+), 8 deletions(-)
>  rename drivers/gpu/drm/{drm_fops.c => drm_file.c} (99%)

Reviewed-by: Gustavo Padovan 

Gustavo

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [Intel-gfx] [PATCH 05/24] drm: Remove drmP.h include from drm_kms_helper_common.c

2017-03-08 Thread Gustavo Padovan
2017-03-08 Daniel Vetter :

> An easy one as a drive-by.
> 
> Signed-off-by: Daniel Vetter 
> ---
>  drivers/gpu/drm/drm_kms_helper_common.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_kms_helper_common.c 
> b/drivers/gpu/drm/drm_kms_helper_common.c
> index 45db36cd3d20..6e35a56a6102 100644
> --- a/drivers/gpu/drm/drm_kms_helper_common.c
> +++ b/drivers/gpu/drm/drm_kms_helper_common.c
> @@ -25,8 +25,7 @@
>   *
>   */
>  
> -#include 
> -#include 
> +#include 

Reviewed-by: Gustavo Padovan 

Gustavo

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2 10/12] drm/exynos: set plane possible_crtcs in exynos_plane_init

2017-03-08 Thread Andrzej Hajda
All Exynos planes are assigned to exactly one CRTC, it allows to simplify
initialization by moving setting of possible_crtcs to exynos_plane_init.

Signed-off-by: Andrzej Hajda 
---
 drivers/gpu/drm/exynos/exynos5433_drm_decon.c | 2 +-
 drivers/gpu/drm/exynos/exynos7_drm_decon.c| 2 +-
 drivers/gpu/drm/exynos/exynos_drm_fimd.c  | 2 +-
 drivers/gpu/drm/exynos/exynos_drm_plane.c | 5 ++---
 drivers/gpu/drm/exynos/exynos_drm_plane.h | 1 -
 drivers/gpu/drm/exynos/exynos_drm_vidi.c  | 2 +-
 drivers/gpu/drm/exynos/exynos_mixer.c | 2 +-
 7 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c 
b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
index d922b10..a60d461 100644
--- a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
@@ -604,7 +604,7 @@ static int decon_bind(struct device *dev, struct device 
*master, void *data)
ctx->configs[win].type = decon_win_types[tmp];
 
ret = exynos_plane_init(drm_dev, >planes[win], win,
-   1 << ctx->pipe, >configs[win]);
+   >configs[win]);
if (ret)
return ret;
}
diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c 
b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
index 206e779..4320b3b 100644
--- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
@@ -642,7 +642,7 @@ static int decon_bind(struct device *dev, struct device 
*master, void *data)
ctx->configs[i].type = decon_win_types[i];
 
ret = exynos_plane_init(drm_dev, >planes[i], i,
-   1 << ctx->pipe, >configs[i]);
+   >configs[i]);
if (ret)
return ret;
}
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 588723d..ef27757 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -1009,7 +1009,7 @@ static int fimd_bind(struct device *dev, struct device 
*master, void *data)
ctx->configs[i].zpos = i;
ctx->configs[i].type = fimd_win_types[i];
ret = exynos_plane_init(drm_dev, >planes[i], i,
-   1 << ctx->pipe, >configs[i]);
+   >configs[i]);
if (ret)
return ret;
}
diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c 
b/drivers/gpu/drm/exynos/exynos_drm_plane.c
index c2f17f3..611b6fd 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_plane.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c
@@ -273,14 +273,13 @@ static void exynos_plane_attach_zpos_property(struct 
drm_plane *plane,
 }
 
 int exynos_plane_init(struct drm_device *dev,
- struct exynos_drm_plane *exynos_plane,
- unsigned int index, unsigned long possible_crtcs,
+ struct exynos_drm_plane *exynos_plane, unsigned int index,
  const struct exynos_drm_plane_config *config)
 {
int err;
 
err = drm_universal_plane_init(dev, _plane->base,
-  possible_crtcs,
+  1 << dev->mode_config.num_crtc,
   _plane_funcs,
   config->pixel_formats,
   config->num_pixel_formats,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.h 
b/drivers/gpu/drm/exynos/exynos_drm_plane.h
index 9aafad1..497047b 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_plane.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_plane.h
@@ -11,5 +11,4 @@
 
 int exynos_plane_init(struct drm_device *dev,
  struct exynos_drm_plane *exynos_plane, unsigned int index,
- unsigned long possible_crtcs,
  const struct exynos_drm_plane_config *config);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c 
b/drivers/gpu/drm/exynos/exynos_drm_vidi.c
index cb5e3c6..8860ff4 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c
@@ -408,7 +408,7 @@ static int vidi_bind(struct device *dev, struct device 
*master, void *data)
plane_config.type = vidi_win_types[i];
 
ret = exynos_plane_init(drm_dev, >planes[i], i,
-   1 << ctx->pipe, _config);
+   _config);
if (ret)
return ret;
}
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c 
b/drivers/gpu/drm/exynos/exynos_mixer.c
index 1474982..3722b5f 100644
--- a/drivers/gpu/drm/exynos/exynos_mixer.c
+++ 

Re: [Intel-gfx] [PATCH 04/24] drm: Extract drm_pci.h

2017-03-08 Thread Gustavo Padovan
2017-03-08 Daniel Vetter :

> Just another step in finally making drmP.h obsolete.
> 
> Signed-off-by: Daniel Vetter 
> ---
>  drivers/gpu/drm/drm_pci.c |  7 +
>  include/drm/drmP.h| 43 +++---
>  include/drm/drm_pci.h | 78 
> +++
>  3 files changed, 89 insertions(+), 39 deletions(-)
>  create mode 100644 include/drm/drm_pci.h

Reviewed-by: Gustavo Padovan 

Gustavo
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2 03/12] drm/exynos/decon5433: fix vblank event handling

2017-03-08 Thread Andrzej Hajda
Current implementation of event handling assumes that vblank interrupt is
always called at the right time. It is not true, it can be delayed due to
various reasons. As a result different races can happen. The patch fixes
the issue by using hardware frame counter present in DECON to serialize
vblank and commit completion events.

Signed-off-by: Andrzej Hajda 
---
v2:
  - added internal decon_get_frame_count function,
  - updated frame counter on flush,
  - misc style fixes (thank Inki)
---
 drivers/gpu/drm/exynos/exynos5433_drm_decon.c | 77 ++-
 include/video/exynos5433_decon.h  |  8 +++
 2 files changed, 84 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c 
b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
index 147911e..4ca3d6e 100644
--- a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
@@ -68,6 +68,8 @@ struct decon_context {
unsigned long   flags;
unsigned long   out_type;
int first_win;
+   spinlock_t  vblank_lock;
+   u32 frame_id;
 };
 
 static const uint32_t decon_formats[] = {
@@ -122,6 +124,48 @@ static void decon_disable_vblank(struct exynos_drm_crtc 
*crtc)
writel(0, ctx->addr + DECON_VIDINTCON0);
 }
 
+/* return number of starts/ends of frame transmissions since reset */
+static u32 decon_get_frame_count(struct decon_context *ctx, bool end)
+{
+   u32 frm, pfrm, status, cnt = 2;
+
+   /* To get consistent result repeat read until frame id is stable.
+* Usually the loop will be executed once, in rare cases when the loop
+* is executed at frame change time 2nd pass will be needed.
+*/
+   frm = readl(ctx->addr + DECON_CRFMID);
+   do {
+   status = readl(ctx->addr + DECON_VIDCON1);
+   pfrm = frm;
+   frm = readl(ctx->addr + DECON_CRFMID);
+   } while (frm != pfrm && --cnt);
+
+   /* CRFMID is incremented on BPORCH in case of I80 and on VSYNC in case
+* of RGB, it should be taken into account.
+*/
+   if (!frm)
+   return 0;
+
+   switch (status & (VIDCON1_VSTATUS_MASK | VIDCON1_I80_ACTIVE)) {
+   case VIDCON1_VSTATUS_VS:
+   if (!(ctx->out_type & IFTYPE_I80))
+   --frm;
+   break;
+   case VIDCON1_VSTATUS_BP:
+   --frm;
+   break;
+   case VIDCON1_I80_ACTIVE:
+   case VIDCON1_VSTATUS_AC:
+   if (end)
+   --frm;
+   break;
+   default:
+   break;
+   }
+
+   return frm;
+}
+
 static void decon_setup_trigger(struct decon_context *ctx)
 {
if (!(ctx->out_type & (IFTYPE_I80 | I80_HW_TRG)))
@@ -365,11 +409,14 @@ static void decon_disable_plane(struct exynos_drm_crtc 
*crtc,
 static void decon_atomic_flush(struct exynos_drm_crtc *crtc)
 {
struct decon_context *ctx = crtc->ctx;
+   unsigned long flags;
int i;
 
if (test_bit(BIT_SUSPENDED, >flags))
return;
 
+   spin_lock_irqsave(>vblank_lock, flags);
+
for (i = ctx->first_win; i < WINDOWS_NR; i++)
decon_shadow_protect_win(ctx, i, false);
 
@@ -378,12 +425,18 @@ static void decon_atomic_flush(struct exynos_drm_crtc 
*crtc)
 
if (ctx->out_type & IFTYPE_I80)
set_bit(BIT_WIN_UPDATED, >flags);
+
+   ctx->frame_id = decon_get_frame_count(ctx, true);
+
exynos_crtc_handle_event(crtc);
+
+   spin_unlock_irqrestore(>vblank_lock, flags);
 }
 
 static void decon_swreset(struct decon_context *ctx)
 {
unsigned int tries;
+   unsigned long flags;
 
writel(0, ctx->addr + DECON_VIDCON0);
for (tries = 2000; tries; --tries) {
@@ -401,6 +454,10 @@ static void decon_swreset(struct decon_context *ctx)
 
WARN(tries == 0, "failed to software reset DECON\n");
 
+   spin_lock_irqsave(>vblank_lock, flags);
+   ctx->frame_id = 0;
+   spin_unlock_irqrestore(>vblank_lock, flags);
+
if (!(ctx->out_type & IFTYPE_HDMI))
return;
 
@@ -579,6 +636,23 @@ static const struct component_ops decon_component_ops = {
.unbind = decon_unbind,
 };
 
+static void decon_handle_vblank(struct decon_context *ctx)
+{
+   u32 frm;
+
+   spin_lock(>vblank_lock);
+
+   frm = decon_get_frame_count(ctx, true);
+
+   if (frm != ctx->frame_id) {
+   if (frm > ctx->frame_id)
+   drm_crtc_handle_vblank(>crtc->base);
+   ctx->frame_id = frm;
+   }
+
+   spin_unlock(>vblank_lock);
+}
+
 static irqreturn_t decon_irq_handler(int irq, void *dev_id)
 {
struct decon_context *ctx = dev_id;
@@ -599,7 +673,7 @@ static irqreturn_t decon_irq_handler(int irq, void *dev_id)

[PATCH v2 11/12] drm/exynos: kill pipe field from drivers contexts

2017-03-08 Thread Andrzej Hajda
Since possible_crtcs are set by Exynos core helper pipe fields have no
raison d'etre. The only place it was used, as a hack, is
fimd_clear_channels, to avoid calling drm_crtc_handle_vblank, but DRM core
has already other protection mechanism (vblank->enabled), so it could be
safely removed.

Signed-off-by: Andrzej Hajda 
---
 drivers/gpu/drm/exynos/exynos5433_drm_decon.c |  2 --
 drivers/gpu/drm/exynos/exynos7_drm_decon.c|  4 +---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c  | 11 ++-
 drivers/gpu/drm/exynos/exynos_drm_vidi.c  | 15 +--
 drivers/gpu/drm/exynos/exynos_mixer.c |  2 --
 5 files changed, 4 insertions(+), 30 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c 
b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
index a60d461..999d952 100644
--- a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
@@ -64,7 +64,6 @@ struct decon_context {
void __iomem*addr;
struct regmap   *sysreg;
struct clk  *clks[ARRAY_SIZE(decon_clks_name)];
-   int pipe;
unsigned long   flags;
unsigned long   out_type;
int first_win;
@@ -592,7 +591,6 @@ static int decon_bind(struct device *dev, struct device 
*master, void *data)
int ret;
 
ctx->drm_dev = drm_dev;
-   ctx->pipe = drm_dev->mode_config.num_crtc;
drm_dev->max_vblank_count = 0x;
 
for (win = ctx->first_win; win < WINDOWS_NR; win++) {
diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c 
b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
index 4320b3b..1ffb0b1 100644
--- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
@@ -55,7 +55,6 @@ struct decon_context {
unsigned long   irq_flags;
booli80_if;
boolsuspended;
-   int pipe;
wait_queue_head_t   wait_vsync_queue;
atomic_twait_vsync_event;
 
@@ -131,7 +130,6 @@ static int decon_ctx_initialize(struct decon_context *ctx,
struct drm_device *drm_dev)
 {
ctx->drm_dev = drm_dev;
-   ctx->pipe = drm_dev->mode_config.num_crtc;
 
decon_clear_channels(ctx->crtc);
 
@@ -605,7 +603,7 @@ static irqreturn_t decon_irq_handler(int irq, void *dev_id)
writel(clear_bit, ctx->regs + VIDINTCON1);
 
/* check the crtc is detached already from encoder */
-   if (ctx->pipe < 0 || !ctx->drm_dev)
+   if (!ctx->drm_dev)
goto out;
 
if (!ctx->i80_if) {
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index ef27757..0b74e57 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -191,7 +191,6 @@ struct fimd_context {
u32 i80ifcon;
booli80_if;
boolsuspended;
-   int pipe;
wait_queue_head_t   wait_vsync_queue;
atomic_twait_vsync_event;
atomic_twin_updated;
@@ -368,18 +367,13 @@ static void fimd_clear_channels(struct exynos_drm_crtc 
*crtc)
 
/* Wait for vsync, as disable channel takes effect at next vsync */
if (ch_enabled) {
-   int pipe = ctx->pipe;
-
-   /* ensure that vblank interrupt won't be reported to core */
ctx->suspended = false;
-   ctx->pipe = -1;
 
fimd_enable_vblank(ctx->crtc);
fimd_wait_for_vblank(ctx->crtc);
fimd_disable_vblank(ctx->crtc);
 
ctx->suspended = true;
-   ctx->pipe = pipe;
}
 
clk_disable_unprepare(ctx->lcd_clk);
@@ -913,7 +907,7 @@ static void fimd_te_handler(struct exynos_drm_crtc *crtc)
u32 trg_type = ctx->driver_data->trg_type;
 
/* Checks the crtc is detached already from encoder */
-   if (ctx->pipe < 0 || !ctx->drm_dev)
+   if (!ctx->drm_dev)
return;
 
if (trg_type == I80_HW_TRG)
@@ -971,7 +965,7 @@ static irqreturn_t fimd_irq_handler(int irq, void *dev_id)
writel(clear_bit, ctx->regs + VIDINTCON1);
 
/* check the crtc is detached already from encoder */
-   if (ctx->pipe < 0 || !ctx->drm_dev)
+   if (!ctx->drm_dev)
goto out;
 
if (!ctx->i80_if)
@@ -1001,7 +995,6 @@ static int fimd_bind(struct device *dev, struct device 
*master, void *data)
int ret;
 
ctx->drm_dev = drm_dev;
-   ctx->pipe = drm_dev->mode_config.num_crtc;
 
for (i = 0; i 

[PATCH v2 09/12] drm/exynos: kill exynos_drm_private::pipe

2017-03-08 Thread Andrzej Hajda
The field duplicates drm_dev->mode_config.num_crtc.

Signed-off-by: Andrzej Hajda 
---
 drivers/gpu/drm/exynos/exynos5433_drm_decon.c | 18 --
 drivers/gpu/drm/exynos/exynos7_drm_decon.c| 11 ++-
 drivers/gpu/drm/exynos/exynos_drm_drv.h   |  3 ---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c  |  9 ++---
 drivers/gpu/drm/exynos/exynos_drm_vidi.c  |  4 +---
 drivers/gpu/drm/exynos/exynos_mixer.c |  8 ++--
 6 files changed, 11 insertions(+), 42 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c 
b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
index 2eb6997..d922b10 100644
--- a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
@@ -586,14 +586,13 @@ static int decon_bind(struct device *dev, struct device 
*master, void *data)
 {
struct decon_context *ctx = dev_get_drvdata(dev);
struct drm_device *drm_dev = data;
-   struct exynos_drm_private *priv = drm_dev->dev_private;
struct exynos_drm_plane *exynos_plane;
enum exynos_drm_output_type out_type;
unsigned int win;
int ret;
 
ctx->drm_dev = drm_dev;
-   ctx->pipe = priv->pipe++;
+   ctx->pipe = drm_dev->mode_config.num_crtc;
drm_dev->max_vblank_count = 0x;
 
for (win = ctx->first_win; win < WINDOWS_NR; win++) {
@@ -615,21 +614,12 @@ static int decon_bind(struct device *dev, struct device 
*master, void *data)
  : EXYNOS_DISPLAY_TYPE_LCD;
ctx->crtc = exynos_drm_crtc_create(drm_dev, _plane->base,
out_type, _crtc_ops, ctx);
-   if (IS_ERR(ctx->crtc)) {
-   ret = PTR_ERR(ctx->crtc);
-   goto err;
-   }
+   if (IS_ERR(ctx->crtc))
+   return PTR_ERR(ctx->crtc);
 
decon_clear_channels(ctx->crtc);
 
-   ret = drm_iommu_attach_device(drm_dev, dev);
-   if (ret)
-   goto err;
-
-   return ret;
-err:
-   priv->pipe--;
-   return ret;
+   return drm_iommu_attach_device(drm_dev, dev);
 }
 
 static void decon_unbind(struct device *dev, struct device *master, void *data)
diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c 
b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
index 0ccb334..206e779 100644
--- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
@@ -130,19 +130,12 @@ static void decon_clear_channels(struct exynos_drm_crtc 
*crtc)
 static int decon_ctx_initialize(struct decon_context *ctx,
struct drm_device *drm_dev)
 {
-   struct exynos_drm_private *priv = drm_dev->dev_private;
-   int ret;
-
ctx->drm_dev = drm_dev;
-   ctx->pipe = priv->pipe++;
+   ctx->pipe = drm_dev->mode_config.num_crtc;
 
decon_clear_channels(ctx->crtc);
 
-   ret = drm_iommu_attach_device(drm_dev, ctx->dev);
-   if (ret)
-   priv->pipe--;
-
-   return ret;
+   return drm_iommu_attach_device(drm_dev, ctx->dev);
 }
 
 static void decon_ctx_remove(struct decon_context *ctx)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h 
b/drivers/gpu/drm/exynos/exynos_drm_drv.h
index 7e54be1..7ef2b36 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
@@ -196,7 +196,6 @@ struct drm_exynos_file_private {
  * otherwise default one.
  * @da_space_size: size of device address space.
  * if 0 then default value is used for it.
- * @pipe: the pipe number for this crtc/manager.
  * @pending: the crtcs that have pending updates to finish
  * @lock: protect access to @pending
  * @wait: wait an atomic commit to finish
@@ -207,8 +206,6 @@ struct exynos_drm_private {
struct device *dma_dev;
void *mapping;
 
-   unsigned int pipe;
-
/* for atomic commit */
u32 pending;
spinlock_t  lock;
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index caaccd8..588723d 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -996,13 +996,12 @@ static int fimd_bind(struct device *dev, struct device 
*master, void *data)
 {
struct fimd_context *ctx = dev_get_drvdata(dev);
struct drm_device *drm_dev = data;
-   struct exynos_drm_private *priv = drm_dev->dev_private;
struct exynos_drm_plane *exynos_plane;
unsigned int i;
int ret;
 
ctx->drm_dev = drm_dev;
-   ctx->pipe = priv->pipe++;
+   ctx->pipe = drm_dev->mode_config.num_crtc;
 
for (i = 0; i < WINDOWS_NR; i++) {
ctx->configs[i].pixel_formats = fimd_formats;
@@ -1032,11 +1031,7 @@ static int fimd_bind(struct device *dev, struct device 
*master, void *data)
if (is_drm_iommu_supported(drm_dev))
fimd_clear_channels(ctx->crtc);
 
-  

[PATCH v2 07/12] drm/exynos/decon5433: fix software trigger mask

2017-03-08 Thread Andrzej Hajda
The patch fixes copy/paste bug introduced during code refactoring.

Reported-by: Dan Carpenter 
Fixes: b93c2e8b5d9d ("drm/exynos/decon5433: configure sysreg in case of 
hardware trigger")Fixes:
Signed-off-by: Andrzej Hajda 
---
 drivers/gpu/drm/exynos/exynos5433_drm_decon.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c 
b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
index 319f557..ee8d5cb 100644
--- a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
@@ -182,8 +182,8 @@ static void decon_setup_trigger(struct decon_context *ctx)
return;
 
if (!(ctx->out_type & I80_HW_TRG)) {
-   writel(TRIGCON_TE_AUTO_MASK | TRIGCON_SWTRIGEN
-  | TRIGCON_TE_AUTO_MASK | TRIGCON_SWTRIGEN,
+   writel(TRIGCON_TRIGEN_PER_F | TRIGCON_TRIGEN_F |
+  TRIGCON_TE_AUTO_MASK | TRIGCON_SWTRIGEN,
   ctx->addr + DECON_TRIGCON);
return;
}
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2 12/12] drm/exynos: kill mode_set_nofb callback

2017-03-08 Thread Andrzej Hajda
All Exynos CRTCs are fully configured by .enable callback. The only users
of mode_set_nofb actually did nothing in their callbacks - they immediately
returned because devices were in suspend state - mode_set_nofb is always
called on disabled device.

Signed-off-by: Andrzej Hajda 
---
 drivers/gpu/drm/exynos/exynos7_drm_decon.c |  1 -
 drivers/gpu/drm/exynos/exynos_drm_crtc.c   | 10 --
 drivers/gpu/drm/exynos/exynos_drm_drv.h|  2 --
 drivers/gpu/drm/exynos/exynos_drm_fimd.c   |  1 -
 4 files changed, 14 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c 
b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
index 1ffb0b1..3e88269 100644
--- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
@@ -581,7 +581,6 @@ static void decon_disable(struct exynos_drm_crtc *crtc)
 static const struct exynos_drm_crtc_ops decon_crtc_ops = {
.enable = decon_enable,
.disable = decon_disable,
-   .commit = decon_commit,
.enable_vblank = decon_enable_vblank,
.disable_vblank = decon_disable_vblank,
.atomic_begin = decon_atomic_begin,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index 2d0aa11..d72777f 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -49,15 +49,6 @@ static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
}
 }
 
-static void
-exynos_drm_crtc_mode_set_nofb(struct drm_crtc *crtc)
-{
-   struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
-
-   if (exynos_crtc->ops->commit)
-   exynos_crtc->ops->commit(exynos_crtc);
-}
-
 static int exynos_crtc_atomic_check(struct drm_crtc *crtc,
 struct drm_crtc_state *state)
 {
@@ -93,7 +84,6 @@ static void exynos_crtc_atomic_flush(struct drm_crtc *crtc,
 static const struct drm_crtc_helper_funcs exynos_crtc_helper_funcs = {
.enable = exynos_drm_crtc_enable,
.disable= exynos_drm_crtc_disable,
-   .mode_set_nofb  = exynos_drm_crtc_mode_set_nofb,
.atomic_check   = exynos_crtc_atomic_check,
.atomic_begin   = exynos_crtc_atomic_begin,
.atomic_flush   = exynos_crtc_atomic_flush,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h 
b/drivers/gpu/drm/exynos/exynos_drm_drv.h
index 7ef2b36..527bf1d 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
@@ -115,7 +115,6 @@ struct exynos_drm_plane_config {
  *
  * @enable: enable the device
  * @disable: disable the device
- * @commit: set current hw specific display mode to hw.
  * @enable_vblank: specific driver callback for enabling vblank interrupt.
  * @disable_vblank: specific driver callback for disabling vblank interrupt.
  * @atomic_check: validate state
@@ -130,7 +129,6 @@ struct exynos_drm_crtc;
 struct exynos_drm_crtc_ops {
void (*enable)(struct exynos_drm_crtc *crtc);
void (*disable)(struct exynos_drm_crtc *crtc);
-   void (*commit)(struct exynos_drm_crtc *crtc);
int (*enable_vblank)(struct exynos_drm_crtc *crtc);
void (*disable_vblank)(struct exynos_drm_crtc *crtc);
u32 (*get_vblank_counter)(struct exynos_drm_crtc *crtc);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 0b74e57..bf5135c 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -942,7 +942,6 @@ static void fimd_dp_clock_enable(struct exynos_drm_clk 
*clk, bool enable)
 static const struct exynos_drm_crtc_ops fimd_crtc_ops = {
.enable = fimd_enable,
.disable = fimd_disable,
-   .commit = fimd_commit,
.enable_vblank = fimd_enable_vblank,
.disable_vblank = fimd_disable_vblank,
.atomic_begin = fimd_atomic_begin,
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2 08/12] drm/exynos: kill exynos_drm_crtc::pipe

2017-03-08 Thread Andrzej Hajda
Since crtc index is stored in drm_crtc pipe field became redundant.
The patch beside removing the field simplifies also
exynos_drm_crtc_get_pipe_from_type.

Signed-off-by: Andrzej Hajda 
---
 drivers/gpu/drm/exynos/exynos5433_drm_decon.c |  3 +--
 drivers/gpu/drm/exynos/exynos7_drm_decon.c|  3 +--
 drivers/gpu/drm/exynos/exynos_drm_crtc.c  | 12 +++-
 drivers/gpu/drm/exynos/exynos_drm_crtc.h  |  1 -
 drivers/gpu/drm/exynos/exynos_drm_drv.h   |  8 
 drivers/gpu/drm/exynos/exynos_drm_fimd.c  |  3 +--
 drivers/gpu/drm/exynos/exynos_drm_vidi.c  |  3 +--
 drivers/gpu/drm/exynos/exynos_mixer.c |  3 +--
 8 files changed, 8 insertions(+), 28 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c 
b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
index ee8d5cb..2eb6997 100644
--- a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
@@ -614,8 +614,7 @@ static int decon_bind(struct device *dev, struct device 
*master, void *data)
out_type = (ctx->out_type & IFTYPE_HDMI) ? EXYNOS_DISPLAY_TYPE_HDMI
  : EXYNOS_DISPLAY_TYPE_LCD;
ctx->crtc = exynos_drm_crtc_create(drm_dev, _plane->base,
-   ctx->pipe, out_type,
-   _crtc_ops, ctx);
+   out_type, _crtc_ops, ctx);
if (IS_ERR(ctx->crtc)) {
ret = PTR_ERR(ctx->crtc);
goto err;
diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c 
b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
index 4881180..0ccb334 100644
--- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
@@ -656,8 +656,7 @@ static int decon_bind(struct device *dev, struct device 
*master, void *data)
 
exynos_plane = >planes[DEFAULT_WIN];
ctx->crtc = exynos_drm_crtc_create(drm_dev, _plane->base,
-  ctx->pipe, EXYNOS_DISPLAY_TYPE_LCD,
-  _crtc_ops, ctx);
+   EXYNOS_DISPLAY_TYPE_LCD, _crtc_ops, ctx);
if (IS_ERR(ctx->crtc)) {
decon_ctx_remove(ctx);
return PTR_ERR(ctx->crtc);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index c02378b..2d0aa11 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -166,7 +166,6 @@ static const struct drm_crtc_funcs exynos_crtc_funcs = {
 
 struct exynos_drm_crtc *exynos_drm_crtc_create(struct drm_device *drm_dev,
struct drm_plane *plane,
-   int pipe,
enum exynos_drm_output_type type,
const struct exynos_drm_crtc_ops *ops,
void *ctx)
@@ -179,7 +178,6 @@ struct exynos_drm_crtc *exynos_drm_crtc_create(struct 
drm_device *drm_dev,
if (!exynos_crtc)
return ERR_PTR(-ENOMEM);
 
-   exynos_crtc->pipe = pipe;
exynos_crtc->type = type;
exynos_crtc->ops = ops;
exynos_crtc->ctx = ctx;
@@ -206,13 +204,9 @@ int exynos_drm_crtc_get_pipe_from_type(struct drm_device 
*drm_dev,
 {
struct drm_crtc *crtc;
 
-   list_for_each_entry(crtc, _dev->mode_config.crtc_list, head) {
-   struct exynos_drm_crtc *exynos_crtc;
-
-   exynos_crtc = to_exynos_crtc(crtc);
-   if (exynos_crtc->type == out_type)
-   return exynos_crtc->pipe;
-   }
+   drm_for_each_crtc(crtc, drm_dev)
+   if (to_exynos_crtc(crtc)->type == out_type)
+   return drm_crtc_index(crtc);
 
return -EPERM;
 }
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.h 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.h
index 9634fe5..ef58b64 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.h
@@ -19,7 +19,6 @@
 
 struct exynos_drm_crtc *exynos_drm_crtc_create(struct drm_device *drm_dev,
struct drm_plane *plane,
-   int pipe,
enum exynos_drm_output_type type,
const struct exynos_drm_crtc_ops *ops,
void *context);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h 
b/drivers/gpu/drm/exynos/exynos_drm_drv.h
index 906ab7a..7e54be1 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
@@ -154,13 +154,6 @@ struct exynos_drm_clk {
  *
  * @base: crtc object.
  * @type: one of EXYNOS_DISPLAY_TYPE_LCD and HDMI.
- * @pipe: a crtc index created at load() with a new crtc object creation
- * and the crtc object would be 

[PATCH v2 04/12] drm/exynos/decon5433: implement frame counter

2017-03-08 Thread Andrzej Hajda
DECON in Exynos5433 has frame counter, it can be used to implement
get_vblank_counter callback.

Signed-off-by: Andrzej Hajda 
---
v2:
  - reuse decon_get_frame_count function already implemented
in previous patch
---
 drivers/gpu/drm/exynos/exynos5433_drm_decon.c | 12 
 drivers/gpu/drm/exynos/exynos_drm_crtc.c  | 11 +++
 drivers/gpu/drm/exynos/exynos_drm_drv.h   |  1 +
 3 files changed, 24 insertions(+)

diff --git a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c 
b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
index 4ca3d6e..60ff81b 100644
--- a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
@@ -166,6 +166,16 @@ static u32 decon_get_frame_count(struct decon_context 
*ctx, bool end)
return frm;
 }
 
+static u32 decon_get_vblank_counter(struct exynos_drm_crtc *crtc)
+{
+   struct decon_context *ctx = crtc->ctx;
+
+   if (test_bit(BIT_SUSPENDED, >flags))
+   return 0;
+
+   return decon_get_frame_count(ctx, false);
+}
+
 static void decon_setup_trigger(struct decon_context *ctx)
 {
if (!(ctx->out_type & (IFTYPE_I80 | I80_HW_TRG)))
@@ -564,6 +574,7 @@ static const struct exynos_drm_crtc_ops decon_crtc_ops = {
.disable= decon_disable,
.enable_vblank  = decon_enable_vblank,
.disable_vblank = decon_disable_vblank,
+   .get_vblank_counter = decon_get_vblank_counter,
.atomic_begin   = decon_atomic_begin,
.update_plane   = decon_update_plane,
.disable_plane  = decon_disable_plane,
@@ -583,6 +594,7 @@ static int decon_bind(struct device *dev, struct device 
*master, void *data)
 
ctx->drm_dev = drm_dev;
ctx->pipe = priv->pipe++;
+   drm_dev->max_vblank_count = 0x;
 
for (win = ctx->first_win; win < WINDOWS_NR; win++) {
int tmp = (win == ctx->first_win) ? 0 : win;
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index 9184974..c02378b 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -142,6 +142,16 @@ static void exynos_drm_crtc_disable_vblank(struct drm_crtc 
*crtc)
exynos_crtc->ops->disable_vblank(exynos_crtc);
 }
 
+static u32 exynos_drm_crtc_get_vblank_counter(struct drm_crtc *crtc)
+{
+   struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
+
+   if (exynos_crtc->ops->get_vblank_counter)
+   return exynos_crtc->ops->get_vblank_counter(exynos_crtc);
+
+   return 0;
+}
+
 static const struct drm_crtc_funcs exynos_crtc_funcs = {
.set_config = drm_atomic_helper_set_config,
.page_flip  = drm_atomic_helper_page_flip,
@@ -151,6 +161,7 @@ static const struct drm_crtc_funcs exynos_crtc_funcs = {
.atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
.enable_vblank = exynos_drm_crtc_enable_vblank,
.disable_vblank = exynos_drm_crtc_disable_vblank,
+   .get_vblank_counter = exynos_drm_crtc_get_vblank_counter,
 };
 
 struct exynos_drm_crtc *exynos_drm_crtc_create(struct drm_device *drm_dev,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h 
b/drivers/gpu/drm/exynos/exynos_drm_drv.h
index cb31769..906ab7a 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
@@ -133,6 +133,7 @@ struct exynos_drm_crtc_ops {
void (*commit)(struct exynos_drm_crtc *crtc);
int (*enable_vblank)(struct exynos_drm_crtc *crtc);
void (*disable_vblank)(struct exynos_drm_crtc *crtc);
+   u32 (*get_vblank_counter)(struct exynos_drm_crtc *crtc);
int (*atomic_check)(struct exynos_drm_crtc *crtc,
struct drm_crtc_state *state);
void (*atomic_begin)(struct exynos_drm_crtc *crtc);
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2 00/12] drm/exynos: rework vblank handling

2017-03-08 Thread Andrzej Hajda
Hi Inki,

This patchset fixes long standing issue with occassional page faults
or vblank event timeouts on TM2 targets due to delayed vblank handling.
DECON driver should now handle properly all scenarios described in drm
docs [1][2], at least it was my intention.

The patchset also:
- adds frame counter callback,
- fixes VBLANK interrupt trigger time,
- fixes soft-trigger mask,
- removes redundant pipe related fields.

The patch is based on todays linux-next, the real dependency is on the Shawn 
patchset
'Add vblank hooks to struct drm_crtc_funcs'.

I have successfully tested it on TM2 panel, TV and both.

[1]: 
https://dri.freedesktop.org/docs/drm/gpu/drm-kms.html?highlight=drm_crtc_state#c.drm_crtc_arm_vblank_event
[2]: 
https://dri.freedesktop.org/docs/drm/gpu/drm-kms.html?highlight=drm_crtc_state#c.drm_crtc_state

Regards
Andrzej


Andrzej Hajda (12):
  drm/exynos: move crtc event handling to drivers callbacks
  drm/exynos: simplify completion event handling
  drm/exynos/decon5433: fix vblank event handling
  drm/exynos/decon5433: implement frame counter
  drm/exynos/decon5433: signal frame done interrupt at front porch
  drm/exynos/fimd: signal frame done interrupt at front porch
  drm/exynos/decon5433: fix software trigger mask
  drm/exynos: kill exynos_drm_crtc::pipe
  drm/exynos: kill exynos_drm_private::pipe
  drm/exynos: set plane possible_crtcs in exynos_plane_init
  drm/exynos: kill pipe field from drivers contexts
  drm/exynos: kill mode_set_nofb callback

 drivers/gpu/drm/exynos/exynos5433_drm_decon.c | 119 +-
 drivers/gpu/drm/exynos/exynos7_drm_decon.c|  20 ++---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c  |  65 +++---
 drivers/gpu/drm/exynos/exynos_drm_crtc.h  |   3 +-
 drivers/gpu/drm/exynos/exynos_drm_drv.h   |  14 +--
 drivers/gpu/drm/exynos/exynos_drm_fimd.c  |  28 ++
 drivers/gpu/drm/exynos/exynos_drm_plane.c |   5 +-
 drivers/gpu/drm/exynos/exynos_drm_plane.h |   1 -
 drivers/gpu/drm/exynos/exynos_drm_vidi.c  |  23 +
 drivers/gpu/drm/exynos/exynos_mixer.c |  14 +--
 include/video/exynos5433_decon.h  |  12 +++
 11 files changed, 166 insertions(+), 138 deletions(-)

-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2 02/12] drm/exynos: simplify completion event handling

2017-03-08 Thread Andrzej Hajda
All Exynos CRTC drivers shouldn't fail at referencing vblank events,
alternate path is actually dead code.

Signed-off-by: Andrzej Hajda 
---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c | 17 -
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index 0620d3c..9184974 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -105,16 +105,15 @@ void exynos_crtc_handle_event(struct exynos_drm_crtc 
*exynos_crtc)
struct drm_pending_vblank_event *event = crtc->state->event;
unsigned long flags;
 
-   if (event) {
-   crtc->state->event = NULL;
-   spin_lock_irqsave(>dev->event_lock, flags);
-   if (drm_crtc_vblank_get(crtc) == 0)
-   drm_crtc_arm_vblank_event(crtc, event);
-   else
-   drm_crtc_send_vblank_event(crtc, event);
-   spin_unlock_irqrestore(>dev->event_lock, flags);
-   }
+   if (!event)
+   return;
+   crtc->state->event = NULL;
+
+   WARN_ON(drm_crtc_vblank_get(crtc) != 0);
 
+   spin_lock_irqsave(>dev->event_lock, flags);
+   drm_crtc_arm_vblank_event(crtc, event);
+   spin_unlock_irqrestore(>dev->event_lock, flags);
 }
 
 static void exynos_drm_crtc_destroy(struct drm_crtc *crtc)
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2 05/12] drm/exynos/decon5433: signal frame done interrupt at front porch

2017-03-08 Thread Andrzej Hajda
DECON in case of video mode generates interrupt by default at start
of vertical back porch. As this interrupt is used to generate VBLANK
events more optimal point is start of vertical front porch.

Signed-off-by: Andrzej Hajda 
---
 drivers/gpu/drm/exynos/exynos5433_drm_decon.c | 2 +-
 include/video/exynos5433_decon.h  | 4 
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c 
b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
index 60ff81b..319f557 100644
--- a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
@@ -105,7 +105,7 @@ static int decon_enable_vblank(struct exynos_drm_crtc *crtc)
if (ctx->out_type & IFTYPE_I80)
val |= VIDINTCON0_FRAMEDONE;
else
-   val |= VIDINTCON0_INTFRMEN;
+   val |= VIDINTCON0_INTFRMEN | VIDINTCON0_FRAMESEL_FP;
 
writel(val, ctx->addr + DECON_VIDINTCON0);
}
diff --git a/include/video/exynos5433_decon.h b/include/video/exynos5433_decon.h
index 352fc0d..6b083d3 100644
--- a/include/video/exynos5433_decon.h
+++ b/include/video/exynos5433_decon.h
@@ -127,6 +127,10 @@
 
 /* VIDINTCON0 */
 #define VIDINTCON0_FRAMEDONE   (1 << 17)
+#define VIDINTCON0_FRAMESEL_BP (0 << 15)
+#define VIDINTCON0_FRAMESEL_VS (1 << 15)
+#define VIDINTCON0_FRAMESEL_AC (2 << 15)
+#define VIDINTCON0_FRAMESEL_FP (3 << 15)
 #define VIDINTCON0_INTFRMEN(1 << 12)
 #define VIDINTCON0_INTEN   (1 << 0)
 
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2 01/12] drm/exynos: move crtc event handling to drivers callbacks

2017-03-08 Thread Andrzej Hajda
CRTC event is currently send with next vblank, or instantly in case crtc
is being disabled. This approach usually works, but in corner cases it can
result in premature event generation. Only device driver is able to verify
if the event can be sent. This patch is a first step in that direction - it
moves event handling to the drivers.

Signed-off-by: Andrzej Hajda 
---
 drivers/gpu/drm/exynos/exynos5433_drm_decon.c |  1 +
 drivers/gpu/drm/exynos/exynos7_drm_decon.c|  1 +
 drivers/gpu/drm/exynos/exynos_drm_crtc.c  | 29 +++
 drivers/gpu/drm/exynos/exynos_drm_crtc.h  |  2 ++
 drivers/gpu/drm/exynos/exynos_drm_fimd.c  |  2 ++
 drivers/gpu/drm/exynos/exynos_drm_vidi.c  |  1 +
 drivers/gpu/drm/exynos/exynos_mixer.c |  1 +
 7 files changed, 24 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c 
b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
index 0fd6f7a..147911e 100644
--- a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
@@ -378,6 +378,7 @@ static void decon_atomic_flush(struct exynos_drm_crtc *crtc)
 
if (ctx->out_type & IFTYPE_I80)
set_bit(BIT_WIN_UPDATED, >flags);
+   exynos_crtc_handle_event(crtc);
 }
 
 static void decon_swreset(struct decon_context *ctx)
diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c 
b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
index f9ab19e..4881180 100644
--- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
@@ -526,6 +526,7 @@ static void decon_atomic_flush(struct exynos_drm_crtc *crtc)
 
for (i = 0; i < WINDOWS_NR; i++)
decon_shadow_protect_win(ctx, i, false);
+   exynos_crtc_handle_event(crtc);
 }
 
 static void decon_init(struct decon_context *ctx)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index fa32091..0620d3c 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -85,16 +85,28 @@ static void exynos_crtc_atomic_flush(struct drm_crtc *crtc,
 struct drm_crtc_state *old_crtc_state)
 {
struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
-   struct drm_pending_vblank_event *event;
-   unsigned long flags;
 
if (exynos_crtc->ops->atomic_flush)
exynos_crtc->ops->atomic_flush(exynos_crtc);
+}
+
+static const struct drm_crtc_helper_funcs exynos_crtc_helper_funcs = {
+   .enable = exynos_drm_crtc_enable,
+   .disable= exynos_drm_crtc_disable,
+   .mode_set_nofb  = exynos_drm_crtc_mode_set_nofb,
+   .atomic_check   = exynos_crtc_atomic_check,
+   .atomic_begin   = exynos_crtc_atomic_begin,
+   .atomic_flush   = exynos_crtc_atomic_flush,
+};
+
+void exynos_crtc_handle_event(struct exynos_drm_crtc *exynos_crtc)
+{
+   struct drm_crtc *crtc = _crtc->base;
+   struct drm_pending_vblank_event *event = crtc->state->event;
+   unsigned long flags;
 
-   event = crtc->state->event;
if (event) {
crtc->state->event = NULL;
-
spin_lock_irqsave(>dev->event_lock, flags);
if (drm_crtc_vblank_get(crtc) == 0)
drm_crtc_arm_vblank_event(crtc, event);
@@ -105,15 +117,6 @@ static void exynos_crtc_atomic_flush(struct drm_crtc *crtc,
 
 }
 
-static const struct drm_crtc_helper_funcs exynos_crtc_helper_funcs = {
-   .enable = exynos_drm_crtc_enable,
-   .disable= exynos_drm_crtc_disable,
-   .mode_set_nofb  = exynos_drm_crtc_mode_set_nofb,
-   .atomic_check   = exynos_crtc_atomic_check,
-   .atomic_begin   = exynos_crtc_atomic_begin,
-   .atomic_flush   = exynos_crtc_atomic_flush,
-};
-
 static void exynos_drm_crtc_destroy(struct drm_crtc *crtc)
 {
struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.h 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.h
index 4e986ba..9634fe5 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.h
@@ -38,4 +38,6 @@ int exynos_drm_crtc_get_pipe_from_type(struct drm_device 
*drm_dev,
  */
 void exynos_drm_crtc_te_handler(struct drm_crtc *crtc);
 
+void exynos_crtc_handle_event(struct exynos_drm_crtc *exynos_crtc);
+
 #endif
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index a9fa444..69ebed0 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -723,6 +723,8 @@ static void fimd_atomic_flush(struct exynos_drm_crtc *crtc)
 
for (i = 0; i < WINDOWS_NR; i++)
fimd_shadow_protect_win(ctx, i, false);
+
+   exynos_crtc_handle_event(crtc);
 }
 
 static void fimd_update_plane(struct exynos_drm_crtc *crtc,
diff --git 

[PATCH v2 06/12] drm/exynos/fimd: signal frame done interrupt at front porch

2017-03-08 Thread Andrzej Hajda
VBLANK interrupt should be signalled as soon as scanout ends, front porch
is the best moment.

Signed-off-by: Andrzej Hajda 
---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 69ebed0..eb4cd82 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -257,7 +257,7 @@ static int fimd_enable_vblank(struct exynos_drm_crtc *crtc)
val |= VIDINTCON0_INT_FRAME;
 
val &= ~VIDINTCON0_FRAMESEL0_MASK;
-   val |= VIDINTCON0_FRAMESEL0_VSYNC;
+   val |= VIDINTCON0_FRAMESEL0_FRONTPORCH;
val &= ~VIDINTCON0_FRAMESEL1_MASK;
val |= VIDINTCON0_FRAMESEL1_NONE;
}
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 15/24] drm/radeon: Merge pre/postclose hooks

2017-03-08 Thread Christian König
Reviewed-by: Christian König  for this one and 
#19.


Christian.

Am 08.03.2017 um 15:12 schrieb Daniel Vetter:

Again no apparent explanation for the split except hysterical raisins.
Merging them also makes it a bit more obviuos what's going on wrt the
runtime pm refdancing.

Cc: Alex Deucher 
Cc: Christian König 
Cc: amd-...@lists.freedesktop.org
Signed-off-by: Daniel Vetter 
---
  drivers/gpu/drm/radeon/radeon_drv.c |  3 ---
  drivers/gpu/drm/radeon/radeon_kms.c | 42 +
  2 files changed, 14 insertions(+), 31 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_drv.c 
b/drivers/gpu/drm/radeon/radeon_drv.c
index 956c425e639e..312436a8d9e5 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -108,8 +108,6 @@ void radeon_driver_lastclose_kms(struct drm_device *dev);
  int radeon_driver_open_kms(struct drm_device *dev, struct drm_file 
*file_priv);
  void radeon_driver_postclose_kms(struct drm_device *dev,
 struct drm_file *file_priv);
-void radeon_driver_preclose_kms(struct drm_device *dev,
-   struct drm_file *file_priv);
  int radeon_suspend_kms(struct drm_device *dev, bool suspend,
   bool fbcon, bool freeze);
  int radeon_resume_kms(struct drm_device *dev, bool resume, bool fbcon);
@@ -538,7 +536,6 @@ static struct drm_driver kms_driver = {
DRIVER_PRIME | DRIVER_RENDER,
.load = radeon_driver_load_kms,
.open = radeon_driver_open_kms,
-   .preclose = radeon_driver_preclose_kms,
.postclose = radeon_driver_postclose_kms,
.lastclose = radeon_driver_lastclose_kms,
.set_busid = drm_pci_set_busid,
diff --git a/drivers/gpu/drm/radeon/radeon_kms.c 
b/drivers/gpu/drm/radeon/radeon_kms.c
index 56f35c06742c..a32a62e03a44 100644
--- a/drivers/gpu/drm/radeon/radeon_kms.c
+++ b/drivers/gpu/drm/radeon/radeon_kms.c
@@ -691,13 +691,26 @@ int radeon_driver_open_kms(struct drm_device *dev, struct 
drm_file *file_priv)
   * @dev: drm dev pointer
   * @file_priv: drm file
   *
- * On device post close, tear down vm on cayman+ (all asics).
+ * On device close, tear down hyperz and cmask filps on r1xx-r5xx
+ * (all asics).  And tear down vm on cayman+ (all asics).
   */
  void radeon_driver_postclose_kms(struct drm_device *dev,
 struct drm_file *file_priv)
  {
struct radeon_device *rdev = dev->dev_private;
  
+	pm_runtime_get_sync(dev->dev);

+
+   mutex_lock(>gem.mutex);
+   if (rdev->hyperz_filp == file_priv)
+   rdev->hyperz_filp = NULL;
+   if (rdev->cmask_filp == file_priv)
+   rdev->cmask_filp = NULL;
+   mutex_unlock(>gem.mutex);
+
+   radeon_uvd_free_handles(rdev, file_priv);
+   radeon_vce_free_handles(rdev, file_priv);
+
/* new gpu have virtual address space support */
if (rdev->family >= CHIP_CAYMAN && file_priv->driver_priv) {
struct radeon_fpriv *fpriv = file_priv->driver_priv;
@@ -721,33 +734,6 @@ void radeon_driver_postclose_kms(struct drm_device *dev,
pm_runtime_put_autosuspend(dev->dev);
  }
  
-/**

- * radeon_driver_preclose_kms - drm callback for pre close
- *
- * @dev: drm dev pointer
- * @file_priv: drm file
- *
- * On device pre close, tear down hyperz and cmask filps on r1xx-r5xx
- * (all asics).
- */
-void radeon_driver_preclose_kms(struct drm_device *dev,
-   struct drm_file *file_priv)
-{
-   struct radeon_device *rdev = dev->dev_private;
-
-   pm_runtime_get_sync(dev->dev);
-
-   mutex_lock(>gem.mutex);
-   if (rdev->hyperz_filp == file_priv)
-   rdev->hyperz_filp = NULL;
-   if (rdev->cmask_filp == file_priv)
-   rdev->cmask_filp = NULL;
-   mutex_unlock(>gem.mutex);
-
-   radeon_uvd_free_handles(rdev, file_priv);
-   radeon_vce_free_handles(rdev, file_priv);
-}
-
  /*
   * VBlank related functions.
   */



___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [Intel-gfx] [PATCH 03/24] drm: Move drm_lock_data out of drmP.h

2017-03-08 Thread Gustavo Padovan
2017-03-08 Daniel Vetter :

> And remove the semi-kernel-doc stuff, to make sure no one uses this.
> 
> Signed-off-by: Daniel Vetter 
> ---
>  include/drm/drmP.h | 15 ---
>  include/drm/drm_auth.h | 17 +
>  2 files changed, 17 insertions(+), 15 deletions(-)

Reviewed-by: Gustavo Padovan 

Gustavo
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 06/24] drm/doc: document fallback behaviour for atomic events

2017-03-08 Thread Laurent Pinchart
Hi Daniel,

Thank you for the patch.

On Wednesday 08 Mar 2017 15:12:39 Daniel Vetter wrote:
> Worst case if the hw can't support completion signalling in a
> race-free way we want the event to be too late, not too early.
> 
> Text adapted from a proposal from Laurent - the other side of how to
> make hw work correctly where it's possible is imo already sufficiently
> documented.
> 
> v2: Review from Laurent.
> 
> Cc: Laurent Pinchart 
> Signed-off-by: Daniel Vetter 

Reviewed-by: Laurent Pinchart 

> ---
>  include/drm/drm_crtc.h | 6 ++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
> index cba29ffedafd..6ef59da3fd8e 100644
> --- a/include/drm/drm_crtc.h
> +++ b/include/drm/drm_crtc.h
> @@ -204,6 +204,12 @@ struct drm_crtc_state {
>* drm_crtc_arm_vblank_event(). See the documentation of that function
>* for a detailed discussion of the constraints it needs to be used
>* safely.
> +  *
> +  * If the device can't notify of flip completion in a race-free way
> +  * at all, then the event should be armed just after the page flip is
> +  * committed. In the worst case the driver will send the event to
> +  * userspace one frame too late. This doesn't allow for a real atomic
> +  * update, but it should avoid tearing.
>*/
>   struct drm_pending_vblank_event *event;

-- 
Regards,

Laurent Pinchart

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 02/24] drm: Extract drm_prime.h

2017-03-08 Thread Gustavo Padovan
Hi Daniel,

2017-03-08 Daniel Vetter :

> Plus a little bit more documentation.
> 
> v2: Untangle the missing forward decls to make drm_prime|gem.h
> free-standing.
> 
> Signed-off-by: Daniel Vetter 
> ---
>  Documentation/gpu/drm-mm.rst  |  3 ++
>  drivers/gpu/drm/drm_prime.c   |  3 +-
>  include/drm/drmP.h| 32 ++
>  include/drm/drm_gem.h |  4 +++
>  include/drm/drm_prime.h   | 79 
> +++
>  include/drm/drm_vma_manager.h |  1 -
>  6 files changed, 91 insertions(+), 31 deletions(-)
>  create mode 100644 include/drm/drm_prime.h

Reviewed-by: Gustavo Padovan 

Gustavo

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 3/3] drm/etnaviv: submit support for out-fences

2017-03-08 Thread Gustavo Padovan
Hi Philipp,

2017-03-08 Philipp Zabel :

> Based on commit 4cd0945901a6 ("drm/msm: submit support for out-fences").
> We increment the minor driver version so userspace can detect explicit
> fence support.
> 
> Signed-off-by: Philipp Zabel 
> ---
>  drivers/gpu/drm/etnaviv/etnaviv_drv.c|  2 +-
>  drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c | 27 +++
>  include/uapi/drm/etnaviv_drm.h   |  6 --
>  3 files changed, 32 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c 
> b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> index 587e45043542b..00f7e9acf68ad 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> @@ -512,7 +512,7 @@ static struct drm_driver etnaviv_drm_driver = {
>   .desc   = "etnaviv DRM",
>   .date   = "20151214",
>   .major  = 1,
> - .minor  = 0,
> + .minor  = 1,
>  };
>  
>  /*
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c 
> b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
> index 022fcc7d57f48..7d4dc946104b9 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
> @@ -307,6 +307,8 @@ int etnaviv_ioctl_gem_submit(struct drm_device *dev, void 
> *data,
>   struct etnaviv_cmdbuf *cmdbuf;
>   struct etnaviv_gpu *gpu;
>   struct dma_fence *in_fence = NULL;
> + struct sync_file *sync_file = NULL;
> + int out_fence_fd = -1;
>   void *stream;
>   int ret;
>  
> @@ -374,6 +376,14 @@ int etnaviv_ioctl_gem_submit(struct drm_device *dev, 
> void *data,
>   goto err_submit_cmds;
>   }
>  
> + if (args->flags & ETNA_SUBMIT_FENCE_FD_OUT) {
> + out_fence_fd = get_unused_fd_flags(O_CLOEXEC);
> + if (out_fence_fd < 0) {
> + ret = out_fence_fd;
> + goto err_submit_cmds;
> + }
> + }
> +
>   submit = submit_create(dev, gpu, args->nr_bos);
>   if (!submit) {
>   ret = -ENOMEM;
> @@ -437,10 +447,25 @@ int etnaviv_ioctl_gem_submit(struct drm_device *dev, 
> void *data,
>   goto out;
>   }
>  
> + if (args->flags & ETNA_SUBMIT_FENCE_FD_OUT) {
> + sync_file = sync_file_create(submit->fence);
> + if (!sync_file) {
> + dma_fence_put(submit->fence);
> + submit->fence = NULL;
> + ret = -ENOMEM;
> + goto out;
> + }
> + }
> +
>   ret = etnaviv_gpu_submit(gpu, submit, cmdbuf);
>   if (ret == 0)
>   cmdbuf = NULL;
>  
> + if (args->flags & ETNA_SUBMIT_FENCE_FD_OUT) {
> + fd_install(out_fence_fd, sync_file->file);
> + }

Extra braces here.

Otherwise looks good to me.

Reviewed-by: Gustavo Padovan 

Gustavo

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 2/3] drm/etnaviv: move fence allocation out of etnaviv_gpu_submit()

2017-03-08 Thread Gustavo Padovan
Hi Philipp,

2017-03-08 Philipp Zabel :

> The next patch will need the dma_fence to create the sync_file in
> etnaviv_ioctl_gem_submit, in case an out_fence_fd is requested.
> 
> Signed-off-by: Philipp Zabel 
> ---
>  drivers/gpu/drm/etnaviv/etnaviv_gem.h|  3 ++-
>  drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c |  8 +++-
>  drivers/gpu/drm/etnaviv/etnaviv_gpu.c| 21 ++---
>  drivers/gpu/drm/etnaviv/etnaviv_gpu.h|  1 +
>  4 files changed, 16 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem.h 
> b/drivers/gpu/drm/etnaviv/etnaviv_gem.h
> index 120410d67eb5b..c4a091e874269 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_gem.h
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_gem.h
> @@ -20,6 +20,7 @@
>  #include 
>  #include "etnaviv_drv.h"
>  
> +struct dma_fence;

Why not #include  ?

Other than that looks good to me:

Reviewed-by: Gustavo Padovan 

Gustavo
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 1/3] drm/etnaviv: submit support for in-fences

2017-03-08 Thread Gustavo Padovan
Hi Philipp,

2017-03-08 Philipp Zabel :

> Loosely based on commit f0a42bb5423a ("drm/msm: submit support for
> in-fences"). Unfortunately, struct drm_etnaviv_gem_submit doesn't have
> a flags field yet, so we have to extend the structure and trust that
> drm_ioctl will clear the flags for us if an older userspace only submits
> part of the struct.
> 
> Signed-off-by: Philipp Zabel 
> ---
>  drivers/gpu/drm/etnaviv/Kconfig  |  1 +
>  drivers/gpu/drm/etnaviv/etnaviv_gem.h|  1 +
>  drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c | 34 
> +++-
>  drivers/gpu/drm/etnaviv/etnaviv_gpu.c|  5 +++-
>  drivers/gpu/drm/etnaviv/etnaviv_gpu.h|  2 +-
>  include/uapi/drm/etnaviv_drm.h   |  6 +
>  6 files changed, 46 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/etnaviv/Kconfig b/drivers/gpu/drm/etnaviv/Kconfig
> index cc1731c5289c2..71cee4e9fefbb 100644
> --- a/drivers/gpu/drm/etnaviv/Kconfig
> +++ b/drivers/gpu/drm/etnaviv/Kconfig
> @@ -5,6 +5,7 @@ config DRM_ETNAVIV
>   depends on ARCH_MXC || ARCH_DOVE || (ARM && COMPILE_TEST)
>   depends on MMU
>   select SHMEM
> + select SYNC_FILE
>   select TMPFS
>   select IOMMU_API
>   select IOMMU_SUPPORT
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem.h 
> b/drivers/gpu/drm/etnaviv/etnaviv_gem.h
> index e63ff116a3b3d..120410d67eb5b 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_gem.h
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_gem.h
> @@ -107,6 +107,7 @@ struct etnaviv_gem_submit {
>   u32 fence;
>   unsigned int nr_bos;
>   struct etnaviv_gem_submit_bo bos[0];
> + u32 flags;
>  };
>  
>  int etnaviv_gem_wait_bo(struct etnaviv_gpu *gpu, struct drm_gem_object *obj,
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c 
> b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
> index 726090d7a6ace..e67d83eac22dc 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
> @@ -15,6 +15,7 @@
>   */
>  
>  #include 
> +#include 
>  #include "etnaviv_cmdbuf.h"
>  #include "etnaviv_drv.h"
>  #include "etnaviv_gpu.h"
> @@ -169,8 +170,10 @@ static int submit_fence_sync(const struct 
> etnaviv_gem_submit *submit)
>   for (i = 0; i < submit->nr_bos; i++) {
>   struct etnaviv_gem_object *etnaviv_obj = submit->bos[i].obj;
>   bool write = submit->bos[i].flags & ETNA_SUBMIT_BO_WRITE;
> + bool explicit = !(submit->flags & ETNA_SUBMIT_NO_IMPLICIT);
>  
> - ret = etnaviv_gpu_fence_sync_obj(etnaviv_obj, context, write);
> + ret = etnaviv_gpu_fence_sync_obj(etnaviv_obj, context, write,
> +  explicit);
>   if (ret)
>   break;
>   }
> @@ -303,6 +306,7 @@ int etnaviv_ioctl_gem_submit(struct drm_device *dev, void 
> *data,
>   struct etnaviv_gem_submit *submit;
>   struct etnaviv_cmdbuf *cmdbuf;
>   struct etnaviv_gpu *gpu;
> + struct dma_fence *in_fence = NULL;
>   void *stream;
>   int ret;
>  
> @@ -326,6 +330,11 @@ int etnaviv_ioctl_gem_submit(struct drm_device *dev, 
> void *data,
>   return -EINVAL;
>   }
>  
> + if (args->flags & ~ETNA_SUBMIT_FLAGS) {
> + DRM_ERROR("invalid flags: 0x%x\n", args->flags);
> + return -EINVAL;
> + }
> +
>   /*
>* Copy the command submission and bo array to kernel space in
>* one go, and do this outside of any locks.
> @@ -371,6 +380,8 @@ int etnaviv_ioctl_gem_submit(struct drm_device *dev, void 
> *data,
>   goto err_submit_cmds;
>   }
>  
> + submit->flags = args->flags;
> +
>   ret = submit_lookup_objects(submit, file, bos, args->nr_bos);
>   if (ret)
>   goto err_submit_objects;
> @@ -385,6 +396,25 @@ int etnaviv_ioctl_gem_submit(struct drm_device *dev, 
> void *data,
>   goto err_submit_objects;
>   }
>  
> + if (args->flags & ETNA_SUBMIT_FENCE_FD_IN) {
> + in_fence = sync_file_get_fence(args->fence_fd);
> + if (!in_fence) {
> + ret = -EINVAL;
> + goto err_submit_objects;
> + }
> +
> + /* TODO if we get an array-fence due to userspace merging
> +  * multiple fences, we need a way to determine if all the
> +  * backing fences are from our own context..
> +  */

All GPU drivers seem to have the same need on fence_array, so I think we
can create a fence array helper to inspect if it has a specific context
or not.

> +
> + if (in_fence->context != gpu->fence_context) {
> + ret = dma_fence_wait(in_fence, true);
> + if (ret)
> + goto err_submit_objects;

sync_file_get_fence() hold a fence ref, we need to release it here
always and not only in case 

Re: [PATCH 4/5] drm/amd/display: Add HDMI Stereo 3D (DC) support

2017-03-08 Thread Jeffrey Smith
I have easy access to an LG 3D television, though I do not have model
information handy at the moment.  This is the only display I have tested on
so far.

I have tested all three modes, and in each case the signal is recognized as
3D (the TV pops up a message to this effect), and the content is displayed
as intended.

BTW, regarding timing_3d_format I am not entirely clear on the difference
between hardware and software varieties (e.g. _HW_FRAME_PACKING vs.
_SW_FRAME_PACKING) but my inclination was that the software variety is what
I was working with.

On Wed, Mar 1, 2017 at 5:13 PM, Harry Wentland 
wrote:

> On 2017-02-24 07:14 PM, Jeff Smith wrote:
>
>> Signed-off-by: Jeff Smith 
>> ---
>>  .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c| 32
>> --
>>  .../display/dc/dce110/dce110_timing_generator.c|  4 ---
>>  2 files changed, 23 insertions(+), 13 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c
>> b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c
>> index 3912dc8..eda813e 100644
>> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c
>> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c
>> @@ -649,8 +649,7 @@ static void update_stream_scaling_settings(
>> return;
>>
>> /* Full screen scaling by default */
>> -   src.width = mode->hdisplay;
>> -   src.height = mode->vdisplay;
>> +   drm_crtc_get_hv_timing(mode, , );
>> dst.width = stream->timing.h_addressable;
>> dst.height = stream->timing.v_addressable;
>>
>> @@ -853,7 +852,22 @@ static void fill_stream_properties_from_dr
>> m_display_mode(
>> else
>> timing_out->pixel_encoding = PIXEL_ENCODING_RGB;
>>
>> -   timing_out->timing_3d_format = TIMING_3D_FORMAT_NONE;
>> +   switch (mode_in->flags & DRM_MODE_FLAG_3D_MASK) {
>> +   case DRM_MODE_FLAG_3D_FRAME_PACKING:
>> +   timing_out->timing_3d_format =
>> TIMING_3D_FORMAT_SW_FRAME_PACKING;
>> +   break;
>> +   case DRM_MODE_FLAG_3D_TOP_AND_BOTTOM:
>> +   timing_out->timing_3d_format =
>> TIMING_3D_FORMAT_TB_SW_PACKED;
>> +   break;
>> +   case DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF:
>> +   timing_out->timing_3d_format =
>> TIMING_3D_FORMAT_SBS_SW_PACKED;
>> +   break;
>> +   case DRM_MODE_FLAG_3D_NONE:
>> +   default:
>> +   timing_out->timing_3d_format = TIMING_3D_FORMAT_NONE;
>> +   break;
>> +   }
>> +
>>
>
> Are these tested and if so on which displays? Even though we have some of
> this code in place we haven't tested any of it and don't necessarily expect
> it to work.
>
> Harry
>
>
> timing_out->display_color_depth = convert_color_depth_from_displ
>> ay_info(
>> connector);
>> timing_out->scan_type = SCANNING_TYPE_NODATA;
>> @@ -1028,6 +1042,7 @@ static struct dc_stream *create_stream_for_sink(
>> dm_state->scaling != RMX_OFF);
>> }
>>
>> +   drm_mode_set_crtcinfo(, CRTC_STEREO_DOUBLE_ONLY);
>> fill_stream_properties_from_drm_display_mode(stream,
>> , >base);
>> update_stream_scaling_settings(, dm_state, stream);
>> @@ -1558,13 +1573,12 @@ int amdgpu_dm_connector_mode_valid(
>> goto stream_create_fail;
>> }
>>
>> -   drm_mode_set_crtcinfo(mode, 0);
>> +   drm_mode_set_crtcinfo(mode, CRTC_STEREO_DOUBLE);
>> fill_stream_properties_from_drm_display_mode(stream, mode,
>> connector);
>>
>> val_set.stream = stream;
>> val_set.surface_count = 0;
>> -   stream->src.width = mode->hdisplay;
>> -   stream->src.height = mode->vdisplay;
>> +   drm_crtc_get_hv_timing(mode, >src.width,
>> >src.height);
>> stream->dst = stream->src;
>>
>> if (dc_validate_resources(adev->dm.dc, _set, 1))
>> @@ -1793,14 +1807,13 @@ int dm_create_validation_set_for_connector(struct
>> drm_connector *connector,
>> return result;
>> }
>>
>> -   drm_mode_set_crtcinfo(mode, 0);
>> +   drm_mode_set_crtcinfo(mode, CRTC_STEREO_DOUBLE);
>>
>> fill_stream_properties_from_drm_display_mode(stream, mode,
>> connector);
>>
>> val_set->stream = stream;
>>
>> -   stream->src.width = mode->hdisplay;
>> -   stream->src.height = mode->vdisplay;
>> +   drm_crtc_get_hv_timing(mode, >src.width,
>> >src.height);
>> stream->dst = stream->src;
>>
>> return MODE_OK;
>> @@ -2073,6 +2086,7 @@ void amdgpu_dm_connector_init_helper(
>> aconnector->dc_link = link;
>> aconnector->base.interlace_allowed = true;
>> aconnector->base.doublescan_allowed = true;
>> +   aconnector->base.stereo_allowed = true;
>> aconnector->base.dpms = DRM_MODE_DPMS_OFF;
>> aconnector->hpd.hpd = AMDGPU_HPD_NONE; /* not used */
>>
>> 

[PATCH 22/24] drm: Nerf the preclose callback for modern drivers

2017-03-08 Thread Daniel Vetter
With all drivers converted there's only legacy dri1 drivers using it.
Not going to touch those, instead just hide it like we've done with
other dri1 driver hooks like firstopen.

In all this I didn't find any real reason why we'd needed 2 hooks, and
having symmetry between open and close just appeases my OCD better.
Yeah, someone else could do an s/postclose/close/, but that's for
someone who understands cocci. And maybe after this series is reviewed
and landed, to avoid patch-regen churn.

Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/drm_file.c |  8 
 include/drm/drm_drv.h  | 23 ++-
 2 files changed, 6 insertions(+), 25 deletions(-)

diff --git a/drivers/gpu/drm/drm_file.c b/drivers/gpu/drm/drm_file.c
index a8813a1115dc..f8483fc6d3d7 100644
--- a/drivers/gpu/drm/drm_file.c
+++ b/drivers/gpu/drm/drm_file.c
@@ -350,9 +350,8 @@ void drm_lastclose(struct drm_device * dev)
  *
  * This function must be used by drivers as their _operations.release
  * method. It frees any resources associated with the open file, and calls the
- * _driver.preclose and _driver.lastclose driver callbacks. If this is
- * the last open file for the DRM device also proceeds to call the
- * _driver.lastclose driver callback.
+ * _driver.lastclose driver callback. If this is the last open file for the
+ * DRM device also proceeds to call the _driver.lastclose driver callback.
  *
  * RETURNS:
  *
@@ -372,7 +371,8 @@ int drm_release(struct inode *inode, struct file *filp)
list_del(_priv->lhead);
mutex_unlock(>filelist_mutex);
 
-   if (dev->driver->preclose)
+   if (drm_core_check_feature(dev, DRIVER_LEGACY) &&
+   dev->driver->preclose)
dev->driver->preclose(dev, file_priv);
 
/* 
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
index 8f900fb30275..fde343e0d581 100644
--- a/include/drm/drm_drv.h
+++ b/include/drm/drm_drv.h
@@ -104,23 +104,6 @@ struct drm_driver {
int (*open) (struct drm_device *, struct drm_file *);
 
/**
-* @preclose:
-*
-* One of the driver callbacks when a new  drm_file is closed.
-* Useful for tearing down driver-private data structures allocated in
-* @open like buffer allocators, execution contexts or similar things.
-*
-* Since the display/modeset side of DRM can only be owned by exactly
-* one  drm_file (see _file.is_master and _device.master)
-* there should never be a need to tear down any modeset related
-* resources in this callback. Doing so would be a driver design bug.
-*
-* FIXME: It is not really clear why there's both @preclose and
-* @postclose. Without a really good reason, use @postclose only.
-*/
-   void (*preclose) (struct drm_device *, struct drm_file *file_priv);
-
-   /**
 * @postclose:
 *
 * One of the driver callbacks when a new  drm_file is closed.
@@ -131,9 +114,6 @@ struct drm_driver {
 * one  drm_file (see _file.is_master and _device.master)
 * there should never be a need to tear down any modeset related
 * resources in this callback. Doing so would be a driver design bug.
-*
-* FIXME: It is not really clear why there's both @preclose and
-* @postclose. Without a really good reason, use @postclose only.
 */
void (*postclose) (struct drm_device *, struct drm_file *);
 
@@ -150,7 +130,7 @@ struct drm_driver {
 * state changes, e.g. in conjunction with the :ref:`vga_switcheroo`
 * infrastructure.
 *
-* This is called after @preclose and @postclose have been called.
+* This is called after @postclose hook has been called.
 *
 * NOTE:
 *
@@ -516,6 +496,7 @@ struct drm_driver {
/* List of devices hanging off this driver with stealth attach. */
struct list_head legacy_dev_list;
int (*firstopen) (struct drm_device *);
+   void (*preclose) (struct drm_device *, struct drm_file *file_priv);
int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file 
*file_priv);
int (*dma_quiescent) (struct drm_device *);
int (*context_dtor) (struct drm_device *dev, int context);
-- 
2.11.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 23/24] drm: Create DEFINE_DRM_GEM_CMA_FOPS and roll it out to drivers

2017-03-08 Thread Daniel Vetter
Less code ftw.

This converts all drivers except the tinydrm helper module. That one
needs more work, since it gets the THIS_MODULE reference from
tinydrm.ko instead of the actual driver module like it should.
Probably needs a similar trick like I used here with generating the
entire struct with a macro.

Cc: Noralf Trønnes 
Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/arm/hdlcd_drv.c | 12 +---
 drivers/gpu/drm/arm/malidp_drv.c| 12 +---
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c| 12 +---
 drivers/gpu/drm/drm_file.c  |  3 +++
 drivers/gpu/drm/drm_gem_cma_helper.c|  3 +++
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c   | 12 +---
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 12 +---
 drivers/gpu/drm/imx/imx-drm-core.c  | 11 +--
 drivers/gpu/drm/meson/meson_drv.c   | 14 +
 drivers/gpu/drm/mxsfb/mxsfb_drv.c   | 14 +
 drivers/gpu/drm/rcar-du/rcar_du_drv.c   | 12 +---
 drivers/gpu/drm/shmobile/shmob_drm_drv.c| 12 +---
 drivers/gpu/drm/sti/sti_drv.c   | 11 +--
 drivers/gpu/drm/sun4i/sun4i_drv.c   | 12 +---
 drivers/gpu/drm/tilcdc/tilcdc_drv.c | 12 +---
 drivers/gpu/drm/zte/zx_drm_drv.c| 14 +
 include/drm/drm_gem_cma_helper.h| 26 +
 17 files changed, 46 insertions(+), 158 deletions(-)

diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c
index 4840dc277339..0e74880b5e94 100644
--- a/drivers/gpu/drm/arm/hdlcd_drv.c
+++ b/drivers/gpu/drm/arm/hdlcd_drv.c
@@ -239,17 +239,7 @@ static int hdlcd_debugfs_init(struct drm_minor *minor)
 }
 #endif
 
-static const struct file_operations fops = {
-   .owner  = THIS_MODULE,
-   .open   = drm_open,
-   .release= drm_release,
-   .unlocked_ioctl = drm_ioctl,
-   .compat_ioctl   = drm_compat_ioctl,
-   .poll   = drm_poll,
-   .read   = drm_read,
-   .llseek = noop_llseek,
-   .mmap   = drm_gem_cma_mmap,
-};
+DEFINE_DRM_GEM_CMA_FOPS(fops);
 
 static struct drm_driver hdlcd_driver = {
.driver_features = DRIVER_HAVE_IRQ | DRIVER_GEM |
diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c
index a9608a2e5a29..ea2546f766c2 100644
--- a/drivers/gpu/drm/arm/malidp_drv.c
+++ b/drivers/gpu/drm/arm/malidp_drv.c
@@ -178,17 +178,7 @@ static void malidp_lastclose(struct drm_device *drm)
drm_fbdev_cma_restore_mode(malidp->fbdev);
 }
 
-static const struct file_operations fops = {
-   .owner = THIS_MODULE,
-   .open = drm_open,
-   .release = drm_release,
-   .unlocked_ioctl = drm_ioctl,
-   .compat_ioctl = drm_compat_ioctl,
-   .poll = drm_poll,
-   .read = drm_read,
-   .llseek = noop_llseek,
-   .mmap = drm_gem_cma_mmap,
-};
+DEFINE_DRM_GEM_CMA_FOPS(fops);
 
 static struct drm_driver malidp_driver = {
.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC |
diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c 
b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
index 970bd87d7cce..178acbf5f6c5 100644
--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
+++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
@@ -724,17 +724,7 @@ static void atmel_hlcdc_dc_irq_uninstall(struct drm_device 
*dev)
regmap_read(dc->hlcdc->regmap, ATMEL_HLCDC_ISR, );
 }
 
-static const struct file_operations fops = {
-   .owner  = THIS_MODULE,
-   .open   = drm_open,
-   .release= drm_release,
-   .unlocked_ioctl = drm_ioctl,
-   .compat_ioctl   = drm_compat_ioctl,
-   .poll   = drm_poll,
-   .read   = drm_read,
-   .llseek = no_llseek,
-   .mmap   = drm_gem_cma_mmap,
-};
+DEFINE_DRM_GEM_CMA_FOPS(fops);
 
 static struct drm_driver atmel_hlcdc_dc_driver = {
.driver_features = DRIVER_HAVE_IRQ | DRIVER_GEM |
diff --git a/drivers/gpu/drm/drm_file.c b/drivers/gpu/drm/drm_file.c
index f8483fc6d3d7..260a83563976 100644
--- a/drivers/gpu/drm/drm_file.c
+++ b/drivers/gpu/drm/drm_file.c
@@ -89,6 +89,9 @@ DEFINE_MUTEX(drm_global_mutex);
  * .mmap = drm_gem_mmap,
  * };
  *
+ * For CMA based drivers there is the DEFINE_DRM_GEM_CMA_FOPS() macro to make
+ * this simpler.
+ *
  * FIXME: We should have a macro for this (and the CMA version) so that drivers
  * don't have to repeat it all the time.
  */
diff --git a/drivers/gpu/drm/drm_gem_cma_helper.c 
b/drivers/gpu/drm/drm_gem_cma_helper.c
index bb968e76779b..bc28e7575254 100644
--- a/drivers/gpu/drm/drm_gem_cma_helper.c
+++ b/drivers/gpu/drm/drm_gem_cma_helper.c
@@ -338,6 +338,9 @@ static int drm_gem_cma_mmap_obj(struct 

Re: [PATCH 5/5] drm/amd/display: Allow HDMI capabilities over DVI connector (DC)

2017-03-08 Thread Jeffrey Smith
This did work for me, including stereo 3D, so that is rather disappointing.
(DVI output of the card -> DVI/HDMI adapter -> HDMI Cable -> HDMI TV input)

Is it that HDMI signaling passing through a DVI connector is dis-allowed
on the whole, or is there something more subtle that I am missing?

Would it be allowed if only accessible through a kernel parameter?


On Wed, Mar 1, 2017 at 5:11 PM, Harry Wentland 
wrote:

> On 2017-02-24 07:14 PM, Jeff Smith wrote:
>
>> Signed-off-by: Jeff Smith 
>> ---
>>  drivers/gpu/drm/amd/display/dc/core/dc_link.c | 7 ++-
>>  1 file changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link.c
>> b/drivers/gpu/drm/amd/display/dc/core/dc_link.c
>> index 2b92939..168f260 100644
>> --- a/drivers/gpu/drm/amd/display/dc/core/dc_link.c
>> +++ b/drivers/gpu/drm/amd/display/dc/core/dc_link.c
>> @@ -706,8 +706,13 @@ bool dc_link_detect(const struct dc_link *dc_link,
>> bool boot)
>>
>> /* HDMI-DVI Dongle */
>> if (dc_sink->sink_signal == SIGNAL_TYPE_HDMI_TYPE_A &&
>> -   !dc_sink->edid_caps.edid_hdmi)
>> +   !dc_sink->edid_caps.edid_hdmi) {
>> dc_sink->sink_signal =
>> SIGNAL_TYPE_DVI_SINGLE_LINK;
>> +   } else if ((dc_sink->sink_signal ==
>> SIGNAL_TYPE_DVI_SINGLE_LINK ||
>> +   dc_sink->sink_signal ==
>> SIGNAL_TYPE_DVI_DUAL_LINK) &&
>> +   dc_sink->edid_caps.edid_hdmi) {
>> +   dc_sink->sink_signal = SIGNAL_TYPE_HDMI_TYPE_A;
>> +   }
>>
>
> This won't pass HDMI compliance.
>
> Harry
>
>
>
>> /* Connectivity log: detection */
>> for (i = 0; i < sink->public.dc_edid.length /
>> EDID_BLOCK_SIZE; i++) {
>>
>>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 24/24] drm/gem: Add DEFINE_DRM_GEM_FOPS

2017-03-08 Thread Daniel Vetter
Sadly there's only 1 driver which can use it, everyone else is special
for some reason:

- gma500 has a horrible runtime PM ioctl wrapper that probably doesn't
  really work but meh.
- i915 needs special compat_ioctl handler because regrets.
- arcgpu needs to fixup the pgprot because (no idea why it can't do
  that in the fault handler like everyone else).
- tegra does even worse stuff with pgprot
- udl does something with vm_flags too ...
- cma helpers, etnaviv, mtk, msm, rockchip, omap all implement some
  variation on prefaulting.
- exynos is exynos, I got lost in the midlayers.
- vc4 has to reinvent half of cma helpers because those are too much
  midlayer, plus vm_flags dances.
- vgem also seems unhappy with the default vm_flags.

So pretty sad divergence and I'm sure we could do better, but not
really an idea. Oh well, maybe this macro here helps to encourage more
consistency at least going forward.

Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/armada/armada_drv.c | 11 +--
 drivers/gpu/drm/drm_file.c  |  8 +++-
 include/drm/drm_gem.h   | 26 ++
 3 files changed, 30 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/armada/armada_drv.c 
b/drivers/gpu/drm/armada/armada_drv.c
index 1952e8748fea..f986e9ff093d 100644
--- a/drivers/gpu/drm/armada/armada_drv.c
+++ b/drivers/gpu/drm/armada/armada_drv.c
@@ -60,16 +60,7 @@ static void armada_drm_lastclose(struct drm_device *dev)
armada_fbdev_lastclose(dev);
 }
 
-static const struct file_operations armada_drm_fops = {
-   .owner  = THIS_MODULE,
-   .llseek = no_llseek,
-   .read   = drm_read,
-   .poll   = drm_poll,
-   .unlocked_ioctl = drm_ioctl,
-   .mmap   = drm_gem_mmap,
-   .open   = drm_open,
-   .release= drm_release,
-};
+DEFINE_DRM_GEM_FOPS(armada_drm_fops);
 
 static struct drm_driver armada_drm_driver = {
.lastclose  = armada_drm_lastclose,
diff --git a/drivers/gpu/drm/drm_file.c b/drivers/gpu/drm/drm_file.c
index 260a83563976..0701362dcca1 100644
--- a/drivers/gpu/drm/drm_file.c
+++ b/drivers/gpu/drm/drm_file.c
@@ -89,11 +89,9 @@ DEFINE_MUTEX(drm_global_mutex);
  * .mmap = drm_gem_mmap,
  * };
  *
- * For CMA based drivers there is the DEFINE_DRM_GEM_CMA_FOPS() macro to make
- * this simpler.
- *
- * FIXME: We should have a macro for this (and the CMA version) so that drivers
- * don't have to repeat it all the time.
+ * For plain GEM based drivers there is the DEFINE_DRM_GEM_FOPS() macro, and 
for
+ * CMA based drivers there is the DEFINE_DRM_GEM_CMA_FOPS() macro to make this
+ * simpler.
  */
 
 static int drm_open_helper(struct file *filp, struct drm_minor *minor);
diff --git a/include/drm/drm_gem.h b/include/drm/drm_gem.h
index b9ade75ecd82..663d80358057 100644
--- a/include/drm/drm_gem.h
+++ b/include/drm/drm_gem.h
@@ -178,6 +178,32 @@ struct drm_gem_object {
struct dma_buf_attachment *import_attach;
 };
 
+/**
+ * DEFINE_DRM_GEM_FOPS() - macro to generate file operations for GEM drivers
+ * @name: name for the generated structure
+ *
+ * This macro autogenerates a suitable  file_operations for GEM based
+ * drivers, which can be assigned to _driver.fops. Note that this structure
+ * cannot be shared between drivers, because it contains a reference to the
+ * current module using THIS_MODULE.
+ *
+ * Note that the declaration is already marked as static - if you need a
+ * non-static version of this you're probably doing it wrong and will break the
+ * THIS_MODULE reference by accident.
+ */
+#define DEFINE_DRM_GEM_FOPS(name) \
+   static const struct file_operations name = {\
+   .owner  = THIS_MODULE,\
+   .open   = drm_open,\
+   .release= drm_release,\
+   .unlocked_ioctl = drm_ioctl,\
+   .compat_ioctl   = drm_compat_ioctl,\
+   .poll   = drm_poll,\
+   .read   = drm_read,\
+   .llseek = noop_llseek,\
+   .mmap   = drm_gem_mmap,\
+   }
+
 void drm_gem_object_release(struct drm_gem_object *obj);
 void drm_gem_object_free(struct kref *kref);
 int drm_gem_object_init(struct drm_device *dev,
-- 
2.11.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 14/24] drm/nouveau: Merge pre/postclose hooks

2017-03-08 Thread Daniel Vetter
Again no apparent explanation for the split except hysterical raisins.
Merging them also makes it a bit more obviuos what's going on wrt the
runtime pm refdancing.

Cc: Ben Skeggs 
Cc: nouv...@lists.freedesktop.org
Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/nouveau/nouveau_drm.c | 9 +
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c 
b/drivers/gpu/drm/nouveau/nouveau_drm.c
index f0bb7606eb8b..0e26be017de7 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -881,7 +881,7 @@ nouveau_drm_open(struct drm_device *dev, struct drm_file 
*fpriv)
 }
 
 static void
-nouveau_drm_preclose(struct drm_device *dev, struct drm_file *fpriv)
+nouveau_drm_postclose(struct drm_device *dev, struct drm_file *fpriv)
 {
struct nouveau_cli *cli = nouveau_cli(fpriv);
struct nouveau_drm *drm = nouveau_drm(dev);
@@ -897,12 +897,6 @@ nouveau_drm_preclose(struct drm_device *dev, struct 
drm_file *fpriv)
list_del(>head);
mutex_unlock(>client.mutex);
 
-}
-
-static void
-nouveau_drm_postclose(struct drm_device *dev, struct drm_file *fpriv)
-{
-   struct nouveau_cli *cli = nouveau_cli(fpriv);
nouveau_cli_fini(cli);
kfree(cli);
pm_runtime_mark_last_busy(dev->dev);
@@ -974,7 +968,6 @@ driver_stub = {
.load = nouveau_drm_load,
.unload = nouveau_drm_unload,
.open = nouveau_drm_open,
-   .preclose = nouveau_drm_preclose,
.postclose = nouveau_drm_postclose,
.lastclose = nouveau_vga_lastclose,
 
-- 
2.11.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 08/24] drm: Remove DRM_MINOR_CNT

2017-03-08 Thread David Herrmann
Hi

On Wed, Mar 8, 2017 at 3:12 PM, Daniel Vetter  wrote:
> This was originally added by David Herrmann for range checks, but
> entirely unused. It confused me, so let's remove it.
>
> Cc: David Herrmann 
> Signed-off-by: Daniel Vetter 
> ---
>  include/drm/drmP.h | 1 -
>  1 file changed, 1 deletion(-)

Reviewed-by: David Herrmann 

Thanks
David

> diff --git a/include/drm/drmP.h b/include/drm/drmP.h
> index 826101785876..7bd6752683a4 100644
> --- a/include/drm/drmP.h
> +++ b/include/drm/drmP.h
> @@ -444,7 +444,6 @@ enum drm_minor_type {
> DRM_MINOR_PRIMARY,
> DRM_MINOR_CONTROL,
> DRM_MINOR_RENDER,
> -   DRM_MINOR_CNT,
>  };
>
>  /**
> --
> 2.11.0
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 20/24] drm/exynos: Merge pre/postclose hooks

2017-03-08 Thread Daniel Vetter
Again no apparent explanation for the split except hysterical raisins.
Merging them also makes it a bit more obviuos what's going on wrt the
runtime pm refdancing.

Cc: Inki Dae 
Cc: Joonyoung Shim 
Cc: Seung-Woo Kim 
Cc: Kyungmin Park 
Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/exynos/exynos_drm_drv.c | 8 +---
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c 
b/drivers/gpu/drm/exynos/exynos_drm_drv.c
index b4522f67b3cb..180e3c9884e5 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
@@ -194,14 +194,9 @@ static int exynos_drm_open(struct drm_device *dev, struct 
drm_file *file)
return ret;
 }
 
-static void exynos_drm_preclose(struct drm_device *dev,
-   struct drm_file *file)
-{
-   exynos_drm_subdrv_close(dev, file);
-}
-
 static void exynos_drm_postclose(struct drm_device *dev, struct drm_file *file)
 {
+   exynos_drm_subdrv_close(dev, file);
kfree(file->driver_priv);
file->driver_priv = NULL;
 }
@@ -259,7 +254,6 @@ static struct drm_driver exynos_drm_driver = {
.load   = exynos_drm_load,
.unload = exynos_drm_unload,
.open   = exynos_drm_open,
-   .preclose   = exynos_drm_preclose,
.lastclose  = exynos_drm_lastclose,
.postclose  = exynos_drm_postclose,
.gem_free_object_unlocked = exynos_drm_gem_free_object,
-- 
2.11.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 07/24] drm: rename drm_fops.c to drm_file.c

2017-03-08 Thread Daniel Vetter
It's not just file ops, but drm_file stuff in general. This is prep
work to extracting a drm_file.h header in the next patch.

Signed-off-by: Daniel Vetter 
---
 Documentation/gpu/drm-internals.rst| 4 ++--
 drivers/gpu/drm/Makefile   | 2 +-
 drivers/gpu/drm/{drm_fops.c => drm_file.c} | 3 ---
 drivers/gpu/drm/drm_internal.h | 2 +-
 include/drm/drmP.h | 2 +-
 5 files changed, 5 insertions(+), 8 deletions(-)
 rename drivers/gpu/drm/{drm_fops.c => drm_file.c} (99%)

diff --git a/Documentation/gpu/drm-internals.rst 
b/Documentation/gpu/drm-internals.rst
index 29d6bf7bb1ac..ea329b71c459 100644
--- a/Documentation/gpu/drm-internals.rst
+++ b/Documentation/gpu/drm-internals.rst
@@ -298,10 +298,10 @@ over.
 File Operations
 ---
 
-.. kernel-doc:: drivers/gpu/drm/drm_fops.c
+.. kernel-doc:: drivers/gpu/drm/drm_file.c
:doc: file operations
 
-.. kernel-doc:: drivers/gpu/drm/drm_fops.c
+.. kernel-doc:: drivers/gpu/drm/drm_file.c
:export:
 
 IOCTLs
diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index 3ee95793d122..eb54ffabacc5 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -4,7 +4,7 @@
 
 drm-y   := drm_auth.o drm_bufs.o drm_cache.o \
drm_context.o drm_dma.o \
-   drm_fops.o drm_gem.o drm_ioctl.o drm_irq.o \
+   drm_file.o drm_gem.o drm_ioctl.o drm_irq.o \
drm_lock.o drm_memory.o drm_drv.o \
drm_scatter.o drm_pci.o \
drm_platform.o drm_sysfs.o drm_hashtab.o drm_mm.o \
diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_file.c
similarity index 99%
rename from drivers/gpu/drm/drm_fops.c
rename to drivers/gpu/drm/drm_file.c
index afdf5b147f39..83e8c96ec4ab 100644
--- a/drivers/gpu/drm/drm_fops.c
+++ b/drivers/gpu/drm/drm_file.c
@@ -1,7 +1,4 @@
 /*
- * \file drm_fops.c
- * File operations for DRM
- *
  * \author Rickard E. (Rik) Faith 
  * \author Daryll Strauss 
  * \author Gareth Hughes 
diff --git a/drivers/gpu/drm/drm_internal.h b/drivers/gpu/drm/drm_internal.h
index f37388cb2fde..92ff4b9393b1 100644
--- a/drivers/gpu/drm/drm_internal.h
+++ b/drivers/gpu/drm/drm_internal.h
@@ -24,7 +24,7 @@
 #define DRM_IF_MAJOR 1
 #define DRM_IF_MINOR 4
 
-/* drm_fops.c */
+/* drm_file.c */
 extern struct mutex drm_global_mutex;
 void drm_lastclose(struct drm_device *dev);
 
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 1ad699de8769..826101785876 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -689,7 +689,7 @@ extern long drm_compat_ioctl(struct file *filp,
 #endif
 extern bool drm_ioctl_flags(unsigned int nr, unsigned int *flags);
 
-/* File Operations (drm_fops.c) */
+/* File Operations (drm_file.c) */
 int drm_open(struct inode *inode, struct file *filp);
 ssize_t drm_read(struct file *filp, char __user *buffer,
 size_t count, loff_t *offset);
-- 
2.11.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 19/24] drm/amdgpu: Merge pre/postclose hooks

2017-03-08 Thread Daniel Vetter
Again no apparent explanation for the split except hysterical raisins.
Merging them also makes it a bit more obviuos what's going on wrt the
runtime pm refdancing.

Cc: Alex Deucher 
Cc: Christian König 
Cc: amd-...@lists.freedesktop.org
Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h |  2 --
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c |  1 -
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 17 ++---
 3 files changed, 2 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h 
b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index c1b913541739..c8860f05bfb9 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -1762,8 +1762,6 @@ void amdgpu_driver_lastclose_kms(struct drm_device *dev);
 int amdgpu_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv);
 void amdgpu_driver_postclose_kms(struct drm_device *dev,
 struct drm_file *file_priv);
-void amdgpu_driver_preclose_kms(struct drm_device *dev,
-   struct drm_file *file_priv);
 int amdgpu_suspend(struct amdgpu_device *adev);
 int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon);
 int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 75fc376ba735..09eb5026983c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -684,7 +684,6 @@ static struct drm_driver kms_driver = {
DRIVER_PRIME | DRIVER_RENDER | DRIVER_MODESET,
.load = amdgpu_driver_load_kms,
.open = amdgpu_driver_open_kms,
-   .preclose = amdgpu_driver_preclose_kms,
.postclose = amdgpu_driver_postclose_kms,
.lastclose = amdgpu_driver_lastclose_kms,
.set_busid = drm_pci_set_busid,
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
index 61d94c745672..55f951bcc91f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
@@ -694,6 +694,8 @@ void amdgpu_driver_postclose_kms(struct drm_device *dev,
if (!fpriv)
return;
 
+   pm_runtime_get_sync(dev->dev);
+
amdgpu_ctx_mgr_fini(>ctx_mgr);
 
amdgpu_uvd_free_handles(adev, file_priv);
@@ -722,21 +724,6 @@ void amdgpu_driver_postclose_kms(struct drm_device *dev,
pm_runtime_put_autosuspend(dev->dev);
 }
 
-/**
- * amdgpu_driver_preclose_kms - drm callback for pre close
- *
- * @dev: drm dev pointer
- * @file_priv: drm file
- *
- * On device pre close, tear down hyperz and cmask filps on r1xx-r5xx
- * (all asics).
- */
-void amdgpu_driver_preclose_kms(struct drm_device *dev,
-   struct drm_file *file_priv)
-{
-   pm_runtime_get_sync(dev->dev);
-}
-
 /*
  * VBlank related functions.
  */
-- 
2.11.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 16/24] drm/tegra: switch to postclose

2017-03-08 Thread Daniel Vetter
I didn't spot anything that would require ordering here (well not
anywhere else either), and I'm trying to unify at least modern drivers
on one close hook.

Cc: Thierry Reding 
Cc: linux-te...@vger.kernel.org
Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/tegra/drm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
index dba4e090d3df..3b419f9dbf4d 100644
--- a/drivers/gpu/drm/tegra/drm.c
+++ b/drivers/gpu/drm/tegra/drm.c
@@ -804,7 +804,7 @@ static const struct file_operations tegra_drm_fops = {
.llseek = noop_llseek,
 };
 
-static void tegra_drm_preclose(struct drm_device *drm, struct drm_file *file)
+static void tegra_drm_postclose(struct drm_device *drm, struct drm_file *file)
 {
struct tegra_drm_file *fpriv = file->driver_priv;
struct tegra_drm_context *context, *tmp;
@@ -868,7 +868,7 @@ static struct drm_driver tegra_drm_driver = {
.load = tegra_drm_load,
.unload = tegra_drm_unload,
.open = tegra_drm_open,
-   .preclose = tegra_drm_preclose,
+   .postclose = tegra_drm_postclose,
.lastclose = tegra_drm_lastclose,
 
 #if defined(CONFIG_DEBUG_FS)
-- 
2.11.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 21/24] drm/msm: Simplify vblank event delivery

2017-03-08 Thread Daniel Vetter
The core takes care of handling the send_event vs. close() issues, we
can remove that driver code.

Cc: Rob Clark 
Cc: linux-arm-...@vger.kernel.org
Cc: freedr...@lists.freedesktop.org
Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c | 12 +++-
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c | 12 +++-
 2 files changed, 6 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c 
b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c
index 1c29618f4ddb..f29194a74a19 100644
--- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c
+++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c
@@ -114,15 +114,9 @@ static void complete_flip(struct drm_crtc *crtc, struct 
drm_file *file)
spin_lock_irqsave(>event_lock, flags);
event = mdp4_crtc->event;
if (event) {
-   /* if regular vblank case (!file) or if cancel-flip from
-* preclose on file that requested flip, then send the
-* event:
-*/
-   if (!file || (event->base.file_priv == file)) {
-   mdp4_crtc->event = NULL;
-   DBG("%s: send event: %p", mdp4_crtc->name, event);
-   drm_crtc_send_vblank_event(crtc, event);
-   }
+   mdp4_crtc->event = NULL;
+   DBG("%s: send event: %p", mdp4_crtc->name, event);
+   drm_crtc_send_vblank_event(crtc, event);
}
spin_unlock_irqrestore(>event_lock, flags);
 }
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c 
b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c
index d0c8b38b96ce..87a19e0c0e67 100644
--- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c
+++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c
@@ -138,15 +138,9 @@ static void complete_flip(struct drm_crtc *crtc, struct 
drm_file *file)
spin_lock_irqsave(>event_lock, flags);
event = mdp5_crtc->event;
if (event) {
-   /* if regular vblank case (!file) or if cancel-flip from
-* preclose on file that requested flip, then send the
-* event:
-*/
-   if (!file || (event->base.file_priv == file)) {
-   mdp5_crtc->event = NULL;
-   DBG("%s: send event: %p", crtc->name, event);
-   drm_crtc_send_vblank_event(crtc, event);
-   }
+   mdp5_crtc->event = NULL;
+   DBG("%s: send event: %p", crtc->name, event);
+   drm_crtc_send_vblank_event(crtc, event);
}
spin_unlock_irqrestore(>event_lock, flags);
 
-- 
2.11.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 18/24] drm/etnaviv: switch to postclose

2017-03-08 Thread Daniel Vetter
I didn't spot anything that would require ordering here (well not
anywhere else either), and I'm trying to unify at least modern drivers
on one close hook.

Cc: Lucas Stach 
Cc: Russell King 
Cc: Christian Gmeiner 
Cc: etna...@lists.freedesktop.org
Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/etnaviv/etnaviv_drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c 
b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
index 587e45043542..289a9f8c6671 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
@@ -111,7 +111,7 @@ static int etnaviv_open(struct drm_device *dev, struct 
drm_file *file)
return 0;
 }
 
-static void etnaviv_preclose(struct drm_device *dev, struct drm_file *file)
+static void etnaviv_postclose(struct drm_device *dev, struct drm_file *file)
 {
struct etnaviv_drm_private *priv = dev->dev_private;
struct etnaviv_file_private *ctx = file->driver_priv;
@@ -488,7 +488,7 @@ static struct drm_driver etnaviv_drm_driver = {
DRIVER_PRIME |
DRIVER_RENDER,
.open   = etnaviv_open,
-   .preclose   = etnaviv_preclose,
+   .postclose   = etnaviv_postclose,
.gem_free_object_unlocked = etnaviv_gem_free_object,
.gem_vm_ops = _ops,
.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
-- 
2.11.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 10/24] drm: Remove drm_pending_event->pid

2017-03-08 Thread Daniel Vetter
We might as well dump the drm_file pointer, that's about as useful
a cookie as the pid. Noticed while typing docs for drm_file and friends.

Since the only consumer of this is the tracepoints I think we can safely
change this - those tracepoints should not be uapi relevant at all. It
all goes back to

commit b9c2c9ae882f058084e13e339925dbf8d2d20271
Author: Jesse Barnes 
Date:   Thu Jul 1 16:48:09 2010 -0700

drm: add per-event vblank event trace points

which doesn't give a special justification for using pid over a pointer.

Also note that the nouveau code setting it is entirely pointless:
Since this isn't a vblank event, it will never hit the vblank
tracepoints.

Cc: Ben Skeggs 
Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/drm_irq.c  |  5 ++---
 drivers/gpu/drm/drm_trace.h| 20 ++--
 drivers/gpu/drm/nouveau/nouveau_usif.c |  1 -
 include/drm/drm_file.h |  2 --
 4 files changed, 12 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index 1906723af389..9bdca69f754c 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -978,7 +978,7 @@ static void send_vblank_event(struct drm_device *dev,
e->event.tv_sec = now->tv_sec;
e->event.tv_usec = now->tv_usec;
 
-   trace_drm_vblank_event_delivered(e->base.pid, e->pipe,
+   trace_drm_vblank_event_delivered(e->base.file_priv, e->pipe,
 e->event.sequence);
 
drm_send_event_locked(dev, >base);
@@ -1505,7 +1505,6 @@ static int drm_queue_vblank_event(struct drm_device *dev, 
unsigned int pipe,
}
 
e->pipe = pipe;
-   e->base.pid = current->pid;
e->event.base.type = DRM_EVENT_VBLANK;
e->event.base.length = sizeof(e->event);
e->event.user_data = vblwait->request.signal;
@@ -1534,7 +1533,7 @@ static int drm_queue_vblank_event(struct drm_device *dev, 
unsigned int pipe,
DRM_DEBUG("event on vblank count %u, current %u, crtc %u\n",
  vblwait->request.sequence, seq, pipe);
 
-   trace_drm_vblank_event_queued(current->pid, pipe,
+   trace_drm_vblank_event_queued(file_priv, pipe,
  vblwait->request.sequence);
 
e->event.sequence = vblwait->request.sequence;
diff --git a/drivers/gpu/drm/drm_trace.h b/drivers/gpu/drm/drm_trace.h
index ce3c42813fbb..14c5a777682e 100644
--- a/drivers/gpu/drm/drm_trace.h
+++ b/drivers/gpu/drm/drm_trace.h
@@ -24,36 +24,36 @@ TRACE_EVENT(drm_vblank_event,
 );
 
 TRACE_EVENT(drm_vblank_event_queued,
-   TP_PROTO(pid_t pid, int crtc, unsigned int seq),
-   TP_ARGS(pid, crtc, seq),
+   TP_PROTO(struct drm_file *file, int crtc, unsigned int seq),
+   TP_ARGS(file, crtc, seq),
TP_STRUCT__entry(
-   __field(pid_t, pid)
+   __field(struct drm_file *, file)
__field(int, crtc)
__field(unsigned int, seq)
),
TP_fast_assign(
-   __entry->pid = pid;
+   __entry->file = file;
__entry->crtc = crtc;
__entry->seq = seq;
),
-   TP_printk("pid=%d, crtc=%d, seq=%u", __entry->pid, __entry->crtc, \
+   TP_printk("file=%p, crtc=%d, seq=%u", __entry->file, __entry->crtc, 
\
  __entry->seq)
 );
 
 TRACE_EVENT(drm_vblank_event_delivered,
-   TP_PROTO(pid_t pid, int crtc, unsigned int seq),
-   TP_ARGS(pid, crtc, seq),
+   TP_PROTO(struct drm_file *file, int crtc, unsigned int seq),
+   TP_ARGS(file, crtc, seq),
TP_STRUCT__entry(
-   __field(pid_t, pid)
+   __field(struct drm_file *, file)
__field(int, crtc)
__field(unsigned int, seq)
),
TP_fast_assign(
-   __entry->pid = pid;
+   __entry->file = file;
__entry->crtc = crtc;
__entry->seq = seq;
),
-   TP_printk("pid=%d, crtc=%d, seq=%u", __entry->pid, __entry->crtc, \
+   TP_printk("file=%p, crtc=%d, seq=%u", __entry->file, __entry->crtc, 
\
  __entry->seq)
 );
 
diff --git a/drivers/gpu/drm/nouveau/nouveau_usif.c 
b/drivers/gpu/drm/nouveau/nouveau_usif.c
index afbdbed1a690..9dc10b17ad34 100644
--- a/drivers/gpu/drm/nouveau/nouveau_usif.c
+++ b/drivers/gpu/drm/nouveau/nouveau_usif.c
@@ -211,7 +211,6 @@ usif_notify_get(struct drm_file *f, void *data, u32 size, 
void *argv, u32 argc)
goto done;
ntfy->p->base.event = >p->e.base;
ntfy->p->base.file_priv = f;
-   ntfy->p->base.pid = current->pid;
ntfy->p->e.base.type = DRM_NOUVEAU_EVENT_NVIF;

[PATCH 11/24] drm/doc: Document drm_file.[hc]

2017-03-08 Thread Daniel Vetter
Well, mostly drm_file.h, and clean up all related things:

- I didnt' figure out the difference between preclose and postclose.
  The existing explanation in drm-internals.rst didn't convince me,
  since it's also really outdated - we clean up pending DRM events in
  the core nowadays. I put a FIXME in for the future.

- Another FIXME is to have a macro for default fops.

- Lots of links all around, main areas are to tie the overview in
  drm_file.c more into the callbacks in struct drm_device, and the
  other is to link render/primary node code to the right sections in
  drm-uapi.rst.

- Also moved the open/close stuff to drm_drv.h from drm-internals.rst,
  seems like the better place for that information. Since that section
  was rather outdated this amounted to full-on rewrite.

A big missing piece here is some overview graph, but I think better to
wait with that one until drm_device and drm_driver are also fully
documented.

Signed-off-by: Daniel Vetter 
---
 Documentation/gpu/drm-internals.rst |  52 +--
 Documentation/gpu/drm-uapi.rst  |   4 +
 drivers/gpu/drm/drm_file.c  |  66 +
 include/drm/drm_drv.h   |  81 ++-
 include/drm/drm_file.h  | 267 
 5 files changed, 356 insertions(+), 114 deletions(-)

diff --git a/Documentation/gpu/drm-internals.rst 
b/Documentation/gpu/drm-internals.rst
index ea329b71c459..7a2fe4a02212 100644
--- a/Documentation/gpu/drm-internals.rst
+++ b/Documentation/gpu/drm-internals.rst
@@ -246,61 +246,15 @@ drivers.
 Open/Close, File Operations and IOCTLs
 ==
 
-Open and Close
---
-
-Open and close handlers. None of those methods are mandatory::
-
-int (*firstopen) (struct drm_device *);
-void (*lastclose) (struct drm_device *);
-int (*open) (struct drm_device *, struct drm_file *);
-void (*preclose) (struct drm_device *, struct drm_file *);
-void (*postclose) (struct drm_device *, struct drm_file *);
-
-The firstopen method is called by the DRM core for legacy UMS (User Mode
-Setting) drivers only when an application opens a device that has no
-other opened file handle. UMS drivers can implement it to acquire device
-resources. KMS drivers can't use the method and must acquire resources
-in the load method instead.
-
-Similarly the lastclose method is called when the last application
-holding a file handle opened on the device closes it, for both UMS and
-KMS drivers. Additionally, the method is also called at module unload
-time or, for hot-pluggable devices, when the device is unplugged. The
-firstopen and lastclose calls can thus be unbalanced.
-
-The open method is called every time the device is opened by an
-application. Drivers can allocate per-file private data in this method
-and store them in the struct :c:type:`struct drm_file
-` driver_priv field. Note that the open method is
-called before firstopen.
-
-The close operation is split into preclose and postclose methods.
-Drivers must stop and cleanup all per-file operations in the preclose
-method. For instance pending vertical blanking and page flip events must
-be cancelled. No per-file operation is allowed on the file handle after
-returning from the preclose method.
-
-Finally the postclose method is called as the last step of the close
-operation, right before calling the lastclose method if no other open
-file handle exists for the device. Drivers that have allocated per-file
-private data in the open method should free it here.
-
-The lastclose method should restore CRTC and plane properties to default
-value, so that a subsequent open of the device will not inherit state
-from the previous user. It can also be used to execute delayed power
-switching state changes, e.g. in conjunction with the :ref:`vga_switcheroo`
-infrastructure. Beyond that KMS drivers should not do any
-further cleanup. Only legacy UMS drivers might need to clean up device
-state so that the vga console or an independent fbdev driver could take
-over.
-
 File Operations
 ---
 
 .. kernel-doc:: drivers/gpu/drm/drm_file.c
:doc: file operations
 
+.. kernel-doc:: include/drm/drm_file.h
+   :internal:
+
 .. kernel-doc:: drivers/gpu/drm/drm_file.c
:export:
 
diff --git a/Documentation/gpu/drm-uapi.rst b/Documentation/gpu/drm-uapi.rst
index fcc228ef5bc4..352652810dab 100644
--- a/Documentation/gpu/drm-uapi.rst
+++ b/Documentation/gpu/drm-uapi.rst
@@ -21,6 +21,8 @@ libdrm Device Lookup
:doc: getunique and setversion story
 
 
+.. _drm_primary_node:
+
 Primary Nodes, DRM Master and Authentication
 
 
@@ -103,6 +105,8 @@ is already rather painful for the DRM subsystem, with 
multiple different uAPIs
 for the same thing co-existing. If we add a few more complete mistakes into the
 mix every year it would be entirely unmanageable.
 
+.. _drm_render_node:
+
 Render nodes
 
 
diff --git 

[PATCH 17/24] drm/vgem: switch to postclose

2017-03-08 Thread Daniel Vetter
I didn't spot anything that would require ordering here (well not
anywhere else either), and I'm trying to unify at least modern drivers
on one close hook.

Cc: Chris Wilson 
Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/vgem/vgem_drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/vgem/vgem_drv.c b/drivers/gpu/drm/vgem/vgem_drv.c
index a1f42d125e6e..9fee38a942c4 100644
--- a/drivers/gpu/drm/vgem/vgem_drv.c
+++ b/drivers/gpu/drm/vgem/vgem_drv.c
@@ -104,7 +104,7 @@ static int vgem_open(struct drm_device *dev, struct 
drm_file *file)
return 0;
 }
 
-static void vgem_preclose(struct drm_device *dev, struct drm_file *file)
+static void vgem_postclose(struct drm_device *dev, struct drm_file *file)
 {
struct vgem_file *vfile = file->driver_priv;
 
@@ -303,7 +303,7 @@ static int vgem_prime_mmap(struct drm_gem_object *obj,
 static struct drm_driver vgem_driver = {
.driver_features= DRIVER_GEM | DRIVER_PRIME,
.open   = vgem_open,
-   .preclose   = vgem_preclose,
+   .postclose  = vgem_postclose,
.gem_free_object_unlocked   = vgem_gem_free_object,
.gem_vm_ops = _gem_vm_ops,
.ioctls = vgem_ioctls,
-- 
2.11.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 15/24] drm/radeon: Merge pre/postclose hooks

2017-03-08 Thread Daniel Vetter
Again no apparent explanation for the split except hysterical raisins.
Merging them also makes it a bit more obviuos what's going on wrt the
runtime pm refdancing.

Cc: Alex Deucher 
Cc: Christian König 
Cc: amd-...@lists.freedesktop.org
Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/radeon/radeon_drv.c |  3 ---
 drivers/gpu/drm/radeon/radeon_kms.c | 42 +
 2 files changed, 14 insertions(+), 31 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_drv.c 
b/drivers/gpu/drm/radeon/radeon_drv.c
index 956c425e639e..312436a8d9e5 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -108,8 +108,6 @@ void radeon_driver_lastclose_kms(struct drm_device *dev);
 int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv);
 void radeon_driver_postclose_kms(struct drm_device *dev,
 struct drm_file *file_priv);
-void radeon_driver_preclose_kms(struct drm_device *dev,
-   struct drm_file *file_priv);
 int radeon_suspend_kms(struct drm_device *dev, bool suspend,
   bool fbcon, bool freeze);
 int radeon_resume_kms(struct drm_device *dev, bool resume, bool fbcon);
@@ -538,7 +536,6 @@ static struct drm_driver kms_driver = {
DRIVER_PRIME | DRIVER_RENDER,
.load = radeon_driver_load_kms,
.open = radeon_driver_open_kms,
-   .preclose = radeon_driver_preclose_kms,
.postclose = radeon_driver_postclose_kms,
.lastclose = radeon_driver_lastclose_kms,
.set_busid = drm_pci_set_busid,
diff --git a/drivers/gpu/drm/radeon/radeon_kms.c 
b/drivers/gpu/drm/radeon/radeon_kms.c
index 56f35c06742c..a32a62e03a44 100644
--- a/drivers/gpu/drm/radeon/radeon_kms.c
+++ b/drivers/gpu/drm/radeon/radeon_kms.c
@@ -691,13 +691,26 @@ int radeon_driver_open_kms(struct drm_device *dev, struct 
drm_file *file_priv)
  * @dev: drm dev pointer
  * @file_priv: drm file
  *
- * On device post close, tear down vm on cayman+ (all asics).
+ * On device close, tear down hyperz and cmask filps on r1xx-r5xx
+ * (all asics).  And tear down vm on cayman+ (all asics).
  */
 void radeon_driver_postclose_kms(struct drm_device *dev,
 struct drm_file *file_priv)
 {
struct radeon_device *rdev = dev->dev_private;
 
+   pm_runtime_get_sync(dev->dev);
+
+   mutex_lock(>gem.mutex);
+   if (rdev->hyperz_filp == file_priv)
+   rdev->hyperz_filp = NULL;
+   if (rdev->cmask_filp == file_priv)
+   rdev->cmask_filp = NULL;
+   mutex_unlock(>gem.mutex);
+
+   radeon_uvd_free_handles(rdev, file_priv);
+   radeon_vce_free_handles(rdev, file_priv);
+
/* new gpu have virtual address space support */
if (rdev->family >= CHIP_CAYMAN && file_priv->driver_priv) {
struct radeon_fpriv *fpriv = file_priv->driver_priv;
@@ -721,33 +734,6 @@ void radeon_driver_postclose_kms(struct drm_device *dev,
pm_runtime_put_autosuspend(dev->dev);
 }
 
-/**
- * radeon_driver_preclose_kms - drm callback for pre close
- *
- * @dev: drm dev pointer
- * @file_priv: drm file
- *
- * On device pre close, tear down hyperz and cmask filps on r1xx-r5xx
- * (all asics).
- */
-void radeon_driver_preclose_kms(struct drm_device *dev,
-   struct drm_file *file_priv)
-{
-   struct radeon_device *rdev = dev->dev_private;
-
-   pm_runtime_get_sync(dev->dev);
-
-   mutex_lock(>gem.mutex);
-   if (rdev->hyperz_filp == file_priv)
-   rdev->hyperz_filp = NULL;
-   if (rdev->cmask_filp == file_priv)
-   rdev->cmask_filp = NULL;
-   mutex_unlock(>gem.mutex);
-
-   radeon_uvd_free_handles(rdev, file_priv);
-   radeon_vce_free_handles(rdev, file_priv);
-}
-
 /*
  * VBlank related functions.
  */
-- 
2.11.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 12/24] drm/i915: Merge pre/postclose hooks

2017-03-08 Thread Daniel Vetter
There's really not a reason afaics that we can't just clean up
everything at the end, in the terminal postclose hook: Since this is
closing a file descriptor we know no one else can have a reference or
a thread doing something with that drm_file except the close code.
Ordering shouldn't matter, as long as we don't kfree before we clean
stuff up.

In the past this was more relevant when drivers still had to track and
clean up pending drm events, but that's all done by the core now.

Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/i915/i915_drv.c | 10 +++---
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index b1e9027a4f80..1e511d17684e 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -1423,17 +1423,14 @@ static void i915_driver_lastclose(struct drm_device 
*dev)
vga_switcheroo_process_delayed_switch();
 }
 
-static void i915_driver_preclose(struct drm_device *dev, struct drm_file *file)
+static void i915_driver_postclose(struct drm_device *dev, struct drm_file 
*file)
 {
+   struct drm_i915_file_private *file_priv = file->driver_priv;
+
mutex_lock(>struct_mutex);
i915_gem_context_close(dev, file);
i915_gem_release(dev, file);
mutex_unlock(>struct_mutex);
-}
-
-static void i915_driver_postclose(struct drm_device *dev, struct drm_file 
*file)
-{
-   struct drm_i915_file_private *file_priv = file->driver_priv;
 
kfree(file_priv);
 }
@@ -2638,7 +2635,6 @@ static struct drm_driver driver = {
.release = i915_driver_release,
.open = i915_driver_open,
.lastclose = i915_driver_lastclose,
-   .preclose = i915_driver_preclose,
.postclose = i915_driver_postclose,
.set_busid = drm_pci_set_busid,
 
-- 
2.11.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 13/24] drm/msm: switch to postclose

2017-03-08 Thread Daniel Vetter
I didn't spot anything that would require ordering here (well not
anywhere else either), and I'm trying to unify at least modern drivers
on one close hook.

Cc: Rob Clark 
Cc: linux-arm-...@vger.kernel.org
Cc: freedr...@lists.freedesktop.org
Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/msm/msm_drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
index 604331f3cf39..44774f02ef0e 100644
--- a/drivers/gpu/drm/msm/msm_drv.c
+++ b/drivers/gpu/drm/msm/msm_drv.c
@@ -540,7 +540,7 @@ static int msm_open(struct drm_device *dev, struct drm_file 
*file)
return 0;
 }
 
-static void msm_preclose(struct drm_device *dev, struct drm_file *file)
+static void msm_postclose(struct drm_device *dev, struct drm_file *file)
 {
struct msm_drm_private *priv = dev->dev_private;
struct msm_file_private *ctx = file->driver_priv;
@@ -813,7 +813,7 @@ static struct drm_driver msm_driver = {
DRIVER_ATOMIC |
DRIVER_MODESET,
.open   = msm_open,
-   .preclose   = msm_preclose,
+   .postclose   = msm_postclose,
.lastclose  = msm_lastclose,
.irq_handler= msm_irq,
.irq_preinstall = msm_irq_preinstall,
-- 
2.11.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 04/24] drm: Extract drm_pci.h

2017-03-08 Thread Daniel Vetter
Just another step in finally making drmP.h obsolete.

Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/drm_pci.c |  7 +
 include/drm/drmP.h| 43 +++---
 include/drm/drm_pci.h | 78 +++
 3 files changed, 89 insertions(+), 39 deletions(-)
 create mode 100644 include/drm/drm_pci.h

diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c
index a3b356e70b35..1eb4fc3eee20 100644
--- a/drivers/gpu/drm/drm_pci.c
+++ b/drivers/gpu/drm/drm_pci.c
@@ -26,6 +26,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include "drm_internal.h"
 #include "drm_legacy.h"
@@ -36,6 +37,9 @@
  * @size: size of block to allocate
  * @align: alignment of block
  *
+ * FIXME: This is a needless abstraction of the Linux dma-api and should be
+ * removed.
+ *
  * Return: A handle to the allocated memory block on success or NULL on
  * failure.
  */
@@ -104,6 +108,9 @@ void __drm_legacy_pci_free(struct drm_device * dev, 
drm_dma_handle_t * dmah)
  * drm_pci_free - Free a PCI consistent memory block
  * @dev: DRM device
  * @dmah: handle to memory block
+ *
+ * FIXME: This is a needless abstraction of the Linux dma-api and should be
+ * removed.
  */
 void drm_pci_free(struct drm_device * dev, drm_dma_handle_t * dmah)
 {
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 22b6f6f45b07..1ad699de8769 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -47,7 +47,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -77,6 +76,7 @@
 #include 
 #include 
 #include 
+#include 
 
 struct module;
 
@@ -85,7 +85,6 @@ struct drm_device;
 struct drm_agp_head;
 struct drm_local_map;
 struct drm_device_dma;
-struct drm_dma_handle;
 struct drm_gem_object;
 struct drm_master;
 struct drm_vblank_crtc;
@@ -96,6 +95,9 @@ struct videomode;
 struct reservation_object;
 struct dma_buf_attachment;
 
+struct pci_dev;
+struct pci_controller;
+
 /*
  * The following categories are defined:
  *
@@ -739,49 +741,12 @@ static inline int drm_debugfs_remove_files(const struct 
drm_info_list *files,
 }
 #endif
 
-
-extern struct drm_dma_handle *drm_pci_alloc(struct drm_device *dev, size_t 
size,
-   size_t align);
-extern void drm_pci_free(struct drm_device *dev, struct drm_dma_handle * dmah);
-
   /* sysfs support (drm_sysfs.c) */
 extern void drm_sysfs_hotplug_event(struct drm_device *dev);
 
 
 /*@}*/
 
-extern int drm_pci_init(struct drm_driver *driver, struct pci_driver *pdriver);
-extern void drm_pci_exit(struct drm_driver *driver, struct pci_driver 
*pdriver);
-#ifdef CONFIG_PCI
-extern int drm_get_pci_dev(struct pci_dev *pdev,
-  const struct pci_device_id *ent,
-  struct drm_driver *driver);
-extern int drm_pci_set_busid(struct drm_device *dev, struct drm_master 
*master);
-#else
-static inline int drm_get_pci_dev(struct pci_dev *pdev,
- const struct pci_device_id *ent,
- struct drm_driver *driver)
-{
-   return -ENOSYS;
-}
-
-static inline int drm_pci_set_busid(struct drm_device *dev,
-   struct drm_master *master)
-{
-   return -ENOSYS;
-}
-#endif
-
-#define DRM_PCIE_SPEED_25 1
-#define DRM_PCIE_SPEED_50 2
-#define DRM_PCIE_SPEED_80 4
-
-extern int drm_pcie_get_speed_cap_mask(struct drm_device *dev, u32 
*speed_mask);
-extern int drm_pcie_get_max_link_width(struct drm_device *dev, u32 *mlw);
-
-/* platform section */
-extern int drm_platform_init(struct drm_driver *driver, struct platform_device 
*platform_device);
-
 /* returns true if currently okay to sleep */
 static __inline__ bool drm_can_sleep(void)
 {
diff --git a/include/drm/drm_pci.h b/include/drm/drm_pci.h
new file mode 100644
index ..5081b3eba309
--- /dev/null
+++ b/include/drm/drm_pci.h
@@ -0,0 +1,78 @@
+/*
+ * Internal Header for the Direct Rendering Manager
+ *
+ * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
+ * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
+ * Copyright (c) 2009-2010, Code Aurora Forum.
+ * All rights reserved.
+ *
+ * Author: Rickard E. (Rik) Faith 
+ * Author: Gareth Hughes 
+ *
+ * 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 

[PATCH 08/24] drm: Remove DRM_MINOR_CNT

2017-03-08 Thread Daniel Vetter
This was originally added by David Herrmann for range checks, but
entirely unused. It confused me, so let's remove it.

Cc: David Herrmann 
Signed-off-by: Daniel Vetter 
---
 include/drm/drmP.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 826101785876..7bd6752683a4 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -444,7 +444,6 @@ enum drm_minor_type {
DRM_MINOR_PRIMARY,
DRM_MINOR_CONTROL,
DRM_MINOR_RENDER,
-   DRM_MINOR_CNT,
 };
 
 /**
-- 
2.11.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 09/24] drm: Extract drm_file.h

2017-03-08 Thread Daniel Vetter
I'm torn on whether drm_minor really should be here or somewhere else.
Maybe with more clarity after untangling drmP.h more this is easier to
decide, for now I've put a FIXME comment right next to it. Right now
we need struct drm_minor for the inline drm_file type helpers, and so
it does kinda make sense to have them here.

Next patch will kerneldoc-ify the entire pile.

Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/drm_file.c |   5 +-
 include/drm/drmP.h | 127 +
 include/drm/drm_file.h | 172 +
 include/drm/drm_prime.h|   1 +
 4 files changed, 178 insertions(+), 127 deletions(-)
 create mode 100644 include/drm/drm_file.h

diff --git a/drivers/gpu/drm/drm_file.c b/drivers/gpu/drm/drm_file.c
index 83e8c96ec4ab..d9e63d73d3ec 100644
--- a/drivers/gpu/drm/drm_file.c
+++ b/drivers/gpu/drm/drm_file.c
@@ -31,10 +31,13 @@
  * OTHER DEALINGS IN THE SOFTWARE.
  */
 
-#include 
 #include 
 #include 
 #include 
+
+#include 
+#include 
+
 #include "drm_legacy.h"
 #include "drm_internal.h"
 #include "drm_crtc_internal.h"
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 7bd6752683a4..4a0260e2b067 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -77,10 +77,10 @@
 #include 
 #include 
 #include 
+#include 
 
 struct module;
 
-struct drm_file;
 struct drm_device;
 struct drm_agp_head;
 struct drm_local_map;
@@ -360,76 +360,6 @@ struct drm_ioctl_desc {
.name = #ioctl  \
 }
 
-/* Event queued up for userspace to read */
-struct drm_pending_event {
-   struct completion *completion;
-   void (*completion_release)(struct completion *completion);
-   struct drm_event *event;
-   struct dma_fence *fence;
-   struct list_head link;
-   struct list_head pending_link;
-   struct drm_file *file_priv;
-   pid_t pid; /* pid of requester, no guarantee it's valid by the time
- we deliver the event, for tracing only */
-};
-
-/** File private data */
-struct drm_file {
-   unsigned authenticated :1;
-   /* true when the client has asked us to expose stereo 3D mode flags */
-   unsigned stereo_allowed :1;
-   /*
-* true if client understands CRTC primary planes and cursor planes
-* in the plane list
-*/
-   unsigned universal_planes:1;
-   /* true if client understands atomic properties */
-   unsigned atomic:1;
-   /*
-* This client is the creator of @master.
-* Protected by struct drm_device::master_mutex.
-*/
-   unsigned is_master:1;
-
-   struct pid *pid;
-   drm_magic_t magic;
-   struct list_head lhead;
-   struct drm_minor *minor;
-   unsigned long lock_count;
-
-   /** Mapping of mm object handles to object pointers. */
-   struct idr object_idr;
-   /** Lock for synchronization of access to object_idr. */
-   spinlock_t table_lock;
-
-   struct file *filp;
-   void *driver_priv;
-
-   struct drm_master *master; /* master this node is currently associated 
with
- N.B. not always dev->master */
-   /**
-* fbs - List of framebuffers associated with this file.
-*
-* Protected by fbs_lock. Note that the fbs list holds a reference on
-* the fb object to prevent it from untimely disappearing.
-*/
-   struct list_head fbs;
-   struct mutex fbs_lock;
-
-   /** User-created blob properties; this retains a reference on the
-*  property. */
-   struct list_head blobs;
-
-   wait_queue_head_t event_wait;
-   struct list_head pending_event_list;
-   struct list_head event_list;
-   int event_space;
-
-   struct mutex event_read_lock;
-
-   struct drm_prime_file_private prime;
-};
-
 /* Flags and return codes for get_vblank_timestamp() driver function. */
 #define DRM_CALLED_FROM_VBLIRQ 1
 #define DRM_VBLANKTIME_SCANOUTPOS_METHOD (1 << 0)
@@ -440,12 +370,6 @@ struct drm_file {
 #define DRM_SCANOUTPOS_IN_VBLANK(1 << 1)
 #define DRM_SCANOUTPOS_ACCURATE (1 << 2)
 
-enum drm_minor_type {
-   DRM_MINOR_PRIMARY,
-   DRM_MINOR_CONTROL,
-   DRM_MINOR_RENDER,
-};
-
 /**
  * Info file list entry. This structure represents a debugfs or proc file to
  * be created by the drm core
@@ -468,21 +392,6 @@ struct drm_info_node {
 };
 
 /**
- * DRM minor structure. This structure represents a drm minor number.
- */
-struct drm_minor {
-   int index;  /**< Minor device number */
-   int type;   /**< Control or render */
-   struct device *kdev;/**< Linux device */
-   struct drm_device *dev;
-
-   struct dentry *debugfs_root;
-
-   struct list_head debugfs_list;
-   struct mutex debugfs_lock; /* Protects debugfs_list. */
-};
-
-/**
  * DRM device 

[PATCH 05/24] drm: Remove drmP.h include from drm_kms_helper_common.c

2017-03-08 Thread Daniel Vetter
An easy one as a drive-by.

Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/drm_kms_helper_common.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_kms_helper_common.c 
b/drivers/gpu/drm/drm_kms_helper_common.c
index 45db36cd3d20..6e35a56a6102 100644
--- a/drivers/gpu/drm/drm_kms_helper_common.c
+++ b/drivers/gpu/drm/drm_kms_helper_common.c
@@ -25,8 +25,7 @@
  *
  */
 
-#include 
-#include 
+#include 
 
 #include "drm_crtc_helper_internal.h"
 
-- 
2.11.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


  1   2   >