mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-10-31 22:25:21 -04:00
backend/drm: parse TILE property
This commit is contained in:
parent
cbf921ccbb
commit
2a697512d7
6 changed files with 54 additions and 0 deletions
|
|
@ -15,6 +15,7 @@
|
||||||
#include <wlr/interfaces/wlr_output.h>
|
#include <wlr/interfaces/wlr_output.h>
|
||||||
#include <wlr/render/drm_syncobj.h>
|
#include <wlr/render/drm_syncobj.h>
|
||||||
#include <wlr/render/wlr_renderer.h>
|
#include <wlr/render/wlr_renderer.h>
|
||||||
|
#include <wlr/types/wlr_output_group.h>
|
||||||
#include <wlr/util/box.h>
|
#include <wlr/util/box.h>
|
||||||
#include <wlr/util/log.h>
|
#include <wlr/util/log.h>
|
||||||
#include <wlr/util/transform.h>
|
#include <wlr/util/transform.h>
|
||||||
|
|
@ -1720,6 +1721,12 @@ static bool connect_drm_connector(struct wlr_drm_connector *wlr_conn,
|
||||||
parse_edid(wlr_conn, edid_len, edid);
|
parse_edid(wlr_conn, edid_len, edid);
|
||||||
free(edid);
|
free(edid);
|
||||||
|
|
||||||
|
size_t tile_len = 0;
|
||||||
|
uint8_t *tile = get_drm_prop_blob(drm->fd,
|
||||||
|
wlr_conn->id, wlr_conn->props.tile, &tile_len);
|
||||||
|
parse_tile(wlr_conn, tile_len, tile);
|
||||||
|
free(tile);
|
||||||
|
|
||||||
char *subconnector = NULL;
|
char *subconnector = NULL;
|
||||||
if (wlr_conn->props.subconnector) {
|
if (wlr_conn->props.subconnector) {
|
||||||
subconnector = get_drm_prop_enum(drm->fd,
|
subconnector = get_drm_prop_enum(drm->fd,
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ static const struct prop_info connector_info[] = {
|
||||||
{ "EDID", INDEX(edid) },
|
{ "EDID", INDEX(edid) },
|
||||||
{ "HDR_OUTPUT_METADATA", INDEX(hdr_output_metadata) },
|
{ "HDR_OUTPUT_METADATA", INDEX(hdr_output_metadata) },
|
||||||
{ "PATH", INDEX(path) },
|
{ "PATH", INDEX(path) },
|
||||||
|
{ "TILE", INDEX(tile) },
|
||||||
{ "content type", INDEX(content_type) },
|
{ "content type", INDEX(content_type) },
|
||||||
{ "link-status", INDEX(link_status) },
|
{ "link-status", INDEX(link_status) },
|
||||||
{ "max bpc", INDEX(max_bpc) },
|
{ "max bpc", INDEX(max_bpc) },
|
||||||
|
|
|
||||||
|
|
@ -97,6 +97,47 @@ void parse_edid(struct wlr_drm_connector *conn, size_t len, const uint8_t *data)
|
||||||
di_info_destroy(info);
|
di_info_destroy(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void parse_tile(struct wlr_drm_connector *conn, size_t len, const uint8_t *data) {
|
||||||
|
struct wlr_output_group_tile_info *tile_info = &conn->tile_info;
|
||||||
|
memset(tile_info, 0, sizeof(*tile_info));
|
||||||
|
if (len == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Reference:
|
||||||
|
// - include/linux/drm/drm_connector.h tile_blob_ptr
|
||||||
|
// - drivers/gpu/drm/drm_edid.c drm_parse_tiled_block()
|
||||||
|
//
|
||||||
|
// Note: group_id is always > 0
|
||||||
|
int ret = sscanf((char*)data, "%d:%d:%d:%d:%d:%d:%d:%d",
|
||||||
|
&tile_info->group_id,
|
||||||
|
&tile_info->is_single_monitor,
|
||||||
|
&tile_info->num_h,
|
||||||
|
&tile_info->num_v,
|
||||||
|
&tile_info->h_loc,
|
||||||
|
&tile_info->v_loc,
|
||||||
|
&tile_info->h_size,
|
||||||
|
&tile_info->v_size);
|
||||||
|
if(ret != 8) {
|
||||||
|
wlr_log(WLR_ERROR, "Unable to understand tile information for "
|
||||||
|
"connector %s", conn->name);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
wlr_log(WLR_INFO, "Connector '%s' TILE information: "
|
||||||
|
"group ID %d, single monitor %d, total %d horizontal tiles, "
|
||||||
|
"total %d vertical tiles, horizontal tile %d, vertical tile "
|
||||||
|
"%d, width %d, height %d",
|
||||||
|
conn->name,
|
||||||
|
tile_info->group_id,
|
||||||
|
tile_info->is_single_monitor,
|
||||||
|
tile_info->num_h,
|
||||||
|
tile_info->num_v,
|
||||||
|
tile_info->h_loc,
|
||||||
|
tile_info->v_loc,
|
||||||
|
tile_info->h_size,
|
||||||
|
tile_info->v_size);
|
||||||
|
}
|
||||||
|
|
||||||
const char *drm_connector_status_str(drmModeConnection status) {
|
const char *drm_connector_status_str(drmModeConnection status) {
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case DRM_MODE_CONNECTED:
|
case DRM_MODE_CONNECTED:
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@
|
||||||
#include <wlr/backend/session.h>
|
#include <wlr/backend/session.h>
|
||||||
#include <wlr/render/drm_format_set.h>
|
#include <wlr/render/drm_format_set.h>
|
||||||
#include <wlr/types/wlr_output_layer.h>
|
#include <wlr/types/wlr_output_layer.h>
|
||||||
|
#include <wlr/types/wlr_output_group.h>
|
||||||
#include <xf86drmMode.h>
|
#include <xf86drmMode.h>
|
||||||
#include "backend/drm/iface.h"
|
#include "backend/drm/iface.h"
|
||||||
#include "backend/drm/properties.h"
|
#include "backend/drm/properties.h"
|
||||||
|
|
@ -219,6 +220,8 @@ struct wlr_drm_connector {
|
||||||
uint32_t hdr_output_metadata;
|
uint32_t hdr_output_metadata;
|
||||||
|
|
||||||
int32_t refresh;
|
int32_t refresh;
|
||||||
|
|
||||||
|
struct wlr_output_group_tile_info tile_info;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct wlr_drm_backend *get_drm_backend_from_backend(
|
struct wlr_drm_backend *get_drm_backend_from_backend(
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ struct wlr_drm_connector_props {
|
||||||
uint32_t panel_orientation; // not guaranteed to exist
|
uint32_t panel_orientation; // not guaranteed to exist
|
||||||
uint32_t content_type; // not guaranteed to exist
|
uint32_t content_type; // not guaranteed to exist
|
||||||
uint32_t max_bpc; // not guaranteed to exist
|
uint32_t max_bpc; // not guaranteed to exist
|
||||||
|
uint32_t tile; // not guaranteed to exist
|
||||||
|
|
||||||
// atomic-modesetting only
|
// atomic-modesetting only
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ enum wlr_output_mode_aspect_ratio get_picture_aspect_ratio(const drmModeModeInfo
|
||||||
const char *get_pnp_manufacturer(const char code[static 3]);
|
const char *get_pnp_manufacturer(const char code[static 3]);
|
||||||
// Populates the make/model/phys_{width,height} of output from the edid data
|
// Populates the make/model/phys_{width,height} of output from the edid data
|
||||||
void parse_edid(struct wlr_drm_connector *conn, size_t len, const uint8_t *data);
|
void parse_edid(struct wlr_drm_connector *conn, size_t len, const uint8_t *data);
|
||||||
|
void parse_tile(struct wlr_drm_connector *conn, size_t len, const uint8_t *data);
|
||||||
const char *drm_connector_status_str(drmModeConnection status);
|
const char *drm_connector_status_str(drmModeConnection status);
|
||||||
void generate_cvt_mode(drmModeModeInfo *mode, int hdisplay, int vdisplay,
|
void generate_cvt_mode(drmModeModeInfo *mode, int hdisplay, int vdisplay,
|
||||||
float vrefresh);
|
float vrefresh);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue