UDL's fbdev doesn't work for user-space apps

2017-12-04 Thread Alexey Brodkin
Hello,

I'm trying to use DisplayLink USB2.0-to-HDMI adapter as the one and only
video output and I want to get Xserver working on top of that.

I'm not very familiar with all the parts of Linux GPU/video stack
(especially its user-space counterpart) so my assumptions might be wrong
in that case please correct me.

My first [probably incorrect] assumption is Xserver requires fbdev (/dev/fbX)
and it cannot use DRI video card natively. Is that correct?

So to get /ded/fb0 with UDL I just enabled CONFIG_DRM_UDL & 
CONFIG_DRM_FBDEV_EMULATION.
That gave me boot console on HDMI screen and I was full of expectations.
But when I tried to use /dev/fb0 from whatever user-space app nothing got
displayed on the screen... as well as no error messages appeared.

After eyeballing at UDL code (especially in comparison with QXC which uses 
deferredio
as well) I noticed that in UDL fb_deferred_io_init() is called from 
udl_fb_open(),
i.e. .fb_open call-back (in other words every time user-space app opens 
/dev/fb0)
while in QXC this is done only once and much earlier in qxlfb_create(), which is
called with .fb_probe call-back. So moved fb_deferred_io_init() in UDL driver 
from
udl_fb_open() to udlfb_create() which is also called from .fb_probe.

With that change I finally got video output via fbdev from user-space app,
but only on the first run. The next attempt to run inevitably ends with
kernel crash showing the following stack-trace (having half of the new screen
rendered on display):
>8-
Stack Trace:
  udl_handle_damage+0x48/0x210
  udl_crtc_mode_set+0x6ee/0x754
  drm_crtc_helper_set_mode+0x25e/0x438
  drm_crtc_helper_set_config+0x6d6/0x814
  __drm_mode_set_config_internal+0x48/0xc8
  drm_mode_setcrtc+0x320/0x478
  drm_ioctl+0x22c/0x3e4
  SyS_ioctl+0xa4/0x8cc
  EV_Trap+0x108/0x10c
random: crng init done
>8-

I'm wondering if UDL driver (its DRM flavor) was ever tested for
fbdev in user-space? If so and it really works for somebody
maybe I'm doing something terribly wrong - in that case any comments
are very welcome.

One interesting note: it seems like pure DRI stuff works like a charm.
I may run kmscube perfectly fine without any changes whatsoever and do it
many times in a row.

Thanks in advance,
Alexey
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

Re: UDL's fbdev doesn't work for user-space apps

2017-12-04 Thread Jose Abreu
Hi Alexey,

On 04-12-2017 11:32, Alexey Brodkin wrote:
> My first [probably incorrect] assumption is Xserver requires fbdev (/dev/fbX)
> and it cannot use DRI video card natively. Is that correct?
>
>

Xserver can use DRI directly, you need to enable modesetting
driver in Xorg config or use the designated driver for your card
(if there is any).

e.g.:

Section "Device"
Identifier "Card0"
Driver "modesetting"
Option "kmsdev" "/dev/dri/card0"
Option "SWcursor" "true"
BusID "PCI:X:X:X"
EndSection

Best Regards,
Jose Miguel Abreu

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


xf86-video-armada via UDL [was: Re: UDL's fbdev doesn't work for user-space apps]

2017-12-04 Thread Alexey Brodkin
Hi Jose,

On Mon, 2017-12-04 at 11:50 +, Jose Abreu wrote:
> Hi Alexey,
> 
> On 04-12-2017 11:32, Alexey Brodkin wrote:
> > 
> > My first [probably incorrect] assumption is Xserver requires fbdev 
> > (/dev/fbX)
> > and it cannot use DRI video card natively. Is that correct?
> > 
> > 
> 
> Xserver can use DRI directly, you need to enable modesetting
> driver in Xorg config or use the designated driver for your card
> (if there is any).

Ok that makes sense. I didn't think about generic modesetting driver for 
Xserver.
And that indeed works. This is my xorg.conf:
--->8--
# cat /etc/X11/xorg.conf 
Section "Device"
Identifier  "Driver0"
Screen  0
Driver  "modesetting"
Option  "kmsdev" "/dev/dri/card1"
EndSection
--->8--

I do see xclock is rendered fine.

Now I guess is getting closer to what I really need :)
In the end I wanted to get 3D rendered by Vivante GPU
to be displayed on UDL. My assumption was very simple - if IMX-DRM+Etnaviv
work fine it should be straight-forward to swap IMX-DRM bitstreamer with UDL
and we're golden.

That might be more a question to Lucas now.
I use xorg.conf as found here:
http://git.arm.linux.org.uk/cgit/xf86-video-armada.git/tree/conf/xorg-sample.conf?h=unstable-devel
That's what it has:
--->8--
Section "Device"
Identifier  "Driver0"
Screen  0
Driver  "armada"

# Support hotplugging displays?
#   Option  "Hotplug"   "TRUE"

# Support hardware cursor if available?
#   Option  "HWCursor"  "TRUE"

# Use GPU acceleration?
#   Option  "UseGPU""TRUE"

# Provide Xv interfaces?
#   Option  "XvAccel"   "TRUE"

# Prefer overlay for Xv (TRUE for armada-drm, FALSE for imx-drm)
#   Option  "XvPreferOverlay" "TRUE"

# Which accelerator module to load (automatically found if commented out)
#   Option  "AccelModule"   "etnadrm_gpu"
#   Option  "AccelModule"   "etnaviv_gpu"

# Support DRI2 interfaces?
#   Option  "DRI"   "TRUE"
EndSection
--->8--

Indeed I uncommented all the lines and then it allows to see
for example glmark2-es2 working on Wandboard (that's exactly where
"imx-drm + etnaviv" combo is used).

But if I swap "imx-drm" to "udl" I don't see anything on my screen
(connected via UDL) even though Xserver seems to really start claiming the 
screen
(so I see it becomes black, effectively overriding whatever was there before) 
and
glmark benchmark prints results.

Maybe I'm missing some additional glue for UDL in "xf86-video-armada" except 
the simple one:
--->8--
--- a/src/armada_module.c
+++ b/src/armada_module.c
@@ -26,7 +26,7 @@
 #define ARMADA_NAME"armada"
 #define ARMADA_DRIVER_NAME "armada"
 
-#define DRM_MODULE_NAMES   "armada-drm", "imx-drm"
+#define DRM_MODULE_NAMES   "armada-drm", "imx-drm", "udl"
 #define DRM_DEFAULT_BUS_ID NULL
 
 static const char *drm_module_names[] = { DRM_MODULE_NAMES };
@@ -43,6 +43,11 @@ static SymTabRec ipu_chipsets[] = {
{ -1, NULL }
 };
 
+static SymTabRec udl_chipsets[] = {
+   {  0, "UDL" },
+   { -1, NULL }
+};
+
 static const OptionInfoRec * const options[] = {
armada_drm_options,
common_drm_options,
@@ -115,6 +120,8 @@ static void armada_identify(int flags)
  armada_chipsets);
xf86PrintChipsets(ARMADA_NAME, "Support for Freescale IPU",
  ipu_chipsets);
+   xf86PrintChipsets(ARMADA_NAME, "Support DisplayLink USB2.0",
+ udl_chipsets);
 }
--->8--

-Alexey
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

Re: xf86-video-armada via UDL [was: Re: UDL's fbdev doesn't work for user-space apps]

2017-12-04 Thread Jose Abreu
On 04-12-2017 13:16, Alexey Brodkin wrote:
> Option  "kmsdev" "/dev/dri/card1"

Which drm driver uses /dev/dri/card0? I'm seing drmOpen code and
if you don't specify the busID it will fallback for the first
card that matches "armada-drm" or "imx-drm" or "udl".

> But if I swap "imx-drm" to "udl" I don't see anything on my screen
> (connected via UDL) even though Xserver seems to really start claiming the 
> screen
> (so I see it becomes black, effectively overriding whatever was there before) 
> and
> glmark benchmark prints results.
>
>

Xorg.log can help confirm if everything is ok.

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: xf86-video-armada via UDL [was: Re: UDL's fbdev doesn't work for user-space apps]

2017-12-04 Thread Alexey Brodkin
Hi Jose,

On Mon, 2017-12-04 at 14:02 +, Jose Abreu wrote:
> On 04-12-2017 13:16, Alexey Brodkin wrote:
> > 
> > Option  "kmsdev" "/dev/dri/card1"
> 
> Which drm driver uses /dev/dri/card0? I'm seing drmOpen code and
> if you don't specify the busID it will fallback for the first
> card that matches "armada-drm" or "imx-drm" or "udl".
> 
> > 
> > But if I swap "imx-drm" to "udl" I don't see anything on my screen
> > (connected via UDL) even though Xserver seems to really start claiming the 
> > screen
> > (so I see it becomes black, effectively overriding whatever was there 
> > before) and
> > glmark benchmark prints results.
> > 
> > 
> 
> Xorg.log can help confirm if everything is ok.

That's xorg.conf:
--->8--
# cat /etc/X11/xorg.conf 
Section "Device"
Identifier  "Driver0"
Screen  0
Driver  "armada"

# Support hotplugging displays?
Option  "Hotplug"   "TRUE"

# Support hardware cursor if available?
Option  "HWCursor"  "TRUE"

# Use GPU acceleration?
Option  "UseGPU""TRUE"

# Provide Xv interfaces?
Option  "XvAccel"   "TRUE"

# Prefer overlay for Xv (TRUE for armada-drm, FALSE for imx-drm)
Option  "XvPreferOverlay" "TRUE"

# Which accelerator module to load (automatically found if commented out)
Option  "AccelModule"   "etnadrm_gpu"
Option  "AccelModule"   "etnaviv_gpu"

# Support DRI2 interfaces?
Option  "DRI"   "TRUE"
EndSection
--->8--

Full log you may find below.

-Alexey


Linux version 4.14.2-8-g95be6f762b7f-dirty (abrodkin@abrodkin-7440l) (gcc 
version 7.1.1 20170710 (ARCv2 ISA Linux uClibc toolchain 2017.09-rc1))
#68 SMP PREEMPT Mon Dec 4 16:12:46 MSK 2017
Memory @ 8000 [1024M] 
OF: fdt: Machine model: snps,hsdk
earlycon: uart8250 at MMIO32 0xf0005000 (options '115200n8')
bootconsole [uart8250] enabled
archs-intc  : 2 priority levels (default 1) FIRQ (not used)

IDENTITY: ARCVER [0x52] ARCNUM [0x0] CHIPID [ 0x0]
processor [0]   : ARC HS38 R2.1 (ARCv2 ISA) 
Timers  : Timer0 Timer1 RTC [UP 64-bit] GFRC [SMP 64-bit] 
ISA Extn: atomic ll64 unalign (not used)
: mpy[opt 9] div_rem norm barrel-shift swap minmax swape
BPU : full match, cache:2048, Predict Table:16384
MMU [v4]: 8k PAGE, 2M Super Page (not used) JTLB 1024 (256x4), uDTLB 8, 
uITLB 4, PAE40 (not used) 
I-Cache : 64K, 4way/set, 64B Line, VIPT aliasing
D-Cache : 64K, 2way/set, 64B Line, PIPT
SLC : 512K, 128B Line
Peripherals : 0xf000, IO-Coherency (disabled) 
Vector Table: 0x9000
FPU : SP DP 
DEBUG   : ActionPoint smaRT RTT 
OS ABI [v4] : 64-bit data any register aligned
Extn [SMP]  : ARConnect (v2): 4 cores with IPI IDU DEBUG GFRC
Enable CONFIG_ARC_HAS_ACCL_REGS for working apps
On node 0 totalpages: 131072
free_area_init_node: node 0, pgdat 91cf1080, node_mem_map bfb8
  Normal zone: 576 pages used for memmap
  Normal zone: 0 pages reserved
  Normal zone: 131072 pages, LIFO batch:15
random: fast init done
percpu: Embedded 7 pages/cpu @bfb1c000 s25088 r8192 d24064 u57344
pcpu-alloc: s25088 r8192 d24064 u57344 alloc=7*8192
pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3 
Built 1 zonelists, mobility grouping on.  Total pages: 130496
Kernel command line: earlycon=uart8250,mmio32,0xf0005000,115200n8 
console=ttyS0,115200n8 debug print-fatal-signals=1 drm.debug=0x1e
PID hash table entries: 4096 (order: 1, 16384 bytes)
Dentry cache hash table entries: 131072 (order: 6, 524288 bytes)
Inode-cache hash table entries: 65536 (order: 5, 262144 bytes)
Memory: 749864K/1048576K available (5319K kernel code, 270K rwdata, 1048K 
rodata, 23040K init, 293K bss, 298712K reserved, 0K cma-reserved)
Preemptible hierarchical RCU implementation.
Tasks RCU enabled.
NR_IRQS: 512
MCIP: IDU supports 64 common irqs
clocksource: ARConnect GFRC: mask: 0x max_cycles: 
0x1cd42e4dffb, max_idle_ns: 881590591483 ns
Console: colour dummy device 80x25
Calibrating delay loop... 996.14 BogoMIPS (lpj=4980736)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 2048 (order: 0, 8192 bytes)
Mountpoint-cache hash table entries: 2048 (order: 0, 8192 bytes)
Hierarchical SRCU implementation.
smp: Bringing up secondary CPUs ...
Idle Task [1] bf04da80
Trying to bring up CPU1 ...
archs-intc  : 2 priority levels (default 1) FIRQ (not used)

