diff options
Diffstat (limited to 'drivers/gpu/drm/vmwgfx/vmwgfx_kms.h')
-rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_kms.h | 147 |
1 files changed, 132 insertions, 15 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h index cb36e1d70133..13f2f1d2818a 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h @@ -33,6 +33,8 @@ #include <drm/drm_encoder.h> #include "vmwgfx_drv.h" + + /** * struct vmw_kms_dirty - closure structure for the vmw_kms_helper_dirty * function. @@ -125,19 +127,71 @@ struct vmw_framebuffer_dmabuf { }; -/* - * Basic cursor manipulation +static const uint32_t vmw_primary_plane_formats[] = { + DRM_FORMAT_XRGB1555, + DRM_FORMAT_RGB565, + DRM_FORMAT_RGB888, + DRM_FORMAT_XRGB8888, + DRM_FORMAT_ARGB8888, +}; + +static const uint32_t vmw_cursor_plane_formats[] = { + DRM_FORMAT_ARGB8888, +}; + + +#define vmw_crtc_state_to_vcs(x) container_of(x, struct vmw_crtc_state, base) +#define vmw_plane_state_to_vps(x) container_of(x, struct vmw_plane_state, base) +#define vmw_connector_state_to_vcs(x) \ + container_of(x, struct vmw_connector_state, base) + +/** + * Derived class for crtc state object + * + * @base DRM crtc object */ -int vmw_cursor_update_image(struct vmw_private *dev_priv, - u32 *image, u32 width, u32 height, - u32 hotspotX, u32 hotspotY); -int vmw_cursor_update_dmabuf(struct vmw_private *dev_priv, - struct vmw_dma_buffer *dmabuf, - u32 width, u32 height, - u32 hotspotX, u32 hotspotY); -void vmw_cursor_update_position(struct vmw_private *dev_priv, - bool show, int x, int y); +struct vmw_crtc_state { + struct drm_crtc_state base; +}; +/** + * Derived class for plane state object + * + * @base DRM plane object + * @surf Display surface for STDU + * @dmabuf display dmabuf for SOU + * @content_fb_type Used by STDU. + * @dmabuf_size Size of the dmabuf, used by Screen Object Display Unit + * @pinned pin count for STDU display surface + */ +struct vmw_plane_state { + struct drm_plane_state base; + struct vmw_surface *surf; + struct vmw_dma_buffer *dmabuf; + + int content_fb_type; + unsigned long dmabuf_size; + + int pinned; + + /* For CPU Blit */ + struct ttm_bo_kmap_obj host_map, guest_map; + unsigned int cpp; +}; + + +/** + * Derived class for connector state object + * + * @base DRM connector object + * @is_implicit connector property + * + */ +struct vmw_connector_state { + struct drm_connector_state base; + + bool is_implicit; +}; /** * Base class display unit. @@ -150,6 +204,8 @@ struct vmw_display_unit { struct drm_crtc crtc; struct drm_encoder encoder; struct drm_connector connector; + struct drm_plane primary; + struct drm_plane cursor; struct vmw_surface *cursor_surface; struct vmw_dma_buffer *cursor_dmabuf; @@ -198,11 +254,24 @@ void vmw_du_crtc_save(struct drm_crtc *crtc); void vmw_du_crtc_restore(struct drm_crtc *crtc); int vmw_du_crtc_gamma_set(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b, - uint32_t size); + uint32_t size, + struct drm_modeset_acquire_ctx *ctx); int vmw_du_crtc_cursor_set2(struct drm_crtc *crtc, struct drm_file *file_priv, uint32_t handle, uint32_t width, uint32_t height, int32_t hot_x, int32_t hot_y); int vmw_du_crtc_cursor_move(struct drm_crtc *crtc, int x, int y); +int vmw_du_connector_set_property(struct drm_connector *connector, + struct drm_property *property, + uint64_t val); +int vmw_du_connector_atomic_set_property(struct drm_connector *connector, + struct drm_connector_state *state, + struct drm_property *property, + uint64_t val); +int +vmw_du_connector_atomic_get_property(struct drm_connector *connector, + const struct drm_connector_state *state, + struct drm_property *property, + uint64_t *val); int vmw_du_connector_dpms(struct drm_connector *connector, int mode); void vmw_du_connector_save(struct drm_connector *connector); void vmw_du_connector_restore(struct drm_connector *connector); @@ -210,9 +279,6 @@ enum drm_connector_status vmw_du_connector_detect(struct drm_connector *connector, bool force); int vmw_du_connector_fill_modes(struct drm_connector *connector, uint32_t max_width, uint32_t max_height); -int vmw_du_connector_set_property(struct drm_connector *connector, - struct drm_property *property, - uint64_t val); int vmw_kms_helper_dirty(struct vmw_private *dev_priv, struct vmw_framebuffer *framebuffer, const struct drm_clip_rect *clips, @@ -270,6 +336,55 @@ void vmw_kms_update_implicit_fb(struct vmw_private *dev_priv, void vmw_kms_create_implicit_placement_property(struct vmw_private *dev_priv, bool immutable); +/* Universal Plane Helpers */ +void vmw_du_primary_plane_destroy(struct drm_plane *plane); +void vmw_du_cursor_plane_destroy(struct drm_plane *plane); +int vmw_du_cursor_plane_disable(struct drm_plane *plane); +int vmw_du_cursor_plane_update(struct drm_plane *plane, + struct drm_crtc *crtc, + struct drm_framebuffer *fb, + int crtc_x, int crtc_y, + unsigned int crtc_w, + unsigned int crtc_h, + uint32_t src_x, uint32_t src_y, + uint32_t src_w, uint32_t src_h); + +/* Atomic Helpers */ +int vmw_du_primary_plane_atomic_check(struct drm_plane *plane, + struct drm_plane_state *state); +int vmw_du_cursor_plane_atomic_check(struct drm_plane *plane, + struct drm_plane_state *state); +void vmw_du_cursor_plane_atomic_update(struct drm_plane *plane, + struct drm_plane_state *old_state); +void vmw_du_cursor_plane_atomic_disable(struct drm_plane *plane, + struct drm_plane_state *old_state); +int vmw_du_cursor_plane_prepare_fb(struct drm_plane *plane, + struct drm_plane_state *new_state); +void vmw_du_plane_cleanup_fb(struct drm_plane *plane, + struct drm_plane_state *old_state); +void vmw_du_plane_reset(struct drm_plane *plane); +struct drm_plane_state *vmw_du_plane_duplicate_state(struct drm_plane *plane); +void vmw_du_plane_destroy_state(struct drm_plane *plane, + struct drm_plane_state *state); +void vmw_du_plane_unpin_surf(struct vmw_plane_state *vps, + bool unreference); + +int vmw_du_crtc_atomic_check(struct drm_crtc *crtc, + struct drm_crtc_state *state); +void vmw_du_crtc_atomic_begin(struct drm_crtc *crtc, + struct drm_crtc_state *old_crtc_state); +void vmw_du_crtc_atomic_flush(struct drm_crtc *crtc, + struct drm_crtc_state *old_crtc_state); +void vmw_du_crtc_reset(struct drm_crtc *crtc); +struct drm_crtc_state *vmw_du_crtc_duplicate_state(struct drm_crtc *crtc); +void vmw_du_crtc_destroy_state(struct drm_crtc *crtc, + struct drm_crtc_state *state); +void vmw_du_connector_reset(struct drm_connector *connector); +struct drm_connector_state * +vmw_du_connector_duplicate_state(struct drm_connector *connector); + +void vmw_du_connector_destroy_state(struct drm_connector *connector, + struct drm_connector_state *state); /* * Legacy display unit functions - vmwgfx_ldu.c @@ -339,5 +454,7 @@ int vmw_kms_stdu_dma(struct vmw_private *dev_priv, bool to_surface, bool interruptible); +int vmw_kms_set_config(struct drm_mode_set *set, + struct drm_modeset_acquire_ctx *ctx); #endif |