Skip to content

Commit

Permalink
drm: Patch physical dimensions
Browse files Browse the repository at this point in the history
  • Loading branch information
misyltoad committed Sep 1, 2023
1 parent a8471d8 commit cf19852
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/drm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -574,14 +574,18 @@ static void create_patched_edid( const uint8_t *orig_data, size_t orig_size, drm

if ( g_bRotated )
{
// Patch width, height.
drm_log.infof("[patched edid] Patching dims %ux%u -> %ux%u", edid[0x15], edid[0x16], edid[0x16], edid[0x15]);
std::swap(edid[0x15], edid[0x16]);

for (uint32_t i = 0; i < EDID_BYTE_DESCRIPTOR_COUNT; i++)
{
uint8_t *byte_desc_data = &edid[0x36 + i * EDID_BYTE_DESCRIPTOR_SIZE];
if (byte_desc_data[0] || byte_desc_data[1])
{
uint32_t horiz = (get_bit_range(byte_desc_data[4], 7, 4) << 8) | byte_desc_data[2];
uint32_t vert = (get_bit_range(byte_desc_data[7], 7, 4) << 8) | byte_desc_data[5];
drm_log.infof("[patched edid] Patching %ux%u -> %ux%u", horiz, vert, vert, horiz);
drm_log.infof("[patched edid] Patching res %ux%u -> %ux%u", horiz, vert, vert, horiz);
std::swap(byte_desc_data[4], byte_desc_data[7]);
std::swap(byte_desc_data[2], byte_desc_data[5]);
break;
Expand Down

0 comments on commit cf19852

Please sign in to comment.