IDENTITY: ARCVER [0x52] ARCNUM [0x1] CHIPID [ 0x0]
processor [1]   : ARC HS38 R2.1 (ARCv2 ISA) 
Timers  : Timer0 Timer1 RTC [UP 64-bit] 
ISA Extn: atomic ll64 unalign (not used)
: mpy[opt 9] div_rem norm barrel-shift swap minmax swape
BPU : full match, cache:2048, Predict Table:16384
MMU [v4]: 

Re: xf86-video-armada via UDL [was: Re: UDL's fbdev doesn't work for user-space apps]

2017-12-04 Thread Jose Abreu
On 04-12-2017 14:53, Alexey Brodkin wrote:
> Full log you may find below.

Sorry but I meant /var/log/Xorg.0.log file.


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: xf86-video-armada via UDL [was: Re: UDL's fbdev doesn't work for user-space apps]

2017-12-04 Thread Alexey Brodkin
Hi Jose,

On Mon, 2017-12-04 at 15:55 +, Jose Abreu wrote:
> On 04-12-2017 14:53, Alexey Brodkin wrote:
> > 
> > Full log you may find below.
> 
> Sorry but I meant /var/log/Xorg.0.log file.

Ooops... sorry... here is it.

-Alexey



# cat /var/log/Xorg.0.log 
[30.345] 
X.Org X Server 1.19.5
Release Date: 2017-10-12
[30.345] X Protocol Version 11, Revision 0
[30.345] Build Operating System: Linux 3.10.0-514.el7.x86_64 x86_64 
[30.346] Current Operating System: Linux axs103 
4.14.2-8-g95be6f762b7f-dirty #68 SMP PREEMPT Mon Dec 4 16:12:46 MSK 2017 arc
[30.346] Kernel command line: earlycon=uart8250,mmio32,0xf0005000,115200n8 
console=ttyS0,115200n8 debug print-fatal-signals=1 drm.debug=0x1e
[30.346] Build Date: 01 December 2017  12:21:28PM
[30.346]  
[30.346] Current version of pixman: 0.34.0
[30.346]Before reporting problems, check http://wiki.x.org
to make sure that you have the latest version.
[30.346] Markers: (--) probed, (**) from config file, (==) default setting,
(++) from command line, (!!) notice, (II) informational,
(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
[30.346] (==) Log file: "/var/log/Xorg.0.log", Time: Thu Jan  1 00:00:30 
1970
[30.346] (==) Using config file: "/etc/X11/xorg.conf"
[30.346] (==) Using system config directory "/usr/share/X11/xorg.conf.d"
[30.347] (==) No Layout section.  Using the first Screen section.
[30.347] (==) No screen section available. Using defaults.
[30.347] (**) |-->Screen "Default Screen Section" (0)
[30.347] (**) |   |-->Monitor ""
[30.348] (==) No device specified for screen "Default Screen Section".
Using the first device section listed.
[30.348] (**) |   |-->Device "Driver0"
[30.348] (==) No monitor specified for screen "Default Screen Section".
Using a default monitor configuration.
[30.349] (==) Not automatically adding devices
[30.349] (==) Not automatically enabling devices
[30.349] (==) Not automatically adding GPU devices
[30.349] (==) Max clients allowed: 256, resource mask: 0x1f
[30.349] (WW) The directory "/usr/share/fonts/X11//TTF/" does not exist.
[30.349]Entry deleted from font path.
[30.349] (WW) The directory "/usr/share/fonts/X11//OTF/" does not exist.
[30.349]Entry deleted from font path.
[30.349] (WW) `fonts.dir' not found (or not valid) in 
"/usr/share/fonts/X11//100dpi/".
[30.349]Entry deleted from font path.
[30.349](Run 'mkfontdir' on "/usr/share/fonts/X11//100dpi/").
[30.349] (WW) `fonts.dir' not found (or not valid) in 
"/usr/share/fonts/X11//75dpi/".
[30.349]Entry deleted from font path.
[30.350](Run 'mkfontdir' on "/usr/share/fonts/X11//75dpi/").
[30.350] (==) FontPath set to:
/usr/share/fonts/X11//misc/,
/usr/share/fonts/X11//Type1/
[30.350] (==) ModulePath set to "/usr/lib/xorg/modules"
[30.350] (==) |-->Input Device ""
[30.350] (==) |-->Input Device ""
[30.350] (==) No Layout section. Using the default mouse configuration.
[30.350] (==) No Layout section. Using the default keyboard configuration.
[30.350] (II) Loader magic: 0x178528
[30.350] (II) Module ABI versions:
[30.350]X.Org ANSI C Emulation: 0.4
[30.350]X.Org Video Driver: 23.0
[30.350]X.Org XInput driver : 24.1
[30.350]X.Org Server Extension : 10.0
[30.350] (II) LoadModule: "armada"
[30.351] (II) Loading /usr/lib/xorg/modules/drivers/armada_drv.so
[30.352] (II) Module armada: vendor="X.Org Foundation"
[30.352]compiled for 1.19.5, module version = 0.0.0
[30.352]Module class: X.Org Video Driver
[30.352]ABI class: X.Org Video Driver, version 23.0
[30.352] (II) LoadModule: "mouse"
[30.352] (II) Loading /usr/lib/xorg/modules/input/mouse_drv.so
[30.353] (II) Module mouse: vendor="X.Org Foundation"
[30.353]compiled for 1.19.5, module version = 1.9.2
[30.353]Module class: X.Org XInput Driver
[30.353]ABI class: X.Org XInput driver, version 24.1
[30.353] (II) LoadModule: "kbd"
[30.353] (II) Loading /usr/lib/xorg/modules/input/kbd_drv.so
[30.353] (II) Module kbd: vendor="X.Org Foundation"
[30.353]compiled for 1.19.5, module version = 1.9.0
[30.354]Module class: X.Org XInput Driver
[30.354]ABI class: X.Org XInput driver, version 24.1
[30.354] (II) armada: Support for Marvell LCD Controller: 88AP510
[30.354] (II) armada: Support for Freescale IPU: i.MX6
[30.354] (II) armada: Support DisplayLink USB2.0: UDL
[30.354] (--) using VT number 2

[30.354] (WW) Falling back to old probe method for armada
[30.357] (WW) VGA arbiter: cannot open kernel arbiter, no multi-card support
[30.357] (II) armada(0): hardware: udl
[30.357] (II) armada(0): Creating default Display subsection in Screen 
section
"Default Screen Section" for depth/fbbpp 24/

Re: xf86-video-armada via UDL [was: Re: UDL's fbdev doesn't work for user-space apps]

2017-12-04 Thread Jose Abreu
On 04-12-2017 16:00, Alexey Brodkin wrote:
> [30.763] (II) armada(0): etnaviv: Xv: using YUY2 format intermediate YUV 
> target
>

I'm wondering if this means that target format for UDL is YUV ...

But anyway, I revisited your first email and noticed that you
said kmscube runs fine. Is this using etnaviv as renderer? And
you also said X is claiming the screen but nothing appears ...
which X client are you using to test this?

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: xf86-video-armada via UDL [was: Re: UDL's fbdev doesn't work for user-space apps]

2017-12-04 Thread Alexey Brodkin
Hi Jose,

On Mon, 2017-12-04 at 17:24 +, Jose Abreu wrote:
> On 04-12-2017 16:00, Alexey Brodkin wrote:
> > 
> > [30.763] (II) armada(0): etnaviv: Xv: using YUY2 format intermediate 
> > YUV target
> > 
> 
> I'm wondering if this means that target format for UDL is YUV ...
> 
> But anyway, I revisited your first email and noticed that you
> said kmscube runs fine. Is this using etnaviv as renderer?

Indeed, in case of kmscube etnaviv is a renderer while UDL
outputs the picture on the screen.

> And
> you also said X is claiming the screen but nothing appears ...
> which X client are you using to test this?

Well it might be seen from my full log.
I just start X with "X&" command and then
execute things like "xclock".

So not sure who is a client in that case.

-Alexey
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

Re: xf86-video-armada via UDL [was: Re: UDL's fbdev doesn't work for user-space apps]

2017-12-04 Thread Emil Velikov
On 4 December 2017 at 14:02, Jose Abreu  wrote:
> On 04-12-2017 13:16, Alexey Brodkin wrote:
>> Option  "kmsdev" "/dev/dri/card1"
>
> Which drm driver uses /dev/dri/card0? I'm seing drmOpen code and
> if you don't specify the busID it will fallback for the first
> card that matches "armada-drm" or "imx-drm" or "udl".
>
As you've noticed, drmOpen can give you some 'nice' side-effects.
I'd recommend getting a list of devices with drmGetDevice{,s}2 and
applying $heuristics to filter the device you want.

-Emil

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc