base907c.c 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /*
  2. * Copyright 2018 Red Hat Inc.
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  17. * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
  18. * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  19. * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  20. * OTHER DEALINGS IN THE SOFTWARE.
  21. */
  22. #include "base.h"
  23. static void
  24. base907c_image_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
  25. {
  26. u32 *push;
  27. if ((push = evo_wait(&wndw->wndw, 10))) {
  28. evo_mthd(push, 0x0084, 1);
  29. evo_data(push, asyw->image.mode << 8 |
  30. asyw->image.interval << 4);
  31. evo_mthd(push, 0x00c0, 1);
  32. evo_data(push, asyw->image.handle[0]);
  33. evo_mthd(push, 0x0400, 5);
  34. evo_data(push, asyw->image.offset[0] >> 8);
  35. evo_data(push, 0x00000000);
  36. evo_data(push, asyw->image.h << 16 | asyw->image.w);
  37. evo_data(push, asyw->image.layout << 24 |
  38. (asyw->image.pitch[0] >> 8) << 8 |
  39. asyw->image.blocks[0] << 8 |
  40. asyw->image.blockh);
  41. evo_data(push, asyw->image.format << 8);
  42. evo_kick(push, &wndw->wndw);
  43. }
  44. }
  45. static void
  46. base907c_xlut_clr(struct nv50_wndw *wndw)
  47. {
  48. u32 *push;
  49. if ((push = evo_wait(&wndw->wndw, 6))) {
  50. evo_mthd(push, 0x00e0, 1);
  51. evo_data(push, 0x00000000);
  52. evo_mthd(push, 0x00e8, 1);
  53. evo_data(push, 0x00000000);
  54. evo_mthd(push, 0x00fc, 1);
  55. evo_data(push, 0x00000000);
  56. evo_kick(push, &wndw->wndw);
  57. }
  58. }
  59. static void
  60. base907c_xlut_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
  61. {
  62. u32 *push;
  63. if ((push = evo_wait(&wndw->wndw, 6))) {
  64. evo_mthd(push, 0x00e0, 3);
  65. evo_data(push, asyw->xlut.i.enable << 30 |
  66. asyw->xlut.i.mode << 24);
  67. evo_data(push, asyw->xlut.i.offset >> 8);
  68. evo_data(push, 0x40000000);
  69. evo_mthd(push, 0x00fc, 1);
  70. evo_data(push, asyw->xlut.handle);
  71. evo_kick(push, &wndw->wndw);
  72. }
  73. }
  74. static void
  75. base907c_ilut(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
  76. {
  77. asyw->xlut.i.mode = 7;
  78. asyw->xlut.i.enable = 2;
  79. }
  80. const struct nv50_wndw_func
  81. base907c = {
  82. .acquire = base507c_acquire,
  83. .release = base507c_release,
  84. .sema_set = base507c_sema_set,
  85. .sema_clr = base507c_sema_clr,
  86. .ntfy_reset = base507c_ntfy_reset,
  87. .ntfy_set = base507c_ntfy_set,
  88. .ntfy_clr = base507c_ntfy_clr,
  89. .ntfy_wait_begun = base507c_ntfy_wait_begun,
  90. .ilut = base907c_ilut,
  91. .olut_core = true,
  92. .xlut_set = base907c_xlut_set,
  93. .xlut_clr = base907c_xlut_clr,
  94. .image_set = base907c_image_set,
  95. .image_clr = base507c_image_clr,
  96. .update = base507c_update,
  97. };
  98. int
  99. base907c_new(struct nouveau_drm *drm, int head, s32 oclass,
  100. struct nv50_wndw **pwndw)
  101. {
  102. return base507c_new_(&base907c, base507c_format, drm, head, oclass,
  103. 0x00000002 << (head * 4), pwndw);
  104. }