drm: Enable reading 3D capabilities of 3D monitor
Subsystems (3)
PATCH 1/1 drm: Enable reading 3D capabilities of 3D monitor
This is first of the patches to enable reading the 3D capabilities of a connected monitor on HDMI. Similar functionality would also be implemented for other interface, eDP, DP
The idea is to read the 3D capabilities via EDID and provide this to a user space application that would want to switch the mode of the connected monitor to a specific 3D format. The implementation follows the HDMI 1.4a specification.
Quoted 1 line
From
95dc9536dc1a863a4a2d12836ead338835a4be59Mon Sep 17 00:00:00 2001
From: Sateesh Kavuri <[email protected]>
Date: Wed, 7 Dec 2011 14:49:20 +0530
Subject: [PATCH] This patch enables the reading of the 3D capabilities of the connected
HDMI monitor. Currently only the 3D format support fields are read. Later this could be extended. This information is expected to be sent to the user space which then sets the format on the monitor.
This patch also handles DIP register signaling to the HDMI connected 3D monitor the 3D format to be set
---
---
--- drivers/gpu/drm/drm_edid.c | 109 +++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 11 ++++ drivers/gpu/drm/i915/intel_hdmi.c | 119 +++++++++++++++++++++++++++++++++++++ include/drm/drm_crtc.h | 2 + include/drm/drm_edid.h | 20 ++++++ 5 files changed, 261 insertions(+), 0 deletions(-)
drivers/gpu/drm/drm_edid.c +109 -0
@@ -1321,6 +1321,8 @@ add_detailed_modes(struct drm_connector *connector, struct edid *edid,#define VENDOR_BLOCK 0x03#define SPEAKER_BLOCK 0x04#define EDID_BASIC_AUDIO (1 << 6) +#define MONITOR_VIDEO_PRESENT 0x01 +#define PANEL_SUPPORTS_3D 0x01/** * Search EDID for CEA extension block.
@@ -1610,6 +1612,113 @@ end: }EXPORT_SYMBOL (drm_detect_monitor_audio); +enum { +NO_SPL_CAPS =0x0 , +STRUCTURE_PRESENT =0x1 , +STRUCTURE_MASK_PRESENT =0x2 +} are_3d_caps_present; + +/** +* drm_detect_monitor_3D - check monitor 3D capabilities +* +* Monitor should have CEA extension block. +* Check if the monitor has 3D capabilities. If it does, store the capabilitie +* to a data structure +* +* FIXME: Currently returning bool (to denote 3D present or not), later should +* return the 3D capabilities (or can there be a separate function for that?) +*/ +bool drm_detect_3D_monitor (struct edid *edid) +{ +u8 *edid_ext; +int i, hdmi_id; +int start_offset, end_offset; +bool is_hdmi = false; +bool is_3d = false; +struct panel_3d_caps *caps =kmalloc (sizeof (struct panel_3d_caps ),GFP_KERNEL ); + + edid_ext =drm_find_cea_extension (edid); +if (!edid_ext) + goto end; + +/* Data block offset in CEA extension block */ + start_offset =4 ; + end_offset = edid_ext[2 ]; + +/* 3D vars */ +int multi_present =0 ; + +/* +* Because HDMI identifier is in Vendor Specific Block, +* search it from all data blocks of CEA extension. +*/ +for (i = start_offset; i < end_offset; +/* Increased by data block len */ + i += ((edid_ext[i] &0x1f ) +1 )) { +/* Find vendor specific block */ +/* 6'th bit is the VIDEO_PRESENT bit */ +if ( ((edid_ext[i] >>5 ) ==VENDOR_BLOCK ) && + ((edid_ext[i+8 ] &0x20 ) ==MONITOR_VIDEO_PRESENT ) ) { + hdmi_id = edid_ext[i +1 ] | (edid_ext[i +2 ] <<8 ) | + edid_ext[i +3 ] <<16 ; +/* Find HDMI identifier */ +if (hdmi_id ==HDMI_IDENTIFIER ) + is_hdmi = true; + +/* Check for the 3D_Present flag */ +if ((edid_ext[i+13 ] >>6 ) ==PANEL_SUPPORTS_3D ) { + caps->panel_supports_3d =1 ; + is_3d = true; + } + +/* Check if 3D_Multi_present is set */ +if ((edid_ext[i+13 ] &0x60 ) ==0x0 ) { + multi_present = true; + } + +/* Collect 3D capabilities of the monitor */ +int hdmi_3d_len =0 ; +int hdmi_vic_len =0 ; + hdmi_vic_len = (edid_ext[i+14 ] >>0x05 ); + hdmi_3d_len = ((edid_ext[i+14 ] <<0x03 ) >>0x03 ); +int multi_val = edid_ext[i+13 ] &0x6 ; +if (multi_val ==0x0 ) + multi_present =NO_SPL_CAPS ; +else if (multi_val ==0x1 ) + multi_present =STRUCTURE_PRESENT ; +else if (multi_val ==0x2 ) + multi_val =STRUCTURE_MASK_PRESENT ; + +if ((multi_val ==STRUCTURE_PRESENT ) || + (multi_val ==STRUCTURE_MASK_PRESENT ) ) { +if ((edid_ext[i+15 +hdmi_vic_len] &0x01 ) ==0x01 ) + caps->format |=0x0 ;/* FRAME_PACKING */ +if ((edid_ext[i+15 +hdmi_vic_len] &0x02 ) ==0x02 ) + caps->format |=0x1 ;/*FIELD_ALTERNATIVE */ +if ((edid_ext[i+15 +hdmi_vic_len] &0x04 ) ==0x04 ) + caps->format |=0x2 ;/* LINE_ALTERNATIVE */ +if ((edid_ext[i+15 +hdmi_vic_len] &0x08 ) ==0x08 ) + caps->format |=0x3 ;/*SIDE_BY_SIDE_FULL */ +if ((edid_ext[i+15 +hdmi_vic_len] &0x10 ) ==0x10 ) + caps->format |=0x4 ;/* L_DEPTH */ +if ((edid_ext[i+15 +hdmi_vic_len] &0x20 ) ==0x20 ) + caps->format |=0x5 ;/* L_DEPTH_GFX_GFX_DEPTH */ +if ((edid_ext[i+15 +hdmi_vic_len] &0x40 ) ==0x40 ) + caps->format |=0x6 ;/* TOP_BOTTOM */ +if ((edid_ext[i+14 +hdmi_vic_len] &0x01 ) ==0x01 ) + caps->format |=0x7 ;/* S_BY_S_HALF */ +if ((edid_ext[i+14 +hdmi_vic_len] &0x80 ) ==0x80 ) + caps->format |=0x8 ;/* S_BY_S_HALF_QUINCUNX */ + } +break ; + } + } + +end: +return is_3d; +} +EXPORT_SYMBOL (drm_detect_3D_monitor); +/** * drm_add_display_info - pull display info out if present * @edid: EDID data
drivers/gpu/drm/i915/intel_drv.h +11 -0
@@ -183,6 +183,11 @@ struct intel_crtc {#define DIP_HEADER_SIZE 5 +/* Vendor info frame = 0x81 */ +#define DIP_TYPE_VSIF 0x81 +#define DIP_VERSION_VSIF 0x01 +#define DIP_LEN_VSIF 06 +#define DIP_TYPE_AVI 0x82#define DIP_VERSION_AVI 0x2#define DIP_LEN_AVI 13
@@ -232,6 +237,12 @@ struct dip_infoframe {uint8_t pd[16 ];uint8_t sdi; } spd; +struct { +uint8_t ieee[3 ]; +uint8_t hdmi_video_format;/* last 3 bits are used */ +uint8_t s3d_struct;/* last 4 bits are used */ +uint8_t s3d_struct_ext;/* last 4 bits are used */ + } hdmi_vendor_info;uint8_t payload[27 ]; } __attribute__ ((packed)) body; } __attribute__((packed));
drivers/gpu/drm/i915/intel_hdmi.c +119 -0
149 lines not on this page · raw message
include/drm/drm_crtc.h +2 -0
@@ -798,6 +798,8 @@ extern int drm_mode_gamma_set_ioctl(struct drm_device *dev,extern u8 *drm_find_cea_extension (struct edid *edid);extern bool drm_detect_hdmi_monitor (struct edid *edid);extern bool drm_detect_monitor_audio (struct edid *edid); +extern bool drm_detect_3D_monitor (struct edid *edid); +//extern struct panel_3d_caps* drm_detect_3D_monitor(struct edid *edid); extern int drm_mode_page_flip_ioctl (struct drm_device *dev,void *data,struct drm_file *file_priv); extern struct drm_display_mode *drm_cvt_mode(struct drm_device *dev,
include/drm/drm_edid.h +20 -0
@@ -230,6 +230,26 @@ struct edid {#define EDID_PRODUCT_ID (e) ((e)->prod_code[0] | ((e)->prod_code[1] << 8)) +enum s3d_formats { +FRAME_PACKING =0x0 , +FIELD_ALTERNATIVE =0x1 , +LINE_ALTERNATIVE =0x2 , +SIDE_BY_SIDE_FULL =0x3 , +L_DEPTH =0x4 , +L_DEPTH_GFX_GFX_DEPTH =0x5 , +TOP_BOTTOM =0x6 ,/* 0x7 is reserved for future */ +SIDE_BY_SIDE_HALF =0x8 /* 0x9 onwards is reserved for future */ +}; + +enum s3d_formats_ext { +HORIZONTAL_SUB_SAMPLING =0x10 +}; + +struct panel_3d_caps { +u16 panel_supports_3d; +u16 format; +}; +struct drm_encoder ;struct drm_connector ;struct drm_display_mode ;
Signature · 1 line
1.7.4.1
Quoted 11 lines · Sateesh
drivers/gpu/drm/drm_edid.c +11
-0+if ((multi_val ==STRUCTURE_PRESENT ) || + (multi_val ==STRUCTURE_MASK_PRESENT ) ) { +if ((edid_ext[i+15 +hdmi_vic_len] &0x01 ) ==0x01 ) + caps->format |=0x0 ;/* FRAME_PACKING */ +if ((edid_ext[i+15 +hdmi_vic_len] &0x02 ) ==0x02 ) + caps->format |=0x1 ;/*FIELD_ALTERNATIVE */ +if ((edid_ext[i+15 +hdmi_vic_len] &0x04 ) ==0x04 ) + caps->format |=0x2 ;/* LINE_ALTERNATIVE */ +if ((edid_ext[i+15 +hdmi_vic_len] &0x08 ) ==0x08 ) + caps->format |=0x3 ;/*SIDE_BY_SIDE_FULL */ +if ((edid_ext[i+15 +hdmi_vic_len] &0x10 ) ==0x10 )
drivers/gpu/drm/drm_edid.c end: · line 1712
Quoted 10 lines
drivers/gpu/drm/drm_edid.c +10
-0+ caps->format |=0x4 ;/* L_DEPTH */ +if ((edid_ext[i+15 +hdmi_vic_len] &0x20 ) ==0x20 ) + caps->format |=0x5 ;/* L_DEPTH_GFX_GFX_DEPTH */ +if ((edid_ext[i+15 +hdmi_vic_len] &0x40 ) ==0x40 ) + caps->format |=0x6 ;/* TOP_BOTTOM */ +if ((edid_ext[i+14 +hdmi_vic_len] &0x01 ) ==0x01 ) + caps->format |=0x7 ;/* S_BY_S_HALF */ +if ((edid_ext[i+14 +hdmi_vic_len] &0x80 ) ==0x80 ) + caps->format |=0x8 ;/* S_BY_S_HALF_QUINCUNX */ + }
This reads poorly, which makes me think it's wrong. Is format supposed to be a bitfield or an enum?
Quoted 1 line
+EXPORT_SYMBOL(drm_detect_3D_monitor);
I suspect this is poorly named. There exist 3D displays which are not HDMI.
drivers/gpu/drm/i915/intel_hdmi.c static void intel_hdmi_set_avi_infoframe(struct drm_encoder *encoder) · line 216
Quoted 7 lines
drivers/gpu/drm/i915/intel_hdmi.c +7
-0+#define VSIF_RESET_INDEX 0xFFFFFFF8 +#define VSIF_RESET_BIT_22 0xFFBFFFFF +#define VSIF_SET_BIT_19 0x80000 +#define VSIF_RESET_BIT_20 0xFFEFFFFF +#define VSIF_RESET_BIT_17 0x10000 +#define VSIF_SET_BIT_16 0xFFFDFFFF +#define VSIF_SET_MASTER_BIT 0x400000
i915 style is usually to write these as (1 << 22) I think.
More importantly, use semantic names for register contents. "Bit 17" doesn't mean anything.
include/drm/drm_crtc.h extern int drm_mode_gamma_set_ioctl(struct drm_device *dev, · line 802
Quoted 10 lines
include/drm/drm_crtc.h +2
-0@@ -798,6 +798,8 @@ extern int drm_mode_gamma_set_ioctl(struct drm_device *dev,extern u8 *drm_find_cea_extension (struct edid *edid);extern bool drm_detect_hdmi_monitor (struct edid *edid);extern bool drm_detect_monitor_audio (struct edid *edid); +extern bool drm_detect_3D_monitor (struct edid *edid); +//extern struct panel_3d_caps* drm_detect_3D_monitor(struct edid *edid);
Well, which is it?
include/drm/drm_crtc.h extern int drm_mode_gamma_set_ioctl(struct drm_device *dev,
Quoted 10 lines
include/drm/drm_crtc.h +10
-0+enum s3d_formats { +FRAME_PACKING =0x0 , +FIELD_ALTERNATIVE =0x1 , +LINE_ALTERNATIVE =0x2 , +SIDE_BY_SIDE_FULL =0x3 , +L_DEPTH =0x4 , +L_DEPTH_GFX_GFX_DEPTH =0x5 , +TOP_BOTTOM =0x6 ,/* 0x7 is reserved for future */ +SIDE_BY_SIDE_HALF =0x8 /* 0x9 onwards is reserved for future */ +};
If format is supposed to be an enum, why aren't you using these symbolic values?
- ajax
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Thanks for the comments. Fixed most of the issues with the earlier patch. Sending out a new one. Comments inline below.
Quoted 44 lines
-----Original Message-----
From: Adam Jackson [mailto:[email protected]]
Sent: Tuesday, December 13, 2011 9:51 PM
To: Kavuri, Sateesh
Cc: [email protected]
Subject: Re: [PATCH] drm: Enable reading 3D capabilities of 3D monitorReview
Quoted 3 lines · Sateesh
(quoted diff) +3
-0+ if ((multi_val == STRUCTURE_PRESENT) || + (multi_val == STRUCTURE_MASK_PRESENT) ) { + if ((edid_ext[i+15+hdmi_vic_len] & 0x01) ==
0x01)Review
Quoted 1 line
(quoted diff) +1
-0+ caps->format |= 0x0; /*
FRAME_PACKING*/Review
Quoted 1 line
(quoted diff) +1
-0+ if ((edid_ext[i+15+hdmi_vic_len] & 0x02) ==
0x02)Review
Quoted 1 line
(quoted diff) +1
-0+ caps->format |= 0x1;/*FIELD_ALTERNATIVE */
Review
Quoted 1 line
(quoted diff) +1
-0+ if ((edid_ext[i+15+hdmi_vic_len] & 0x04) ==
0x04)Review
Quoted 1 line
(quoted diff) +1
-0+ caps->format |= 0x2; /*
LINE_ALTERNATIVE*/Review
Quoted 1 line
(quoted diff) +1
-0+ if ((edid_ext[i+15+hdmi_vic_len] & 0x08) ==
0x08)Review
Quoted 1 line
(quoted diff) +1
-0+ caps->format |= 0x3;/*SIDE_BY_SIDE_FULL */
Review
Quoted 1 line
(quoted diff) +1
-0+ if ((edid_ext[i+15+hdmi_vic_len] & 0x10) ==
0x10)Review
Quoted 2 lines
(quoted diff) +2
-0+ caps->format |= 0x4; /* L_DEPTH */ + if ((edid_ext[i+15+hdmi_vic_len] & 0x20) ==
0x20)Review
Quoted 1 line
(quoted diff) +1
-0+ caps->format |= 0x5; /*
L_DEPTH_GFX_GFX_DEPTH*/Review
Quoted 1 line
(quoted diff) +1
-0+ if ((edid_ext[i+15+hdmi_vic_len] & 0x40) ==
0x40)Review
Quoted 2 lines
(quoted diff) +2
-0+ caps->format |= 0x6; /* TOP_BOTTOM */ + if ((edid_ext[i+14+hdmi_vic_len] & 0x01) ==
0x01)Review
Quoted 2 lines
(quoted diff) +2
-0+ caps->format |= 0x7; /* S_BY_S_HALF */ + if ((edid_ext[i+14+hdmi_vic_len] & 0x80) ==
0x80)Review
Quoted 1 line
(quoted diff) +1
-0+ caps->format |= 0x8; /*
S_BY_S_HALF_QUINCUNX*/
Quoted 8 lines
Review
Quoted 1 line
(quoted diff) +1
-0+ }This reads poorly, which makes me think it's wrong. Is format supposed to be a bitfield or an enum?
Quoted 1 line
+EXPORT_SYMBOL(drm_detect_3D_monitor);
I suspect this is poorly named. There exist 3D displays which are not HDMI.
I want to integrate the other interfaces (eDP, DP, MIPI) panel detection in this method itself. Started off with implementing the HDMI part.
Quoted 10 lines
Review
Quoted 8 lines
(quoted diff) +7
-0+#define VSIF_RESET_INDEX 0xFFFFFFF8 +#define VSIF_RESET_BIT_22 0xFFBFFFFF +#define VSIF_SET_BIT_19 0x80000 +#define VSIF_RESET_BIT_20 0xFFEFFFFF +#define VSIF_RESET_BIT_17 0x10000 +#define VSIF_SET_BIT_16 0xFFFDFFFF +#define VSIF_SET_MASTER_BIT 0x400000i915 style is usually to write these as (1 << 22) I think.
These I have fixed. Patch with these fixes below.
Quoted 17 lines
More importantly, use semantic names for register contents. "Bit 17" doesn't mean anything.
include/drm/drm_crtc.h
Quoted 10 lines
include/drm/drm_crtc.h index renamed from include/drm/drm_crtc.h +0
-08020798..5b4d09c 100644
include/drm/drm_crtc.h +0
-0@@ -798,6 +798,8 @@ extern int drm_mode_gamma_set_ioctl(struct
drm_device*dev, extern u8 *drm_find_cea_extension(struct edid *edid); extern booldrm_detect_hdmi_monitor(struct edid *edid); extern booldrm_detect_monitor_audio(struct edid *edid);include/drm/drm_crtc.h +2
-0+extern bool drm_detect_3D_monitor (struct edid *edid);//extern struct +panel_3d_caps *drm_detect_3D_monitor (struct edid *edid);Well, which is it?
Quoted 13 lines
include/drm/drm_crtc.h
Quoted 10 lines
include/drm/drm_crtc.h +10
-0+enum s3d_formats { +FRAME_PACKING =0x0 , +FIELD_ALTERNATIVE =0x1 , +LINE_ALTERNATIVE =0x2 , +SIDE_BY_SIDE_FULL =0x3 , +L_DEPTH =0x4 , +L_DEPTH_GFX_GFX_DEPTH =0x5 , +TOP_BOTTOM =0x6 ,/* 0x7 is reserved for future */ +SIDE_BY_SIDE_HALF =0x8 /* 0x9 onwards is reserved for future */ +};If format is supposed to be an enum, why aren't you using these symbolic values?
I fixed the part to use a u16 integer value to represent the format.
Quoted 2 lines
- ajax
================
Quoted 1 line
From
d4c989bc807be730b2693a843fe93d4d559c05ebMon Sep 17 00:00:00 2001
From: Sateesh Kavuri <[email protected]>
Date: Fri, 9 Dec 2011 17:08:42 +0530
Subject: [PATCH] Patch to enable reading the EDID information of a 3D capable HDMI
monitor. This EDID information would be used to enable a user
space application to switch the mode of the monitor to a specific 3D format.
--
Signed-off=by: [email protected]
--- drivers/gpu/drm/drm_edid.c | 109 ++++++++++++++++++++++++++++++++++++++++++++ include/drm/drm_crtc.h | 25 ++++++++++ 2 files changed, 134 insertions(+), 0 deletions(-)
drivers/gpu/drm/drm_edid.c +109 -0
@@ -1322,6 +1322,9 @@ add_detailed_modes(struct drm_connector *connector, struct edid *edid,#define SPEAKER_BLOCK 0x04#define EDID_BASIC_AUDIO (1 << 6) +#define MONITOR_VIDEO_PRESENT 0x01 +#define PANEL_SUPPORTS_3D 0x01 +/** * Search EDID for CEA extension block. */
@@ -1563,6 +1566,110 @@ end: }EXPORT_SYMBOL (drm_detect_hdmi_monitor); +enum { +NO_SPL_CAPS =0x0 , +STRUCTURE_PRESENT =0x1 , +STRUCTURE_MASK_PRESENT =0x2 +} are_3d_caps_present; + +/** +* drm_detect_monitor_3D - check monitor 3D capabilities +* +* Monitor should have CEA extension block. +* Check if the monitor has 3D capabilities. If it does, store the capabilitie +* to a data structure +* +*/ +struct drm_panel_3D_capabilities *drm_detect_3D_monitor (struct edid *edid) +{ +u8 *edid_ext; +int i, hdmi_id; +int start_offset, end_offset; +bool is_hdmi = false; +struct drm_panel_3D_capabilities *caps =0 ; + + edid_ext =drm_find_cea_extension (edid); +if (!edid_ext) + goto end; + +/* Data block offset in CEA extension block */ + start_offset =4 ; + end_offset = edid_ext[2 ]; + +/* 3D vars */ +int multi_present =0 ; + +/* +* Because HDMI identifier is in Vendor Specific Block, +* search it from all data blocks of CEA extension. +*/ +for (i = start_offset; i < end_offset; +/* Increased by data block len */ + i += ((edid_ext[i] &0x1f ) +1 )) { +/* Find vendor specific block */ +/* 6'th bit is the VIDEO_PRESENT bit */ +if ( ((edid_ext[i] >>5 ) ==VENDOR_BLOCK ) && + ((edid_ext[i+8 ] &0x20 ) ==MONITOR_VIDEO_PRESENT ) ) { + hdmi_id = edid_ext[i +1 ] | (edid_ext[i +2 ] <<8 ) | + edid_ext[i +3 ] <<16 ; +/* Find HDMI identifier */ +if (hdmi_id ==HDMI_IDENTIFIER ) + is_hdmi = true; + +/* Check for the 3D_Present flag */ +if ((edid_ext[i+13 ] >>6 ) ==PANEL_SUPPORTS_3D ) { + caps =kmalloc (sizeof (struct drm_panel_3D_capabilities ),GFP_KERNEL ); + caps->panel_supports_3D =1 ; + } + +/* Check if 3D_Multi_present is set */ +if ((edid_ext[i+13 ] &0x60 ) ==0x0 ) { + multi_present = true; + } + +/* Collect 3D capabilities of the monitor */ +int hdmi_3d_len =0 ; +int hdmi_vic_len =0 ; + hdmi_vic_len = (edid_ext[i+14 ] >>0x05 ); + hdmi_3d_len = ((edid_ext[i+14 ] <<0x03 ) >>0x03 ); +int multi_val = edid_ext[i+13 ] &0x6 ; +if (multi_val ==0x0 ) + multi_present =NO_SPL_CAPS ; +else if (multi_val ==0x1 ) + multi_present =STRUCTURE_PRESENT ; +else if (multi_val ==0x2 ) + multi_val =STRUCTURE_MASK_PRESENT ; + +if ((multi_val ==STRUCTURE_PRESENT ) || + (multi_val ==STRUCTURE_MASK_PRESENT ) ) { +if (edid_ext[i+15 +hdmi_vic_len] & (1 <<0 )) + caps->format |= (1 <<0 );/* FRAME_PACKING */ +if (edid_ext[i+15 +hdmi_vic_len] & (1 <<1 )) + caps->format |= (1 <<1 );/*FIELD_ALTERNATIVE */ +if (edid_ext[i+15 +hdmi_vic_len] & (1 <<2 )) + caps->format |= (1 <<2 );/* LINE_ALTERNATIVE */ +if (edid_ext[i+15 +hdmi_vic_len] &0x3 ) + caps->format |= (1 <<3 );/*SIDE_BY_SIDE_FULL */ +if (edid_ext[i+15 +hdmi_vic_len] & (1 <<4 )) + caps->format |= (1 <<4 );/* L_DEPTH */ +if (edid_ext[i+15 +hdmi_vic_len] &0x5 ) + caps->format |= (1 <<5 );/* L_DEPTH_GFX_GFX_DEPTH */ +if (edid_ext[i+15 +hdmi_vic_len] &0x6 ) + caps->format |= (1 <<6 );/* TOP_BOTTOM */ +if (edid_ext[i+14 +hdmi_vic_len] &0x7 ) + caps->format |= (1 <<7 );/* S_BY_S_HALF */ +if (edid_ext[i+14 +hdmi_vic_len] & (1 <<8 )) + caps->format |= (1 <<8 );/* S_BY_S_HALF_QUINCUNX */ + } +break ; + } + } + +end: +return caps; +} +EXPORT_SYMBOL (drm_detect_3D_monitor); +/** * drm_detect_monitor_audio - check monitor audio capability *
@@ -1630,6 +1737,7 @@ static void drm_add_display_info(struct edid *edid,/* driver figures it out in this case */ info->bpc =0 ; info->color_formats =0 ; + info->caps_3D =0 ;/* Only defined for 1.4 with digital displays */ if (edid->revision <4 )
@@ -1675,6 +1783,7 @@ static void drm_add_display_info(struct edid *edid,return ; info->cea_rev = edid_ext[1 ]; + info->caps_3D=drm_detect_3D_monitor (edid); }/**
include/drm/drm_crtc.h +25 -0
@@ -186,6 +186,28 @@ enum subpixel_order {#define DRM_COLOR_FORMAT_RGB444 (1<<0)#define DRM_COLOR_FORMAT_YCRCB444 (1<<1)#define DRM_COLOR_FORMAT_YCRCB422 (1<<2) + +enum s3d_formats_ext { +HORIZONTAL_SUB_SAMPLING =0x10 +}; + +/* Pre-defined 3D formats as per HDMI spec */ +enum s3d_formats { +FRAME_PACKING =0x0 , +FIELD_ALTERNATIVE =0x1 , +LINE_ALTERNATIVE =0x2 , +SIDE_BY_SIDE_FULL =0x3 , +L_DEPTH =0x4 , +L_DEPTH_GFX_GFX_DEPTH =0x5 , +TOP_BOTTOM =0x6 ,/* 0x7 is reserved for future */ +SIDE_BY_SIDE_HALF =0x8 /* 0x9 onwards is reserved for future */ +}; + +/* 3D capabilities */ +struct drm_panel_3D_capabilities { +u16 panel_supports_3D; +u16 format; +};/* * Describes a given display (e.g. CRT or flat panel) and its limitations. */
@@ -208,6 +230,8 @@ struct drm_display_info {u8 cea_rev;char *raw_edid;/* if any */ + +struct drm_panel_3D_capabilities *caps_3D; };struct drm_framebuffer_funcs {
@@ -798,6 +822,7 @@ extern int drm_mode_gamma_set_ioctl(struct drm_device *dev,extern u8 *drm_find_cea_extension (struct edid *edid);extern bool drm_detect_hdmi_monitor (struct edid *edid);extern bool drm_detect_monitor_audio (struct edid *edid); +extern struct drm_panel_3D_capabilities *drm_detect_3D_monitor (struct edid *edid);extern int drm_mode_page_flip_ioctl (struct drm_device *dev,void *data,struct drm_file *file_priv); extern struct drm_display_mode *drm_cvt_mode(struct drm_device *dev,
Signature · 4 lines
1.7.4.1 ================
drivers/gpu/drm/drm_edid.c end: · line 1600
Quoted 6 lines · Sateesh
drivers/gpu/drm/drm_edid.c +6
-0+/* Data block offset in CEA extension block */ + start_offset =4 ; + end_offset = edid_ext[2 ]; + +/* 3D vars */ +int multi_present =0 ;
Pretty sure kernel style frowns upon mixed decls and code.
drivers/gpu/drm/drm_edid.c end: · line 1612
Quoted 11 lines
drivers/gpu/drm/drm_edid.c +11
-0+/* +* Because HDMI identifier is in Vendor Specific Block, +* search it from all data blocks of CEA extension. +*/ +for (i = start_offset; i < end_offset; +/* Increased by data block len */ + i += ((edid_ext[i] &0x1f ) +1 )) { +/* Find vendor specific block */ +/* 6'th bit is the VIDEO_PRESENT bit */ +if ( ((edid_ext[i] >>5 ) ==VENDOR_BLOCK ) && + ((edid_ext[i+8 ] &0x20 ) ==MONITOR_VIDEO_PRESENT ) ) {
This conditional will always be false:
if ((x == VENDOR_BLOCK) &&
((y & 0x20) == 0x01))I suspect you want:
#define MONITOR_VIDEO_PRESENT (1 << 6)
...
if ((x == VENDOR_BLOCK) && (y & MONITOR_VIDEO_PRESENT)) {
...drivers/gpu/drm/drm_edid.c end: · line 1623
Quoted 11 lines
drivers/gpu/drm/drm_edid.c +11
-0+ hdmi_id = edid_ext[i +1 ] | (edid_ext[i +2 ] <<8 ) | + edid_ext[i +3 ] <<16 ; +/* Find HDMI identifier */ +if (hdmi_id ==HDMI_IDENTIFIER ) + is_hdmi = true; + +/* Check for the 3D_Present flag */ +if ((edid_ext[i+13 ] >>6 ) ==PANEL_SUPPORTS_3D ) { + caps =kmalloc (sizeof (struct drm_panel_3D_capabilities ),GFP_KERNEL ); + caps->panel_supports_3D =1 ; + }
This will probably also not do what you want. Consider what happens if edid_ext[i+13] has (1 << 7) set.
drivers/gpu/drm/drm_edid.c end: · line 1628
Quoted 4 lines
drivers/gpu/drm/drm_edid.c +4
-0+/* Check if 3D_Multi_present is set */ +if ((edid_ext[i+13 ] &0x60 ) ==0x0 ) { + multi_present = true; + }
Code and comment disagree.
drivers/gpu/drm/drm_edid.c end: · line 1635
Quoted 7 lines
drivers/gpu/drm/drm_edid.c +7
-0+ +/* Collect 3D capabilities of the monitor */ +int hdmi_3d_len =0 ; +int hdmi_vic_len =0 ; + hdmi_vic_len = (edid_ext[i+14 ] >>0x05 ); + hdmi_3d_len = ((edid_ext[i+14 ] <<0x03 ) >>0x03 ); +int multi_val = edid_ext[i+13 ] &0x6 ;
Note: multi_val can only have the values {0, 2, 4, 6} now.
drivers/gpu/drm/drm_edid.c end: · line 1639
Quoted 4 lines
drivers/gpu/drm/drm_edid.c +4
-0+if (multi_val ==0x0 ) + multi_present =NO_SPL_CAPS ; +else if (multi_val ==0x1 ) + multi_present =STRUCTURE_PRESENT ;
These two assignments (and the one above) are the only use of the multi_present variable, it's never used in a subsequent conditional or passed back to the caller.
The 'else' here can never be true, as noted above.
Quoted 11 lines
drivers/gpu/drm/drm_edid.c +11
-0+if ((multi_val ==STRUCTURE_PRESENT ) || + (multi_val ==STRUCTURE_MASK_PRESENT ) ) { +if (edid_ext[i+15 +hdmi_vic_len] & (1 <<0 )) + caps->format |= (1 <<0 );/* FRAME_PACKING */ +if (edid_ext[i+15 +hdmi_vic_len] & (1 <<1 )) + caps->format |= (1 <<1 );/*FIELD_ALTERNATIVE */ +if (edid_ext[i+15 +hdmi_vic_len] & (1 <<2 )) + caps->format |= (1 <<2 );/* LINE_ALTERNATIVE */ +if (edid_ext[i+15 +hdmi_vic_len] &0x3 ) + caps->format |= (1 <<3 );/*SIDE_BY_SIDE_FULL */ +if (edid_ext[i+15 +hdmi_vic_len] & (1 <<4 ))
drivers/gpu/drm/drm_edid.c end: · line 1663
Quoted 10 lines
drivers/gpu/drm/drm_edid.c +10
-0+ caps->format |= (1 <<4 );/* L_DEPTH */ +if (edid_ext[i+15 +hdmi_vic_len] &0x5 ) + caps->format |= (1 <<5 );/* L_DEPTH_GFX_GFX_DEPTH */ +if (edid_ext[i+15 +hdmi_vic_len] &0x6 ) + caps->format |= (1 <<6 );/* TOP_BOTTOM */ +if (edid_ext[i+14 +hdmi_vic_len] &0x7 ) + caps->format |= (1 <<7 );/* S_BY_S_HALF */ +if (edid_ext[i+14 +hdmi_vic_len] & (1 <<8 )) + caps->format |= (1 <<8 );/* S_BY_S_HALF_QUINCUNX */ + }
Here you've made it clear that ->format is a bitfield, but the values should be in a header (so drivers can use them) and this code should only be using the symbolic names.
drivers/gpu/drm/drm_edid.c static void drm_add_display_info(struct edid *edid, · line 1789
Quoted 8 lines
drivers/gpu/drm/drm_edid.c +1
-0@@ -1675,6 +1783,7 @@ static void drm_add_display_info(struct edid *edid,return ; info->cea_rev = edid_ext[1 ]; + info->caps_3D=drm_detect_3D_monitor (edid); }/**
Whitespace.
include/drm/drm_crtc.h enum subpixel_order { · line 204
Quoted 11 lines
include/drm/drm_crtc.h +11
-0+/* Pre-defined 3D formats as per HDMI spec */ +enum s3d_formats { +FRAME_PACKING =0x0 , +FIELD_ALTERNATIVE =0x1 , +LINE_ALTERNATIVE =0x2 , +SIDE_BY_SIDE_FULL =0x3 , +L_DEPTH =0x4 , +L_DEPTH_GFX_GFX_DEPTH =0x5 , +TOP_BOTTOM =0x6 ,/* 0x7 is reserved for future */ +SIDE_BY_SIDE_HALF =0x8 /* 0x9 onwards is reserved for future */ +};
These don't match the bit shifts you used earlier.
- ajax
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel