<div dir="ltr">Hi,<div><br></div><div>modesetting X11 driver may provide negative x/y cordinates in mdp5_crtc_cursor_move(...) call when rotation is enabled.</div><div><br></div><div>Because of</div><div><br></div><div>static int mdp5_crtc_cursor_move(struct drm_crtc *crtc, int x, int y)<br></div><div>{</div><div>...</div><div><div><span style="white-space:pre"> </span>mdp5_crtc->cursor.x = x = max(x, 0);</div><div><span style="white-space:pre"> </span>mdp5_crtc->cursor.y = y = max(y, 0);</div></div><div>...</div><div>}</div><div><br></div><div>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.</div><div><br></div><div>For e.g rotation of 180 degree that means that the upper left cursor point stays never reaches the region (0/0) to (<span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">mdp5_crtc->cursor.width/mdp5_crtc->cursor.height).</span></div><div><span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></div><div><span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">I already asked the X men if this should be fixed in modesetting driver or in the kernel CRT</span></div><div><span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">functions:</span></div><div><span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></div><div><span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><a href="https://www.spinics.net/lists/xorg/msg58969.html">https://www.spinics.net/lists/xorg/msg58969.html</a><br></span></div><div><span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></div><div><span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">They told me to fix this in the kernel.</span></div><div><span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></div><div><span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">So, I suppose:</span></div><div><span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></div><div><span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">1.) cursor x should be rather clamped instead to</span></div><div><span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></div>static int mdp5_crtc_cursor_move(struct drm_crtc *crtc, int x, int y)
{ <div><span style="white-space:pre">...</span></div><div><span style="white-space:pre"> </span>mdp5_crtc->cursor.x = x = max(x, -mdp5_crtc->cursor.width);</div><div><span style="white-space:pre"> </span>mdp5_crtc->cursor.y = y = max(y, -mdp5_crtc->cursor.height);</div><div>...</div><div>}</div><div><br></div><div><span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"> 2.) The ROI calculation must be extendet to:</span></div><div><span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></div><div><span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><div>static void get_roi(struct drm_crtc *crtc, uint32_t *roi_w, uint32_t *roi_h)</div><div>{</div><div>...</div><div><div><span style="white-space:pre"> </span>if (x>=0)</div><div><span style="white-space:pre"> </span> *roi_w = min(mdp5_crtc->cursor.width, xres -</div><div><span style="white-space:pre"> </span> mdp5_crtc->cursor.x);</div><div><span style="white-space:pre"> </span>else</div><div><span style="white-space:pre"> </span> *roi_w = mdp5_crtc->cursor.width - abs(mdp5_crtc->cursor.x);</div><div><span style="white-space:pre"> </span>if (y>=0)</div><div><span style="white-space:pre"> </span> *roi_h = min(mdp5_crtc->cursor.height, yres -</div><div><span style="white-space:pre"> </span> mdp5_crtc->cursor.y);</div><div><span style="white-space:pre"> </span>else</div><div><span style="white-space:pre"> </span> *roi_h = mdp5_crtc->cursor.height - abs(mdp5_crtc->cursor.y);</div></div><div>...</div><div>}</div><div><br></div><div>3.) There has to be some kind of hotspot setup in mdp5_crtc_restore_cursor(...)</div><div><br></div><div>Since I have no MDP5 documentation, I don't know how to setup the hotspot and I can't</div><div>implement 3.)</div><div><br></div><div>Please help!</div><div><br></div><div>Best regards</div><div>-Carsten</div></span></div></div>