@@ -367,10 +367,11 @@ pub struct PersistentDisplayData {
367367}
368368
369369#[ derive( Debug ) ]
370- pub struct DefaultProperty {
370+ pub struct DefaultProperty < T = ( ) > {
371371 pub name : & ' static str ,
372372 pub prop : DrmProperty ,
373373 pub value : u64 ,
374+ pub t : T ,
374375}
375376
376377#[ derive( Debug ) ]
@@ -1022,12 +1023,15 @@ enum DefaultValue {
10221023 RangeMax ,
10231024}
10241025
1025- fn create_default_properties (
1026+ fn create_default_properties < T > (
10261027 props : & CollectedProperties ,
1027- defaults : & [ ( & ' static str , DefaultValue ) ] ,
1028- ) -> Vec < DefaultProperty > {
1028+ defaults : & [ ( & ' static str , DefaultValue , T ) ] ,
1029+ ) -> Vec < DefaultProperty < T > >
1030+ where
1031+ T : Copy ,
1032+ {
10291033 let mut res = vec ! [ ] ;
1030- ' outer: for & ( name, def) in defaults {
1034+ ' outer: for & ( name, def, t ) in defaults {
10311035 if let Some ( ( definition, _) ) = props. props . get ( name. as_bytes ( ) . as_bstr ( ) ) {
10321036 let value = match def {
10331037 DefaultValue :: Fixed ( v) => v,
@@ -1067,6 +1071,7 @@ fn create_default_properties(
10671071 name,
10681072 prop : definition. id ,
10691073 value,
1074+ t,
10701075 } ) ;
10711076 }
10721077 }
@@ -1368,14 +1373,14 @@ fn create_connector_display_data(
13681373 let default_properties = create_default_properties (
13691374 & props,
13701375 & [
1371- ( "Broadcast RGB" , DefaultValue :: Enum ( "Automatic" ) ) ,
1372- ( "HDR_SOURCE_METADATA" , DefaultValue :: Fixed ( 0 ) ) ,
1373- ( "Output format" , DefaultValue :: Enum ( "Default" ) ) ,
1374- ( "WRITEBACK_FB_ID" , DefaultValue :: Fixed ( 0 ) ) ,
1375- ( "WRITEBACK_OUT_FENCE_PTR" , DefaultValue :: Fixed ( 0 ) ) ,
1376- ( "content type" , DefaultValue :: Enum ( "No Data" ) ) ,
1377- ( "dither" , DefaultValue :: Enum ( "off" ) ) ,
1378- ( "max bpc" , DefaultValue :: RangeMax ) ,
1376+ ( "Broadcast RGB" , DefaultValue :: Enum ( "Automatic" ) , ( ) ) ,
1377+ ( "HDR_SOURCE_METADATA" , DefaultValue :: Fixed ( 0 ) , ( ) ) ,
1378+ ( "Output format" , DefaultValue :: Enum ( "Default" ) , ( ) ) ,
1379+ ( "WRITEBACK_FB_ID" , DefaultValue :: Fixed ( 0 ) , ( ) ) ,
1380+ ( "WRITEBACK_OUT_FENCE_PTR" , DefaultValue :: Fixed ( 0 ) , ( ) ) ,
1381+ ( "content type" , DefaultValue :: Enum ( "No Data" ) , ( ) ) ,
1382+ ( "dither" , DefaultValue :: Enum ( "off" ) , ( ) ) ,
1383+ ( "max bpc" , DefaultValue :: RangeMax , ( ) ) ,
13791384 ] ,
13801385 ) ;
13811386 let hdr_metadata_prop = props
@@ -1484,10 +1489,10 @@ fn create_crtc(
14841489 let default_properties = create_default_properties (
14851490 & props,
14861491 & [
1487- ( "AMD_CRTC_REGAMMA_TF" , DefaultValue :: Enum ( "Default" ) ) ,
1488- ( "CTM" , DefaultValue :: Fixed ( 0 ) ) ,
1489- ( "DEGAMMA_LUT" , DefaultValue :: Fixed ( 0 ) ) ,
1490- ( "OUT_FENCE_PTR" , DefaultValue :: Fixed ( 0 ) ) ,
1492+ ( "AMD_CRTC_REGAMMA_TF" , DefaultValue :: Enum ( "Default" ) , ( ) ) ,
1493+ ( "CTM" , DefaultValue :: Fixed ( 0 ) , ( ) ) ,
1494+ ( "DEGAMMA_LUT" , DefaultValue :: Fixed ( 0 ) , ( ) ) ,
1495+ ( "OUT_FENCE_PTR" , DefaultValue :: Fixed ( 0 ) , ( ) ) ,
14911496 ] ,
14921497 ) ;
14931498 let mode_id = props. get ( "MODE_ID" ) ?. map ( |v| DrmBlob ( v as u32 ) ) ;
@@ -1604,18 +1609,18 @@ fn create_plane(plane: DrmPlane, master: &Rc<DrmMaster>) -> Result<MetalPlane, D
16041609 let default_properties = create_default_properties (
16051610 & props,
16061611 & [
1607- ( "AMD_PLANE_BLEND_LUT" , DefaultValue :: Fixed ( 0 ) ) ,
1608- ( "AMD_PLANE_BLEND_TF" , DefaultValue :: Enum ( "Default" ) ) ,
1609- ( "AMD_PLANE_CTM" , DefaultValue :: Fixed ( 0 ) ) ,
1610- ( "AMD_PLANE_DEGAMMA_LUT" , DefaultValue :: Fixed ( 0 ) ) ,
1611- ( "AMD_PLANE_HDR_MULT" , DefaultValue :: Fixed ( 0 ) ) ,
1612- ( "AMD_PLANE_LUT3D" , DefaultValue :: Fixed ( 0 ) ) ,
1613- ( "AMD_PLANE_SHAPER_LUT" , DefaultValue :: Fixed ( 0 ) ) ,
1614- ( "AMD_PLANE_SHAPER_TF" , DefaultValue :: Enum ( "Default" ) ) ,
1615- ( "alpha" , DefaultValue :: RangeMax ) ,
1616- ( "pixel blend mode" , DefaultValue :: Enum ( "Pre-multiplied" ) ) ,
1617- ( "rotation" , DefaultValue :: Bitmask ( & [ "rotate-0" ] ) ) ,
1618- ( "COLOR_PIPELINE" , DefaultValue :: Enum ( "Bypass" ) ) ,
1612+ ( "AMD_PLANE_BLEND_LUT" , DefaultValue :: Fixed ( 0 ) , ( ) ) ,
1613+ ( "AMD_PLANE_BLEND_TF" , DefaultValue :: Enum ( "Default" ) , ( ) ) ,
1614+ ( "AMD_PLANE_CTM" , DefaultValue :: Fixed ( 0 ) , ( ) ) ,
1615+ ( "AMD_PLANE_DEGAMMA_LUT" , DefaultValue :: Fixed ( 0 ) , ( ) ) ,
1616+ ( "AMD_PLANE_HDR_MULT" , DefaultValue :: Fixed ( 0 ) , ( ) ) ,
1617+ ( "AMD_PLANE_LUT3D" , DefaultValue :: Fixed ( 0 ) , ( ) ) ,
1618+ ( "AMD_PLANE_SHAPER_LUT" , DefaultValue :: Fixed ( 0 ) , ( ) ) ,
1619+ ( "AMD_PLANE_SHAPER_TF" , DefaultValue :: Enum ( "Default" ) , ( ) ) ,
1620+ ( "alpha" , DefaultValue :: RangeMax , ( ) ) ,
1621+ ( "pixel blend mode" , DefaultValue :: Enum ( "Pre-multiplied" ) , ( ) ) ,
1622+ ( "rotation" , DefaultValue :: Bitmask ( & [ "rotate-0" ] ) , ( ) ) ,
1623+ ( "COLOR_PIPELINE" , DefaultValue :: Enum ( "Bypass" ) , ( ) ) ,
16191624 ] ,
16201625 ) ;
16211626 let in_fence_fd = props. get ( "IN_FENCE_FD" ) ?;
0 commit comments