Skip to content

HDMI display support for raspberry pi based platforms - #610

Merged
dwalton76 merged 8 commits into
ev3dev:ev3dev-stretchfrom
dwalton76:brickpi3-display
Apr 6, 2019
Merged

dwalton76 merged 8 commits into
ev3dev:ev3dev-stretchfrom
dwalton76:brickpi3-display

Conversation

@dwalton76

Copy link
Copy Markdown
Collaborator

No description provided.

@dwalton76

Copy link
Copy Markdown
Collaborator Author

Will also fix this while in this area

Exception ignored in: <bound method FbMem.__del__ of <ev3dev2.display.Display object at 0x76535480>>
Traceback (most recent call last):
  File "/home/robot/ev3dev-lang-python/ev3dev2/display.py", line 158, in __del__
AttributeError: 'NoneType' object has no attribute '_close_fbdev'

@dlech

dlech commented Mar 26, 2019

Copy link
Copy Markdown
Member

BirckPi3 doesn't have a display.

@dwalton76

Copy link
Copy Markdown
Collaborator Author

Poorly worded title on my part..."HDMI display support for raspberry pi based platforms" maybe? Even then though the code itself is checking that platform is brickpi3 so feels kinda clunky.

@dlech

dlech commented Mar 26, 2019

Copy link
Copy Markdown
Member

Ah, so really the Raspberry Pi HDMI out.

@dwalton76 dwalton76 changed the title Display support for brickpi3 HDMI display support for raspberry pi based platforms Mar 26, 2019
@dwalton76

Copy link
Copy Markdown
Collaborator Author

This __del__ in FbMem is problematic. Even after adding the if FbMem check that is sometimes true only for us to barf on line 186 because the os module has been purged

183     @staticmethod
184     def _close_fbdev(fbfid):
185         """Close the framebuffer file descriptor."""
186         os.close(fbfid)

traceback

Exception ignored in: <bound method FbMem.__del__ of <ev3dev2.display.Display object at 0x766d8c90>>
Traceback (most recent call last):
  File "/home/robot/ev3dev-lang-python/ev3dev2/display.py", line 169, in __del__
  File "/home/robot/ev3dev-lang-python/ev3dev2/display.py", line 186, in _close_fbdev
TypeError: 'NoneType' object is not callable

I am not familiar with the FbMem history, anyone know why we have this __del__?

@WasabiFan

Copy link
Copy Markdown
Member

That __del__ implementation has been there since initial display support: ab003c6

Not sure how it is supposed to work exactly.

This PR looks good after that's sorted out though.

Comment thread ev3dev2/display.py Outdated
elif self.var_info.bits_per_pixel == 16:
im_type = "RGB"
elif self.platform == "ev3" and self.var_info.bits_per_pixel == 32:
elif ((self.platform == "ev3" or self.platform in platforms_with_hdmi_display) and

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need to check for "platform" by name here at all. Just check for 32 bits per pixel and not EV3. im_type = "L" means grayscale, so I don't think we want this for HDMI otherwise you won't be able to do anything in color.

Maybe something like this?

        elif self.platform == "ev3" and self.var_info.bits_per_pixel == 32:
            im_type = "L"
        elif self.var_info.bits_per_pixel == 16 or self.var_info.bits_per_pixel == 32:
            im_type = "RGB"

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whether L or RGB is used for brickpi3 the screen has this yellow/green color
IMG_7464

via

display = Display()

display_font = "luBS24"
x_grid = 4
y_grid = 4
display.text_grid("BAR", clear_screen=True, x=x_grid, y=y_grid, font=display_font)
display.update()
sys.exit(0)

Not a huge deal at this point as any display at all is a step in the right direction but I haven't figured out yet where this color is coming from.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recall there's a code path which uses something like a 5-6-5 bit width pattern... is it possible that that's somehow involved?

You could probably get a good clue about what's going on if you looked at a dump of the raw data it's writing to the framebuffer.

Comment thread ev3dev2/display.py Resolved
@dwalton76

Copy link
Copy Markdown
Collaborator Author

That __del__ implementation has been there since initial display support: ab003c6

Not sure how it is supposed to work exactly.

This PR looks good after that's sorted out though.

From reading this:
https://stackoverflow.com/questions/1481488/what-is-the-del-method-how-to-call-it

It sounds like we should not be using __del__. I am going to remove it and do some testing (on brickpi3 and EV3) and see if anything crops up.

Comment thread ev3dev2/display.py
"""Close the FbMem framebuffer memory object."""
self.mmap.close()
FbMem._close_fbdev(self.fid)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have been testing on an EV3 and all seems fine without this __del__

@dwalton76

Copy link
Copy Markdown
Collaborator Author

No luck figuring out where that green/yellow color is coming from. It isn't that important to me right now and this is a step in the right direction so am going to go ahead and merge it. We can dig into the green/yellow thing later if it becomes a more significant issues for someone.

@dwalton76
dwalton76 merged commit e821b47 into ev3dev:ev3dev-stretch Apr 6, 2019
@dwalton76
dwalton76 deleted the brickpi3-display branch April 6, 2019 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants