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

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

2018-07-17 Thread Carsten Behling
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.

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_crtc_restore_cursor(struct drm_crtc *crtc)
 
get_roi(crtc, _w, _h);
 
+   /* If cusror buffer overlaps due to rotation on the
+* upper or left screen border the pixel offset inside
+* the cursor buffer of the ROI is the positive overlap
+* distance.
+*/
+   if (mdp5_crtc->cursor.x < 0) {
+   src_x = abs(mdp5_crtc->cursor.x);
+   x = 0;
+   } else {
+   src_x = 0;
+   }
+   if (mdp5_crtc->cursor.y < 0) {
+   src_y = abs(mdp5_crtc->cursor.y);
+   y = 0;
+   } else {
+   src_y = 0;
+   }
+   DBG("%s: x=%u, y=%u roi_w=%u roi_h=%u src_x=%u src_y=%u",
+   crtc->name, x, y, roi_w, roi_h, src_x, src_y);
+
mdp5_write(mdp5_kms, REG_MDP5_LM_CURSOR_STRIDE(lm), stride);
mdp5_write(mdp5_kms, REG_MDP5_LM_CURSOR_FORMAT(lm),
MDP5_LM_CURSOR_FORMAT_FORMAT(CURSOR_FMT_ARGB));
@@ -812,6 +843,9 @@ static void mdp5_crtc_restore_cursor(struct drm_crtc *crtc)
mdp5_write(mdp5_kms, REG_MDP5_LM_CURSOR_START_XY(lm),
MDP5_LM_CURSOR_START_XY_Y_START(y) |
MDP5_LM_CURSOR_START_XY_X_START(x));
+   mdp5_write(mdp5_kms, REG_MDP5_LM_CURSOR_XY(lm),
+   MDP5_LM_CURSOR_XY_SRC_Y(src_y) |
+   MDP5_LM_CURSOR_XY_SRC_X(src_x));
mdp5_write(mdp5_kms, REG_MDP5_LM_CURSOR_BASE_ADDR(lm),
mdp5_crtc->cursor.iova

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

2018-07-17 Thread Carsten Behling
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.

Signed-off-by: Carsten Behling 
---
 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..43a86582876c 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_crtc_restore_cursor(struct drm_crtc *crtc)
 
get_roi(crtc, _w, _h);
 
+   /* If cusror buffer overlaps due to rotation on the
+* upper or left screen border the pixel offset inside
+* the cursor buffer of the ROI is the positive overlap
+* distance.
+*/
+   if (mdp5_crtc->cursor.x < 0) {
+   src_x = abs(mdp5_crtc->cursor.x);
+   x = 0;
+   } else {
+   src_x = 0;
+   }
+   if (mdp5_crtc->cursor.y < 0) {
+   src_y = abs(mdp5_crtc->cursor.y);
+   y = 0;
+   } else {
+   src_y = 0;
+   }
+   DBG("%s: x=%d, y=%d roi_w=%d roi_h=%d src_x=%d src_y=%d",
+   x, y, roi_w, roi_h, src_x, src_y);
+
mdp5_write(mdp5_kms, REG_MDP5_LM_CURSOR_STRIDE(lm), stride);
mdp5_write(mdp5_kms, REG_MDP5_LM_CURSOR_FORMAT(lm),
MDP5_LM_CURSOR_FORMAT_FORMAT(CURSOR_FMT_ARGB));
@@ -812,6 +843,9 @@ static void mdp5_crtc_restore_cursor(struct drm_crtc *crtc)
mdp5_write(mdp5_kms, REG_MDP5_LM_CURSOR_START_XY(lm),
MDP5_LM_CURSOR_START_XY_Y_START(y) |
MDP5_LM_CURSOR_START_XY_X_START(x));
+   mdp5_write(mdp5_kms, REG_MDP5_LM_CURSOR_XY(lm),
+   MDP5_LM_CURSOR_XY_SRC_Y(src_y) |
+   MDP5_LM_CURSOR_XY_SRC_X(src_x));
mdp5_write(mdp5_kms, REG_MDP5_LM_CURSOR_BASE_ADDR(lm),
mdp5_crtc->cursor.iova);
 
@@ -932,8 +966,9 @@ static int mdp5_crtc_cursor_move(struct drm_crtc

Re: drm/msm/mdp5: negative x/y in cursor move

2018-07-11 Thread Carsten Behling
I found the solution:

ROI has to be recalculated for negative x/y indicating using the
lower/right corner of the cursor buffer. Further, MDP5_LM_CURSOR_XY_SRC_Y
and MDP5_LM_CURSOR_XY_SRC_X mus be calculated for the hotspot:

Index: kernel-source/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c
===
--- kernel-source.orig/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c
+++ kernel-source/drivers/gpu/drm/msm/mdp/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)
@@ -756,10 +756,16 @@ static void get_roi(struct drm_crtc *crt
  * (xres-x) will be new cursor width when x > (xres - cursor.width)
  * (yres-y) will be new cursor height when y > (yres - cursor.height)
  */
- *roi_w = min(mdp5_crtc->cursor.width, xres -
- mdp5_crtc->cursor.x);
- *roi_h = min(mdp5_crtc->cursor.height, yres -
- mdp5_crtc->cursor.y);
+ if (mdp5_crtc->cursor.x >= 0)
+ *roi_w = min(mdp5_crtc->cursor.width, xres -
+ mdp5_crtc->cursor.x);
+ 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)
@@ -769,7 +775,7 @@ static void mdp5_crtc_restore_cursor(str
  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;

@@ -786,6 +792,20 @@ static void mdp5_crtc_restore_cursor(str

  get_roi(crtc, _w, _h);

+if (mdp5_crtc->cursor.x < 0) {
+src_x = abs(mdp5_crtc->cursor.x);
+x = 0;
+ } else
+src_x = 0;
+
+if (mdp5_crtc->cursor.y < 0) {
+src_y = abs(mdp5_crtc->cursor.y);
+y = 0;
+} else
+src_y = 0;
+
+ //printk("x=%d, y=%d roi_w=%d roi_h=%d src_x=%d src_y=%d\n", x, y, roi_w,
roi_h, src_x, src_y);
+
  mdp5_write(mdp5_kms, REG_MDP5_LM_CURSOR_STRIDE(lm), stride);
  mdp5_write(mdp5_kms, REG_MDP5_LM_CURSOR_FORMAT(lm),
  MDP5_LM_CURSOR_FORMAT_FORMAT(CURSOR_FMT_ARGB));
@@ -798,6 +818,9 @@ static void mdp5_crtc_restore_cursor(str
  mdp5_write(mdp5_kms, REG_MDP5_LM_CURSOR_START_XY(lm),
  MDP5_LM_CURSOR_START_XY_Y_START(y) |
  MDP5_LM_CURSOR_START_XY_X_START(x));
+ mdp5_write(mdp5_kms, REG_MDP5_LM_CURSOR_XY(lm),
+ MDP5_LM_CURSOR_XY_SRC_Y(src_y) |
+ MDP5_LM_CURSOR_XY_SRC_X(src_x));
  mdp5_write(mdp5_kms, REG_MDP5_LM_CURSOR_BASE_ADDR(lm),
  mdp5_crtc->cursor.iova);

@@ -903,6 +926,8 @@ static int mdp5_crtc_cursor_move(struct
  uint32_t roi_w;
  uint32_t roi_h;
  unsigned long flags;
+ int border_x = mdp5_crtc->cursor.width * (-1);
+ int border_y = mdp5_crtc->cursor.height * (-1);

  if (!mdp5_crtc->lm_cursor_enabled) {
  dev_warn(dev->dev,
@@ -918,8 +943,8 @@ static int mdp5_crtc_cursor_move(struct
  if (unlikely(!crtc->state->enable))
  return 0;

- mdp5_crtc->cursor.x = x = max(x, 0);
- mdp5_crtc->cursor.y = y = max(y, 0);
+ mdp5_crtc->cursor.x = x = max(x, border_x);
+ mdp5_crtc->cursor.y = y = max(y, border_y);

  get_roi(crtc, _w, _h);

Best regards
-Carsten

2018-07-10 12:11 GMT+02:00 Carsten Behling :

> Hi,
>
> modesetting X11 driver may provide negative x/y cordinates in
> mdp5_crtc_cursor_move(...) call when rotation is enabled.
>
> Because of
>
> static int mdp5_crtc_cursor_move(struct drm_crtc *crtc, int x, int y)
> {
> ...
> mdp5_crtc->cursor.x = x = max(x, 0);
> mdp5_crtc->cursor.y = y = max(y, 0);
> ...
> }
>
> x/y is calmped to 0/0 in those cases resulting that the cursor does not
> move anymore beyond mdp5_crtc->cursor.width, mdp5_crtc->cursor.height.
>
> For e.g rotation of 180 degree that means that the upper left cursor point
> stays never reaches the region (0/0) to  (mdp5_crtc->cursor.width/
> mdp5_crtc->cursor.height).
>
> I already asked the X men if this should be fixed in modesetting driver or
> in the kernel CRT
> functions:
>
> https://www.spinics.net/lists/xorg/msg58969.html
>
> They told me to fix this in the kernel.
>
> So, I suppose:
>
> 1.) cursor x should be rather clamped instead to
>
> static int mdp5_crtc_cursor_move(struct drm_crtc *crtc, int x, int y) {
> ...
> mdp5_crtc->cursor.x = x = max(x, -mdp5_crtc->cursor.width);
> mdp5_crtc->cursor.y = y = max(y, -mdp5_crtc->cursor.height);
> ...
> }
>
>  2

drm/msm/mdp5: negative x/y in cursor move

2018-07-11 Thread Carsten Behling
Hi,

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

Because of

static int mdp5_crtc_cursor_move(struct drm_crtc *crtc, int x, int y)
{
...
mdp5_crtc->cursor.x = x = max(x, 0);
mdp5_crtc->cursor.y = y = max(y, 0);
...
}

x/y is calmped to 0/0 in those cases resulting that the cursor does not
move anymore beyond mdp5_crtc->cursor.width, mdp5_crtc->cursor.height.

For e.g rotation of 180 degree that means that the upper left cursor point
stays never reaches the region (0/0) to  (
mdp5_crtc->cursor.width/mdp5_crtc->cursor.height).

I already asked the X men if this should be fixed in modesetting driver or
in the kernel CRT
functions:

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

They told me to fix this in the kernel.

So, I suppose:

1.) cursor x should be rather clamped instead to

static int mdp5_crtc_cursor_move(struct drm_crtc *crtc, int x, int y) {
...
mdp5_crtc->cursor.x = x = max(x, -mdp5_crtc->cursor.width);
mdp5_crtc->cursor.y = y = max(y, -mdp5_crtc->cursor.height);
...
}

 2.) The ROI calculation must be extendet to:

static void get_roi(struct drm_crtc *crtc, uint32_t *roi_w, uint32_t *roi_h)
{
...
if (x>=0)
*roi_w = min(mdp5_crtc->cursor.width, xres -
mdp5_crtc->cursor.x);
else
*roi_w = mdp5_crtc->cursor.width - abs(mdp5_crtc->cursor.x);
if (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);
...
}

3.) There has to be some kind of hotspot setup
in mdp5_crtc_restore_cursor(...)

Since I have no MDP5 documentation, I don't know how to setup the hotspot
and I can't
implement 3.)

Please help!

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


Re: Fwd: DRM MIPI DSI device and I2C device?

2018-04-05 Thread Carsten Behling
> 2018-04-05 13:39 GMT+02:00 Laurent Pinchart <
laurent.pinch...@ideasonboard.com>:
> Hi Andrzej,
>
> On Thursday, 5 April 2018 14:28:51 EEST Andrzej Hajda wrote:
>> On 05.04.2018 12:28, Laurent Pinchart wrote:
>>> On Wednesday, 4 April 2018 11:41:05 EEST Carsten Behling wrote:
>>>>> Hi,
>>>>>
>>>>> I would like to write a DRM bridge driver that is an I2C device and a
>>>>> DRM MIPI DSI device.
>>>>>
>>>>> It looks like that both - 'i2c-core.c: of_i2c_register_devices' and
>>>>> 'drm_mipi_dsi.c: mipi_dsi_host_register'  are registering their
devices
>>>>> by iterating over devicetree child nodes with
>>>>> for_each_available_child_of_node.
>>>>>
>>>>>> Since I can't make the bridge a child node of both, I don't know how
to
>>>>> resolve it.
>>>>
>>>> Found the answer myself. adv7533 driver is a good example. Devicetree
>>>> exists for qcom apq8016-sbc. No need to make the bridge a MIPI DSI
child
>>>> node.
>>>
>>> This is an issue that has largely been ignored so far in Linux. Both DT
>>> and the Linux kernel device model organize devices in a tree structure
>>> based on the control buses. Devices that are connected to multiple
control
>>> buses haven't been taken into account in the design and are thus hard to
>>> support.
>>>
>>> As you may know, DSI can work in command mode or data mode. In data mode
>>> the DSI bus is only use to transfer video data, while in command mode it
>>> is also used to control the device (reading and writing registers).
>>
>> I am not sure what you mean by data and command mode. MIPI DSI specs
>> says about video and command mode - modes to transfer video data. In
>> both cases DSI can be used to control the device.
>
> Sorry, I meant pure video mode, when a panel only uses DSI to receive
video
> data but handles all control communication through a separate control bus.
>
>>> A DSI device operating in data mode and controlled through I2C isn't a
>>> problem, as there's a single control bus in that case. The device should
>>> be a child of the I2C controller in DT, and will be instantiated through
>>> of_i2c_register_devices(). A DSI device operating in command mode
without
>>> any other control bus isn't a problem either, it will be a child of the
>>> DSI master in DT, and will bee instantiated through
>>> mipi_dsi_host_register().
>>>
>>> A DSI device operating in command mode that also require configuration
>>> through a separate control bus (such as I2C, but also SPI) is much more
>>> problematic to support. Fortunately those devices are rare. Hopefully
>>> your device won't fall in this category. If it does, we can discuss how
>>> to best support it.
>>
>> As you have already found adv bridge is a good example. It is not clear
>> from the emails if DSI is used only to send video, or also to control?
>> And if to control, is it used to pass only specific commands
>> or can be used as alternative to i2c interface?
>
>Carsten, could you please provide more information about the panel you're
>using ?

Sure, it's an TI SN65DSI84. It is just receiving pixel data on the input
lines.
I got an incomplete driver from Variscite that just writes a hardcoded  I2C
regmap from
DTS. I'm currently writing a real DRM bridge driver based on that. I didn't
find
a better one.

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


Fwd: DRM MIPI DSI device and I2C device?

2018-04-05 Thread Carsten Behling
> Hi,
>
> I would like to write a DRM bridge driver that is an I2C device and a DRM
MIPI DSI device.
>
> It looks like that both - 'i2c-core.c: of_i2c_register_devices' and
'drm_mipi_dsi.c: mipi_dsi_host_register'  are registering their devices by
iterating over devicetree child nodes with for_each_available_child_of_node.
>
>Since I can't make the bridge a child node of both, I don't know how to
resolve it.
>
Found the answer myself. adv7533 driver is a good example. Devicetree
exists for qcom apq8016-sbc. No need to make the bridge a MIPI DSI child
node.

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


DRM MIPI DSI device and I2C device?

2018-04-04 Thread Carsten Behling
Hi,

I would like to write a DRM bridge driver that is an I2C device and a DRM
MIPI DSI device.

It looks like that both - 'i2c-core.c: of_i2c_register_devices' and
'drm_mipi_dsi.c: mipi_dsi_host_register'  are registering their devices by
iterating over devicetree child nodes with for_each_available_child_of_node.

Since I can't make the bridge a child node of both, I don't know how to
resolve it.

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