linux/drivers/gpu/drm/nouveau/dispnv50/ovly907e.c
<<
>>
Prefs
   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 "ovly.h"
  23#include "atom.h"
  24
  25static void
  26ovly907e_image_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
  27{
  28        u32 *push;
  29        if ((push = evo_wait(&wndw->wndw, 12))) {
  30                evo_mthd(push, 0x0084, 1);
  31                evo_data(push, asyw->image.interval << 4);
  32                evo_mthd(push, 0x00c0, 1);
  33                evo_data(push, asyw->image.handle[0]);
  34                evo_mthd(push, 0x0100, 1);
  35                evo_data(push, 0x00000002);
  36                evo_mthd(push, 0x0400, 1);
  37                evo_data(push, asyw->image.offset[0] >> 8);
  38                evo_mthd(push, 0x0408, 3);
  39                evo_data(push, asyw->image.h << 16 | asyw->image.w);
  40                evo_data(push, asyw->image.layout << 24 |
  41                               (asyw->image.pitch[0] >> 8) << 8 |
  42                               asyw->image.blocks[0] << 8 |
  43                               asyw->image.blockh);
  44                evo_data(push, asyw->image.format << 8 |
  45                               asyw->image.colorspace);
  46                evo_kick(push, &wndw->wndw);
  47        }
  48}
  49
  50const struct nv50_wndw_func
  51ovly907e = {
  52        .acquire = ovly507e_acquire,
  53        .release = ovly507e_release,
  54        .ntfy_set = ovly507e_ntfy_set,
  55        .ntfy_clr = ovly507e_ntfy_clr,
  56        .ntfy_reset = ovly827e_ntfy_reset,
  57        .ntfy_wait_begun = ovly827e_ntfy_wait_begun,
  58        .image_set = ovly907e_image_set,
  59        .image_clr = ovly507e_image_clr,
  60        .scale_set = ovly507e_scale_set,
  61        .update = ovly507e_update,
  62};
  63
  64static const u32
  65ovly907e_format[] = {
  66        DRM_FORMAT_YUYV,
  67        DRM_FORMAT_UYVY,
  68        DRM_FORMAT_XRGB8888,
  69        DRM_FORMAT_XRGB1555,
  70        DRM_FORMAT_XBGR2101010,
  71        DRM_FORMAT_XBGR16161616F,
  72        0
  73};
  74
  75int
  76ovly907e_new(struct nouveau_drm *drm, int head, s32 oclass,
  77             struct nv50_wndw **pwndw)
  78{
  79        return ovly507e_new_(&ovly907e, ovly907e_format, drm, head, oclass,
  80                             0x00000004 << (head * 4), pwndw);
  81}
  82