Message ID | 1392229733-1379-1-git-send-email-alexander.deucher@amd.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Mit, 2014-02-12 at 13:28 -0500, Alex Deucher wrote: > Some hardware may not support standard 64x64 cursors. Add > a drm cap to query the cursor size from the kernel. Some examples > include radeon CIK parts (128x128 cursors) and armada (32x64 or 64x32). > This allows things like device specific ddxes to remove asics specific > logic and also allows xf86-video-modesetting to work properly with hw > cursors on this hardware. Default to 64 if the driver doesn't specify > a size. The patches look good, but what's your plan for dealing with other KMS apps such as Wayland compositors (weston is also affected by this, I assume so is gnome-shell, maybe more)? I was thinking it might be good to have a backup plan in the kernel, e.g. copying from the BO passed in by userspace to a different BO if the former doesn't match the hardware size.
On Wed, Feb 12, 2014 at 8:37 PM, Michel Dänzer <michel@daenzer.net> wrote: > On Mit, 2014-02-12 at 13:28 -0500, Alex Deucher wrote: >> Some hardware may not support standard 64x64 cursors. Add >> a drm cap to query the cursor size from the kernel. Some examples >> include radeon CIK parts (128x128 cursors) and armada (32x64 or 64x32). >> This allows things like device specific ddxes to remove asics specific >> logic and also allows xf86-video-modesetting to work properly with hw >> cursors on this hardware. Default to 64 if the driver doesn't specify >> a size. > > The patches look good, but what's your plan for dealing with other KMS > apps such as Wayland compositors (weston is also affected by this, I > assume so is gnome-shell, maybe more)? I was thinking it might be good > to have a backup plan in the kernel, e.g. copying from the BO passed in > by userspace to a different BO if the former doesn't match the hardware > size. I think the easiest fix would be for them to fix up support similarly to what I did for xf86-video-modesetting so they are ready to go once distros start enabling them by default. Adjusting the image on the fly in the kernel seems a like pain. Alex > > > -- > Earthling Michel Dänzer | http://www.amd.com > Libre software enthusiast | Mesa and X developer >
On Wed, Feb 12, 2014 at 1:28 PM, Alex Deucher <alexdeucher@gmail.com> wrote: > Some hardware may not support standard 64x64 cursors. Add > a drm cap to query the cursor size from the kernel. Some examples > include radeon CIK parts (128x128 cursors) and armada (32x64 or 64x32). > This allows things like device specific ddxes to remove asics specific > logic and also allows xf86-video-modesetting to work properly with hw > cursors on this hardware. Default to 64 if the driver doesn't specify > a size. > > Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Rob Clark <robdclark@gmail.com> > --- > drivers/gpu/drm/drm_ioctl.c | 12 ++++++++++++ > include/drm/drm_crtc.h | 3 +++ > include/uapi/drm/drm.h | 2 ++ > 3 files changed, 17 insertions(+) > > diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c > index dffc836..f4dc9b7 100644 > --- a/drivers/gpu/drm/drm_ioctl.c > +++ b/drivers/gpu/drm/drm_ioctl.c > @@ -296,6 +296,18 @@ int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_priv) > case DRM_CAP_ASYNC_PAGE_FLIP: > req->value = dev->mode_config.async_page_flip; > break; > + case DRM_CAP_CURSOR_WIDTH: > + if (dev->mode_config.cursor_width) > + req->value = dev->mode_config.cursor_width; > + else > + req->value = 64; > + break; > + case DRM_CAP_CURSOR_HEIGHT: > + if (dev->mode_config.cursor_height) > + req->value = dev->mode_config.cursor_height; > + else > + req->value = 64; > + break; > default: > return -EINVAL; > } > diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h > index 71727b6..8f3dee0 100644 > --- a/include/drm/drm_crtc.h > +++ b/include/drm/drm_crtc.h > @@ -907,6 +907,9 @@ struct drm_mode_config { > > /* whether async page flip is supported or not */ > bool async_page_flip; > + > + /* cursor size */ > + uint32_t cursor_width, cursor_height; > }; > > #define obj_to_crtc(x) container_of(x, struct drm_crtc, base) > diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h > index 3c9a833..b06c8ed 100644 > --- a/include/uapi/drm/drm.h > +++ b/include/uapi/drm/drm.h > @@ -619,6 +619,8 @@ struct drm_gem_open { > #define DRM_PRIME_CAP_EXPORT 0x2 > #define DRM_CAP_TIMESTAMP_MONOTONIC 0x6 > #define DRM_CAP_ASYNC_PAGE_FLIP 0x7 > +#define DRM_CAP_CURSOR_WIDTH 0x8 > +#define DRM_CAP_CURSOR_HEIGHT 0x9 > > /** DRM_IOCTL_GET_CAP ioctl argument type */ > struct drm_get_cap { > -- > 1.8.3.1 > > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/dri-devel
diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c index dffc836..f4dc9b7 100644 --- a/drivers/gpu/drm/drm_ioctl.c +++ b/drivers/gpu/drm/drm_ioctl.c @@ -296,6 +296,18 @@ int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_priv) case DRM_CAP_ASYNC_PAGE_FLIP: req->value = dev->mode_config.async_page_flip; break; + case DRM_CAP_CURSOR_WIDTH: + if (dev->mode_config.cursor_width) + req->value = dev->mode_config.cursor_width; + else + req->value = 64; + break; + case DRM_CAP_CURSOR_HEIGHT: + if (dev->mode_config.cursor_height) + req->value = dev->mode_config.cursor_height; + else + req->value = 64; + break; default: return -EINVAL; } diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index 71727b6..8f3dee0 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h @@ -907,6 +907,9 @@ struct drm_mode_config { /* whether async page flip is supported or not */ bool async_page_flip; + + /* cursor size */ + uint32_t cursor_width, cursor_height; }; #define obj_to_crtc(x) container_of(x, struct drm_crtc, base) diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h index 3c9a833..b06c8ed 100644 --- a/include/uapi/drm/drm.h +++ b/include/uapi/drm/drm.h @@ -619,6 +619,8 @@ struct drm_gem_open { #define DRM_PRIME_CAP_EXPORT 0x2 #define DRM_CAP_TIMESTAMP_MONOTONIC 0x6 #define DRM_CAP_ASYNC_PAGE_FLIP 0x7 +#define DRM_CAP_CURSOR_WIDTH 0x8 +#define DRM_CAP_CURSOR_HEIGHT 0x9 /** DRM_IOCTL_GET_CAP ioctl argument type */ struct drm_get_cap {
Some hardware may not support standard 64x64 cursors. Add a drm cap to query the cursor size from the kernel. Some examples include radeon CIK parts (128x128 cursors) and armada (32x64 or 64x32). This allows things like device specific ddxes to remove asics specific logic and also allows xf86-video-modesetting to work properly with hw cursors on this hardware. Default to 64 if the driver doesn't specify a size. Signed-off-by: Alex Deucher <alexander.deucher@amd.com> --- drivers/gpu/drm/drm_ioctl.c | 12 ++++++++++++ include/drm/drm_crtc.h | 3 +++ include/uapi/drm/drm.h | 2 ++ 3 files changed, 17 insertions(+)