rockchip: refactor handling of hdmi output mode

Signed-off-by: hmz007 <hmz007@gmail.com>
master
hmz007 5 years ago
parent 01d53c55c9
commit 7c287c2cb2

@ -142,19 +142,20 @@ public class RkDisplayModes {
}
private String readColorFormatFromNode(){
FileReader fr=null;
BufferedReader br=null;
String line="";
FileReader fr = null;
BufferedReader br = null;
String line = "";
String mode = null;
try {
fr = new FileReader(HDMI_DBG_STATUS);
} catch (FileNotFoundException e) {
Log.e(TAG, "Couldn't find or open file "+HDMI_DBG_STATUS, e);
return null;
Log.e(TAG, "Failed to open file: " + e.getMessage());
return mode;
}
br=new BufferedReader(fr);
br = new BufferedReader(fr);
try {
while ((line=br.readLine())!=null) {
while ((line = br.readLine()) != null) {
if (line.contains("Color Format:")) {
StringBuilder builder = new StringBuilder();
int start = line.indexOf("Format:");
@ -171,17 +172,17 @@ public class RkDisplayModes {
builder.append(STR_YCBCR420).append("-").append(depth).append("bit");
else
builder.append(format).append("-").append(depth).append("bit");
Log.e(TAG, "readColorFormatFromNode :" + builder.toString());
return builder.toString();
mode = builder.toString();
Log.e(TAG, "readColorFormatFromNode :" + mode);
break;
}
}
br.close();
fr.close();
return null;
} catch (IOException e) {
Log.e(TAG, "Couldn't read data from /d/dw-hdmi/status", e);
return null;
Log.e(TAG, "Couldn't read data from " + HDMI_DBG_STATUS, e);
}
return mode;
}
private static boolean readModeWhiteList(String pathname) {
@ -744,10 +745,9 @@ public class RkDisplayModes {
if (mColorMode != null)
mCurColorMode = mColorMode;
if (mCurColorMode == null)
mCurColorMode = "RGB-8bit";
if (mCurColorMode.equals("")) {
mCurColorMode = "RGB-8bit";
else if (mCurColorMode.equals(""))
mCurColorMode = "Auto";
}
Log.d(TAG, "getCurColorMode =========== " + mCurColorMode);
return mCurColorMode;
}

@ -987,9 +987,10 @@ static int hw_output_get_cur_color_mode(struct hw_output_device* dev, int dpy, c
mBaseParmeter->get_disp_info(mCurConnector->get_type(), mCurConnector->connector_id(), &dispInfo);
int slot = findSuitableInfoSlot(&dispInfo, mCurConnector->get_type(), mCurConnector->connector_id());
if (dispInfo.screen_info[slot].depthc == Automatic &&
dispInfo.screen_info[slot].format == output_ycbcr_high_subsampling)
dispInfo.screen_info[slot].format == output_ycbcr_high_subsampling) {
sprintf(colorMode, "%s", "Auto");
}
}
sprintf(curColorMode, "%s", colorMode);
ALOGD("nativeGetCurCorlorMode: colorMode=%s", colorMode);

Loading…
Cancel
Save