Commit 0f5abd79 authored by Alexandru Gheorghe's avatar Alexandru Gheorghe
Browse files

drm_hwcomposer: Rename DrmResources to DrmDevice

DrmDevice is a better name to reflect the fact that DrmResources/
DrmDevice can handle just one dri node.

Suggested here [1] by Sean Paul.
[1] https://lists.freedesktop.org/archives/dri-devel/2018-April/173290.html



Signed-off-by: default avatarAlexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com>
parent 81a295cc
......@@ -56,7 +56,7 @@ LOCAL_C_INCLUDES := \
LOCAL_SRC_FILES := \
autolock.cpp \
drmresources.cpp \
drmdevice.cpp \
drmconnector.cpp \
drmcrtc.cpp \
drmdisplaycomposition.cpp \
......
......@@ -17,7 +17,7 @@
#define LOG_TAG "hwc-drm-connector"
#include "drmconnector.h"
#include "drmresources.h"
#include "drmdevice.h"
#include <errno.h>
#include <stdint.h>
......@@ -27,7 +27,7 @@
namespace android {
DrmConnector::DrmConnector(DrmResources *drm, drmModeConnectorPtr c,
DrmConnector::DrmConnector(DrmDevice *drm, drmModeConnectorPtr c,
DrmEncoder *current_encoder,
std::vector<DrmEncoder *> &possible_encoders)
: drm_(drm),
......
......@@ -27,11 +27,11 @@
namespace android {
class DrmResources;
class DrmDevice;
class DrmConnector {
public:
DrmConnector(DrmResources *drm, drmModeConnectorPtr c,
DrmConnector(DrmDevice *drm, drmModeConnectorPtr c,
DrmEncoder *current_encoder,
std::vector<DrmEncoder *> &possible_encoders);
DrmConnector(const DrmProperty &) = delete;
......@@ -71,7 +71,7 @@ class DrmConnector {
uint32_t mm_height() const;
private:
DrmResources *drm_;
DrmDevice *drm_;
uint32_t id_;
DrmEncoder *encoder_;
......
......@@ -17,7 +17,7 @@
#define LOG_TAG "hwc-drm-crtc"
#include "drmcrtc.h"
#include "drmresources.h"
#include "drmdevice.h"
#include <stdint.h>
#include <xf86drmMode.h>
......@@ -26,12 +26,8 @@
namespace android {
DrmCrtc::DrmCrtc(DrmResources *drm, drmModeCrtcPtr c, unsigned pipe)
: drm_(drm),
id_(c->crtc_id),
pipe_(pipe),
display_(-1),
mode_(&c->mode) {
DrmCrtc::DrmCrtc(DrmDevice *drm, drmModeCrtcPtr c, unsigned pipe)
: drm_(drm), id_(c->crtc_id), pipe_(pipe), display_(-1), mode_(&c->mode) {
}
int DrmCrtc::Init() {
......
......@@ -25,11 +25,11 @@
namespace android {
class DrmResources;
class DrmDevice;
class DrmCrtc {
public:
DrmCrtc(DrmResources *drm, drmModeCrtcPtr c, unsigned pipe);
DrmCrtc(DrmDevice *drm, drmModeCrtcPtr c, unsigned pipe);
DrmCrtc(const DrmCrtc &) = delete;
DrmCrtc &operator=(const DrmCrtc &) = delete;
......@@ -48,7 +48,7 @@ class DrmCrtc {
const DrmProperty &out_fence_ptr_property() const;
private:
DrmResources *drm_;
DrmDevice *drm_;
uint32_t id_;
unsigned pipe_;
......
......@@ -14,14 +14,14 @@
* limitations under the License.
*/
#define LOG_TAG "hwc-drm-resources"
#define LOG_TAG "hwc-drm-device"
#include "drmconnector.h"
#include "drmcrtc.h"
#include "drmencoder.h"
#include "drmeventlistener.h"
#include "drmplane.h"
#include "drmresources.h"
#include "drmdevice.h"
#include <cinttypes>
#include <errno.h>
......@@ -35,14 +35,14 @@
namespace android {
DrmResources::DrmResources() : event_listener_(this) {
DrmDevice::DrmDevice() : event_listener_(this) {
}
DrmResources::~DrmResources() {
DrmDevice::~DrmDevice() {
event_listener_.Exit();
}
int DrmResources::Init() {
int DrmDevice::Init() {
char path[PROPERTY_VALUE_MAX];
property_get("hwc.drm.device", path, "/dev/dri/card0");
......@@ -67,7 +67,7 @@ int DrmResources::Init() {
drmModeResPtr res = drmModeGetResources(fd());
if (!res) {
ALOGE("Failed to get DrmResources resources");
ALOGE("Failed to get DrmDevice resources");
return -ENODEV;
}
......@@ -229,7 +229,7 @@ int DrmResources::Init() {
return 0;
}
DrmConnector *DrmResources::GetConnectorForDisplay(int display) const {
DrmConnector *DrmDevice::GetConnectorForDisplay(int display) const {
for (auto &conn : connectors_) {
if (conn->display() == display)
return conn.get();
......@@ -237,7 +237,7 @@ DrmConnector *DrmResources::GetConnectorForDisplay(int display) const {
return NULL;
}
DrmCrtc *DrmResources::GetCrtcForDisplay(int display) const {
DrmCrtc *DrmDevice::GetCrtcForDisplay(int display) const {
for (auto &crtc : crtcs_) {
if (crtc->display() == display)
return crtc.get();
......@@ -245,7 +245,7 @@ DrmCrtc *DrmResources::GetCrtcForDisplay(int display) const {
return NULL;
}
DrmPlane *DrmResources::GetPlane(uint32_t id) const {
DrmPlane *DrmDevice::GetPlane(uint32_t id) const {
for (auto &plane : planes_) {
if (plane->id() == id)
return plane.get();
......@@ -253,15 +253,15 @@ DrmPlane *DrmResources::GetPlane(uint32_t id) const {
return NULL;
}
const std::vector<std::unique_ptr<DrmCrtc>> & DrmResources::crtcs() const {
const std::vector<std::unique_ptr<DrmCrtc>> &DrmDevice::crtcs() const {
return crtcs_;
}
uint32_t DrmResources::next_mode_id() {
uint32_t DrmDevice::next_mode_id() {
return ++mode_id_;
}
int DrmResources::TryEncoderForDisplay(int display, DrmEncoder *enc) {
int DrmDevice::TryEncoderForDisplay(int display, DrmEncoder *enc) {
/* First try to use the currently-bound crtc */
DrmCrtc *crtc = enc->crtc();
if (crtc && crtc->can_bind(display)) {
......@@ -286,7 +286,7 @@ int DrmResources::TryEncoderForDisplay(int display, DrmEncoder *enc) {
return -EAGAIN;
}
int DrmResources::CreateDisplayPipe(DrmConnector *connector) {
int DrmDevice::CreateDisplayPipe(DrmConnector *connector) {
int display = connector->display();
/* Try to use current setup first */
if (connector->encoder()) {
......@@ -314,8 +314,8 @@ int DrmResources::CreateDisplayPipe(DrmConnector *connector) {
return -ENODEV;
}
int DrmResources::CreatePropertyBlob(void *data, size_t length,
uint32_t *blob_id) {
int DrmDevice::CreatePropertyBlob(void *data, size_t length,
uint32_t *blob_id) {
struct drm_mode_create_blob create_blob;
memset(&create_blob, 0, sizeof(create_blob));
create_blob.length = length;
......@@ -330,7 +330,7 @@ int DrmResources::CreatePropertyBlob(void *data, size_t length,
return 0;
}
int DrmResources::DestroyPropertyBlob(uint32_t blob_id) {
int DrmDevice::DestroyPropertyBlob(uint32_t blob_id) {
if (!blob_id)
return 0;
......@@ -345,12 +345,12 @@ int DrmResources::DestroyPropertyBlob(uint32_t blob_id) {
return 0;
}
DrmEventListener *DrmResources::event_listener() {
DrmEventListener *DrmDevice::event_listener() {
return &event_listener_;
}
int DrmResources::GetProperty(uint32_t obj_id, uint32_t obj_type,
const char *prop_name, DrmProperty *property) {
int DrmDevice::GetProperty(uint32_t obj_id, uint32_t obj_type,
const char *prop_name, DrmProperty *property) {
drmModeObjectPropertiesPtr props;
props = drmModeObjectGetProperties(fd(), obj_id, obj_type);
......@@ -373,19 +373,19 @@ int DrmResources::GetProperty(uint32_t obj_id, uint32_t obj_type,
return found ? 0 : -ENOENT;
}
int DrmResources::GetPlaneProperty(const DrmPlane &plane, const char *prop_name,
DrmProperty *property) {
int DrmDevice::GetPlaneProperty(const DrmPlane &plane, const char *prop_name,
DrmProperty *property) {
return GetProperty(plane.id(), DRM_MODE_OBJECT_PLANE, prop_name, property);
}
int DrmResources::GetCrtcProperty(const DrmCrtc &crtc, const char *prop_name,
DrmProperty *property) {
int DrmDevice::GetCrtcProperty(const DrmCrtc &crtc, const char *prop_name,
DrmProperty *property) {
return GetProperty(crtc.id(), DRM_MODE_OBJECT_CRTC, prop_name, property);
}
int DrmResources::GetConnectorProperty(const DrmConnector &connector,
const char *prop_name,
DrmProperty *property) {
int DrmDevice::GetConnectorProperty(const DrmConnector &connector,
const char *prop_name,
DrmProperty *property) {
return GetProperty(connector.id(), DRM_MODE_OBJECT_CONNECTOR, prop_name,
property);
}
......
......@@ -27,10 +27,10 @@
namespace android {
class DrmResources {
class DrmDevice {
public:
DrmResources();
~DrmResources();
DrmDevice();
~DrmDevice();
int Init();
......
......@@ -16,11 +16,11 @@
#define LOG_TAG "hwc-drm-display-composition"
#include "drmdevice.h"
#include "drmdisplaycomposition.h"
#include "drmdisplaycompositor.h"
#include "drmcrtc.h"
#include "drmplane.h"
#include "drmresources.h"
#include "platform.h"
#include <stdlib.h>
......@@ -37,7 +37,7 @@ namespace android {
DrmDisplayComposition::~DrmDisplayComposition() {
}
int DrmDisplayComposition::Init(DrmResources *drm, DrmCrtc *crtc,
int DrmDisplayComposition::Init(DrmDevice *drm, DrmCrtc *crtc,
Importer *importer, Planner *planner,
uint64_t frame_no) {
drm_ = drm;
......
......@@ -111,8 +111,8 @@ class DrmDisplayComposition {
DrmDisplayComposition(const DrmDisplayComposition &) = delete;
~DrmDisplayComposition();
int Init(DrmResources *drm, DrmCrtc *crtc, Importer *importer,
Planner *planner, uint64_t frame_no);
int Init(DrmDevice *drm, DrmCrtc *crtc, Importer *importer, Planner *planner,
uint64_t frame_no);
int SetLayers(DrmHwcLayer *layers, size_t num_layers, bool geometry_changed);
int AddPlaneComposition(DrmCompositionPlane plane);
......@@ -176,7 +176,7 @@ class DrmDisplayComposition {
private:
bool validate_composition_type(DrmCompositionType desired);
DrmResources *drm_ = NULL;
DrmDevice *drm_ = NULL;
DrmCrtc *crtc_ = NULL;
Importer *importer_ = NULL;
Planner *planner_ = NULL;
......
......@@ -33,8 +33,8 @@
#include "autolock.h"
#include "drmcrtc.h"
#include "drmdevice.h"
#include "drmplane.h"
#include "drmresources.h"
namespace android {
......@@ -74,7 +74,7 @@ DrmDisplayCompositor::~DrmDisplayCompositor() {
pthread_mutex_destroy(&lock_);
}
int DrmDisplayCompositor::Init(DrmResources *drm, int display) {
int DrmDisplayCompositor::Init(DrmDevice *drm, int display) {
drm_ = drm;
display_ = display;
......
......@@ -40,7 +40,7 @@ class DrmDisplayCompositor {
DrmDisplayCompositor();
~DrmDisplayCompositor();
int Init(DrmResources *drm, int display);
int Init(DrmDevice *drm, int display);
std::unique_ptr<DrmDisplayComposition> CreateComposition() const;
int ApplyComposition(std::unique_ptr<DrmDisplayComposition> composition);
......@@ -78,7 +78,7 @@ class DrmDisplayCompositor {
std::tuple<int, uint32_t> CreateModeBlob(const DrmMode &mode);
DrmResources *drm_;
DrmDevice *drm_;
int display_;
std::unique_ptr<DrmDisplayComposition> active_composition_;
......
......@@ -15,8 +15,8 @@
*/
#include "drmcrtc.h"
#include "drmdevice.h"
#include "drmencoder.h"
#include "drmresources.h"
#include <stdint.h>
#include <xf86drmMode.h>
......
......@@ -16,8 +16,8 @@
#define LOG_TAG "hwc-drm-event-listener"
#include "drmdevice.h"
#include "drmeventlistener.h"
#include "drmresources.h"
#include <assert.h>
#include <errno.h>
......@@ -31,9 +31,8 @@
namespace android {
DrmEventListener::DrmEventListener(DrmResources *drm)
: Worker("drm-event-listener", HAL_PRIORITY_URGENT_DISPLAY),
drm_(drm) {
DrmEventListener::DrmEventListener(DrmDevice *drm)
: Worker("drm-event-listener", HAL_PRIORITY_URGENT_DISPLAY), drm_(drm) {
}
int DrmEventListener::Init() {
......
......@@ -22,7 +22,7 @@
namespace android {
class DrmResources;
class DrmDevice;
class DrmEventHandler {
public:
......@@ -36,7 +36,7 @@ class DrmEventHandler {
class DrmEventListener : public Worker {
public:
DrmEventListener(DrmResources *drm);
DrmEventListener(DrmDevice *drm);
virtual ~DrmEventListener() {
}
......@@ -57,7 +57,7 @@ class DrmEventListener : public Worker {
UniqueFd uevent_fd_;
int max_fd_ = -1;
DrmResources *drm_;
DrmDevice *drm_;
DrmEventHandler *hotplug_handler_ = NULL;
};
}
......
......@@ -150,7 +150,7 @@ HWC2::Error DrmHwcTwo::RegisterCallback(int32_t descriptor,
return HWC2::Error::None;
}
DrmHwcTwo::HwcDisplay::HwcDisplay(DrmResources *drm,
DrmHwcTwo::HwcDisplay::HwcDisplay(DrmDevice *drm,
std::shared_ptr<Importer> importer,
hwc2_display_t handle, HWC2::DisplayType type)
: drm_(drm), importer_(importer), handle_(handle), type_(type) {
......
......@@ -16,7 +16,7 @@
#include "drmdisplaycompositor.h"
#include "drmhwcomposer.h"
#include "drmresources.h"
#include "drmdevice.h"
#include "platform.h"
#include "vsyncworker.h"
......@@ -135,7 +135,7 @@ class DrmHwcTwo : public hwc2_device_t {
class HwcDisplay {
public:
HwcDisplay(DrmResources *drm, std::shared_ptr<Importer> importer,
HwcDisplay(DrmDevice *drm, std::shared_ptr<Importer> importer,
hwc2_display_t handle, HWC2::DisplayType type);
HwcDisplay(const HwcDisplay &) = delete;
HWC2::Error Init(std::vector<DrmPlane *> *planes);
......@@ -188,7 +188,7 @@ class DrmHwcTwo : public hwc2_device_t {
HWC2::Error CreateComposition(bool test);
void AddFenceToRetireFence(int fd);
DrmResources *drm_;
DrmDevice *drm_;
DrmDisplayCompositor compositor_;
std::shared_ptr<Importer> importer_;
std::unique_ptr<Planner> planner_;
......@@ -261,7 +261,7 @@ class DrmHwcTwo : public hwc2_device_t {
HWC2::Error RegisterCallback(int32_t descriptor, hwc2_callback_data_t data,
hwc2_function_pointer_t function);
DrmResources drm_;
DrmDevice drm_;
std::shared_ptr<Importer> importer_; // Shared with HwcDisplay
std::map<hwc2_display_t, HwcDisplay> displays_;
std::map<HWC2::Callback, HwcCallback> callbacks_;
......
......@@ -14,8 +14,8 @@
* limitations under the License.
*/
#include "drmdevice.h"
#include "drmmode.h"
#include "drmresources.h"
#include <stdint.h>
#include <string>
......
......@@ -16,8 +16,8 @@
#define LOG_TAG "hwc-drm-plane"
#include "drmdevice.h"
#include "drmplane.h"
#include "drmresources.h"
#include <cinttypes>
#include <errno.h>
......@@ -28,7 +28,7 @@
namespace android {
DrmPlane::DrmPlane(DrmResources *drm, drmModePlanePtr p)
DrmPlane::DrmPlane(DrmDevice *drm, drmModePlanePtr p)
: drm_(drm), id_(p->plane_id), possible_crtc_mask_(p->possible_crtcs) {
}
......
......@@ -26,11 +26,11 @@
namespace android {
class DrmResources;
class DrmDevice;
class DrmPlane {
public:
DrmPlane(DrmResources *drm, drmModePlanePtr p);
DrmPlane(DrmDevice *drm, drmModePlanePtr p);
DrmPlane(const DrmPlane &) = delete;
DrmPlane &operator=(const DrmPlane &) = delete;
......@@ -57,7 +57,7 @@ class DrmPlane {
const DrmProperty &in_fence_fd_property() const;
private:
DrmResources *drm_;
DrmDevice *drm_;
uint32_t id_;
uint32_t possible_crtc_mask_;
......
......@@ -14,8 +14,8 @@
* limitations under the License.
*/
#include "drmdevice.h"
#include "drmproperty.h"
#include "drmresources.h"
#include <errno.h>
#include <stdint.h>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment