-
Notifications
You must be signed in to change notification settings - Fork 5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add FBUNSUPPORTED ioctl for bcm2708_fb #1200
Add FBUNSUPPORTED ioctl for bcm2708_fb #1200
Conversation
I'm wondering if we should just turn dev_err() into dev_dbg() instead and silence the error that way. Let userspace report the error if necessary. |
@notro It's not easy to say it should be kernel module or usespace's work to info this. since the log just verboses a u32, confuses me at first look...we reparse it then we should classify it in the switch-case. When fb ioctls grow in 2d display driver, this will save us a lot time to say which is which. |
As far as I can see FBUNSUPPORTED is a hack in fbturbo and isn't something handled by any other kernel fb driver. As such it could never be upstreamed and doesn't really belong in the kernel. That leaves the options of fbturbo not doing this hack, or of the kernel downgrading an unknown ioctl into a more minor complaint, or of just living with the kernel messages. @pelwell any thoughts? |
Looking at the fbdev core, I see that it doesn't log unsupported ioctl calls, it just returns -ENOTTY. static long do_fb_ioctl(struct fb_info *info, unsigned int cmd,
unsigned long arg)
{
<...>
switch (cmd) {
<...>
default:
if (!lock_fb_info(info))
return -ENODEV;
fb = info->fbops;
if (fb->fb_ioctl)
ret = fb->fb_ioctl(info, cmd, arg);
else
ret = -ENOTTY;
unlock_fb_info(info);
}
return ret;
} A quick look at some drivers shows examples of printing an error (omap2), returning zero even if it's unsupported (udlfb) and just returning an error (sh_mobile_lcdcfb). |
Supporting an ioctl that has been chosen specfically because it isn't supported does seem to be going against the spirit of the hack. We should just return an error - any decent code that cares will check it. |
Some drivers use ENOIOCTLCMD. |
That would seem to be an obvious choice except for: These should never be seen by user programs.
The correct return code for bad ioctl's seems to be ENOTTY: |
That's fine with me. |
yes, once Xserver's 2d driver housekeeps its specified ioctls, we'd better sync with it. A better way to manager those ioctls is just bring in those specific ioctls inside bcm2708 fbdev's scope.
ENOTTY does meet and come closely to what we need. But I do in favor of seeing the kernel message complaint when encounter unknown ioctls which is easier to catch our attention. What do you @notro @popcornmix @pelwell think of? |
I'm still not keen on adding explicit support for FBUNSUPPORTED (which isn't a real kernel ioctl). I think I could live with changing the current dev_err to a dev_dbg. I think that avoids the dmesg log message. It's not trivial to enable the message without a kernel rebuild, but hopefully if an error occurs it will be passed up the stack and reported from userland somewhere (maybe...) So I think a two line patch that changes dev_err to dev_dbg and change the EINVAL to ENOTTY would be my preference. |
+1 |
since fbturbo introduces and use FBUNSUPPORTED ioctl on copyarea operations for unsupported dummy ioctl which is expected to return failure. in such scenario, bcm2709 always prompts error log. in order not to bother users in kernel log, we change the dev_err to dev_dbg and return a ENOTTY other than EINVAL to let userspace handles the return value. Signed-off-by: wuyuehang <yuehan9.wu@gmail.com> Reviewed-by: popcornmix <popcornmix@gmail.com> Reviewed-by: Phil Elwell <pelwell@users.noreply.github.com> Reviewed-by: Noralf Trønnes <noralf@tronnes.org>
ok, I see, let the userspace worry the return value. |
bcm2709_fb: refine appropriate behaviors to unsupported fb ioctls
Adding "Reviewed-by:" on someone else's behalf without explicit permission is slightly disingenuous, but this is a very simple change and we've already spent too long discussing it so I've merged anyway. |
thank your for your reminder, will take care it next time. :p |
kernel: BCM270X_DT: Use clk_core for I2C interfaces See: #212 kernel: SDIO-overlay: add poll_once-boolean parameter kernel: dts: Added overlay for gpio_ir_recv driver See: raspberrypi/linux#1199 kernel: Add FBUNSUPPORTED ioctl for bcm2708_fb See: raspberrypi/linux#1200 kernel: config: Add FB_TFT_ILI9163 module See: raspberrypi/linux#1177
kernel: BCM270X_DT: Use clk_core for I2C interfaces See: raspberrypi/firmware#212 kernel: SDIO-overlay: add poll_once-boolean parameter kernel: dts: Added overlay for gpio_ir_recv driver See: raspberrypi/linux#1199 kernel: Add FBUNSUPPORTED ioctl for bcm2708_fb See: raspberrypi/linux#1200 kernel: config: Add FB_TFT_ILI9163 module See: raspberrypi/linux#1177
kernel: BCM270X_DT: Use clk_core for I2C interfaces See: raspberrypi#212 kernel: SDIO-overlay: add poll_once-boolean parameter kernel: dts: Added overlay for gpio_ir_recv driver See: raspberrypi/linux#1199 kernel: Add FBUNSUPPORTED ioctl for bcm2708_fb See: raspberrypi/linux#1200 kernel: config: Add FB_TFT_ILI9163 module See: raspberrypi/linux#1177
since fbturbo introduces and use it on copyarea operations for
unsupported dummy ioctl which is expected to return failure.
In order not to confuse user in kernel log, we should filter it out.
related fbturbo copyarea src code at: https://github.com/ssvb/xf86-video-fbturbo/blob/master/src/fb_copyarea.c#L76