Re: [PATCH v3 09/21] drm/bridge: Add a drm_bridge_state object

2019-11-23 Thread Boris Brezillon
On Tue, 5 Nov 2019 17:05:16 +0100
Neil Armstrong  wrote:

> >  void drm_bridge_add(struct drm_bridge *bridge);
> >  void drm_bridge_remove(struct drm_bridge *bridge);
> >  struct drm_bridge *of_drm_find_bridge(struct device_node *np);
> > @@ -475,6 +543,56 @@ void drm_atomic_bridge_chain_pre_enable(struct 
> > drm_bridge *bridge,
> >  void drm_atomic_bridge_chain_enable(struct drm_bridge *bridge,
> > struct drm_atomic_state *state);
> >  
> > +void __drm_atomic_helper_bridge_reset(struct drm_bridge *bridge,
> > + struct drm_bridge_state *state);
> > +struct drm_bridge_state *
> > +drm_atomic_helper_bridge_reset(struct drm_bridge *bridge);
> > +void drm_atomic_helper_bridge_destroy_state(struct drm_bridge *bridge,
> > +   struct drm_bridge_state *state);
> > +void __drm_atomic_helper_bridge_duplicate_state(struct drm_bridge *bridge,
> > +   struct drm_bridge_state *new);
> > +struct drm_bridge_state *
> > +drm_atomic_helper_bridge_duplicate_state(struct drm_bridge *bridge);
> > +
> > +static inline struct drm_bridge_state *
> > +drm_atomic_get_bridge_state(struct drm_atomic_state *state,
> > +   struct drm_bridge *bridge)
> > +{
> > +   struct drm_private_state *obj_state;
> > +
> > +   obj_state = drm_atomic_get_private_obj_state(state, >base);
> > +   if (!obj_state)
> > +   return NULL;  
> 
> drm_atomic_get_private_obj_state will return an error object on error, so 
> should be:
>   if (IS_ERR(obj_state))
>   return ERR_CAST(obj_state);

Right, I'll fix it in v4.

Thanks,

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

Re: [PATCH v3 07/21] drm/bridge: Make the bridge chain a double-linked list

2019-11-23 Thread Boris Brezillon
Hi Neil,

Sorry for the late reply.

On Tue, 5 Nov 2019 17:02:30 +0100
Neil Armstrong  wrote:

> Hi,
> 
> 
> On 25/10/2019 15:29, Neil Armstrong wrote:
> > On 23/10/2019 17:44, Boris Brezillon wrote:  
> >> So that each element in the chain can easily access its predecessor.
> >> This will be needed to support bus format negotiation between elements
> >> of the bridge chain.
> >>
> >> Signed-off-by: Boris Brezillon 
> >> ---
> >> Changes in v3:
> >> * None
> >>
> >> Changes in v2:
> >> * Adjust things to the "dummy encoder bridge" change (patch 2 in this
> >>   series)
> >> ---
> >>  drivers/gpu/drm/drm_bridge.c  | 171 ++
> >>  drivers/gpu/drm/drm_encoder.c |  16 +---
> >>  include/drm/drm_bridge.h  |  12 ++-
> >>  include/drm/drm_encoder.h |   9 +-
> >>  4 files changed, 135 insertions(+), 73 deletions(-)
> >>
> >> diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c
> >> index 54c874493c57..c5cf8a9c4237 100644
> >> --- a/drivers/gpu/drm/drm_bridge.c
> >> +++ b/drivers/gpu/drm/drm_bridge.c  
> 
> [...]
> 
> >>  
> >> @@ -426,15 +471,23 @@ EXPORT_SYMBOL(drm_atomic_bridge_chain_post_disable);
> >>  void drm_atomic_bridge_chain_pre_enable(struct drm_bridge *bridge,
> >>struct drm_atomic_state *state)
> >>  {
> >> +  struct drm_encoder *encoder;
> >> +  struct drm_bridge *iter;
> >> +
> >>if (!bridge)
> >>return;
> >>  
> >> -  drm_atomic_bridge_chain_pre_enable(bridge->next, state);
> >> +  encoder = bridge->encoder;
> >> +  list_for_each_entry_reverse(iter, >encoder->bridge_chain,
> >> +  chain_node) {  
> 
> This should use the encoder local variable in list_for_each_entry_reverse()
> 
> >> +  if (iter->funcs->atomic_pre_enable)
> >> +  iter->funcs->atomic_pre_enable(iter, state);
> >> +  else if (iter->funcs->pre_enable)
> >> +  iter->funcs->pre_enable(iter);
> >>  
> >> -  if (bridge->funcs->atomic_pre_enable)
> >> -  bridge->funcs->atomic_pre_enable(bridge, state);
> >> -  else if (bridge->funcs->pre_enable)
> >> -  bridge->funcs->pre_enable(bridge);
> >> +  if (iter == bridge)
> >> +  break;
> >> +  }
> >>  }
> >>  EXPORT_SYMBOL(drm_atomic_bridge_chain_pre_enable);
> >>  
> >> @@ -453,15 +506,19 @@ EXPORT_SYMBOL(drm_atomic_bridge_chain_pre_enable);
> >>  void drm_atomic_bridge_chain_enable(struct drm_bridge *bridge,
> >>struct drm_atomic_state *state)
> >>  {
> >> +  struct drm_encoder *encoder;
> >> +
> >>if (!bridge)
> >>return;
> >>  
> >> -  if (bridge->funcs->atomic_enable)
> >> -  bridge->funcs->atomic_enable(bridge, state);
> >> -  else if (bridge->funcs->enable)
> >> -  bridge->funcs->enable(bridge);
> >> -
> >> -  drm_atomic_bridge_chain_enable(bridge->next, state);
> >> +  encoder = bridge->encoder;
> >> +  list_for_each_entry_from(bridge, >encoder->bridge_chain,
> >> +   chain_node) {  
> 
> This should use encoder instead of bridge->encoder otherwise bridge will
> change and bridge->encoder->bridge_chain won't be valid during the for_each 
> and
> cause the following :

Oops, indeed. I fixed the very same problem in another helper but
somehow missed those 2. Thanks for testing/reporting the bug.

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

Re: [PATCH v3 00/21] drm: Add support for bus-format negotiation

2019-11-23 Thread Boris Brezillon
On Sun, 24 Nov 2019 09:46:41 +0900
Ezequiel Garcia  wrote:

> Hi Boris, Neil,
> 
> On Wed, 2019-10-23 at 17:44 +0200, Boris Brezillon wrote:
> > This patch series aims at adding support for runtime bus-format
> > negotiation between all elements of the
> > 'encoder -> bridges -> connector/display' section of the pipeline.
> > 
> > In order to support that, we need drm bridges to fully take part in the
> > atomic state validation process, which requires adding a
> > drm_bridge_state and a new drm_bridge_funcs.atomic_check() hook.
> > Once those basic building blocks are in place, we can add new hooks to
> > allow bus format negotiation (those are called just before  
> > ->atomic_check()). The bus format selection is done at runtime by  
> > testing all possible combinations across the whole bridge chain until
> > one is reported to work.
> > 
> > Major changes since v2:
> > * Get rid of the dummy bridge embedded in drm_encoder and let encoder
> >   drivers provide their own bridge element
> > * Clarify APIs and improve the doc
> > * Propagate bus flags by default
> > 
> > Major changes since the RFC:
> > 
> > * Add a dummy bridge to the drm_encoder object so that vc4 and exynos
> >   DSI drivers can implement the pre_enable/post_disable hooks instead
> >   of manually setting encoder->bridge to NULL to control the
> >   enable/disable sequence. This change is also a first step towards
> >   drm_bridge/drm_encoder unification. New encoder drivers should
> >   stop implementing drm_encoder_helper_funcs and switch to
> >   drm_bridge_funcs. Existing drivers can be converted progressively
> >   (already have a branch where I started converting some of them [1])
> > * rework the bus format negotiation to give more control to bridge
> >   drivers in the selection process (driver can select at runtime which
> >   input bus format they support for a specific output bus format based
> >   on any information available in the connector, crtc and bridge state.
> > 
> > A more detailed changelog is provided in each patch.
> > 
> > This patch series is also available here [2].
> > 
> > Thanks,
> > 
> > Boris
> > 
> > [1]https://github.com/bbrezillon/linux-0day/commits/drm-encoder-bridge
> > [2]https://github.com/bbrezillon/linux-0day/commits/drm-bridge-busfmt-v3
> > 
> > *** BLURB HERE ***
> > 
> > Boris Brezillon (21):
> >   drm/vc4: Declare the DSI encoder as a bridge element
> >   drm/exynos: Don't reset bridge->next
> >   drm/exynos: Declare the DSI encoder as a bridge element
> >   drm/bridge: Rename bridge helpers targeting a bridge chain
> >   drm/bridge: Introduce drm_bridge_chain_get_next_bridge()
> >   drm: Stop accessing encoder->bridge directly  
> 
> Patches 1 to 6 seem to be reviewed, and appear as a good
> step forward.

AFAICT, patch 1 and 3 are not reviewed, which is kind of blocking me
for patch 4-6. I can (and plan to) apply patch 2.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH v7 07/24] IB/umem: use get_user_pages_fast() to pin DMA pages

2019-11-23 Thread John Hubbard
On 11/21/19 6:36 AM, Jason Gunthorpe wrote:
> On Thu, Nov 21, 2019 at 12:07:46AM -0800, Christoph Hellwig wrote:
>> On Wed, Nov 20, 2019 at 11:13:37PM -0800, John Hubbard wrote:
>>> And get rid of the mmap_sem calls, as part of that. Note
>>> that get_user_pages_fast() will, if necessary, fall back to
>>> __gup_longterm_unlocked(), which takes the mmap_sem as needed.
>>>
>>> Reviewed-by: Jan Kara 
>>> Reviewed-by: Jason Gunthorpe 
>>> Reviewed-by: Ira Weiny 
>>> Signed-off-by: John Hubbard 
>>
>> Looks fine,
>>
>> Reviewed-by: Christoph Hellwig 
>>
>> Jason, can you queue this up for 5.5 to reduce this patch stack a bit?
> 
> Yes, I said I'd do this in an earlier revision. Now that it is clear this
> won't go through Andrew's tree, applied to rdma for-next
> 

Great, I'll plan on it going up through that tree. To be clear, is it headed 
for:

git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git for-next

?


thanks,
-- 
John Hubbard
NVIDIA
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH v3 00/21] drm: Add support for bus-format negotiation

2019-11-23 Thread Ezequiel Garcia
Hi Boris, Neil,

On Wed, 2019-10-23 at 17:44 +0200, Boris Brezillon wrote:
> This patch series aims at adding support for runtime bus-format
> negotiation between all elements of the
> 'encoder -> bridges -> connector/display' section of the pipeline.
> 
> In order to support that, we need drm bridges to fully take part in the
> atomic state validation process, which requires adding a
> drm_bridge_state and a new drm_bridge_funcs.atomic_check() hook.
> Once those basic building blocks are in place, we can add new hooks to
> allow bus format negotiation (those are called just before
> ->atomic_check()). The bus format selection is done at runtime by
> testing all possible combinations across the whole bridge chain until
> one is reported to work.
> 
> Major changes since v2:
> * Get rid of the dummy bridge embedded in drm_encoder and let encoder
>   drivers provide their own bridge element
> * Clarify APIs and improve the doc
> * Propagate bus flags by default
> 
> Major changes since the RFC:
> 
> * Add a dummy bridge to the drm_encoder object so that vc4 and exynos
>   DSI drivers can implement the pre_enable/post_disable hooks instead
>   of manually setting encoder->bridge to NULL to control the
>   enable/disable sequence. This change is also a first step towards
>   drm_bridge/drm_encoder unification. New encoder drivers should
>   stop implementing drm_encoder_helper_funcs and switch to
>   drm_bridge_funcs. Existing drivers can be converted progressively
>   (already have a branch where I started converting some of them [1])
> * rework the bus format negotiation to give more control to bridge
>   drivers in the selection process (driver can select at runtime which
>   input bus format they support for a specific output bus format based
>   on any information available in the connector, crtc and bridge state.
> 
> A more detailed changelog is provided in each patch.
> 
> This patch series is also available here [2].
> 
> Thanks,
> 
> Boris
> 
> [1]https://github.com/bbrezillon/linux-0day/commits/drm-encoder-bridge
> [2]https://github.com/bbrezillon/linux-0day/commits/drm-bridge-busfmt-v3
> 
> *** BLURB HERE ***
> 
> Boris Brezillon (21):
>   drm/vc4: Declare the DSI encoder as a bridge element
>   drm/exynos: Don't reset bridge->next
>   drm/exynos: Declare the DSI encoder as a bridge element
>   drm/bridge: Rename bridge helpers targeting a bridge chain
>   drm/bridge: Introduce drm_bridge_chain_get_next_bridge()
>   drm: Stop accessing encoder->bridge directly

Patches 1 to 6 seem to be reviewed, and appear as a good
step forward.

Perhaps we can consider merging these first? That way,
we can reduce the patches needed to rebase and submit
on each iteration.

Regards,
Ezequiel

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

Re: [PATCH] drm/i915: Remove tautological compare in eb_relocate_vma

2019-11-23 Thread Chris Wilson
Quoting Nathan Chancellor (2019-11-23 19:53:22)
> -Wtautological-compare was recently added to -Wall in LLVM, which
> exposed an if statement in i915 that is always false:
> 
> ../drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c:1485:22: warning:
> result of comparison of constant 576460752303423487 with expression of
> type 'unsigned int' is always false
> [-Wtautological-constant-out-of-range-compare]
> if (unlikely(remain > N_RELOC(ULONG_MAX)))
> ^
> 
> Since remain is an unsigned int, it can never be larger than UINT_MAX,
> which is less than ULONG_MAX / sizeof(struct drm_i915_gem_relocation_entry).
> Remove this statement to fix the warning.

The check should remain as we do want to document the overflow
calculation, and it should represent the types used -- it's much easier
to review a stub than trying to find a missing overflow check. If the
overflow cannot happen as the types are wide enough, no problem, the
compiler can remove the known false branch.

Tautology here has a purpose for conveying information to the reader.
-Chris
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[Bug 205523] AMDGPU display lockup during boot with 5.4 RC on Ryzen 2700u

2019-11-23 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=205523

Haxk20 (haxk...@gmail.com) changed:

   What|Removed |Added

 CC||haxk...@gmail.com

--- Comment #4 from Haxk20 (haxk...@gmail.com) ---
(In reply to Alex Deucher from comment #2)
> Does disabling the IOMMU help?  Set iommu=off or iommu=pt on the kernel
> command line.

Is this permanent too ? This will regress and produce tearing in games running
with PRIME setup.

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

Re: [PATCH 3/3] drm/panel: simple: Add support for the Frida FRD350H54004 panel

2019-11-23 Thread Sam Ravnborg
Hi Paul.

On Wed, Nov 20, 2019 at 06:10:27PM +0100, Paul Cercueil wrote:
> The FRD350H54004 is a simple 3.5" 320x240 24-bit TFT panel, found for
> instance inside the Anbernic RG-350 handheld gaming console.
> 
> Signed-off-by: Paul Cercueil 
> ---
>  drivers/gpu/drm/panel/panel-simple.c | 29 
>  1 file changed, 29 insertions(+)
> 
> diff --git a/drivers/gpu/drm/panel/panel-simple.c 
> b/drivers/gpu/drm/panel/panel-simple.c
> index 28fa6ba7b767..8c03f7fe461c 100644
> --- a/drivers/gpu/drm/panel/panel-simple.c
> +++ b/drivers/gpu/drm/panel/panel-simple.c
> @@ -1378,6 +1378,32 @@ static const struct panel_desc evervision_vgg804821 = {
>   .bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_NEGEDGE,
>  };
>  
> +static const struct drm_display_mode frida_frd350h54004_mode = {
> + .clock = 6777,
> + .hdisplay = 320,
> + .hsync_start = 320 + 70,
> + .hsync_end = 320 + 70 + 50,
> + .htotal = 320 + 70 + 50 + 10,
> + .vdisplay = 240,
> + .vsync_start = 240 + 5,
> + .vsync_end = 240 + 5 + 1,
> + .vtotal = 240 + 5 + 1 + 5,
> + .vrefresh = 60,
> + .flags = DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC,
> +};
> +
> +static const struct panel_desc frida_frd350h54004 = {
> + .modes = _frd350h54004_mode,
> + .num_modes = 1,
> + .bpc = 8,
> + .size = {
> + .width = 77,
> + .height = 64,
> + },
> + .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
> + .bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_POSEDGE,
> +};
> +
>  static const struct drm_display_mode foxlink_fl500wvr00_a0t_mode = {
>   .clock = 32260,
>   .hdisplay = 800,
> @@ -3186,6 +3212,9 @@ static const struct of_device_id platform_of_match[] = {
>   }, {
>   .compatible = "evervision,vgg804821",
>   .data = _vgg804821,
> + }, {
> + .compatible = "frida,frd350h54004",
> + .data = _frd350h54004,
>   }, {
>   .compatible = "foxlink,fl500wvr00-a0t",
>   .data = _fl500wvr00_a0t,

In alphabetic order. frida comes after fox.

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

Re: [PATCH 2/3] dt-bindings: panel: Document Frida FRD350H54004 LCD panel

2019-11-23 Thread Sam Ravnborg
Hi Paul.

On Wed, Nov 20, 2019 at 06:10:26PM +0100, Paul Cercueil wrote:
> Add bindings documentation for the Frida 3.5" (320x240 pixels) 24-bit
> TFT LCD panel.

New bindings using the meta-schema (.yaml) syntax please.

Sam
> 
> Signed-off-by: Paul Cercueil 
> ---
>  .../bindings/display/panel/frida,frd350h54004.txt| 12 
>  1 file changed, 12 insertions(+)
>  create mode 100644 
> Documentation/devicetree/bindings/display/panel/frida,frd350h54004.txt
> 
> diff --git 
> a/Documentation/devicetree/bindings/display/panel/frida,frd350h54004.txt 
> b/Documentation/devicetree/bindings/display/panel/frida,frd350h54004.txt
> new file mode 100644
> index ..8428f8b05b93
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/display/panel/frida,frd350h54004.txt
> @@ -0,0 +1,12 @@
> +Frida 3.5" (320x240 pixels) 24-bit TFT LCD panel
> +
> +Required properties:
> +- compatible: should be "frida,frd350h54004"
> +- power-supply: as specified in the base binding
> +
> +Optional properties:
> +- backlight: as specified in the base binding
> +- enable-gpios: as specified in the base binding
> +
> +This binding is compatible with the simple-panel binding, which is specified
> +in simple-panel.txt in this directory.
> -- 
> 2.24.0
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH 1/3] dt-bindings: vendor-prefixes: Add Shenzhen Frida LCD Co., Ltd.

2019-11-23 Thread Sam Ravnborg
Hi Paul.

On Wed, Nov 20, 2019 at 06:10:25PM +0100, Paul Cercueil wrote:
> Add an entry for Shenzhen Frida LCD Co., Ltd.
> 
> Signed-off-by: Paul Cercueil 

Reviewed-by: Sam Ravnborg 
> ---
>  Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/vendor-prefixes.yaml 
> b/Documentation/devicetree/bindings/vendor-prefixes.yaml
> index 967e78c5ec0a..9c6e1b42435b 100644
> --- a/Documentation/devicetree/bindings/vendor-prefixes.yaml
> +++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml
> @@ -337,6 +337,8 @@ patternProperties:
>  description: Firefly
>"^focaltech,.*":
>  description: FocalTech Systems Co.,Ltd
> +  "^frida,.*":
> +description: Shenzhen Frida LCD Co., Ltd.
Random note:
Some descriptions end with a '.,', others not.
So both works.


>"^friendlyarm,.*":
>  description: Guangzhou FriendlyARM Computer Tech Co., Ltd
>"^fsl,.*":
> -- 
> 2.24.0
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH 0/4] Replace hibmc code with generic implmentation

2019-11-23 Thread Sam Ravnborg
Hi Thomas.


> The patch set replaces code in hibmc with generic implementation.
> 
> Patches 1 to 3 replace fbdev emuation, framebuffer and creation of
> dumb buffers with respective code from DRM helpers. Patch 4 adds an
> additional interface to debugfs that displays the allocated and free
> areas in video memory.
> 
> The patches have only been compile-tested. Further testing is
> appreciated.

Changes looks good and diffstat is very nice.
From my quick browsing everything was fine, a small comment on
one of the patches.

You can add my:
Acked-by: Sam Ravnborg 

to the whole series.

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

Re: [PATCH 3/4] drm/hisilicon/hibmc: Implement hibmc_dumb_create() with generic helpers

2019-11-23 Thread Sam Ravnborg
Hi Thomas.

Change looks good. If you spin this could you move the
changes to generic drm code to a separate patch?
As it is now it is hidden for most.
But then there are also no users of drm_gem_vram_fill_create_dumb()

One small nit below that you can safely ignore :-)


Sam


On Fri, Nov 22, 2019 at 09:30:43AM +0100, Thomas Zimmermann wrote:
> The hibmc driver aligns scanlines to 16 bytes. Adding the pitch alignment
> as an argument to drm_gem_vram_fill_create_dumb() allows to use the generic
> implementation with hibmc. A value of 0 disables scanline pitches.
> 
> Signed-off-by: Thomas Zimmermann 
> ---
>  drivers/gpu/drm/drm_gem_vram_helper.c | 10 ++--
>  .../gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h   |  4 --
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c   | 48 +--
>  include/drm/drm_gem_vram_helper.h |  1 +
>  4 files changed, 10 insertions(+), 53 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_gem_vram_helper.c 
> b/drivers/gpu/drm/drm_gem_vram_helper.c
> index 666cb4c22bb9..f098784e7dfd 100644
> --- a/drivers/gpu/drm/drm_gem_vram_helper.c
> +++ b/drivers/gpu/drm/drm_gem_vram_helper.c
> @@ -485,6 +485,7 @@ EXPORT_SYMBOL(drm_gem_vram_vunmap);
>   * @dev: the DRM device
>   * @bdev:the TTM BO device managing the buffer object
>   * @pg_align:the buffer's alignment in multiples of the page 
> size
> + * @pitch_align: the scanline's alignment in powers of 2
>   * @interruptible:   sleep interruptible if waiting for memory
>   * @args:the arguments as provided to \
>drm_driver.dumb_create
> @@ -502,6 +503,7 @@ int drm_gem_vram_fill_create_dumb(struct drm_file *file,
> struct drm_device *dev,
> struct ttm_bo_device *bdev,
> unsigned long pg_align,
> +   unsigned long pitch_align,
> bool interruptible,
> struct drm_mode_create_dumb *args)
>  {
> @@ -510,7 +512,9 @@ int drm_gem_vram_fill_create_dumb(struct drm_file *file,
>   int ret;
>   u32 handle;
>  
> - pitch = args->width * ((args->bpp + 7) / 8);
> + pitch = args->width * DIV_ROUND_UP(args->bpp, 8);
Semi related change...

> + if (pitch_align)
> + pitch = ALIGN(pitch, pitch_align);
>   size = pitch * args->height;
>  
>   size = roundup(size, PAGE_SIZE);
> @@ -612,8 +616,8 @@ int drm_gem_vram_driver_dumb_create(struct drm_file *file,
>   if (WARN_ONCE(!dev->vram_mm, "VRAM MM not initialized"))
>   return -EINVAL;
>  
> - return drm_gem_vram_fill_create_dumb(file, dev, >vram_mm->bdev, 0,
> -  false, args);
> + return drm_gem_vram_fill_create_dumb(file, dev, >vram_mm->bdev,
> +  0, 0, false, args);
>  }
>  EXPORT_SYMBOL(drm_gem_vram_driver_dumb_create);
>  
> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h 
> b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h
> index 8eb7258b236a..50a0c1f9d211 100644
> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h
> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h
> @@ -18,7 +18,6 @@
>  #include 
>  
>  struct drm_device;
> -struct drm_gem_object;
>  
>  struct hibmc_drm_private {
>   /* hw */
> @@ -41,9 +40,6 @@ void hibmc_set_current_gate(struct hibmc_drm_private *priv,
>  int hibmc_de_init(struct hibmc_drm_private *priv);
>  int hibmc_vdac_init(struct hibmc_drm_private *priv);
>  
> -int hibmc_gem_create(struct drm_device *dev, u32 size, bool iskernel,
> -  struct drm_gem_object **obj);
> -
>  int hibmc_mm_init(struct hibmc_drm_private *hibmc);
>  void hibmc_mm_fini(struct hibmc_drm_private *hibmc);
>  int hibmc_dumb_create(struct drm_file *file, struct drm_device *dev,
> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c 
> b/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c
> index f6d25b85c209..0af5d966a480 100644
> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c
> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c
> @@ -47,55 +47,11 @@ void hibmc_mm_fini(struct hibmc_drm_private *hibmc)
>   drm_vram_helper_release_mm(hibmc->dev);
>  }
>  
> -int hibmc_gem_create(struct drm_device *dev, u32 size, bool iskernel,
> -  struct drm_gem_object **obj)
> -{
> - struct drm_gem_vram_object *gbo;
> - int ret;
> -
> - *obj = NULL;
> -
> - size = roundup(size, PAGE_SIZE);
> - if (size == 0)
> - return -EINVAL;
> -
> - gbo = drm_gem_vram_create(dev, >vram_mm->bdev, size, 0, false);
> - if (IS_ERR(gbo)) {
> - ret = PTR_ERR(gbo);
> - if (ret != -ERESTARTSYS)
> - DRM_ERROR("failed to allocate GEM object: %d\n", ret);
> - return ret;
> - }
> - *obj = >bo.base;
> - return 0;
> -}
> -
>  int 

Re: [PATCH 2/8] drm/atmel: ditch fb_create wrapper

2019-11-23 Thread Sam Ravnborg
Hi Daniel.
On Tue, Nov 19, 2019 at 10:22:31PM +0100, Daniel Vetter wrote:
> On Fri, Nov 15, 2019 at 10:33:24AM +0100, Boris Brezillon wrote:
> > On Fri, 15 Nov 2019 10:21:14 +0100
> > Daniel Vetter  wrote:
> > 
> > > Spotted while looking through them all.
> > > 
> > > Signed-off-by: Daniel Vetter 
> > > Cc: Sam Ravnborg 
> > > Cc: Boris Brezillon 
> > 
> > Acked-by: Boris Brezillon 
> 
> Merged, thanks for taking a look.

Hi Daniel, thanks for merging this.

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

[PATCH] Revert "drm/fbdev: Fallback to non tiled mode if all tiles not present"

2019-11-23 Thread Uma Shankar
This reverts commit f25c7a006cd1c07254780e3406e45cee4842b933.

2p2c display configuration blows up dmesg when one connector is
disconnected, causing issues in CI.

Below are the sample errors thrown in logs:

[IGT] core_getversion: executing
[IGT] core_getversion: exiting, ret=0
Setting dangerous option reset - tainting kernel
drm:drm_atomic_helper_wait_for_dependencies] ERROR [CRTC:152:pipe B] flip_done 
timed out
drm:drm_atomic_helper_wait_for_dependencies] ERROR [CONNECTOR:299:DP-2] 
flip_done timed out
drm:drm_atomic_helper_wait_for_dependencies] ERROR [PLANE:92:plane 1B] 
flip_done timed out
[drm:drm_atomic_helper_wait_for_flip_done] ERROR [CRTC:152:pipe B] flip_done 
timed out
[drm:drm_atomic_helper_wait_for_dependencies] ERROR [CRTC:152:pipe B] flip_done 
timed out
[drm:drm_atomic_helper_wait_for_dependencies] ERROR [CONNECTOR:299:DP-2] 
flip_done timed out
[drm:drm_atomic_helper_wait_for_dependencies] ERROR [PLANE:92:plane 1B] 
flip_done timed out
[drm:drm_atomic_helper_wait_for_flip_done] ERROR [CRTC:152:pipe B] flip_done 
timed out
Console: switching to colour frame buffer device 480x135
[drm:drm_atomic_helper_wait_for_dependencies] ERROR [CRTC:152:pipe B] flip_done 
timed out
[drm:drm_atomic_helper_wait_for_dependencies] ERROR [CONNECTOR:299:DP-2] 
flip_done timed out

Reverting the change for now to unblock CI execution.

Cc: Ville Syrjälä 
Cc: Dave Airlie 
Cc: Jani Nikula 
Cc: Manasi Navare 
Signed-off-by: Uma Shankar 
---
 drivers/gpu/drm/drm_client_modeset.c | 70 
 1 file changed, 70 deletions(-)

diff --git a/drivers/gpu/drm/drm_client_modeset.c 
b/drivers/gpu/drm/drm_client_modeset.c
index f2150a0bac4c..895b73f23079 100644
--- a/drivers/gpu/drm/drm_client_modeset.c
+++ b/drivers/gpu/drm/drm_client_modeset.c
@@ -114,33 +114,6 @@ drm_client_find_modeset(struct drm_client_dev *client, 
struct drm_crtc *crtc)
return NULL;
 }
 
-static struct drm_display_mode *
-drm_connector_get_tiled_mode(struct drm_connector *connector)
-{
-   struct drm_display_mode *mode;
-
-   list_for_each_entry(mode, >modes, head) {
-   if (mode->hdisplay == connector->tile_h_size &&
-   mode->vdisplay == connector->tile_v_size)
-   return mode;
-   }
-   return NULL;
-}
-
-static struct drm_display_mode *
-drm_connector_fallback_non_tiled_mode(struct drm_connector *connector)
-{
-   struct drm_display_mode *mode;
-
-   list_for_each_entry(mode, >modes, head) {
-   if (mode->hdisplay == connector->tile_h_size &&
-   mode->vdisplay == connector->tile_v_size)
-   continue;
-   return mode;
-   }
-   return NULL;
-}
-
 static struct drm_display_mode *
 drm_connector_has_preferred_mode(struct drm_connector *connector, int width, 
int height)
 {
@@ -375,14 +348,8 @@ static bool drm_client_target_preferred(struct 
drm_connector **connectors,
struct drm_connector *connector;
u64 conn_configured = 0;
int tile_pass = 0;
-   int num_tiled_conns = 0;
int i;
 
-   for (i = 0; i < connector_count; i++) {
-   if (connectors[i]->has_tile)
-   num_tiled_conns++;
-   }
-
 retry:
for (i = 0; i < connector_count; i++) {
connector = connectors[i];
@@ -432,28 +399,6 @@ static bool drm_client_target_preferred(struct 
drm_connector **connectors,
list_for_each_entry(modes[i], >modes, head)
break;
}
-   /*
-* In case of tiled mode if all tiles not present fallback to
-* first available non tiled mode.
-* After all tiles are present, try to find the tiled mode
-* for all and if tiled mode not present due to fbcon size
-* limitations, use first non tiled mode only for
-* tile 0,0 and set to no mode for all other tiles.
-*/
-   if (connector->has_tile) {
-   if (num_tiled_conns <
-   connector->num_h_tile * connector->num_v_tile ||
-   (connector->tile_h_loc == 0 &&
-connector->tile_v_loc == 0 &&
-!drm_connector_get_tiled_mode(connector))) {
-   DRM_DEBUG_KMS("Falling back to non tiled mode 
on Connector %d\n",
- connector->base.id);
-   modes[i] = 
drm_connector_fallback_non_tiled_mode(connector);
-   } else {
-   modes[i] = 
drm_connector_get_tiled_mode(connector);
-   }
-   }
-
DRM_DEBUG_KMS("found mode %s\n", modes[i] ? modes[i]->name :
  "none");
conn_configured |= BIT_ULL(i);
@@ -570,7 +515,6 @@ static bool