vsp1_drm.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607
  1. /*
  2. * vsp1_drm.c -- R-Car VSP1 DRM API
  3. *
  4. * Copyright (C) 2015 Renesas Electronics Corporation
  5. *
  6. * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. */
  13. #include <linux/device.h>
  14. #include <linux/slab.h>
  15. #include <media/media-entity.h>
  16. #include <media/v4l2-subdev.h>
  17. #include <media/vsp1.h>
  18. #include "vsp1.h"
  19. #include "vsp1_bru.h"
  20. #include "vsp1_dl.h"
  21. #include "vsp1_drm.h"
  22. #include "vsp1_lif.h"
  23. #include "vsp1_pipe.h"
  24. #include "vsp1_rwpf.h"
  25. /* -----------------------------------------------------------------------------
  26. * Interrupt Handling
  27. */
  28. void vsp1_drm_display_start(struct vsp1_device *vsp1)
  29. {
  30. vsp1_dlm_irq_display_start(vsp1->drm->pipe.output->dlm);
  31. }
  32. /* -----------------------------------------------------------------------------
  33. * DU Driver API
  34. */
  35. int vsp1_du_init(struct device *dev)
  36. {
  37. struct vsp1_device *vsp1 = dev_get_drvdata(dev);
  38. if (!vsp1)
  39. return -EPROBE_DEFER;
  40. return 0;
  41. }
  42. EXPORT_SYMBOL_GPL(vsp1_du_init);
  43. /**
  44. * vsp1_du_setup_lif - Setup the output part of the VSP pipeline
  45. * @dev: the VSP device
  46. * @width: output frame width in pixels
  47. * @height: output frame height in pixels
  48. *
  49. * Configure the output part of VSP DRM pipeline for the given frame @width and
  50. * @height. This sets up formats on the BRU source pad, the WPF0 sink and source
  51. * pads, and the LIF sink pad.
  52. *
  53. * As the media bus code on the BRU source pad is conditioned by the
  54. * configuration of the BRU sink 0 pad, we also set up the formats on all BRU
  55. * sinks, even if the configuration will be overwritten later by
  56. * vsp1_du_setup_rpf(). This ensures that the BRU configuration is set to a well
  57. * defined state.
  58. *
  59. * Return 0 on success or a negative error code on failure.
  60. */
  61. int vsp1_du_setup_lif(struct device *dev, unsigned int width,
  62. unsigned int height)
  63. {
  64. struct vsp1_device *vsp1 = dev_get_drvdata(dev);
  65. struct vsp1_pipeline *pipe = &vsp1->drm->pipe;
  66. struct vsp1_bru *bru = vsp1->bru;
  67. struct v4l2_subdev_format format;
  68. unsigned int i;
  69. int ret;
  70. dev_dbg(vsp1->dev, "%s: configuring LIF with format %ux%u\n",
  71. __func__, width, height);
  72. if (width == 0 || height == 0) {
  73. /* Zero width or height means the CRTC is being disabled, stop
  74. * the pipeline and turn the light off.
  75. */
  76. ret = vsp1_pipeline_stop(pipe);
  77. if (ret == -ETIMEDOUT)
  78. dev_err(vsp1->dev, "DRM pipeline stop timeout\n");
  79. media_entity_pipeline_stop(&pipe->output->entity.subdev.entity);
  80. for (i = 0; i < bru->entity.source_pad; ++i) {
  81. vsp1->drm->inputs[i].enabled = false;
  82. bru->inputs[i].rpf = NULL;
  83. pipe->inputs[i] = NULL;
  84. }
  85. pipe->num_inputs = 0;
  86. vsp1_dlm_reset(pipe->output->dlm);
  87. vsp1_device_put(vsp1);
  88. dev_dbg(vsp1->dev, "%s: pipeline disabled\n", __func__);
  89. return 0;
  90. }
  91. /* Configure the format at the BRU sinks and propagate it through the
  92. * pipeline.
  93. */
  94. memset(&format, 0, sizeof(format));
  95. format.which = V4L2_SUBDEV_FORMAT_ACTIVE;
  96. for (i = 0; i < bru->entity.source_pad; ++i) {
  97. format.pad = i;
  98. format.format.width = width;
  99. format.format.height = height;
  100. format.format.code = MEDIA_BUS_FMT_ARGB8888_1X32;
  101. format.format.field = V4L2_FIELD_NONE;
  102. ret = v4l2_subdev_call(&bru->entity.subdev, pad,
  103. set_fmt, NULL, &format);
  104. if (ret < 0)
  105. return ret;
  106. dev_dbg(vsp1->dev, "%s: set format %ux%u (%x) on BRU pad %u\n",
  107. __func__, format.format.width, format.format.height,
  108. format.format.code, i);
  109. }
  110. format.pad = bru->entity.source_pad;
  111. format.format.width = width;
  112. format.format.height = height;
  113. format.format.code = MEDIA_BUS_FMT_ARGB8888_1X32;
  114. format.format.field = V4L2_FIELD_NONE;
  115. ret = v4l2_subdev_call(&bru->entity.subdev, pad, set_fmt, NULL,
  116. &format);
  117. if (ret < 0)
  118. return ret;
  119. dev_dbg(vsp1->dev, "%s: set format %ux%u (%x) on BRU pad %u\n",
  120. __func__, format.format.width, format.format.height,
  121. format.format.code, i);
  122. format.pad = RWPF_PAD_SINK;
  123. ret = v4l2_subdev_call(&vsp1->wpf[0]->entity.subdev, pad, set_fmt, NULL,
  124. &format);
  125. if (ret < 0)
  126. return ret;
  127. dev_dbg(vsp1->dev, "%s: set format %ux%u (%x) on WPF0 sink\n",
  128. __func__, format.format.width, format.format.height,
  129. format.format.code);
  130. format.pad = RWPF_PAD_SOURCE;
  131. ret = v4l2_subdev_call(&vsp1->wpf[0]->entity.subdev, pad, get_fmt, NULL,
  132. &format);
  133. if (ret < 0)
  134. return ret;
  135. dev_dbg(vsp1->dev, "%s: got format %ux%u (%x) on WPF0 source\n",
  136. __func__, format.format.width, format.format.height,
  137. format.format.code);
  138. format.pad = LIF_PAD_SINK;
  139. ret = v4l2_subdev_call(&vsp1->lif->entity.subdev, pad, set_fmt, NULL,
  140. &format);
  141. if (ret < 0)
  142. return ret;
  143. dev_dbg(vsp1->dev, "%s: set format %ux%u (%x) on LIF sink\n",
  144. __func__, format.format.width, format.format.height,
  145. format.format.code);
  146. /* Verify that the format at the output of the pipeline matches the
  147. * requested frame size and media bus code.
  148. */
  149. if (format.format.width != width || format.format.height != height ||
  150. format.format.code != MEDIA_BUS_FMT_ARGB8888_1X32) {
  151. dev_dbg(vsp1->dev, "%s: format mismatch\n", __func__);
  152. return -EPIPE;
  153. }
  154. /* Mark the pipeline as streaming and enable the VSP1. This will store
  155. * the pipeline pointer in all entities, which the s_stream handlers
  156. * will need. We don't start the entities themselves right at this point
  157. * as there's no plane configured yet, so we can't start processing
  158. * buffers.
  159. */
  160. ret = vsp1_device_get(vsp1);
  161. if (ret < 0)
  162. return ret;
  163. ret = media_entity_pipeline_start(&pipe->output->entity.subdev.entity,
  164. &pipe->pipe);
  165. if (ret < 0) {
  166. dev_dbg(vsp1->dev, "%s: pipeline start failed\n", __func__);
  167. vsp1_device_put(vsp1);
  168. return ret;
  169. }
  170. dev_dbg(vsp1->dev, "%s: pipeline enabled\n", __func__);
  171. return 0;
  172. }
  173. EXPORT_SYMBOL_GPL(vsp1_du_setup_lif);
  174. /**
  175. * vsp1_du_atomic_begin - Prepare for an atomic update
  176. * @dev: the VSP device
  177. */
  178. void vsp1_du_atomic_begin(struct device *dev)
  179. {
  180. struct vsp1_device *vsp1 = dev_get_drvdata(dev);
  181. struct vsp1_pipeline *pipe = &vsp1->drm->pipe;
  182. vsp1->drm->num_inputs = pipe->num_inputs;
  183. /* Prepare the display list. */
  184. pipe->dl = vsp1_dl_list_get(pipe->output->dlm);
  185. }
  186. EXPORT_SYMBOL_GPL(vsp1_du_atomic_begin);
  187. /**
  188. * vsp1_du_atomic_update - Setup one RPF input of the VSP pipeline
  189. * @dev: the VSP device
  190. * @rpf_index: index of the RPF to setup (0-based)
  191. * @cfg: the RPF configuration
  192. *
  193. * Configure the VSP to perform image composition through RPF @rpf_index as
  194. * described by the @cfg configuration. The image to compose is referenced by
  195. * @cfg.mem and composed using the @cfg.src crop rectangle and the @cfg.dst
  196. * composition rectangle. The Z-order is configurable with higher @zpos values
  197. * displayed on top.
  198. *
  199. * If the @cfg configuration is NULL, the RPF will be disabled. Calling the
  200. * function on a disabled RPF is allowed.
  201. *
  202. * Image format as stored in memory is expressed as a V4L2 @cfg.pixelformat
  203. * value. The memory pitch is configurable to allow for padding at end of lines,
  204. * or simply for images that extend beyond the crop rectangle boundaries. The
  205. * @cfg.pitch value is expressed in bytes and applies to all planes for
  206. * multiplanar formats.
  207. *
  208. * The source memory buffer is referenced by the DMA address of its planes in
  209. * the @cfg.mem array. Up to two planes are supported. The second plane DMA
  210. * address is ignored for formats using a single plane.
  211. *
  212. * This function isn't reentrant, the caller needs to serialize calls.
  213. *
  214. * Return 0 on success or a negative error code on failure.
  215. */
  216. int vsp1_du_atomic_update(struct device *dev, unsigned int rpf_index,
  217. const struct vsp1_du_atomic_config *cfg)
  218. {
  219. struct vsp1_device *vsp1 = dev_get_drvdata(dev);
  220. const struct vsp1_format_info *fmtinfo;
  221. struct vsp1_rwpf *rpf;
  222. if (rpf_index >= vsp1->info->rpf_count)
  223. return -EINVAL;
  224. rpf = vsp1->rpf[rpf_index];
  225. if (!cfg) {
  226. dev_dbg(vsp1->dev, "%s: RPF%u: disable requested\n", __func__,
  227. rpf_index);
  228. vsp1->drm->inputs[rpf_index].enabled = false;
  229. return 0;
  230. }
  231. dev_dbg(vsp1->dev,
  232. "%s: RPF%u: (%u,%u)/%ux%u -> (%u,%u)/%ux%u (%08x), pitch %u dma { %pad, %pad, %pad } zpos %u\n",
  233. __func__, rpf_index,
  234. cfg->src.left, cfg->src.top, cfg->src.width, cfg->src.height,
  235. cfg->dst.left, cfg->dst.top, cfg->dst.width, cfg->dst.height,
  236. cfg->pixelformat, cfg->pitch, &cfg->mem[0], &cfg->mem[1],
  237. &cfg->mem[2], cfg->zpos);
  238. /*
  239. * Store the format, stride, memory buffer address, crop and compose
  240. * rectangles and Z-order position and for the input.
  241. */
  242. fmtinfo = vsp1_get_format_info(vsp1, cfg->pixelformat);
  243. if (!fmtinfo) {
  244. dev_dbg(vsp1->dev, "Unsupport pixel format %08x for RPF\n",
  245. cfg->pixelformat);
  246. return -EINVAL;
  247. }
  248. rpf->fmtinfo = fmtinfo;
  249. rpf->format.num_planes = fmtinfo->planes;
  250. rpf->format.plane_fmt[0].bytesperline = cfg->pitch;
  251. rpf->format.plane_fmt[1].bytesperline = cfg->pitch;
  252. rpf->alpha = cfg->alpha;
  253. rpf->mem.addr[0] = cfg->mem[0];
  254. rpf->mem.addr[1] = cfg->mem[1];
  255. rpf->mem.addr[2] = cfg->mem[2];
  256. vsp1->drm->inputs[rpf_index].crop = cfg->src;
  257. vsp1->drm->inputs[rpf_index].compose = cfg->dst;
  258. vsp1->drm->inputs[rpf_index].zpos = cfg->zpos;
  259. vsp1->drm->inputs[rpf_index].enabled = true;
  260. return 0;
  261. }
  262. EXPORT_SYMBOL_GPL(vsp1_du_atomic_update);
  263. static int vsp1_du_setup_rpf_pipe(struct vsp1_device *vsp1,
  264. struct vsp1_rwpf *rpf, unsigned int bru_input)
  265. {
  266. struct v4l2_subdev_selection sel;
  267. struct v4l2_subdev_format format;
  268. const struct v4l2_rect *crop;
  269. int ret;
  270. /* Configure the format on the RPF sink pad and propagate it up to the
  271. * BRU sink pad.
  272. */
  273. crop = &vsp1->drm->inputs[rpf->entity.index].crop;
  274. memset(&format, 0, sizeof(format));
  275. format.which = V4L2_SUBDEV_FORMAT_ACTIVE;
  276. format.pad = RWPF_PAD_SINK;
  277. format.format.width = crop->width + crop->left;
  278. format.format.height = crop->height + crop->top;
  279. format.format.code = rpf->fmtinfo->mbus;
  280. format.format.field = V4L2_FIELD_NONE;
  281. ret = v4l2_subdev_call(&rpf->entity.subdev, pad, set_fmt, NULL,
  282. &format);
  283. if (ret < 0)
  284. return ret;
  285. dev_dbg(vsp1->dev,
  286. "%s: set format %ux%u (%x) on RPF%u sink\n",
  287. __func__, format.format.width, format.format.height,
  288. format.format.code, rpf->entity.index);
  289. memset(&sel, 0, sizeof(sel));
  290. sel.which = V4L2_SUBDEV_FORMAT_ACTIVE;
  291. sel.pad = RWPF_PAD_SINK;
  292. sel.target = V4L2_SEL_TGT_CROP;
  293. sel.r = *crop;
  294. ret = v4l2_subdev_call(&rpf->entity.subdev, pad, set_selection, NULL,
  295. &sel);
  296. if (ret < 0)
  297. return ret;
  298. dev_dbg(vsp1->dev,
  299. "%s: set selection (%u,%u)/%ux%u on RPF%u sink\n",
  300. __func__, sel.r.left, sel.r.top, sel.r.width, sel.r.height,
  301. rpf->entity.index);
  302. /* RPF source, hardcode the format to ARGB8888 to turn on format
  303. * conversion if needed.
  304. */
  305. format.pad = RWPF_PAD_SOURCE;
  306. ret = v4l2_subdev_call(&rpf->entity.subdev, pad, get_fmt, NULL,
  307. &format);
  308. if (ret < 0)
  309. return ret;
  310. dev_dbg(vsp1->dev,
  311. "%s: got format %ux%u (%x) on RPF%u source\n",
  312. __func__, format.format.width, format.format.height,
  313. format.format.code, rpf->entity.index);
  314. format.format.code = MEDIA_BUS_FMT_ARGB8888_1X32;
  315. ret = v4l2_subdev_call(&rpf->entity.subdev, pad, set_fmt, NULL,
  316. &format);
  317. if (ret < 0)
  318. return ret;
  319. /* BRU sink, propagate the format from the RPF source. */
  320. format.pad = bru_input;
  321. ret = v4l2_subdev_call(&vsp1->bru->entity.subdev, pad, set_fmt, NULL,
  322. &format);
  323. if (ret < 0)
  324. return ret;
  325. dev_dbg(vsp1->dev, "%s: set format %ux%u (%x) on BRU pad %u\n",
  326. __func__, format.format.width, format.format.height,
  327. format.format.code, format.pad);
  328. sel.pad = bru_input;
  329. sel.target = V4L2_SEL_TGT_COMPOSE;
  330. sel.r = vsp1->drm->inputs[rpf->entity.index].compose;
  331. ret = v4l2_subdev_call(&vsp1->bru->entity.subdev, pad, set_selection,
  332. NULL, &sel);
  333. if (ret < 0)
  334. return ret;
  335. dev_dbg(vsp1->dev,
  336. "%s: set selection (%u,%u)/%ux%u on BRU pad %u\n",
  337. __func__, sel.r.left, sel.r.top, sel.r.width, sel.r.height,
  338. sel.pad);
  339. return 0;
  340. }
  341. static unsigned int rpf_zpos(struct vsp1_device *vsp1, struct vsp1_rwpf *rpf)
  342. {
  343. return vsp1->drm->inputs[rpf->entity.index].zpos;
  344. }
  345. /**
  346. * vsp1_du_atomic_flush - Commit an atomic update
  347. * @dev: the VSP device
  348. */
  349. void vsp1_du_atomic_flush(struct device *dev)
  350. {
  351. struct vsp1_device *vsp1 = dev_get_drvdata(dev);
  352. struct vsp1_pipeline *pipe = &vsp1->drm->pipe;
  353. struct vsp1_rwpf *inputs[VSP1_MAX_RPF] = { NULL, };
  354. struct vsp1_entity *entity;
  355. unsigned long flags;
  356. unsigned int i;
  357. int ret;
  358. /* Count the number of enabled inputs and sort them by Z-order. */
  359. pipe->num_inputs = 0;
  360. for (i = 0; i < vsp1->info->rpf_count; ++i) {
  361. struct vsp1_rwpf *rpf = vsp1->rpf[i];
  362. unsigned int j;
  363. if (!vsp1->drm->inputs[i].enabled) {
  364. pipe->inputs[i] = NULL;
  365. continue;
  366. }
  367. pipe->inputs[i] = rpf;
  368. /* Insert the RPF in the sorted RPFs array. */
  369. for (j = pipe->num_inputs++; j > 0; --j) {
  370. if (rpf_zpos(vsp1, inputs[j-1]) <= rpf_zpos(vsp1, rpf))
  371. break;
  372. inputs[j] = inputs[j-1];
  373. }
  374. inputs[j] = rpf;
  375. }
  376. /* Setup the RPF input pipeline for every enabled input. */
  377. for (i = 0; i < vsp1->info->num_bru_inputs; ++i) {
  378. struct vsp1_rwpf *rpf = inputs[i];
  379. if (!rpf) {
  380. vsp1->bru->inputs[i].rpf = NULL;
  381. continue;
  382. }
  383. vsp1->bru->inputs[i].rpf = rpf;
  384. rpf->bru_input = i;
  385. rpf->entity.sink_pad = i;
  386. dev_dbg(vsp1->dev, "%s: connecting RPF.%u to BRU:%u\n",
  387. __func__, rpf->entity.index, i);
  388. ret = vsp1_du_setup_rpf_pipe(vsp1, rpf, i);
  389. if (ret < 0)
  390. dev_err(vsp1->dev,
  391. "%s: failed to setup RPF.%u\n",
  392. __func__, rpf->entity.index);
  393. }
  394. /* Configure all entities in the pipeline. */
  395. list_for_each_entry(entity, &pipe->entities, list_pipe) {
  396. /* Disconnect unused RPFs from the pipeline. */
  397. if (entity->type == VSP1_ENTITY_RPF) {
  398. struct vsp1_rwpf *rpf = to_rwpf(&entity->subdev);
  399. if (!pipe->inputs[rpf->entity.index]) {
  400. vsp1_dl_list_write(pipe->dl, entity->route->reg,
  401. VI6_DPR_NODE_UNUSED);
  402. continue;
  403. }
  404. }
  405. vsp1_entity_route_setup(entity, pipe->dl);
  406. if (entity->ops->configure) {
  407. entity->ops->configure(entity, pipe, pipe->dl,
  408. VSP1_ENTITY_PARAMS_INIT);
  409. entity->ops->configure(entity, pipe, pipe->dl,
  410. VSP1_ENTITY_PARAMS_RUNTIME);
  411. entity->ops->configure(entity, pipe, pipe->dl,
  412. VSP1_ENTITY_PARAMS_PARTITION);
  413. }
  414. }
  415. vsp1_dl_list_commit(pipe->dl);
  416. pipe->dl = NULL;
  417. /* Start or stop the pipeline if needed. */
  418. if (!vsp1->drm->num_inputs && pipe->num_inputs) {
  419. vsp1_write(vsp1, VI6_DISP_IRQ_STA, 0);
  420. vsp1_write(vsp1, VI6_DISP_IRQ_ENB, VI6_DISP_IRQ_ENB_DSTE);
  421. spin_lock_irqsave(&pipe->irqlock, flags);
  422. vsp1_pipeline_run(pipe);
  423. spin_unlock_irqrestore(&pipe->irqlock, flags);
  424. } else if (vsp1->drm->num_inputs && !pipe->num_inputs) {
  425. vsp1_write(vsp1, VI6_DISP_IRQ_ENB, 0);
  426. vsp1_pipeline_stop(pipe);
  427. }
  428. }
  429. EXPORT_SYMBOL_GPL(vsp1_du_atomic_flush);
  430. /* -----------------------------------------------------------------------------
  431. * Initialization
  432. */
  433. int vsp1_drm_create_links(struct vsp1_device *vsp1)
  434. {
  435. const u32 flags = MEDIA_LNK_FL_ENABLED | MEDIA_LNK_FL_IMMUTABLE;
  436. unsigned int i;
  437. int ret;
  438. /* VSPD instances require a BRU to perform composition and a LIF to
  439. * output to the DU.
  440. */
  441. if (!vsp1->bru || !vsp1->lif)
  442. return -ENXIO;
  443. for (i = 0; i < vsp1->info->rpf_count; ++i) {
  444. struct vsp1_rwpf *rpf = vsp1->rpf[i];
  445. ret = media_create_pad_link(&rpf->entity.subdev.entity,
  446. RWPF_PAD_SOURCE,
  447. &vsp1->bru->entity.subdev.entity,
  448. i, flags);
  449. if (ret < 0)
  450. return ret;
  451. rpf->entity.sink = &vsp1->bru->entity.subdev.entity;
  452. rpf->entity.sink_pad = i;
  453. }
  454. ret = media_create_pad_link(&vsp1->bru->entity.subdev.entity,
  455. vsp1->bru->entity.source_pad,
  456. &vsp1->wpf[0]->entity.subdev.entity,
  457. RWPF_PAD_SINK, flags);
  458. if (ret < 0)
  459. return ret;
  460. vsp1->bru->entity.sink = &vsp1->wpf[0]->entity.subdev.entity;
  461. vsp1->bru->entity.sink_pad = RWPF_PAD_SINK;
  462. ret = media_create_pad_link(&vsp1->wpf[0]->entity.subdev.entity,
  463. RWPF_PAD_SOURCE,
  464. &vsp1->lif->entity.subdev.entity,
  465. LIF_PAD_SINK, flags);
  466. if (ret < 0)
  467. return ret;
  468. return 0;
  469. }
  470. int vsp1_drm_init(struct vsp1_device *vsp1)
  471. {
  472. struct vsp1_pipeline *pipe;
  473. unsigned int i;
  474. vsp1->drm = devm_kzalloc(vsp1->dev, sizeof(*vsp1->drm), GFP_KERNEL);
  475. if (!vsp1->drm)
  476. return -ENOMEM;
  477. pipe = &vsp1->drm->pipe;
  478. vsp1_pipeline_init(pipe);
  479. /* The DRM pipeline is static, add entities manually. */
  480. for (i = 0; i < vsp1->info->rpf_count; ++i) {
  481. struct vsp1_rwpf *input = vsp1->rpf[i];
  482. list_add_tail(&input->entity.list_pipe, &pipe->entities);
  483. }
  484. list_add_tail(&vsp1->bru->entity.list_pipe, &pipe->entities);
  485. list_add_tail(&vsp1->wpf[0]->entity.list_pipe, &pipe->entities);
  486. list_add_tail(&vsp1->lif->entity.list_pipe, &pipe->entities);
  487. pipe->bru = &vsp1->bru->entity;
  488. pipe->lif = &vsp1->lif->entity;
  489. pipe->output = vsp1->wpf[0];
  490. pipe->output->pipe = pipe;
  491. return 0;
  492. }
  493. void vsp1_drm_cleanup(struct vsp1_device *vsp1)
  494. {
  495. }