Re: [PATCH v15] drm/bridge: add support for sn65dsi86 bridge driver

2018-07-26 Thread Andrzej Hajda
On 20.07.2018 08:54, Sandeep Panda wrote:
> Add support for TI's sn65dsi86 dsi2edp bridge chip.
> The chip converts DSI transmitted signal to eDP signal,
> which is fed to the connected eDP panel.
>
> This chip can be controlled via either i2c interface or
> dsi interface. Currently in driver all the control registers
> are being accessed through i2c interface only.
> Also as of now HPD support has not been added to bridge
> chip driver.
>
> Changes in v1:
>  - Split the dt-bindings and the driver support into separate patches
>(Andrzej Hajda).
>  - Use of gpiod APIs to parse and configure gpios instead of obsolete ones
>(Andrzej Hajda).
>  - Use macros to define the register offsets (Andrzej Hajda).
>
> Changes in v2:
>  - Separate out edp panel specific HW resource handling from bridge
>driver and create a separate edp panel drivers to handle panel
>specific mode information and HW resources (Sean Paul).
>  - Replace pr_* APIs to DRM_* APIs to log error or debug information
>(Sean Paul).
>  - Remove some of the unnecessary structure/variable from driver (Sean
>Paul).
>  - Rename the function and structure prefix "sn65dsi86" to "ti_sn_bridge"
>(Sean Paul / Rob Herring).
>  - Remove most of the hard-coding and modified the bridge init sequence
>based on current mode (Sean Paul).
>  - Remove the existing function to retrieve the EDID data and
>implemented this as an i2c_adapter and use drm_get_edid() (Sean Paul).
>  - Remove the dummy irq handler implementation, will add back the
>proper irq handling later (Sean Paul).
>  - Capture the required enable gpios in a single array based on dt entry
>instead of having individual descriptor for each gpio (Sean Paul).
>
> Changes in v3:
>  - Remove usage of irq_gpio and replace it as "interrupts" property (Rob
>Herring).
>  - Remove the unnecessary header file inclusions (Sean Paul).
>  - Rearrange the header files in alphabetical order (Sean Paul).
>  - Use regmap interface to perform i2c transactions.
>  - Update Copyright/License field and address other review comments
>(Jordan Crouse).
>
> Changes in v4:
>  - Update License/Copyright (Sean Paul).
>  - Add Kconfig and Makefile changes (Sean Paul).
>  - Drop i2c gpio handling from this bridge driver, since i2c sda/scl gpios
>will be handled by i2c master.
>  - Update required supplies names.
>  - Remove unnecessary goto statements (Sean Paul).
>  - Add mutex lock to power_ctrl API to avoid race conditions (Sean
>Paul).
>  - Add support to parse reference clk frequency from dt(optional).
>  - Update the bridge chip enable/disable sequence.
>
> Changes in v5:
>  - Fixed Kbuild test service reported warnings.
>
> Changes in v6:
>  - Use PM runtime based ref-counting instead of local ref_count mechanism
>(Stephen Boyd).
>  - Clean up some debug logs and indentations (Sean Paul).
>  - Simplify dp rate calculation (Sean Paul).
>  - Add support to configure refclk based on input REFCLK pin or DACP/N
>pin (Stephen Boyd).
>
> Changes in v7:
>  - Use static supply entries instead of dynamic allocation (Andrzej
>Hajda).
>  - Defer bridge driver probe if panel is not probed (Andrzej Hajda).
>  - Update of_graph APIs for correct node reference management. (Andrzej
>Hajda).
>  - Remove local display_mode object (Andrzej Hajda).
>  - Remove version id check function from driver.
>
> Changes in v8:
>  - Move dsi register/attach function to bridge driver probe (Andrzej
>Hajda).
>  - Introduce a new helper function to write 16bit words into consecutive
>registers (Andrzej Hajda).
>  - Remove unnecessary macros (Andrzej Hajda).
>
> Changes in v9:
>  - Remove dsi register/attach from bridge probe, since dsi dev register
>completion also waits for any panel or bridge to get added. This creates
>deadlock situation when bridge driver calls dsi dev register and
>attach before bridge add, in its probe function.
>  - Fix issues faced during testing of bridge driver on actual HW.
>  - Remove unnecessary initializations (Stephen Boyd).
>  - Use local refclk lut size instead of global macro (Sean Paul).
>
> Changes in v10:
>  - Use refclk to determine if continuous dsi clock is needed or not.
>
> Changes in v11:
>  - Read DPPLL_SRC register to determine continuous clock instead of
>using refclk handle (Stephen Boyd).
>
> Changes in v12:
>  - Explain in comment as in why dsi dev registration is done in
>bridge_attach (Andrzej Hajda).
>  - Move HPD disable to bridge_pre_enable (Andrzej Hajda).
>  - Make panel/DDC exclusive until HPD support is added (Andrzej Hajda).
>
> Changes in v13:
>  - eDP panels report EDID via DP-AUX channel, so remove support for
>dedicated DDC line (Andrzej Hajda).
>
> Changes in v14:
>  - Remove unnecessary drm_panel checks (Andrzej Hajda).
>
> Signed-off-by: Sandeep Panda 

I will queue both patches to drm-misc.

Reviewed-by: Andrzej Hajda 

 --
Regards
Andrzej


___

Re: y4T�TCH 4/4] drm/amdgpu: Add audio component support

2018-07-26 Thread jimqu



On 2018年07月25日 16:20, Takashi Iwai wrote:

On Wed, 25 Jul 2018 10:02:34 +0200,
jimqu wrote:



On 2018年07月25日 13:46, Takashi Iwai wrote:

On Wed, 25 Jul 2018 07:38:37 +0200,
Qu, Jim wrote:

Jim: Just like Alex said, we want driver can get eld info when hotplug in new 
device. amdgpu driver is a bit difference from radeon driver, it is not a 
suitable place to call notify() function in *_audio_enable() , since they are 
not in the hotplug process context like them in radeon driver, but the mode 
setting.

IMO, the right place to call notify() function is also in the 
amdgpu_connector__detect() in amdgpu_connector.c.

Hm, but by the modesetting, it actually enables / disables the audio
as well, no?  If so, the notifier is exactly for that purpose.  The
audio driver needs to know not only about the physical connection but
whether the audio can be actually driven.

That is, even if the monitor is connected, the audio won't come out if
the mode is off.  That is equivalent with the unplugged state for the
audio driver.

The i915 driver deals with the notifier just like the above, so the
behavior is intentional.


thanks,

Takashi

I am afraid if device hotplug out, how is audio state if it follow up
eld info? Since the modesetting is never performed for the display
which is plugged out, so there is no notify() call on it.

In principle, the HDMI audio just needs to follows the video state,
and it doesn't need to care actual physical connections.  As long as
video can go out, it's fine, audio can, too.  When video is disabled
(even if connected), audio can't be used as well, so it must follow to
off, too.  The notifier is used to follow this video state change.

Practically seen, the user-space shall switch off the video
accordingly upon hot unplug, then the audio notifier is sent, and the
audio gets off, too.


thanks,

Takashi


Ok, that means there are other code pathes to update audio state. 
Anyway, for patch 3/4 Acked-by: Jim Qu 

There may be other concerns from Alex/Christian.

Thanks
JimQu

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


linux-next: manual merge of the drm tree with the v4l-dvb tree

2018-07-26 Thread Stephen Rothwell
Hi all,

Today's linux-next merge of the drm tree got a conflict in:

  drivers/gpu/ipu-v3/ipu-cpmem.c

between commit:

  343b23a7c6b6 ("media: gpu: ipu-v3: Allow negative offsets for interlaced 
scanning")

from the v4l-dvb tree and commit:

  4e3c5d7e05be ("gpu: ipu-v3: Allow negative offsets for interlaced scanning")

from the drm tree.

I fixed it up (I just used the drm tree version) and can carry the fix
as necessary. This is now fixed as far as linux-next is concerned, but
any non trivial conflicts should be mentioned to your upstream maintainer
when your tree is submitted for merging.  You may also want to consider
cooperating with the maintainer of the conflicting tree to minimise any
particularly complex conflicts.



-- 
Cheers,
Stephen Rothwell


pgpMkY3o6UKqm.pgp
Description: OpenPGP digital signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[git pull] drm fixes for 4.18-rc7

2018-07-26 Thread Dave Airlie
Hi Linus,

Not much happening this week which is good, two imx display fixes and
one i915 quirk addition.

Dave.

drm-fixes-2018-07-27:
two imx fixes and one i915 fix.
The following changes since commit d72e90f33aa4709ebecc5005562f52335e106a60:

  Linux 4.18-rc6 (2018-07-22 14:12:20 -0700)

are available in the Git repository at:

  git://anongit.freedesktop.org/drm/drm tags/drm-fixes-2018-07-27

for you to fetch changes up to 050d2a5533af362932553cb47fd5db9a3476074e:

  Merge tag 'imx-drm-fixes-2018-07-20' of
git://git.pengutronix.de/git/pza/linux into drm-fixes (2018-07-27
12:17:31 +1000)


two imx fixes and one i915 fix.


Clint Taylor (1):
  drm/i915/glk: Add Quirk for GLK NUC HDMI port issues.

Dave Airlie (2):
  Merge tag 'drm-intel-fixes-2018-07-26' of
git://anongit.freedesktop.org/drm/drm-intel into drm-fixes
  Merge tag 'imx-drm-fixes-2018-07-20' of
git://git.pengutronix.de/git/pza/linux into drm-fixes

Lucas Stach (2):
  drm/imx: imx-ldb: disable LDB on driver bind
  drm/imx: imx-ldb: check if channel is enabled before printing warning

Steve Longerbeam (1):
  gpu: ipu-csi: Check for field type alternate

 drivers/gpu/drm/i915/i915_drv.h  |  1 +
 drivers/gpu/drm/i915/intel_ddi.c | 13 +++--
 drivers/gpu/drm/i915/intel_display.c | 21 -
 drivers/gpu/drm/i915/intel_drv.h |  3 +--
 drivers/gpu/drm/imx/imx-ldb.c|  9 ++---
 drivers/gpu/ipu-v3/ipu-csi.c |  3 ++-
 6 files changed, 41 insertions(+), 9 deletions(-)
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2 0/4] drm/ttm: move non-x86 definitions to the common header

2018-07-26 Thread Huang Rui
On Thu, Jul 26, 2018 at 08:12:05PM +0800, Koenig, Christian wrote:
> Am 26.07.2018 um 13:59 schrieb Bas Nieuwenhuizen:
> > On Thu, Jul 26, 2018 at 1:52 PM, Huang Rui  wrote:
> >> Hi,
> >>
> >> As suggested by Christian, we should move non-x86 definitions into one 
> >> common
> >> header, and it will make the codes readable. They are based on the 
> >> improvement
> >> fix of Bas (already rebase Bas's patch to drm-next).
> >>
> >> Changes from V1 -> V2:
> >> - add ttm_ prefix at this header.
> >> - use set_pages_wb instead of set_memory_wb.
> > Thanks! For the series
> 
> Agreed, really nice cleanup.
> 
> > Reviewed-by: Bas Nieuwenhuizen 
> 
> Reviewed-by: Christian König  as well.
> 

Thank you, guys. :-)
Already applied them.

Ray

> Regards,
> Christian.
> 
> >> Thanks,
> >> Ray
> >>
> >> Bas Nieuwenhuizen (1):
> >>drm/ttm: Merge hugepage attr changes in ttm_dma_page_put. (v2)
> >>
> >> Huang Rui (3):
> >>drm/ttm: add ttm_set_memory header (v2)
> >>drm/ttm: clean up non-x86 definitions on ttm_page_alloc_dma
> >>drm/ttm: clean up non-x86 definitions on ttm_page_alloc
> >>
> >>   drivers/gpu/drm/ttm/ttm_page_alloc.c |  62 ++-
> >>   drivers/gpu/drm/ttm/ttm_page_alloc_dma.c |  57 ++
> >>   include/drm/ttm/ttm_set_memory.h | 128 
> >> +++
> >>   3 files changed, 140 insertions(+), 107 deletions(-)
> >>   create mode 100644 include/drm/ttm/ttm_set_memory.h
> >>
> >> --
> >> 2.7.4
> >>
> 
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [Freedreno] [PATCH 0/5] drm/msm/dpu: Remove dead code

2018-07-26 Thread Rob Clark
On Thu, Jul 26, 2018 at 4:30 PM, Jordan Crouse  wrote:
> I made a silly little script that looked at the defined symbols
> in nm and then looked to see if other files in the module used
> those symbols and if they didn't they were either candidates
> for removal or to be made static. This is the result.
>
> I split the code into per-file chunks for easier review and
> to make it easier for the developers to object to any given removal
> but I have no qualms if Sean or Rob want to squash these together
> in the final patch.

nice, I was wishing for such a script the other day when I noticed a
few unused things..

I'm ok to leave these unsquashed.. I guess in the best case that makes
it easier to resurrect appropriate hunks if they become un-dead in the
future..

BR,
-R


>
> Jordan Crouse (5):
>   drm/msm/disp/dpu: Remove unused code from drm_encoder.c
>   drm/msm/disp/dpu: Remove unused code from drm_crtc.c
>   drm/msm/disp/dpu: Remove dpu_kms_utils
>   drm/msm/disp/dpu: Remove unused functions from dpu_formats.c
>   drm/msm/disp/dpu: Mark a handful of functions as static
>
>  drivers/gpu/drm/msm/Makefile  |   1 -
>  drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c  | 383 +-
>  drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h  |  61 ---
>  drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c   |  87 +---
>  drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h   |  14 -
>  .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h  |  23 --
>  .../drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c  |   2 +-
>  drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c   |  43 +-
>  drivers/gpu/drm/msm/disp/dpu1/dpu_formats.h   |  48 ---
>  .../gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c|   2 +-
>  drivers/gpu/drm/msm/disp/dpu1/dpu_hw_cdm.c|   4 +-
>  drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.c|   2 +-
>  drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c   |  84 
>  drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h   |  10 -
>  drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c   |   2 +-
>  drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h   | 112 -
>  drivers/gpu/drm/msm/disp/dpu1/dpu_kms_utils.c | 153 ---
>  drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c  |   2 +-
>  18 files changed, 15 insertions(+), 1018 deletions(-)
>  delete mode 100644 drivers/gpu/drm/msm/disp/dpu1/dpu_kms_utils.c
>
> --
> 2.18.0
>
> ___
> Freedreno mailing list
> freedr...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/freedreno
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 105760] [4.17-rc1] RIP: smu7_populate_single_firmware_entry.isra.6+0x57/0xc0 [amdgpu] RSP: ffffa17901efb930

2018-07-26 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105760

--- Comment #56 from Thomas Martitz  ---
Created attachment 140846
  --> https://bugs.freedesktop.org/attachment.cgi?id=140846&action=edit
fixed hack.patch

-- 
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 105760] [4.17-rc1] RIP: smu7_populate_single_firmware_entry.isra.6+0x57/0xc0 [amdgpu] RSP: ffffa17901efb930

2018-07-26 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105760

Thomas Martitz  changed:

   What|Removed |Added

 Attachment #140356|0   |1
is obsolete||
 Attachment #140585|0   |1
is obsolete||
 Attachment #140611|0   |1
is obsolete||
 Attachment #140660|0   |1
is obsolete||

--- Comment #55 from Thomas Martitz  ---
Created attachment 140845
  --> https://bugs.freedesktop.org/attachment.cgi?id=140845&action=edit
dmesg + Karols hack

No, unfortunately, the GPU is unusable after resume, but the dmesg output is
different now.

FWIW, in this case I have booted with pcie_port_pm=off which I feel improves
things on my system (but it's nowhere a solution), since I think the GPU is
behind a PCIe bridge to which the TB3 port is also connected, and I found in
the source that bridge pm should be disabled if there are TB3 ports behind due
to hotplug.

Without pcie_port_pm the behavior is almost the same, except that dmesg shows
lots of powerplay error messages that don't occur in the attached output
(again, made with pcie_port_pm=off).

Karol's patch didn't apply cleanly onto drm-next-4.19-wip, so I made some
changes, perhaps you may check if it's still equivalent (will attach with the
next comment.

-- 
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 107390] [BISECTED] EDID read failure breaks display mirroring

2018-07-26 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=107390

--- Comment #5 from Alex Deucher  ---
did you find ac916c914c3156e53505e9ea3a9d1495518bf873 as the problematic by
bisection?  If so, does reverting it fix the problem?  If not, can you bisect
and verify that this is the actual commit that causes the problem?

-- 
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 107390] [BISECTED] EDID read failure breaks display mirroring

2018-07-26 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=107390

Alex Deucher  changed:

   What|Removed |Added

 Attachment #140839|text/x-log  |text/plain
  mime type||

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


[PATCH 1/5] drm/msm/disp/dpu: Remove unused code from drm_encoder.c

2018-07-26 Thread Jordan Crouse
Remove dpu_encoder_check_mode and dpu_encoder_helper_hw_release
frmo drm_encoder.c as they appear to be unused.

Signed-off-by: Jordan Crouse 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c   | 80 ---
 drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h   |  8 --
 .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h  |  9 ---
 3 files changed, 97 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
index 27775feed32b..5c0051af5e98 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
@@ -1627,22 +1627,6 @@ static void _dpu_encoder_kickoff_phys(struct 
dpu_encoder_virt *dpu_enc)
spin_unlock_irqrestore(&dpu_enc->enc_spinlock, lock_flags);
 }
 
-bool dpu_encoder_check_mode(struct drm_encoder *drm_enc, u32 mode)
-{
-   struct dpu_encoder_virt *dpu_enc;
-   struct msm_display_info *disp_info;
-
-   if (!drm_enc) {
-   DPU_ERROR("invalid encoder\n");
-   return false;
-   }
-
-   dpu_enc = to_dpu_encoder_virt(drm_enc);
-   disp_info = &dpu_enc->disp_info;
-
-   return (disp_info->capabilities & mode);
-}
-
 void dpu_encoder_trigger_kickoff_pending(struct drm_encoder *drm_enc)
 {
struct dpu_encoder_virt *dpu_enc;
@@ -1903,70 +1887,6 @@ void dpu_encoder_kickoff(struct drm_encoder *drm_enc)
DPU_ATRACE_END("encoder_kickoff");
 }
 
-int dpu_encoder_helper_hw_release(struct dpu_encoder_phys *phys_enc,
-   struct drm_framebuffer *fb)
-{
-   struct drm_encoder *drm_enc;
-   struct dpu_hw_mixer_cfg mixer;
-   struct dpu_rm_hw_iter lm_iter;
-   bool lm_valid = false;
-
-   if (!phys_enc || !phys_enc->parent) {
-   DPU_ERROR("invalid encoder\n");
-   return -EINVAL;
-   }
-
-   drm_enc = phys_enc->parent;
-   memset(&mixer, 0, sizeof(mixer));
-
-   /* reset associated CTL/LMs */
-   if (phys_enc->hw_ctl->ops.clear_pending_flush)
-   phys_enc->hw_ctl->ops.clear_pending_flush(phys_enc->hw_ctl);
-   if (phys_enc->hw_ctl->ops.clear_all_blendstages)
-   phys_enc->hw_ctl->ops.clear_all_blendstages(phys_enc->hw_ctl);
-
-   dpu_rm_init_hw_iter(&lm_iter, drm_enc->base.id, DPU_HW_BLK_LM);
-   while (dpu_rm_get_hw(&phys_enc->dpu_kms->rm, &lm_iter)) {
-   struct dpu_hw_mixer *hw_lm = (struct dpu_hw_mixer *)lm_iter.hw;
-
-   if (!hw_lm)
-   continue;
-
-   /* need to flush LM to remove it */
-   if (phys_enc->hw_ctl->ops.get_bitmask_mixer &&
-   phys_enc->hw_ctl->ops.update_pending_flush)
-   phys_enc->hw_ctl->ops.update_pending_flush(
-   phys_enc->hw_ctl,
-   phys_enc->hw_ctl->ops.get_bitmask_mixer(
-   phys_enc->hw_ctl, hw_lm->idx));
-
-   if (fb) {
-   /* assume a single LM if targeting a frame buffer */
-   if (lm_valid)
-   continue;
-
-   mixer.out_height = fb->height;
-   mixer.out_width = fb->width;
-
-   if (hw_lm->ops.setup_mixer_out)
-   hw_lm->ops.setup_mixer_out(hw_lm, &mixer);
-   }
-
-   lm_valid = true;
-
-   /* only enable border color on LM */
-   if (phys_enc->hw_ctl->ops.setup_blendstage)
-   phys_enc->hw_ctl->ops.setup_blendstage(
-   phys_enc->hw_ctl, hw_lm->idx, NULL);
-   }
-
-   if (!lm_valid) {
-   DPU_DEBUG_ENC(to_dpu_encoder_virt(drm_enc), "lm not found\n");
-   return -EFAULT;
-   }
-   return 0;
-}
-
 void dpu_encoder_prepare_commit(struct drm_encoder *drm_enc)
 {
struct dpu_encoder_virt *dpu_enc;
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h
index ce92901ed227..204e538b0b74 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h
@@ -139,14 +139,6 @@ enum dpu_intf_mode dpu_encoder_get_intf_mode(struct 
drm_encoder *encoder);
  */
 void dpu_encoder_virt_restore(struct drm_encoder *encoder);
 
-/**
- * dpu_encoder_check_mode - check if given mode is supported or not
- * @drm_enc: Pointer to drm encoder object
- * @mode: Mode to be checked
- * @Return: true if it is cmd mode
- */
-bool dpu_encoder_check_mode(struct drm_encoder *drm_enc, u32 mode);
-
 /**
  * dpu_encoder_init - initialize virtual encoder object
  * @dev:Pointer to drm device structure
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h
index 8505edddcc81..dacec1c8eeeb 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h
++

[PATCH 5/5] drm/msm/disp/dpu: Mark a handful of functions as static

2018-07-26 Thread Jordan Crouse
Mark a number of static functions that are only unsed in the file
that defines them and remove the prototypes from the headers where
needed.

Signed-off-by: Jordan Crouse 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c |  7 +--
 drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h |  6 --
 .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h| 14 --
 .../drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c|  2 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c |  2 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_formats.h | 17 -
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c  |  2 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_cdm.c  |  4 ++--
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.c  |  2 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c |  2 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c|  2 +-
 11 files changed, 13 insertions(+), 47 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
index 5c0051af5e98..0bd3eda93e22 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
@@ -264,6 +264,9 @@ void dpu_encoder_helper_report_irq_timeout(struct 
dpu_encoder_phys *phys_enc,
DPU_ENCODER_FRAME_EVENT_ERROR);
 }
 
+static int dpu_encoder_helper_wait_event_timeout(int32_t drm_id,
+   int32_t hw_id, struct dpu_encoder_wait_info *info);
+
 int dpu_encoder_helper_wait_for_irq(struct dpu_encoder_phys *phys_enc,
enum dpu_intr_idx intr_idx,
struct dpu_encoder_wait_info *wait_info)
@@ -467,7 +470,7 @@ void dpu_encoder_get_hw_resources(struct drm_encoder 
*drm_enc,
}
 }
 
-void dpu_encoder_destroy(struct drm_encoder *drm_enc)
+static void dpu_encoder_destroy(struct drm_encoder *drm_enc)
 {
struct dpu_encoder_virt *dpu_enc = NULL;
int i = 0;
@@ -1516,7 +1519,7 @@ void dpu_encoder_helper_trigger_start(struct 
dpu_encoder_phys *phys_enc)
}
 }
 
-int dpu_encoder_helper_wait_event_timeout(
+static int dpu_encoder_helper_wait_event_timeout(
int32_t drm_id,
int32_t hw_id,
struct dpu_encoder_wait_info *info)
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h
index 204e538b0b74..60f809fc7c13 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h
@@ -158,12 +158,6 @@ struct drm_encoder *dpu_encoder_init(
 int dpu_encoder_setup(struct drm_device *dev, struct drm_encoder *enc,
struct msm_display_info *disp_info);
 
-/**
- * dpu_encoder_destroy - destroy previously initialized virtual encoder
- * @drm_enc:Pointer to previously created drm encoder structure
- */
-void dpu_encoder_destroy(struct drm_encoder *drm_enc);
-
 /**
  * dpu_encoder_prepare_commit - prepare encoder at the very beginning of an
  * atomic commit, before any registers are written
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h
index dacec1c8eeeb..c7df8aad6613 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h
@@ -355,20 +355,6 @@ struct dpu_encoder_phys *dpu_encoder_phys_cmd_init(
  */
 void dpu_encoder_helper_trigger_start(struct dpu_encoder_phys *phys_enc);
 
-/**
- * dpu_encoder_helper_wait_event_timeout - wait for event with timeout
- * taking into account that jiffies may jump between reads leading to
- * incorrectly detected timeouts. Prevent failure in this scenario by
- * making sure that elapsed time during wait is valid.
- * @drm_id: drm object id for logging
- * @hw_id: hw instance id for logging
- * @info: wait info structure
- */
-int dpu_encoder_helper_wait_event_timeout(
-   int32_t drm_id,
-   int32_t hw_id,
-   struct dpu_encoder_wait_info *info);
-
 /**
  * dpu_encoder_helper_hw_reset - issue ctl hw reset
  * This helper function may be optionally specified by physical
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c
index e6d02c6947b4..3084675ed425 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c
@@ -349,7 +349,7 @@ static int dpu_encoder_phys_cmd_control_vblank_irq(
return ret;
 }
 
-void dpu_encoder_phys_cmd_irq_control(struct dpu_encoder_phys *phys_enc,
+static void dpu_encoder_phys_cmd_irq_control(struct dpu_encoder_phys *phys_enc,
bool enable)
 {
struct dpu_encoder_phys_cmd *cmd_enc;
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c
index 0cb00612f96f..bfcd165e96df 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c
@@ -846,7 +846,7 @@ static int _dp

[PATCH 3/5] drm/msm/disp/dpu: Remove dpu_kms_utils

2018-07-26 Thread Jordan Crouse
None of the functions in dpu_kms_utils.c seem to be used so
remove them all.

Signed-off-by: Jordan Crouse 
---
 drivers/gpu/drm/msm/Makefile  |   1 -
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h   | 112 -
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms_utils.c | 153 --
 3 files changed, 266 deletions(-)
 delete mode 100644 drivers/gpu/drm/msm/disp/dpu1/dpu_kms_utils.c

diff --git a/drivers/gpu/drm/msm/Makefile b/drivers/gpu/drm/msm/Makefile
index 1639ea8c0d13..7c773e003663 100644
--- a/drivers/gpu/drm/msm/Makefile
+++ b/drivers/gpu/drm/msm/Makefile
@@ -68,7 +68,6 @@ msm-y := \
disp/dpu1/dpu_io_util.o \
disp/dpu1/dpu_irq.o \
disp/dpu1/dpu_kms.o \
-   disp/dpu1/dpu_kms_utils.o \
disp/dpu1/dpu_mdss.o \
disp/dpu1/dpu_plane.o \
disp/dpu1/dpu_power_handle.o \
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h
index 407c1ed27fe6..66d466628e2b 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h
@@ -270,118 +270,6 @@ void *dpu_debugfs_get_root(struct dpu_kms *dpu_kms);
  */
 #define DPU_KMS_INFO_MAX_SIZE  4096
 
-/**
- * struct dpu_kms_info - connector information structure container
- * @data: Array of information character data
- * @len: Current length of information data
- * @staged_len: Temporary data buffer length, commit to
- *  len using dpu_kms_info_stop
- * @start: Whether or not a partial data entry was just started
- */
-struct dpu_kms_info {
-   char data[DPU_KMS_INFO_MAX_SIZE];
-   uint32_t len;
-   uint32_t staged_len;
-   bool start;
-};
-
-/**
- * DPU_KMS_INFO_DATA - Macro for accessing dpu_kms_info data bytes
- * @S: Pointer to dpu_kms_info structure
- * Returns: Pointer to byte data
- */
-#define DPU_KMS_INFO_DATA(S)((S) ? ((struct dpu_kms_info *)(S))->data : 0)
-
-/**
- * DPU_KMS_INFO_DATALEN - Macro for accessing dpu_kms_info data length
- * it adds an extra character length to count null.
- * @S: Pointer to dpu_kms_info structure
- * Returns: Size of available byte data
- */
-#define DPU_KMS_INFO_DATALEN(S) ((S) ? ((struct dpu_kms_info *)(S))->len + 1 \
-   : 0)
-
-/**
- * dpu_kms_info_reset - reset dpu_kms_info structure
- * @info: Pointer to dpu_kms_info structure
- */
-void dpu_kms_info_reset(struct dpu_kms_info *info);
-
-/**
- * dpu_kms_info_add_keyint - add integer value to 'dpu_kms_info'
- * @info: Pointer to dpu_kms_info structure
- * @key: Pointer to key string
- * @value: Signed 64-bit integer value
- */
-void dpu_kms_info_add_keyint(struct dpu_kms_info *info,
-   const char *key,
-   int64_t value);
-
-/**
- * dpu_kms_info_add_keystr - add string value to 'dpu_kms_info'
- * @info: Pointer to dpu_kms_info structure
- * @key: Pointer to key string
- * @value: Pointer to string value
- */
-void dpu_kms_info_add_keystr(struct dpu_kms_info *info,
-   const char *key,
-   const char *value);
-
-/**
- * dpu_kms_info_start - begin adding key to 'dpu_kms_info'
- * Usage:
- *  dpu_kms_info_start(key)
- *  dpu_kms_info_append(val_1)
- *  ...
- *  dpu_kms_info_append(val_n)
- *  dpu_kms_info_stop
- * @info: Pointer to dpu_kms_info structure
- * @key: Pointer to key string
- */
-void dpu_kms_info_start(struct dpu_kms_info *info,
-   const char *key);
-
-/**
- * dpu_kms_info_append - append value string to 'dpu_kms_info'
- * Usage:
- *  dpu_kms_info_start(key)
- *  dpu_kms_info_append(val_1)
- *  ...
- *  dpu_kms_info_append(val_n)
- *  dpu_kms_info_stop
- * @info: Pointer to dpu_kms_info structure
- * @str: Pointer to partial value string
- */
-void dpu_kms_info_append(struct dpu_kms_info *info,
-   const char *str);
-
-/**
- * dpu_kms_info_append_format - append format code string to 'dpu_kms_info'
- * Usage:
- *  dpu_kms_info_start(key)
- *  dpu_kms_info_append_format(fourcc, modifier)
- *  ...
- *  dpu_kms_info_stop
- * @info: Pointer to dpu_kms_info structure
- * @pixel_format: FOURCC format code
- * @modifier: 64-bit drm format modifier
- */
-void dpu_kms_info_append_format(struct dpu_kms_info *info,
-   uint32_t pixel_format,
-   uint64_t modifier);
-
-/**
- * dpu_kms_info_stop - finish adding key to 'dpu_kms_info'
- * Usage:
- *  dpu_kms_info_start(key)
- *  dpu_kms_info_append(val_1)
- *  ...
- *  dpu_kms_info_append(val_n)
- *  dpu_kms_info_stop
- * @info: Pointer to dpu_kms_info structure
- */
-void dpu_kms_info_stop(struct dpu_kms_info *info);
-
 /**
  * Vblank enable/disable functions
  */
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms_utils.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms_utils.c
deleted file mode 100644
index a80b3da5a9fe..
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms_utils.c
+++ /dev/null
@@ -1,153 +0,0 @@
-/

[PATCH 2/5] drm/msm/disp/dpu: Remove unused code from drm_crtc.c

2018-07-26 Thread Jordan Crouse
Remove a chunk of unused code from drm_crtc.c, namely
dpu_crtc_res_add, dpu_crtc_res_get, dpu_crtc_res_put
and associated static functions.

Also zap dpu_crtc_event_queue(), helper functions
and members.

Signed-off-by: Jordan Crouse 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 383 +--
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h |  61 
 2 files changed, 2 insertions(+), 442 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
index 7ac0e0dda866..80cbf75bc2ff 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
@@ -280,289 +280,6 @@ static void _dpu_crtc_rp_reset(struct dpu_crtc_respool 
*rp,
mutex_unlock(rp_lock);
 }
 
-/**
- * _dpu_crtc_rp_add_no_lock - add given resource to resource pool without lock
- * @rp: Pointer to original resource pool
- * @type: Resource type
- * @tag: Search tag for given resource
- * @val: Resource handle
- * @ops: Resource callback operations
- * return: 0 if success; error code otherwise
- */
-static int _dpu_crtc_rp_add_no_lock(struct dpu_crtc_respool *rp, u32 type,
-   u64 tag, void *val, struct dpu_crtc_res_ops *ops)
-{
-   struct dpu_crtc_res *res;
-   struct drm_crtc *crtc;
-
-   if (!rp || !ops) {
-   DPU_ERROR("invalid resource pool/ops\n");
-   return -EINVAL;
-   }
-
-   crtc = _dpu_crtc_rp_to_crtc(rp);
-   if (!crtc) {
-   DPU_ERROR("invalid crtc\n");
-   return -EINVAL;
-   }
-
-   list_for_each_entry(res, &rp->res_list, list) {
-   if (res->type != type || res->tag != tag)
-   continue;
-   DPU_ERROR("crtc%d.%u already exist res:0x%x/0x%llx/%pK/%d\n",
-   crtc->base.id, rp->sequence_id,
-   res->type, res->tag, res->val,
-   atomic_read(&res->refcount));
-   return -EEXIST;
-   }
-   res = kzalloc(sizeof(struct dpu_crtc_res), GFP_KERNEL);
-   if (!res)
-   return -ENOMEM;
-   INIT_LIST_HEAD(&res->list);
-   atomic_set(&res->refcount, 1);
-   res->type = type;
-   res->tag = tag;
-   res->val = val;
-   res->ops = *ops;
-   list_add_tail(&res->list, &rp->res_list);
-   DPU_DEBUG("crtc%d.%u added res:0x%x/0x%llx\n",
-   crtc->base.id, rp->sequence_id, type, tag);
-   return 0;
-}
-
-/**
- * _dpu_crtc_rp_add - add given resource to resource pool
- * @rp: Pointer to original resource pool
- * @type: Resource type
- * @tag: Search tag for given resource
- * @val: Resource handle
- * @ops: Resource callback operations
- * return: 0 if success; error code otherwise
- */
-static int _dpu_crtc_rp_add(struct dpu_crtc_respool *rp, u32 type, u64 tag,
-   void *val, struct dpu_crtc_res_ops *ops)
-{
-   int rc;
-
-   if (!rp) {
-   DPU_ERROR("invalid resource pool\n");
-   return -EINVAL;
-   }
-
-   mutex_lock(rp->rp_lock);
-   rc = _dpu_crtc_rp_add_no_lock(rp, type, tag, val, ops);
-   mutex_unlock(rp->rp_lock);
-   return rc;
-}
-
-/**
- * _dpu_crtc_rp_get - lookup the resource from given resource pool and obtain
- * if available; otherwise, obtain resource from global pool
- * @rp: Pointer to original resource pool
- * @type: Resource type
- * @tag:  Search tag for given resource
- * return: Resource handle if success; pointer error or null otherwise
- */
-static void *_dpu_crtc_rp_get(struct dpu_crtc_respool *rp, u32 type, u64 tag)
-{
-   struct dpu_crtc_respool *old_rp;
-   struct dpu_crtc_res *res;
-   void *val = NULL;
-   int rc;
-   struct drm_crtc *crtc;
-
-   if (!rp) {
-   DPU_ERROR("invalid resource pool\n");
-   return NULL;
-   }
-
-   crtc = _dpu_crtc_rp_to_crtc(rp);
-   if (!crtc) {
-   DPU_ERROR("invalid crtc\n");
-   return NULL;
-   }
-
-   mutex_lock(rp->rp_lock);
-   list_for_each_entry(res, &rp->res_list, list) {
-   if (res->type != type || res->tag != tag)
-   continue;
-   DPU_DEBUG("crtc%d.%u found res:0x%x/0x%llx/%pK/%d\n",
-   crtc->base.id, rp->sequence_id,
-   res->type, res->tag, res->val,
-   atomic_read(&res->refcount));
-   atomic_inc(&res->refcount);
-   res->flags &= ~DPU_CRTC_RES_FLAG_FREE;
-   mutex_unlock(rp->rp_lock);
-   return res->val;
-   }
-   list_for_each_entry(res, &rp->res_list, list) {
-   if (res->type != type || !(res->flags & DPU_CRTC_RES_FLAG_FREE))
-   continue;
-   DPU_DEBUG("crtc%d.%u retag res:0x%x/0x%llx/%pK/%d\n",
-   crtc->base.id, rp->sequence_id,
-  

[PATCH 0/5] drm/msm/dpu: Remove dead code

2018-07-26 Thread Jordan Crouse
I made a silly little script that looked at the defined symbols
in nm and then looked to see if other files in the module used
those symbols and if they didn't they were either candidates
for removal or to be made static. This is the result.

I split the code into per-file chunks for easier review and
to make it easier for the developers to object to any given removal
but I have no qualms if Sean or Rob want to squash these together
in the final patch.

Jordan Crouse (5):
  drm/msm/disp/dpu: Remove unused code from drm_encoder.c
  drm/msm/disp/dpu: Remove unused code from drm_crtc.c
  drm/msm/disp/dpu: Remove dpu_kms_utils
  drm/msm/disp/dpu: Remove unused functions from dpu_formats.c
  drm/msm/disp/dpu: Mark a handful of functions as static

 drivers/gpu/drm/msm/Makefile  |   1 -
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c  | 383 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h  |  61 ---
 drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c   |  87 +---
 drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h   |  14 -
 .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h  |  23 --
 .../drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c  |   2 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c   |  43 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_formats.h   |  48 ---
 .../gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c|   2 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_cdm.c|   4 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.c|   2 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c   |  84 
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h   |  10 -
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c   |   2 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h   | 112 -
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms_utils.c | 153 ---
 drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c  |   2 +-
 18 files changed, 15 insertions(+), 1018 deletions(-)
 delete mode 100644 drivers/gpu/drm/msm/disp/dpu1/dpu_kms_utils.c

-- 
2.18.0

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


[PATCH 4/5] drm/msm/disp/dpu: Remove unused functions from dpu_formats.c

2018-07-26 Thread Jordan Crouse
Remove dpu_format_get_block_size, dpu_format_get_framebuffer_size,
dpu_set_scaler_v2 and dpu_copy_formats they are unused and unneeded.

Signed-off-by: Jordan Crouse 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c | 41 --
 drivers/gpu/drm/msm/disp/dpu1/dpu_formats.h | 31 
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c | 84 -
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h | 10 ---
 4 files changed, 166 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c
index 8189539b0620..0cb00612f96f 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c
@@ -869,47 +869,6 @@ int dpu_format_get_plane_sizes(
return _dpu_format_get_plane_sizes_linear(fmt, w, h, layout, pitches);
 }
 
-int dpu_format_get_block_size(const struct dpu_format *fmt,
-   uint32_t *w, uint32_t *h)
-{
-   if (!fmt || !w || !h) {
-   DRM_ERROR("invalid pointer\n");
-   return -EINVAL;
-   }
-
-   /* TP10 is 96x96 and all others are 128x128 */
-   if (DPU_FORMAT_IS_YUV(fmt) && DPU_FORMAT_IS_DX(fmt) &&
-   (fmt->num_planes == 2) && fmt->unpack_tight)
-   *w = *h = 96;
-   else
-   *w = *h = 128;
-
-   return 0;
-}
-
-uint32_t dpu_format_get_framebuffer_size(
-   const uint32_t format,
-   const uint32_t width,
-   const uint32_t height,
-   const uint32_t *pitches,
-   const uint64_t modifiers)
-{
-   const struct dpu_format *fmt;
-   struct dpu_hw_fmt_layout layout;
-
-   fmt = dpu_get_dpu_format_ext(format, modifiers);
-   if (!fmt)
-   return 0;
-
-   if (!pitches)
-   return -EINVAL;
-
-   if (dpu_format_get_plane_sizes(fmt, width, height, &layout, pitches))
-   layout.total_size = 0;
-
-   return layout.total_size;
-}
-
 static int _dpu_format_populate_addrs_ubwc(
struct msm_gem_address_space *aspace,
struct drm_framebuffer *fb,
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.h 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.h
index b55bfd13e296..b3a6592f1a8a 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.h
@@ -72,19 +72,6 @@ int dpu_format_get_plane_sizes(
struct dpu_hw_fmt_layout *layout,
const uint32_t *pitches);
 
-/**
- * dpu_format_get_block_size - get block size of given format when
- * operating in block mode
- * @fmt: pointer to dpu_format
- * @w:   pointer to width of the block
- * @h:   pointer to height of the block
- *
- * Return: 0 if success; error oode otherwise
- */
-int dpu_format_get_block_size(const struct dpu_format *fmt,
-   uint32_t *w, uint32_t *h);
-
-/**
  * dpu_format_check_modified_format - validate format and buffers for
  *   dpu non-standard, i.e. modified format
  * @kms: kms driver
@@ -115,22 +102,4 @@ int dpu_format_populate_layout(
struct drm_framebuffer *fb,
struct dpu_hw_fmt_layout *fmtl);
 
-/**
- * dpu_format_get_framebuffer_size - get framebuffer memory size
- * @format:DRM pixel format
- * @width: pixel width
- * @height:pixel height
- * @pitches:   array of size [DPU_MAX_PLANES] to populate
- *pitch for each plane
- * @modifiers: drm modifier
- *
- * Return: memory size required for frame buffer
- */
-uint32_t dpu_format_get_framebuffer_size(
-   const uint32_t format,
-   const uint32_t width,
-   const uint32_t height,
-   const uint32_t *pitches,
-   const uint64_t modifiers);
-
 #endif /*_DPU_FORMATS_H */
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c
index 1ba571e94b32..4cabae480a7b 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c
@@ -92,59 +92,6 @@ u32 *dpu_hw_util_get_log_mask_ptr(void)
return &dpu_hw_util_log_mask;
 }
 
-void dpu_set_scaler_v2(struct dpu_hw_scaler3_cfg *cfg,
-   const struct dpu_drm_scaler_v2 *scale_v2)
-{
-   int i;
-
-   cfg->enable = scale_v2->enable;
-   cfg->dir_en = scale_v2->dir_en;
-
-   for (i = 0; i < DPU_MAX_PLANES; i++) {
-   cfg->init_phase_x[i] = scale_v2->init_phase_x[i];
-   cfg->phase_step_x[i] = scale_v2->phase_step_x[i];
-   cfg->init_phase_y[i] = scale_v2->init_phase_y[i];
-   cfg->phase_step_y[i] = scale_v2->phase_step_y[i];
-
-   cfg->preload_x[i] = scale_v2->preload_x[i];
-   cfg->preload_y[i] = scale_v2->preload_y[i];
-   cfg->src_width[i] = scale_v2->src_width[i];
-   cfg-

Re: [PATCH v2 01/10] drm/atomic: Add __drm_atomic_helper_plane_reset

2018-07-26 Thread Laurent Pinchart
Hi Alexandru,

Thank you for the patch.

On Thursday, 26 July 2018 19:17:47 EEST Alexandru Gheorghe wrote:
> There are a lot of drivers that subclass drm_plane_state, all of them
> duplicate the code that links toghether the plane with plane_state.

s/toghether/together/

> On top of that, drivers that enable core properties also have to
> duplicate the code for initializing the properties to their default
> values, which in all cases are the same as the defaults from core.
> 
> Change since v1:
> - Make it consistent with the other helpers and require that both
>   plane and state not be NULL, suggested by Boris Brezillon and
>   Philipp Zabel.
> 
> Signed-off-by: Alexandru Gheorghe 
> ---
>  drivers/gpu/drm/drm_atomic_helper.c | 31 -
>  include/drm/drm_atomic_helper.h |  2 ++
>  2 files changed, 24 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c
> b/drivers/gpu/drm/drm_atomic_helper.c index 866a2cc72ef6..7f5aafc5b1a0
> 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -3552,6 +3552,26 @@ void drm_atomic_helper_crtc_destroy_state(struct
> drm_crtc *crtc, }
>  EXPORT_SYMBOL(drm_atomic_helper_crtc_destroy_state);
> 
> +/**
> + * __drm_atomic_helper_plane_reset - resets planes state to default values
> + * @plane: plane object, must not be NULL
> + * @state: atomic plane state, must not be NULL
> + *
> + * Initializes plane state to default. This is useful for drivers that
> subclass
> + * the plane state.
> + */
> +void __drm_atomic_helper_plane_reset(struct drm_plane *plane,
> +  struct drm_plane_state *state)
> +{
> + state->plane = plane;
> + state->rotation = DRM_MODE_ROTATE_0;

Nitpicking, I'd keep the blank line here to make the code a bit easier to read

> + /* Reset the alpha value to fully opaque if it matters */
> + if (plane->alpha_property)
> + state->alpha = plane->alpha_property->values[1];

And here too.

Apart from that,

Reviewed-by: Laurent Pinchart 

> + plane->state = state;
> +}
> +EXPORT_SYMBOL(__drm_atomic_helper_plane_reset);
> +
>  /**
>   * drm_atomic_helper_plane_reset - default &drm_plane_funcs.reset hook for
> planes * @plane: drm plane
> @@ -3566,15 +3586,8 @@ void drm_atomic_helper_plane_reset(struct drm_plane
> *plane)
> 
>   kfree(plane->state);
>   plane->state = kzalloc(sizeof(*plane->state), GFP_KERNEL);
> -
> - if (plane->state) {
> - plane->state->plane = plane;
> - plane->state->rotation = DRM_MODE_ROTATE_0;
> -
> - /* Reset the alpha value to fully opaque if it matters */
> - if (plane->alpha_property)
> - plane->state->alpha = plane->alpha_property->values[1];
> - }
> + if (plane->state)
> + __drm_atomic_helper_plane_reset(plane, plane->state);
>  }
>  EXPORT_SYMBOL(drm_atomic_helper_plane_reset);
> 
> diff --git a/include/drm/drm_atomic_helper.h
> b/include/drm/drm_atomic_helper.h index 99e2a5297c69..f4c7ed876c97 100644
> --- a/include/drm/drm_atomic_helper.h
> +++ b/include/drm/drm_atomic_helper.h
> @@ -156,6 +156,8 @@ void __drm_atomic_helper_crtc_destroy_state(struct
> drm_crtc_state *state); void drm_atomic_helper_crtc_destroy_state(struct
> drm_crtc *crtc,
> struct drm_crtc_state *state);
> 
> +void __drm_atomic_helper_plane_reset(struct drm_plane *plane,
> +  struct drm_plane_state *state);
>  void drm_atomic_helper_plane_reset(struct drm_plane *plane);
>  void __drm_atomic_helper_plane_duplicate_state(struct drm_plane *plane,
>  struct drm_plane_state *state);

-- 
Regards,

Laurent Pinchart



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


Re: [PATCH v2 07/10] drm: rcar-du: Use __drm_atomic_helper_plane_reset instead of copying the logic

2018-07-26 Thread Laurent Pinchart
Hi Alexandru,

Thank you for the patch.

On Thursday, 26 July 2018 19:17:53 EEST Alexandru Gheorghe wrote:
> A new helper function(__drm_atomic_helper_plane_reset) has been added
> for linking a plane with its state and resetting the core
> properties(alpha, rotation, etc.) to their default values.
> Use that instead of duplicating the logic.
> 
> __drm_atomic_helper_plane_reset initializes the alpha property to its
> max value, which is defined by the drm core as DRM_BLEND_ALPHA_OPAQUE,
> so nothing changes regarding the alpha value.
> 
> Signed-off-by: Alexandru Gheorghe 
> ---
>  drivers/gpu/drm/rcar-du/rcar_du_plane.c | 4 +---
>  drivers/gpu/drm/rcar-du/rcar_du_vsp.c   | 4 +---
>  2 files changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.c
> b/drivers/gpu/drm/rcar-du/rcar_du_plane.c index c20f7ed48c8d..19a9d5f6db1c
> 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_plane.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
> @@ -689,15 +689,13 @@ static void rcar_du_plane_reset(struct drm_plane
> *plane)
>   state = kzalloc(sizeof(*state), GFP_KERNEL);
>   if (state == NULL)
>   return;

As I'd like you to fix the two small issues below, could you also add a blank 
line here ?

> + __drm_atomic_helper_plane_reset(plane, &state->state);
> 
>   state->hwindex = -1;
>   state->source = RCAR_DU_PLANE_MEMORY;
>   state->colorkey = RCAR_DU_COLORKEY_NONE;
>   state->state.zpos = plane->type == DRM_PLANE_TYPE_PRIMARY ? 0 : 1;
> 

This blank line should be removed.

> - plane->state = &state->state;
> - plane->state->alpha = DRM_BLEND_ALPHA_OPAQUE;
> - plane->state->plane = plane;
>  }
> 
>  static int rcar_du_plane_atomic_set_property(struct drm_plane *plane,
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
> b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c index 72eebeda518e..0a0aa490f805
> 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
> @@ -346,11 +346,9 @@ static void rcar_du_vsp_plane_reset(struct drm_plane
> *plane)
>   if (state == NULL)
>   return;
> 
> - state->state.alpha = DRM_BLEND_ALPHA_OPAQUE;
> + __drm_atomic_helper_plane_reset(plane, &state->state);
>   state->state.zpos = plane->type == DRM_PLANE_TYPE_PRIMARY ? 0 : 1;
> 

And this one too.

> - plane->state = &state->state;
> - plane->state->plane = plane;
>  }
> 
>  static const struct drm_plane_funcs rcar_du_vsp_plane_funcs = {

Apart from that,

Reviewed-by: Laurent Pinchart 

-- 
Regards,

Laurent Pinchart



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


[Bug 200661] AMD Radeon R9 390 freezes/crashing with white stripes/blocks

2018-07-26 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=200661

Alex Deucher (alexdeuc...@gmail.com) changed:

   What|Removed |Added

 CC||alexdeuc...@gmail.com

--- Comment #1 from Alex Deucher (alexdeuc...@gmail.com) ---
Please attach your dmesg output.  Can you bisect?

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


[Bug 200661] New: AMD Radeon R9 390 freezes/crashing with white stripes/blocks

2018-07-26 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=200661

Bug ID: 200661
   Summary: AMD Radeon R9 390 freezes/crashing with white
stripes/blocks
   Product: Drivers
   Version: 2.5
Kernel Version: 4.17.10
  Hardware: All
OS: Linux
  Tree: Mainline
Status: NEW
  Severity: blocking
  Priority: P1
 Component: Video(DRI - non Intel)
  Assignee: drivers_video-...@kernel-bugs.osdl.org
  Reporter: francois5...@gmail.com
Regression: No

After upgrading to 4.17.10 my screen freezes and is showing white stripes
(memory fault?). The issue doesn't show up on 4.17.9 or any lower kernel
version.

When the screen freezes, the audio continues to play in the background. A few
seconds later however the system just seem to stop completely.

Boot flags: rw radeon.cik_support=0 radeon.dpm=0 amdgpu.cik_support=1
amdgpu.dc=1 amdgpu.dpm=1 scsi_mod.use_blk_mq=1 pcie_aspm=force

I'm using the latest linux-firmware and running Arch Linux.

In the journal I'm unable to find any weird stuff, but I'm happy to provide it
if needed.

Thanks.

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


[Bug 105760] [4.17-rc1] RIP: smu7_populate_single_firmware_entry.isra.6+0x57/0xc0 [amdgpu] RSP: ffffa17901efb930

2018-07-26 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105760

--- Comment #54 from Alex Deucher  ---
Can you see if this patch fixes it?
https://gist.github.com/karolherbst/3cde7028a6b885ca42863b6f6320658c

-- 
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 107390] [BISECTED] EDID read failure breaks display mirroring

2018-07-26 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=107390

Justinas Narusevicius  changed:

   What|Removed |Added

 Attachment #140841|417.png display mirroring   |417.png Display mirroring
description|unavailable in 4.17+|unavailable in 4.17+
   |kernels |kernels

-- 
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 107390] [BISECTED] EDID read failure breaks display mirroring

2018-07-26 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=107390

Justinas Narusevicius  changed:

   What|Removed |Added

 Attachment #140840|Display mirroring available |416.png Display mirroring
description|on 4.16.9 kernel|available on 4.16.9 kernel

-- 
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 107390] [BISECTED] EDID read failure breaks display mirroring

2018-07-26 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=107390

--- Comment #4 from Justinas Narusevicius  ---
Created attachment 140843
  --> https://bugs.freedesktop.org/attachment.cgi?id=140843&action=edit
BenQ G2420HDBL (monitor) EDID dump

-- 
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 107390] [BISECTED] EDID read failure breaks display mirroring

2018-07-26 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=107390

--- Comment #3 from Justinas Narusevicius  ---
Created attachment 140842
  --> https://bugs.freedesktop.org/attachment.cgi?id=140842&action=edit
Philips 55PUS6401 (4k TV) EDID dump

-- 
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 107390] [BISECTED] EDID read failure breaks display mirroring

2018-07-26 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=107390

--- Comment #2 from Justinas Narusevicius  ---
Created attachment 140841
  --> https://bugs.freedesktop.org/attachment.cgi?id=140841&action=edit
417.png display mirroring unavailable in 4.17+ kernels

-- 
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 107390] [BISECTED] EDID read failure breaks display mirroring

2018-07-26 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=107390

--- Comment #1 from Justinas Narusevicius  ---
Created attachment 140840
  --> https://bugs.freedesktop.org/attachment.cgi?id=140840&action=edit
Display mirroring available on 4.16.9 kernel

-- 
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 107390] [BISECTED] EDID read failure breaks display mirroring

2018-07-26 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=107390

Bug ID: 107390
   Summary: [BISECTED] EDID read failure breaks display mirroring
   Product: DRI
   Version: unspecified
  Hardware: x86-64 (AMD64)
OS: Linux (All)
Status: NEW
  Severity: normal
  Priority: medium
 Component: DRM/AMDgpu
  Assignee: dri-devel@lists.freedesktop.org
  Reporter: jun...@gmail.com

Created attachment 140839
  --> https://bugs.freedesktop.org/attachment.cgi?id=140839&action=edit
Boot log showing EDID read failure

Two displays are connected to a POLARIS 10 GPU:

DVI-D-1   BenQ G2420HDBL (monitor)
HDMI-A-1  Philips 55PUS6401 (4k TV)

The displays worked fine in mirror mode on 1920x1080@60 until commit
ac916c914c3156e53505e9ea3a9d1495518bf873: see 416.png - gnome display settings
working as expected on mainline 4.16.9 kernel.

As far as i can tell ac916c914c3156e53505e9ea3a9d1495518bf873 introduces 3
issues (listing the later two because they are probably side effects of the
first one):

 1st issue 
ac916c914c3156e53505e9ea3a9d1495518bf873 and later builds only allow desktop to
be extended and not mirrored leaving the impression AMDGPU thinks the displays
have no compatible output modes for mirroring: see 417.png - gnome display
settings on mainline 4.17+ no longer allowing the two displays to be mirrored,
the tabline present at the top of 416.png is missing in 417.png.

Grepping through kernel logs indeed shows AMDGPU failing to read EDID (full
boot log attached):

[drm:dm_logger_write [amdgpu]] *ERROR* No EDID read.

* The error message is present with only the monitor connected.
* The error message is also present with only the TV connected.
This leaves me to believe that EDID is bad on both of my displays and AMDGPU
was tolerating it until now or there might be some issues on AMDGPU's side too.

 2nd issue (probably related) 
If using the "Join Displays" (extended desktop) mode it was previously possible
to have have an extended desktop span 3840x2160 on TV and 1920x1080 on monitor. 

After ac916c914c3156e53505e9ea3a9d1495518bf873 gnome display settings no longer
allows choosing 3840x2160 on TV when monitor is also plugged in. Both displays
are capped to 1920x1080@60.
The 4k resolutions return when only TV is connected.

 3rd issue (probably related) 
After ac916c914c3156e53505e9ea3a9d1495518bf873 a third erroneous "Unknown
display" is found and put in 'enabled' state on what appears to be HDMI-A-2.
with following modes:
$ cat /sys/class/drm/card0-HDMI-A-2/modes 
1024x768
800x600
800x600
848x480
640x480

There's nothing connected to HDMI-A-2 physically.

 SUMMARY 
Since broken EDID is probably the root cause of all of this i'm attaching both
displays EDID dumps as produced by read-edid 3.0.2
I have no experience in kernel development but would gladly test patches if
anyone has ideas on what could be wrong.
I'll also understand if this will be filed under woun't fix due to display EDID
issues.

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


[PULL] drm-intel-fixes

2018-07-26 Thread Rodrigo Vivi
Hi Dave,

Here goes drm-intel-fixes-2018-07-26:

- Only a quirk for GLK NUC HDMI port issues

Thanks,
Rodrigo.

The following changes since commit d72e90f33aa4709ebecc5005562f52335e106a60:

  Linux 4.18-rc6 (2018-07-22 14:12:20 -0700)

are available in the Git repository at:

  git://anongit.freedesktop.org/drm/drm-intel tags/drm-intel-fixes-2018-07-26

for you to fetch changes up to 0ca9488193e61ec5f31a631d8147f74525629e8a:

  drm/i915/glk: Add Quirk for GLK NUC HDMI port issues. (2018-07-25 14:52:17 
-0700)


- Only a quirk for GLK NUC HDMI port issues


Clint Taylor (1):
  drm/i915/glk: Add Quirk for GLK NUC HDMI port issues.

 drivers/gpu/drm/i915/i915_drv.h  |  1 +
 drivers/gpu/drm/i915/intel_ddi.c | 13 +++--
 drivers/gpu/drm/i915/intel_display.c | 21 -
 drivers/gpu/drm/i915/intel_drv.h |  3 +--
 4 files changed, 33 insertions(+), 5 deletions(-)
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2 01/10] drm/atomic: Add __drm_atomic_helper_plane_reset

2018-07-26 Thread Alexandru Gheorghe
There are a lot of drivers that subclass drm_plane_state, all of them
duplicate the code that links toghether the plane with plane_state.

On top of that, drivers that enable core properties also have to
duplicate the code for initializing the properties to their default
values, which in all cases are the same as the defaults from core.

Change since v1:
- Make it consistent with the other helpers and require that both
  plane and state not be NULL, suggested by Boris Brezillon and
  Philipp Zabel.

Signed-off-by: Alexandru Gheorghe 
---
 drivers/gpu/drm/drm_atomic_helper.c | 31 -
 include/drm/drm_atomic_helper.h |  2 ++
 2 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic_helper.c 
b/drivers/gpu/drm/drm_atomic_helper.c
index 866a2cc72ef6..7f5aafc5b1a0 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -3552,6 +3552,26 @@ void drm_atomic_helper_crtc_destroy_state(struct 
drm_crtc *crtc,
 }
 EXPORT_SYMBOL(drm_atomic_helper_crtc_destroy_state);
 
+/**
+ * __drm_atomic_helper_plane_reset - resets planes state to default values
+ * @plane: plane object, must not be NULL
+ * @state: atomic plane state, must not be NULL
+ *
+ * Initializes plane state to default. This is useful for drivers that subclass
+ * the plane state.
+ */
+void __drm_atomic_helper_plane_reset(struct drm_plane *plane,
+struct drm_plane_state *state)
+{
+   state->plane = plane;
+   state->rotation = DRM_MODE_ROTATE_0;
+   /* Reset the alpha value to fully opaque if it matters */
+   if (plane->alpha_property)
+   state->alpha = plane->alpha_property->values[1];
+   plane->state = state;
+}
+EXPORT_SYMBOL(__drm_atomic_helper_plane_reset);
+
 /**
  * drm_atomic_helper_plane_reset - default &drm_plane_funcs.reset hook for 
planes
  * @plane: drm plane
@@ -3566,15 +3586,8 @@ void drm_atomic_helper_plane_reset(struct drm_plane 
*plane)
 
kfree(plane->state);
plane->state = kzalloc(sizeof(*plane->state), GFP_KERNEL);
-
-   if (plane->state) {
-   plane->state->plane = plane;
-   plane->state->rotation = DRM_MODE_ROTATE_0;
-
-   /* Reset the alpha value to fully opaque if it matters */
-   if (plane->alpha_property)
-   plane->state->alpha = plane->alpha_property->values[1];
-   }
+   if (plane->state)
+   __drm_atomic_helper_plane_reset(plane, plane->state);
 }
 EXPORT_SYMBOL(drm_atomic_helper_plane_reset);
 
diff --git a/include/drm/drm_atomic_helper.h b/include/drm/drm_atomic_helper.h
index 99e2a5297c69..f4c7ed876c97 100644
--- a/include/drm/drm_atomic_helper.h
+++ b/include/drm/drm_atomic_helper.h
@@ -156,6 +156,8 @@ void __drm_atomic_helper_crtc_destroy_state(struct 
drm_crtc_state *state);
 void drm_atomic_helper_crtc_destroy_state(struct drm_crtc *crtc,
  struct drm_crtc_state *state);
 
+void __drm_atomic_helper_plane_reset(struct drm_plane *plane,
+struct drm_plane_state *state);
 void drm_atomic_helper_plane_reset(struct drm_plane *plane);
 void __drm_atomic_helper_plane_duplicate_state(struct drm_plane *plane,
   struct drm_plane_state *state);
-- 
2.18.0

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


[PATCH v2 10/10] drm/vmwgfx: Use __drm_atomic_helper_plane_reset instead of copying the logic

2018-07-26 Thread Alexandru Gheorghe
A new helper function(__drm_atomic_helper_plane_reset) has been added
for linking a plane with its state and resetting the core
properties(alpha, rotation, etc.) to their default values.
Use that instead of duplicating the logic.

Reviewed-by: Sinclair Yeh 
Reviewed-by: Deepak Rawat 
Signed-off-by: Alexandru Gheorghe 
---
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c 
b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
index 4a0f0f41afa1..61824e360619 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
@@ -720,9 +720,7 @@ void vmw_du_plane_reset(struct drm_plane *plane)
return;
}
 
-   plane->state = &vps->base;
-   plane->state->plane = plane;
-   plane->state->rotation = DRM_MODE_ROTATE_0;
+   __drm_atomic_helper_plane_reset(plane, &vps->base);
 }
 
 
-- 
2.18.0

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


[PATCH v2 05/10] drm/exynos: Use __drm_atomic_helper_plane_reset instead of copying the logic

2018-07-26 Thread Alexandru Gheorghe
A new helper function(__drm_atomic_helper_plane_reset) has been added
for linking a plane with its state and resetting the core
properties(alpha, rotation, etc.) to their default values.
Use that instead of duplicating the logic.

Signed-off-by: Alexandru Gheorghe 
---
 drivers/gpu/drm/exynos/exynos_drm_plane.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c 
b/drivers/gpu/drm/exynos/exynos_drm_plane.c
index eb9915da7dec..681328fbe7de 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_plane.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c
@@ -139,8 +139,7 @@ static void exynos_drm_plane_reset(struct drm_plane *plane)
 
exynos_state = kzalloc(sizeof(*exynos_state), GFP_KERNEL);
if (exynos_state) {
-   plane->state = &exynos_state->base;
-   plane->state->plane = plane;
+   __drm_atomic_helper_plane_reset(plane, &exynos_state->base);
plane->state->zpos = exynos_plane->config->zpos;
}
 }
-- 
2.18.0

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


[PATCH v2 04/10] drm: atmel-hlcdc: Use __drm_atomic_helper_plane_reset instead of copying the logic

2018-07-26 Thread Alexandru Gheorghe
A new helper function(__drm_atomic_helper_plane_reset) has been added
for linking a plane with its state and resetting the core
properties(alpha, rotation, etc.) to their default values.
Use that instead of duplicating the logic.

__drm_atomic_helper_plane_reset initializes the alpha property to its
max value, which is defined by the drm core as DRM_BLEND_ALPHA_OPAQUE,
so nothing changes regarding the alpha value.

Acked-by: Boris Brezillon 
Signed-off-by: Alexandru Gheorghe 
---
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c 
b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
index 04440064b9b7..9330a076e15a 100644
--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
+++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
@@ -942,10 +942,7 @@ static void atmel_hlcdc_plane_reset(struct drm_plane *p)
"Failed to allocate initial plane state\n");
return;
}
-
-   p->state = &state->base;
-   p->state->alpha = DRM_BLEND_ALPHA_OPAQUE;
-   p->state->plane = p;
+   __drm_atomic_helper_plane_reset(p, &state->base);
}
 }
 
-- 
2.18.0

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


[PATCH v2 02/10] drm/amd/display: Use __drm_atomic_helper_plane_reset instead of copying the logic

2018-07-26 Thread Alexandru Gheorghe
A new helper function(__drm_atomic_helper_plane_reset) has been added
for linking a plane with its state and resetting the core
properties(alpha, rotation, etc) to their default values.
Use that instead of duplicating the logic.

Reviewed-by: Harry Wentland 
Signed-off-by: Alexandru Gheorghe 
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index ae09331eed00..8e4978d5b83f 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -2965,11 +2965,8 @@ static void dm_drm_plane_reset(struct drm_plane *plane)
amdgpu_state = kzalloc(sizeof(*amdgpu_state), GFP_KERNEL);
WARN_ON(amdgpu_state == NULL);

-   if (amdgpu_state) {
-   plane->state = &amdgpu_state->base;
-   plane->state->plane = plane;
-   plane->state->rotation = DRM_MODE_ROTATE_0;
-   }
+   if (amdgpu_state)
+   __drm_atomic_helper_plane_reset(plane, &amdgpu_state->base);
 }
 
 static struct drm_plane_state *
-- 
2.18.0

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


[PATCH v2 03/10] drm: mali-dp: Use __drm_atomic_helper_plane_reset instead of copying the logic

2018-07-26 Thread Alexandru Gheorghe
A new helper function(__drm_atomic_helper_plane_reset) has been added
for linking a plane with its state and resetting the core
properties(alpha, rotation, etc.) to their default values.
Use that instead of duplicating the logic.

Reviewed-by: Ayan Kumar halder 
Acked-by: Liviu Dudau 
Signed-off-by: Alexandru Gheorghe 
---
 drivers/gpu/drm/arm/malidp_planes.c | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/arm/malidp_planes.c 
b/drivers/gpu/drm/arm/malidp_planes.c
index 29409a65d864..49c37f6dd63e 100644
--- a/drivers/gpu/drm/arm/malidp_planes.c
+++ b/drivers/gpu/drm/arm/malidp_planes.c
@@ -78,11 +78,8 @@ static void malidp_plane_reset(struct drm_plane *plane)
kfree(state);
plane->state = NULL;
state = kzalloc(sizeof(*state), GFP_KERNEL);
-   if (state) {
-   state->base.plane = plane;
-   state->base.rotation = DRM_MODE_ROTATE_0;
-   plane->state = &state->base;
-   }
+   if (state)
+   __drm_atomic_helper_plane_reset(plane, &state->base);
 }
 
 static struct
-- 
2.18.0

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


[PATCH v2 09/10] drm/vc4: Use __drm_atomic_helper_plane_reset instead of copying the logic

2018-07-26 Thread Alexandru Gheorghe
A new helper function(__drm_atomic_helper_plane_reset) has been added
for linking a plane with its state and resetting the core
properties(alpha, rotation, etc.) to their default values.
Use that instead of duplicating the logic.

__drm_atomic_helper_plane_reset initializes the alpha property to its
max value, which is defined by the drm core as DRM_BLEND_ALPHA_OPAQUE,
so nothing changes regarding the alpha value.

Signed-off-by: Alexandru Gheorghe 
---
 drivers/gpu/drm/vc4/vc4_plane.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plane.c
index 9d7a36f148cf..688ad9bb0f08 100644
--- a/drivers/gpu/drm/vc4/vc4_plane.c
+++ b/drivers/gpu/drm/vc4/vc4_plane.c
@@ -200,9 +200,7 @@ static void vc4_plane_reset(struct drm_plane *plane)
if (!vc4_state)
return;
 
-   plane->state = &vc4_state->base;
-   plane->state->alpha = DRM_BLEND_ALPHA_OPAQUE;
-   vc4_state->base.plane = plane;
+   __drm_atomic_helper_plane_reset(plane, &vc4_state->base);
 }
 
 static void vc4_dlist_write(struct vc4_plane_state *vc4_state, u32 val)
-- 
2.18.0

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


[PATCH v2 08/10] drm/sun4i: Use __drm_atomic_helper_plane_reset instead of copying the logic

2018-07-26 Thread Alexandru Gheorghe
A new helper function(__drm_atomic_helper_plane_reset) has been added
for linking a plane with its state and resetting the core
properties(alpha, rotation, etc.) to their default values.
Use that instead of duplicating the logic.

__drm_atomic_helper_plane_reset initializes the alpha property to its
max value, which is defined by the drm core as DRM_BLEND_ALPHA_OPAQUE,
so nothing changes regarding the alpha value.

Signed-off-by: Alexandru Gheorghe 
---
 drivers/gpu/drm/sun4i/sun4i_layer.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun4i_layer.c 
b/drivers/gpu/drm/sun4i/sun4i_layer.c
index 750ad24de1d7..78f77af8805a 100644
--- a/drivers/gpu/drm/sun4i/sun4i_layer.c
+++ b/drivers/gpu/drm/sun4i/sun4i_layer.c
@@ -35,9 +35,7 @@ static void sun4i_backend_layer_reset(struct drm_plane *plane)
 
state = kzalloc(sizeof(*state), GFP_KERNEL);
if (state) {
-   plane->state = &state->state;
-   plane->state->plane = plane;
-   plane->state->alpha = DRM_BLEND_ALPHA_OPAQUE;
+   __drm_atomic_helper_plane_reset(plane, &state->state);
plane->state->zpos = layer->id;
}
 }
-- 
2.18.0

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


[PATCH v2 07/10] drm: rcar-du: Use __drm_atomic_helper_plane_reset instead of copying the logic

2018-07-26 Thread Alexandru Gheorghe
A new helper function(__drm_atomic_helper_plane_reset) has been added
for linking a plane with its state and resetting the core
properties(alpha, rotation, etc.) to their default values.
Use that instead of duplicating the logic.

__drm_atomic_helper_plane_reset initializes the alpha property to its
max value, which is defined by the drm core as DRM_BLEND_ALPHA_OPAQUE,
so nothing changes regarding the alpha value.

Signed-off-by: Alexandru Gheorghe 
---
 drivers/gpu/drm/rcar-du/rcar_du_plane.c | 4 +---
 drivers/gpu/drm/rcar-du/rcar_du_vsp.c   | 4 +---
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.c 
b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
index c20f7ed48c8d..19a9d5f6db1c 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_plane.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
@@ -689,15 +689,13 @@ static void rcar_du_plane_reset(struct drm_plane *plane)
state = kzalloc(sizeof(*state), GFP_KERNEL);
if (state == NULL)
return;
+   __drm_atomic_helper_plane_reset(plane, &state->state);
 
state->hwindex = -1;
state->source = RCAR_DU_PLANE_MEMORY;
state->colorkey = RCAR_DU_COLORKEY_NONE;
state->state.zpos = plane->type == DRM_PLANE_TYPE_PRIMARY ? 0 : 1;
 
-   plane->state = &state->state;
-   plane->state->alpha = DRM_BLEND_ALPHA_OPAQUE;
-   plane->state->plane = plane;
 }
 
 static int rcar_du_plane_atomic_set_property(struct drm_plane *plane,
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c 
b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
index 72eebeda518e..0a0aa490f805 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
@@ -346,11 +346,9 @@ static void rcar_du_vsp_plane_reset(struct drm_plane 
*plane)
if (state == NULL)
return;
 
-   state->state.alpha = DRM_BLEND_ALPHA_OPAQUE;
+   __drm_atomic_helper_plane_reset(plane, &state->state);
state->state.zpos = plane->type == DRM_PLANE_TYPE_PRIMARY ? 0 : 1;
 
-   plane->state = &state->state;
-   plane->state->plane = plane;
 }
 
 static const struct drm_plane_funcs rcar_du_vsp_plane_funcs = {
-- 
2.18.0

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


[PATCH v2 06/10] drm/imx: Use __drm_atomic_helper_plane_reset instead of copying the logic

2018-07-26 Thread Alexandru Gheorghe
A new helper function(__drm_atomic_helper_plane_reset) has been added
for linking a plane with its state and resetting the core
properties(alpha, rotation, etc.) to their default values.
Use that instead of duplicating the logic.

Signed-off-by: Alexandru Gheorghe 
---
 drivers/gpu/drm/imx/ipuv3-plane.c | 8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/imx/ipuv3-plane.c 
b/drivers/gpu/drm/imx/ipuv3-plane.c
index 203f247d4854..1bd4de03ce9e 100644
--- a/drivers/gpu/drm/imx/ipuv3-plane.c
+++ b/drivers/gpu/drm/imx/ipuv3-plane.c
@@ -281,16 +281,14 @@ static void ipu_plane_state_reset(struct drm_plane *plane)
ipu_state = to_ipu_plane_state(plane->state);
__drm_atomic_helper_plane_destroy_state(plane->state);
kfree(ipu_state);
+   plane->state = NULL;
}
 
ipu_state = kzalloc(sizeof(*ipu_state), GFP_KERNEL);
 
-   if (ipu_state) {
-   ipu_state->base.plane = plane;
-   ipu_state->base.rotation = DRM_MODE_ROTATE_0;
-   }
+   if (ipu_state)
+   __drm_atomic_helper_plane_reset(plane, &ipu_state->base);
 
-   plane->state = &ipu_state->base;
 }
 
 static struct drm_plane_state *
-- 
2.18.0

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


[PATCH v2 00/10] Add helper for plane reset

2018-07-26 Thread Alexandru Gheorghe
Changes since v1: 
 - Make __drm_atomic_helper_plane_reset consistent with the other
   helpers and require that both plane and state not be NULL,
   suggested by Boris Brezillon and Philipp Zabel. Drivers already
   check for that.
 - Add a proper commit message for driver changes.

Drivers that subclass drm_plane need to copy the logic for linking the
drm_plane with its state and to initialize core properties to their
default values. E.g (alpha and rotation)

Having a helper to reset the plane_state makes sense because of multiple
reasons:
1. Eliminate code duplication.
2. Add a single place for initializing core properties to their
default values, no need for driver to do it if what the helper sets
makes sense for them.
3. No need to debug the driver when you enable a core property and
observe it doesn't have a proper default value.

Tested with mali-dp the other drivers are just built-tested.


Alexandru Gheorghe (10):
  drm/atomic: Add  __drm_atomic_helper_plane_reset
  drm/amd/display: Use __drm_atomic_helper_plane_reset instead of
copying the logic
  drm: mali-dp: Use __drm_atomic_helper_plane_reset instead of copying
the logic
  drm: atmel-hlcdc: Use __drm_atomic_helper_plane_reset instead of
copying the logic
  drm/exynos: Use __drm_atomic_helper_plane_reset instead of copying the
logic
  drm/imx: Use __drm_atomic_helper_plane_reset instead of copying the
logic
  drm: rcar-du: Use __drm_atomic_helper_plane_reset instead of copying
the logic
  drm/sun4i: Use __drm_atomic_helper_plane_reset instead of copying the
logic
  drm/vc4: Use __drm_atomic_helper_plane_reset instead of copying the
logic
  drm/vmwgfx: Use __drm_atomic_helper_plane_reset instead of copying the
logic

 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  7 ++---
 drivers/gpu/drm/arm/malidp_planes.c   |  7 ++---
 .../gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c   |  5 +--
 drivers/gpu/drm/drm_atomic_helper.c   | 31 +--
 drivers/gpu/drm/exynos/exynos_drm_plane.c |  3 +-
 drivers/gpu/drm/imx/ipuv3-plane.c |  8 ++---
 drivers/gpu/drm/rcar-du/rcar_du_plane.c   |  4 +--
 drivers/gpu/drm/rcar-du/rcar_du_vsp.c |  4 +--
 drivers/gpu/drm/sun4i/sun4i_layer.c   |  4 +--
 drivers/gpu/drm/vc4/vc4_plane.c   |  4 +--
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c   |  4 +--
 include/drm/drm_atomic_helper.h   |  2 ++
 12 files changed, 38 insertions(+), 45 deletions(-)

-- 
2.18.0

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


Re: [PATCH] drm/nouveau: Set DRIVER_ATOMIC cap earlier to fix debugfs

2018-07-26 Thread Lyude Paul
On Thu, 2018-07-26 at 17:12 +0200, Greg KH wrote:
> On Mon, Jul 23, 2018 at 01:13:20PM -0400, Lyude Paul wrote:
> > commit eb493fbc150f4a28151ae1ee84f24395989f3600 upstream
> > 
> > Currently nouveau doesn't actually expose the state debugfs file that's
> > usually provided for any modesetting driver that supports atomic, even
> > if nouveau is loaded with atomic=1. This is due to the fact that the
> > standard debugfs files that DRM creates for atomic drivers is called
> > when drm_get_pci_dev() is called from nouveau_drm.c. This happens well
> > before we've initialized the display core, which is currently
> > responsible for setting the DRIVER_ATOMIC cap.
> > 
> > So, move the atomic option into nouveau_drm.c and just add the
> > DRIVER_ATOMIC cap whenever it's enabled on the kernel commandline. This
> > shouldn't cause any actual issues, as the atomic ioctl will still fail
> > as expected even if the display core doesn't disable it until later in
> > the init sequence. This also provides the added benefit of being able to
> > use the state debugfs file to check the current display state even if
> > clients aren't allowed to modify it through anything other than the
> > legacy ioctls.
> > 
> > Additionally, disable the DRIVER_ATOMIC cap in nv04's display core, as
> > this was already disabled there previously.
> > 
> > Signed-off-by: Lyude Paul 
> > Cc: sta...@vger.kernel.org
> > Signed-off-by: Ben Skeggs 
> > ---
> >  drivers/gpu/drm/nouveau/dispnv04/disp.c | 3 +++
> >  drivers/gpu/drm/nouveau/nouveau_drm.c   | 7 +++
> >  drivers/gpu/drm/nouveau/nv50_display.c  | 6 --
> >  3 files changed, 10 insertions(+), 6 deletions(-)
> 
> Please give me a hint as to what kernel versions you want the patches to
> be applied to, otherwise I just have to guess :)
will note for the future, sorry about that!
> 
> thanks,
> 
> greg k-h

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


Re: [PATCH] drm/nouveau: Set DRIVER_ATOMIC cap earlier to fix debugfs

2018-07-26 Thread Greg KH
On Mon, Jul 23, 2018 at 01:13:20PM -0400, Lyude Paul wrote:
> commit eb493fbc150f4a28151ae1ee84f24395989f3600 upstream
> 
> Currently nouveau doesn't actually expose the state debugfs file that's
> usually provided for any modesetting driver that supports atomic, even
> if nouveau is loaded with atomic=1. This is due to the fact that the
> standard debugfs files that DRM creates for atomic drivers is called
> when drm_get_pci_dev() is called from nouveau_drm.c. This happens well
> before we've initialized the display core, which is currently
> responsible for setting the DRIVER_ATOMIC cap.
> 
> So, move the atomic option into nouveau_drm.c and just add the
> DRIVER_ATOMIC cap whenever it's enabled on the kernel commandline. This
> shouldn't cause any actual issues, as the atomic ioctl will still fail
> as expected even if the display core doesn't disable it until later in
> the init sequence. This also provides the added benefit of being able to
> use the state debugfs file to check the current display state even if
> clients aren't allowed to modify it through anything other than the
> legacy ioctls.
> 
> Additionally, disable the DRIVER_ATOMIC cap in nv04's display core, as
> this was already disabled there previously.
> 
> Signed-off-by: Lyude Paul 
> Cc: sta...@vger.kernel.org
> Signed-off-by: Ben Skeggs 
> ---
>  drivers/gpu/drm/nouveau/dispnv04/disp.c | 3 +++
>  drivers/gpu/drm/nouveau/nouveau_drm.c   | 7 +++
>  drivers/gpu/drm/nouveau/nv50_display.c  | 6 --
>  3 files changed, 10 insertions(+), 6 deletions(-)

Please give me a hint as to what kernel versions you want the patches to
be applied to, otherwise I just have to guess :)

thanks,

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


[Bug 107367] [regression, bisected] Games freeze the PC with newest AMD Staging DRM Next Kernel

2018-07-26 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=107367

--- Comment #3 from Gregor Münch  ---
This is the crash with kernel from today:

Jul 26 16:47:57 greg-pc kernel: Fixing recursive fault but reboot is needed!
Jul 26 16:47:57 greg-pc kernel: CR2: 7f14fd433fd2 CR3: 03009005
CR4: 001606f0
Jul 26 16:47:57 greg-pc kernel: CS:  0010 DS:  ES:  CR0:
80050033
Jul 26 16:47:57 greg-pc kernel: FS:  ()
GS:88041ec0() knlGS:
Jul 26 16:47:57 greg-pc kernel: R13: 880407a32200 R14: 0206
R15: dead0200
Jul 26 16:47:57 greg-pc kernel: R10: 8803fd74e018 R11: 000d
R12: 880408f42768
Jul 26 16:47:57 greg-pc kernel: RBP: 8803d62a18b8 R08: 
R09: 000c
Jul 26 16:47:57 greg-pc kernel: RDX: 880408f46d40 RSI: 
RDI: 8803d62a18b8
Jul 26 16:47:57 greg-pc kernel: RAX:  RBX: 8803d62a1800
RCX: 
Jul 26 16:47:57 greg-pc kernel: RSP: 0018:c9000821fb88 EFLAGS: 00010286
Jul 26 16:47:57 greg-pc kernel: Code: 89 df 48 89 04 24 e8 9d fd ff ff 48 8b 04
24 eb bc 31 c0 eb 8d 0f 1f 00 0f 1f 44 00 00 41 55 41 54 55 48 89 fd 53 48 8b
47 10 <48> 8b 58 08 48 85 c0 74 07 31 f6 e8 6e fd ff ff 48 83 7d 20 00 0f 
Jul 26 16:47:57 greg-pc kernel: RIP: 0010:drm_sched_entity_fini+0x12/0x190
[gpu_sched]
Jul 26 16:47:57 greg-pc kernel: ---[ end trace 2d06a2d2eeb82fce ]---
Jul 26 16:47:57 greg-pc kernel: CR2: 0008
Jul 26 16:47:57 greg-pc kernel:  ehci_pci xhci_hcd ehci_hcd scsi_mod usbcore
usb_common amdgpu chash i2c_algo_bit gpu_sched drm_kms_helper syscopyarea
sysfillrect sysimgblt fb_sys_fops ttm drm
Jul 26 16:47:57 greg-pc kernel: Modules linked in: ccm fuse nls_iso8859_1
nls_cp437 vfat fat intel_rapl x86_pkg_temp_thermal intel_powerclamp coretemp
arc4 kvm ath9k ath9k_common irqbypass ath9k_hw crct10dif_pclmul crc32_pclmul
eeepc_wmi>
Jul 26 16:47:57 greg-pc kernel: R13: 55d5bb149e78 R14: 
R15: 55d5bb149ecc
Jul 26 16:47:57 greg-pc kernel: R10:  R11: 0246
R12: 0003
Jul 26 16:47:57 greg-pc kernel: RBP:  R08: 
R09: 
Jul 26 16:47:57 greg-pc kernel: RDX:  RSI: 0080
RDI: 55d5bb149ecc
Jul 26 16:47:57 greg-pc kernel: RAX: fe00 RBX: 55d5bb149ea0
RCX: 7f14fd433ffc
Jul 26 16:47:57 greg-pc kernel: RSP: 002b:7f14ea320d60 EFLAGS: 0246
ORIG_RAX: 00ca
Jul 26 16:47:57 greg-pc kernel: Code: Bad RIP value.
Jul 26 16:47:57 greg-pc kernel: RIP: 0033:0x7f14fd433ffc
Jul 26 16:47:57 greg-pc kernel:  entry_SYSCALL_64_after_hwframe+0x44/0xa9
Jul 26 16:47:57 greg-pc kernel:  do_syscall_64+0xcb/0x100
Jul 26 16:47:57 greg-pc kernel:  exit_to_usermode_loop+0x8e/0xb0
Jul 26 16:47:57 greg-pc kernel:  ? task_work_run+0x7c/0xb0
Jul 26 16:47:57 greg-pc kernel:  do_signal+0x36/0x630
Jul 26 16:47:57 greg-pc kernel:  get_signal+0x240/0x590
Jul 26 16:47:57 greg-pc kernel:  do_group_exit+0x33/0xa0
Jul 26 16:47:57 greg-pc kernel:  ? ___preempt_schedule+0x16/0x18
Jul 26 16:47:57 greg-pc kernel:  ? preempt_schedule_common+0x11/0x30
Jul 26 16:47:57 greg-pc kernel:  do_exit+0x301/0xa90
Jul 26 16:47:57 greg-pc kernel:  task_work_run+0x90/0xb0
Jul 26 16:47:57 greg-pc kernel:  __fput+0xa0/0x1f0
Jul 26 16:47:57 greg-pc kernel:  drm_release+0x25a/0x390 [drm]
Jul 26 16:47:57 greg-pc kernel:  amdgpu_driver_postclose_kms+0x102/0x230
[amdgpu]
Jul 26 16:47:57 greg-pc kernel:  amdgpu_vm_fini+0x84/0x400 [amdgpu]
Jul 26 16:47:57 greg-pc kernel: Call Trace:
Jul 26 16:47:57 greg-pc kernel: CR2: 0008 CR3: 03009005
CR4: 001606f0
Jul 26 16:47:57 greg-pc kernel: CS:  0010 DS:  ES:  CR0:
80050033
Jul 26 16:47:57 greg-pc kernel: FS:  ()
GS:88041ec0() knlGS:
Jul 26 16:47:57 greg-pc kernel: R13: 880407a32200 R14: 0206
R15: dead0200
Jul 26 16:47:57 greg-pc kernel: R10: 8803fd74e018 R11: 000d
R12: 880408f42768
Jul 26 16:47:57 greg-pc kernel: RBP: 8803d62a18b8 R08: 
R09: 000c
Jul 26 16:47:57 greg-pc kernel: RDX: 880408f46d40 RSI: 
RDI: 8803d62a18b8
Jul 26 16:47:57 greg-pc kernel:  get_signal+0x240/0x590
Jul 26 16:47:57 greg-pc kernel:  do_group_exit+0x33/0xa0
Jul 26 16:47:57 greg-pc kernel:  ? ___preempt_schedule+0x16/0x18
Jul 26 16:47:57 greg-pc kernel:  ? preempt_schedule_common+0x11/0x30
Jul 26 16:47:57 greg-pc kernel:  do_exit+0x301/0xa90
Jul 26 16:47:57 greg-pc kernel:  task_work_run+0x90/0xb0
Jul 26 16:47:57 greg-pc kernel:  __fput+0xa0/0x1f0
Jul 26 16:47:57 greg-pc kernel:  drm_release+0x25a/0x390 [drm]
Jul 26 16:47:57 greg-pc kernel:  amdgpu_driver_postclose_kms+0x102/0x230
[amdgpu]
Jul 26 16:47:57 greg-pc kernel:  amdgpu_vm_fini+0x84/0x400 [amdgpu]
Jul 26 16:47:57 greg-pc kernel: Call Trace:
Jul 26 16:47:57 greg-pc kernel: CR

[PATCH v4 03/19] drm: add msm compressed format modifiers

2018-07-26 Thread Sean Paul
From: Jeykumar Sankaran 

Qualcomm Snapdragon chipsets uses compressed format
to optimize BW across multiple IP's. This change adds
needed modifier support in drm for a simple 4x4 tile
based compressed variants of base formats.

Changes in v3:
- Removed duplicate entry for DRM_FORMAT_MOD_QCOM_COMPRESSED (Rob Clark)
Changes in v4:
- Remove all modifiers aside from COMPRESSED, this includes tiled and
  10-bit

Signed-off-by: Jeykumar Sankaran 
Signed-off-by: Sean Paul 
Signed-off-by: Rob Clark 
---
 include/uapi/drm/drm_fourcc.h | 13 +
 1 file changed, 13 insertions(+)

diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h
index d43949b5bb3e..721ab7e54d96 100644
--- a/include/uapi/drm/drm_fourcc.h
+++ b/include/uapi/drm/drm_fourcc.h
@@ -299,6 +299,19 @@ extern "C" {
  */
 #define DRM_FORMAT_MOD_SAMSUNG_64_32_TILE  fourcc_mod_code(SAMSUNG, 1)
 
+/*
+ * Qualcomm Compressed Format
+ *
+ * Refers to a compressed variant of the base format that is compressed.
+ * Implementation may be platform and base-format specific.
+ *
+ * Each macrotile consists of m x n (mostly 4 x 4) tiles.
+ * Pixel data pitch/stride is aligned with macrotile width.
+ * Pixel data height is aligned with macrotile height.
+ * Entire pixel data buffer is aligned with 4k(bytes).
+ */
+#define DRM_FORMAT_MOD_QCOM_COMPRESSED fourcc_mod_code(QCOM, 1)
+
 /* Vivante framebuffer modifiers */
 
 /*
-- 
Sean Paul, Software Engineer, Google / Chromium OS

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


Re: [BUG] video: fbdev: broadsheetfb: Possible null function pointers

2018-07-26 Thread Bartlomiej Zolnierkiewicz
On Thursday, July 26, 2018 10:17:44 PM bai wrote:
> In Linux-4.16, drivers/video/fbdev/broadsheetfb.c,
> 
> 158. static void broadsheet_mmio_send_cmdargs(...) {
>  ..
> 163. par->board->mmio_write(...);
>  ..
> 166. par->board->mmio_write(...);
> 167. }
> 
> For x86 kernel configuration, I find that there is no assignment of the 
> function pointer ".mmio_write" in the kernel code.
> So calling the function pointer in lines 163 and 166 may cause a null 
> pointer dereference.
> 
> In this file, there are many calls to this function pointer...

This is a platform driver and it won't be used on x86 (actually it is
used only by single ARM PXA board). The dependency for FB_BROADSHEET
in Kconfig file could be improved to i.e.

depends on FB && (ARCH_PXA || COMPILE_TEST)

but there is no bug there.

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

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


[PATCH 2/3] drm: Make drm_gem_fb_alloc available for drivers to use

2018-07-26 Thread Alexandru Gheorghe
Some drivers can't use drm_gem_fb_create, so instead of copying the
logic that does the framebuffer allocation allow them to use core
drm_gem_fb_alloc.

Signed-off-by: Alexandru Gheorghe 
---
 drivers/gpu/drm/drm_gem_framebuffer_helper.c | 3 ++-
 include/drm/drm_gem_framebuffer_helper.h | 5 +
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_gem_framebuffer_helper.c 
b/drivers/gpu/drm/drm_gem_framebuffer_helper.c
index 2810d4131411..64eddf5a1bd9 100644
--- a/drivers/gpu/drm/drm_gem_framebuffer_helper.c
+++ b/drivers/gpu/drm/drm_gem_framebuffer_helper.c
@@ -57,7 +57,7 @@ struct drm_gem_object *drm_gem_fb_get_obj(struct 
drm_framebuffer *fb,
 }
 EXPORT_SYMBOL_GPL(drm_gem_fb_get_obj);
 
-static struct drm_framebuffer *
+struct drm_framebuffer *
 drm_gem_fb_alloc(struct drm_device *dev,
 const struct drm_mode_fb_cmd2 *mode_cmd,
 struct drm_gem_object **obj, unsigned int num_planes,
@@ -85,6 +85,7 @@ drm_gem_fb_alloc(struct drm_device *dev,
 
return fb;
 }
+EXPORT_SYMBOL_GPL(drm_gem_fb_alloc);
 
 /**
  * drm_gem_fb_destroy - Free GEM backed framebuffer
diff --git a/include/drm/drm_gem_framebuffer_helper.h 
b/include/drm/drm_gem_framebuffer_helper.h
index a38de7eb55b4..d20c1356000a 100644
--- a/include/drm/drm_gem_framebuffer_helper.h
+++ b/include/drm/drm_gem_framebuffer_helper.h
@@ -14,6 +14,11 @@ struct drm_simple_display_pipe;
 
 struct drm_gem_object *drm_gem_fb_get_obj(struct drm_framebuffer *fb,
  unsigned int plane);
+struct drm_framebuffer *
+drm_gem_fb_alloc(struct drm_device *dev,
+const struct drm_mode_fb_cmd2 *mode_cmd,
+struct drm_gem_object **obj, unsigned int num_planes,
+const struct drm_framebuffer_funcs *funcs);
 void drm_gem_fb_destroy(struct drm_framebuffer *fb);
 int drm_gem_fb_create_handle(struct drm_framebuffer *fb, struct drm_file *file,
 unsigned int *handle);
-- 
2.18.0

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


[PATCH 1/3] drm/fourcc: Add malidp yuv formats

2018-07-26 Thread Alexandru Gheorghe
Malidp implements a number of yuv buffer formats which are not
currently described in drm_fourcc.h.
This adds those definitions and describes their memory layout.

Signed-off-by: Alexandru Gheorghe 
---
 drivers/gpu/drm/drm_fourcc.c  |  7 +++
 include/uapi/drm/drm_fourcc.h | 27 ++-
 2 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_fourcc.c b/drivers/gpu/drm/drm_fourcc.c
index 35c1e2742c27..18bb960e9943 100644
--- a/drivers/gpu/drm/drm_fourcc.c
+++ b/drivers/gpu/drm/drm_fourcc.c
@@ -173,6 +173,13 @@ const struct drm_format_info *__drm_format_info(u32 format)
{ .format = DRM_FORMAT_UYVY,.depth = 0,  
.num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
{ .format = DRM_FORMAT_VYUY,.depth = 0,  
.num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1, .is_yuv = true },
{ .format = DRM_FORMAT_AYUV,.depth = 0,  
.num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .has_alpha = true, 
.is_yuv = true },
+   { .format = DRM_FORMAT_XYUV,.depth = 0,  
.num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
+   { .format = DRM_FORMAT_XVYU2101010, .depth = 0,  
.num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1, .is_yuv = true },
+   { .format = DRM_FORMAT_Y0L0,.depth = 0,  
.num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 2, .has_alpha = true, 
.is_yuv = true },
+   { .format = DRM_FORMAT_X0L0,.depth = 0,  
.num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true },
+   { .format = DRM_FORMAT_Y0L2,.depth = 0,  
.num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 2, .has_alpha = true, 
.is_yuv = true },
+   { .format = DRM_FORMAT_X0L2,.depth = 0,  
.num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 2, .is_yuv = true },
+   { .format = DRM_FORMAT_P010,.depth = 0,  
.num_planes = 2, .cpp = { 2, 4, 0 }, .hsub = 2, .vsub = 2, .is_yuv  = true },
};
 
unsigned int i;
diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h
index d43949b5bb3e..ba2fd9e9815d 100644
--- a/include/uapi/drm/drm_fourcc.h
+++ b/include/uapi/drm/drm_fourcc.h
@@ -105,13 +105,31 @@ extern "C" {
 #define DRM_FORMAT_RGBA1010102 fourcc_code('R', 'A', '3', '0') /* [31:0] 
R:G:B:A 10:10:10:2 little endian */
 #define DRM_FORMAT_BGRA1010102 fourcc_code('B', 'A', '3', '0') /* [31:0] 
B:G:R:A 10:10:10:2 little endian */
 
-/* packed YCbCr */
+/* packed YCbCr422 */
 #define DRM_FORMAT_YUYVfourcc_code('Y', 'U', 'Y', 'V') /* 
[31:0] Cr0:Y1:Cb0:Y0 8:8:8:8 little endian */
 #define DRM_FORMAT_YVYUfourcc_code('Y', 'V', 'Y', 'U') /* 
[31:0] Cb0:Y1:Cr0:Y0 8:8:8:8 little endian */
 #define DRM_FORMAT_UYVYfourcc_code('U', 'Y', 'V', 'Y') /* 
[31:0] Y1:Cr0:Y0:Cb0 8:8:8:8 little endian */
 #define DRM_FORMAT_VYUYfourcc_code('V', 'Y', 'U', 'Y') /* 
[31:0] Y1:Cb0:Y0:Cr0 8:8:8:8 little endian */
 
+/* packed YCbCr444 */
 #define DRM_FORMAT_AYUVfourcc_code('A', 'Y', 'U', 'V') /* 
[31:0] A:Y:Cb:Cr 8:8:8:8 little endian */
+#define DRM_FORMAT_XYUVfourcc_code('X', 'Y', 'U', 'V') /* [31:0] 
X:Y:Cb:Cr 8:8:8:8 little endian */
+#define DRM_FORMAT_XVYU2101010 fourcc_code('V', 'U', '3', '0') /* [31:0] 
X:Cr:Y:Cb 2:10:10:10 little endian */
+
+/*
+ * packed YCbCr420 2x2 tiled formats
+ * first 64 bits will contain Y,Cb,Cr components for a 2x2 tile
+ */
+
+/* [63:0]   A3:A2:Y3:0:Cr0:0:Y2:0:A1:A0:Y1:0:Cb0:0:Y0:0  
1:1:8:2:8:2:8:2:1:1:8:2:8:2:8:2 little endian */
+#define DRM_FORMAT_Y0L0fourcc_code('Y', '0', 'L', '0')
+/* [63:0]   X3:X2:Y3:0:Cr0:0:Y2:0:X1:X0:Y1:0:Cb0:0:Y0:0  
1:1:8:2:8:2:8:2:1:1:8:2:8:2:8:2 little endian */
+#define DRM_FORMAT_X0L0fourcc_code('X', '0', 'L', '0')
+
+/* [63:0]   A3:A2:Y3:Cr0:Y2:A1:A0:Y1:Cb0:Y0  1:1:10:10:10:1:1:10:10:10 little 
endian */
+#define DRM_FORMAT_Y0L2fourcc_code('Y', '0', 'L', '2')
+/* [63:0]   X3:X2:Y3:Cr0:Y2:X1:X0:Y1:Cb0:Y0  1:1:10:10:10:1:1:10:10:10 little 
endian */
+#define DRM_FORMAT_X0L2fourcc_code('X', '0', 'L', '2')
 
 /*
  * 2 plane RGB + A
@@ -141,6 +159,13 @@ extern "C" {
 #define DRM_FORMAT_NV24fourcc_code('N', 'V', '2', '4') /* 
non-subsampled Cr:Cb plane */
 #define DRM_FORMAT_NV42fourcc_code('N', 'V', '4', '2') /* 
non-subsampled Cb:Cr plane */
 
+/*
+ * Each sample packed into the top 10 bits of a 16-bit word.
+ * Y plane: [63:0] Y3:0:Y2:0:Y1:0:Y0:0, 10:6:10:6:10:6:10:6
+ * CrCb plane: [63:0] Cr2:0:Cb2:0:Cr0:0:Cb0:0, 10:6:10:6:10:6:10:6
+ */
+#define DRM_FORMAT_P010fourcc_code('P', '0', '1', '0') /* 2x2 
subsampled Cr:Cb plane */
+
 /*
  * 3 plane YCbCr
  * index 0: Y plane, [7:0] Y
-- 
2.18.0

__

[PATCH 3/3] drm: mali-dp: Enable mali specific buffer formats

2018-07-26 Thread Alexandru Gheorghe
Enable the following formats
 - DRM_FORMAT_XYUV
 - DRM_FORMAT_XVYU2101010
 - DRM_FORMAT_X0L0
 - DRM_FORMAT_X0L2
 - DRM_FORMAT_P010

All formats respect the rules checked by core framebuffer_check except
DRM_FORMAT_X0L0 and DRM_FORMAT_X0L2 for which we neeed to take into
consideration that it's a 2x2 tiled format, so the following things
need special handling:

1) PITCH: needs to cover two rows.
2) GEM_SIZE: the core formula (drm_gem_fb_create_with_funcs) that
checks min_object size doesn't work anymore, so I added special check
in driver for X0L0 and X0L2.
3) SOURCE_CROPPING: drm_fb_cma_get_gem_addr doesn't properly retrieves
start address, so I added the right formula for DRM_FORMAT_X0L0 and
DRM_FORMAT_X0L2 inside the driver.

Signed-off-by: Alexandru Gheorghe 
---
 drivers/gpu/drm/arm/malidp_drv.c| 65 -
 drivers/gpu/drm/arm/malidp_hw.c |  7 +++-
 drivers/gpu/drm/arm/malidp_planes.c | 52 +++
 3 files changed, 114 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c
index 5b7260557391..6745c4639dd4 100644
--- a/drivers/gpu/drm/arm/malidp_drv.c
+++ b/drivers/gpu/drm/arm/malidp_drv.c
@@ -258,8 +258,71 @@ static const struct drm_mode_config_helper_funcs 
malidp_mode_config_helpers = {
.atomic_commit_tail = malidp_atomic_commit_tail,
 };
 
+static const struct drm_framebuffer_funcs malidp_gem_fb_funcs = {
+   .destroy= drm_gem_fb_destroy,
+   .create_handle  = drm_gem_fb_create_handle,
+};
+
+struct drm_framebuffer *
+malidp_fb_create(struct drm_device *dev, struct drm_file *file,
+const struct drm_mode_fb_cmd2 *mode_cmd)
+{
+   if (mode_cmd->pixel_format == DRM_FORMAT_X0L2 ||
+   mode_cmd->pixel_format == DRM_FORMAT_X0L0) {
+   const struct drm_format_info *info;
+   struct drm_gem_object *obj;
+   struct drm_framebuffer *fb = NULL;
+   const unsigned int tile_size = 2;
+   unsigned int min_size;
+
+   info = drm_format_info(mode_cmd->pixel_format &
+   ~DRM_FORMAT_BIG_ENDIAN);
+   /*
+* Pitch needs to take into consideration that we are dealing
+* with a tiled 2x2 format, so the pitch/stride need to cover
+* both rows
+*/
+   if (mode_cmd->pitches[0] < mode_cmd->width * info->cpp[0] *
+   tile_size) {
+   struct drm_format_name_buf format_name;
+
+   drm_get_format_name(mode_cmd->pixel_format,
+   &format_name);
+   DRM_DEBUG_KMS("Invalid pitch for format %s",
+ format_name.str);
+   return ERR_PTR(-EINVAL);
+   }
+   obj = drm_gem_object_lookup(file, mode_cmd->handles[0]);
+   if (!obj) {
+   DRM_DEBUG_KMS("Failed to lookup GEM object\n");
+   fb = ERR_PTR(-ENOENT);
+   goto err_gem_object_put;
+   }
+   min_size = mode_cmd->height / tile_size  * mode_cmd->pitches[0];
+   if (obj->size < min_size) {
+   drm_gem_object_put_unlocked(obj);
+   DRM_DEBUG_KMS("Object size is less than minimum"
+ " required\n");
+   fb = ERR_PTR(-EINVAL);
+   goto err_gem_object_put;
+   }
+
+   fb = drm_gem_fb_alloc(dev, mode_cmd, &obj, 1,
+ &malidp_gem_fb_funcs);
+   if (IS_ERR(fb))
+   goto err_gem_object_put;
+   return fb;
+
+   err_gem_object_put:
+   drm_gem_object_put_unlocked(obj);
+   return fb;
+   }
+
+   return drm_gem_fb_create(dev, file, mode_cmd);
+}
+
 static const struct drm_mode_config_funcs malidp_mode_config_funcs = {
-   .fb_create = drm_gem_fb_create,
+   .fb_create = malidp_fb_create,
.output_poll_changed = drm_fb_helper_output_poll_changed,
.atomic_check = drm_atomic_helper_check,
.atomic_commit = drm_atomic_helper_commit,
diff --git a/drivers/gpu/drm/arm/malidp_hw.c b/drivers/gpu/drm/arm/malidp_hw.c
index c94a4422e0e9..472cae76e19b 100644
--- a/drivers/gpu/drm/arm/malidp_hw.c
+++ b/drivers/gpu/drm/arm/malidp_hw.c
@@ -74,10 +74,15 @@ static const struct malidp_format_id malidp500_de_formats[] 
= {
{ DRM_FORMAT_ABGR1555, DE_VIDEO1 | DE_GRAPHICS1 | DE_VIDEO2, 
MALIDP_ID(4, 1) }, \
{ DRM_FORMAT_RGB565, DE_VIDEO1 | DE_GRAPHICS1 | DE_VIDEO2, MALIDP_ID(4, 
2) }, \
{ DRM_FORMAT_BGR565, DE_VIDEO1 | DE_GRAPHICS1 | DE_VIDEO2, MALIDP_ID(4, 
3) }, \
+   { DRM_FORMAT_XYUV, DE_VIDEO1 | DE_VIDEO2, MALIDP_ID(5, 0) }, \
{ DRM_FOR

[PATCH 0/3] Add Mali DP pixel formats

2018-07-26 Thread Alexandru Gheorghe
Mali DP supports a bunch of pixel formats that don't have a fourcc
code defined in drm_fourcc.h, so this patchset adds the definition for
those formats and enables them in mali-dp driver.

The following new formats will be added:

Packed YCbCr444
* DRM_FORMAT_XYUV
* DRM_FORMAT_XVYU2101010

Two plane 10 bits format.
* DRM_FORMAT_P010

Packed YCbCr420 2x2 tiled formats
* DRM_FORMAT_Y0L0
* DRM_FORMAT_X0L0
* DRM_FORMAT_Y0L2
* DRM_FORMAT_X0L2
The difference between X0L0/X0L2 vs Y0L0/Y0L2 is that the later group
have two alpha bits per pixel.

This group is a bit special because we are dealing with a tiled format
where the first 64 bits in memory represent the pixels for a 2x2 tile,
so it needs a bit of special handling when it comes to:
 - pitch: needs to cover both rows that are in the same tile.
 - min allocation size: since a pitch cover both rows the formulas
   defined in drm_gem_fb_create don't work anymore.
 - handling of src_x and src_y offset: same as above since we are
   dealing with a tiled format drm_fb_cma_get_gem_obj doesn't return
   the correct address offset.

So, for this formats mali-dp needs a special implementation of
drm_fb_cma_get_gem_obj and drm_fb_cma_get_gem_addr which are more or
less clones of the core functions, except they take into account the
tile_size.

Other alternatives would be:
  1) Add a tile_size to drm_format_info and plumb the drm_core
 functions to proper handle this special formats.
  2) Add a driver hook that checks buffer min_size and avoid
 duplicating the code from drm_gem_fb_create_with_funcs.

If you have an opinion about how this should be handled feel free to
suggest it.

Alexandru Gheorghe (3):
  drm/fourcc: Add malidp yuv formats
  drm: Make drm_gem_fb_alloc available for drivers to use
  drm: mali-dp: Enable mali specific buffer formats

 drivers/gpu/drm/arm/malidp_drv.c | 65 +++-
 drivers/gpu/drm/arm/malidp_hw.c  |  7 ++-
 drivers/gpu/drm/arm/malidp_planes.c  | 52 +---
 drivers/gpu/drm/drm_fourcc.c |  7 +++
 drivers/gpu/drm/drm_gem_framebuffer_helper.c |  3 +-
 include/drm/drm_gem_framebuffer_helper.h |  5 ++
 include/uapi/drm/drm_fourcc.h| 27 +++-
 7 files changed, 154 insertions(+), 12 deletions(-)

-- 
2.18.0

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


Re: [PATCH] [RESEND] amdgpu: kfd: use modern ktime accessors

2018-07-26 Thread Oded Gabbay
On Wed, Jul 11, 2018 at 3:41 PM Arnd Bergmann  wrote:
>
> getrawmonotonic64() and get_monotonic_boottime64() are deprecated
> because of the nonstandard naming.
>
> The replacement functions ktime_get_raw_ns() and ktime_get_boot_ns()
> also simplify the callers.
>
> Reviewed-by: Felix Kuehling .
> Signed-off-by: Arnd Bergmann 
> ---
> Patch was originall sent on Jun 18 but not applied yet, resending
> With Felix' Reviewed-by tag
> ---
>  drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 8 ++--
>  1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c 
> b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
> index f64c5551cdba..7e717716b90e 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
> @@ -754,7 +754,6 @@ static int kfd_ioctl_get_clock_counters(struct file 
> *filep,
>  {
> struct kfd_ioctl_get_clock_counters_args *args = data;
> struct kfd_dev *dev;
> -   struct timespec64 time;
>
> dev = kfd_device_by_id(args->gpu_id);
> if (dev)
> @@ -766,11 +765,8 @@ static int kfd_ioctl_get_clock_counters(struct file 
> *filep,
> args->gpu_clock_counter = 0;
>
> /* No access to rdtsc. Using raw monotonic time */
> -   getrawmonotonic64(&time);
> -   args->cpu_clock_counter = (uint64_t)timespec64_to_ns(&time);
> -
> -   get_monotonic_boottime64(&time);
> -   args->system_clock_counter = (uint64_t)timespec64_to_ns(&time);
> +   args->cpu_clock_counter = ktime_get_raw_ns();
> +   args->system_clock_counter = ktime_get_boot_ns();
>
> /* Since the counter is in nano-seconds we use 1GHz frequency */
> args->system_clock_freq = 10;
> --
> 2.9.0
>
Applied to -next
Thanks,
Oded
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2 1/2] ARM: dts: exynos: arndale: use i2c-gpio for HDMI-DDC

2018-07-26 Thread Krzysztof Kozlowski
On 26 July 2018 at 15:22, Andrzej Hajda  wrote:
> HDMI-DDC for unknown reasons doesn't work with Exynos I2C
> controllers. Fortunately i2c-gpio comes to the rescue.
>
> Signed-off-by: Andrzej Hajda 
> ---
>  arch/arm/boot/dts/exynos5250-arndale.dts  | 28 ---
>  arch/arm/boot/dts/exynos5250-pinctrl.dtsi |  6 +
>  2 files changed, 26 insertions(+), 8 deletions(-)
>

Thanks, looks good. I'll take it after merge window.

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


[PATCH] drm/tegra: return with probe defer if GPIO subsystem is not ready

2018-07-26 Thread Stefan Agner
If the GPIO subsystem is not ready make sure to return -EPROBE_DEFER
instead of silently continuing without HPD.

Reported-by: Marcel Ziswiler 
Signed-off-by: Stefan Agner 
---
 drivers/gpu/drm/tegra/output.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/tegra/output.c b/drivers/gpu/drm/tegra/output.c
index ffe34bd0bb9d..4bcefe455afd 100644
--- a/drivers/gpu/drm/tegra/output.c
+++ b/drivers/gpu/drm/tegra/output.c
@@ -133,7 +133,9 @@ int tegra_output_probe(struct tegra_output *output)
output->hpd_gpio = of_get_named_gpio_flags(output->of_node,
   "nvidia,hpd-gpio", 0,
   &output->hpd_gpio_flags);
-   if (gpio_is_valid(output->hpd_gpio)) {
+   if (output->hpd_gpio == -EPROBE_DEFER) {
+   return -EPROBE_DEFER;
+   } else if (gpio_is_valid(output->hpd_gpio)) {
unsigned long flags;
 
err = gpio_request_one(output->hpd_gpio, GPIOF_DIR_IN,
-- 
2.18.0

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


[PATCH v2 1/2] ARM: dts: exynos: arndale: use i2c-gpio for HDMI-DDC

2018-07-26 Thread Andrzej Hajda
HDMI-DDC for unknown reasons doesn't work with Exynos I2C
controllers. Fortunately i2c-gpio comes to the rescue.

Signed-off-by: Andrzej Hajda 
---
 arch/arm/boot/dts/exynos5250-arndale.dts  | 28 ---
 arch/arm/boot/dts/exynos5250-pinctrl.dtsi |  6 +
 2 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/arch/arm/boot/dts/exynos5250-arndale.dts 
b/arch/arm/boot/dts/exynos5250-arndale.dts
index 816d89d4cefd..e7a9b9aa85f1 100644
--- a/arch/arm/boot/dts/exynos5250-arndale.dts
+++ b/arch/arm/boot/dts/exynos5250-arndale.dts
@@ -211,7 +211,7 @@
 
 &hdmi {
status = "okay";
-   ddc = <&i2c_2>;
+   ddc = <&i2c_ddc>;
hpd-gpios = <&gpx3 7 GPIO_ACTIVE_LOW>;
vdd_osc-supply = <&ldo10_reg>;
vdd_pll-supply = <&ldo8_reg>;
@@ -513,13 +513,6 @@
};
 };
 
-&i2c_2 {
-   status = "okay";
-   /* used by HDMI DDC */
-   samsung,i2c-sda-delay = <100>;
-   samsung,i2c-max-bus-freq = <66000>;
-};
-
 &i2c_3 {
status = "okay";
 
@@ -608,3 +601,22 @@
status = "okay";
samsung,exynos-sataphy-i2c-phandle = <&sata_phy_i2c>;
 };
+
+&soc {
+   /*
+* For unknown reasons HDMI-DDC does not work with Exynos I2C
+* controllers. Lets use software I2C over GPIO pins as a workaround.
+*/
+   i2c_ddc: i2c-gpio {
+   pinctrl-names = "default";
+   pinctrl-0 = <&i2c2_gpio_bus>;
+   status = "okay";
+   compatible = "i2c-gpio";
+   gpios = <&gpa0 6 0 /* sda */
+&gpa0 7 0 /* scl */
+   >;
+   i2c-gpio,delay-us = <2>;
+   #address-cells = <1>;
+   #size-cells = <0>;
+   };
+};
diff --git a/arch/arm/boot/dts/exynos5250-pinctrl.dtsi 
b/arch/arm/boot/dts/exynos5250-pinctrl.dtsi
index 6ff6dea29d44..b25d520393b8 100644
--- a/arch/arm/boot/dts/exynos5250-pinctrl.dtsi
+++ b/arch/arm/boot/dts/exynos5250-pinctrl.dtsi
@@ -225,6 +225,12 @@
samsung,pin-drv = ;
};
 
+   i2c2_gpio_bus: i2c2-gpio-bus {
+   samsung,pins = "gpa0-6", "gpa0-7";
+   samsung,pin-pud = ;
+   samsung,pin-drv = ;
+   };
+
uart2_data: uart2-data {
samsung,pins = "gpa1-0", "gpa1-1";
samsung,pin-function = ;
-- 
2.18.0

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


[PATCH] drm/msm/gpu: avoid deprecated do_gettimeofday

2018-07-26 Thread Arnd Bergmann
All users of do_gettimeofday() have been removed, but this one recently
crept in, along with an incorrect printing of the microseconds portion.

This converts it to using ktime_get_real_timespec64() as a direct
replacement, and adds the leading zeroes. I considered using monotonic
times (ktime_get()) instead, but as this timestamp appears to only
be used for humans rather than compared with other timestamps, the
real time domain is probably good enough.

Fixes: e43b045e2c82 ("drm/msm/gpu: Capture the state of the GPU")
Signed-off-by: Arnd Bergmann 
---
 drivers/gpu/drm/msm/adreno/adreno_gpu.c | 2 +-
 drivers/gpu/drm/msm/msm_gpu.c   | 4 ++--
 drivers/gpu/drm/msm/msm_gpu.h   | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.c 
b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
index 08d3c618b7de..38ac50b73829 100644
--- a/drivers/gpu/drm/msm/adreno/adreno_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
@@ -376,7 +376,7 @@ int adreno_gpu_state_get(struct msm_gpu *gpu, struct 
msm_gpu_state *state)
 
kref_init(&state->ref);
 
-   do_gettimeofday(&state->time);
+   ktime_get_real_ts64(&state->time);
 
for (i = 0; i < gpu->nr_rings; i++) {
int size = 0, j;
diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c
index 3cf8e8d29812..f388944c93e2 100644
--- a/drivers/gpu/drm/msm/msm_gpu.c
+++ b/drivers/gpu/drm/msm/msm_gpu.c
@@ -297,8 +297,8 @@ static ssize_t msm_gpu_devcoredump_read(char *buffer, 
loff_t offset,
drm_printf(&p, "---\n");
drm_printf(&p, "kernel: " UTS_RELEASE "\n");
drm_printf(&p, "module: " KBUILD_MODNAME "\n");
-   drm_printf(&p, "time: %ld.%ld\n",
-   state->time.tv_sec, state->time.tv_usec);
+   drm_printf(&p, "time: %lld.%09ld\n",
+   state->time.tv_sec, state->time.tv_nsec);
if (state->comm)
drm_printf(&p, "comm: %s\n", state->comm);
if (state->cmd)
diff --git a/drivers/gpu/drm/msm/msm_gpu.h b/drivers/gpu/drm/msm/msm_gpu.h
index 57380ef8d1f7..1c6105bc55c7 100644
--- a/drivers/gpu/drm/msm/msm_gpu.h
+++ b/drivers/gpu/drm/msm/msm_gpu.h
@@ -189,7 +189,7 @@ struct msm_gpu_state_bo {
 
 struct msm_gpu_state {
struct kref ref;
-   struct timeval time;
+   struct timespec64 time;
 
struct {
u64 iova;
-- 
2.18.0

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


Re: [PATCH v2 0/4] drm/ttm: move non-x86 definitions to the common header

2018-07-26 Thread Christian König

Am 26.07.2018 um 13:59 schrieb Bas Nieuwenhuizen:

On Thu, Jul 26, 2018 at 1:52 PM, Huang Rui  wrote:

Hi,

As suggested by Christian, we should move non-x86 definitions into one common
header, and it will make the codes readable. They are based on the improvement
fix of Bas (already rebase Bas's patch to drm-next).

Changes from V1 -> V2:
- add ttm_ prefix at this header.
- use set_pages_wb instead of set_memory_wb.

Thanks! For the series


Agreed, really nice cleanup.


Reviewed-by: Bas Nieuwenhuizen 


Reviewed-by: Christian König  as well.

Regards,
Christian.


Thanks,
Ray

Bas Nieuwenhuizen (1):
   drm/ttm: Merge hugepage attr changes in ttm_dma_page_put. (v2)

Huang Rui (3):
   drm/ttm: add ttm_set_memory header (v2)
   drm/ttm: clean up non-x86 definitions on ttm_page_alloc_dma
   drm/ttm: clean up non-x86 definitions on ttm_page_alloc

  drivers/gpu/drm/ttm/ttm_page_alloc.c |  62 ++-
  drivers/gpu/drm/ttm/ttm_page_alloc_dma.c |  57 ++
  include/drm/ttm/ttm_set_memory.h | 128 +++
  3 files changed, 140 insertions(+), 107 deletions(-)
  create mode 100644 include/drm/ttm/ttm_set_memory.h

--
2.7.4



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


Re: [PATCH v2 0/4] drm/ttm: move non-x86 definitions to the common header

2018-07-26 Thread Bas Nieuwenhuizen
On Thu, Jul 26, 2018 at 1:52 PM, Huang Rui  wrote:
> Hi,
>
> As suggested by Christian, we should move non-x86 definitions into one common
> header, and it will make the codes readable. They are based on the improvement
> fix of Bas (already rebase Bas's patch to drm-next).
>
> Changes from V1 -> V2:
> - add ttm_ prefix at this header.
> - use set_pages_wb instead of set_memory_wb.

Thanks! For the series

Reviewed-by: Bas Nieuwenhuizen 
>
> Thanks,
> Ray
>
> Bas Nieuwenhuizen (1):
>   drm/ttm: Merge hugepage attr changes in ttm_dma_page_put. (v2)
>
> Huang Rui (3):
>   drm/ttm: add ttm_set_memory header (v2)
>   drm/ttm: clean up non-x86 definitions on ttm_page_alloc_dma
>   drm/ttm: clean up non-x86 definitions on ttm_page_alloc
>
>  drivers/gpu/drm/ttm/ttm_page_alloc.c |  62 ++-
>  drivers/gpu/drm/ttm/ttm_page_alloc_dma.c |  57 ++
>  include/drm/ttm/ttm_set_memory.h | 128 
> +++
>  3 files changed, 140 insertions(+), 107 deletions(-)
>  create mode 100644 include/drm/ttm/ttm_set_memory.h
>
> --
> 2.7.4
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 2/2] ARM: dts: exynos: arndale: fix HDMI-HPD line handling

2018-07-26 Thread Krzysztof Kozlowski
On 26 July 2018 at 13:50, Andrzej Hajda  wrote:
> On 26.07.2018 12:44, Krzysztof Kozlowski wrote:
>> On 26 July 2018 at 12:12, Andrzej Hajda  wrote:
>>> HDMI-HPD was set active low, moreover by default pincontrol
>>> chip sets pull-down on the pin. As a result HDMI driver
>>> assumes TV is always connected regardless of actual state.
>>> The patch fixes it.
>>>
>>> Signed-off-by: Andrzej Hajda 
>>> ---
>>>  arch/arm/boot/dts/exynos5250-arndale.dts  | 4 +++-
>>>  arch/arm/boot/dts/exynos5250-pinctrl.dtsi | 5 +
>>>  2 files changed, 8 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/arch/arm/boot/dts/exynos5250-arndale.dts 
>>> b/arch/arm/boot/dts/exynos5250-arndale.dts
>>> index 591023391f7d..26bae5157177 100644
>>> --- a/arch/arm/boot/dts/exynos5250-arndale.dts
>>> +++ b/arch/arm/boot/dts/exynos5250-arndale.dts
>>> @@ -210,9 +210,11 @@
>>>  };
>>>
>>>  &hdmi {
>>> +   pinctrl-names = "default";
>>> +   pinctrl-0 = <&hdmi_hpd>;
>>> status = "okay";
>>> ddc = <&i2c_ddc>;
>>> -   hpd-gpios = <&gpx3 7 GPIO_ACTIVE_LOW>;
>>> +   hpd-gpios = <&gpx3 7 GPIO_ACTIVE_HIGH>;
>> The gpx3-7 (HDMI-HPD) has external pull up to... so maybe it should be
>> active low? How can it go high if it is already high?
>> I am not sure if this matters because the driver ignores the flags and
>> responds on both falling and rising edge.
>
> HDMI specification says HPD is active high!
> Arndale schematics are quite misleading - pull-up resistors near level
> shifter are marked as not-connected :) so there are no pull-ups.
> And there is pull-down resistor on right side of the level shifter.

Ah, I was looking at schematics and looking and looking and still did
not see "NC"... My mistake.

> And finally with this patch it works as expected, without it it works
> sometimes.

Everything is good. I already sent last pull request so this will go
after merge window, for v4.20 (or whatever number it will be).

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


[PATCH v2 3/4] drm/ttm: clean up non-x86 definitions on ttm_page_alloc

2018-07-26 Thread Huang Rui
All non-x86 definitions are moved to ttm_set_memory header, so remove it from
ttm_page_alloc.c.

Suggested-by: Christian König 
Signed-off-by: Huang Rui 
---
 drivers/gpu/drm/ttm/ttm_page_alloc.c | 62 +++-
 1 file changed, 5 insertions(+), 57 deletions(-)

diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc.c 
b/drivers/gpu/drm/ttm/ttm_page_alloc.c
index 6e2d130..f841acc 100644
--- a/drivers/gpu/drm/ttm/ttm_page_alloc.c
+++ b/drivers/gpu/drm/ttm/ttm_page_alloc.c
@@ -47,13 +47,7 @@
 
 #include 
 #include 
-
-#if IS_ENABLED(CONFIG_AGP)
-#include 
-#endif
-#ifdef CONFIG_X86
-#include 
-#endif
+#include 
 
 #define NUM_PAGES_TO_ALLOC (PAGE_SIZE/sizeof(struct page *))
 #define SMALL_ALLOCATION   16
@@ -222,52 +216,6 @@ static struct kobj_type ttm_pool_kobj_type = {
 
 static struct ttm_pool_manager *_manager;
 
-#ifndef CONFIG_X86
-static int set_pages_wb(struct page *page, int numpages)
-{
-#if IS_ENABLED(CONFIG_AGP)
-   int i;
-
-   for (i = 0; i < numpages; i++)
-   unmap_page_from_agp(page++);
-#endif
-   return 0;
-}
-
-static int set_pages_array_wb(struct page **pages, int addrinarray)
-{
-#if IS_ENABLED(CONFIG_AGP)
-   int i;
-
-   for (i = 0; i < addrinarray; i++)
-   unmap_page_from_agp(pages[i]);
-#endif
-   return 0;
-}
-
-static int set_pages_array_wc(struct page **pages, int addrinarray)
-{
-#if IS_ENABLED(CONFIG_AGP)
-   int i;
-
-   for (i = 0; i < addrinarray; i++)
-   map_page_into_agp(pages[i]);
-#endif
-   return 0;
-}
-
-static int set_pages_array_uc(struct page **pages, int addrinarray)
-{
-#if IS_ENABLED(CONFIG_AGP)
-   int i;
-
-   for (i = 0; i < addrinarray; i++)
-   map_page_into_agp(pages[i]);
-#endif
-   return 0;
-}
-#endif
-
 /**
  * Select the right pool or requested caching state and ttm flags. */
 static struct ttm_page_pool *ttm_get_pool(int flags, bool huge,
@@ -302,13 +250,13 @@ static void ttm_pages_put(struct page *pages[], unsigned 
npages,
unsigned int i, pages_nr = (1 << order);
 
if (order == 0) {
-   if (set_pages_array_wb(pages, npages))
+   if (ttm_set_pages_array_wb(pages, npages))
pr_err("Failed to set %d pages to wb!\n", npages);
}
 
for (i = 0; i < npages; ++i) {
if (order > 0) {
-   if (set_pages_wb(pages[i], pages_nr))
+   if (ttm_set_pages_wb(pages[i], pages_nr))
pr_err("Failed to set %d pages to wb!\n", 
pages_nr);
}
__free_pages(pages[i], order);
@@ -498,12 +446,12 @@ static int ttm_set_pages_caching(struct page **pages,
/* Set page caching */
switch (cstate) {
case tt_uncached:
-   r = set_pages_array_uc(pages, cpages);
+   r = ttm_set_pages_array_uc(pages, cpages);
if (r)
pr_err("Failed to set %d pages to uc!\n", cpages);
break;
case tt_wc:
-   r = set_pages_array_wc(pages, cpages);
+   r = ttm_set_pages_array_wc(pages, cpages);
if (r)
pr_err("Failed to set %d pages to wc!\n", cpages);
break;
-- 
2.7.4

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


[PATCH v2 2/4] drm/ttm: clean up non-x86 definitions on ttm_page_alloc_dma

2018-07-26 Thread Huang Rui
All non-x86 definitions are moved to ttm_set_memory header, so remove it from
ttm_page_alloc_dma.c.

Suggested-by: Christian König 
Signed-off-by: Huang Rui 
---
 drivers/gpu/drm/ttm/ttm_page_alloc_dma.c | 48 +++-
 1 file changed, 4 insertions(+), 44 deletions(-)

diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c 
b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
index 3f14c1c..f31148a 100644
--- a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
+++ b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
@@ -50,12 +50,7 @@
 #include 
 #include 
 #include 
-#if IS_ENABLED(CONFIG_AGP)
-#include 
-#endif
-#ifdef CONFIG_X86
-#include 
-#endif
+#include 
 
 #define NUM_PAGES_TO_ALLOC (PAGE_SIZE/sizeof(struct page *))
 #define SMALL_ALLOCATION   4
@@ -268,41 +263,6 @@ static struct kobj_type ttm_pool_kobj_type = {
.default_attrs = ttm_pool_attrs,
 };
 
-#ifndef CONFIG_X86
-static int set_pages_array_wb(struct page **pages, int addrinarray)
-{
-#if IS_ENABLED(CONFIG_AGP)
-   int i;
-
-   for (i = 0; i < addrinarray; i++)
-   unmap_page_from_agp(pages[i]);
-#endif
-   return 0;
-}
-
-static int set_pages_array_wc(struct page **pages, int addrinarray)
-{
-#if IS_ENABLED(CONFIG_AGP)
-   int i;
-
-   for (i = 0; i < addrinarray; i++)
-   map_page_into_agp(pages[i]);
-#endif
-   return 0;
-}
-
-static int set_pages_array_uc(struct page **pages, int addrinarray)
-{
-#if IS_ENABLED(CONFIG_AGP)
-   int i;
-
-   for (i = 0; i < addrinarray; i++)
-   map_page_into_agp(pages[i]);
-#endif
-   return 0;
-}
-#endif /* for !CONFIG_X86 */
-
 static int ttm_set_pages_caching(struct dma_pool *pool,
 struct page **pages, unsigned cpages)
 {
@@ -315,7 +275,7 @@ static int ttm_set_pages_caching(struct dma_pool *pool,
   pool->dev_name, cpages);
}
if (pool->type & IS_WC) {
-   r = set_pages_array_wc(pages, cpages);
+   r = ttm_set_pages_array_wc(pages, cpages);
if (r)
pr_err("%s: Failed to set %d pages to wc!\n",
   pool->dev_name, cpages);
@@ -395,7 +355,7 @@ static void ttm_dma_page_put(struct dma_pool *pool, struct 
dma_page *d_page)
if (!(pool->type & IS_CACHED)) {
num_pages = pool->size / PAGE_SIZE;
for (i = 0; i < num_pages; ++i, ++page) {
-   if (set_pages_array_wb(&page, 1)) {
+   if (ttm_set_pages_array_wb(&page, 1)) {
pr_err("%s: Failed to set %d pages to wb!\n",
   pool->dev_name, 1);
}
@@ -420,7 +380,7 @@ static void ttm_dma_pages_put(struct dma_pool *pool, struct 
list_head *d_pages,
 
/* Don't set WB on WB page pool. */
if (npages && !(pool->type & IS_CACHED) &&
-   set_pages_array_wb(pages, npages))
+   ttm_set_pages_array_wb(pages, npages))
pr_err("%s: Failed to set %d pages to wb!\n",
   pool->dev_name, npages);
 
-- 
2.7.4

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


[PATCH v2 4/4] drm/ttm: Merge hugepage attr changes in ttm_dma_page_put. (v2)

2018-07-26 Thread Huang Rui
From: Bas Nieuwenhuizen 

Every set_pages_array_wb call resulted in cross-core
interrupts and TLB flushes. Merge more of them for
less overhead.

This reduces the time needed to free a 1.6 GiB GTT WC
buffer as part of Vulkan CTS from  ~2 sec to < 0.25 sec.
(Allocation still takes more than 2 sec though)

(v2): use set_pages_wb instead of set_memory_wb.

Signed-off-by: Bas Nieuwenhuizen 
Signed-off-by: Huang Rui 
---
 drivers/gpu/drm/ttm/ttm_page_alloc_dma.c | 11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c 
b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
index f31148a..8304917 100644
--- a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
+++ b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
@@ -349,17 +349,14 @@ static void ttm_pool_update_free_locked(struct dma_pool 
*pool,
 static void ttm_dma_page_put(struct dma_pool *pool, struct dma_page *d_page)
 {
struct page *page = d_page->p;
-   unsigned i, num_pages;
+   unsigned num_pages;
 
/* Don't set WB on WB page pool. */
if (!(pool->type & IS_CACHED)) {
num_pages = pool->size / PAGE_SIZE;
-   for (i = 0; i < num_pages; ++i, ++page) {
-   if (ttm_set_pages_array_wb(&page, 1)) {
-   pr_err("%s: Failed to set %d pages to wb!\n",
-  pool->dev_name, 1);
-   }
-   }
+   if (ttm_set_pages_wb(page, num_pages))
+   pr_err("%s: Failed to set %d pages to wb!\n",
+  pool->dev_name, num_pages);
}
 
list_del(&d_page->page_list);
-- 
2.7.4

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


[PATCH v2 1/4] drm/ttm: add ttm_set_memory header (v2)

2018-07-26 Thread Huang Rui
This patch moves all non-x86 abstraction to the ttm_set_memory header.
It is to make function calling more clearly.

(v2): add ttm_ prefix.

Suggested-by: Christian König 
Signed-off-by: Huang Rui 
---
 include/drm/ttm/ttm_set_memory.h | 128 +++
 1 file changed, 128 insertions(+)
 create mode 100644 include/drm/ttm/ttm_set_memory.h

diff --git a/include/drm/ttm/ttm_set_memory.h b/include/drm/ttm/ttm_set_memory.h
new file mode 100644
index 000..a70723c
--- /dev/null
+++ b/include/drm/ttm/ttm_set_memory.h
@@ -0,0 +1,128 @@
+/**
+ *
+ * Copyright (c) 2018 Advanced Micro Devices, Inc.
+ * All Rights Reserved.
+ *
+ * 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, sub license, 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 SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **/
+/*
+ * Authors: Huang Rui 
+ */
+
+#ifndef TTM_SET_MEMORY
+#define TTM_SET_MEMORY
+
+#include 
+
+#ifdef CONFIG_X86
+
+#include 
+
+static inline int ttm_set_pages_array_wb(struct page **pages, int addrinarray)
+{
+   return set_pages_array_wb(pages, addrinarray);
+}
+
+static inline int ttm_set_pages_array_wc(struct page **pages, int addrinarray)
+{
+   return set_pages_array_wc(pages, addrinarray);
+}
+
+static inline int ttm_set_pages_array_uc(struct page **pages, int addrinarray)
+{
+   return set_pages_array_uc(pages, addrinarray);
+}
+
+static inline int ttm_set_pages_wb(struct page *page, int numpages)
+{
+   return set_pages_wb(page, numpages);
+}
+
+#else /* for CONFIG_X86 */
+
+#if IS_ENABLED(CONFIG_AGP)
+
+#include 
+
+static inline int ttm_set_pages_array_wb(struct page **pages, int addrinarray)
+{
+   int i;
+
+   for (i = 0; i < addrinarray; i++)
+   unmap_page_from_agp(pages[i]);
+   return 0;
+}
+
+static inline int ttm_set_pages_array_wc(struct page **pages, int addrinarray)
+{
+   int i;
+
+   for (i = 0; i < addrinarray; i++)
+   map_page_into_agp(pages[i]);
+   return 0;
+}
+
+static inline int ttm_set_pages_array_uc(struct page **pages, int addrinarray)
+{
+   int i;
+
+   for (i = 0; i < addrinarray; i++)
+   map_page_into_agp(pages[i]);
+   return 0;
+}
+
+static inline int ttm_set_pages_wb(struct page *page, int numpages)
+{
+   int i;
+
+   for (i = 0; i < numpages; i++)
+   unmap_page_from_agp(page++);
+   return 0;
+}
+
+#else /* for CONFIG_AGP */
+
+static inline int ttm_set_pages_array_wb(struct page **pages, int addrinarray)
+{
+   return 0;
+}
+
+static inline int ttm_set_pages_array_wc(struct page **pages, int addrinarray)
+{
+   return 0;
+}
+
+static inline int ttm_set_pages_array_uc(struct page **pages, int addrinarray)
+{
+   return 0;
+}
+
+static inline int ttm_set_pages_wb(struct page *page, int numpages)
+{
+   return 0;
+}
+
+#endif /* for CONFIG_AGP */
+
+#endif /* for CONFIG_X86 */
+
+#endif
-- 
2.7.4

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


[PATCH v2 0/4] drm/ttm: move non-x86 definitions to the common header

2018-07-26 Thread Huang Rui
Hi,

As suggested by Christian, we should move non-x86 definitions into one common
header, and it will make the codes readable. They are based on the improvement
fix of Bas (already rebase Bas's patch to drm-next).

Changes from V1 -> V2:
- add ttm_ prefix at this header.
- use set_pages_wb instead of set_memory_wb.

Thanks,
Ray

Bas Nieuwenhuizen (1):
  drm/ttm: Merge hugepage attr changes in ttm_dma_page_put. (v2)

Huang Rui (3):
  drm/ttm: add ttm_set_memory header (v2)
  drm/ttm: clean up non-x86 definitions on ttm_page_alloc_dma
  drm/ttm: clean up non-x86 definitions on ttm_page_alloc

 drivers/gpu/drm/ttm/ttm_page_alloc.c |  62 ++-
 drivers/gpu/drm/ttm/ttm_page_alloc_dma.c |  57 ++
 include/drm/ttm/ttm_set_memory.h | 128 +++
 3 files changed, 140 insertions(+), 107 deletions(-)
 create mode 100644 include/drm/ttm/ttm_set_memory.h

-- 
2.7.4

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


Re: [PATCH 1/2] ARM: dts: exynos: arndale: use i2c-gpio for HDMI-DDC

2018-07-26 Thread Krzysztof Kozlowski
On 26 July 2018 at 13:04, Andrzej Hajda  wrote:
> On 26.07.2018 12:23, Krzysztof Kozlowski wrote:
>> On 26 July 2018 at 12:12, Andrzej Hajda  wrote:
>>> HDMI-DDC for unknown reasons doesn't work with Exynos I2C
>>> controllers. Fortunately i2c-gpio comes to the rescue.
>> Wait... what? The I2C controller on SoC (or its driver) is buggy in
>> some way and we need to use these pins as GPIO to run i2c-gpio driver
>> there? It looks like workaround not a proper solution...
>
> But at least working one :) Better solutions are welcome.
> This seems to be not uncommon issue, if you for example look into odroid
> vendor kernel you can even find hardcoded EDIDs :)

I am not sure whether hardkernel's tree is a good argument. They took
vendor's tree and apply whatever patches/fixes are needed to bring it
up. They do not have time to look for correct (the "best") fixes. They
choose whatever is working now.
Better solution would be to spend months and fix the driver. :)

Can you at least mention next to i2c-gpio node that it replaces i2c_2
because of this?

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


Re: [PATCH 2/2] ARM: dts: exynos: arndale: fix HDMI-HPD line handling

2018-07-26 Thread Andrzej Hajda
On 26.07.2018 12:44, Krzysztof Kozlowski wrote:
> On 26 July 2018 at 12:12, Andrzej Hajda  wrote:
>> HDMI-HPD was set active low, moreover by default pincontrol
>> chip sets pull-down on the pin. As a result HDMI driver
>> assumes TV is always connected regardless of actual state.
>> The patch fixes it.
>>
>> Signed-off-by: Andrzej Hajda 
>> ---
>>  arch/arm/boot/dts/exynos5250-arndale.dts  | 4 +++-
>>  arch/arm/boot/dts/exynos5250-pinctrl.dtsi | 5 +
>>  2 files changed, 8 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/arm/boot/dts/exynos5250-arndale.dts 
>> b/arch/arm/boot/dts/exynos5250-arndale.dts
>> index 591023391f7d..26bae5157177 100644
>> --- a/arch/arm/boot/dts/exynos5250-arndale.dts
>> +++ b/arch/arm/boot/dts/exynos5250-arndale.dts
>> @@ -210,9 +210,11 @@
>>  };
>>
>>  &hdmi {
>> +   pinctrl-names = "default";
>> +   pinctrl-0 = <&hdmi_hpd>;
>> status = "okay";
>> ddc = <&i2c_ddc>;
>> -   hpd-gpios = <&gpx3 7 GPIO_ACTIVE_LOW>;
>> +   hpd-gpios = <&gpx3 7 GPIO_ACTIVE_HIGH>;
> The gpx3-7 (HDMI-HPD) has external pull up to... so maybe it should be
> active low? How can it go high if it is already high?
> I am not sure if this matters because the driver ignores the flags and
> responds on both falling and rising edge.

HDMI specification says HPD is active high!
Arndale schematics are quite misleading - pull-up resistors near level
shifter are marked as not-connected :) so there are no pull-ups.
And there is pull-down resistor on right side of the level shifter.
And finally with this patch it works as expected, without it it works
sometimes.

Regards
Andrzej

>
> Best regards,
> Krzysztof
>
>> vdd_osc-supply = <&ldo10_reg>;
>> vdd_pll-supply = <&ldo8_reg>;
>> vdd-supply = <&ldo8_reg>;
>> diff --git a/arch/arm/boot/dts/exynos5250-pinctrl.dtsi 
>> b/arch/arm/boot/dts/exynos5250-pinctrl.dtsi
>> index b25d520393b8..d31a68672bfa 100644
>> --- a/arch/arm/boot/dts/exynos5250-pinctrl.dtsi
>> +++ b/arch/arm/boot/dts/exynos5250-pinctrl.dtsi
>> @@ -599,6 +599,11 @@
>> samsung,pin-pud = ;
>> samsung,pin-drv = ;
>> };
>> +
>> +   hdmi_hpd: hdmi-hpd {
>> +   samsung,pins = "gpx3-7";
>> +   samsung,pin-pud = ;
>> +   };
>>  };
>>
>>  &pinctrl_1 {
>> --
>> 2.18.0
>>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" 
> in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
>

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


[PATCH] drm/scheduler: only kill entity if last user is killed

2018-07-26 Thread Christian König
Note which task is using the entity and only kill it if the last user of
the entity is killed. This should prevent problems when entities are leaked to
child processes.

Signed-off-by: Christian König 
---
 drivers/gpu/drm/scheduler/gpu_scheduler.c | 6 +-
 include/drm/gpu_scheduler.h   | 1 +
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/scheduler/gpu_scheduler.c 
b/drivers/gpu/drm/scheduler/gpu_scheduler.c
index 3f2fc5e8242a..f563e4fbb4b6 100644
--- a/drivers/gpu/drm/scheduler/gpu_scheduler.c
+++ b/drivers/gpu/drm/scheduler/gpu_scheduler.c
@@ -275,6 +275,7 @@ static void drm_sched_entity_kill_jobs_cb(struct dma_fence 
*f,
 long drm_sched_entity_flush(struct drm_sched_entity *entity, long timeout)
 {
struct drm_gpu_scheduler *sched;
+   struct task_struct *last_user;
long ret = timeout;
 
sched = entity->rq->sched;
@@ -295,7 +296,9 @@ long drm_sched_entity_flush(struct drm_sched_entity 
*entity, long timeout)
 
 
/* For killed process disable any more IBs enqueue right now */
-   if ((current->flags & PF_EXITING) && (current->exit_code == SIGKILL))
+   last_user = cmpxchg(&entity->last_user, current->group_leader, NULL);
+   if ((!last_user || last_user == current->group_leader) &&
+   (current->flags & PF_EXITING) && (current->exit_code == SIGKILL))
drm_sched_entity_set_rq(entity, NULL);
 
return ret;
@@ -541,6 +544,7 @@ void drm_sched_entity_push_job(struct drm_sched_job 
*sched_job,
 
trace_drm_sched_job(sched_job, entity);
 
+   WRITE_ONCE(entity->last_user, current->group_leader);
first = spsc_queue_push(&entity->job_queue, &sched_job->queue_node);
 
/* first job wakes up scheduler */
diff --git a/include/drm/gpu_scheduler.h b/include/drm/gpu_scheduler.h
index 091b9afcd184..64016446a103 100644
--- a/include/drm/gpu_scheduler.h
+++ b/include/drm/gpu_scheduler.h
@@ -85,6 +85,7 @@ struct drm_sched_entity {
struct dma_fence_cb cb;
atomic_t*guilty;
struct dma_fence*last_scheduled;
+   struct task_struct  *last_user;
 };
 
 /**
-- 
2.14.1

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


Re: [PATCH v3 03/19] drm: add msm compressed format modifiers

2018-07-26 Thread Rob Clark
On Wed, Jul 25, 2018 at 7:09 PM, Jeykumar Sankaran
 wrote:
> On 2018-07-25 07:09, Stanimir Varbanov wrote:
>>
>> Hi,
>>
>> On 07/20/2018 11:42 PM, Sean Paul wrote:
>>>
>>> From: Jeykumar Sankaran 
>>>
>>> Qualcomm Snapdragon chipsets uses compressed format
>>> to optimize BW across multiple IP's. This change adds
>>> needed modifier support in drm for a simple 4x4 tile
>>> based compressed variants of base formats.
>>>
>>> Changes in v3:
>>> - Removed duplicate entry for DRM_FORMAT_MOD_QCOM_COMPRESSED (Rob Clark)
>>>
>>> Signed-off-by: Jeykumar Sankaran 
>>> Signed-off-by: Sean Paul 
>>> ---
>>>  include/uapi/drm/drm_fourcc.h | 37 +++
>>>  1 file changed, 37 insertions(+)
>>>
>>> diff --git a/include/uapi/drm/drm_fourcc.h
>>> b/include/uapi/drm/drm_fourcc.h
>>> index e04613d30a13..1c9a6bf8c81e 100644
>>> --- a/include/uapi/drm/drm_fourcc.h
>>> +++ b/include/uapi/drm/drm_fourcc.h
>>> @@ -298,6 +298,43 @@ extern "C" {
>>>   */
>>>  #define DRM_FORMAT_MOD_SAMSUNG_64_32_TILE  fourcc_mod_code(SAMSUNG,
>>> 1)
>>>
>>> +/*
>>> + * Qualcomm Compressed Format
>>> + *
>>> + * Refers to a compressed variant of the base format that is compressed.
>>> + * Implementation may be platform and base-format specific.
>>> + *
>>> + * Each macrotile consists of m x n (mostly 4 x 4) tiles.
>>> + * Pixel data pitch/stride is aligned with macrotile width.
>>> + * Pixel data height is aligned with macrotile height.
>>> + * Entire pixel data buffer is aligned with 4k(bytes).
>>> + */
>>> +#define DRM_FORMAT_MOD_QCOM_COMPRESSED fourcc_mod_code(QCOM, 1)
>>> +
>>> +/*
>>> + * QTI DX Format
>>> + *
>>> + * Refers to a DX variant of the base format.
>>> + * Implementation may be platform and base-format specific.
>>> + */
>>> +#define DRM_FORMAT_MOD_QCOM_DX fourcc_mod_code(QCOM, 0x2)
>>
>>
>> What DX stands for?
>
>
> _DX is QCOM modifier for identifying 10bit version of NV12 format since
> there is no fourcc_code for the same.
>

this sounds like it should actually be P010 then.. not a modifier.. I
think we should remove the modifier before it ends up in a release..

See: https://patchwork.freedesktop.org/patch/141342/

from a quick look, it seems like we just need a driver that supports
it to land the new fourcc's

BR,
-R


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


Re: [PATCH 1/2] ARM: dts: exynos: arndale: use i2c-gpio for HDMI-DDC

2018-07-26 Thread Andrzej Hajda
On 26.07.2018 12:23, Krzysztof Kozlowski wrote:
> On 26 July 2018 at 12:12, Andrzej Hajda  wrote:
>> HDMI-DDC for unknown reasons doesn't work with Exynos I2C
>> controllers. Fortunately i2c-gpio comes to the rescue.
> Wait... what? The I2C controller on SoC (or its driver) is buggy in
> some way and we need to use these pins as GPIO to run i2c-gpio driver
> there? It looks like workaround not a proper solution...

But at least working one :) Better solutions are welcome.
This seems to be not uncommon issue, if you for example look into odroid
vendor kernel you can even find hardcoded EDIDs :)

Regards
Andrzej


>
> Best regards,
> Krzysztof
>
>> Signed-off-by: Andrzej Hajda 
>> ---
>>  arch/arm/boot/dts/exynos5250-arndale.dts  | 24 +++
>>  arch/arm/boot/dts/exynos5250-pinctrl.dtsi |  6 ++
>>  2 files changed, 22 insertions(+), 8 deletions(-)
>>
>> diff --git a/arch/arm/boot/dts/exynos5250-arndale.dts 
>> b/arch/arm/boot/dts/exynos5250-arndale.dts
>> index 816d89d4cefd..591023391f7d 100644
>> --- a/arch/arm/boot/dts/exynos5250-arndale.dts
>> +++ b/arch/arm/boot/dts/exynos5250-arndale.dts
>> @@ -211,7 +211,7 @@
>>
>>  &hdmi {
>> status = "okay";
>> -   ddc = <&i2c_2>;
>> +   ddc = <&i2c_ddc>;
>> hpd-gpios = <&gpx3 7 GPIO_ACTIVE_LOW>;
>> vdd_osc-supply = <&ldo10_reg>;
>> vdd_pll-supply = <&ldo8_reg>;
>> @@ -513,13 +513,6 @@
>> };
>>  };
>>
>> -&i2c_2 {
>> -   status = "okay";
>> -   /* used by HDMI DDC */
>> -   samsung,i2c-sda-delay = <100>;
>> -   samsung,i2c-max-bus-freq = <66000>;
>> -};
>> -
>>  &i2c_3 {
>> status = "okay";
>>
>> @@ -608,3 +601,18 @@
>> status = "okay";
>> samsung,exynos-sataphy-i2c-phandle = <&sata_phy_i2c>;
>>  };
>> +
>> +&soc {
>> +   i2c_ddc: i2c-gpio {
>> +   pinctrl-names = "default";
>> +   pinctrl-0 = <&i2c2_gpio_bus>;
>> +   status = "okay";
>> +   compatible = "i2c-gpio";
>> +   gpios = <&gpa0 6 0 /* sda */
>> +&gpa0 7 0 /* scl */
>> +   >;
>> +   i2c-gpio,delay-us = <2>;
>> +   #address-cells = <1>;
>> +   #size-cells = <0>;
>> +   };
>> +};
>> diff --git a/arch/arm/boot/dts/exynos5250-pinctrl.dtsi 
>> b/arch/arm/boot/dts/exynos5250-pinctrl.dtsi
>> index 6ff6dea29d44..b25d520393b8 100644
>> --- a/arch/arm/boot/dts/exynos5250-pinctrl.dtsi
>> +++ b/arch/arm/boot/dts/exynos5250-pinctrl.dtsi
>> @@ -225,6 +225,12 @@
>> samsung,pin-drv = ;
>> };
>>
>> +   i2c2_gpio_bus: i2c2-gpio-bus {
>> +   samsung,pins = "gpa0-6", "gpa0-7";
>> +   samsung,pin-pud = ;
>> +   samsung,pin-drv = ;
>> +   };
>> +
>> uart2_data: uart2-data {
>> samsung,pins = "gpa1-0", "gpa1-1";
>> samsung,pin-function = ;
>> --
>> 2.18.0
>>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" 
> in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
>

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


Re: [PATCH 2/2] ARM: dts: exynos: arndale: fix HDMI-HPD line handling

2018-07-26 Thread Krzysztof Kozlowski
On 26 July 2018 at 12:12, Andrzej Hajda  wrote:
> HDMI-HPD was set active low, moreover by default pincontrol
> chip sets pull-down on the pin. As a result HDMI driver
> assumes TV is always connected regardless of actual state.
> The patch fixes it.
>
> Signed-off-by: Andrzej Hajda 
> ---
>  arch/arm/boot/dts/exynos5250-arndale.dts  | 4 +++-
>  arch/arm/boot/dts/exynos5250-pinctrl.dtsi | 5 +
>  2 files changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm/boot/dts/exynos5250-arndale.dts 
> b/arch/arm/boot/dts/exynos5250-arndale.dts
> index 591023391f7d..26bae5157177 100644
> --- a/arch/arm/boot/dts/exynos5250-arndale.dts
> +++ b/arch/arm/boot/dts/exynos5250-arndale.dts
> @@ -210,9 +210,11 @@
>  };
>
>  &hdmi {
> +   pinctrl-names = "default";
> +   pinctrl-0 = <&hdmi_hpd>;
> status = "okay";
> ddc = <&i2c_ddc>;
> -   hpd-gpios = <&gpx3 7 GPIO_ACTIVE_LOW>;
> +   hpd-gpios = <&gpx3 7 GPIO_ACTIVE_HIGH>;

The gpx3-7 (HDMI-HPD) has external pull up to... so maybe it should be
active low? How can it go high if it is already high?
I am not sure if this matters because the driver ignores the flags and
responds on both falling and rising edge.

Best regards,
Krzysztof

> vdd_osc-supply = <&ldo10_reg>;
> vdd_pll-supply = <&ldo8_reg>;
> vdd-supply = <&ldo8_reg>;
> diff --git a/arch/arm/boot/dts/exynos5250-pinctrl.dtsi 
> b/arch/arm/boot/dts/exynos5250-pinctrl.dtsi
> index b25d520393b8..d31a68672bfa 100644
> --- a/arch/arm/boot/dts/exynos5250-pinctrl.dtsi
> +++ b/arch/arm/boot/dts/exynos5250-pinctrl.dtsi
> @@ -599,6 +599,11 @@
> samsung,pin-pud = ;
> samsung,pin-drv = ;
> };
> +
> +   hdmi_hpd: hdmi-hpd {
> +   samsung,pins = "gpx3-7";
> +   samsung,pin-pud = ;
> +   };
>  };
>
>  &pinctrl_1 {
> --
> 2.18.0
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 1/2] ARM: dts: exynos: arndale: use i2c-gpio for HDMI-DDC

2018-07-26 Thread Krzysztof Kozlowski
On 26 July 2018 at 12:12, Andrzej Hajda  wrote:
> HDMI-DDC for unknown reasons doesn't work with Exynos I2C
> controllers. Fortunately i2c-gpio comes to the rescue.

Wait... what? The I2C controller on SoC (or its driver) is buggy in
some way and we need to use these pins as GPIO to run i2c-gpio driver
there? It looks like workaround not a proper solution...

Best regards,
Krzysztof

> Signed-off-by: Andrzej Hajda 
> ---
>  arch/arm/boot/dts/exynos5250-arndale.dts  | 24 +++
>  arch/arm/boot/dts/exynos5250-pinctrl.dtsi |  6 ++
>  2 files changed, 22 insertions(+), 8 deletions(-)
>
> diff --git a/arch/arm/boot/dts/exynos5250-arndale.dts 
> b/arch/arm/boot/dts/exynos5250-arndale.dts
> index 816d89d4cefd..591023391f7d 100644
> --- a/arch/arm/boot/dts/exynos5250-arndale.dts
> +++ b/arch/arm/boot/dts/exynos5250-arndale.dts
> @@ -211,7 +211,7 @@
>
>  &hdmi {
> status = "okay";
> -   ddc = <&i2c_2>;
> +   ddc = <&i2c_ddc>;
> hpd-gpios = <&gpx3 7 GPIO_ACTIVE_LOW>;
> vdd_osc-supply = <&ldo10_reg>;
> vdd_pll-supply = <&ldo8_reg>;
> @@ -513,13 +513,6 @@
> };
>  };
>
> -&i2c_2 {
> -   status = "okay";
> -   /* used by HDMI DDC */
> -   samsung,i2c-sda-delay = <100>;
> -   samsung,i2c-max-bus-freq = <66000>;
> -};
> -
>  &i2c_3 {
> status = "okay";
>
> @@ -608,3 +601,18 @@
> status = "okay";
> samsung,exynos-sataphy-i2c-phandle = <&sata_phy_i2c>;
>  };
> +
> +&soc {
> +   i2c_ddc: i2c-gpio {
> +   pinctrl-names = "default";
> +   pinctrl-0 = <&i2c2_gpio_bus>;
> +   status = "okay";
> +   compatible = "i2c-gpio";
> +   gpios = <&gpa0 6 0 /* sda */
> +&gpa0 7 0 /* scl */
> +   >;
> +   i2c-gpio,delay-us = <2>;
> +   #address-cells = <1>;
> +   #size-cells = <0>;
> +   };
> +};
> diff --git a/arch/arm/boot/dts/exynos5250-pinctrl.dtsi 
> b/arch/arm/boot/dts/exynos5250-pinctrl.dtsi
> index 6ff6dea29d44..b25d520393b8 100644
> --- a/arch/arm/boot/dts/exynos5250-pinctrl.dtsi
> +++ b/arch/arm/boot/dts/exynos5250-pinctrl.dtsi
> @@ -225,6 +225,12 @@
> samsung,pin-drv = ;
> };
>
> +   i2c2_gpio_bus: i2c2-gpio-bus {
> +   samsung,pins = "gpa0-6", "gpa0-7";
> +   samsung,pin-pud = ;
> +   samsung,pin-drv = ;
> +   };
> +
> uart2_data: uart2-data {
> samsung,pins = "gpa1-0", "gpa1-1";
> samsung,pin-function = ;
> --
> 2.18.0
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 2/2] ARM: dts: exynos: arndale: fix HDMI-HPD line handling

2018-07-26 Thread Andrzej Hajda
HDMI-HPD was set active low, moreover by default pincontrol
chip sets pull-down on the pin. As a result HDMI driver
assumes TV is always connected regardless of actual state.
The patch fixes it.

Signed-off-by: Andrzej Hajda 
---
 arch/arm/boot/dts/exynos5250-arndale.dts  | 4 +++-
 arch/arm/boot/dts/exynos5250-pinctrl.dtsi | 5 +
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/exynos5250-arndale.dts 
b/arch/arm/boot/dts/exynos5250-arndale.dts
index 591023391f7d..26bae5157177 100644
--- a/arch/arm/boot/dts/exynos5250-arndale.dts
+++ b/arch/arm/boot/dts/exynos5250-arndale.dts
@@ -210,9 +210,11 @@
 };
 
 &hdmi {
+   pinctrl-names = "default";
+   pinctrl-0 = <&hdmi_hpd>;
status = "okay";
ddc = <&i2c_ddc>;
-   hpd-gpios = <&gpx3 7 GPIO_ACTIVE_LOW>;
+   hpd-gpios = <&gpx3 7 GPIO_ACTIVE_HIGH>;
vdd_osc-supply = <&ldo10_reg>;
vdd_pll-supply = <&ldo8_reg>;
vdd-supply = <&ldo8_reg>;
diff --git a/arch/arm/boot/dts/exynos5250-pinctrl.dtsi 
b/arch/arm/boot/dts/exynos5250-pinctrl.dtsi
index b25d520393b8..d31a68672bfa 100644
--- a/arch/arm/boot/dts/exynos5250-pinctrl.dtsi
+++ b/arch/arm/boot/dts/exynos5250-pinctrl.dtsi
@@ -599,6 +599,11 @@
samsung,pin-pud = ;
samsung,pin-drv = ;
};
+
+   hdmi_hpd: hdmi-hpd {
+   samsung,pins = "gpx3-7";
+   samsung,pin-pud = ;
+   };
 };
 
 &pinctrl_1 {
-- 
2.18.0

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


[PATCH 1/2] ARM: dts: exynos: arndale: use i2c-gpio for HDMI-DDC

2018-07-26 Thread Andrzej Hajda
HDMI-DDC for unknown reasons doesn't work with Exynos I2C
controllers. Fortunately i2c-gpio comes to the rescue.

Signed-off-by: Andrzej Hajda 
---
 arch/arm/boot/dts/exynos5250-arndale.dts  | 24 +++
 arch/arm/boot/dts/exynos5250-pinctrl.dtsi |  6 ++
 2 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/arch/arm/boot/dts/exynos5250-arndale.dts 
b/arch/arm/boot/dts/exynos5250-arndale.dts
index 816d89d4cefd..591023391f7d 100644
--- a/arch/arm/boot/dts/exynos5250-arndale.dts
+++ b/arch/arm/boot/dts/exynos5250-arndale.dts
@@ -211,7 +211,7 @@
 
 &hdmi {
status = "okay";
-   ddc = <&i2c_2>;
+   ddc = <&i2c_ddc>;
hpd-gpios = <&gpx3 7 GPIO_ACTIVE_LOW>;
vdd_osc-supply = <&ldo10_reg>;
vdd_pll-supply = <&ldo8_reg>;
@@ -513,13 +513,6 @@
};
 };
 
-&i2c_2 {
-   status = "okay";
-   /* used by HDMI DDC */
-   samsung,i2c-sda-delay = <100>;
-   samsung,i2c-max-bus-freq = <66000>;
-};
-
 &i2c_3 {
status = "okay";
 
@@ -608,3 +601,18 @@
status = "okay";
samsung,exynos-sataphy-i2c-phandle = <&sata_phy_i2c>;
 };
+
+&soc {
+   i2c_ddc: i2c-gpio {
+   pinctrl-names = "default";
+   pinctrl-0 = <&i2c2_gpio_bus>;
+   status = "okay";
+   compatible = "i2c-gpio";
+   gpios = <&gpa0 6 0 /* sda */
+&gpa0 7 0 /* scl */
+   >;
+   i2c-gpio,delay-us = <2>;
+   #address-cells = <1>;
+   #size-cells = <0>;
+   };
+};
diff --git a/arch/arm/boot/dts/exynos5250-pinctrl.dtsi 
b/arch/arm/boot/dts/exynos5250-pinctrl.dtsi
index 6ff6dea29d44..b25d520393b8 100644
--- a/arch/arm/boot/dts/exynos5250-pinctrl.dtsi
+++ b/arch/arm/boot/dts/exynos5250-pinctrl.dtsi
@@ -225,6 +225,12 @@
samsung,pin-drv = ;
};
 
+   i2c2_gpio_bus: i2c2-gpio-bus {
+   samsung,pins = "gpa0-6", "gpa0-7";
+   samsung,pin-pud = ;
+   samsung,pin-drv = ;
+   };
+
uart2_data: uart2-data {
samsung,pins = "gpa1-0", "gpa1-1";
samsung,pin-function = ;
-- 
2.18.0

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


Re: [PATCH v3 03/19] drm: add msm compressed format modifiers

2018-07-26 Thread Stanimir Varbanov


On 07/26/2018 02:09 AM, Jeykumar Sankaran wrote:
> On 2018-07-25 07:09, Stanimir Varbanov wrote:
>> Hi,
>>
>> On 07/20/2018 11:42 PM, Sean Paul wrote:
>>> From: Jeykumar Sankaran 
>>>
>>> Qualcomm Snapdragon chipsets uses compressed format
>>> to optimize BW across multiple IP's. This change adds
>>> needed modifier support in drm for a simple 4x4 tile
>>> based compressed variants of base formats.
>>>
>>> Changes in v3:
>>> - Removed duplicate entry for DRM_FORMAT_MOD_QCOM_COMPRESSED (Rob Clark)
>>>
>>> Signed-off-by: Jeykumar Sankaran 
>>> Signed-off-by: Sean Paul 
>>> ---
>>>  include/uapi/drm/drm_fourcc.h | 37 +++
>>>  1 file changed, 37 insertions(+)
>>>
>>> diff --git a/include/uapi/drm/drm_fourcc.h
>>> b/include/uapi/drm/drm_fourcc.h
>>> index e04613d30a13..1c9a6bf8c81e 100644
>>> --- a/include/uapi/drm/drm_fourcc.h
>>> +++ b/include/uapi/drm/drm_fourcc.h
>>> @@ -298,6 +298,43 @@ extern "C" {
>>>   */
>>>  #define DRM_FORMAT_MOD_SAMSUNG_64_32_TILE   
>>> fourcc_mod_code(SAMSUNG, 1)
>>>
>>> +/*
>>> + * Qualcomm Compressed Format
>>> + *
>>> + * Refers to a compressed variant of the base format that is
>>> compressed.
>>> + * Implementation may be platform and base-format specific.
>>> + *
>>> + * Each macrotile consists of m x n (mostly 4 x 4) tiles.
>>> + * Pixel data pitch/stride is aligned with macrotile width.
>>> + * Pixel data height is aligned with macrotile height.
>>> + * Entire pixel data buffer is aligned with 4k(bytes).
>>> + */
>>> +#define DRM_FORMAT_MOD_QCOM_COMPRESSED    fourcc_mod_code(QCOM, 1)
>>> +
>>> +/*
>>> + * QTI DX Format
>>> + *
>>> + * Refers to a DX variant of the base format.
>>> + * Implementation may be platform and base-format specific.
>>> + */
>>> +#define DRM_FORMAT_MOD_QCOM_DX    fourcc_mod_code(QCOM, 0x2)
>>
>> What DX stands for?
> 
> _DX is QCOM modifier for identifying 10bit version of NV12 format since
> there is no fourcc_code for the same.
> 

Did you mean such as COLOR_FMT_P010? And how DX is translated to ?

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


[PATCH 1/5] drm/ttm: Merge hugepage attr changes in ttm_dma_page_put.

2018-07-26 Thread Huang Rui
From: Bas Nieuwenhuizen 

Every set_pages_array_wb call resulted in cross-core
interrupts and TLB flushes. Merge more of them for
less overhead.

This reduces the time needed to free a 1.6 GiB GTT WC
buffer as part of Vulkan CTS from  ~2 sec to < 0.25 sec.
(Allocation still takes more than 2 sec though)

Signed-off-by: Bas Nieuwenhuizen 
Signed-off-by: Huang Rui 
---
 drivers/gpu/drm/ttm/ttm_page_alloc_dma.c | 30 +++---
 1 file changed, 23 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c 
b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
index 3f14c1c..27fb543 100644
--- a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
+++ b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
@@ -301,6 +301,25 @@ static int set_pages_array_uc(struct page **pages, int 
addrinarray)
 #endif
return 0;
 }
+
+static int ttm_set_page_range_wb(struct page *p, unsigned long numpages)
+{
+#if IS_ENABLED(CONFIG_AGP)
+unsigned long i;
+
+for (i = 0; i < numpages; i++)
+unmap_page_from_agp(p + i);
+#endif
+   return 0;
+}
+
+#else /* for !CONFIG_X86 */
+
+static int ttm_set_page_range_wb(struct page *p, unsigned long numpages)
+{
+   return set_memory_wb((unsigned long)page_address(p), numpages);
+}
+
 #endif /* for !CONFIG_X86 */
 
 static int ttm_set_pages_caching(struct dma_pool *pool,
@@ -389,17 +408,14 @@ static void ttm_pool_update_free_locked(struct dma_pool 
*pool,
 static void ttm_dma_page_put(struct dma_pool *pool, struct dma_page *d_page)
 {
struct page *page = d_page->p;
-   unsigned i, num_pages;
+   unsigned num_pages;
 
/* Don't set WB on WB page pool. */
if (!(pool->type & IS_CACHED)) {
num_pages = pool->size / PAGE_SIZE;
-   for (i = 0; i < num_pages; ++i, ++page) {
-   if (set_pages_array_wb(&page, 1)) {
-   pr_err("%s: Failed to set %d pages to wb!\n",
-  pool->dev_name, 1);
-   }
-   }
+   if (ttm_set_page_range_wb(page, num_pages))
+   pr_err("%s: Failed to set %d pages to wb!\n",
+  pool->dev_name, num_pages);
}
 
list_del(&d_page->page_list);
-- 
2.7.4

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


[PATCH 0/5] drm/ttm: move non-x86 definitions to the common header

2018-07-26 Thread Huang Rui
Hi,

As suggested by Christian, we should move non-x86 definitions into one common
header, and it will make the codes readable. They are based on the improvement
fix of Bas (already rebase Bas's patch to drm-next).

Thanks,
Ray

Bas Nieuwenhuizen (1):
  drm/ttm: Merge hugepage attr changes in ttm_dma_page_put.

Huang Rui (4):
  drm/ttm: add ttm_set_memory header
  drm/ttm: clean up non-x86 definitions on ttm_page_alloc_dma
  drm/ttm: clean up non-x86 definitions on ttm_page_alloc
  drm/ttm: use set_pages_wb instead of set_memory_wb

 drivers/gpu/drm/ttm/ttm_page_alloc.c |  54 +
 drivers/gpu/drm/ttm/ttm_page_alloc_dma.c |  53 ++---
 include/drm/ttm/ttm_set_memory.h | 127 +++
 3 files changed, 133 insertions(+), 101 deletions(-)
 create mode 100644 include/drm/ttm/ttm_set_memory.h

-- 
2.7.4

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


[Bug 105733] Amdgpu randomly hangs and only ssh works. Mouse cursor moves sometimes but does nothing. Keyboard stops working.

2018-07-26 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105733

--- Comment #22 from Suloev Dmitry  ---
With iommu and dc system can't even boot.

-- 
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 105733] Amdgpu randomly hangs and only ssh works. Mouse cursor moves sometimes but does nothing. Keyboard stops working.

2018-07-26 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105733

--- Comment #21 from Suloev Dmitry  ---
Created attachment 140825
  --> https://bugs.freedesktop.org/attachment.cgi?id=140825&action=edit
amdgpu with dc enabled

And different traceback with amdgpu.dc enabled.

-- 
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] drm/ttm: Merge hugepage attr changes in ttm_dma_page_put.

2018-07-26 Thread Bas Nieuwenhuizen
On Thu, Jul 26, 2018 at 7:52 AM, Zhang, Jerry (Junwei)
 wrote:
> On 07/26/2018 04:29 AM, Bas Nieuwenhuizen wrote:
>>
>> Every set_pages_array_wb call resulted in cross-core
>> interrupts and TLB flushes. Merge more of them for
>> less overhead.
>>
>> This reduces the time needed to free a 1.6 GiB GTT WC
>> buffer as part of Vulkan CTS from  ~2 sec to < 0.25 sec.
>> (Allocation still takes more than 2 sec though)
>>
>> Signed-off-by: Bas Nieuwenhuizen 
>> ---
>>   drivers/gpu/drm/ttm/ttm_page_alloc_dma.c | 31 ++--
>>   1 file changed, 24 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
>> b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
>> index 4c659405a008a..9440ba0a55116 100644
>> --- a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
>> +++ b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
>> @@ -299,6 +299,25 @@ static int set_pages_array_uc(struct page **pages,
>> int addrinarray)
>>   #endif
>> return 0;
>>   }
>> +
>> +static int ttm_set_page_range_wb(struct page *p, unsigned long numpages)
>> +{
>> +#if IS_ENABLED(CONFIG_AGP)
>> +unsigned long i;
>> +
>> +for (i = 0; i < numpages; i++)
>> +unmap_page_from_agp(p + i);
>> +#endif
>> +   return 0;
>> +}
>> +
>> +#else /* for !CONFIG_X86 */
>> +
>> +static int ttm_set_page_range_wb(struct page *p, unsigned long numpages)
>> +{
>> +   return set_memory_wb((unsigned long)page_address(p), numpages);
>> +}
>> +
>>   #endif /* for !CONFIG_X86 */
>>
>>   static int ttm_set_pages_caching(struct dma_pool *pool,
>> @@ -387,18 +406,16 @@ static void ttm_pool_update_free_locked(struct
>> dma_pool *pool,
>>   static void ttm_dma_page_put(struct dma_pool *pool, struct dma_page
>> *d_page)
>>   {
>> struct page *page = d_page->p;
>> -   unsigned i, num_pages;
>> +   unsigned num_pages;
>> int ret;
>>
>> /* Don't set WB on WB page pool. */
>> if (!(pool->type & IS_CACHED)) {
>> num_pages = pool->size / PAGE_SIZE;
>> -   for (i = 0; i < num_pages; ++i, ++page) {
>> -   ret = set_pages_array_wb(&page, 1);
>> -   if (ret) {
>> -   pr_err("%s: Failed to set %d pages to
>> wb!\n",
>> -  pool->dev_name, 1);
>> -   }
>> +   ret = ttm_set_page_range_wb(page, num_pages);
>
>
> For AGP enabled, set_pages_array_wc() could works like that by passing
> "num_pages" instead of "1"
> In X86 case, we may use set_pages_array_wb() in arch/x86/mm/pageattr.c.
>
> so, does it work as below?
>
> ret = set_pages_array_wb(page, num_pages);

No that would not work. Note that we have an array of page structs,
while set_pages_array_wb() wants an array of pointers to page structs.
We could allocate a temporary array and write the pointers but that
seems unnecessarily inefficient to me, and probably also does not
achieve a reduction in code.

>
> Jerry
>
>
>> +   if (ret) {
>> +   pr_err("%s: Failed to set %d pages to wb!\n",
>> +  pool->dev_name, num_pages);
>> }
>> }
>>
>>
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 107384] random tab crashes in firefox nightly

2018-07-26 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=107384

Bug ID: 107384
   Summary: random tab crashes in firefox nightly
   Product: Mesa
   Version: git
  Hardware: Other
OS: All
Status: NEW
  Severity: normal
  Priority: medium
 Component: Drivers/Gallium/radeonsi
  Assignee: dri-devel@lists.freedesktop.org
  Reporter: haa...@frickel.club
QA Contact: dri-devel@lists.freedesktop.org

Created attachment 140824
  --> https://bugs.freedesktop.org/attachment.cgi?id=140824&action=edit
backtrace

RX 480, mesa git e68fe445f51, libdrm git.

Tabs in firefox nightly randomly crash, see backtrace.
Everything else seems to work fine.

Without debug symbols the backtrace went through glPrimitiveBoundingBox for
some reason 

Core was generated by `/opt/firefox-nightly/firefox -contentproc -childID 4
-isForBrowser -prefsLen 43'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00406d30 in ?? ()
[Current thread is 1 (Thread 0x7efc14152740 (LWP 14385))]
(gdb) bt
#0  0x00406d30 in  ()
#1  0x7efbe0647be0 in drmFreeDevice () at /usr/lib/libdrm.so.2
#2  0x7efbe0ade8ae in glPrimitiveBoundingBox () at /usr/lib/libGL.so.1
#3  0x7efbe0ad5bd5 in  () at /usr/lib/libGL.so.1
#4  0x7efbe0abe350 in  () at /usr/lib/libGL.so.1
#5  0x7efbe0ab9d81 in glXQueryVersion () at /usr/lib/libGL.so.1

but in the attached backtrace with full debugging enabled it looks a bit
different.

-- 
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 105733] Amdgpu randomly hangs and only ssh works. Mouse cursor moves sometimes but does nothing. Keyboard stops working.

2018-07-26 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105733

--- Comment #20 from Suloev Dmitry  ---
Created attachment 140823
  --> https://bugs.freedesktop.org/attachment.cgi?id=140823&action=edit
Memory manager not clean during takedown.

But everything changes with iommu enabled!

-- 
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 105733] Amdgpu randomly hangs and only ssh works. Mouse cursor moves sometimes but does nothing. Keyboard stops working.

2018-07-26 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105733

--- Comment #19 from Suloev Dmitry  ---
Created attachment 140822
  --> https://bugs.freedesktop.org/attachment.cgi?id=140822&action=edit
startx.log

I even can run X with disabled iommu, but when I start firefox - X hangs.
But gpu_recovery trying reset gpu and I cag get back to console.

-- 
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 105733] Amdgpu randomly hangs and only ssh works. Mouse cursor moves sometimes but does nothing. Keyboard stops working.

2018-07-26 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105733

Suloev Dmitry  changed:

   What|Removed |Added

 Attachment #140820|0   |1
is obsolete||

--- Comment #18 from Suloev Dmitry  ---
Created attachment 140821
  --> https://bugs.freedesktop.org/attachment.cgi?id=140821&action=edit
amdgpu timeout with iommu disabled

-- 
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 105733] Amdgpu randomly hangs and only ssh works. Mouse cursor moves sometimes but does nothing. Keyboard stops working.

2018-07-26 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105733

--- Comment #17 from Suloev Dmitry  ---
Created attachment 140820
  --> https://bugs.freedesktop.org/attachment.cgi?id=140820&action=edit
amdgpu timeout with iommu enabled

-- 
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 105733] Amdgpu randomly hangs and only ssh works. Mouse cursor moves sometimes but does nothing. Keyboard stops working.

2018-07-26 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105733

--- Comment #16 from Suloev Dmitry  ---
This issue looks pretty similar to one of mine.
But in addition to this I found few more bugs in amdgpu+iommu+drm bundle.

-- 
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 105684] Loading amdgpu hits general protection fault: 0000 [#1] SMP NOPTI

2018-07-26 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105684

--- Comment #40 from jian-h...@endlessm.com ---
Created attachment 140819
  --> https://bugs.freedesktop.org/attachment.cgi?id=140819&action=edit
4.18.0-rc6 Build config file

Hi Paul,

The config file is as attachment.

I just "make", and "make modules_install install" with gcc version 6.3.0
20170516 (Debian 6.3.0-18+deb9u1endless2bem1).

-- 
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 v5 6/9] ARM: dts: exynos5250: add DSI node

2018-07-26 Thread Krzysztof Kozlowski
On 25 July 2018 at 17:46, Andrzej Hajda  wrote:
> The patch adds common part of DSI node for Exynos5250 platforms
> and a required mipi-phy node.
>
> Signed-off-by: Andrzej Hajda 
> Signed-off-by: Maciej Purski 
> ---
>  arch/arm/boot/dts/exynos5250.dtsi | 21 +
>  1 file changed, 21 insertions(+)

I'll take it after merge window so for v4.20.

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


Re: [PATCH v5 7/9] ARM: dts: exynos5250-arndale: add DSI and panel nodes

2018-07-26 Thread Krzysztof Kozlowski
On 25 July 2018 at 17:46, Andrzej Hajda  wrote:
> The patch adds bridge and panel nodes.
> It adds also DSI properties specific for arndale board and
> regulators required by the bridge.
>
> Signed-off-by: Andrzej Hajda 
> Signed-off-by: Maciej Purski 
> ---
>  arch/arm/boot/dts/exynos5250-arndale.dts | 61 
>  1 file changed, 61 insertions(+)

I'll take it after merge window so for v4.20.

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


[Bug 106228] amdgpu reads back brightness 0 (which is not true) if checked before a brightness has been explicitly set

2018-07-26 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=106228

jian-h...@endlessm.com changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|NEW |RESOLVED

--- Comment #9 from jian-h...@endlessm.com ---
Hi David,

Yes!  It is. Thanks

-- 
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 v5 5/9] drm/bridge: tc358764: Add DSI to LVDS bridge driver

2018-07-26 Thread Archit Taneja



On Wednesday 25 July 2018 09:16 PM, Andrzej Hajda wrote:

Add a drm_bridge driver for the Toshiba TC358764 DSI to LVDS bridge.

Changes in v4:
- removed license blob,
- ordered includes,
- added error handling,
- fixed reset GPIO handling,
- added missing calls to the panel,
- custom OF graph code replaced with helpers,
- removed tc358764_poweroff from remove callback.
v5:
- fixed supply names,
- fixed broken console - added connector to fb_helper,
- added detach callback - unbinding works,
- fixed typo in error checking code,
- removed sparse bridge->encoder check - core does it already.

Signed-off-by: Andrzej Hajda 
Signed-off-by: Maciej Purski 
[ a.ha...@samsung.com: v4, v5 ]
Signed-off-by: Andrzej Hajda 
---
  drivers/gpu/drm/bridge/Kconfig|   8 +
  drivers/gpu/drm/bridge/Makefile   |   1 +
  drivers/gpu/drm/bridge/tc358764.c | 499 ++
  3 files changed, 508 insertions(+)
  create mode 100644 drivers/gpu/drm/bridge/tc358764.c

diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index fa2c7997e2fd..f3da8a716833 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -110,6 +110,14 @@ config DRM_THINE_THC63LVD1024
---help---
  Thine THC63LVD1024 LVDS/parallel converter driver.
  
+config DRM_TOSHIBA_TC358764

+   tristate "TC358764 DSI/LVDS bridge"
+   depends on DRM && DRM_PANEL
+   depends on OF
+   select DRM_MIPI_DSI
+   help
+ Toshiba TC358764 DSI/LVDS bridge driver.
+
  config DRM_TOSHIBA_TC358767
tristate "Toshiba TC358767 eDP bridge"
depends on OF
diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
index 35f88d48ec20..bf7c0cecf227 100644
--- a/drivers/gpu/drm/bridge/Makefile
+++ b/drivers/gpu/drm/bridge/Makefile
@@ -10,6 +10,7 @@ obj-$(CONFIG_DRM_SIL_SII8620) += sil-sii8620.o
  obj-$(CONFIG_DRM_SII902X) += sii902x.o
  obj-$(CONFIG_DRM_SII9234) += sii9234.o
  obj-$(CONFIG_DRM_THINE_THC63LVD1024) += thc63lvd1024.o
+obj-$(CONFIG_DRM_TOSHIBA_TC358764) += tc358764.o
  obj-$(CONFIG_DRM_TOSHIBA_TC358767) += tc358767.o
  obj-$(CONFIG_DRM_ANALOGIX_DP) += analogix/
  obj-$(CONFIG_DRM_I2C_ADV7511) += adv7511/
diff --git a/drivers/gpu/drm/bridge/tc358764.c 
b/drivers/gpu/drm/bridge/tc358764.c
new file mode 100644
index ..779bc5fce22a
--- /dev/null
+++ b/drivers/gpu/drm/bridge/tc358764.c
@@ -0,0 +1,499 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2018 Samsung Electronics Co., Ltd
+ *
+ * Authors:
+ * Andrzej Hajda 
+ * Maciej Purski 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define FLD_MASK(start, end)(((1 << ((start) - (end) + 1)) - 1) << (end))
+#define FLD_VAL(val, start, end) (((val) << (end)) & FLD_MASK(start, end))
+
+/* PPI layer registers */
+#define PPI_STARTPPI   0x0104 /* START control bit */
+#define PPI_LPTXTIMECNT0x0114 /* LPTX timing signal */
+#define PPI_LANEENABLE 0x0134 /* Enables each lane */
+#define PPI_TX_RX_TA   0x013C /* BTA timing parameters */
+#define PPI_D0S_CLRSIPOCOUNT   0x0164 /* Assertion timer for Lane 0 */
+#define PPI_D1S_CLRSIPOCOUNT   0x0168 /* Assertion timer for Lane 1 */
+#define PPI_D2S_CLRSIPOCOUNT   0x016C /* Assertion timer for Lane 2 */
+#define PPI_D3S_CLRSIPOCOUNT   0x0170 /* Assertion timer for Lane 3 */
+#define PPI_START_FUNCTION 1
+
+/* DSI layer registers */
+#define DSI_STARTDSI   0x0204 /* START control bit of DSI-TX */
+#define DSI_LANEENABLE 0x0210 /* Enables each lane */
+#define DSI_RX_START   1
+
+/* Video path registers */
+#define VP_CTRL0x0450 /* Video Path Control */
+#define VP_CTRL_MSF(v) FLD_VAL(v, 0, 0) /* Magic square in RGB666 */
+#define VP_CTRL_VTGEN(v)   FLD_VAL(v, 4, 4) /* Use chip clock for timing */
+#define VP_CTRL_EVTMODE(v) FLD_VAL(v, 5, 5) /* Event mode */
+#define VP_CTRL_RGB888(v)  FLD_VAL(v, 8, 8) /* RGB888 mode */
+#define VP_CTRL_VSDELAY(v) FLD_VAL(v, 31, 20) /* VSYNC delay */
+#define VP_CTRL_HSPOL  BIT(17) /* Polarity of HSYNC signal */
+#define VP_CTRL_DEPOL  BIT(18) /* Polarity of DE signal */
+#define VP_CTRL_VSPOL  BIT(19) /* Polarity of VSYNC signal */
+#define VP_HTIM1   0x0454 /* Horizontal Timing Control 1 */
+#define VP_HTIM1_HBP(v)FLD_VAL(v, 24, 16)
+#define VP_HTIM1_HSYNC(v)  FLD_VAL(v, 8, 0)
+#define VP_HTIM2   0x0458 /* Horizontal Timing Control 2 */
+#define VP_HTIM2_HFP(v)FLD_VAL(v, 24, 16)
+#define VP_HTIM2_HACT(v)   FLD_VAL(v, 10, 0)
+#define VP_VTIM1   0x045C /* Vertical Timing Control 1 */
+#define VP_VTIM1_VBP(v)FLD_VAL(v, 23, 16)
+#define VP_VTIM1_VSYNC(v)  FLD_VAL(v, 7, 0)
+#define VP_VTIM2   0x0460 /* Vertical Timing Control 2 */
+#define VP_VTIM2

Re: [resend PATCH v4 4/5] drm/mediatek: Add support for mmsys through a pdev

2018-07-26 Thread Stephen Boyd
Quoting Sean Wang (2018-07-18 03:06:27)
> On Wed, 2018-07-18 at 11:05 +0300, Laurent Pinchart wrote:
> > Hi Sean,
> > 
> > On Wednesday, 18 July 2018 05:57:35 EEST Sean Wang wrote:
> > > On Wed, 2018-07-18 at 00:03 +0200, matthias@kernel.org wrote:
> > > > From: Matthias Brugger 
> > > > 
> > > > The MMSYS subsystem includes clocks and drm components.
> > > > This patch adds an initailization path through a platform device
> > > > for the clock part, so that both drivers get probed from the same
> > > > device tree compatible.
> > > 
> > > Sorry for that I should have a response earlier for the series.
> > > 
> > > Some points I felt they're not exactly right and should be fixed up
> > > before we're moving on
> > > 
> > > Currently, drm driver have a wrong reference to the dt-binding,
> > > "mediatek,mt2701-mmsys" or "mediatek,mt8173-mmsys", they should be all
> > > for the subsystem exporting clock and reset line such common resource to
> > > its sub-devices. Every subsystem has a similar shape. I hope mmsys
> > > shouldn't be an exception.
> > > 
> > > DRM device needs to have its own dt-binding show how connections between
> > > DRM components being made and its node should be put under mmsys node.
> > > 
> > > In this way, it becomes easy to see how the topology of the subsystem is
> > > and grows, like a tree "device tree", instead of hiding the details in
> > > the implementation.
> > > 
> > > The similar example we already did for audsys on mt2701 and mt7623 as
> > > below
> > > 
> > > audsys: clock-controller@1122 {
> > > 
> > compatible = "mediatek,mt7623-audsys",
> > > 
> >"mediatek,mt2701-audsys",
> > > 
> >"syscon";
> > > 
> >   ...
> > > 
> > > 
> > afe: audio-controller {
> > > 
> >   compatible = "mediatek,mt7623-audio",
> > > 
> >   
> >  "mediatek,mt2701-audio";
> > > 
> > > 
> >   ...
> > > 
> > };
> > > };
> > 
> > This looks very strange to me. I'm not familiar with the hardware 
> > architecture, but a clock controller that includes an audio controller 
> > seems 
> > like a very weird design. It's usually the other way around, you have an 
> > audio
> 
> yes, naming audsys as clock controller is really not good. it should be
> worth a better naming.
> 
> mtk subsystem AFAIK works as a container, at least provides clocks,
> reset, syscon access, these common resource to these devices running on
> the subsystem. It also has a power gate independent from other
> subsystem, that can be controlled when these devices all powered down
> or once up.
> 
> And it should be better that we don't assume what exact devices are
> running on since it is possible that there're different devices running
> on the same subsystem per SoC. mtk has many subsystem working in this
> way. mmsys is just a case. we can see in [1]
> 
> 
> [1]
> https://elixir.bootlin.com/linux/v4.18-rc5/source/Documentation/devicetree/bindings/arm/mediatek
>  

Sean, is this an ack for this patch series? I think the consensus is to
not modify DT to add a subnode for the "clk" part of the hardware, but
instead either register the clks from the device driver that has the clk
hardware inside of it, or do what this patch series does and register a
device in software from the "parent" device driver so that logically clk
things are contained in drivers/clk/

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


Re: [PATCH v2] drm/msm/display: negative x/y in cursor move

2018-07-26 Thread Archit Taneja



On Wednesday 25 July 2018 08:40 PM, Carsten Behling wrote:

Hi,


Thanks for the patch. Could you tell how to reproduce this issue
on a db410c?

 >

I was playing with xrandr's --rotate and --reflect options to get
a rotated output, but wasn't able to generate negative x/y
co-ordinates. I'm using linaro's debian userspace, running lxqt.


I used Yocto Rocko from 96Boards

https://github.com/96boards/oe-rpb-manifest/tree/rocko

MACHINE=dragonboard-410c
DISTRO=rpb

rpb-desktop-image

Connect HDMI monitor and USB mouse, then

1.) Just boot. Wait for X-Server up.
2.) From my serial console:
      DISPLAY=:0.0 xrandr -o 2
3.) Try to move the mouse to the upper (the rotated lower) border.

Interesting to know that your debian user space is ok. The yocto X11 
configuration is very basic.

There may be a X11 configuration or extension that does the trick on Debian.


Thanks, I'll give this a try.

The patch looks good, anyway. Rob's queued it for msm-next.

Archit



Therefore, I asked the X11 people where to fix:

https://www.spinics.net/lists/xorg/msg58969.html

Best regards
-Carsten


2018-07-24 19:33 GMT+02:00 Archit Taneja >:


Hi,

On Tuesday 17 July 2018 04:33 AM, Carsten Behling wrote:

modesetting X11 driver may provide negative x/y cordinates in
mdp5_crtc_cursor_move call when rotation is enabled.

Cursor buffer can overlap down to its negative width/height.

ROI has to be recalculated for negative x/y indicating using the
lower/right corner of the cursor buffer and hotspot must be set
in MDP5_LM_CURSOR_XY_SRC_Y MDP5_LM_CURSOR_XY_SRC_X.


Thanks for the patch. Could you tell how to reproduce this issue
on a db410c?

I was playing with xrandr's --rotate and --reflect options to get
a rotated output, but wasn't able to generate negative x/y
co-ordinates. I'm using linaro's debian userspace, running lxqt.

Thanks,
Archit



Signed-off-by: Carsten Behling mailto:carsten.behl...@gmail.com>>
---
Changes in v2:
- fixed format specifier in debug message

   drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c | 51
++-
   1 file changed, 43 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
index 10271359789e..a7f4a6688fec 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
@@ -65,7 +65,7 @@ struct mdp5_crtc {
                 struct drm_gem_object *scanout_bo;
                 uint64_t iova;
                 uint32_t width, height;
-               uint32_t x, y;
+               int x, y;
         } cursor;
   };
   #define to_mdp5_crtc(x) container_of(x, struct mdp5_crtc, base)
@@ -760,20 +760,31 @@ static void get_roi(struct drm_crtc *crtc,
uint32_t *roi_w, uint32_t *roi_h)
          * Cursor Region Of Interest (ROI) is a plane read from
cursor
          * buffer to render. The ROI region is determined by
the visibility of
          * the cursor point. In the default Cursor image the
cursor point will
-        * be at the top left of the cursor image, unless it is
specified
-        * otherwise using hotspot feature.
+        * be at the top left of the cursor image.
          *
+        * Without rotation:
          * If the cursor point reaches the right (xres - x <
cursor.width) or
          * bottom (yres - y < cursor.height) boundary of the
screen, then ROI
          * width and ROI height need to be evaluated to crop
the cursor image
          * accordingly.
          * (xres-x) will be new cursor width when x > (xres -
cursor.width)
          * (yres-y) will be new cursor height when y > (yres -
cursor.height)
+        *
+        * With rotation:
+        * We get negative x and/or y coordinates.
+        * (cursor.width - abs(x)) will be new cursor width when
x < 0
+        * (cursor.height - abs(y)) will be new cursor width
when y < 0
          */
-       *roi_w = min(mdp5_crtc->cursor.width, xres -
+       if (mdp5_crtc->cursor.x >= 0)
+               *roi_w = min(mdp5_crtc->cursor.width, xres -
                         mdp5_crtc->cursor.x);
-       *roi_h = min(mdp5_crtc->cursor.height, yres -
+       else
+               *roi_w = mdp5_crtc->cursor.width -
abs(mdp5_crtc->cursor.x);
+       if (mdp5_crtc->cursor.y >= 0)
+               *roi_h = min(mdp5_crtc->cursor.height, yres -
                         mdp5_crtc->cursor.y);

Re: [PATCH] gpu/drm/vkms: Use new return type vm_fault_t

2018-07-26 Thread Souptick Joarder
On Wed, Jul 25, 2018 at 6:47 PM, Rodrigo Siqueira
 wrote:
> Hi,
>
> Thanks for the patch,
>
> I reviewed and tested it; everything is fine. I only suggest removing
> the "gpu" part from the patch title (i.e., "drm/vkms: Use new return
> type vm_fault_t").

ok. I Will post v2.

>
> On 07/23, Souptick Joarder wrote:
>> Use new return type vm_fault_t for fault handler.
>>
>> Signed-off-by: Souptick Joarder 
>> ---
>>  drivers/gpu/drm/vkms/vkms_drv.h | 2 +-
>>  drivers/gpu/drm/vkms/vkms_gem.c | 5 ++---
>>  2 files changed, 3 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/vkms/vkms_drv.h 
>> b/drivers/gpu/drm/vkms/vkms_drv.h
>> index 07be29f..d5d04a8 100644
>> --- a/drivers/gpu/drm/vkms/vkms_drv.h
>> +++ b/drivers/gpu/drm/vkms/vkms_drv.h
>> @@ -65,7 +65,7 @@ struct drm_gem_object *vkms_gem_create(struct drm_device 
>> *dev,
>>  u32 *handle,
>>  u64 size);
>>
>> -int vkms_gem_fault(struct vm_fault *vmf);
>> +vm_fault_t vkms_gem_fault(struct vm_fault *vmf);
>>
>>  int vkms_dumb_create(struct drm_file *file, struct drm_device *dev,
>>struct drm_mode_create_dumb *args);
>> diff --git a/drivers/gpu/drm/vkms/vkms_gem.c 
>> b/drivers/gpu/drm/vkms/vkms_gem.c
>> index c7e3836..62e05dc 100644
>> --- a/drivers/gpu/drm/vkms/vkms_gem.c
>> +++ b/drivers/gpu/drm/vkms/vkms_gem.c
>> @@ -43,14 +43,14 @@ void vkms_gem_free_object(struct drm_gem_object *obj)
>>   kfree(gem);
>>  }
>>
>> -int vkms_gem_fault(struct vm_fault *vmf)
>> +vm_fault_t vkms_gem_fault(struct vm_fault *vmf)
>>  {
>>   struct vm_area_struct *vma = vmf->vma;
>>   struct vkms_gem_object *obj = vma->vm_private_data;
>>   unsigned long vaddr = vmf->address;
>>   pgoff_t page_offset;
>>   loff_t num_pages;
>> - int ret;
>> + vm_fault_t ret = VM_FAULT_SIGBUS;
>>
>>   page_offset = (vaddr - vma->vm_start) >> PAGE_SHIFT;
>>   num_pages = DIV_ROUND_UP(obj->gem.size, PAGE_SIZE);
>> @@ -58,7 +58,6 @@ int vkms_gem_fault(struct vm_fault *vmf)
>>   if (page_offset > num_pages)
>>   return VM_FAULT_SIGBUS;
>>
>> - ret = -ENOENT;
>>   mutex_lock(&obj->pages_lock);
>>   if (obj->pages) {
>>   get_page(obj->pages[page_offset]);
>> --
>> 1.9.1
>>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[libdrm patch] Fix build with -std=c11

2018-07-26 Thread Tom Anderson
Hello,

I have a simple one-line patch that fixes the libdrm build with -std=c11.
I would appreciate if anyone with commit access could merge the attached
change on my behalf.

Thanks!
Tom
From fc7a593454030df2b06e5b9dbafaa666d51a30ac Mon Sep 17 00:00:00 2001
From: Tom Anderson 
Date: Wed, 25 Jul 2018 12:06:29 -0700
Subject: [PATCH] Fix build with -std=c11

typeof() is a GNU extension that will only work when the compiler is passed
-std=gnu*.  __typeof__() works with -std=c*, however.
---
 util_math.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/util_math.h b/util_math.h
index 02b15a8e..35bf4512 100644
--- a/util_math.h
+++ b/util_math.h
@@ -29,6 +29,6 @@
 #define MAX3( A, B, C ) ((A) > (B) ? MAX2(A, C) : MAX2(B, C))
 
 #define __align_mask(value, mask)  (((value) + (mask)) & ~(mask))
-#define ALIGN(value, alignment)__align_mask(value, (typeof(value))((alignment) - 1))
+#define ALIGN(value, alignment)__align_mask(value, (__typeof__(value))((alignment) - 1))
 
 #endif /*_UTIL_MATH_H_*/
-- 
2.18.0.233.g985f88cf7e-goog

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


Re: [PATCH v2] drm/msm/display: negative x/y in cursor move

2018-07-26 Thread Carsten Behling
Hi,

> Thanks for the patch. Could you tell how to reproduce this issue
> on a db410c?
>
> I was playing with xrandr's --rotate and --reflect options to get
> a rotated output, but wasn't able to generate negative x/y
> co-ordinates. I'm using linaro's debian userspace, running lxqt.

I used Yocto Rocko from 96Boards

https://github.com/96boards/oe-rpb-manifest/tree/rocko

MACHINE=dragonboard-410c
DISTRO=rpb

rpb-desktop-image

Connect HDMI monitor and USB mouse, then

1.) Just boot. Wait for X-Server up.
2.) From my serial console:
 DISPLAY=:0.0 xrandr -o 2
3.) Try to move the mouse to the upper (the rotated lower) border.

Interesting to know that your debian user space is ok. The yocto X11
configuration is very basic.
There may be a X11 configuration or extension that does the trick on Debian.

Therefore, I asked the X11 people where to fix:

https://www.spinics.net/lists/xorg/msg58969.html

Best regards
-Carsten


2018-07-24 19:33 GMT+02:00 Archit Taneja :

> Hi,
>
> On Tuesday 17 July 2018 04:33 AM, Carsten Behling wrote:
>
>> modesetting X11 driver may provide negative x/y cordinates in
>> mdp5_crtc_cursor_move call when rotation is enabled.
>>
>> Cursor buffer can overlap down to its negative width/height.
>>
>> ROI has to be recalculated for negative x/y indicating using the
>> lower/right corner of the cursor buffer and hotspot must be set
>> in MDP5_LM_CURSOR_XY_SRC_Y MDP5_LM_CURSOR_XY_SRC_X.
>>
>
> Thanks for the patch. Could you tell how to reproduce this issue
> on a db410c?
>
> I was playing with xrandr's --rotate and --reflect options to get
> a rotated output, but wasn't able to generate negative x/y
> co-ordinates. I'm using linaro's debian userspace, running lxqt.
>
> Thanks,
> Archit
>
>
>
>> Signed-off-by: Carsten Behling 
>> ---
>> Changes in v2:
>> - fixed format specifier in debug message
>>
>>   drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c | 51
>> ++-
>>   1 file changed, 43 insertions(+), 8 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
>> b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
>> index 10271359789e..a7f4a6688fec 100644
>> --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
>> +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
>> @@ -65,7 +65,7 @@ struct mdp5_crtc {
>> struct drm_gem_object *scanout_bo;
>> uint64_t iova;
>> uint32_t width, height;
>> -   uint32_t x, y;
>> +   int x, y;
>> } cursor;
>>   };
>>   #define to_mdp5_crtc(x) container_of(x, struct mdp5_crtc, base)
>> @@ -760,20 +760,31 @@ static void get_roi(struct drm_crtc *crtc, uint32_t
>> *roi_w, uint32_t *roi_h)
>>  * Cursor Region Of Interest (ROI) is a plane read from cursor
>>  * buffer to render. The ROI region is determined by the
>> visibility of
>>  * the cursor point. In the default Cursor image the cursor point
>> will
>> -* be at the top left of the cursor image, unless it is specified
>> -* otherwise using hotspot feature.
>> +* be at the top left of the cursor image.
>>  *
>> +* Without rotation:
>>  * If the cursor point reaches the right (xres - x <
>> cursor.width) or
>>  * bottom (yres - y < cursor.height) boundary of the screen, then
>> ROI
>>  * width and ROI height need to be evaluated to crop the cursor
>> image
>>  * accordingly.
>>  * (xres-x) will be new cursor width when x > (xres -
>> cursor.width)
>>  * (yres-y) will be new cursor height when y > (yres -
>> cursor.height)
>> +*
>> +* With rotation:
>> +* We get negative x and/or y coordinates.
>> +* (cursor.width - abs(x)) will be new cursor width when x < 0
>> +* (cursor.height - abs(y)) will be new cursor width when y < 0
>>  */
>> -   *roi_w = min(mdp5_crtc->cursor.width, xres -
>> +   if (mdp5_crtc->cursor.x >= 0)
>> +   *roi_w = min(mdp5_crtc->cursor.width, xres -
>> mdp5_crtc->cursor.x);
>> -   *roi_h = min(mdp5_crtc->cursor.height, yres -
>> +   else
>> +   *roi_w = mdp5_crtc->cursor.width -
>> abs(mdp5_crtc->cursor.x);
>> +   if (mdp5_crtc->cursor.y >= 0)
>> +   *roi_h = min(mdp5_crtc->cursor.height, yres -
>> mdp5_crtc->cursor.y);
>> +   else
>> +   *roi_h = mdp5_crtc->cursor.height -
>> abs(mdp5_crtc->cursor.y);
>>   }
>> static void mdp5_crtc_restore_cursor(struct drm_crtc *crtc)
>> @@ -783,7 +794,7 @@ static void mdp5_crtc_restore_cursor(struct drm_crtc
>> *crtc)
>> struct mdp5_kms *mdp5_kms = get_kms(crtc);
>> const enum mdp5_cursor_alpha cur_alpha = CURSOR_ALPHA_PER_PIXEL;
>> uint32_t blendcfg, stride;
>> -   uint32_t x, y, width, height;
>> +   uint32_t x, y, src_x, src_y, width, height;
>> uint32_t roi_w, roi_h;
>> int lm;
>>   @@ -800,6 +811,26 @@ static void mdp5_crt