vmwgfx_kms.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /**************************************************************************
  2. *
  3. * Copyright © 2009 VMware, Inc., Palo Alto, CA., USA
  4. * All Rights Reserved.
  5. *
  6. * Permission is hereby granted, free of charge, to any person obtaining a
  7. * copy of this software and associated documentation files (the
  8. * "Software"), to deal in the Software without restriction, including
  9. * without limitation the rights to use, copy, modify, merge, publish,
  10. * distribute, sub license, and/or sell copies of the Software, and to
  11. * permit persons to whom the Software is furnished to do so, subject to
  12. * the following conditions:
  13. *
  14. * The above copyright notice and this permission notice (including the
  15. * next paragraph) shall be included in all copies or substantial portions
  16. * of the Software.
  17. *
  18. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20. * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
  21. * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
  22. * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  23. * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  24. * USE OR OTHER DEALINGS IN THE SOFTWARE.
  25. *
  26. **************************************************************************/
  27. #ifndef VMWGFX_KMS_H_
  28. #define VMWGFX_KMS_H_
  29. #include "drmP.h"
  30. #include "vmwgfx_drv.h"
  31. #define vmw_framebuffer_to_vfb(x) \
  32. container_of(x, struct vmw_framebuffer, base)
  33. /**
  34. * Base class for framebuffers
  35. *
  36. * @pin is called the when ever a crtc uses this framebuffer
  37. * @unpin is called
  38. */
  39. struct vmw_framebuffer {
  40. struct drm_framebuffer base;
  41. int (*pin)(struct vmw_framebuffer *fb);
  42. int (*unpin)(struct vmw_framebuffer *fb);
  43. };
  44. #define vmw_crtc_to_du(x) \
  45. container_of(x, struct vmw_display_unit, crtc)
  46. /*
  47. * Basic cursor manipulation
  48. */
  49. int vmw_cursor_update_image(struct vmw_private *dev_priv,
  50. u32 *image, u32 width, u32 height,
  51. u32 hotspotX, u32 hotspotY);
  52. void vmw_cursor_update_position(struct vmw_private *dev_priv,
  53. bool show, int x, int y);
  54. /**
  55. * Base class display unit.
  56. *
  57. * Since the SVGA hw doesn't have a concept of a crtc, encoder or connector
  58. * so the display unit is all of them at the same time. This is true for both
  59. * legacy multimon and screen objects.
  60. */
  61. struct vmw_display_unit {
  62. struct drm_crtc crtc;
  63. struct drm_encoder encoder;
  64. struct drm_connector connector;
  65. struct vmw_surface *cursor_surface;
  66. struct vmw_dma_buffer *cursor_dmabuf;
  67. size_t cursor_age;
  68. int cursor_x;
  69. int cursor_y;
  70. int hotspot_x;
  71. int hotspot_y;
  72. unsigned unit;
  73. };
  74. /*
  75. * Shared display unit functions - vmwgfx_kms.c
  76. */
  77. void vmw_display_unit_cleanup(struct vmw_display_unit *du);
  78. int vmw_du_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv,
  79. uint32_t handle, uint32_t width, uint32_t height);
  80. int vmw_du_crtc_cursor_move(struct drm_crtc *crtc, int x, int y);
  81. /*
  82. * Legacy display unit functions - vmwgfx_ldu.h
  83. */
  84. int vmw_kms_init_legacy_display_system(struct vmw_private *dev_priv);
  85. int vmw_kms_close_legacy_display_system(struct vmw_private *dev_priv);
  86. #endif