summaryrefslogtreecommitdiffstats
path: root/xbmc/windowing/gbm/drm/DRMCrtc.h
blob: a1aadc2fadbff1297c2cb07adbca93c5318e416e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
 *  Copyright (C) 2005-2020 Team Kodi
 *  This file is part of Kodi - https://kodi.tv
 *
 *  SPDX-License-Identifier: GPL-2.0-or-later
 *  See LICENSES/README.md for more information.
 */

#pragma once

#include "DRMObject.h"

namespace KODI
{
namespace WINDOWING
{
namespace GBM
{

class CDRMCrtc : public CDRMObject
{
public:
  explicit CDRMCrtc(int fd, uint32_t crtc);
  CDRMCrtc(const CDRMCrtc&) = delete;
  CDRMCrtc& operator=(const CDRMCrtc&) = delete;
  ~CDRMCrtc() = default;

  uint32_t GetCrtcId() const { return m_crtc->crtc_id; }
  uint32_t GetBufferId() const { return m_crtc->buffer_id; }
  uint32_t GetX() const { return m_crtc->x; }
  uint32_t GetY() const { return m_crtc->y; }
  drmModeModeInfoPtr GetMode() const { return &m_crtc->mode; }
  bool GetModeValid() const { return m_crtc->mode_valid != 0; }

private:
  struct DrmModeCrtcDeleter
  {
    void operator()(drmModeCrtc* p) { drmModeFreeCrtc(p); }
  };

  std::unique_ptr<drmModeCrtc, DrmModeCrtcDeleter> m_crtc;
};

} // namespace GBM
} // namespace WINDOWING
} // namespace KODI